diff --git a/camunda_connect/camunda_connect.go b/camunda_connect/camunda_connect.go index 2b0329bb..d4a8becd 100644 --- a/camunda_connect/camunda_connect.go +++ b/camunda_connect/camunda_connect.go @@ -75,27 +75,41 @@ func FillSettings() { } -// Connect - подключается к серверу Camunda +// Connect_err - подключается к серверу Camunda, паника при ошибке func Connect() { + err := Connect_err() + if err != nil { + log.Panic("Connect_err() error: ", err) + } else { + log.Info("CAMUNDA connected, ip: ", Settings.CAMUNDA_HOST, " port: ", Settings.CAMUNDA_PORT) + } +} + +// Connect_err - подключается к серверу Camunda, возвращает ошибку +func Connect_err() error { var err error if Settings.CAMUNDA_HOST == "" { FillSettings() } - port_checker.CheckPort(Settings.CAMUNDA_HOST, Settings.CAMUNDA_PORT) + err = port_checker.CheckPort_err(Settings.CAMUNDA_HOST, Settings.CAMUNDA_PORT) + if err != nil { + return err + } Client, err = zbc.NewClient(&zbc.ClientConfig{ GatewayAddress: GetURL(), UsePlaintextConnection: true, }) if err != nil { - log.Fatal(err) + return err } - log.Infoln("CAMUNDA connected. ip: ", Settings.CAMUNDA_HOST) + //log.Infoln("CAMUNDA connected. ip: ", Settings.CAMUNDA_HOST) // JobWorker = Client.NewJobWorker().JobType(CAMUNDA_ID).Handler(HandleJob).Open() + return err } // CloseConnection - отключается от сервера Camunda @@ -226,7 +240,22 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup, HandleJob func(c stopapp.SetWaitGroup_Main(WaitGroup) // - StartCamunda(HandleJob, CAMUNDA_JOBTYPE, BPMN_filename) + // var err error + + err = Connect_err() + if err != nil { + return err + } + + JobWorker = Client.NewJobWorker().JobType(CAMUNDA_JOBTYPE).Handler(HandleJob).Open() + + Send_BPMN_File(BPMN_filename) + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() + + stopapp.GetWaitGroup_Main().Add(1) + go ping_go() return err } diff --git a/chatgpt_connect/chatgpt_connect.go b/chatgpt_connect/chatgpt_connect.go index 30d2d323..149efe37 100644 --- a/chatgpt_connect/chatgpt_connect.go +++ b/chatgpt_connect/chatgpt_connect.go @@ -159,7 +159,13 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup) error { stopapp.SetWaitGroup_Main(WaitGroup) // - Start() + err = Connect_err() + if err != nil { + return err + } + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() return err } diff --git a/chatgpt_proxy/chatgpt_proxy.go b/chatgpt_proxy/chatgpt_proxy.go index 09790cfd..d0365ba1 100644 --- a/chatgpt_proxy/chatgpt_proxy.go +++ b/chatgpt_proxy/chatgpt_proxy.go @@ -155,7 +155,13 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup) error { stopapp.SetWaitGroup_Main(WaitGroup) // - Start() + err = Connect_err() + if err != nil { + return err + } + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() return err } diff --git a/email/email.go b/email/email.go index b93650a1..6dbdb232 100644 --- a/email/email.go +++ b/email/email.go @@ -256,7 +256,15 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup) error { stopapp.SetWaitGroup_Main(WaitGroup) // - Start() + LoadEnv() + err = Connect_err() + + if err != nil { + return err + } + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() return err } diff --git a/email_imap/email_imap.go b/email_imap/email_imap.go index 77d5822c..1b7065c4 100644 --- a/email_imap/email_imap.go +++ b/email_imap/email_imap.go @@ -268,7 +268,7 @@ func WaitStop() { // Start - необходимые процедуры для подключения к серверу email imap func Start() { LoadEnv() - Connect_err() + Connect() stopapp.GetWaitGroup_Main().Add(1) go WaitStop() @@ -286,7 +286,14 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup) error { stopapp.SetWaitGroup_Main(WaitGroup) // - Start() + LoadEnv() + err = Connect_err() + if err != nil { + return err + } + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() return err } diff --git a/fiber_connect/fiber_connect.go b/fiber_connect/fiber_connect.go index 1230bd64..52d38b2c 100644 --- a/fiber_connect/fiber_connect.go +++ b/fiber_connect/fiber_connect.go @@ -129,8 +129,8 @@ func Start() { // Start_ctx - запускает работу веб-сервера // Свой контекст и WaitGroup нужны для остановки работы сервиса Graceful shutdown // Для тех кто пользуется этим репозиторием для старта и останова сервиса можно просто Start() -func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup) error { - var err error +func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup) { + //var err error //запомним к себе контекст и WaitGroup contextmain.Ctx = ctx @@ -139,7 +139,6 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup) error { // Start() - return err } // CloseConnection - закрывает соединения веб-сервера, возвращает ошибку diff --git a/go.mod b/go.mod index cb1ad8e2..3de3ad52 100644 --- a/go.mod +++ b/go.mod @@ -1,68 +1,68 @@ module github.com/ManyakRus/starter -go 1.22 +go 1.22.0 toolchain go1.22.1 require ( github.com/ManyakRus/logrus v0.0.0-20231019115155-9e6fede0d792 - github.com/camunda/zeebe/clients/go/v8 v8.5.3 - github.com/cockroachdb/pebble v1.1.1 + github.com/camunda/zeebe/clients/go/v8 v8.5.7 + github.com/cockroachdb/pebble v1.1.2 github.com/denisenkom/go-mssqldb v0.12.3 github.com/emersion/go-imap v1.2.1 github.com/emersion/go-message v0.18.1 github.com/go-faster/errors v0.7.1 - github.com/gofiber/fiber/v2 v2.52.4 + github.com/gofiber/fiber/v2 v2.52.5 github.com/golang-module/carbon/v2 v2.3.12 github.com/google/uuid v1.6.0 github.com/gotd/contrib v0.20.0 - github.com/gotd/td v0.104.0 - github.com/jackc/pgx/v5 v5.6.0 + github.com/gotd/td v0.110.1 + github.com/jackc/pgx/v5 v5.7.1 github.com/jmoiron/sqlx v1.4.0 github.com/joho/godotenv v1.5.1 - github.com/klauspost/compress v1.17.9 + github.com/klauspost/compress v1.17.10 github.com/lib/pq v1.10.9 - github.com/mattn/go-sqlite3 v1.14.22 + github.com/mattn/go-sqlite3 v1.14.23 github.com/mdp/qrterminal/v3 v3.2.0 - github.com/minio/minio-go/v7 v7.0.72 - github.com/nats-io/nats.go v1.36.0 + github.com/minio/minio-go/v7 v7.0.77 + github.com/nats-io/nats.go v1.37.0 github.com/rugatling/go-openai v0.0.0-20240619084423-aeaffca189bb - github.com/sashabaranov/go-openai v1.26.0 + github.com/sashabaranov/go-openai v1.31.0 github.com/segmentio/kafka-go v0.4.47 github.com/xhit/go-simple-mail/v2 v2.16.0 - gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange v0.0.20 - gitlab.aescorp.ru/dsp_dev/claim/sync_service v1.2.138 - go.etcd.io/bbolt v1.3.10 - go.mau.fi/whatsmeow v0.0.0-20240619210240-329c2336a6f1 + gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange v0.0.23 + gitlab.aescorp.ru/dsp_dev/claim/sync_service v1.2.159 + go.etcd.io/bbolt v1.3.11 + go.mau.fi/whatsmeow v0.0.0-20240924123543-d5cecea9882e go.uber.org/zap v1.27.0 - golang.org/x/crypto v0.24.0 - golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 - golang.org/x/time v0.5.0 + golang.org/x/crypto v0.27.0 + golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 gopkg.in/natefinch/lumberjack.v2 v2.2.1 gorm.io/driver/postgres v1.5.9 gorm.io/driver/sqlserver v1.5.3 - gorm.io/gorm v1.25.10 + gorm.io/gorm v1.25.12 ) require ( filippo.io/edwards25519 v1.1.0 // indirect - github.com/DataDog/zstd v1.5.5 // indirect + github.com/DataDog/zstd v1.5.6 // indirect github.com/andybalholm/brotli v1.1.0 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cockroachdb/errors v1.11.3 // indirect - github.com/cockroachdb/fifo v0.0.0-20240616162244-4768e80dfb9a // indirect + github.com/cockroachdb/fifo v0.0.0-20240816210425-c5d0cb0b6fc0 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/emersion/go-sasl v0.0.0-20231106173351-e73c9f7bad43 // indirect - github.com/getsentry/sentry-go v0.28.1 // indirect + github.com/getsentry/sentry-go v0.29.0 // indirect github.com/go-faster/jx v1.1.0 // indirect github.com/go-faster/xor v1.0.0 // indirect + github.com/go-ini/ini v1.67.0 // indirect github.com/go-ozzo/ozzo-validation/v4 v4.3.0 // indirect github.com/go-test/deep v1.1.0 // indirect github.com/goccy/go-json v0.10.3 // indirect @@ -76,7 +76,7 @@ require ( github.com/gotd/neo v0.1.5 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect - github.com/jackc/puddle/v2 v2.2.1 // indirect + github.com/jackc/puddle/v2 v2.2.2 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/klauspost/cpuid/v2 v2.2.8 // indirect @@ -84,49 +84,49 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/mattn/go-runewidth v0.0.16 // indirect github.com/microsoft/go-mssqldb v1.7.2 // indirect github.com/minio/md5-simd v1.1.2 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/nats-io/nkeys v0.4.7 // indirect github.com/nats-io/nuid v1.0.1 // indirect github.com/pierrec/lz4/v4 v4.1.21 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.4 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.54.0 // indirect + github.com/prometheus/common v0.59.1 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rivo/uniseg v0.4.7 // indirect - github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/rs/xid v1.5.0 // indirect + github.com/rogpeppe/go-internal v1.13.1 // indirect + github.com/rs/xid v1.6.0 // indirect github.com/rs/zerolog v1.33.0 // indirect github.com/segmentio/asm v1.2.0 // indirect github.com/stretchr/testify v1.9.0 // indirect github.com/syndtr/goleveldb v1.0.0 // indirect github.com/toorop/go-dkim v0.0.0-20240103092955-90b7d1423f92 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect - github.com/valyala/fasthttp v1.55.0 // indirect + github.com/valyala/fasthttp v1.56.0 // indirect github.com/valyala/tcplisten v1.0.0 // indirect github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect - go.mau.fi/libsignal v0.1.0 // indirect - go.mau.fi/util v0.5.0 // indirect - go.opentelemetry.io/otel v1.27.0 // indirect - go.opentelemetry.io/otel/trace v1.27.0 // indirect + go.mau.fi/libsignal v0.1.1 // indirect + go.mau.fi/util v0.8.0 // indirect + go.opentelemetry.io/otel v1.30.0 // indirect + go.opentelemetry.io/otel/trace v1.30.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/term v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4 // indirect - google.golang.org/grpc v1.64.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/term v0.24.0 // indirect + golang.org/x/text v0.18.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - nhooyr.io/websocket v1.8.11 // indirect + nhooyr.io/websocket v1.8.17 // indirect rsc.io/qr v0.2.0 // indirect ) diff --git a/go.sum b/go.sum index b2cfd6c7..b613fb65 100644 --- a/go.sum +++ b/go.sum @@ -27,8 +27,8 @@ github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDm github.com/AzureAD/microsoft-authentication-library-for-go v1.1.0/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 h1:DzHpqpoJVaCgOUdVHxE8QB52S6NiVdDQvGlny1qvPqA= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= -github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/DataDog/zstd v1.5.6 h1:LbEglqepa/ipmmQJUDnSsfvA8e8IStVcGaFWDuxvGOY= +github.com/DataDog/zstd v1.5.6/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/ManyakRus/logrus v0.0.0-20231019115155-9e6fede0d792 h1:bxwxD0H3kSUAH3uNk/b74gkImcUiP7dyibmMoVwk338= github.com/ManyakRus/logrus v0.0.0-20231019115155-9e6fede0d792/go.mod h1:OUyxCVbPW/2lC1e6cM7Am941SJiC88BhNnb24x2R3a8= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= @@ -38,8 +38,8 @@ github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3d github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/camunda/zeebe/clients/go/v8 v8.5.3 h1:froVKeE0Mdgu8gii4BuRU1cZ+BzvMbDlo6qzQVghhZ4= -github.com/camunda/zeebe/clients/go/v8 v8.5.3/go.mod h1:mx6wq3Z6Mfjda3yDe6Pl1G6BjX+VjkYYtWgoRQPgoFQ= +github.com/camunda/zeebe/clients/go/v8 v8.5.7 h1:nlDBz6qWUOSg+DaJYf1MSUFX1O5cyqX1tANSx9QH9Bg= +github.com/camunda/zeebe/clients/go/v8 v8.5.7/go.mod h1:uhvn2GApZjPX+H95pNDCKMYvZRJNzWLkKa7GD3urCgM= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= @@ -48,12 +48,12 @@ github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaY github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= -github.com/cockroachdb/fifo v0.0.0-20240616162244-4768e80dfb9a h1:f52TdbU4D5nozMAhO9TvTJ2ZMCXtN4VIAmfrrZ0JXQ4= -github.com/cockroachdb/fifo v0.0.0-20240616162244-4768e80dfb9a/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= +github.com/cockroachdb/fifo v0.0.0-20240816210425-c5d0cb0b6fc0 h1:pU88SPhIFid6/k0egdR5V6eALQYq2qbSmukrkgIh/0A= +github.com/cockroachdb/fifo v0.0.0-20240816210425-c5d0cb0b6fc0/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v1.1.1 h1:XnKU22oiCLy2Xn8vp1re67cXg4SAasg/WDt1NtcRFaw= -github.com/cockroachdb/pebble v1.1.1/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= +github.com/cockroachdb/pebble v1.1.2 h1:CUh2IPtR4swHlEj48Rhfzw6l/d0qA31fItcIszQVIsA= +github.com/cockroachdb/pebble v1.1.2/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= @@ -79,8 +79,8 @@ github.com/emersion/go-sasl v0.0.0-20231106173351-e73c9f7bad43 h1:hH4PQfOndHDlpz github.com/emersion/go-sasl v0.0.0-20231106173351-e73c9f7bad43/go.mod h1:iL2twTeMvZnrg54ZoPDNfJaJaqy0xIQFuBdrLsmspwQ= github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594/go.mod h1:aqO8z8wPrjkscevZJFVE1wXJrLpC5LtJG7fqLOsPb2U= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/getsentry/sentry-go v0.28.1 h1:zzaSm/vHmGllRM6Tpx1492r0YDzauArdBfkJRtY6P5k= -github.com/getsentry/sentry-go v0.28.1/go.mod h1:1fQZ+7l7eeJ3wYi82q5Hg8GqAPgefRq+FP/QhafYVgg= +github.com/getsentry/sentry-go v0.29.0 h1:YtWluuCFg9OfcqnaujpY918N/AhCCwarIDWOYSBAjCA= +github.com/getsentry/sentry-go v0.29.0/go.mod h1:jhPesDAL0Q0W2+2YEuVOvdWmVtdsr1+jtBrlDEVWwLY= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-faster/errors v0.7.1 h1:MkJTnDoEdi9pDabt1dpWf7AA8/BaSYZqibYyhZ20AYg= @@ -90,6 +90,8 @@ github.com/go-faster/jx v1.1.0/go.mod h1:vKDNikrKoyUmpzaJ0OkIkRQClNHFX/nF3dnTJZb github.com/go-faster/xor v0.3.0/go.mod h1:x5CaDY9UKErKzqfRfFZdfu+OSTfoZny3w5Ak7UxcipQ= github.com/go-faster/xor v1.0.0 h1:2o8vTOgErSGHP3/7XwA5ib1FTtUsNtwCoLLBjl31X38= github.com/go-faster/xor v1.0.0/go.mod h1:x5CaDY9UKErKzqfRfFZdfu+OSTfoZny3w5Ak7UxcipQ= +github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= +github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-ozzo/ozzo-validation/v4 v4.3.0 h1:byhDUpfEwjsVQb1vBunvIjh2BHQ9ead57VkAEY4V+Es= github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRiTzuqKbvfrL2RxCj6Ew= github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= @@ -99,8 +101,8 @@ github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncV github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofiber/fiber/v2 v2.52.4 h1:P+T+4iK7VaqUsq2PALYEfBBo6bJZ4q3FP8cZ84EggTM= -github.com/gofiber/fiber/v2 v2.52.4/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ= +github.com/gofiber/fiber/v2 v2.52.5 h1:tWoP1MJQjGEe4GB5TUGOi7P2E0ZMMRx5ZTG4rT+yGMo= +github.com/gofiber/fiber/v2 v2.52.5/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.4.3/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= @@ -136,8 +138,8 @@ github.com/gotd/ige v0.2.2 h1:XQ9dJZwBfDnOGSTxKXBGP4gMud3Qku2ekScRjDWWfEk= github.com/gotd/ige v0.2.2/go.mod h1:tuCRb+Y5Y3eNTo3ypIfNpQ4MFjrnONiL2jN2AKZXmb0= github.com/gotd/neo v0.1.5 h1:oj0iQfMbGClP8xI59x7fE/uHoTJD7NZH9oV1WNuPukQ= github.com/gotd/neo v0.1.5/go.mod h1:9A2a4bn9zL6FADufBdt7tZt+WMhvZoc5gWXihOPoiBQ= -github.com/gotd/td v0.104.0 h1:RxpRITAOJlCinTdHFVQSRMFZ6Sm4N8vnvJ2PxgwzaJA= -github.com/gotd/td v0.104.0/go.mod h1:aVe5/LP/nNIyAqaW3CwB0Ckum+MkcfvazwMOLHV0bqQ= +github.com/gotd/td v0.110.1 h1:worMp6CqduQye2NfkuBFhYe6kyt/f1EhmXaOEKKX+fY= +github.com/gotd/td v0.110.1/go.mod h1:mwQQQrrAn3wizT37UjBAUB4lTy1j2RHnkRJ4z9ivqGs= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= @@ -146,10 +148,10 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgx/v5 v5.6.0 h1:SWJzexBzPL5jb0GEsrPMLIsi/3jOo7RHlzTjcAeDrPY= -github.com/jackc/pgx/v5 v5.6.0/go.mod h1:DNZ/vlrUnhWCoFGxHAG8U2ljioxukquj7utPDgtQdTw= -github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= -github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jackc/pgx/v5 v5.7.1 h1:x7SYsPBYDkHDksogeSmZZ5xzThcTgRz++I5E+ePFUcs= +github.com/jackc/pgx/v5 v5.7.1/go.mod h1:e7O26IywZZ+naJtWWos6i6fvWK+29etgITqrqHLfoZA= +github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= +github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= github.com/jcmturner/gofork v1.7.6/go.mod h1:1622LH6i/EZqLloHfE7IeZ0uEJwMSUyQ/nDd82IeqRo= @@ -167,8 +169,8 @@ github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwA github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= -github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= -github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0= +github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.8 h1:+StwCXwm9PdpiEkPyzBXIy+M9KUb4ODm0Zarf1kS5BM= github.com/klauspost/cpuid/v2 v2.2.8/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= @@ -186,10 +188,11 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= -github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= +github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/mattn/go-sqlite3 v1.14.23 h1:gbShiuAP1W5j9UOksQ06aiiqPMxYecovVGwmTxWtuw0= +github.com/mattn/go-sqlite3 v1.14.23/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mdp/qrterminal/v3 v3.2.0 h1:qteQMXO3oyTK4IHwj2mWsKYYRBOp1Pj2WRYFYYNTCdk= github.com/mdp/qrterminal/v3 v3.2.0/go.mod h1:XGGuua4Lefrl7TLEsSONiD+UEjQXJZ4mPzF+gWYIJkk= github.com/microsoft/go-mssqldb v1.6.0/go.mod h1:00mDtPbeQCRGC1HwOOR5K/gr30P1NcEG0vx6Kbv2aJU= @@ -197,14 +200,16 @@ github.com/microsoft/go-mssqldb v1.7.2 h1:CHkFJiObW7ItKTJfHo1QX7QBBD1iV+mn1eOyRP github.com/microsoft/go-mssqldb v1.7.2/go.mod h1:kOvZKUdrhhFQmxLZqbwUV0rHkNkZpthMITIb2Ko1IoA= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= -github.com/minio/minio-go/v7 v7.0.72 h1:ZSbxs2BfJensLyHdVOgHv+pfmvxYraaUy07ER04dWnA= -github.com/minio/minio-go/v7 v7.0.72/go.mod h1:4yBA8v80xGA30cfM3fz0DKYMXunWl/AV/6tWEs9ryzo= +github.com/minio/minio-go/v7 v7.0.77 h1:GaGghJRg9nwDVlNbwYjSDJT1rqltQkBFDsypWX1v3Bw= +github.com/minio/minio-go/v7 v7.0.77/go.mod h1:AVM3IUN6WwKzmwBxVdjzhH8xq+f57JSbbvzqvUzR6eg= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/montanaflynn/stats v0.7.0/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/nats-io/nats.go v1.36.0 h1:suEUPuWzTSse/XhESwqLxXGuj8vGRuPRoG7MoRN/qyU= -github.com/nats-io/nats.go v1.36.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/nats-io/nats.go v1.37.0 h1:07rauXbVnnJvv1gfIyghFEo6lUcYRY0WXc3x7x0vUxE= +github.com/nats-io/nats.go v1.37.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8= github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI= github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= @@ -228,28 +233,29 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= +github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.54.0 h1:ZlZy0BgJhTwVZUn7dLOkwCZHUkrAqd3WYtcFCWnM1D8= -github.com/prometheus/common v0.54.0/go.mod h1:/TQgMJP5CuVYveyT7n/0Ix8yLNNXy9yRSkhnLTHPDIQ= +github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJoX0= +github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= -github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU= +github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/rugatling/go-openai v0.0.0-20240619084423-aeaffca189bb h1:xd4iu7OuOnv3+oHYIJctw/IRPz5EeyCYC1lc24m7tis= github.com/rugatling/go-openai v0.0.0-20240619084423-aeaffca189bb/go.mod h1:D2GUNPklB0S39CynQAH+f09YMMvhGhi/pqc58PXnPPU= -github.com/sashabaranov/go-openai v1.26.0 h1:upM565hxdqvCxNzuAcEBZ1XsfGehH0/9kgk9rFVpDxQ= -github.com/sashabaranov/go-openai v1.26.0/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg= +github.com/sashabaranov/go-openai v1.31.0 h1:rGe77x7zUeCjtS2IS7NCY6Tp4bQviXNMhkQM6hz/UC4= +github.com/sashabaranov/go-openai v1.31.0/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg= github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= github.com/segmentio/kafka-go v0.4.47 h1:IqziR4pA3vrZq7YdRxaT3w1/5fvIH5qpCwstUanQQB0= @@ -275,8 +281,8 @@ github.com/toorop/go-dkim v0.0.0-20240103092955-90b7d1423f92 h1:flbMkdl6HxQkLs6D github.com/toorop/go-dkim v0.0.0-20240103092955-90b7d1423f92/go.mod h1:BzWtXXrXzZUvMacR0oF/fbDDgUPO8L36tDMmRAf14ns= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.55.0 h1:Zkefzgt6a7+bVKHnu/YaYSOPfNYNisSVBo/unVCf8k8= -github.com/valyala/fasthttp v1.55.0/go.mod h1:NkY9JtkrpPKmgwV3HTaS2HWaJss9RSIsRVfcxxoHiOM= +github.com/valyala/fasthttp v1.56.0 h1:bEZdJev/6LCBlpdORfrLu/WOZXXxvrUQSiyniuaoW8U= +github.com/valyala/fasthttp v1.56.0/go.mod h1:sReBt3XZVnudxuLOx4J/fMrJVorWRiWY2koQKgABiVI= github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= @@ -294,22 +300,22 @@ github.com/xhit/go-simple-mail/v2 v2.16.0/go.mod h1:b7P5ygho6SYE+VIqpxA6QkYfv4te github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange v0.0.20 h1:+XMnq6wG1HxQ/AABQxCGBkAD9hwHeqsQ71oD8ndiwWY= -gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange v0.0.20/go.mod h1:rtYvrpxYJvuxIiBfhQl1OuXAazVWMql20fO48vYirWA= -gitlab.aescorp.ru/dsp_dev/claim/sync_service v1.2.138 h1:6SqA5+I541+rDryunt7A5urmMnOREWjIXrgei4vVK4g= -gitlab.aescorp.ru/dsp_dev/claim/sync_service v1.2.138/go.mod h1:RqtVWDlzP8wWauYEoz0DBypeQDU9huFRxGzGkSbTGeI= -go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0= -go.etcd.io/bbolt v1.3.10/go.mod h1:bK3UQLPJZly7IlNmV7uVHJDxfe5aK9Ll93e/74Y9oEQ= -go.mau.fi/libsignal v0.1.0 h1:vAKI/nJ5tMhdzke4cTK1fb0idJzz1JuEIpmjprueC+c= -go.mau.fi/libsignal v0.1.0/go.mod h1:R8ovrTezxtUNzCQE5PH30StOQWWeBskBsWE55vMfY9I= -go.mau.fi/util v0.5.0 h1:8yELAl+1CDRrwGe9NUmREgVclSs26Z68pTWePHVxuDo= -go.mau.fi/util v0.5.0/go.mod h1:DsJzUrJAG53lCZnnYvq9/mOyLuPScWwYhvETiTrpdP4= -go.mau.fi/whatsmeow v0.0.0-20240619210240-329c2336a6f1 h1:gpFEqwk7WtbF/8HaOMASKE6JvxWqhTmaR0CqoPpoly8= -go.mau.fi/whatsmeow v0.0.0-20240619210240-329c2336a6f1/go.mod h1:0+65CYaE6r4dWzr0dN8i+UZKy0gIfJ79VuSqIl0nKRM= -go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= -go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= -go.opentelemetry.io/otel/trace v1.27.0 h1:IqYb813p7cmbHk0a5y6pD5JPakbVfftRXABGt5/Rscw= -go.opentelemetry.io/otel/trace v1.27.0/go.mod h1:6RiD1hkAprV4/q+yd2ln1HG9GoPx39SuvvstaLBl+l4= +gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange v0.0.23 h1:EB+hgd9RKnXmclrrxbHHcX9bbtDk5p9dKV4U1px8sP8= +gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange v0.0.23/go.mod h1:+ZbwpurumFpi0GbiahOY4shV6WB2kguFxN486+76prs= +gitlab.aescorp.ru/dsp_dev/claim/sync_service v1.2.159 h1:MaT4QvPhnxJ2ezM7pan2jh4YZamVwF+s7U3w9/Lut8o= +gitlab.aescorp.ru/dsp_dev/claim/sync_service v1.2.159/go.mod h1:gKajLMv2MCDJvAATHMapcYV9+vzNoFcHR7Edw+68Tjs= +go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0= +go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I= +go.mau.fi/libsignal v0.1.1 h1:m/0PGBh4QKP/I1MQ44ti4C0fMbLMuHb95cmDw01FIpI= +go.mau.fi/libsignal v0.1.1/go.mod h1:QLs89F/OA3ThdSL2Wz2p+o+fi8uuQUz0e1BRa6ExdBw= +go.mau.fi/util v0.8.0 h1:MiSny8jgQq4XtCLAT64gDJhZVhqiDeMVIEBDFVw+M0g= +go.mau.fi/util v0.8.0/go.mod h1:1Ixb8HWoVbl3rT6nAX6nV4iMkzn7KU/KXwE0Rn5RmsQ= +go.mau.fi/whatsmeow v0.0.0-20240924123543-d5cecea9882e h1:3xF5id5VFiL4MXdiM+eK/lEPUXnkXIQ0RUEoNq3S8bk= +go.mau.fi/whatsmeow v0.0.0-20240924123543-d5cecea9882e/go.mod h1:UvaXcdb8y5Mryj2LSXAMw7u4/exnWJIXn8Gvpmf6ndI= +go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= +go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= +go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= +go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= @@ -329,10 +335,10 @@ golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= -golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= -golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -354,10 +360,10 @@ golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -365,8 +371,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -385,8 +391,8 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -394,8 +400,8 @@ golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= -golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= +golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -407,10 +413,8 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -421,10 +425,10 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4 h1:Di6ANFilr+S60a4S61ZM00vLdw0IrQOSMS2/6mrnOU0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= -google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 h1:N9BgCIAUvn/M+p4NJccWPWb3BWh88+zyL0ll9HgbEeM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -432,8 +436,6 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= @@ -453,9 +455,9 @@ gorm.io/driver/sqlserver v1.5.3 h1:rjupPS4PVw+rjJkfvr8jn2lJ8BMhT4UW5FwuJY0P3Z0= gorm.io/driver/sqlserver v1.5.3/go.mod h1:B+CZ0/7oFJ6tAlefsKoyxdgDCXJKSgwS2bMOQZT0I00= gorm.io/gorm v1.25.4/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= -gorm.io/gorm v1.25.10 h1:dQpO+33KalOA+aFYGlK+EfxcI5MbO7EP2yYygwh9h+s= -gorm.io/gorm v1.25.10/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= -nhooyr.io/websocket v1.8.11 h1:f/qXNc2/3DpoSZkHt1DQu6rj4zGC8JmkkLkWss0MgN0= -nhooyr.io/websocket v1.8.11/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c= +gorm.io/gorm v1.25.12 h1:I0u8i2hWQItBq1WfE0o2+WuL9+8L21K9e2HHSTE/0f8= +gorm.io/gorm v1.25.12/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ= +nhooyr.io/websocket v1.8.17 h1:KEVeLJkUywCKVsnLIDlD/5gtayKp8VoCkksHCGGfT9Y= +nhooyr.io/websocket v1.8.17/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c= rsc.io/qr v0.2.0 h1:6vBLea5/NRMVTz8V66gipeLycZMl/+UlFmk8DvqQ6WY= rsc.io/qr v0.2.0/go.mod h1:IF+uZjkb9fqyeF/4tlBoynqmQxUoPfWEKh921coOuXs= diff --git a/kafka_connect/kafka_connect.go b/kafka_connect/kafka_connect.go index fecef965..a1402b00 100644 --- a/kafka_connect/kafka_connect.go +++ b/kafka_connect/kafka_connect.go @@ -79,7 +79,13 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup) error { stopapp.SetWaitGroup_Main(WaitGroup) // - StartKafka() + err = Connect_err() + if err != nil { + return err + } + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() return err } diff --git a/minio_connect/minio_connect.go b/minio_connect/minio_connect.go index baff4c25..2032930a 100644 --- a/minio_connect/minio_connect.go +++ b/minio_connect/minio_connect.go @@ -216,7 +216,13 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup) error { stopapp.SetWaitGroup_Main(WaitGroup) // - StartMinio() + err = Connect_err() + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() + + stopapp.GetWaitGroup_Main().Add(1) + go ping_go() return err } diff --git a/mssql_connect/mssql_connect.go b/mssql_connect/mssql_connect.go index aa70ed64..8de9e53a 100644 --- a/mssql_connect/mssql_connect.go +++ b/mssql_connect/mssql_connect.go @@ -219,7 +219,13 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup) error { stopapp.SetWaitGroup_Main(WaitGroup) // - StartDB() + err = Connect_err() + if err != nil { + return err + } + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() return err } diff --git a/mssql_gorm/mssql_gorm.go b/mssql_gorm/mssql_gorm.go index 1ff643fa..486283d2 100644 --- a/mssql_gorm/mssql_gorm.go +++ b/mssql_gorm/mssql_gorm.go @@ -233,7 +233,13 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup) error { stopapp.SetWaitGroup_Main(WaitGroup) // - StartDB() + err = Connect_err() + if err != nil { + return err + } + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() return err } diff --git a/nats_connect/nats_connect.go b/nats_connect/nats_connect.go index 2ea85bd8..2afc4003 100644 --- a/nats_connect/nats_connect.go +++ b/nats_connect/nats_connect.go @@ -82,7 +82,13 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup) error { stopapp.SetWaitGroup_Main(WaitGroup) // - StartNats() + err = Connect_err() + if err != nil { + return err + } + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() return err } diff --git a/nats_liveness/nats_liveness.go b/nats_liveness/nats_liveness.go index d8a744e2..a5da9c55 100644 --- a/nats_liveness/nats_liveness.go +++ b/nats_liveness/nats_liveness.go @@ -161,10 +161,10 @@ func FillSettings(SERVICE_NAME string) { } -// Start - Старт работы NATS Liveness -func Start(ServiceName string) { +// CheckSettingsNATS - проверяет наличие переменных окружения +func CheckSettingsNATS() error { + var err error - // проверка нужен ли старт NATS_HOST := os.Getenv("NATS_HOST") NATS_PORT := os.Getenv("NATS_PORT") if NATS_HOST == "" { @@ -177,10 +177,23 @@ func Start(ServiceName string) { if NATS_HOST == "" { log.Error("Need fill BUS_LOCAL_HOST ! in os.ENV ") - return + return err } if NATS_PORT == "" { log.Error("Need fill BUS_LOCAL_PORT ! in os.ENV ") + return err + } + + return err +} + +// Start - Старт работы NATS Liveness +func Start(ServiceName string) { + var err error + + // + err = CheckSettingsNATS() + if err != nil { return } @@ -210,7 +223,26 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup, ServiceName stri stopapp.SetWaitGroup_Main(WaitGroup) // - Start(ServiceName) + err = CheckSettingsNATS() + if err != nil { + return err + } + + // + FillSettings(ServiceName) + + err = Connect_err() + if err != nil { + return err + } + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() + + Ticker = time.NewTicker(5 * time.Second) + + stopapp.GetWaitGroup_Main().Add(1) + go SendMessages_go() return err } diff --git a/postgres_connect/postgres_connect.go b/postgres_connect/postgres_connect.go index 07789613..cd230933 100644 --- a/postgres_connect/postgres_connect.go +++ b/postgres_connect/postgres_connect.go @@ -234,7 +234,16 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup) error { stopapp.SetWaitGroup_Main(WaitGroup) // - StartDB() + err = Connect_err() + if err != nil { + return err + } + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() + + stopapp.GetWaitGroup_Main().Add(1) + go ping_go() return err } diff --git a/postgres_gorm/postgres_gorm.go b/postgres_gorm/postgres_gorm.go index 43504420..5d9f6def 100644 --- a/postgres_gorm/postgres_gorm.go +++ b/postgres_gorm/postgres_gorm.go @@ -299,7 +299,16 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup) error { stopapp.SetWaitGroup_Main(WaitGroup) // - StartDB() + err = Connect_err() + if err != nil { + return err + } + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() + + stopapp.GetWaitGroup_Main().Add(1) + go ping_go() return err } diff --git a/postgres_pgx/postgres_pgx.go b/postgres_pgx/postgres_pgx.go index 5cf5a227..c78e6c7d 100644 --- a/postgres_pgx/postgres_pgx.go +++ b/postgres_pgx/postgres_pgx.go @@ -262,7 +262,16 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup) error { stopapp.SetWaitGroup_Main(WaitGroup) // - StartDB() + err = Connect_err() + if err != nil { + return err + } + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() + + stopapp.GetWaitGroup_Main().Add(1) + go ping_go() return err } diff --git a/postgres_stek/postgres_stek.go b/postgres_stek/postgres_stek.go index ae1a4d4e..2affc380 100644 --- a/postgres_stek/postgres_stek.go +++ b/postgres_stek/postgres_stek.go @@ -292,7 +292,16 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup, Connection conne stopapp.SetWaitGroup_Main(WaitGroup) // - StartDB(Connection) + err = Connect_err(Connection) + if err != nil { + return err + } + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() + + stopapp.GetWaitGroup_Main().Add(1) + go ping_go() return err } diff --git a/sync_exchange_connect/sync_exchange_connect.go b/sync_exchange_connect/sync_exchange_connect.go index a7b81177..c3f2af08 100644 --- a/sync_exchange_connect/sync_exchange_connect.go +++ b/sync_exchange_connect/sync_exchange_connect.go @@ -14,18 +14,25 @@ import ( // Connect - подключение к NATS SyncExchange func Connect(ServiceName string) { + err := Connect_err(ServiceName) + if err != nil { + log.Panicln("Can not start NATS, server: ", nats_connect.Settings.NATS_HOST, " error: ", err) + } else { + log.Info("NATS connected. OK., server: ", nats_connect.Settings.NATS_HOST, ":", nats_connect.Settings.NATS_PORT, " error: ", err) + } +} + +// Connect_err - подключение к NATS SyncExchange +func Connect_err(ServiceName string) error { var err error nats_connect.FillSettings() sNATS_PORT := (nats_connect.Settings.NATS_PORT) url := "nats://" + nats_connect.Settings.NATS_HOST + ":" + sNATS_PORT - err = sync_exchange.InitSyncExchange(url, ServiceName) - if err != nil { - log.Panicln("Can not start NATS, server: ", nats_connect.Settings.NATS_HOST, " error: ", err) - } + err = sync_exchange.InitSyncExchange(url, ServiceName, "") - //return err + return err } // Start - необходимые процедуры для подключения к серверу Nats SyncExchange @@ -50,7 +57,13 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup, ServiceName stri stopapp.SetWaitGroup_Main(WaitGroup) // - Start(ServiceName) + err = Connect_err(ServiceName) + if err != nil { + return err + } + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() return err } diff --git a/telegram_client/telegram_client.go b/telegram_client/telegram_client.go index cdbef14a..11a0c5db 100644 --- a/telegram_client/telegram_client.go +++ b/telegram_client/telegram_client.go @@ -833,7 +833,15 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup, func_OnNewMessag stopapp.SetWaitGroup_Main(WaitGroup) // - StartTelegram(func_OnNewMessage) + CreateTelegramClient(func_OnNewMessage) + + err = Connect_err(func_OnNewMessage) + if err != nil { + return err + } + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() return err } diff --git a/vendor/github.com/DataDog/zstd/README.md b/vendor/github.com/DataDog/zstd/README.md index 64481445..3416a507 100644 --- a/vendor/github.com/DataDog/zstd/README.md +++ b/vendor/github.com/DataDog/zstd/README.md @@ -6,8 +6,8 @@ [C Zstd Homepage](https://github.com/facebook/zstd) -The current headers and C files are from *v1.5.0* (Commit -[10f0e699](https://github.com/facebook/zstd/releases/tag/v1.5.0)). +The current headers and C files are from *v1.5.6* (Commit +[794ea1b](https://github.com/facebook/zstd/releases/tag/v1.5.6)). ## Usage diff --git a/vendor/github.com/DataDog/zstd/allocations.h b/vendor/github.com/DataDog/zstd/allocations.h index 5289f24d..61bc09e5 100644 --- a/vendor/github.com/DataDog/zstd/allocations.h +++ b/vendor/github.com/DataDog/zstd/allocations.h @@ -15,7 +15,7 @@ #define ZSTD_DEPS_NEED_MALLOC #include "zstd_deps.h" /* ZSTD_malloc, ZSTD_calloc, ZSTD_free, ZSTD_memset */ -#include "mem.h" /* MEM_STATIC */ +#include "compiler.h" /* MEM_STATIC */ #define ZSTD_STATIC_LINKING_ONLY #include "zstd.h" /* ZSTD_customMem */ diff --git a/vendor/github.com/DataDog/zstd/bitstream.h b/vendor/github.com/DataDog/zstd/bitstream.h index 9d92f7b5..50597a52 100644 --- a/vendor/github.com/DataDog/zstd/bitstream.h +++ b/vendor/github.com/DataDog/zstd/bitstream.h @@ -91,19 +91,20 @@ MEM_STATIC size_t BIT_closeCStream(BIT_CStream_t* bitC); /*-******************************************** * bitStream decoding API (read backward) **********************************************/ +typedef size_t BitContainerType; typedef struct { - size_t bitContainer; + BitContainerType bitContainer; unsigned bitsConsumed; const char* ptr; const char* start; const char* limitPtr; } BIT_DStream_t; -typedef enum { BIT_DStream_unfinished = 0, - BIT_DStream_endOfBuffer = 1, - BIT_DStream_completed = 2, - BIT_DStream_overflow = 3 } BIT_DStream_status; /* result of BIT_reloadDStream() */ - /* 1,2,4,8 would be better for bitmap combinations, but slows down performance a bit ... :( */ +typedef enum { BIT_DStream_unfinished = 0, /* fully refilled */ + BIT_DStream_endOfBuffer = 1, /* still some bits left in bitstream */ + BIT_DStream_completed = 2, /* bitstream entirely consumed, bit-exact */ + BIT_DStream_overflow = 3 /* user requested more bits than present in bitstream */ + } BIT_DStream_status; /* result of BIT_reloadDStream() */ MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, size_t srcSize); MEM_STATIC size_t BIT_readBits(BIT_DStream_t* bitD, unsigned nbBits); @@ -113,7 +114,7 @@ MEM_STATIC unsigned BIT_endOfDStream(const BIT_DStream_t* bitD); /* Start by invoking BIT_initDStream(). * A chunk of the bitStream is then stored into a local register. -* Local register size is 64-bits on 64-bits systems, 32-bits on 32-bits systems (size_t). +* Local register size is 64-bits on 64-bits systems, 32-bits on 32-bits systems (BitContainerType). * You can then retrieve bitFields stored into the local register, **in reverse order**. * Local register is explicitly reloaded from memory by the BIT_reloadDStream() method. * A reload guarantee a minimum of ((8*sizeof(bitD->bitContainer))-7) bits when its result is BIT_DStream_unfinished. @@ -163,7 +164,7 @@ MEM_STATIC size_t BIT_initCStream(BIT_CStream_t* bitC, return 0; } -MEM_STATIC FORCE_INLINE_ATTR size_t BIT_getLowerBits(size_t bitContainer, U32 const nbBits) +FORCE_INLINE_TEMPLATE size_t BIT_getLowerBits(size_t bitContainer, U32 const nbBits) { #if defined(STATIC_BMI2) && STATIC_BMI2 == 1 && !defined(ZSTD_NO_INTRINSICS) return _bzhi_u64(bitContainer, nbBits); @@ -268,22 +269,22 @@ MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, si bitD->bitContainer = *(const BYTE*)(bitD->start); switch(srcSize) { - case 7: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16); + case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16); ZSTD_FALLTHROUGH; - case 6: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24); + case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24); ZSTD_FALLTHROUGH; - case 5: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32); + case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32); ZSTD_FALLTHROUGH; - case 4: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[3]) << 24; + case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24; ZSTD_FALLTHROUGH; - case 3: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[2]) << 16; + case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16; ZSTD_FALLTHROUGH; - case 2: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[1]) << 8; + case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) << 8; ZSTD_FALLTHROUGH; default: break; @@ -298,12 +299,12 @@ MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, si return srcSize; } -MEM_STATIC FORCE_INLINE_ATTR size_t BIT_getUpperBits(size_t bitContainer, U32 const start) +FORCE_INLINE_TEMPLATE size_t BIT_getUpperBits(BitContainerType bitContainer, U32 const start) { return bitContainer >> start; } -MEM_STATIC FORCE_INLINE_ATTR size_t BIT_getMiddleBits(size_t bitContainer, U32 const start, U32 const nbBits) +FORCE_INLINE_TEMPLATE size_t BIT_getMiddleBits(BitContainerType bitContainer, U32 const start, U32 const nbBits) { U32 const regMask = sizeof(bitContainer)*8 - 1; /* if start > regMask, bitstream is corrupted, and result is undefined */ @@ -326,7 +327,7 @@ MEM_STATIC FORCE_INLINE_ATTR size_t BIT_getMiddleBits(size_t bitContainer, U32 c * On 32-bits, maxNbBits==24. * On 64-bits, maxNbBits==56. * @return : value extracted */ -MEM_STATIC FORCE_INLINE_ATTR size_t BIT_lookBits(const BIT_DStream_t* bitD, U32 nbBits) +FORCE_INLINE_TEMPLATE size_t BIT_lookBits(const BIT_DStream_t* bitD, U32 nbBits) { /* arbitrate between double-shift and shift+mask */ #if 1 @@ -349,7 +350,7 @@ MEM_STATIC size_t BIT_lookBitsFast(const BIT_DStream_t* bitD, U32 nbBits) return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask); } -MEM_STATIC FORCE_INLINE_ATTR void BIT_skipBits(BIT_DStream_t* bitD, U32 nbBits) +FORCE_INLINE_TEMPLATE void BIT_skipBits(BIT_DStream_t* bitD, U32 nbBits) { bitD->bitsConsumed += nbBits; } @@ -358,7 +359,7 @@ MEM_STATIC FORCE_INLINE_ATTR void BIT_skipBits(BIT_DStream_t* bitD, U32 nbBits) * Read (consume) next n bits from local register and update. * Pay attention to not read more than nbBits contained into local register. * @return : extracted value. */ -MEM_STATIC FORCE_INLINE_ATTR size_t BIT_readBits(BIT_DStream_t* bitD, unsigned nbBits) +FORCE_INLINE_TEMPLATE size_t BIT_readBits(BIT_DStream_t* bitD, unsigned nbBits) { size_t const value = BIT_lookBits(bitD, nbBits); BIT_skipBits(bitD, nbBits); @@ -375,6 +376,21 @@ MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits) return value; } +/*! BIT_reloadDStream_internal() : + * Simple variant of BIT_reloadDStream(), with two conditions: + * 1. bitstream is valid : bitsConsumed <= sizeof(bitD->bitContainer)*8 + * 2. look window is valid after shifted down : bitD->ptr >= bitD->start + */ +MEM_STATIC BIT_DStream_status BIT_reloadDStream_internal(BIT_DStream_t* bitD) +{ + assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8); + bitD->ptr -= bitD->bitsConsumed >> 3; + assert(bitD->ptr >= bitD->start); + bitD->bitsConsumed &= 7; + bitD->bitContainer = MEM_readLEST(bitD->ptr); + return BIT_DStream_unfinished; +} + /*! BIT_reloadDStreamFast() : * Similar to BIT_reloadDStream(), but with two differences: * 1. bitsConsumed <= sizeof(bitD->bitContainer)*8 must hold! @@ -385,31 +401,35 @@ MEM_STATIC BIT_DStream_status BIT_reloadDStreamFast(BIT_DStream_t* bitD) { if (UNLIKELY(bitD->ptr < bitD->limitPtr)) return BIT_DStream_overflow; - assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8); - bitD->ptr -= bitD->bitsConsumed >> 3; - bitD->bitsConsumed &= 7; - bitD->bitContainer = MEM_readLEST(bitD->ptr); - return BIT_DStream_unfinished; + return BIT_reloadDStream_internal(bitD); } /*! BIT_reloadDStream() : * Refill `bitD` from buffer previously set in BIT_initDStream() . - * This function is safe, it guarantees it will not read beyond src buffer. + * This function is safe, it guarantees it will not never beyond src buffer. * @return : status of `BIT_DStream_t` internal register. * when status == BIT_DStream_unfinished, internal register is filled with at least 25 or 57 bits */ -MEM_STATIC FORCE_INLINE_ATTR BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD) +FORCE_INLINE_TEMPLATE BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD) { - if (bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8)) /* overflow detected, like end of stream */ + /* note : once in overflow mode, a bitstream remains in this mode until it's reset */ + if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) { + static const BitContainerType zeroFilled = 0; + bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */ + /* overflow detected, erroneous scenario or end of stream: no update */ return BIT_DStream_overflow; + } + + assert(bitD->ptr >= bitD->start); if (bitD->ptr >= bitD->limitPtr) { - return BIT_reloadDStreamFast(bitD); + return BIT_reloadDStream_internal(bitD); } if (bitD->ptr == bitD->start) { + /* reached end of bitStream => no update */ if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer; return BIT_DStream_completed; } - /* start < ptr < limitPtr */ + /* start < ptr < limitPtr => cautious update */ { U32 nbBytes = bitD->bitsConsumed >> 3; BIT_DStream_status result = BIT_DStream_unfinished; if (bitD->ptr - nbBytes < bitD->start) { diff --git a/vendor/github.com/DataDog/zstd/compiler.h b/vendor/github.com/DataDog/zstd/compiler.h index ffd66caf..a90cebd8 100644 --- a/vendor/github.com/DataDog/zstd/compiler.h +++ b/vendor/github.com/DataDog/zstd/compiler.h @@ -12,6 +12,8 @@ #ifndef ZSTD_COMPILER_H #define ZSTD_COMPILER_H +#include + #include "portability_macros.h" /*-******************************************************* @@ -52,12 +54,19 @@ # define WIN_CDECL #endif +/* UNUSED_ATTR tells the compiler it is okay if the function is unused. */ +#if defined(__GNUC__) +# define UNUSED_ATTR __attribute__((unused)) +#else +# define UNUSED_ATTR +#endif + /** * FORCE_INLINE_TEMPLATE is used to define C "templates", which take constant * parameters. They must be inlined for the compiler to eliminate the constant * branches. */ -#define FORCE_INLINE_TEMPLATE static INLINE_KEYWORD FORCE_INLINE_ATTR +#define FORCE_INLINE_TEMPLATE static INLINE_KEYWORD FORCE_INLINE_ATTR UNUSED_ATTR /** * HINT_INLINE is used to help the compiler generate better code. It is *not* * used for "templates", so it can be tweaked based on the compilers @@ -72,14 +81,28 @@ #if !defined(__clang__) && defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8 && __GNUC__ < 5 # define HINT_INLINE static INLINE_KEYWORD #else -# define HINT_INLINE static INLINE_KEYWORD FORCE_INLINE_ATTR +# define HINT_INLINE FORCE_INLINE_TEMPLATE #endif -/* UNUSED_ATTR tells the compiler it is okay if the function is unused. */ +/* "soft" inline : + * The compiler is free to select if it's a good idea to inline or not. + * The main objective is to silence compiler warnings + * when a defined function in included but not used. + * + * Note : this macro is prefixed `MEM_` because it used to be provided by `mem.h` unit. + * Updating the prefix is probably preferable, but requires a fairly large codemod, + * since this name is used everywhere. + */ +#ifndef MEM_STATIC /* already defined in Linux Kernel mem.h */ #if defined(__GNUC__) -# define UNUSED_ATTR __attribute__((unused)) +# define MEM_STATIC static __inline UNUSED_ATTR +#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) +# define MEM_STATIC static inline +#elif defined(_MSC_VER) +# define MEM_STATIC static __inline #else -# define UNUSED_ATTR +# define MEM_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */ +#endif #endif /* force no inlining */ @@ -110,10 +133,10 @@ /* prefetch * can be disabled, by declaring NO_PREFETCH build macro */ #if defined(NO_PREFETCH) -# define PREFETCH_L1(ptr) (void)(ptr) /* disabled */ -# define PREFETCH_L2(ptr) (void)(ptr) /* disabled */ +# define PREFETCH_L1(ptr) do { (void)(ptr); } while (0) /* disabled */ +# define PREFETCH_L2(ptr) do { (void)(ptr); } while (0) /* disabled */ #else -# if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) /* _mm_prefetch() is not defined outside of x86/x64 */ +# if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) && !defined(_M_ARM64EC) /* _mm_prefetch() is not defined outside of x86/x64 */ # include /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */ # define PREFETCH_L1(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0) # define PREFETCH_L2(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T1) @@ -121,24 +144,25 @@ # define PREFETCH_L1(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */) # define PREFETCH_L2(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */) # elif defined(__aarch64__) -# define PREFETCH_L1(ptr) __asm__ __volatile__("prfm pldl1keep, %0" ::"Q"(*(ptr))) -# define PREFETCH_L2(ptr) __asm__ __volatile__("prfm pldl2keep, %0" ::"Q"(*(ptr))) +# define PREFETCH_L1(ptr) do { __asm__ __volatile__("prfm pldl1keep, %0" ::"Q"(*(ptr))); } while (0) +# define PREFETCH_L2(ptr) do { __asm__ __volatile__("prfm pldl2keep, %0" ::"Q"(*(ptr))); } while (0) # else -# define PREFETCH_L1(ptr) (void)(ptr) /* disabled */ -# define PREFETCH_L2(ptr) (void)(ptr) /* disabled */ +# define PREFETCH_L1(ptr) do { (void)(ptr); } while (0) /* disabled */ +# define PREFETCH_L2(ptr) do { (void)(ptr); } while (0) /* disabled */ # endif #endif /* NO_PREFETCH */ #define CACHELINE_SIZE 64 -#define PREFETCH_AREA(p, s) { \ - const char* const _ptr = (const char*)(p); \ - size_t const _size = (size_t)(s); \ - size_t _pos; \ - for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \ - PREFETCH_L2(_ptr + _pos); \ - } \ -} +#define PREFETCH_AREA(p, s) \ + do { \ + const char* const _ptr = (const char*)(p); \ + size_t const _size = (size_t)(s); \ + size_t _pos; \ + for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \ + PREFETCH_L2(_ptr + _pos); \ + } \ + } while (0) /* vectorization * older GCC (pre gcc-4.3 picked as the cutoff) uses a different syntax, @@ -167,9 +191,9 @@ #endif #if __has_builtin(__builtin_unreachable) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))) -# define ZSTD_UNREACHABLE { assert(0), __builtin_unreachable(); } +# define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0) #else -# define ZSTD_UNREACHABLE { assert(0); } +# define ZSTD_UNREACHABLE do { assert(0); } while (0) #endif /* disable warnings */ @@ -282,6 +306,74 @@ * Sanitizer *****************************************************************/ +/** + * Zstd relies on pointer overflow in its decompressor. + * We add this attribute to functions that rely on pointer overflow. + */ +#ifndef ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +# if __has_attribute(no_sanitize) +# if !defined(__clang__) && defined(__GNUC__) && __GNUC__ < 8 + /* gcc < 8 only has signed-integer-overlow which triggers on pointer overflow */ +# define ZSTD_ALLOW_POINTER_OVERFLOW_ATTR __attribute__((no_sanitize("signed-integer-overflow"))) +# else + /* older versions of clang [3.7, 5.0) will warn that pointer-overflow is ignored. */ +# define ZSTD_ALLOW_POINTER_OVERFLOW_ATTR __attribute__((no_sanitize("pointer-overflow"))) +# endif +# else +# define ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +# endif +#endif + +/** + * Helper function to perform a wrapped pointer difference without trigging + * UBSAN. + * + * @returns lhs - rhs with wrapping + */ +MEM_STATIC +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +ptrdiff_t ZSTD_wrappedPtrDiff(unsigned char const* lhs, unsigned char const* rhs) +{ + return lhs - rhs; +} + +/** + * Helper function to perform a wrapped pointer add without triggering UBSAN. + * + * @return ptr + add with wrapping + */ +MEM_STATIC +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +unsigned char const* ZSTD_wrappedPtrAdd(unsigned char const* ptr, ptrdiff_t add) +{ + return ptr + add; +} + +/** + * Helper function to perform a wrapped pointer subtraction without triggering + * UBSAN. + * + * @return ptr - sub with wrapping + */ +MEM_STATIC +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +unsigned char const* ZSTD_wrappedPtrSub(unsigned char const* ptr, ptrdiff_t sub) +{ + return ptr - sub; +} + +/** + * Helper function to add to a pointer that works around C's undefined behavior + * of adding 0 to NULL. + * + * @returns `ptr + add` except it defines `NULL + 0 == NULL`. + */ +MEM_STATIC +unsigned char* ZSTD_maybeNullPtrAdd(unsigned char* ptr, ptrdiff_t add) +{ + return add > 0 ? ptr + add : ptr; +} + /* Issue #3240 reports an ASAN failure on an llvm-mingw build. Out of an * abundance of caution, disable our custom poisoning on mingw. */ #ifdef __MINGW32__ diff --git a/vendor/github.com/DataDog/zstd/cover.c b/vendor/github.com/DataDog/zstd/cover.c index 330e33af..fa867042 100644 --- a/vendor/github.com/DataDog/zstd/cover.c +++ b/vendor/github.com/DataDog/zstd/cover.c @@ -32,8 +32,8 @@ #endif #include "mem.h" /* read */ -#include "pool.h" -#include "threading.h" +#include "pool.h" /* POOL_ctx */ +#include "threading.h" /* ZSTD_pthread_mutex_t */ #include "zstd_internal.h" /* includes zstd.h */ #include "bits.h" /* ZSTD_highbit32 */ #include "zdict.h" @@ -79,7 +79,7 @@ static clock_t g_time = 0; #undef LOCALDISPLAYUPDATE #define LOCALDISPLAYUPDATE(displayLevel, l, ...) \ if (displayLevel >= l) { \ - if ((clock() - g_time > g_refreshRate) || (displayLevel >= 4)) { \ + if ((clock() - g_time > g_refreshRate) || (displayLevel >= 4)) { \ g_time = clock(); \ DISPLAY(__VA_ARGS__); \ } \ @@ -302,9 +302,10 @@ static int WIN_CDECL COVER_strict_cmp8(const void *lp, const void *rp) { * Returns the first pointer in [first, last) whose element does not compare * less than value. If no such element exists it returns last. */ -static const size_t *COVER_lower_bound(const size_t *first, const size_t *last, +static const size_t *COVER_lower_bound(const size_t* first, const size_t* last, size_t value) { - size_t count = last - first; + size_t count = (size_t)(last - first); + assert(last >= first); while (count != 0) { size_t step = count / 2; const size_t *ptr = first; @@ -550,7 +551,8 @@ static void COVER_ctx_destroy(COVER_ctx_t *ctx) { */ static size_t COVER_ctx_init(COVER_ctx_t *ctx, const void *samplesBuffer, const size_t *samplesSizes, unsigned nbSamples, - unsigned d, double splitPoint) { + unsigned d, double splitPoint) +{ const BYTE *const samples = (const BYTE *)samplesBuffer; const size_t totalSamplesSize = COVER_sum(samplesSizes, nbSamples); /* Split samples into testing and training sets */ @@ -734,7 +736,7 @@ static size_t COVER_buildDictionary(const COVER_ctx_t *ctx, U32 *freqs, return tail; } -ZDICTLIB_API size_t ZDICT_trainFromBuffer_cover( +ZDICTLIB_STATIC_API size_t ZDICT_trainFromBuffer_cover( void *dictBuffer, size_t dictBufferCapacity, const void *samplesBuffer, const size_t *samplesSizes, unsigned nbSamples, ZDICT_cover_params_t parameters) @@ -908,8 +910,10 @@ void COVER_best_start(COVER_best_t *best) { * Decrements liveJobs and signals any waiting threads if liveJobs == 0. * If this dictionary is the best so far save it and its parameters. */ -void COVER_best_finish(COVER_best_t *best, ZDICT_cover_params_t parameters, - COVER_dictSelection_t selection) { +void COVER_best_finish(COVER_best_t* best, + ZDICT_cover_params_t parameters, + COVER_dictSelection_t selection) +{ void* dict = selection.dictContent; size_t compressedSize = selection.totalCompressedSize; size_t dictSize = selection.dictSize; @@ -981,8 +985,8 @@ COVER_dictSelection_t COVER_selectDict(BYTE* customDictContent, size_t dictBuffe size_t largestCompressed = 0; BYTE* customDictContentEnd = customDictContent + dictContentSize; - BYTE * largestDictbuffer = (BYTE *)malloc(dictBufferCapacity); - BYTE * candidateDictBuffer = (BYTE *)malloc(dictBufferCapacity); + BYTE* largestDictbuffer = (BYTE*)malloc(dictBufferCapacity); + BYTE* candidateDictBuffer = (BYTE*)malloc(dictBufferCapacity); double regressionTolerance = ((double)params.shrinkDictMaxRegression / 100.0) + 1.00; if (!largestDictbuffer || !candidateDictBuffer) { @@ -1120,7 +1124,7 @@ _cleanup: free(freqs); } -ZDICTLIB_API size_t ZDICT_optimizeTrainFromBuffer_cover( +ZDICTLIB_STATIC_API size_t ZDICT_optimizeTrainFromBuffer_cover( void* dictBuffer, size_t dictBufferCapacity, const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples, ZDICT_cover_params_t* parameters) diff --git a/vendor/github.com/DataDog/zstd/cover.h b/vendor/github.com/DataDog/zstd/cover.h index 5c739dab..5653b295 100644 --- a/vendor/github.com/DataDog/zstd/cover.h +++ b/vendor/github.com/DataDog/zstd/cover.h @@ -13,14 +13,8 @@ # define ZDICT_STATIC_LINKING_ONLY #endif -#include /* fprintf */ -#include /* malloc, free, qsort */ -#include /* memset */ -#include /* clock */ -#include "mem.h" /* read */ -#include "pool.h" -#include "threading.h" -#include "zstd_internal.h" /* includes zstd.h */ +#include "threading.h" /* ZSTD_pthread_mutex_t */ +#include "mem.h" /* U32, BYTE */ #include "zdict.h" /** diff --git a/vendor/github.com/DataDog/zstd/cpu.h b/vendor/github.com/DataDog/zstd/cpu.h index 22b646ed..1852693e 100644 --- a/vendor/github.com/DataDog/zstd/cpu.h +++ b/vendor/github.com/DataDog/zstd/cpu.h @@ -36,6 +36,7 @@ MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) { U32 f7b = 0; U32 f7c = 0; #if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86)) +#if !defined(__clang__) int reg[4]; __cpuid((int*)reg, 0); { @@ -51,6 +52,41 @@ MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) { f7c = (U32)reg[2]; } } +#else + /* Clang compiler has a bug (fixed in https://reviews.llvm.org/D101338) in + * which the `__cpuid` intrinsic does not save and restore `rbx` as it needs + * to due to being a reserved register. So in that case, do the `cpuid` + * ourselves. Clang supports inline assembly anyway. + */ + U32 n; + __asm__( + "pushq %%rbx\n\t" + "cpuid\n\t" + "popq %%rbx\n\t" + : "=a"(n) + : "a"(0) + : "rcx", "rdx"); + if (n >= 1) { + U32 f1a; + __asm__( + "pushq %%rbx\n\t" + "cpuid\n\t" + "popq %%rbx\n\t" + : "=a"(f1a), "=c"(f1c), "=d"(f1d) + : "a"(1) + :); + } + if (n >= 7) { + __asm__( + "pushq %%rbx\n\t" + "cpuid\n\t" + "movq %%rbx, %%rax\n\t" + "popq %%rbx" + : "=a"(f7b), "=c"(f7c) + : "a"(7), "c"(0) + : "rdx"); + } +#endif #elif defined(__i386__) && defined(__PIC__) && !defined(__clang__) && defined(__GNUC__) /* The following block like the normal cpuid branch below, but gcc * reserves ebx for use of its pic register so we must specially diff --git a/vendor/github.com/DataDog/zstd/debug.c b/vendor/github.com/DataDog/zstd/debug.c index d1dfc35b..1ce10e95 100644 --- a/vendor/github.com/DataDog/zstd/debug.c +++ b/vendor/github.com/DataDog/zstd/debug.c @@ -22,6 +22,12 @@ #include "debug.h" +#if !defined(ZSTD_LINUX_KERNEL) || (DEBUGLEVEL>=2) +/* We only use this when DEBUGLEVEL>=2, but we get -Werror=pedantic errors if a + * translation unit is empty. So remove this from Linux kernel builds, but + * otherwise just leave it in. + */ int g_debuglevel = DEBUGLEVEL; +#endif #endif /* USE_EXTERNAL_ZSTD */ diff --git a/vendor/github.com/DataDog/zstd/debug.h b/vendor/github.com/DataDog/zstd/debug.h index 110d55f4..695f6bc8 100644 --- a/vendor/github.com/DataDog/zstd/debug.h +++ b/vendor/github.com/DataDog/zstd/debug.h @@ -86,18 +86,27 @@ extern int g_debuglevel; /* the variable is only declared, It's useful when enabling very verbose levels on selective conditions (such as position in src) */ -# define RAWLOG(l, ...) { \ - if (l<=g_debuglevel) { \ - ZSTD_DEBUG_PRINT(__VA_ARGS__); \ - } } -# define DEBUGLOG(l, ...) { \ - if (l<=g_debuglevel) { \ - ZSTD_DEBUG_PRINT(__FILE__ ": " __VA_ARGS__); \ - ZSTD_DEBUG_PRINT(" \n"); \ - } } +# define RAWLOG(l, ...) \ + do { \ + if (l<=g_debuglevel) { \ + ZSTD_DEBUG_PRINT(__VA_ARGS__); \ + } \ + } while (0) + +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) +#define LINE_AS_STRING TOSTRING(__LINE__) + +# define DEBUGLOG(l, ...) \ + do { \ + if (l<=g_debuglevel) { \ + ZSTD_DEBUG_PRINT(__FILE__ ":" LINE_AS_STRING ": " __VA_ARGS__); \ + ZSTD_DEBUG_PRINT(" \n"); \ + } \ + } while (0) #else -# define RAWLOG(l, ...) {} /* disabled */ -# define DEBUGLOG(l, ...) {} /* disabled */ +# define RAWLOG(l, ...) do { } while (0) /* disabled */ +# define DEBUGLOG(l, ...) do { } while (0) /* disabled */ #endif diff --git a/vendor/github.com/DataDog/zstd/error_private.h b/vendor/github.com/DataDog/zstd/error_private.h index 05ddbfa8..1e8c205b 100644 --- a/vendor/github.com/DataDog/zstd/error_private.h +++ b/vendor/github.com/DataDog/zstd/error_private.h @@ -61,8 +61,13 @@ ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); } ERR_STATIC ERR_enum ERR_getErrorCode(size_t code) { if (!ERR_isError(code)) return (ERR_enum)0; return (ERR_enum) (0-code); } /* check and forward error code */ -#define CHECK_V_F(e, f) size_t const e = f; if (ERR_isError(e)) return e -#define CHECK_F(f) { CHECK_V_F(_var_err__, f); } +#define CHECK_V_F(e, f) \ + size_t const e = f; \ + do { \ + if (ERR_isError(e)) \ + return e; \ + } while (0) +#define CHECK_F(f) do { CHECK_V_F(_var_err__, f); } while (0) /*-**************************************** @@ -96,10 +101,12 @@ void _force_has_format_string(const char *format, ...) { * We want to force this function invocation to be syntactically correct, but * we don't want to force runtime evaluation of its arguments. */ -#define _FORCE_HAS_FORMAT_STRING(...) \ - if (0) { \ - _force_has_format_string(__VA_ARGS__); \ - } +#define _FORCE_HAS_FORMAT_STRING(...) \ + do { \ + if (0) { \ + _force_has_format_string(__VA_ARGS__); \ + } \ + } while (0) #define ERR_QUOTE(str) #str @@ -110,48 +117,50 @@ void _force_has_format_string(const char *format, ...) { * In order to do that (particularly, printing the conditional that failed), * this can't just wrap RETURN_ERROR(). */ -#define RETURN_ERROR_IF(cond, err, ...) \ - if (cond) { \ - RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s", \ - __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \ - _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ - RAWLOG(3, ": " __VA_ARGS__); \ - RAWLOG(3, "\n"); \ - return ERROR(err); \ - } +#define RETURN_ERROR_IF(cond, err, ...) \ + do { \ + if (cond) { \ + RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s", \ + __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \ + _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ + RAWLOG(3, ": " __VA_ARGS__); \ + RAWLOG(3, "\n"); \ + return ERROR(err); \ + } \ + } while (0) /** * Unconditionally return the specified error. * * In debug modes, prints additional information. */ -#define RETURN_ERROR(err, ...) \ - do { \ - RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \ - __FILE__, __LINE__, ERR_QUOTE(ERROR(err))); \ - _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ - RAWLOG(3, ": " __VA_ARGS__); \ - RAWLOG(3, "\n"); \ - return ERROR(err); \ - } while(0); +#define RETURN_ERROR(err, ...) \ + do { \ + RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \ + __FILE__, __LINE__, ERR_QUOTE(ERROR(err))); \ + _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ + RAWLOG(3, ": " __VA_ARGS__); \ + RAWLOG(3, "\n"); \ + return ERROR(err); \ + } while(0) /** * If the provided expression evaluates to an error code, returns that error code. * * In debug modes, prints additional information. */ -#define FORWARD_IF_ERROR(err, ...) \ - do { \ - size_t const err_code = (err); \ - if (ERR_isError(err_code)) { \ - RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s", \ - __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \ - _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ - RAWLOG(3, ": " __VA_ARGS__); \ - RAWLOG(3, "\n"); \ - return err_code; \ - } \ - } while(0); +#define FORWARD_IF_ERROR(err, ...) \ + do { \ + size_t const err_code = (err); \ + if (ERR_isError(err_code)) { \ + RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s", \ + __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \ + _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ + RAWLOG(3, ": " __VA_ARGS__); \ + RAWLOG(3, "\n"); \ + return err_code; \ + } \ + } while(0) #if defined (__cplusplus) } diff --git a/vendor/github.com/DataDog/zstd/fastcover.c b/vendor/github.com/DataDog/zstd/fastcover.c index 147ccbfc..0d559e26 100644 --- a/vendor/github.com/DataDog/zstd/fastcover.c +++ b/vendor/github.com/DataDog/zstd/fastcover.c @@ -546,7 +546,7 @@ FASTCOVER_convertToFastCoverParams(ZDICT_cover_params_t coverParams, } -ZDICTLIB_API size_t +ZDICTLIB_STATIC_API size_t ZDICT_trainFromBuffer_fastCover(void* dictBuffer, size_t dictBufferCapacity, const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples, @@ -615,7 +615,7 @@ ZDICT_trainFromBuffer_fastCover(void* dictBuffer, size_t dictBufferCapacity, } -ZDICTLIB_API size_t +ZDICTLIB_STATIC_API size_t ZDICT_optimizeTrainFromBuffer_fastCover( void* dictBuffer, size_t dictBufferCapacity, const void* samplesBuffer, diff --git a/vendor/github.com/DataDog/zstd/fse.h b/vendor/github.com/DataDog/zstd/fse.h index 5d6e4c45..47ecc184 100644 --- a/vendor/github.com/DataDog/zstd/fse.h +++ b/vendor/github.com/DataDog/zstd/fse.h @@ -230,6 +230,7 @@ If there is an error, the function will return an error code, which can be teste #endif /* FSE_H */ + #if defined(FSE_STATIC_LINKING_ONLY) && !defined(FSE_H_FSE_STATIC_LINKING_ONLY) #define FSE_H_FSE_STATIC_LINKING_ONLY @@ -465,13 +466,13 @@ MEM_STATIC void FSE_encodeSymbol(BIT_CStream_t* bitC, FSE_CState_t* statePtr, un FSE_symbolCompressionTransform const symbolTT = ((const FSE_symbolCompressionTransform*)(statePtr->symbolTT))[symbol]; const U16* const stateTable = (const U16*)(statePtr->stateTable); U32 const nbBitsOut = (U32)((statePtr->value + symbolTT.deltaNbBits) >> 16); - BIT_addBits(bitC, statePtr->value, nbBitsOut); + BIT_addBits(bitC, (size_t)statePtr->value, nbBitsOut); statePtr->value = stateTable[ (statePtr->value >> nbBitsOut) + symbolTT.deltaFindState]; } MEM_STATIC void FSE_flushCState(BIT_CStream_t* bitC, const FSE_CState_t* statePtr) { - BIT_addBits(bitC, statePtr->value, statePtr->stateLog); + BIT_addBits(bitC, (size_t)statePtr->value, statePtr->stateLog); BIT_flushBits(bitC); } diff --git a/vendor/github.com/DataDog/zstd/fse_compress.c b/vendor/github.com/DataDog/zstd/fse_compress.c index 41f56e06..b42e8481 100644 --- a/vendor/github.com/DataDog/zstd/fse_compress.c +++ b/vendor/github.com/DataDog/zstd/fse_compress.c @@ -26,7 +26,7 @@ #include "error_private.h" #define ZSTD_DEPS_NEED_MALLOC #define ZSTD_DEPS_NEED_MATH64 -#include "zstd_deps.h" /* ZSTD_malloc, ZSTD_free, ZSTD_memcpy, ZSTD_memset */ +#include "zstd_deps.h" /* ZSTD_memset */ #include "bits.h" /* ZSTD_highbit32 */ @@ -226,8 +226,8 @@ size_t FSE_NCountWriteBound(unsigned maxSymbolValue, unsigned tableLog) size_t const maxHeaderSize = (((maxSymbolValue+1) * tableLog + 4 /* bitCount initialized at 4 */ + 2 /* first two symbols may use one additional bit each */) / 8) - + 1 /* round up to whole nb bytes */ - + 2 /* additional two bytes for bitstream flush */; + + 1 /* round up to whole nb bytes */ + + 2 /* additional two bytes for bitstream flush */; return maxSymbolValue ? maxHeaderSize : FSE_NCOUNTBOUND; /* maxSymbolValue==0 ? use default */ } @@ -256,7 +256,7 @@ FSE_writeNCount_generic (void* header, size_t headerBufferSize, /* Init */ remaining = tableSize+1; /* +1 for extra accuracy */ threshold = tableSize; - nbBits = tableLog+1; + nbBits = (int)tableLog+1; while ((symbol < alphabetSize) && (remaining>1)) { /* stops at 1 */ if (previousIs0) { @@ -275,7 +275,7 @@ FSE_writeNCount_generic (void* header, size_t headerBufferSize, } while (symbol >= start+3) { start+=3; - bitStream += 3 << bitCount; + bitStream += 3U << bitCount; bitCount += 2; } bitStream += (symbol-start) << bitCount; @@ -295,7 +295,7 @@ FSE_writeNCount_generic (void* header, size_t headerBufferSize, count++; /* +1 for extra accuracy */ if (count>=threshold) count += max; /* [0..max[ [max..threshold[ (...) [threshold+max 2*threshold[ */ - bitStream += count << bitCount; + bitStream += (U32)count << bitCount; bitCount += nbBits; bitCount -= (count>8); out+= (bitCount+7) /8; - return (out-ostart); + assert(out >= ostart); + return (size_t)(out-ostart); } diff --git a/vendor/github.com/DataDog/zstd/fse_decompress.c b/vendor/github.com/DataDog/zstd/fse_decompress.c index e6aafaef..df40f915 100644 --- a/vendor/github.com/DataDog/zstd/fse_decompress.c +++ b/vendor/github.com/DataDog/zstd/fse_decompress.c @@ -23,8 +23,7 @@ #define FSE_STATIC_LINKING_ONLY #include "fse.h" #include "error_private.h" -#define ZSTD_DEPS_NEED_MALLOC -#include "zstd_deps.h" +#include "zstd_deps.h" /* ZSTD_memcpy */ #include "bits.h" /* ZSTD_highbit32 */ @@ -85,7 +84,7 @@ static size_t FSE_buildDTable_internal(FSE_DTable* dt, const short* normalizedCo symbolNext[s] = 1; } else { if (normalizedCounter[s] >= largeLimit) DTableH.fastMode=0; - symbolNext[s] = normalizedCounter[s]; + symbolNext[s] = (U16)normalizedCounter[s]; } } } ZSTD_memcpy(dt, &DTableH, sizeof(DTableH)); } @@ -100,8 +99,7 @@ static size_t FSE_buildDTable_internal(FSE_DTable* dt, const short* normalizedCo * all symbols have counts <= 8. We ensure we have 8 bytes at the end of * our buffer to handle the over-write. */ - { - U64 const add = 0x0101010101010101ull; + { U64 const add = 0x0101010101010101ull; size_t pos = 0; U64 sv = 0; U32 s; @@ -112,9 +110,8 @@ static size_t FSE_buildDTable_internal(FSE_DTable* dt, const short* normalizedCo for (i = 8; i < n; i += 8) { MEM_write64(spread + pos + i, sv); } - pos += n; - } - } + pos += (size_t)n; + } } /* Now we spread those positions across the table. * The benefit of doing it in two stages is that we avoid the * variable size inner loop, which caused lots of branch misses. @@ -233,12 +230,12 @@ FORCE_INLINE_TEMPLATE size_t FSE_decompress_usingDTable_generic( break; } } - return op-ostart; + assert(op >= ostart); + return (size_t)(op-ostart); } typedef struct { short ncount[FSE_MAX_SYMBOL_VALUE + 1]; - FSE_DTable dtable[1]; /* Dynamically sized */ } FSE_DecompressWksp; @@ -253,13 +250,18 @@ FORCE_INLINE_TEMPLATE size_t FSE_decompress_wksp_body( unsigned tableLog; unsigned maxSymbolValue = FSE_MAX_SYMBOL_VALUE; FSE_DecompressWksp* const wksp = (FSE_DecompressWksp*)workSpace; + size_t const dtablePos = sizeof(FSE_DecompressWksp) / sizeof(FSE_DTable); + FSE_DTable* const dtable = (FSE_DTable*)workSpace + dtablePos; - DEBUG_STATIC_ASSERT((FSE_MAX_SYMBOL_VALUE + 1) % 2 == 0); + FSE_STATIC_ASSERT((FSE_MAX_SYMBOL_VALUE + 1) % 2 == 0); if (wkspSize < sizeof(*wksp)) return ERROR(GENERIC); + /* correct offset to dtable depends on this property */ + FSE_STATIC_ASSERT(sizeof(FSE_DecompressWksp) % sizeof(FSE_DTable) == 0); + /* normal FSE decoding mode */ - { - size_t const NCountLength = FSE_readNCount_bmi2(wksp->ncount, &maxSymbolValue, &tableLog, istart, cSrcSize, bmi2); + { size_t const NCountLength = + FSE_readNCount_bmi2(wksp->ncount, &maxSymbolValue, &tableLog, istart, cSrcSize, bmi2); if (FSE_isError(NCountLength)) return NCountLength; if (tableLog > maxLog) return ERROR(tableLog_tooLarge); assert(NCountLength <= cSrcSize); @@ -272,16 +274,16 @@ FORCE_INLINE_TEMPLATE size_t FSE_decompress_wksp_body( workSpace = (BYTE*)workSpace + sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog); wkspSize -= sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog); - CHECK_F( FSE_buildDTable_internal(wksp->dtable, wksp->ncount, maxSymbolValue, tableLog, workSpace, wkspSize) ); + CHECK_F( FSE_buildDTable_internal(dtable, wksp->ncount, maxSymbolValue, tableLog, workSpace, wkspSize) ); { - const void* ptr = wksp->dtable; + const void* ptr = dtable; const FSE_DTableHeader* DTableH = (const FSE_DTableHeader*)ptr; const U32 fastMode = DTableH->fastMode; /* select fast mode (static) */ - if (fastMode) return FSE_decompress_usingDTable_generic(dst, dstCapacity, ip, cSrcSize, wksp->dtable, 1); - return FSE_decompress_usingDTable_generic(dst, dstCapacity, ip, cSrcSize, wksp->dtable, 0); + if (fastMode) return FSE_decompress_usingDTable_generic(dst, dstCapacity, ip, cSrcSize, dtable, 1); + return FSE_decompress_usingDTable_generic(dst, dstCapacity, ip, cSrcSize, dtable, 0); } } diff --git a/vendor/github.com/DataDog/zstd/huf.h b/vendor/github.com/DataDog/zstd/huf.h index ad9a485c..07f1a95a 100644 --- a/vendor/github.com/DataDog/zstd/huf.h +++ b/vendor/github.com/DataDog/zstd/huf.h @@ -198,9 +198,22 @@ size_t HUF_readCTable (HUF_CElt* CTable, unsigned* maxSymbolValuePtr, const void /** HUF_getNbBitsFromCTable() : * Read nbBits from CTable symbolTable, for symbol `symbolValue` presumed <= HUF_SYMBOLVALUE_MAX - * Note 1 : is not inlined, as HUF_CElt definition is private */ + * Note 1 : If symbolValue > HUF_readCTableHeader(symbolTable).maxSymbolValue, returns 0 + * Note 2 : is not inlined, as HUF_CElt definition is private + */ U32 HUF_getNbBitsFromCTable(const HUF_CElt* symbolTable, U32 symbolValue); +typedef struct { + BYTE tableLog; + BYTE maxSymbolValue; + BYTE unused[sizeof(size_t) - 2]; +} HUF_CTableHeader; + +/** HUF_readCTableHeader() : + * @returns The header from the CTable specifying the tableLog and the maxSymbolValue. + */ +HUF_CTableHeader HUF_readCTableHeader(HUF_CElt const* ctable); + /* * HUF_decompress() does the following: * 1. select the decompression algorithm (X1, X2) based on pre-computed heuristics diff --git a/vendor/github.com/DataDog/zstd/huf_compress.c b/vendor/github.com/DataDog/zstd/huf_compress.c index 7fb3c96a..7df91608 100644 --- a/vendor/github.com/DataDog/zstd/huf_compress.c +++ b/vendor/github.com/DataDog/zstd/huf_compress.c @@ -221,6 +221,25 @@ static void HUF_setValue(HUF_CElt* elt, size_t value) } } +HUF_CTableHeader HUF_readCTableHeader(HUF_CElt const* ctable) +{ + HUF_CTableHeader header; + ZSTD_memcpy(&header, ctable, sizeof(header)); + return header; +} + +static void HUF_writeCTableHeader(HUF_CElt* ctable, U32 tableLog, U32 maxSymbolValue) +{ + HUF_CTableHeader header; + HUF_STATIC_ASSERT(sizeof(ctable[0]) == sizeof(header)); + ZSTD_memset(&header, 0, sizeof(header)); + assert(tableLog < 256); + header.tableLog = (BYTE)tableLog; + assert(maxSymbolValue < 256); + header.maxSymbolValue = (BYTE)maxSymbolValue; + ZSTD_memcpy(ctable, &header, sizeof(header)); +} + typedef struct { HUF_CompressWeightsWksp wksp; BYTE bitsToWeight[HUF_TABLELOG_MAX + 1]; /* precomputed conversion table */ @@ -238,6 +257,9 @@ size_t HUF_writeCTable_wksp(void* dst, size_t maxDstSize, HUF_STATIC_ASSERT(HUF_CTABLE_WORKSPACE_SIZE >= sizeof(HUF_WriteCTableWksp)); + assert(HUF_readCTableHeader(CTable).maxSymbolValue == maxSymbolValue); + assert(HUF_readCTableHeader(CTable).tableLog == huffLog); + /* check conditions */ if (workspaceSize < sizeof(HUF_WriteCTableWksp)) return ERROR(GENERIC); if (maxSymbolValue > HUF_SYMBOLVALUE_MAX) return ERROR(maxSymbolValue_tooLarge); @@ -284,7 +306,9 @@ size_t HUF_readCTable (HUF_CElt* CTable, unsigned* maxSymbolValuePtr, const void if (tableLog > HUF_TABLELOG_MAX) return ERROR(tableLog_tooLarge); if (nbSymbols > *maxSymbolValuePtr+1) return ERROR(maxSymbolValue_tooSmall); - CTable[0] = tableLog; + *maxSymbolValuePtr = nbSymbols - 1; + + HUF_writeCTableHeader(CTable, tableLog, *maxSymbolValuePtr); /* Prepare base value per rank */ { U32 n, nextRankStart = 0; @@ -316,7 +340,6 @@ size_t HUF_readCTable (HUF_CElt* CTable, unsigned* maxSymbolValuePtr, const void { U32 n; for (n=0; n HUF_readCTableHeader(CTable).maxSymbolValue) + return 0; return (U32)HUF_getNbBits(ct[symbolValue]); } @@ -724,7 +749,8 @@ static void HUF_buildCTableFromTree(HUF_CElt* CTable, nodeElt const* huffNode, i HUF_setNbBits(ct + huffNode[n].byte, huffNode[n].nbBits); /* push nbBits per symbol, symbol order */ for (n=0; n 11) @@ -1256,7 +1289,7 @@ unsigned HUF_optimalTableLog( { BYTE* dst = (BYTE*)workSpace + sizeof(HUF_WriteCTableWksp); size_t dstSize = wkspSize - sizeof(HUF_WriteCTableWksp); - size_t maxBits, hSize, newSize; + size_t hSize, newSize; const unsigned symbolCardinality = HUF_cardinality(count, maxSymbolValue); const unsigned minTableLog = HUF_minTableLog(symbolCardinality); size_t optSize = ((size_t) ~0) - 1; @@ -1267,12 +1300,14 @@ unsigned HUF_optimalTableLog( /* Search until size increases */ for (optLogGuess = minTableLog; optLogGuess <= maxTableLog; optLogGuess++) { DEBUGLOG(7, "checking for huffLog=%u", optLogGuess); - maxBits = HUF_buildCTable_wksp(table, count, maxSymbolValue, optLogGuess, workSpace, wkspSize); - if (ERR_isError(maxBits)) continue; - if (maxBits < optLogGuess && optLogGuess > minTableLog) break; + { size_t maxBits = HUF_buildCTable_wksp(table, count, maxSymbolValue, optLogGuess, workSpace, wkspSize); + if (ERR_isError(maxBits)) continue; - hSize = HUF_writeCTable_wksp(dst, dstSize, table, maxSymbolValue, (U32)maxBits, workSpace, wkspSize); + if (maxBits < optLogGuess && optLogGuess > minTableLog) break; + + hSize = HUF_writeCTable_wksp(dst, dstSize, table, maxSymbolValue, (U32)maxBits, workSpace, wkspSize); + } if (ERR_isError(hSize)) continue; @@ -1373,12 +1408,6 @@ HUF_compress_internal (void* dst, size_t dstSize, huffLog = (U32)maxBits; DEBUGLOG(6, "bit distribution completed (%zu symbols)", showCTableBits(table->CTable + 1, maxSymbolValue+1)); } - /* Zero unused symbols in CTable, so we can check it for validity */ - { - size_t const ctableSize = HUF_CTABLE_SIZE_ST(maxSymbolValue); - size_t const unusedSize = sizeof(table->CTable) - ctableSize * sizeof(HUF_CElt); - ZSTD_memset(table->CTable + ctableSize, 0, unusedSize); - } /* Write table description header */ { CHECK_V_F(hSize, HUF_writeCTable_wksp(op, dstSize, table->CTable, maxSymbolValue, huffLog, @@ -1421,7 +1450,7 @@ size_t HUF_compress1X_repeat (void* dst, size_t dstSize, /* HUF_compress4X_repeat(): * compress input using 4 streams. * consider skipping quickly - * re-use an existing huffman compression table */ + * reuse an existing huffman compression table */ size_t HUF_compress4X_repeat (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned huffLog, diff --git a/vendor/github.com/DataDog/zstd/huf_decompress.c b/vendor/github.com/DataDog/zstd/huf_decompress.c index da4d1845..1589ef1f 100644 --- a/vendor/github.com/DataDog/zstd/huf_decompress.c +++ b/vendor/github.com/DataDog/zstd/huf_decompress.c @@ -35,6 +35,12 @@ * Macros ****************************************************************/ +#ifdef HUF_DISABLE_FAST_DECODE +# define HUF_ENABLE_FAST_DECODE 0 +#else +# define HUF_ENABLE_FAST_DECODE 1 +#endif + /* These two optional macros force the use one way or another of the two * Huffman decompression implementations. You can't force in both directions * at the same time. @@ -159,17 +165,18 @@ static size_t HUF_initFastDStream(BYTE const* ip) { * op [in/out] - The output pointers, must be updated to reflect what is written. * bits [in/out] - The bitstream containers, must be updated to reflect the current state. * dt [in] - The decoding table. - * ilimit [in] - The input limit, stop when any input pointer is below ilimit. + * ilowest [in] - The beginning of the valid range of the input. Decoders may read + * down to this pointer. It may be below iend[0]. * oend [in] - The end of the output stream. op[3] must not cross oend. * iend [in] - The end of each input stream. ip[i] may cross iend[i], - * as long as it is above ilimit, but that indicates corruption. + * as long as it is above ilowest, but that indicates corruption. */ typedef struct { BYTE const* ip[4]; BYTE* op[4]; U64 bits[4]; void const* dt; - BYTE const* ilimit; + BYTE const* ilowest; BYTE* oend; BYTE const* iend[4]; } HUF_DecompressFastArgs; @@ -187,9 +194,9 @@ static size_t HUF_DecompressFastArgs_init(HUF_DecompressFastArgs* args, void* ds void const* dt = DTable + 1; U32 const dtLog = HUF_getDTableDesc(DTable).tableLog; - const BYTE* const ilimit = (const BYTE*)src + 6 + 8; + const BYTE* const istart = (const BYTE*)src; - BYTE* const oend = (BYTE*)dst + dstSize; + BYTE* const oend = ZSTD_maybeNullPtrAdd((BYTE*)dst, dstSize); /* The fast decoding loop assumes 64-bit little-endian. * This condition is false on x32. @@ -197,6 +204,11 @@ static size_t HUF_DecompressFastArgs_init(HUF_DecompressFastArgs* args, void* ds if (!MEM_isLittleEndian() || MEM_32bits()) return 0; + /* Avoid nullptr addition */ + if (dstSize == 0) + return 0; + assert(dst != NULL); + /* strict minimum : jump table + 1 byte per stream */ if (srcSize < 10) return ERROR(corruption_detected); @@ -210,7 +222,6 @@ static size_t HUF_DecompressFastArgs_init(HUF_DecompressFastArgs* args, void* ds /* Read the jump table. */ { - const BYTE* const istart = (const BYTE*)src; size_t const length1 = MEM_readLE16(istart); size_t const length2 = MEM_readLE16(istart+2); size_t const length3 = MEM_readLE16(istart+4); @@ -222,10 +233,8 @@ static size_t HUF_DecompressFastArgs_init(HUF_DecompressFastArgs* args, void* ds /* HUF_initFastDStream() requires this, and this small of an input * won't benefit from the ASM loop anyways. - * length1 must be >= 16 so that ip[0] >= ilimit before the loop - * starts. */ - if (length1 < 16 || length2 < 8 || length3 < 8 || length4 < 8) + if (length1 < 8 || length2 < 8 || length3 < 8 || length4 < 8) return 0; if (length4 > srcSize) return ERROR(corruption_detected); /* overflow */ } @@ -257,11 +266,12 @@ static size_t HUF_DecompressFastArgs_init(HUF_DecompressFastArgs* args, void* ds args->bits[2] = HUF_initFastDStream(args->ip[2]); args->bits[3] = HUF_initFastDStream(args->ip[3]); - /* If ip[] >= ilimit, it is guaranteed to be safe to - * reload bits[]. It may be beyond its section, but is - * guaranteed to be valid (>= istart). - */ - args->ilimit = ilimit; + /* The decoders must be sure to never read beyond ilowest. + * This is lower than iend[0], but allowing decoders to read + * down to ilowest can allow an extra iteration or two in the + * fast loop. + */ + args->ilowest = istart; args->oend = oend; args->dt = dt; @@ -286,13 +296,31 @@ static size_t HUF_initRemainingDStream(BIT_DStream_t* bit, HUF_DecompressFastArg assert(sizeof(size_t) == 8); bit->bitContainer = MEM_readLEST(args->ip[stream]); bit->bitsConsumed = ZSTD_countTrailingZeros64(args->bits[stream]); - bit->start = (const char*)args->iend[0]; + bit->start = (const char*)args->ilowest; bit->limitPtr = bit->start + sizeof(size_t); bit->ptr = (const char*)args->ip[stream]; return 0; } +/* Calls X(N) for each stream 0, 1, 2, 3. */ +#define HUF_4X_FOR_EACH_STREAM(X) \ + do { \ + X(0); \ + X(1); \ + X(2); \ + X(3); \ + } while (0) + +/* Calls X(N, var) for each stream 0, 1, 2, 3. */ +#define HUF_4X_FOR_EACH_STREAM_WITH_VAR(X, var) \ + do { \ + X(0, (var)); \ + X(1, (var)); \ + X(2, (var)); \ + X(3, (var)); \ + } while (0) + #ifndef HUF_FORCE_DECOMPRESS_X2 @@ -501,15 +529,19 @@ HUF_decodeSymbolX1(BIT_DStream_t* Dstream, const HUF_DEltX1* dt, const U32 dtLog } #define HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr) \ - *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog) + do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0) -#define HUF_DECODE_SYMBOLX1_1(ptr, DStreamPtr) \ - if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \ - HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr) +#define HUF_DECODE_SYMBOLX1_1(ptr, DStreamPtr) \ + do { \ + if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \ + HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \ + } while (0) -#define HUF_DECODE_SYMBOLX1_2(ptr, DStreamPtr) \ - if (MEM_64bits()) \ - HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr) +#define HUF_DECODE_SYMBOLX1_2(ptr, DStreamPtr) \ + do { \ + if (MEM_64bits()) \ + HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \ + } while (0) HINT_INLINE size_t HUF_decodeStreamX1(BYTE* p, BIT_DStream_t* const bitDPtr, BYTE* const pEnd, const HUF_DEltX1* const dt, const U32 dtLog) @@ -547,7 +579,7 @@ HUF_decompress1X1_usingDTable_internal_body( const HUF_DTable* DTable) { BYTE* op = (BYTE*)dst; - BYTE* const oend = op + dstSize; + BYTE* const oend = ZSTD_maybeNullPtrAdd(op, dstSize); const void* dtPtr = DTable + 1; const HUF_DEltX1* const dt = (const HUF_DEltX1*)dtPtr; BIT_DStream_t bitD; @@ -575,6 +607,7 @@ HUF_decompress4X1_usingDTable_internal_body( { /* Check */ if (cSrcSize < 10) return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */ + if (dstSize < 6) return ERROR(corruption_detected); /* stream 4-split doesn't work */ { const BYTE* const istart = (const BYTE*) cSrc; BYTE* const ostart = (BYTE*) dst; @@ -610,7 +643,7 @@ HUF_decompress4X1_usingDTable_internal_body( if (length4 > cSrcSize) return ERROR(corruption_detected); /* overflow */ if (opStart4 > oend) return ERROR(corruption_detected); /* overflow */ - if (dstSize < 6) return ERROR(corruption_detected); /* stream 4-split doesn't work */ + assert(dstSize >= 6); /* validated above */ CHECK_F( BIT_initDStream(&bitD1, istart1, length1) ); CHECK_F( BIT_initDStream(&bitD2, istart2, length2) ); CHECK_F( BIT_initDStream(&bitD3, istart3, length3) ); @@ -693,7 +726,7 @@ void HUF_decompress4X1_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* BYTE* op[4]; U16 const* const dtable = (U16 const*)args->dt; BYTE* const oend = args->oend; - BYTE const* const ilimit = args->ilimit; + BYTE const* const ilowest = args->ilowest; /* Copy the arguments to local variables */ ZSTD_memcpy(&bits, &args->bits, sizeof(bits)); @@ -706,13 +739,12 @@ void HUF_decompress4X1_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* for (;;) { BYTE* olimit; int stream; - int symbol; /* Assert loop preconditions */ #ifndef NDEBUG for (stream = 0; stream < 4; ++stream) { assert(op[stream] <= (stream == 3 ? oend : op[stream + 1])); - assert(ip[stream] >= ilimit); + assert(ip[stream] >= ilowest); } #endif /* Compute olimit */ @@ -722,7 +754,7 @@ void HUF_decompress4X1_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* /* Each iteration consumes up to 11 bits * 5 = 55 bits < 7 bytes * per stream. */ - size_t const iiters = (size_t)(ip[0] - ilimit) / 7; + size_t const iiters = (size_t)(ip[0] - ilowest) / 7; /* We can safely run iters iterations before running bounds checks */ size_t const iters = MIN(oiters, iiters); size_t const symbols = iters * 5; @@ -733,8 +765,8 @@ void HUF_decompress4X1_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* */ olimit = op[3] + symbols; - /* Exit fast decoding loop once we get close to the end. */ - if (op[3] + 20 > olimit) + /* Exit fast decoding loop once we reach the end. */ + if (op[3] == olimit) break; /* Exit the decoding loop if any input pointer has crossed the @@ -753,27 +785,42 @@ void HUF_decompress4X1_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* } #endif +#define HUF_4X1_DECODE_SYMBOL(_stream, _symbol) \ + do { \ + int const index = (int)(bits[(_stream)] >> 53); \ + int const entry = (int)dtable[index]; \ + bits[(_stream)] <<= (entry & 0x3F); \ + op[(_stream)][(_symbol)] = (BYTE)((entry >> 8) & 0xFF); \ + } while (0) + +#define HUF_4X1_RELOAD_STREAM(_stream) \ + do { \ + int const ctz = ZSTD_countTrailingZeros64(bits[(_stream)]); \ + int const nbBits = ctz & 7; \ + int const nbBytes = ctz >> 3; \ + op[(_stream)] += 5; \ + ip[(_stream)] -= nbBytes; \ + bits[(_stream)] = MEM_read64(ip[(_stream)]) | 1; \ + bits[(_stream)] <<= nbBits; \ + } while (0) + + /* Manually unroll the loop because compilers don't consistently + * unroll the inner loops, which destroys performance. + */ do { /* Decode 5 symbols in each of the 4 streams */ - for (symbol = 0; symbol < 5; ++symbol) { - for (stream = 0; stream < 4; ++stream) { - int const index = (int)(bits[stream] >> 53); - int const entry = (int)dtable[index]; - bits[stream] <<= (entry & 63); - op[stream][symbol] = (BYTE)((entry >> 8) & 0xFF); - } - } - /* Reload the bitstreams */ - for (stream = 0; stream < 4; ++stream) { - int const ctz = ZSTD_countTrailingZeros64(bits[stream]); - int const nbBits = ctz & 7; - int const nbBytes = ctz >> 3; - op[stream] += 5; - ip[stream] -= nbBytes; - bits[stream] = MEM_read64(ip[stream]) | 1; - bits[stream] <<= nbBits; - } + HUF_4X_FOR_EACH_STREAM_WITH_VAR(HUF_4X1_DECODE_SYMBOL, 0); + HUF_4X_FOR_EACH_STREAM_WITH_VAR(HUF_4X1_DECODE_SYMBOL, 1); + HUF_4X_FOR_EACH_STREAM_WITH_VAR(HUF_4X1_DECODE_SYMBOL, 2); + HUF_4X_FOR_EACH_STREAM_WITH_VAR(HUF_4X1_DECODE_SYMBOL, 3); + HUF_4X_FOR_EACH_STREAM_WITH_VAR(HUF_4X1_DECODE_SYMBOL, 4); + + /* Reload each of the 4 the bitstreams */ + HUF_4X_FOR_EACH_STREAM(HUF_4X1_RELOAD_STREAM); } while (op[3] < olimit); + +#undef HUF_4X1_DECODE_SYMBOL +#undef HUF_4X1_RELOAD_STREAM } _out: @@ -798,8 +845,8 @@ HUF_decompress4X1_usingDTable_internal_fast( HUF_DecompressFastLoopFn loopFn) { void const* dt = DTable + 1; - const BYTE* const iend = (const BYTE*)cSrc + 6; - BYTE* const oend = (BYTE*)dst + dstSize; + BYTE const* const ilowest = (BYTE const*)cSrc; + BYTE* const oend = ZSTD_maybeNullPtrAdd((BYTE*)dst, dstSize); HUF_DecompressFastArgs args; { size_t const ret = HUF_DecompressFastArgs_init(&args, dst, dstSize, cSrc, cSrcSize, DTable); FORWARD_IF_ERROR(ret, "Failed to init fast loop args"); @@ -807,18 +854,22 @@ HUF_decompress4X1_usingDTable_internal_fast( return 0; } - assert(args.ip[0] >= args.ilimit); + assert(args.ip[0] >= args.ilowest); loopFn(&args); - /* Our loop guarantees that ip[] >= ilimit and that we haven't + /* Our loop guarantees that ip[] >= ilowest and that we haven't * overwritten any op[]. */ - assert(args.ip[0] >= iend); - assert(args.ip[1] >= iend); - assert(args.ip[2] >= iend); - assert(args.ip[3] >= iend); + assert(args.ip[0] >= ilowest); + assert(args.ip[0] >= ilowest); + assert(args.ip[1] >= ilowest); + assert(args.ip[2] >= ilowest); + assert(args.ip[3] >= ilowest); assert(args.op[3] <= oend); - (void)iend; + + assert(ilowest == args.ilowest); + assert(ilowest + 6 == args.iend[0]); + (void)ilowest; /* finish bit streams one by one. */ { size_t const segmentSize = (dstSize+3) / 4; @@ -869,7 +920,7 @@ static size_t HUF_decompress4X1_usingDTable_internal(void* dst, size_t dstSize, } #endif - if (!(flags & HUF_flags_disableFast)) { + if (HUF_ENABLE_FAST_DECODE && !(flags & HUF_flags_disableFast)) { size_t const ret = HUF_decompress4X1_usingDTable_internal_fast(dst, dstSize, cSrc, cSrcSize, DTable, loopFn); if (ret != 0) return ret; @@ -1240,15 +1291,19 @@ HUF_decodeLastSymbolX2(void* op, BIT_DStream_t* DStream, const HUF_DEltX2* dt, c } #define HUF_DECODE_SYMBOLX2_0(ptr, DStreamPtr) \ - ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog) + do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0) -#define HUF_DECODE_SYMBOLX2_1(ptr, DStreamPtr) \ - if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \ - ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog) +#define HUF_DECODE_SYMBOLX2_1(ptr, DStreamPtr) \ + do { \ + if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \ + ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \ + } while (0) -#define HUF_DECODE_SYMBOLX2_2(ptr, DStreamPtr) \ - if (MEM_64bits()) \ - ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog) +#define HUF_DECODE_SYMBOLX2_2(ptr, DStreamPtr) \ + do { \ + if (MEM_64bits()) \ + ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \ + } while (0) HINT_INLINE size_t HUF_decodeStreamX2(BYTE* p, BIT_DStream_t* bitDPtr, BYTE* const pEnd, @@ -1308,7 +1363,7 @@ HUF_decompress1X2_usingDTable_internal_body( /* decode */ { BYTE* const ostart = (BYTE*) dst; - BYTE* const oend = ostart + dstSize; + BYTE* const oend = ZSTD_maybeNullPtrAdd(ostart, dstSize); const void* const dtPtr = DTable+1; /* force compiler to not use strict-aliasing */ const HUF_DEltX2* const dt = (const HUF_DEltX2*)dtPtr; DTableDesc const dtd = HUF_getDTableDesc(DTable); @@ -1333,6 +1388,7 @@ HUF_decompress4X2_usingDTable_internal_body( const HUF_DTable* DTable) { if (cSrcSize < 10) return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */ + if (dstSize < 6) return ERROR(corruption_detected); /* stream 4-split doesn't work */ { const BYTE* const istart = (const BYTE*) cSrc; BYTE* const ostart = (BYTE*) dst; @@ -1368,7 +1424,7 @@ HUF_decompress4X2_usingDTable_internal_body( if (length4 > cSrcSize) return ERROR(corruption_detected); /* overflow */ if (opStart4 > oend) return ERROR(corruption_detected); /* overflow */ - if (dstSize < 6) return ERROR(corruption_detected); /* stream 4-split doesn't work */ + assert(dstSize >= 6 /* validated above */); CHECK_F( BIT_initDStream(&bitD1, istart1, length1) ); CHECK_F( BIT_initDStream(&bitD2, istart2, length2) ); CHECK_F( BIT_initDStream(&bitD3, istart3, length3) ); @@ -1473,7 +1529,7 @@ void HUF_decompress4X2_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* BYTE* op[4]; BYTE* oend[4]; HUF_DEltX2 const* const dtable = (HUF_DEltX2 const*)args->dt; - BYTE const* const ilimit = args->ilimit; + BYTE const* const ilowest = args->ilowest; /* Copy the arguments to local registers. */ ZSTD_memcpy(&bits, &args->bits, sizeof(bits)); @@ -1491,13 +1547,12 @@ void HUF_decompress4X2_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* for (;;) { BYTE* olimit; int stream; - int symbol; /* Assert loop preconditions */ #ifndef NDEBUG for (stream = 0; stream < 4; ++stream) { assert(op[stream] <= oend[stream]); - assert(ip[stream] >= ilimit); + assert(ip[stream] >= ilowest); } #endif /* Compute olimit */ @@ -1510,7 +1565,7 @@ void HUF_decompress4X2_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* * We also know that each input pointer is >= ip[0]. So we can run * iters loops before running out of input. */ - size_t iters = (size_t)(ip[0] - ilimit) / 7; + size_t iters = (size_t)(ip[0] - ilowest) / 7; /* Each iteration can produce up to 10 bytes of output per stream. * Each output stream my advance at different rates. So take the * minimum number of safe iterations among all the output streams. @@ -1528,8 +1583,8 @@ void HUF_decompress4X2_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* */ olimit = op[3] + (iters * 5); - /* Exit the fast decoding loop if we are too close to the end. */ - if (op[3] + 10 > olimit) + /* Exit the fast decoding loop once we reach the end. */ + if (op[3] == olimit) break; /* Exit the decoding loop if any input pointer has crossed the @@ -1548,54 +1603,58 @@ void HUF_decompress4X2_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* } #endif +#define HUF_4X2_DECODE_SYMBOL(_stream, _decode3) \ + do { \ + if ((_decode3) || (_stream) != 3) { \ + int const index = (int)(bits[(_stream)] >> 53); \ + HUF_DEltX2 const entry = dtable[index]; \ + MEM_write16(op[(_stream)], entry.sequence); \ + bits[(_stream)] <<= (entry.nbBits) & 0x3F; \ + op[(_stream)] += (entry.length); \ + } \ + } while (0) + +#define HUF_4X2_RELOAD_STREAM(_stream) \ + do { \ + HUF_4X2_DECODE_SYMBOL(3, 1); \ + { \ + int const ctz = ZSTD_countTrailingZeros64(bits[(_stream)]); \ + int const nbBits = ctz & 7; \ + int const nbBytes = ctz >> 3; \ + ip[(_stream)] -= nbBytes; \ + bits[(_stream)] = MEM_read64(ip[(_stream)]) | 1; \ + bits[(_stream)] <<= nbBits; \ + } \ + } while (0) + + /* Manually unroll the loop because compilers don't consistently + * unroll the inner loops, which destroys performance. + */ do { - /* Do 5 table lookups for each of the first 3 streams */ - for (symbol = 0; symbol < 5; ++symbol) { - for (stream = 0; stream < 3; ++stream) { - int const index = (int)(bits[stream] >> 53); - HUF_DEltX2 const entry = dtable[index]; - MEM_write16(op[stream], entry.sequence); - bits[stream] <<= (entry.nbBits); - op[stream] += (entry.length); - } - } - /* Do 1 table lookup from the final stream */ - { - int const index = (int)(bits[3] >> 53); - HUF_DEltX2 const entry = dtable[index]; - MEM_write16(op[3], entry.sequence); - bits[3] <<= (entry.nbBits); - op[3] += (entry.length); - } - /* Do 4 table lookups from the final stream & reload bitstreams */ - for (stream = 0; stream < 4; ++stream) { - /* Do a table lookup from the final stream. - * This is interleaved with the reloading to reduce register - * pressure. This shouldn't be necessary, but compilers can - * struggle with codegen with high register pressure. - */ - { - int const index = (int)(bits[3] >> 53); - HUF_DEltX2 const entry = dtable[index]; - MEM_write16(op[3], entry.sequence); - bits[3] <<= (entry.nbBits); - op[3] += (entry.length); - } - /* Reload the bistreams. The final bitstream must be reloaded - * after the 5th symbol was decoded. - */ - { - int const ctz = ZSTD_countTrailingZeros64(bits[stream]); - int const nbBits = ctz & 7; - int const nbBytes = ctz >> 3; - ip[stream] -= nbBytes; - bits[stream] = MEM_read64(ip[stream]) | 1; - bits[stream] <<= nbBits; - } - } + /* Decode 5 symbols from each of the first 3 streams. + * The final stream will be decoded during the reload phase + * to reduce register pressure. + */ + HUF_4X_FOR_EACH_STREAM_WITH_VAR(HUF_4X2_DECODE_SYMBOL, 0); + HUF_4X_FOR_EACH_STREAM_WITH_VAR(HUF_4X2_DECODE_SYMBOL, 0); + HUF_4X_FOR_EACH_STREAM_WITH_VAR(HUF_4X2_DECODE_SYMBOL, 0); + HUF_4X_FOR_EACH_STREAM_WITH_VAR(HUF_4X2_DECODE_SYMBOL, 0); + HUF_4X_FOR_EACH_STREAM_WITH_VAR(HUF_4X2_DECODE_SYMBOL, 0); + + /* Decode one symbol from the final stream */ + HUF_4X2_DECODE_SYMBOL(3, 1); + + /* Decode 4 symbols from the final stream & reload bitstreams. + * The final stream is reloaded last, meaning that all 5 symbols + * are decoded from the final stream before it is reloaded. + */ + HUF_4X_FOR_EACH_STREAM(HUF_4X2_RELOAD_STREAM); } while (op[3] < olimit); } +#undef HUF_4X2_DECODE_SYMBOL +#undef HUF_4X2_RELOAD_STREAM + _out: /* Save the final values of each of the state variables back to args. */ @@ -1612,8 +1671,8 @@ HUF_decompress4X2_usingDTable_internal_fast( const HUF_DTable* DTable, HUF_DecompressFastLoopFn loopFn) { void const* dt = DTable + 1; - const BYTE* const iend = (const BYTE*)cSrc + 6; - BYTE* const oend = (BYTE*)dst + dstSize; + const BYTE* const ilowest = (const BYTE*)cSrc; + BYTE* const oend = ZSTD_maybeNullPtrAdd((BYTE*)dst, dstSize); HUF_DecompressFastArgs args; { size_t const ret = HUF_DecompressFastArgs_init(&args, dst, dstSize, cSrc, cSrcSize, DTable); @@ -1622,16 +1681,19 @@ HUF_decompress4X2_usingDTable_internal_fast( return 0; } - assert(args.ip[0] >= args.ilimit); + assert(args.ip[0] >= args.ilowest); loopFn(&args); /* note : op4 already verified within main loop */ - assert(args.ip[0] >= iend); - assert(args.ip[1] >= iend); - assert(args.ip[2] >= iend); - assert(args.ip[3] >= iend); + assert(args.ip[0] >= ilowest); + assert(args.ip[1] >= ilowest); + assert(args.ip[2] >= ilowest); + assert(args.ip[3] >= ilowest); assert(args.op[3] <= oend); - (void)iend; + + assert(ilowest == args.ilowest); + assert(ilowest + 6 == args.iend[0]); + (void)ilowest; /* finish bitStreams one by one */ { @@ -1680,7 +1742,7 @@ static size_t HUF_decompress4X2_usingDTable_internal(void* dst, size_t dstSize, } #endif - if (!(flags & HUF_flags_disableFast)) { + if (HUF_ENABLE_FAST_DECODE && !(flags & HUF_flags_disableFast)) { size_t const ret = HUF_decompress4X2_usingDTable_internal_fast(dst, dstSize, cSrc, cSrcSize, DTable, loopFn); if (ret != 0) return ret; diff --git a/vendor/github.com/DataDog/zstd/huf_decompress_amd64.S b/vendor/github.com/DataDog/zstd/huf_decompress_amd64.S index e5dc9a6d..0f5105d8 100644 --- a/vendor/github.com/DataDog/zstd/huf_decompress_amd64.S +++ b/vendor/github.com/DataDog/zstd/huf_decompress_amd64.S @@ -10,11 +10,32 @@ #include "portability_macros.h" +#if defined(__ELF__) && defined(__GNUC__) /* Stack marking * ref: https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart */ -#if defined(__ELF__) && defined(__GNUC__) .section .note.GNU-stack,"",%progbits + +#if defined(__aarch64__) +/* Mark that this assembly supports BTI & PAC, because it is empty for aarch64. + * See: https://github.com/facebook/zstd/issues/3841 + * See: https://gcc.godbolt.org/z/sqr5T4ffK + * See: https://lore.kernel.org/linux-arm-kernel/20200429211641.9279-8-broonie@kernel.org/ + * See: https://reviews.llvm.org/D62609 + */ +.pushsection .note.gnu.property, "a" +.p2align 3 +.long 4 /* size of the name - "GNU\0" */ +.long 0x10 /* size of descriptor */ +.long 0x5 /* NT_GNU_PROPERTY_TYPE_0 */ +.asciz "GNU" +.long 0xc0000000 /* pr_type - GNU_PROPERTY_AARCH64_FEATURE_1_AND */ +.long 4 /* pr_datasz - 4 bytes */ +.long 3 /* pr_data - GNU_PROPERTY_AARCH64_FEATURE_1_BTI | GNU_PROPERTY_AARCH64_FEATURE_1_PAC */ +.p2align 3 /* pr_padding - bring everything to 8 byte alignment */ +.popsection +#endif + #endif #if ZSTD_ENABLE_ASM_X86_64_BMI2 @@ -131,7 +152,7 @@ HUF_decompress4X1_usingDTable_internal_fast_asm_loop: movq 88(%rax), %bits3 movq 96(%rax), %dtable push %rax /* argument */ - push 104(%rax) /* ilimit */ + push 104(%rax) /* ilowest */ push 112(%rax) /* oend */ push %olimit /* olimit space */ @@ -156,11 +177,11 @@ HUF_decompress4X1_usingDTable_internal_fast_asm_loop: shrq $2, %r15 movq %ip0, %rax /* rax = ip0 */ - movq 40(%rsp), %rdx /* rdx = ilimit */ - subq %rdx, %rax /* rax = ip0 - ilimit */ - movq %rax, %rbx /* rbx = ip0 - ilimit */ + movq 40(%rsp), %rdx /* rdx = ilowest */ + subq %rdx, %rax /* rax = ip0 - ilowest */ + movq %rax, %rbx /* rbx = ip0 - ilowest */ - /* rdx = (ip0 - ilimit) / 7 */ + /* rdx = (ip0 - ilowest) / 7 */ movabsq $2635249153387078803, %rdx mulq %rdx subq %rdx, %rbx @@ -183,9 +204,8 @@ HUF_decompress4X1_usingDTable_internal_fast_asm_loop: /* If (op3 + 20 > olimit) */ movq %op3, %rax /* rax = op3 */ - addq $20, %rax /* rax = op3 + 20 */ - cmpq %rax, %olimit /* op3 + 20 > olimit */ - jb .L_4X1_exit + cmpq %rax, %olimit /* op3 == olimit */ + je .L_4X1_exit /* If (ip1 < ip0) go to exit */ cmpq %ip0, %ip1 @@ -316,7 +336,7 @@ HUF_decompress4X1_usingDTable_internal_fast_asm_loop: /* Restore stack (oend & olimit) */ pop %rax /* olimit */ pop %rax /* oend */ - pop %rax /* ilimit */ + pop %rax /* ilowest */ pop %rax /* arg */ /* Save ip / op / bits */ @@ -387,7 +407,7 @@ HUF_decompress4X2_usingDTable_internal_fast_asm_loop: movq 96(%rax), %dtable push %rax /* argument */ push %rax /* olimit */ - push 104(%rax) /* ilimit */ + push 104(%rax) /* ilowest */ movq 112(%rax), %rax push %rax /* oend3 */ @@ -414,9 +434,9 @@ HUF_decompress4X2_usingDTable_internal_fast_asm_loop: /* We can consume up to 7 input bytes each iteration. */ movq %ip0, %rax /* rax = ip0 */ - movq 40(%rsp), %rdx /* rdx = ilimit */ - subq %rdx, %rax /* rax = ip0 - ilimit */ - movq %rax, %r15 /* r15 = ip0 - ilimit */ + movq 40(%rsp), %rdx /* rdx = ilowest */ + subq %rdx, %rax /* rax = ip0 - ilowest */ + movq %rax, %r15 /* r15 = ip0 - ilowest */ /* rdx = rax / 7 */ movabsq $2635249153387078803, %rdx @@ -426,7 +446,7 @@ HUF_decompress4X2_usingDTable_internal_fast_asm_loop: addq %r15, %rdx shrq $2, %rdx - /* r15 = (ip0 - ilimit) / 7 */ + /* r15 = (ip0 - ilowest) / 7 */ movq %rdx, %r15 /* r15 = min(r15, min(oend0 - op0, oend1 - op1, oend2 - op2, oend3 - op3) / 10) */ @@ -467,9 +487,8 @@ HUF_decompress4X2_usingDTable_internal_fast_asm_loop: /* If (op3 + 10 > olimit) */ movq %op3, %rax /* rax = op3 */ - addq $10, %rax /* rax = op3 + 10 */ - cmpq %rax, %olimit /* op3 + 10 > olimit */ - jb .L_4X2_exit + cmpq %rax, %olimit /* op3 == olimit */ + je .L_4X2_exit /* If (ip1 < ip0) go to exit */ cmpq %ip0, %ip1 @@ -537,7 +556,7 @@ HUF_decompress4X2_usingDTable_internal_fast_asm_loop: pop %rax /* oend1 */ pop %rax /* oend2 */ pop %rax /* oend3 */ - pop %rax /* ilimit */ + pop %rax /* ilowest */ pop %rax /* olimit */ pop %rax /* arg */ diff --git a/vendor/github.com/DataDog/zstd/mem.h b/vendor/github.com/DataDog/zstd/mem.h index a6007c93..d469f232 100644 --- a/vendor/github.com/DataDog/zstd/mem.h +++ b/vendor/github.com/DataDog/zstd/mem.h @@ -32,15 +32,6 @@ extern "C" { # include /* _byteswap_ulong */ # include /* _byteswap_* */ #endif -#if defined(__GNUC__) -# define MEM_STATIC static __inline __attribute__((unused)) -#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -# define MEM_STATIC static inline -#elif defined(_MSC_VER) -# define MEM_STATIC static __inline -#else -# define MEM_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */ -#endif /*-************************************************************** * Basic Types diff --git a/vendor/github.com/DataDog/zstd/pool.c b/vendor/github.com/DataDog/zstd/pool.c index d067ac36..943c20ab 100644 --- a/vendor/github.com/DataDog/zstd/pool.c +++ b/vendor/github.com/DataDog/zstd/pool.c @@ -224,7 +224,7 @@ static int POOL_resize_internal(POOL_ctx* ctx, size_t numThreads) { ZSTD_pthread_t* const threadPool = (ZSTD_pthread_t*)ZSTD_customCalloc(numThreads * sizeof(ZSTD_pthread_t), ctx->customMem); if (!threadPool) return 1; /* replace existing thread pool */ - ZSTD_memcpy(threadPool, ctx->threads, ctx->threadCapacity * sizeof(*threadPool)); + ZSTD_memcpy(threadPool, ctx->threads, ctx->threadCapacity * sizeof(ZSTD_pthread_t)); ZSTD_customFree(ctx->threads, ctx->customMem); ctx->threads = threadPool; /* Initialize additional threads */ diff --git a/vendor/github.com/DataDog/zstd/pool.h b/vendor/github.com/DataDog/zstd/pool.h index 7dcf4959..3bec4337 100644 --- a/vendor/github.com/DataDog/zstd/pool.h +++ b/vendor/github.com/DataDog/zstd/pool.h @@ -48,7 +48,7 @@ void POOL_joinJobs(POOL_ctx* ctx); /*! POOL_resize() : * Expands or shrinks pool's number of threads. * This is more efficient than releasing + creating a new context, - * since it tries to preserve and re-use existing threads. + * since it tries to preserve and reuse existing threads. * `numThreads` must be at least 1. * @return : 0 when resize was successful, * !0 (typically 1) if there is an error. diff --git a/vendor/github.com/DataDog/zstd/portability_macros.h b/vendor/github.com/DataDog/zstd/portability_macros.h index ecf5453b..328bec72 100644 --- a/vendor/github.com/DataDog/zstd/portability_macros.h +++ b/vendor/github.com/DataDog/zstd/portability_macros.h @@ -69,6 +69,8 @@ /* Mark the internal assembly functions as hidden */ #ifdef __ELF__ # define ZSTD_HIDE_ASM_FUNCTION(func) .hidden func +#elif defined(__APPLE__) +# define ZSTD_HIDE_ASM_FUNCTION(func) .private_extern func #else # define ZSTD_HIDE_ASM_FUNCTION(func) #endif diff --git a/vendor/github.com/DataDog/zstd/threading.c b/vendor/github.com/DataDog/zstd/threading.c index df3c7ddf..01908a6e 100644 --- a/vendor/github.com/DataDog/zstd/threading.c +++ b/vendor/github.com/DataDog/zstd/threading.c @@ -74,10 +74,12 @@ int ZSTD_pthread_create(ZSTD_pthread_t* thread, const void* unused, ZSTD_thread_params_t thread_param; (void)unused; + if (thread==NULL) return -1; + *thread = NULL; + thread_param.start_routine = start_routine; thread_param.arg = arg; thread_param.initialized = 0; - *thread = NULL; /* Setup thread initialization synchronization */ if(ZSTD_pthread_cond_init(&thread_param.initialized_cond, NULL)) { @@ -92,7 +94,7 @@ int ZSTD_pthread_create(ZSTD_pthread_t* thread, const void* unused, /* Spawn thread */ *thread = (HANDLE)_beginthreadex(NULL, 0, worker, &thread_param, 0, NULL); - if (!thread) { + if (*thread==NULL) { ZSTD_pthread_mutex_destroy(&thread_param.initialized_mutex); ZSTD_pthread_cond_destroy(&thread_param.initialized_cond); return errno; @@ -138,6 +140,7 @@ int ZSTD_pthread_join(ZSTD_pthread_t thread) int ZSTD_pthread_mutex_init(ZSTD_pthread_mutex_t* mutex, pthread_mutexattr_t const* attr) { + assert(mutex != NULL); *mutex = (pthread_mutex_t*)ZSTD_malloc(sizeof(pthread_mutex_t)); if (!*mutex) return 1; @@ -146,6 +149,7 @@ int ZSTD_pthread_mutex_init(ZSTD_pthread_mutex_t* mutex, pthread_mutexattr_t con int ZSTD_pthread_mutex_destroy(ZSTD_pthread_mutex_t* mutex) { + assert(mutex != NULL); if (!*mutex) return 0; { @@ -157,6 +161,7 @@ int ZSTD_pthread_mutex_destroy(ZSTD_pthread_mutex_t* mutex) int ZSTD_pthread_cond_init(ZSTD_pthread_cond_t* cond, pthread_condattr_t const* attr) { + assert(cond != NULL); *cond = (pthread_cond_t*)ZSTD_malloc(sizeof(pthread_cond_t)); if (!*cond) return 1; @@ -165,6 +170,7 @@ int ZSTD_pthread_cond_init(ZSTD_pthread_cond_t* cond, pthread_condattr_t const* int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond) { + assert(cond != NULL); if (!*cond) return 0; { diff --git a/vendor/github.com/DataDog/zstd/xxhash.c b/vendor/github.com/DataDog/zstd/xxhash.c index 71df219c..1096adcc 100644 --- a/vendor/github.com/DataDog/zstd/xxhash.c +++ b/vendor/github.com/DataDog/zstd/xxhash.c @@ -1,26 +1,20 @@ #ifndef USE_EXTERNAL_ZSTD /* - * xxHash - Fast Hash algorithm - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * You can contact the author at : - * - xxHash homepage: https://cyan4973.github.io/xxHash/ - * - xxHash source repository : https://github.com/Cyan4973/xxHash + * xxHash - Extremely Fast Hash algorithm + * Copyright (c) Yann Collet - Meta Platforms, Inc * * This source code is licensed under both the BSD-style license (found in the * LICENSE file in the root directory of this source tree) and the GPLv2 (found * in the COPYING file in the root directory of this source tree). * You may select, at your option, one of the above-listed licenses. -*/ - - + */ /* * xxhash.c instantiates functions defined in xxhash.h */ -#define XXH_STATIC_LINKING_ONLY /* access advanced declarations */ -#define XXH_IMPLEMENTATION /* access definitions */ +#define XXH_STATIC_LINKING_ONLY /* access advanced declarations */ +#define XXH_IMPLEMENTATION /* access definitions */ #include "xxhash.h" diff --git a/vendor/github.com/DataDog/zstd/xxhash.h b/vendor/github.com/DataDog/zstd/xxhash.h index 8675d59b..0c64cd37 100644 --- a/vendor/github.com/DataDog/zstd/xxhash.h +++ b/vendor/github.com/DataDog/zstd/xxhash.h @@ -1,18 +1,16 @@ #ifndef USE_EXTERNAL_ZSTD /* - * xxHash - Fast Hash algorithm - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * You can contact the author at : - * - xxHash homepage: https://cyan4973.github.io/xxHash/ - * - xxHash source repository : https://github.com/Cyan4973/xxHash + * xxHash - Extremely Fast Hash algorithm + * Header File + * Copyright (c) Yann Collet - Meta Platforms, Inc * * This source code is licensed under both the BSD-style license (found in the * LICENSE file in the root directory of this source tree) and the GPLv2 (found * in the COPYING file in the root directory of this source tree). * You may select, at your option, one of the above-listed licenses. -*/ + */ +/* Local adaptations for Zstandard */ #ifndef XXH_NO_XXH3 # define XXH_NO_XXH3 @@ -25,46 +23,210 @@ /*! * @mainpage xxHash * + * xxHash is an extremely fast non-cryptographic hash algorithm, working at RAM speed + * limits. + * + * It is proposed in four flavors, in three families: + * 1. @ref XXH32_family + * - Classic 32-bit hash function. Simple, compact, and runs on almost all + * 32-bit and 64-bit systems. + * 2. @ref XXH64_family + * - Classic 64-bit adaptation of XXH32. Just as simple, and runs well on most + * 64-bit systems (but _not_ 32-bit systems). + * 3. @ref XXH3_family + * - Modern 64-bit and 128-bit hash function family which features improved + * strength and performance across the board, especially on smaller data. + * It benefits greatly from SIMD and 64-bit without requiring it. + * + * Benchmarks + * --- + * The reference system uses an Intel i7-9700K CPU, and runs Ubuntu x64 20.04. + * The open source benchmark program is compiled with clang v10.0 using -O3 flag. + * + * | Hash Name | ISA ext | Width | Large Data Speed | Small Data Velocity | + * | -------------------- | ------- | ----: | ---------------: | ------------------: | + * | XXH3_64bits() | @b AVX2 | 64 | 59.4 GB/s | 133.1 | + * | MeowHash | AES-NI | 128 | 58.2 GB/s | 52.5 | + * | XXH3_128bits() | @b AVX2 | 128 | 57.9 GB/s | 118.1 | + * | CLHash | PCLMUL | 64 | 37.1 GB/s | 58.1 | + * | XXH3_64bits() | @b SSE2 | 64 | 31.5 GB/s | 133.1 | + * | XXH3_128bits() | @b SSE2 | 128 | 29.6 GB/s | 118.1 | + * | RAM sequential read | | N/A | 28.0 GB/s | N/A | + * | ahash | AES-NI | 64 | 22.5 GB/s | 107.2 | + * | City64 | | 64 | 22.0 GB/s | 76.6 | + * | T1ha2 | | 64 | 22.0 GB/s | 99.0 | + * | City128 | | 128 | 21.7 GB/s | 57.7 | + * | FarmHash | AES-NI | 64 | 21.3 GB/s | 71.9 | + * | XXH64() | | 64 | 19.4 GB/s | 71.0 | + * | SpookyHash | | 64 | 19.3 GB/s | 53.2 | + * | Mum | | 64 | 18.0 GB/s | 67.0 | + * | CRC32C | SSE4.2 | 32 | 13.0 GB/s | 57.9 | + * | XXH32() | | 32 | 9.7 GB/s | 71.9 | + * | City32 | | 32 | 9.1 GB/s | 66.0 | + * | Blake3* | @b AVX2 | 256 | 4.4 GB/s | 8.1 | + * | Murmur3 | | 32 | 3.9 GB/s | 56.1 | + * | SipHash* | | 64 | 3.0 GB/s | 43.2 | + * | Blake3* | @b SSE2 | 256 | 2.4 GB/s | 8.1 | + * | HighwayHash | | 64 | 1.4 GB/s | 6.0 | + * | FNV64 | | 64 | 1.2 GB/s | 62.7 | + * | Blake2* | | 256 | 1.1 GB/s | 5.1 | + * | SHA1* | | 160 | 0.8 GB/s | 5.6 | + * | MD5* | | 128 | 0.6 GB/s | 7.8 | + * @note + * - Hashes which require a specific ISA extension are noted. SSE2 is also noted, + * even though it is mandatory on x64. + * - Hashes with an asterisk are cryptographic. Note that MD5 is non-cryptographic + * by modern standards. + * - Small data velocity is a rough average of algorithm's efficiency for small + * data. For more accurate information, see the wiki. + * - More benchmarks and strength tests are found on the wiki: + * https://github.com/Cyan4973/xxHash/wiki + * + * Usage + * ------ + * All xxHash variants use a similar API. Changing the algorithm is a trivial + * substitution. + * + * @pre + * For functions which take an input and length parameter, the following + * requirements are assumed: + * - The range from [`input`, `input + length`) is valid, readable memory. + * - The only exception is if the `length` is `0`, `input` may be `NULL`. + * - For C++, the objects must have the *TriviallyCopyable* property, as the + * functions access bytes directly as if it was an array of `unsigned char`. + * + * @anchor single_shot_example + * **Single Shot** + * + * These functions are stateless functions which hash a contiguous block of memory, + * immediately returning the result. They are the easiest and usually the fastest + * option. + * + * XXH32(), XXH64(), XXH3_64bits(), XXH3_128bits() + * + * @code{.c} + * #include + * #include "xxhash.h" + * + * // Example for a function which hashes a null terminated string with XXH32(). + * XXH32_hash_t hash_string(const char* string, XXH32_hash_t seed) + * { + * // NULL pointers are only valid if the length is zero + * size_t length = (string == NULL) ? 0 : strlen(string); + * return XXH32(string, length, seed); + * } + * @endcode + * + * + * @anchor streaming_example + * **Streaming** + * + * These groups of functions allow incremental hashing of unknown size, even + * more than what would fit in a size_t. + * + * XXH32_reset(), XXH64_reset(), XXH3_64bits_reset(), XXH3_128bits_reset() + * + * @code{.c} + * #include + * #include + * #include "xxhash.h" + * // Example for a function which hashes a FILE incrementally with XXH3_64bits(). + * XXH64_hash_t hashFile(FILE* f) + * { + * // Allocate a state struct. Do not just use malloc() or new. + * XXH3_state_t* state = XXH3_createState(); + * assert(state != NULL && "Out of memory!"); + * // Reset the state to start a new hashing session. + * XXH3_64bits_reset(state); + * char buffer[4096]; + * size_t count; + * // Read the file in chunks + * while ((count = fread(buffer, 1, sizeof(buffer), f)) != 0) { + * // Run update() as many times as necessary to process the data + * XXH3_64bits_update(state, buffer, count); + * } + * // Retrieve the finalized hash. This will not change the state. + * XXH64_hash_t result = XXH3_64bits_digest(state); + * // Free the state. Do not use free(). + * XXH3_freeState(state); + * return result; + * } + * @endcode + * + * Streaming functions generate the xxHash value from an incremental input. + * This method is slower than single-call functions, due to state management. + * For small inputs, prefer `XXH32()` and `XXH64()`, which are better optimized. + * + * An XXH state must first be allocated using `XXH*_createState()`. + * + * Start a new hash by initializing the state with a seed using `XXH*_reset()`. + * + * Then, feed the hash state by calling `XXH*_update()` as many times as necessary. + * + * The function returns an error code, with 0 meaning OK, and any other value + * meaning there is an error. + * + * Finally, a hash value can be produced anytime, by using `XXH*_digest()`. + * This function returns the nn-bits hash as an int or long long. + * + * It's still possible to continue inserting input into the hash state after a + * digest, and generate new hash values later on by invoking `XXH*_digest()`. + * + * When done, release the state using `XXH*_freeState()`. + * + * + * @anchor canonical_representation_example + * **Canonical Representation** + * + * The default return values from XXH functions are unsigned 32, 64 and 128 bit + * integers. + * This the simplest and fastest format for further post-processing. + * + * However, this leaves open the question of what is the order on the byte level, + * since little and big endian conventions will store the same number differently. + * + * The canonical representation settles this issue by mandating big-endian + * convention, the same convention as human-readable numbers (large digits first). + * + * When writing hash values to storage, sending them over a network, or printing + * them, it's highly recommended to use the canonical representation to ensure + * portability across a wider range of systems, present and future. + * + * The following functions allow transformation of hash values to and from + * canonical format. + * + * XXH32_canonicalFromHash(), XXH32_hashFromCanonical(), + * XXH64_canonicalFromHash(), XXH64_hashFromCanonical(), + * XXH128_canonicalFromHash(), XXH128_hashFromCanonical(), + * + * @code{.c} + * #include + * #include "xxhash.h" + * + * // Example for a function which prints XXH32_hash_t in human readable format + * void printXxh32(XXH32_hash_t hash) + * { + * XXH32_canonical_t cano; + * XXH32_canonicalFromHash(&cano, hash); + * size_t i; + * for(i = 0; i < sizeof(cano.digest); ++i) { + * printf("%02x", cano.digest[i]); + * } + * printf("\n"); + * } + * + * // Example for a function which converts XXH32_canonical_t to XXH32_hash_t + * XXH32_hash_t convertCanonicalToXxh32(XXH32_canonical_t cano) + * { + * XXH32_hash_t hash = XXH32_hashFromCanonical(&cano); + * return hash; + * } + * @endcode + * + * * @file xxhash.h * xxHash prototypes and implementation */ -/* TODO: update */ -/* Notice extracted from xxHash homepage: - -xxHash is an extremely fast hash algorithm, running at RAM speed limits. -It also successfully passes all tests from the SMHasher suite. - -Comparison (single thread, Windows Seven 32 bits, using SMHasher on a Core 2 Duo @3GHz) - -Name Speed Q.Score Author -xxHash 5.4 GB/s 10 -CrapWow 3.2 GB/s 2 Andrew -MurmurHash 3a 2.7 GB/s 10 Austin Appleby -SpookyHash 2.0 GB/s 10 Bob Jenkins -SBox 1.4 GB/s 9 Bret Mulvey -Lookup3 1.2 GB/s 9 Bob Jenkins -SuperFastHash 1.2 GB/s 1 Paul Hsieh -CityHash64 1.05 GB/s 10 Pike & Alakuijala -FNV 0.55 GB/s 5 Fowler, Noll, Vo -CRC32 0.43 GB/s 9 -MD5-32 0.33 GB/s 10 Ronald L. Rivest -SHA1-32 0.28 GB/s 10 - -Q.Score is a measure of quality of the hash function. -It depends on successfully passing SMHasher test set. -10 is a perfect score. - -Note: SMHasher's CRC32 implementation is not the fastest one. -Other speed-oriented implementations can be faster, -especially in combination with PCLMUL instruction: -https://fastcompression.blogspot.com/2019/03/presenting-xxh3.html?showComment=1552696407071#c3490092340461170735 - -A 64-bit version, named XXH64, is available since r35. -It offers much better speed, but for 64-bit applications only. -Name Speed on 64 bits Speed on 32 bits -XXH64 13.8 GB/s 1.9 GB/s -XXH32 6.8 GB/s 6.0 GB/s -*/ #if defined (__cplusplus) extern "C" { @@ -74,21 +236,80 @@ extern "C" { * INLINE mode ******************************/ /*! - * XXH_INLINE_ALL (and XXH_PRIVATE_API) + * @defgroup public Public API + * Contains details on the public xxHash functions. + * @{ + */ +#ifdef XXH_DOXYGEN +/*! + * @brief Gives access to internal state declaration, required for static allocation. + * + * Incompatible with dynamic linking, due to risks of ABI changes. + * + * Usage: + * @code{.c} + * #define XXH_STATIC_LINKING_ONLY + * #include "xxhash.h" + * @endcode + */ +# define XXH_STATIC_LINKING_ONLY +/* Do not undef XXH_STATIC_LINKING_ONLY for Doxygen */ + +/*! + * @brief Gives access to internal definitions. + * + * Usage: + * @code{.c} + * #define XXH_STATIC_LINKING_ONLY + * #define XXH_IMPLEMENTATION + * #include "xxhash.h" + * @endcode + */ +# define XXH_IMPLEMENTATION +/* Do not undef XXH_IMPLEMENTATION for Doxygen */ + +/*! + * @brief Exposes the implementation and marks all functions as `inline`. + * * Use these build macros to inline xxhash into the target unit. * Inlining improves performance on small inputs, especially when the length is * expressed as a compile-time constant: * - * https://fastcompression.blogspot.com/2018/03/xxhash-for-small-keys-impressive-power.html + * https://fastcompression.blogspot.com/2018/03/xxhash-for-small-keys-impressive-power.html * * It also keeps xxHash symbols private to the unit, so they are not exported. * * Usage: + * @code{.c} * #define XXH_INLINE_ALL * #include "xxhash.h" - * + * @endcode * Do not compile and link xxhash.o as a separate object, as it is not useful. */ +# define XXH_INLINE_ALL +# undef XXH_INLINE_ALL +/*! + * @brief Exposes the implementation without marking functions as inline. + */ +# define XXH_PRIVATE_API +# undef XXH_PRIVATE_API +/*! + * @brief Emulate a namespace by transparently prefixing all symbols. + * + * If you want to include _and expose_ xxHash functions from within your own + * library, but also want to avoid symbol collisions with other libraries which + * may also include xxHash, you can use @ref XXH_NAMESPACE to automatically prefix + * any public symbol from xxhash library with the value of @ref XXH_NAMESPACE + * (therefore, avoid empty or numeric values). + * + * Note that no change is required within the calling program as long as it + * includes `xxhash.h`: Regular symbol names will be automatically translated + * by this header. + */ +# define XXH_NAMESPACE /* YOUR NAME HERE */ +# undef XXH_NAMESPACE +#endif + #if (defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API)) \ && !defined(XXH_INLINE_ALL_31684351384) /* this section should be traversed only once */ @@ -203,21 +424,13 @@ extern "C" { # undef XXHASH_H_STATIC_13879238742 #endif /* XXH_INLINE_ALL || XXH_PRIVATE_API */ - - /* **************************************************************** * Stable API *****************************************************************/ #ifndef XXHASH_H_5627135585666179 #define XXHASH_H_5627135585666179 1 - -/*! - * @defgroup public Public API - * Contains details on the public xxHash functions. - * @{ - */ -/* specific declaration modes for Windows */ +/*! @brief Marks a global symbol. */ #if !defined(XXH_INLINE_ALL) && !defined(XXH_PRIVATE_API) # if defined(WIN32) && defined(_MSC_VER) && (defined(XXH_IMPORT) || defined(XXH_EXPORT)) # ifdef XXH_EXPORT @@ -230,24 +443,6 @@ extern "C" { # endif #endif -#ifdef XXH_DOXYGEN -/*! - * @brief Emulate a namespace by transparently prefixing all symbols. - * - * If you want to include _and expose_ xxHash functions from within your own - * library, but also want to avoid symbol collisions with other libraries which - * may also include xxHash, you can use XXH_NAMESPACE to automatically prefix - * any public symbol from xxhash library with the value of XXH_NAMESPACE - * (therefore, avoid empty or numeric values). - * - * Note that no change is required within the calling program as long as it - * includes `xxhash.h`: Regular symbol names will be automatically translated - * by this header. - */ -# define XXH_NAMESPACE /* YOUR NAME HERE */ -# undef XXH_NAMESPACE -#endif - #ifdef XXH_NAMESPACE # define XXH_CAT(A,B) A##B # define XXH_NAME2(A,B) XXH_CAT(A,B) @@ -307,12 +502,40 @@ extern "C" { #endif +/* ************************************* +* Compiler specifics +***************************************/ + +/* specific declaration modes for Windows */ +#if !defined(XXH_INLINE_ALL) && !defined(XXH_PRIVATE_API) +# if defined(WIN32) && defined(_MSC_VER) && (defined(XXH_IMPORT) || defined(XXH_EXPORT)) +# ifdef XXH_EXPORT +# define XXH_PUBLIC_API __declspec(dllexport) +# elif XXH_IMPORT +# define XXH_PUBLIC_API __declspec(dllimport) +# endif +# else +# define XXH_PUBLIC_API /* do nothing */ +# endif +#endif + +#if defined (__GNUC__) +# define XXH_CONSTF __attribute__((const)) +# define XXH_PUREF __attribute__((pure)) +# define XXH_MALLOCF __attribute__((malloc)) +#else +# define XXH_CONSTF /* disable */ +# define XXH_PUREF +# define XXH_MALLOCF +#endif + /* ************************************* * Version ***************************************/ #define XXH_VERSION_MAJOR 0 #define XXH_VERSION_MINOR 8 -#define XXH_VERSION_RELEASE 1 +#define XXH_VERSION_RELEASE 2 +/*! @brief Version number, encoded as two digits each */ #define XXH_VERSION_NUMBER (XXH_VERSION_MAJOR *100*100 + XXH_VERSION_MINOR *100 + XXH_VERSION_RELEASE) /*! @@ -321,16 +544,22 @@ extern "C" { * This is mostly useful when xxHash is compiled as a shared library, * since the returned value comes from the library, as opposed to header file. * - * @return `XXH_VERSION_NUMBER` of the invoked library. + * @return @ref XXH_VERSION_NUMBER of the invoked library. */ -XXH_PUBLIC_API unsigned XXH_versionNumber (void); +XXH_PUBLIC_API XXH_CONSTF unsigned XXH_versionNumber (void); /* **************************** * Common basic types ******************************/ #include /* size_t */ -typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode; +/*! + * @brief Exit code for the streaming API. + */ +typedef enum { + XXH_OK = 0, /*!< OK */ + XXH_ERROR /*!< Error */ +} XXH_errorcode; /*-********************************************************************** @@ -347,44 +576,44 @@ typedef uint32_t XXH32_hash_t; #elif !defined (__VMS) \ && (defined (__cplusplus) \ || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) -# include +# ifdef _AIX +# include +# else +# include +# endif typedef uint32_t XXH32_hash_t; #else # include # if UINT_MAX == 0xFFFFFFFFUL typedef unsigned int XXH32_hash_t; +# elif ULONG_MAX == 0xFFFFFFFFUL + typedef unsigned long XXH32_hash_t; # else -# if ULONG_MAX == 0xFFFFFFFFUL - typedef unsigned long XXH32_hash_t; -# else -# error "unsupported platform: need a 32-bit type" -# endif +# error "unsupported platform: need a 32-bit type" # endif #endif /*! * @} * - * @defgroup xxh32_family XXH32 family + * @defgroup XXH32_family XXH32 family * @ingroup public * Contains functions used in the classic 32-bit xxHash algorithm. * * @note * XXH32 is useful for older platforms, with no or poor 64-bit performance. - * Note that @ref xxh3_family provides competitive speed - * for both 32-bit and 64-bit systems, and offers true 64/128 bit hash results. + * Note that the @ref XXH3_family provides competitive speed for both 32-bit + * and 64-bit systems, and offers true 64/128 bit hash results. * - * @see @ref xxh64_family, @ref xxh3_family : Other xxHash families - * @see @ref xxh32_impl for implementation details + * @see @ref XXH64_family, @ref XXH3_family : Other xxHash families + * @see @ref XXH32_impl for implementation details * @{ */ /*! * @brief Calculates the 32-bit hash of @p input using xxHash32. * - * Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark): 5.4 GB/s - * * @param input The block of data to be hashed, at least @p length bytes in size. * @param length The length of @p input, in bytes. * @param seed The 32-bit seed to alter the hash's output predictably. @@ -394,66 +623,13 @@ typedef uint32_t XXH32_hash_t; * readable, contiguous memory. However, if @p length is `0`, @p input may be * `NULL`. In C++, this also must be *TriviallyCopyable*. * - * @return The calculated 32-bit hash value. + * @return The calculated 32-bit xxHash32 value. * - * @see - * XXH64(), XXH3_64bits_withSeed(), XXH3_128bits_withSeed(), XXH128(): - * Direct equivalents for the other variants of xxHash. - * @see - * XXH32_createState(), XXH32_update(), XXH32_digest(): Streaming version. - */ -XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t length, XXH32_hash_t seed); - -/*! - * Streaming functions generate the xxHash value from an incremental input. - * This method is slower than single-call functions, due to state management. - * For small inputs, prefer `XXH32()` and `XXH64()`, which are better optimized. - * - * An XXH state must first be allocated using `XXH*_createState()`. - * - * Start a new hash by initializing the state with a seed using `XXH*_reset()`. - * - * Then, feed the hash state by calling `XXH*_update()` as many times as necessary. - * - * The function returns an error code, with 0 meaning OK, and any other value - * meaning there is an error. - * - * Finally, a hash value can be produced anytime, by using `XXH*_digest()`. - * This function returns the nn-bits hash as an int or long long. - * - * It's still possible to continue inserting input into the hash state after a - * digest, and generate new hash values later on by invoking `XXH*_digest()`. - * - * When done, release the state using `XXH*_freeState()`. - * - * Example code for incrementally hashing a file: - * @code{.c} - * #include - * #include - * #define BUFFER_SIZE 256 - * - * // Note: XXH64 and XXH3 use the same interface. - * XXH32_hash_t - * hashFile(FILE* stream) - * { - * XXH32_state_t* state; - * unsigned char buf[BUFFER_SIZE]; - * size_t amt; - * XXH32_hash_t hash; - * - * state = XXH32_createState(); // Create a state - * assert(state != NULL); // Error check here - * XXH32_reset(state, 0xbaad5eed); // Reset state with our seed - * while ((amt = fread(buf, 1, sizeof(buf), stream)) != 0) { - * XXH32_update(state, buf, amt); // Hash the file in chunks - * } - * hash = XXH32_digest(state); // Finalize the hash - * XXH32_freeState(state); // Clean up - * return hash; - * } - * @endcode + * @see @ref single_shot_example "Single Shot Example" for an example. */ +XXH_PUBLIC_API XXH_PUREF XXH32_hash_t XXH32 (const void* input, size_t length, XXH32_hash_t seed); +#ifndef XXH_NO_STREAM /*! * @typedef struct XXH32_state_s XXH32_state_t * @brief The opaque state struct for the XXH32 streaming API. @@ -465,16 +641,21 @@ typedef struct XXH32_state_s XXH32_state_t; /*! * @brief Allocates an @ref XXH32_state_t. * - * Must be freed with XXH32_freeState(). - * @return An allocated XXH32_state_t on success, `NULL` on failure. + * @return An allocated pointer of @ref XXH32_state_t on success. + * @return `NULL` on failure. + * + * @note Must be freed with XXH32_freeState(). */ -XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void); +XXH_PUBLIC_API XXH_MALLOCF XXH32_state_t* XXH32_createState(void); /*! * @brief Frees an @ref XXH32_state_t. * - * Must be allocated with XXH32_createState(). * @param statePtr A pointer to an @ref XXH32_state_t allocated with @ref XXH32_createState(). - * @return XXH_OK. + * + * @return @ref XXH_OK. + * + * @note @p statePtr must be allocated with XXH32_createState(). + * */ XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr); /*! @@ -490,23 +671,22 @@ XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dst_state, const XXH32_state_ /*! * @brief Resets an @ref XXH32_state_t to begin a new hash. * - * This function resets and seeds a state. Call it before @ref XXH32_update(). - * * @param statePtr The state struct to reset. * @param seed The 32-bit seed to alter the hash result predictably. * * @pre * @p statePtr must not be `NULL`. * - * @return @ref XXH_OK on success, @ref XXH_ERROR on failure. + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note This function resets and seeds a state. Call it before @ref XXH32_update(). */ XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, XXH32_hash_t seed); /*! * @brief Consumes a block of @p input to an @ref XXH32_state_t. * - * Call this to incrementally consume blocks of data. - * * @param statePtr The state struct to update. * @param input The block of data to be hashed, at least @p length bytes in size. * @param length The length of @p input, in bytes. @@ -518,47 +698,32 @@ XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, XXH32_hash_t * readable, contiguous memory. However, if @p length is `0`, @p input may be * `NULL`. In C++, this also must be *TriviallyCopyable*. * - * @return @ref XXH_OK on success, @ref XXH_ERROR on failure. + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note Call this to incrementally consume blocks of data. */ XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length); /*! * @brief Returns the calculated hash value from an @ref XXH32_state_t. * - * @note - * Calling XXH32_digest() will not affect @p statePtr, so you can update, - * digest, and update again. - * * @param statePtr The state struct to calculate the hash from. * * @pre * @p statePtr must not be `NULL`. * - * @return The calculated xxHash32 value from that state. + * @return The calculated 32-bit xxHash32 value from that state. + * + * @note + * Calling XXH32_digest() will not affect @p statePtr, so you can update, + * digest, and update again. */ -XXH_PUBLIC_API XXH32_hash_t XXH32_digest (const XXH32_state_t* statePtr); +XXH_PUBLIC_API XXH_PUREF XXH32_hash_t XXH32_digest (const XXH32_state_t* statePtr); +#endif /* !XXH_NO_STREAM */ /******* Canonical representation *******/ -/* - * The default return values from XXH functions are unsigned 32 and 64 bit - * integers. - * This the simplest and fastest format for further post-processing. - * - * However, this leaves open the question of what is the order on the byte level, - * since little and big endian conventions will store the same number differently. - * - * The canonical representation settles this issue by mandating big-endian - * convention, the same convention as human-readable numbers (large digits first). - * - * When writing hash values to storage, sending them over a network, or printing - * them, it's highly recommended to use the canonical representation to ensure - * portability across a wider range of systems, present and future. - * - * The following functions allow transformation of hash values to and from - * canonical format. - */ - /*! * @brief Canonical (big endian) representation of @ref XXH32_hash_t. */ @@ -569,11 +734,13 @@ typedef struct { /*! * @brief Converts an @ref XXH32_hash_t to a big endian @ref XXH32_canonical_t. * - * @param dst The @ref XXH32_canonical_t pointer to be stored to. + * @param dst The @ref XXH32_canonical_t pointer to be stored to. * @param hash The @ref XXH32_hash_t to be converted. * * @pre * @p dst must not be `NULL`. + * + * @see @ref canonical_representation_example "Canonical Representation Example" */ XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash); @@ -586,44 +753,75 @@ XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t * @p src must not be `NULL`. * * @return The converted hash. + * + * @see @ref canonical_representation_example "Canonical Representation Example" */ -XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src); +XXH_PUBLIC_API XXH_PUREF XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src); +/*! @cond Doxygen ignores this part */ #ifdef __has_attribute # define XXH_HAS_ATTRIBUTE(x) __has_attribute(x) #else # define XXH_HAS_ATTRIBUTE(x) 0 #endif +/*! @endcond */ +/*! @cond Doxygen ignores this part */ +/* + * C23 __STDC_VERSION__ number hasn't been specified yet. For now + * leave as `201711L` (C17 + 1). + * TODO: Update to correct value when its been specified. + */ +#define XXH_C23_VN 201711L +/*! @endcond */ + +/*! @cond Doxygen ignores this part */ /* C-language Attributes are added in C23. */ -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201710L) && defined(__has_c_attribute) +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= XXH_C23_VN) && defined(__has_c_attribute) # define XXH_HAS_C_ATTRIBUTE(x) __has_c_attribute(x) #else # define XXH_HAS_C_ATTRIBUTE(x) 0 #endif +/*! @endcond */ +/*! @cond Doxygen ignores this part */ #if defined(__cplusplus) && defined(__has_cpp_attribute) # define XXH_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) #else # define XXH_HAS_CPP_ATTRIBUTE(x) 0 #endif +/*! @endcond */ +/*! @cond Doxygen ignores this part */ /* -Define XXH_FALLTHROUGH macro for annotating switch case with the 'fallthrough' attribute -introduced in CPP17 and C23. -CPP17 : https://en.cppreference.com/w/cpp/language/attributes/fallthrough -C23 : https://en.cppreference.com/w/c/language/attributes/fallthrough -*/ -#if XXH_HAS_C_ATTRIBUTE(x) -# define XXH_FALLTHROUGH [[fallthrough]] -#elif XXH_HAS_CPP_ATTRIBUTE(x) + * Define XXH_FALLTHROUGH macro for annotating switch case with the 'fallthrough' attribute + * introduced in CPP17 and C23. + * CPP17 : https://en.cppreference.com/w/cpp/language/attributes/fallthrough + * C23 : https://en.cppreference.com/w/c/language/attributes/fallthrough + */ +#if XXH_HAS_C_ATTRIBUTE(fallthrough) || XXH_HAS_CPP_ATTRIBUTE(fallthrough) # define XXH_FALLTHROUGH [[fallthrough]] #elif XXH_HAS_ATTRIBUTE(__fallthrough__) -# define XXH_FALLTHROUGH __attribute__ ((fallthrough)) +# define XXH_FALLTHROUGH __attribute__ ((__fallthrough__)) #else -# define XXH_FALLTHROUGH +# define XXH_FALLTHROUGH /* fallthrough */ #endif +/*! @endcond */ + +/*! @cond Doxygen ignores this part */ +/* + * Define XXH_NOESCAPE for annotated pointers in public API. + * https://clang.llvm.org/docs/AttributeReference.html#noescape + * As of writing this, only supported by clang. + */ +#if XXH_HAS_ATTRIBUTE(noescape) +# define XXH_NOESCAPE __attribute__((noescape)) +#else +# define XXH_NOESCAPE +#endif +/*! @endcond */ + /*! * @} @@ -645,7 +843,11 @@ typedef uint64_t XXH64_hash_t; #elif !defined (__VMS) \ && (defined (__cplusplus) \ || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) -# include +# ifdef _AIX +# include +# else +# include +# endif typedef uint64_t XXH64_hash_t; #else # include @@ -661,7 +863,7 @@ typedef uint64_t XXH64_hash_t; /*! * @} * - * @defgroup xxh64_family XXH64 family + * @defgroup XXH64_family XXH64 family * @ingroup public * @{ * Contains functions used in the classic 64-bit xxHash algorithm. @@ -672,13 +874,9 @@ typedef uint64_t XXH64_hash_t; * It provides better speed for systems with vector processing capabilities. */ - /*! * @brief Calculates the 64-bit hash of @p input using xxHash64. * - * This function usually runs faster on 64-bit systems, but slower on 32-bit - * systems (see benchmark). - * * @param input The block of data to be hashed, at least @p length bytes in size. * @param length The length of @p input, in bytes. * @param seed The 64-bit seed to alter the hash's output predictably. @@ -688,41 +886,145 @@ typedef uint64_t XXH64_hash_t; * readable, contiguous memory. However, if @p length is `0`, @p input may be * `NULL`. In C++, this also must be *TriviallyCopyable*. * - * @return The calculated 64-bit hash. + * @return The calculated 64-bit xxHash64 value. * - * @see - * XXH32(), XXH3_64bits_withSeed(), XXH3_128bits_withSeed(), XXH128(): - * Direct equivalents for the other variants of xxHash. - * @see - * XXH64_createState(), XXH64_update(), XXH64_digest(): Streaming version. + * @see @ref single_shot_example "Single Shot Example" for an example. */ -XXH_PUBLIC_API XXH64_hash_t XXH64(const void* input, size_t length, XXH64_hash_t seed); +XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH64(XXH_NOESCAPE const void* input, size_t length, XXH64_hash_t seed); /******* Streaming *******/ +#ifndef XXH_NO_STREAM /*! * @brief The opaque state struct for the XXH64 streaming API. * * @see XXH64_state_s for details. */ typedef struct XXH64_state_s XXH64_state_t; /* incomplete type */ -XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void); + +/*! + * @brief Allocates an @ref XXH64_state_t. + * + * @return An allocated pointer of @ref XXH64_state_t on success. + * @return `NULL` on failure. + * + * @note Must be freed with XXH64_freeState(). + */ +XXH_PUBLIC_API XXH_MALLOCF XXH64_state_t* XXH64_createState(void); + +/*! + * @brief Frees an @ref XXH64_state_t. + * + * @param statePtr A pointer to an @ref XXH64_state_t allocated with @ref XXH64_createState(). + * + * @return @ref XXH_OK. + * + * @note @p statePtr must be allocated with XXH64_createState(). + */ XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr); -XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* dst_state, const XXH64_state_t* src_state); -XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH64_state_t* statePtr, XXH64_hash_t seed); -XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input, size_t length); -XXH_PUBLIC_API XXH64_hash_t XXH64_digest (const XXH64_state_t* statePtr); +/*! + * @brief Copies one @ref XXH64_state_t to another. + * + * @param dst_state The state to copy to. + * @param src_state The state to copy from. + * @pre + * @p dst_state and @p src_state must not be `NULL` and must not overlap. + */ +XXH_PUBLIC_API void XXH64_copyState(XXH_NOESCAPE XXH64_state_t* dst_state, const XXH64_state_t* src_state); +/*! + * @brief Resets an @ref XXH64_state_t to begin a new hash. + * + * @param statePtr The state struct to reset. + * @param seed The 64-bit seed to alter the hash result predictably. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note This function resets and seeds a state. Call it before @ref XXH64_update(). + */ +XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH_NOESCAPE XXH64_state_t* statePtr, XXH64_hash_t seed); + +/*! + * @brief Consumes a block of @p input to an @ref XXH64_state_t. + * + * @param statePtr The state struct to update. + * @param input The block of data to be hashed, at least @p length bytes in size. + * @param length The length of @p input, in bytes. + * + * @pre + * @p statePtr must not be `NULL`. + * @pre + * The memory between @p input and @p input + @p length must be valid, + * readable, contiguous memory. However, if @p length is `0`, @p input may be + * `NULL`. In C++, this also must be *TriviallyCopyable*. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note Call this to incrementally consume blocks of data. + */ +XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH_NOESCAPE XXH64_state_t* statePtr, XXH_NOESCAPE const void* input, size_t length); + +/*! + * @brief Returns the calculated hash value from an @ref XXH64_state_t. + * + * @param statePtr The state struct to calculate the hash from. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return The calculated 64-bit xxHash64 value from that state. + * + * @note + * Calling XXH64_digest() will not affect @p statePtr, so you can update, + * digest, and update again. + */ +XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH64_digest (XXH_NOESCAPE const XXH64_state_t* statePtr); +#endif /* !XXH_NO_STREAM */ /******* Canonical representation *******/ + +/*! + * @brief Canonical (big endian) representation of @ref XXH64_hash_t. + */ typedef struct { unsigned char digest[sizeof(XXH64_hash_t)]; } XXH64_canonical_t; -XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash); -XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src); + +/*! + * @brief Converts an @ref XXH64_hash_t to a big endian @ref XXH64_canonical_t. + * + * @param dst The @ref XXH64_canonical_t pointer to be stored to. + * @param hash The @ref XXH64_hash_t to be converted. + * + * @pre + * @p dst must not be `NULL`. + * + * @see @ref canonical_representation_example "Canonical Representation Example" + */ +XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH_NOESCAPE XXH64_canonical_t* dst, XXH64_hash_t hash); + +/*! + * @brief Converts an @ref XXH64_canonical_t to a native @ref XXH64_hash_t. + * + * @param src The @ref XXH64_canonical_t to convert. + * + * @pre + * @p src must not be `NULL`. + * + * @return The converted hash. + * + * @see @ref canonical_representation_example "Canonical Representation Example" + */ +XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH64_hashFromCanonical(XXH_NOESCAPE const XXH64_canonical_t* src); #ifndef XXH_NO_XXH3 + /*! * @} * ************************************************************************ - * @defgroup xxh3_family XXH3 family + * @defgroup XXH3_family XXH3 family * @ingroup public * @{ * @@ -742,16 +1044,26 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src * * XXH3's speed benefits greatly from SIMD and 64-bit arithmetic, * but does not require it. - * Any 32-bit and 64-bit targets that can run XXH32 smoothly - * can run XXH3 at competitive speeds, even without vector support. - * Further details are explained in the implementation. + * Most 32-bit and 64-bit targets that can run XXH32 smoothly can run XXH3 + * at competitive speeds, even without vector support. Further details are + * explained in the implementation. * - * Optimized implementations are provided for AVX512, AVX2, SSE2, NEON, POWER8, - * ZVector and scalar targets. This can be controlled via the XXH_VECTOR macro. + * XXH3 has a fast scalar implementation, but it also includes accelerated SIMD + * implementations for many common platforms: + * - AVX512 + * - AVX2 + * - SSE2 + * - ARM NEON + * - WebAssembly SIMD128 + * - POWER8 VSX + * - s390x ZVector + * This can be controlled via the @ref XXH_VECTOR macro, but it automatically + * selects the best version according to predefined macros. For the x86 family, an + * automatic runtime dispatcher is included separately in @ref xxh_x86dispatch.c. * * XXH3 implementation is portable: * it has a generic C90 formulation that can be compiled on any platform, - * all implementations generage exactly the same hash value on all platforms. + * all implementations generate exactly the same hash value on all platforms. * Starting from v0.8.0, it's also labelled "stable", meaning that * any future version will also generate the same hash value. * @@ -763,24 +1075,59 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src * * The API supports one-shot hashing, streaming mode, and custom secrets. */ - /*-********************************************************************** * XXH3 64-bit variant ************************************************************************/ -/* XXH3_64bits(): - * default 64-bit variant, using default secret and default seed of 0. - * It's the fastest variant. */ -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits(const void* data, size_t len); - -/* - * XXH3_64bits_withSeed(): - * This variant generates a custom secret on the fly - * based on default secret altered using the `seed` value. - * While this operation is decently fast, note that it's not completely free. - * Note: seed==0 produces the same results as XXH3_64bits(). +/*! + * @brief Calculates 64-bit unseeded variant of XXH3 hash of @p input. + * + * @param input The block of data to be hashed, at least @p length bytes in size. + * @param length The length of @p input, in bytes. + * + * @pre + * The memory between @p input and @p input + @p length must be valid, + * readable, contiguous memory. However, if @p length is `0`, @p input may be + * `NULL`. In C++, this also must be *TriviallyCopyable*. + * + * @return The calculated 64-bit XXH3 hash value. + * + * @note + * This is equivalent to @ref XXH3_64bits_withSeed() with a seed of `0`, however + * it may have slightly better performance due to constant propagation of the + * defaults. + * + * @see + * XXH3_64bits_withSeed(), XXH3_64bits_withSecret(): other seeding variants + * @see @ref single_shot_example "Single Shot Example" for an example. */ -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSeed(const void* data, size_t len, XXH64_hash_t seed); +XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH3_64bits(XXH_NOESCAPE const void* input, size_t length); + +/*! + * @brief Calculates 64-bit seeded variant of XXH3 hash of @p input. + * + * @param input The block of data to be hashed, at least @p length bytes in size. + * @param length The length of @p input, in bytes. + * @param seed The 64-bit seed to alter the hash result predictably. + * + * @pre + * The memory between @p input and @p input + @p length must be valid, + * readable, contiguous memory. However, if @p length is `0`, @p input may be + * `NULL`. In C++, this also must be *TriviallyCopyable*. + * + * @return The calculated 64-bit XXH3 hash value. + * + * @note + * seed == 0 produces the same results as @ref XXH3_64bits(). + * + * This variant generates a custom secret on the fly based on default secret + * altered using the @p seed value. + * + * While this operation is decently fast, note that it's not completely free. + * + * @see @ref single_shot_example "Single Shot Example" for an example. + */ +XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH3_64bits_withSeed(XXH_NOESCAPE const void* input, size_t length, XXH64_hash_t seed); /*! * The bare minimum size for a custom secret. @@ -791,27 +1138,43 @@ XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSeed(const void* data, size_t len, X */ #define XXH3_SECRET_SIZE_MIN 136 -/* - * XXH3_64bits_withSecret(): +/*! + * @brief Calculates 64-bit variant of XXH3 with a custom "secret". + * + * @param data The block of data to be hashed, at least @p len bytes in size. + * @param len The length of @p data, in bytes. + * @param secret The secret data. + * @param secretSize The length of @p secret, in bytes. + * + * @return The calculated 64-bit XXH3 hash value. + * + * @pre + * The memory between @p data and @p data + @p len must be valid, + * readable, contiguous memory. However, if @p length is `0`, @p data may be + * `NULL`. In C++, this also must be *TriviallyCopyable*. + * * It's possible to provide any blob of bytes as a "secret" to generate the hash. * This makes it more difficult for an external actor to prepare an intentional collision. - * The main condition is that secretSize *must* be large enough (>= XXH3_SECRET_SIZE_MIN). + * The main condition is that @p secretSize *must* be large enough (>= @ref XXH3_SECRET_SIZE_MIN). * However, the quality of the secret impacts the dispersion of the hash algorithm. * Therefore, the secret _must_ look like a bunch of random bytes. * Avoid "trivial" or structured data such as repeated sequences or a text document. * Whenever in doubt about the "randomness" of the blob of bytes, - * consider employing "XXH3_generateSecret()" instead (see below). + * consider employing @ref XXH3_generateSecret() instead (see below). * It will generate a proper high entropy secret derived from the blob of bytes. * Another advantage of using XXH3_generateSecret() is that * it guarantees that all bits within the initial blob of bytes * will impact every bit of the output. * This is not necessarily the case when using the blob of bytes directly * because, when hashing _small_ inputs, only a portion of the secret is employed. + * + * @see @ref single_shot_example "Single Shot Example" for an example. */ -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSecret(const void* data, size_t len, const void* secret, size_t secretSize); +XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH3_64bits_withSecret(XXH_NOESCAPE const void* data, size_t len, XXH_NOESCAPE const void* secret, size_t secretSize); /******* Streaming *******/ +#ifndef XXH_NO_STREAM /* * Streaming requires state maintenance. * This operation costs memory and CPU. @@ -820,40 +1183,124 @@ XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSecret(const void* data, size_t len, */ /*! - * @brief The state struct for the XXH3 streaming API. + * @brief The opaque state struct for the XXH3 streaming API. * * @see XXH3_state_s for details. */ typedef struct XXH3_state_s XXH3_state_t; -XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void); +XXH_PUBLIC_API XXH_MALLOCF XXH3_state_t* XXH3_createState(void); XXH_PUBLIC_API XXH_errorcode XXH3_freeState(XXH3_state_t* statePtr); -XXH_PUBLIC_API void XXH3_copyState(XXH3_state_t* dst_state, const XXH3_state_t* src_state); -/* - * XXH3_64bits_reset(): - * Initialize with default parameters. - * digest will be equivalent to `XXH3_64bits()`. +/*! + * @brief Copies one @ref XXH3_state_t to another. + * + * @param dst_state The state to copy to. + * @param src_state The state to copy from. + * @pre + * @p dst_state and @p src_state must not be `NULL` and must not overlap. */ -XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset(XXH3_state_t* statePtr); -/* - * XXH3_64bits_reset_withSeed(): - * Generate a custom secret from `seed`, and store it into `statePtr`. - * digest will be equivalent to `XXH3_64bits_withSeed()`. +XXH_PUBLIC_API void XXH3_copyState(XXH_NOESCAPE XXH3_state_t* dst_state, XXH_NOESCAPE const XXH3_state_t* src_state); + +/*! + * @brief Resets an @ref XXH3_state_t to begin a new hash. + * + * @param statePtr The state struct to reset. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note + * - This function resets `statePtr` and generate a secret with default parameters. + * - Call this function before @ref XXH3_64bits_update(). + * - Digest will be equivalent to `XXH3_64bits()`. + * */ -XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed); -/* - * XXH3_64bits_reset_withSecret(): - * `secret` is referenced, it _must outlive_ the hash streaming session. - * Similar to one-shot API, `secretSize` must be >= `XXH3_SECRET_SIZE_MIN`, +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset(XXH_NOESCAPE XXH3_state_t* statePtr); + +/*! + * @brief Resets an @ref XXH3_state_t with 64-bit seed to begin a new hash. + * + * @param statePtr The state struct to reset. + * @param seed The 64-bit seed to alter the hash result predictably. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note + * - This function resets `statePtr` and generate a secret from `seed`. + * - Call this function before @ref XXH3_64bits_update(). + * - Digest will be equivalent to `XXH3_64bits_withSeed()`. + * + */ +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH64_hash_t seed); + +/*! + * @brief Resets an @ref XXH3_state_t with secret data to begin a new hash. + * + * @param statePtr The state struct to reset. + * @param secret The secret data. + * @param secretSize The length of @p secret, in bytes. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note + * `secret` is referenced, it _must outlive_ the hash streaming session. + * + * Similar to one-shot API, `secretSize` must be >= @ref XXH3_SECRET_SIZE_MIN, * and the quality of produced hash values depends on secret's entropy * (secret's content should look like a bunch of random bytes). * When in doubt about the randomness of a candidate `secret`, * consider employing `XXH3_generateSecret()` instead (see below). */ -XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize); +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSecret(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize); -XXH_PUBLIC_API XXH_errorcode XXH3_64bits_update (XXH3_state_t* statePtr, const void* input, size_t length); -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t* statePtr); +/*! + * @brief Consumes a block of @p input to an @ref XXH3_state_t. + * + * @param statePtr The state struct to update. + * @param input The block of data to be hashed, at least @p length bytes in size. + * @param length The length of @p input, in bytes. + * + * @pre + * @p statePtr must not be `NULL`. + * @pre + * The memory between @p input and @p input + @p length must be valid, + * readable, contiguous memory. However, if @p length is `0`, @p input may be + * `NULL`. In C++, this also must be *TriviallyCopyable*. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note Call this to incrementally consume blocks of data. + */ +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_update (XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* input, size_t length); + +/*! + * @brief Returns the calculated XXH3 64-bit hash value from an @ref XXH3_state_t. + * + * @param statePtr The state struct to calculate the hash from. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return The calculated XXH3 64-bit hash value from that state. + * + * @note + * Calling XXH3_64bits_digest() will not affect @p statePtr, so you can update, + * digest, and update again. + */ +XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH3_64bits_digest (XXH_NOESCAPE const XXH3_state_t* statePtr); +#endif /* !XXH_NO_STREAM */ /* note : canonical representation of XXH3 is the same as XXH64 * since they both produce XXH64_hash_t values */ @@ -874,11 +1321,76 @@ typedef struct { XXH64_hash_t high64; /*!< `value >> 64` */ } XXH128_hash_t; -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits(const void* data, size_t len); -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSeed(const void* data, size_t len, XXH64_hash_t seed); -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSecret(const void* data, size_t len, const void* secret, size_t secretSize); +/*! + * @brief Calculates 128-bit unseeded variant of XXH3 of @p data. + * + * @param data The block of data to be hashed, at least @p length bytes in size. + * @param len The length of @p data, in bytes. + * + * @return The calculated 128-bit variant of XXH3 value. + * + * The 128-bit variant of XXH3 has more strength, but it has a bit of overhead + * for shorter inputs. + * + * This is equivalent to @ref XXH3_128bits_withSeed() with a seed of `0`, however + * it may have slightly better performance due to constant propagation of the + * defaults. + * + * @see XXH3_128bits_withSeed(), XXH3_128bits_withSecret(): other seeding variants + * @see @ref single_shot_example "Single Shot Example" for an example. + */ +XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH3_128bits(XXH_NOESCAPE const void* data, size_t len); +/*! @brief Calculates 128-bit seeded variant of XXH3 hash of @p data. + * + * @param data The block of data to be hashed, at least @p length bytes in size. + * @param len The length of @p data, in bytes. + * @param seed The 64-bit seed to alter the hash result predictably. + * + * @return The calculated 128-bit variant of XXH3 value. + * + * @note + * seed == 0 produces the same results as @ref XXH3_64bits(). + * + * This variant generates a custom secret on the fly based on default secret + * altered using the @p seed value. + * + * While this operation is decently fast, note that it's not completely free. + * + * @see XXH3_128bits(), XXH3_128bits_withSecret(): other seeding variants + * @see @ref single_shot_example "Single Shot Example" for an example. + */ +XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH3_128bits_withSeed(XXH_NOESCAPE const void* data, size_t len, XXH64_hash_t seed); +/*! + * @brief Calculates 128-bit variant of XXH3 with a custom "secret". + * + * @param data The block of data to be hashed, at least @p len bytes in size. + * @param len The length of @p data, in bytes. + * @param secret The secret data. + * @param secretSize The length of @p secret, in bytes. + * + * @return The calculated 128-bit variant of XXH3 value. + * + * It's possible to provide any blob of bytes as a "secret" to generate the hash. + * This makes it more difficult for an external actor to prepare an intentional collision. + * The main condition is that @p secretSize *must* be large enough (>= @ref XXH3_SECRET_SIZE_MIN). + * However, the quality of the secret impacts the dispersion of the hash algorithm. + * Therefore, the secret _must_ look like a bunch of random bytes. + * Avoid "trivial" or structured data such as repeated sequences or a text document. + * Whenever in doubt about the "randomness" of the blob of bytes, + * consider employing @ref XXH3_generateSecret() instead (see below). + * It will generate a proper high entropy secret derived from the blob of bytes. + * Another advantage of using XXH3_generateSecret() is that + * it guarantees that all bits within the initial blob of bytes + * will impact every bit of the output. + * This is not necessarily the case when using the blob of bytes directly + * because, when hashing _small_ inputs, only a portion of the secret is employed. + * + * @see @ref single_shot_example "Single Shot Example" for an example. + */ +XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH3_128bits_withSecret(XXH_NOESCAPE const void* data, size_t len, XXH_NOESCAPE const void* secret, size_t secretSize); /******* Streaming *******/ +#ifndef XXH_NO_STREAM /* * Streaming requires state maintenance. * This operation costs memory and CPU. @@ -891,39 +1403,163 @@ XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSecret(const void* data, size_t le * All reset and streaming functions have same meaning as their 64-bit counterpart. */ -XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset(XXH3_state_t* statePtr); -XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed); -XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize); +/*! + * @brief Resets an @ref XXH3_state_t to begin a new hash. + * + * @param statePtr The state struct to reset. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note + * - This function resets `statePtr` and generate a secret with default parameters. + * - Call it before @ref XXH3_128bits_update(). + * - Digest will be equivalent to `XXH3_128bits()`. + */ +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset(XXH_NOESCAPE XXH3_state_t* statePtr); -XXH_PUBLIC_API XXH_errorcode XXH3_128bits_update (XXH3_state_t* statePtr, const void* input, size_t length); -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (const XXH3_state_t* statePtr); +/*! + * @brief Resets an @ref XXH3_state_t with 64-bit seed to begin a new hash. + * + * @param statePtr The state struct to reset. + * @param seed The 64-bit seed to alter the hash result predictably. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note + * - This function resets `statePtr` and generate a secret from `seed`. + * - Call it before @ref XXH3_128bits_update(). + * - Digest will be equivalent to `XXH3_128bits_withSeed()`. + */ +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH64_hash_t seed); +/*! + * @brief Resets an @ref XXH3_state_t with secret data to begin a new hash. + * + * @param statePtr The state struct to reset. + * @param secret The secret data. + * @param secretSize The length of @p secret, in bytes. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * `secret` is referenced, it _must outlive_ the hash streaming session. + * Similar to one-shot API, `secretSize` must be >= @ref XXH3_SECRET_SIZE_MIN, + * and the quality of produced hash values depends on secret's entropy + * (secret's content should look like a bunch of random bytes). + * When in doubt about the randomness of a candidate `secret`, + * consider employing `XXH3_generateSecret()` instead (see below). + */ +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSecret(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize); + +/*! + * @brief Consumes a block of @p input to an @ref XXH3_state_t. + * + * Call this to incrementally consume blocks of data. + * + * @param statePtr The state struct to update. + * @param input The block of data to be hashed, at least @p length bytes in size. + * @param length The length of @p input, in bytes. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note + * The memory between @p input and @p input + @p length must be valid, + * readable, contiguous memory. However, if @p length is `0`, @p input may be + * `NULL`. In C++, this also must be *TriviallyCopyable*. + * + */ +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_update (XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* input, size_t length); + +/*! + * @brief Returns the calculated XXH3 128-bit hash value from an @ref XXH3_state_t. + * + * @param statePtr The state struct to calculate the hash from. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return The calculated XXH3 128-bit hash value from that state. + * + * @note + * Calling XXH3_128bits_digest() will not affect @p statePtr, so you can update, + * digest, and update again. + * + */ +XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH3_128bits_digest (XXH_NOESCAPE const XXH3_state_t* statePtr); +#endif /* !XXH_NO_STREAM */ /* Following helper functions make it possible to compare XXH128_hast_t values. * Since XXH128_hash_t is a structure, this capability is not offered by the language. * Note: For better performance, these functions can be inlined using XXH_INLINE_ALL */ /*! - * XXH128_isEqual(): - * Return: 1 if `h1` and `h2` are equal, 0 if they are not. + * @brief Check equality of two XXH128_hash_t values + * + * @param h1 The 128-bit hash value. + * @param h2 Another 128-bit hash value. + * + * @return `1` if `h1` and `h2` are equal. + * @return `0` if they are not. */ -XXH_PUBLIC_API int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2); +XXH_PUBLIC_API XXH_PUREF int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2); /*! - * XXH128_cmp(): + * @brief Compares two @ref XXH128_hash_t * * This comparator is compatible with stdlib's `qsort()`/`bsearch()`. * - * return: >0 if *h128_1 > *h128_2 - * =0 if *h128_1 == *h128_2 - * <0 if *h128_1 < *h128_2 + * @param h128_1 Left-hand side value + * @param h128_2 Right-hand side value + * + * @return >0 if @p h128_1 > @p h128_2 + * @return =0 if @p h128_1 == @p h128_2 + * @return <0 if @p h128_1 < @p h128_2 */ -XXH_PUBLIC_API int XXH128_cmp(const void* h128_1, const void* h128_2); +XXH_PUBLIC_API XXH_PUREF int XXH128_cmp(XXH_NOESCAPE const void* h128_1, XXH_NOESCAPE const void* h128_2); /******* Canonical representation *******/ typedef struct { unsigned char digest[sizeof(XXH128_hash_t)]; } XXH128_canonical_t; -XXH_PUBLIC_API void XXH128_canonicalFromHash(XXH128_canonical_t* dst, XXH128_hash_t hash); -XXH_PUBLIC_API XXH128_hash_t XXH128_hashFromCanonical(const XXH128_canonical_t* src); + + +/*! + * @brief Converts an @ref XXH128_hash_t to a big endian @ref XXH128_canonical_t. + * + * @param dst The @ref XXH128_canonical_t pointer to be stored to. + * @param hash The @ref XXH128_hash_t to be converted. + * + * @pre + * @p dst must not be `NULL`. + * @see @ref canonical_representation_example "Canonical Representation Example" + */ +XXH_PUBLIC_API void XXH128_canonicalFromHash(XXH_NOESCAPE XXH128_canonical_t* dst, XXH128_hash_t hash); + +/*! + * @brief Converts an @ref XXH128_canonical_t to a native @ref XXH128_hash_t. + * + * @param src The @ref XXH128_canonical_t to convert. + * + * @pre + * @p src must not be `NULL`. + * + * @return The converted hash. + * @see @ref canonical_representation_example "Canonical Representation Example" + */ +XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH128_hashFromCanonical(XXH_NOESCAPE const XXH128_canonical_t* src); #endif /* !XXH_NO_XXH3 */ @@ -997,7 +1633,6 @@ struct XXH64_state_s { XXH64_hash_t reserved64; /*!< Reserved field. Do not read or write to it. */ }; /* typedef'd to XXH64_state_t */ - #ifndef XXH_NO_XXH3 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* >= C11 */ @@ -1033,6 +1668,7 @@ struct XXH64_state_s { #define XXH3_INTERNALBUFFER_SIZE 256 /*! + * @internal * @brief Default size of the secret buffer (and @ref XXH3_kSecret). * * This is the size used in @ref XXH3_kSecret and the seeded functions. @@ -1065,7 +1701,7 @@ struct XXH64_state_s { */ struct XXH3_state_s { XXH_ALIGN_MEMBER(64, XXH64_hash_t acc[8]); - /*!< The 8 accumulators. Similar to `vN` in @ref XXH32_state_s::v1 and @ref XXH64_state_s */ + /*!< The 8 accumulators. See @ref XXH32_state_s::v and @ref XXH64_state_s::v */ XXH_ALIGN_MEMBER(64, unsigned char customSecret[XXH3_SECRET_DEFAULT_SIZE]); /*!< Used to store a custom secret generated from a seed. */ XXH_ALIGN_MEMBER(64, unsigned char buffer[XXH3_INTERNALBUFFER_SIZE]); @@ -1105,69 +1741,148 @@ struct XXH3_state_s { * Note that this doesn't prepare the state for a streaming operation, * it's still necessary to use XXH3_NNbits_reset*() afterwards. */ -#define XXH3_INITSTATE(XXH3_state_ptr) { (XXH3_state_ptr)->seed = 0; } +#define XXH3_INITSTATE(XXH3_state_ptr) \ + do { \ + XXH3_state_t* tmp_xxh3_state_ptr = (XXH3_state_ptr); \ + tmp_xxh3_state_ptr->seed = 0; \ + tmp_xxh3_state_ptr->extSecret = NULL; \ + } while(0) -/* XXH128() : - * simple alias to pre-selected XXH3_128bits variant +/*! + * @brief Calculates the 128-bit hash of @p data using XXH3. + * + * @param data The block of data to be hashed, at least @p len bytes in size. + * @param len The length of @p data, in bytes. + * @param seed The 64-bit seed to alter the hash's output predictably. + * + * @pre + * The memory between @p data and @p data + @p len must be valid, + * readable, contiguous memory. However, if @p len is `0`, @p data may be + * `NULL`. In C++, this also must be *TriviallyCopyable*. + * + * @return The calculated 128-bit XXH3 value. + * + * @see @ref single_shot_example "Single Shot Example" for an example. */ -XXH_PUBLIC_API XXH128_hash_t XXH128(const void* data, size_t len, XXH64_hash_t seed); +XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH128(XXH_NOESCAPE const void* data, size_t len, XXH64_hash_t seed); /* === Experimental API === */ /* Symbols defined below must be considered tied to a specific library version. */ -/* - * XXH3_generateSecret(): +/*! + * @brief Derive a high-entropy secret from any user-defined content, named customSeed. + * + * @param secretBuffer A writable buffer for derived high-entropy secret data. + * @param secretSize Size of secretBuffer, in bytes. Must be >= XXH3_SECRET_DEFAULT_SIZE. + * @param customSeed A user-defined content. + * @param customSeedSize Size of customSeed, in bytes. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. * - * Derive a high-entropy secret from any user-defined content, named customSeed. * The generated secret can be used in combination with `*_withSecret()` functions. - * The `_withSecret()` variants are useful to provide a higher level of protection than 64-bit seed, - * as it becomes much more difficult for an external actor to guess how to impact the calculation logic. + * The `_withSecret()` variants are useful to provide a higher level of protection + * than 64-bit seed, as it becomes much more difficult for an external actor to + * guess how to impact the calculation logic. * * The function accepts as input a custom seed of any length and any content, - * and derives from it a high-entropy secret of length @secretSize - * into an already allocated buffer @secretBuffer. - * @secretSize must be >= XXH3_SECRET_SIZE_MIN + * and derives from it a high-entropy secret of length @p secretSize into an + * already allocated buffer @p secretBuffer. * * The generated secret can then be used with any `*_withSecret()` variant. - * Functions `XXH3_128bits_withSecret()`, `XXH3_64bits_withSecret()`, - * `XXH3_128bits_reset_withSecret()` and `XXH3_64bits_reset_withSecret()` + * The functions @ref XXH3_128bits_withSecret(), @ref XXH3_64bits_withSecret(), + * @ref XXH3_128bits_reset_withSecret() and @ref XXH3_64bits_reset_withSecret() * are part of this list. They all accept a `secret` parameter - * which must be large enough for implementation reasons (>= XXH3_SECRET_SIZE_MIN) + * which must be large enough for implementation reasons (>= @ref XXH3_SECRET_SIZE_MIN) * _and_ feature very high entropy (consist of random-looking bytes). - * These conditions can be a high bar to meet, so - * XXH3_generateSecret() can be employed to ensure proper quality. + * These conditions can be a high bar to meet, so @ref XXH3_generateSecret() can + * be employed to ensure proper quality. * - * customSeed can be anything. It can have any size, even small ones, - * and its content can be anything, even "poor entropy" sources such as a bunch of zeroes. - * The resulting `secret` will nonetheless provide all required qualities. + * @p customSeed can be anything. It can have any size, even small ones, + * and its content can be anything, even "poor entropy" sources such as a bunch + * of zeroes. The resulting `secret` will nonetheless provide all required qualities. * - * When customSeedSize > 0, supplying NULL as customSeed is undefined behavior. + * @pre + * - @p secretSize must be >= @ref XXH3_SECRET_SIZE_MIN + * - When @p customSeedSize > 0, supplying NULL as customSeed is undefined behavior. + * + * Example code: + * @code{.c} + * #include + * #include + * #include + * #define XXH_STATIC_LINKING_ONLY // expose unstable API + * #include "xxhash.h" + * // Hashes argv[2] using the entropy from argv[1]. + * int main(int argc, char* argv[]) + * { + * char secret[XXH3_SECRET_SIZE_MIN]; + * if (argv != 3) { return 1; } + * XXH3_generateSecret(secret, sizeof(secret), argv[1], strlen(argv[1])); + * XXH64_hash_t h = XXH3_64bits_withSecret( + * argv[2], strlen(argv[2]), + * secret, sizeof(secret) + * ); + * printf("%016llx\n", (unsigned long long) h); + * } + * @endcode */ -XXH_PUBLIC_API XXH_errorcode XXH3_generateSecret(void* secretBuffer, size_t secretSize, const void* customSeed, size_t customSeedSize); +XXH_PUBLIC_API XXH_errorcode XXH3_generateSecret(XXH_NOESCAPE void* secretBuffer, size_t secretSize, XXH_NOESCAPE const void* customSeed, size_t customSeedSize); - -/* - * XXH3_generateSecret_fromSeed(): +/*! + * @brief Generate the same secret as the _withSeed() variants. * - * Generate the same secret as the _withSeed() variants. - * - * The resulting secret has a length of XXH3_SECRET_DEFAULT_SIZE (necessarily). - * @secretBuffer must be already allocated, of size at least XXH3_SECRET_DEFAULT_SIZE bytes. + * @param secretBuffer A writable buffer of @ref XXH3_SECRET_SIZE_MIN bytes + * @param seed The 64-bit seed to alter the hash result predictably. * * The generated secret can be used in combination with *`*_withSecret()` and `_withSecretandSeed()` variants. - * This generator is notably useful in combination with `_withSecretandSeed()`, - * as a way to emulate a faster `_withSeed()` variant. + * + * Example C++ `std::string` hash class: + * @code{.cpp} + * #include + * #define XXH_STATIC_LINKING_ONLY // expose unstable API + * #include "xxhash.h" + * // Slow, seeds each time + * class HashSlow { + * XXH64_hash_t seed; + * public: + * HashSlow(XXH64_hash_t s) : seed{s} {} + * size_t operator()(const std::string& x) const { + * return size_t{XXH3_64bits_withSeed(x.c_str(), x.length(), seed)}; + * } + * }; + * // Fast, caches the seeded secret for future uses. + * class HashFast { + * unsigned char secret[XXH3_SECRET_SIZE_MIN]; + * public: + * HashFast(XXH64_hash_t s) { + * XXH3_generateSecret_fromSeed(secret, seed); + * } + * size_t operator()(const std::string& x) const { + * return size_t{ + * XXH3_64bits_withSecret(x.c_str(), x.length(), secret, sizeof(secret)) + * }; + * } + * }; + * @endcode */ -XXH_PUBLIC_API void XXH3_generateSecret_fromSeed(void* secretBuffer, XXH64_hash_t seed); +XXH_PUBLIC_API void XXH3_generateSecret_fromSeed(XXH_NOESCAPE void* secretBuffer, XXH64_hash_t seed); -/* - * *_withSecretandSeed() : +/*! + * @brief Calculates 64/128-bit seeded variant of XXH3 hash of @p data. + * + * @param data The block of data to be hashed, at least @p len bytes in size. + * @param len The length of @p data, in bytes. + * @param secret The secret data. + * @param secretSize The length of @p secret, in bytes. + * @param seed The 64-bit seed to alter the hash result predictably. + * * These variants generate hash values using either - * @seed for "short" keys (< XXH3_MIDSIZE_MAX = 240 bytes) - * or @secret for "large" keys (>= XXH3_MIDSIZE_MAX). + * @p seed for "short" keys (< @ref XXH3_MIDSIZE_MAX = 240 bytes) + * or @p secret for "large" keys (>= @ref XXH3_MIDSIZE_MAX). * * This generally benefits speed, compared to `_withSeed()` or `_withSecret()`. * `_withSeed()` has to generate the secret on the fly for "large" keys. @@ -1176,7 +1891,7 @@ XXH_PUBLIC_API void XXH3_generateSecret_fromSeed(void* secretBuffer, XXH64_hash_ * which requires more instructions than _withSeed() variants. * Therefore, _withSecretandSeed variant combines the best of both worlds. * - * When @secret has been generated by XXH3_generateSecret_fromSeed(), + * When @p secret has been generated by XXH3_generateSecret_fromSeed(), * this variant produces *exactly* the same results as `_withSeed()` variant, * hence offering only a pure speed benefit on "large" input, * by skipping the need to regenerate the secret for every large input. @@ -1185,33 +1900,71 @@ XXH_PUBLIC_API void XXH3_generateSecret_fromSeed(void* secretBuffer, XXH64_hash_ * for example with XXH3_64bits(), which then becomes the seed, * and then employ both the seed and the secret in _withSecretandSeed(). * On top of speed, an added benefit is that each bit in the secret - * has a 50% chance to swap each bit in the output, - * via its impact to the seed. + * has a 50% chance to swap each bit in the output, via its impact to the seed. + * * This is not guaranteed when using the secret directly in "small data" scenarios, * because only portions of the secret are employed for small data. */ -XXH_PUBLIC_API XXH64_hash_t -XXH3_64bits_withSecretandSeed(const void* data, size_t len, - const void* secret, size_t secretSize, +XXH_PUBLIC_API XXH_PUREF XXH64_hash_t +XXH3_64bits_withSecretandSeed(XXH_NOESCAPE const void* data, size_t len, + XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed); - -XXH_PUBLIC_API XXH128_hash_t -XXH3_128bits_withSecretandSeed(const void* data, size_t len, - const void* secret, size_t secretSize, +/*! + * @brief Calculates 128-bit seeded variant of XXH3 hash of @p data. + * + * @param input The block of data to be hashed, at least @p len bytes in size. + * @param length The length of @p data, in bytes. + * @param secret The secret data. + * @param secretSize The length of @p secret, in bytes. + * @param seed64 The 64-bit seed to alter the hash result predictably. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @see XXH3_64bits_withSecretandSeed() + */ +XXH_PUBLIC_API XXH_PUREF XXH128_hash_t +XXH3_128bits_withSecretandSeed(XXH_NOESCAPE const void* input, size_t length, + XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed64); - +#ifndef XXH_NO_STREAM +/*! + * @brief Resets an @ref XXH3_state_t with secret data to begin a new hash. + * + * @param statePtr A pointer to an @ref XXH3_state_t allocated with @ref XXH3_createState(). + * @param secret The secret data. + * @param secretSize The length of @p secret, in bytes. + * @param seed64 The 64-bit seed to alter the hash result predictably. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @see XXH3_64bits_withSecretandSeed() + */ XXH_PUBLIC_API XXH_errorcode -XXH3_64bits_reset_withSecretandSeed(XXH3_state_t* statePtr, - const void* secret, size_t secretSize, +XXH3_64bits_reset_withSecretandSeed(XXH_NOESCAPE XXH3_state_t* statePtr, + XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed64); - +/*! + * @brief Resets an @ref XXH3_state_t with secret data to begin a new hash. + * + * @param statePtr A pointer to an @ref XXH3_state_t allocated with @ref XXH3_createState(). + * @param secret The secret data. + * @param secretSize The length of @p secret, in bytes. + * @param seed64 The 64-bit seed to alter the hash result predictably. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @see XXH3_64bits_withSecretandSeed() + */ XXH_PUBLIC_API XXH_errorcode -XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, - const void* secret, size_t secretSize, +XXH3_128bits_reset_withSecretandSeed(XXH_NOESCAPE XXH3_state_t* statePtr, + XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed64); +#endif /* !XXH_NO_STREAM */ - -#endif /* XXH_NO_XXH3 */ +#endif /* !XXH_NO_XXH3 */ #endif /* XXH_NO_LONG_LONG */ #if defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API) # define XXH_IMPLEMENTATION @@ -1265,7 +2018,7 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, /*! * @brief Define this to disable 64-bit code. * - * Useful if only using the @ref xxh32_family and you have a strict C90 compiler. + * Useful if only using the @ref XXH32_family and you have a strict C90 compiler. */ # define XXH_NO_LONG_LONG # undef XXH_NO_LONG_LONG /* don't actually */ @@ -1288,7 +2041,7 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, * Use `memcpy()`. Safe and portable. Note that most modern compilers will * eliminate the function call and treat it as an unaligned access. * - * - `XXH_FORCE_MEMORY_ACCESS=1`: `__attribute__((packed))` + * - `XXH_FORCE_MEMORY_ACCESS=1`: `__attribute__((aligned(1)))` * @par * Depends on compiler extensions and is therefore not portable. * This method is safe _if_ your compiler supports it, @@ -1308,7 +2061,7 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, * inline small `memcpy()` calls, and it might also be faster on big-endian * systems which lack a native byteswap instruction. However, some compilers * will emit literal byteshifts even if the target supports unaligned access. - * . + * * * @warning * Methods 1 and 2 rely on implementation-defined behavior. Use these with @@ -1321,6 +2074,34 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, */ # define XXH_FORCE_MEMORY_ACCESS 0 +/*! + * @def XXH_SIZE_OPT + * @brief Controls how much xxHash optimizes for size. + * + * xxHash, when compiled, tends to result in a rather large binary size. This + * is mostly due to heavy usage to forced inlining and constant folding of the + * @ref XXH3_family to increase performance. + * + * However, some developers prefer size over speed. This option can + * significantly reduce the size of the generated code. When using the `-Os` + * or `-Oz` options on GCC or Clang, this is defined to 1 by default, + * otherwise it is defined to 0. + * + * Most of these size optimizations can be controlled manually. + * + * This is a number from 0-2. + * - `XXH_SIZE_OPT` == 0: Default. xxHash makes no size optimizations. Speed + * comes first. + * - `XXH_SIZE_OPT` == 1: Default for `-Os` and `-Oz`. xxHash is more + * conservative and disables hacks that increase code size. It implies the + * options @ref XXH_NO_INLINE_HINTS == 1, @ref XXH_FORCE_ALIGN_CHECK == 0, + * and @ref XXH3_NEON_LANES == 8 if they are not already defined. + * - `XXH_SIZE_OPT` == 2: xxHash tries to make itself as small as possible. + * Performance may cry. For example, the single shot functions just use the + * streaming API. + */ +# define XXH_SIZE_OPT 0 + /*! * @def XXH_FORCE_ALIGN_CHECK * @brief If defined to non-zero, adds a special path for aligned inputs (XXH32() @@ -1342,9 +2123,11 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, * * In these cases, the alignment check can be removed by setting this macro to 0. * Then the code will always use unaligned memory access. - * Align check is automatically disabled on x86, x64 & arm64, + * Align check is automatically disabled on x86, x64, ARM64, and some ARM chips * which are platforms known to offer good unaligned memory accesses performance. * + * It is also disabled by default when @ref XXH_SIZE_OPT >= 1. + * * This option does not affect XXH3 (only XXH32 and XXH64). */ # define XXH_FORCE_ALIGN_CHECK 0 @@ -1366,11 +2149,28 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, * XXH_NO_INLINE_HINTS marks all internal functions as static, giving the * compiler full control on whether to inline or not. * - * When not optimizing (-O0), optimizing for size (-Os, -Oz), or using - * -fno-inline with GCC or Clang, this will automatically be defined. + * When not optimizing (-O0), using `-fno-inline` with GCC or Clang, or if + * @ref XXH_SIZE_OPT >= 1, this will automatically be defined. */ # define XXH_NO_INLINE_HINTS 0 +/*! + * @def XXH3_INLINE_SECRET + * @brief Determines whether to inline the XXH3 withSecret code. + * + * When the secret size is known, the compiler can improve the performance + * of XXH3_64bits_withSecret() and XXH3_128bits_withSecret(). + * + * However, if the secret size is not known, it doesn't have any benefit. This + * happens when xxHash is compiled into a global symbol. Therefore, if + * @ref XXH_INLINE_ALL is *not* defined, this will be defined to 0. + * + * Additionally, this defaults to 0 on GCC 12+, which has an issue with function pointers + * that are *sometimes* force inline on -Og, and it is impossible to automatically + * detect this optimization level. + */ +# define XXH3_INLINE_SECRET 0 + /*! * @def XXH32_ENDJMP * @brief Whether to use a jump for `XXH32_finalize`. @@ -1392,34 +2192,45 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, */ # define XXH_OLD_NAMES # undef XXH_OLD_NAMES /* don't actually use, it is ugly. */ + +/*! + * @def XXH_NO_STREAM + * @brief Disables the streaming API. + * + * When xxHash is not inlined and the streaming functions are not used, disabling + * the streaming functions can improve code size significantly, especially with + * the @ref XXH3_family which tends to make constant folded copies of itself. + */ +# define XXH_NO_STREAM +# undef XXH_NO_STREAM /* don't actually */ #endif /* XXH_DOXYGEN */ /*! * @} */ #ifndef XXH_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ - /* prefer __packed__ structures (method 1) for gcc on armv7+ and mips */ -# if !defined(__clang__) && \ -( \ - (defined(__INTEL_COMPILER) && !defined(_WIN32)) || \ - ( \ - defined(__GNUC__) && ( \ - (defined(__ARM_ARCH) && __ARM_ARCH >= 7) || \ - ( \ - defined(__mips__) && \ - (__mips <= 5 || __mips_isa_rev < 6) && \ - (!defined(__mips16) || defined(__mips_mips16e2)) \ - ) \ - ) \ - ) \ -) + /* prefer __packed__ structures (method 1) for GCC + * < ARMv7 with unaligned access (e.g. Raspbian armhf) still uses byte shifting, so we use memcpy + * which for some reason does unaligned loads. */ +# if defined(__GNUC__) && !(defined(__ARM_ARCH) && __ARM_ARCH < 7 && defined(__ARM_FEATURE_UNALIGNED)) # define XXH_FORCE_MEMORY_ACCESS 1 # endif #endif +#ifndef XXH_SIZE_OPT + /* default to 1 for -Os or -Oz */ +# if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE_SIZE__) +# define XXH_SIZE_OPT 1 +# else +# define XXH_SIZE_OPT 0 +# endif +#endif + #ifndef XXH_FORCE_ALIGN_CHECK /* can be defined externally */ -# if defined(__i386) || defined(__x86_64__) || defined(__aarch64__) \ - || defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64) /* visual */ + /* don't check on sizeopt, x86, aarch64, or arm when unaligned access is available */ +# if XXH_SIZE_OPT >= 1 || \ + defined(__i386) || defined(__x86_64__) || defined(__aarch64__) || defined(__ARM_FEATURE_UNALIGNED) \ + || defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64) || defined(_M_ARM) /* visual */ # define XXH_FORCE_ALIGN_CHECK 0 # else # define XXH_FORCE_ALIGN_CHECK 1 @@ -1427,14 +2238,22 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, #endif #ifndef XXH_NO_INLINE_HINTS -# if defined(__OPTIMIZE_SIZE__) /* -Os, -Oz */ \ - || defined(__NO_INLINE__) /* -O0, -fno-inline */ +# if XXH_SIZE_OPT >= 1 || defined(__NO_INLINE__) /* -O0, -fno-inline */ # define XXH_NO_INLINE_HINTS 1 # else # define XXH_NO_INLINE_HINTS 0 # endif #endif +#ifndef XXH3_INLINE_SECRET +# if (defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 12) \ + || !defined(XXH_INLINE_ALL) +# define XXH3_INLINE_SECRET 0 +# else +# define XXH3_INLINE_SECRET 1 +# endif +#endif + #ifndef XXH32_ENDJMP /* generally preferable for performance */ # define XXH32_ENDJMP 0 @@ -1449,13 +2268,56 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, /* ************************************* * Includes & Memory related functions ***************************************/ -/* Modify the local functions below should you wish to use some other memory routines */ -/* for ZSTD_malloc(), ZSTD_free() */ -#define ZSTD_DEPS_NEED_MALLOC -#include "zstd_deps.h" /* size_t, ZSTD_malloc, ZSTD_free, ZSTD_memcpy */ -static void* XXH_malloc(size_t s) { return ZSTD_malloc(s); } -static void XXH_free (void* p) { ZSTD_free(p); } -static void* XXH_memcpy(void* dest, const void* src, size_t size) { return ZSTD_memcpy(dest,src,size); } +#if defined(XXH_NO_STREAM) +/* nothing */ +#elif defined(XXH_NO_STDLIB) + +/* When requesting to disable any mention of stdlib, + * the library loses the ability to invoked malloc / free. + * In practice, it means that functions like `XXH*_createState()` + * will always fail, and return NULL. + * This flag is useful in situations where + * xxhash.h is integrated into some kernel, embedded or limited environment + * without access to dynamic allocation. + */ + +static XXH_CONSTF void* XXH_malloc(size_t s) { (void)s; return NULL; } +static void XXH_free(void* p) { (void)p; } + +#else + +/* + * Modify the local functions below should you wish to use + * different memory routines for malloc() and free() + */ +#include + +/*! + * @internal + * @brief Modify this function to use a different routine than malloc(). + */ +static XXH_MALLOCF void* XXH_malloc(size_t s) { return malloc(s); } + +/*! + * @internal + * @brief Modify this function to use a different routine than free(). + */ +static void XXH_free(void* p) { free(p); } + +#endif /* XXH_NO_STDLIB */ + +#include + +/*! + * @internal + * @brief Modify this function to use a different routine than memcpy(). + */ +static void* XXH_memcpy(void* dest, const void* src, size_t size) +{ + return memcpy(dest,src,size); +} + +#include /* ULLONG_MAX */ /* ************************************* @@ -1488,6 +2350,11 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size) { return ZSTD_ # define XXH_NO_INLINE static #endif +#if XXH3_INLINE_SECRET +# define XXH3_WITH_SECRET_INLINE XXH_FORCE_INLINE +#else +# define XXH3_WITH_SECRET_INLINE XXH_NO_INLINE +#endif /* ************************************* @@ -1513,14 +2380,17 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size) { return ZSTD_ # include /* note: can still be disabled with NDEBUG */ # define XXH_ASSERT(c) assert(c) #else -# define XXH_ASSERT(c) ((void)0) +# if defined(__INTEL_COMPILER) +# define XXH_ASSERT(c) XXH_ASSUME((unsigned char) (c)) +# else +# define XXH_ASSERT(c) XXH_ASSUME(c) +# endif #endif /* note: use after variable declarations */ #ifndef XXH_STATIC_ASSERT # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */ -# include -# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0) +# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { _Static_assert((c),m); } while(0) # elif defined(__cplusplus) && (__cplusplus >= 201103L) /* C++11 */ # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0) # else @@ -1535,7 +2405,7 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size) { return ZSTD_ * @brief Used to prevent unwanted optimizations for @p var. * * It uses an empty GCC inline assembly statement with a register constraint - * which forces @p var into a general purpose register (e.g. eax, ebx, ecx + * which forces @p var into a general purpose register (eg eax, ebx, ecx * on x86) and marks it as modified. * * This is used in a few places to avoid unwanted autovectorization (e.g. @@ -1546,18 +2416,30 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size) { return ZSTD_ * XXH3_initCustomSecret_scalar(). */ #if defined(__GNUC__) || defined(__clang__) -# define XXH_COMPILER_GUARD(var) __asm__ __volatile__("" : "+r" (var)) +# define XXH_COMPILER_GUARD(var) __asm__("" : "+r" (var)) #else # define XXH_COMPILER_GUARD(var) ((void)0) #endif +/* Specifically for NEON vectors which use the "w" constraint, on + * Clang. */ +#if defined(__clang__) && defined(__ARM_ARCH) && !defined(__wasm__) +# define XXH_COMPILER_GUARD_CLANG_NEON(var) __asm__("" : "+w" (var)) +#else +# define XXH_COMPILER_GUARD_CLANG_NEON(var) ((void)0) +#endif + /* ************************************* * Basic Types ***************************************/ #if !defined (__VMS) \ && (defined (__cplusplus) \ || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) -# include +# ifdef _AIX +# include +# else +# include +# endif typedef uint8_t xxh_u8; #else typedef unsigned char xxh_u8; @@ -1565,6 +2447,7 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size) { return ZSTD_ typedef XXH32_hash_t xxh_u32; #ifdef XXH_OLD_NAMES +# warning "XXH_OLD_NAMES is planned to be removed starting v0.9. If the program depends on it, consider moving away from it by employing newer type names directly" # define BYTE xxh_u8 # define U8 xxh_u8 # define U32 xxh_u32 @@ -1638,18 +2521,19 @@ static xxh_u32 XXH_read32(const void* memPtr) { return *(const xxh_u32*) memPtr; #elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) /* - * __pack instructions are safer but compiler specific, hence potentially - * problematic for some compilers. - * - * Currently only defined for GCC and ICC. + * __attribute__((aligned(1))) is supported by gcc and clang. Originally the + * documentation claimed that it only increased the alignment, but actually it + * can decrease it on gcc, clang, and icc: + * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69502, + * https://gcc.godbolt.org/z/xYez1j67Y. */ #ifdef XXH_OLD_NAMES typedef union { xxh_u32 u32; } __attribute__((packed)) unalign; #endif static xxh_u32 XXH_read32(const void* ptr) { - typedef union { xxh_u32 u32; } __attribute__((packed)) xxh_unalign; - return ((const xxh_unalign*)ptr)->u32; + typedef __attribute__((aligned(1))) xxh_u32 xxh_unalign32; + return *((const xxh_unalign32*)ptr); } #else @@ -1732,6 +2616,51 @@ static int XXH_isLittleEndian(void) # define XXH_HAS_BUILTIN(x) 0 #endif + + +/* + * C23 and future versions have standard "unreachable()". + * Once it has been implemented reliably we can add it as an + * additional case: + * + * ``` + * #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= XXH_C23_VN) + * # include + * # ifdef unreachable + * # define XXH_UNREACHABLE() unreachable() + * # endif + * #endif + * ``` + * + * Note C++23 also has std::unreachable() which can be detected + * as follows: + * ``` + * #if defined(__cpp_lib_unreachable) && (__cpp_lib_unreachable >= 202202L) + * # include + * # define XXH_UNREACHABLE() std::unreachable() + * #endif + * ``` + * NB: `__cpp_lib_unreachable` is defined in the `` header. + * We don't use that as including `` in `extern "C"` blocks + * doesn't work on GCC12 + */ + +#if XXH_HAS_BUILTIN(__builtin_unreachable) +# define XXH_UNREACHABLE() __builtin_unreachable() + +#elif defined(_MSC_VER) +# define XXH_UNREACHABLE() __assume(0) + +#else +# define XXH_UNREACHABLE() +#endif + +#if XXH_HAS_BUILTIN(__builtin_assume) +# define XXH_ASSUME(c) __builtin_assume(c) +#else +# define XXH_ASSUME(c) if (!(c)) { XXH_UNREACHABLE(); } +#endif + /*! * @internal * @def XXH_rotl32(x,r) @@ -1854,8 +2783,10 @@ XXH_PUBLIC_API unsigned XXH_versionNumber (void) { return XXH_VERSION_NUMBER; } *********************************************************************/ /*! * @} - * @defgroup xxh32_impl XXH32 implementation + * @defgroup XXH32_impl XXH32 implementation * @ingroup impl + * + * Details on the XXH32 implementation. * @{ */ /* #define instead of static const, to be used as initializers */ @@ -1889,7 +2820,7 @@ static xxh_u32 XXH32_round(xxh_u32 acc, xxh_u32 input) acc += input * XXH_PRIME32_2; acc = XXH_rotl32(acc, 13); acc *= XXH_PRIME32_1; -#if (defined(__SSE4_1__) || defined(__aarch64__)) && !defined(XXH_ENABLE_AUTOVECTORIZE) +#if (defined(__SSE4_1__) || defined(__aarch64__) || defined(__wasm_simd128__)) && !defined(XXH_ENABLE_AUTOVECTORIZE) /* * UGLY HACK: * A compiler fence is the only thing that prevents GCC and Clang from @@ -1919,9 +2850,12 @@ static xxh_u32 XXH32_round(xxh_u32 acc, xxh_u32 input) * can load data, while v3 can multiply. SSE forces them to operate * together. * - * This is also enabled on AArch64, as Clang autovectorizes it incorrectly - * and it is pointless writing a NEON implementation that is basically the - * same speed as scalar for XXH32. + * This is also enabled on AArch64, as Clang is *very aggressive* in vectorizing + * the loop. NEON is only faster on the A53, and with the newer cores, it is less + * than half the speed. + * + * Additionally, this is used on WASM SIMD128 because it JITs to the same + * SIMD instructions and has the same issue. */ XXH_COMPILER_GUARD(acc); #endif @@ -1935,17 +2869,17 @@ static xxh_u32 XXH32_round(xxh_u32 acc, xxh_u32 input) * The final mix ensures that all input bits have a chance to impact any bit in * the output digest, resulting in an unbiased distribution. * - * @param h32 The hash to avalanche. + * @param hash The hash to avalanche. * @return The avalanched hash. */ -static xxh_u32 XXH32_avalanche(xxh_u32 h32) +static xxh_u32 XXH32_avalanche(xxh_u32 hash) { - h32 ^= h32 >> 15; - h32 *= XXH_PRIME32_2; - h32 ^= h32 >> 13; - h32 *= XXH_PRIME32_3; - h32 ^= h32 >> 16; - return(h32); + hash ^= hash >> 15; + hash *= XXH_PRIME32_2; + hash ^= hash >> 13; + hash *= XXH_PRIME32_3; + hash ^= hash >> 16; + return hash; } #define XXH_get32bits(p) XXH_readLE32_align(p, align) @@ -1958,24 +2892,25 @@ static xxh_u32 XXH32_avalanche(xxh_u32 h32) * This final stage will digest them to ensure that all input bytes are present * in the final mix. * - * @param h32 The hash to finalize. + * @param hash The hash to finalize. * @param ptr The pointer to the remaining input. * @param len The remaining length, modulo 16. * @param align Whether @p ptr is aligned. * @return The finalized hash. + * @see XXH64_finalize(). */ -static xxh_u32 -XXH32_finalize(xxh_u32 h32, const xxh_u8* ptr, size_t len, XXH_alignment align) +static XXH_PUREF xxh_u32 +XXH32_finalize(xxh_u32 hash, const xxh_u8* ptr, size_t len, XXH_alignment align) { -#define XXH_PROCESS1 do { \ - h32 += (*ptr++) * XXH_PRIME32_5; \ - h32 = XXH_rotl32(h32, 11) * XXH_PRIME32_1; \ +#define XXH_PROCESS1 do { \ + hash += (*ptr++) * XXH_PRIME32_5; \ + hash = XXH_rotl32(hash, 11) * XXH_PRIME32_1; \ } while (0) -#define XXH_PROCESS4 do { \ - h32 += XXH_get32bits(ptr) * XXH_PRIME32_3; \ - ptr += 4; \ - h32 = XXH_rotl32(h32, 17) * XXH_PRIME32_4; \ +#define XXH_PROCESS4 do { \ + hash += XXH_get32bits(ptr) * XXH_PRIME32_3; \ + ptr += 4; \ + hash = XXH_rotl32(hash, 17) * XXH_PRIME32_4; \ } while (0) if (ptr==NULL) XXH_ASSERT(len == 0); @@ -1991,49 +2926,49 @@ XXH32_finalize(xxh_u32 h32, const xxh_u8* ptr, size_t len, XXH_alignment align) XXH_PROCESS1; --len; } - return XXH32_avalanche(h32); + return XXH32_avalanche(hash); } else { switch(len&15) /* or switch(bEnd - p) */ { case 12: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 8: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 4: XXH_PROCESS4; - return XXH32_avalanche(h32); + return XXH32_avalanche(hash); case 13: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 9: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 5: XXH_PROCESS4; XXH_PROCESS1; - return XXH32_avalanche(h32); + return XXH32_avalanche(hash); case 14: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 10: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 6: XXH_PROCESS4; XXH_PROCESS1; XXH_PROCESS1; - return XXH32_avalanche(h32); + return XXH32_avalanche(hash); case 15: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 11: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 7: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 3: XXH_PROCESS1; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 2: XXH_PROCESS1; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 1: XXH_PROCESS1; - XXH_FALLTHROUGH; - case 0: return XXH32_avalanche(h32); + XXH_FALLTHROUGH; /* fallthrough */ + case 0: return XXH32_avalanche(hash); } XXH_ASSERT(0); - return h32; /* reaching this point is deemed impossible */ + return hash; /* reaching this point is deemed impossible */ } } @@ -2053,7 +2988,7 @@ XXH32_finalize(xxh_u32 h32, const xxh_u8* ptr, size_t len, XXH_alignment align) * @param align Whether @p input is aligned. * @return The calculated hash. */ -XXH_FORCE_INLINE xxh_u32 +XXH_FORCE_INLINE XXH_PUREF xxh_u32 XXH32_endian_align(const xxh_u8* input, size_t len, xxh_u32 seed, XXH_alignment align) { xxh_u32 h32; @@ -2086,10 +3021,10 @@ XXH32_endian_align(const xxh_u8* input, size_t len, xxh_u32 seed, XXH_alignment return XXH32_finalize(h32, input, len&15, align); } -/*! @ingroup xxh32_family */ +/*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t len, XXH32_hash_t seed) { -#if 0 +#if !defined(XXH_NO_STREAM) && XXH_SIZE_OPT >= 2 /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ XXH32_state_t state; XXH32_reset(&state, seed); @@ -2108,27 +3043,26 @@ XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t len, XXH32_hash_t s /******* Hash streaming *******/ -/*! - * @ingroup xxh32_family - */ +#ifndef XXH_NO_STREAM +/*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void) { return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t)); } -/*! @ingroup xxh32_family */ +/*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr) { XXH_free(statePtr); return XXH_OK; } -/*! @ingroup xxh32_family */ +/*! @ingroup XXH32_family */ XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dstState, const XXH32_state_t* srcState) { XXH_memcpy(dstState, srcState, sizeof(*dstState)); } -/*! @ingroup xxh32_family */ +/*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t* statePtr, XXH32_hash_t seed) { XXH_ASSERT(statePtr != NULL); @@ -2141,7 +3075,7 @@ XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t* statePtr, XXH32_hash_t s } -/*! @ingroup xxh32_family */ +/*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH_errorcode XXH32_update(XXH32_state_t* state, const void* input, size_t len) { @@ -2196,7 +3130,7 @@ XXH32_update(XXH32_state_t* state, const void* input, size_t len) } -/*! @ingroup xxh32_family */ +/*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH32_hash_t XXH32_digest(const XXH32_state_t* state) { xxh_u32 h32; @@ -2214,31 +3148,18 @@ XXH_PUBLIC_API XXH32_hash_t XXH32_digest(const XXH32_state_t* state) return XXH32_finalize(h32, (const xxh_u8*)state->mem32, state->memsize, XXH_aligned); } - +#endif /* !XXH_NO_STREAM */ /******* Canonical representation *******/ -/*! - * @ingroup xxh32_family - * The default return values from XXH functions are unsigned 32 and 64 bit - * integers. - * - * The canonical representation uses big endian convention, the same convention - * as human-readable numbers (large digits first). - * - * This way, hash values can be written into a file or buffer, remaining - * comparable across different systems. - * - * The following functions allow transformation of hash values to and from their - * canonical format. - */ +/*! @ingroup XXH32_family */ XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash) { - /* XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t)); */ + XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t)); if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap32(hash); XXH_memcpy(dst, &hash, sizeof(*dst)); } -/*! @ingroup xxh32_family */ +/*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src) { return XXH_readBE32(src); @@ -2279,18 +3200,19 @@ static xxh_u64 XXH_read64(const void* memPtr) #elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) /* - * __pack instructions are safer, but compiler specific, hence potentially - * problematic for some compilers. - * - * Currently only defined for GCC and ICC. + * __attribute__((aligned(1))) is supported by gcc and clang. Originally the + * documentation claimed that it only increased the alignment, but actually it + * can decrease it on gcc, clang, and icc: + * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69502, + * https://gcc.godbolt.org/z/xYez1j67Y. */ #ifdef XXH_OLD_NAMES typedef union { xxh_u32 u32; xxh_u64 u64; } __attribute__((packed)) unalign64; #endif static xxh_u64 XXH_read64(const void* ptr) { - typedef union { xxh_u32 u32; xxh_u64 u64; } __attribute__((packed)) xxh_unalign64; - return ((const xxh_unalign64*)ptr)->u64; + typedef __attribute__((aligned(1))) xxh_u64 xxh_unalign64; + return *((const xxh_unalign64*)ptr); } #else @@ -2381,8 +3303,10 @@ XXH_readLE64_align(const void* ptr, XXH_alignment align) /******* xxh64 *******/ /*! * @} - * @defgroup xxh64_impl XXH64 implementation + * @defgroup XXH64_impl XXH64 implementation * @ingroup impl + * + * Details on the XXH64 implementation. * @{ */ /* #define rather that static const, to be used as initializers */ @@ -2400,11 +3324,29 @@ XXH_readLE64_align(const void* ptr, XXH_alignment align) # define PRIME64_5 XXH_PRIME64_5 #endif +/*! @copydoc XXH32_round */ static xxh_u64 XXH64_round(xxh_u64 acc, xxh_u64 input) { acc += input * XXH_PRIME64_2; acc = XXH_rotl64(acc, 31); acc *= XXH_PRIME64_1; +#if (defined(__AVX512F__)) && !defined(XXH_ENABLE_AUTOVECTORIZE) + /* + * DISABLE AUTOVECTORIZATION: + * A compiler fence is used to prevent GCC and Clang from + * autovectorizing the XXH64 loop (pragmas and attributes don't work for some + * reason) without globally disabling AVX512. + * + * Autovectorization of XXH64 tends to be detrimental, + * though the exact outcome may change depending on exact cpu and compiler version. + * For information, it has been reported as detrimental for Skylake-X, + * but possibly beneficial for Zen4. + * + * The default is to disable auto-vectorization, + * but you can select to enable it instead using `XXH_ENABLE_AUTOVECTORIZE` build variable. + */ + XXH_COMPILER_GUARD(acc); +#endif return acc; } @@ -2416,43 +3358,59 @@ static xxh_u64 XXH64_mergeRound(xxh_u64 acc, xxh_u64 val) return acc; } -static xxh_u64 XXH64_avalanche(xxh_u64 h64) +/*! @copydoc XXH32_avalanche */ +static xxh_u64 XXH64_avalanche(xxh_u64 hash) { - h64 ^= h64 >> 33; - h64 *= XXH_PRIME64_2; - h64 ^= h64 >> 29; - h64 *= XXH_PRIME64_3; - h64 ^= h64 >> 32; - return h64; + hash ^= hash >> 33; + hash *= XXH_PRIME64_2; + hash ^= hash >> 29; + hash *= XXH_PRIME64_3; + hash ^= hash >> 32; + return hash; } #define XXH_get64bits(p) XXH_readLE64_align(p, align) -static xxh_u64 -XXH64_finalize(xxh_u64 h64, const xxh_u8* ptr, size_t len, XXH_alignment align) +/*! + * @internal + * @brief Processes the last 0-31 bytes of @p ptr. + * + * There may be up to 31 bytes remaining to consume from the input. + * This final stage will digest them to ensure that all input bytes are present + * in the final mix. + * + * @param hash The hash to finalize. + * @param ptr The pointer to the remaining input. + * @param len The remaining length, modulo 32. + * @param align Whether @p ptr is aligned. + * @return The finalized hash + * @see XXH32_finalize(). + */ +static XXH_PUREF xxh_u64 +XXH64_finalize(xxh_u64 hash, const xxh_u8* ptr, size_t len, XXH_alignment align) { if (ptr==NULL) XXH_ASSERT(len == 0); len &= 31; while (len >= 8) { xxh_u64 const k1 = XXH64_round(0, XXH_get64bits(ptr)); ptr += 8; - h64 ^= k1; - h64 = XXH_rotl64(h64,27) * XXH_PRIME64_1 + XXH_PRIME64_4; + hash ^= k1; + hash = XXH_rotl64(hash,27) * XXH_PRIME64_1 + XXH_PRIME64_4; len -= 8; } if (len >= 4) { - h64 ^= (xxh_u64)(XXH_get32bits(ptr)) * XXH_PRIME64_1; + hash ^= (xxh_u64)(XXH_get32bits(ptr)) * XXH_PRIME64_1; ptr += 4; - h64 = XXH_rotl64(h64, 23) * XXH_PRIME64_2 + XXH_PRIME64_3; + hash = XXH_rotl64(hash, 23) * XXH_PRIME64_2 + XXH_PRIME64_3; len -= 4; } while (len > 0) { - h64 ^= (*ptr++) * XXH_PRIME64_5; - h64 = XXH_rotl64(h64, 11) * XXH_PRIME64_1; + hash ^= (*ptr++) * XXH_PRIME64_5; + hash = XXH_rotl64(hash, 11) * XXH_PRIME64_1; --len; } - return XXH64_avalanche(h64); + return XXH64_avalanche(hash); } #ifdef XXH_OLD_NAMES @@ -2465,7 +3423,15 @@ XXH64_finalize(xxh_u64 h64, const xxh_u8* ptr, size_t len, XXH_alignment align) # undef XXH_PROCESS8_64 #endif -XXH_FORCE_INLINE xxh_u64 +/*! + * @internal + * @brief The implementation for @ref XXH64(). + * + * @param input , len , seed Directly passed from @ref XXH64(). + * @param align Whether @p input is aligned. + * @return The calculated hash. + */ +XXH_FORCE_INLINE XXH_PUREF xxh_u64 XXH64_endian_align(const xxh_u8* input, size_t len, xxh_u64 seed, XXH_alignment align) { xxh_u64 h64; @@ -2502,10 +3468,10 @@ XXH64_endian_align(const xxh_u8* input, size_t len, xxh_u64 seed, XXH_alignment } -/*! @ingroup xxh64_family */ -XXH_PUBLIC_API XXH64_hash_t XXH64 (const void* input, size_t len, XXH64_hash_t seed) +/*! @ingroup XXH64_family */ +XXH_PUBLIC_API XXH64_hash_t XXH64 (XXH_NOESCAPE const void* input, size_t len, XXH64_hash_t seed) { -#if 0 +#if !defined(XXH_NO_STREAM) && XXH_SIZE_OPT >= 2 /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ XXH64_state_t state; XXH64_reset(&state, seed); @@ -2523,27 +3489,27 @@ XXH_PUBLIC_API XXH64_hash_t XXH64 (const void* input, size_t len, XXH64_hash_t s } /******* Hash Streaming *******/ - -/*! @ingroup xxh64_family*/ +#ifndef XXH_NO_STREAM +/*! @ingroup XXH64_family*/ XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void) { return (XXH64_state_t*)XXH_malloc(sizeof(XXH64_state_t)); } -/*! @ingroup xxh64_family */ +/*! @ingroup XXH64_family */ XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr) { XXH_free(statePtr); return XXH_OK; } -/*! @ingroup xxh64_family */ -XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* dstState, const XXH64_state_t* srcState) +/*! @ingroup XXH64_family */ +XXH_PUBLIC_API void XXH64_copyState(XXH_NOESCAPE XXH64_state_t* dstState, const XXH64_state_t* srcState) { XXH_memcpy(dstState, srcState, sizeof(*dstState)); } -/*! @ingroup xxh64_family */ -XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH64_state_t* statePtr, XXH64_hash_t seed) +/*! @ingroup XXH64_family */ +XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH_NOESCAPE XXH64_state_t* statePtr, XXH64_hash_t seed) { XXH_ASSERT(statePtr != NULL); memset(statePtr, 0, sizeof(*statePtr)); @@ -2554,9 +3520,9 @@ XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH64_state_t* statePtr, XXH64_hash_t s return XXH_OK; } -/*! @ingroup xxh64_family */ +/*! @ingroup XXH64_family */ XXH_PUBLIC_API XXH_errorcode -XXH64_update (XXH64_state_t* state, const void* input, size_t len) +XXH64_update (XXH_NOESCAPE XXH64_state_t* state, XXH_NOESCAPE const void* input, size_t len) { if (input==NULL) { XXH_ASSERT(len == 0); @@ -2606,8 +3572,8 @@ XXH64_update (XXH64_state_t* state, const void* input, size_t len) } -/*! @ingroup xxh64_family */ -XXH_PUBLIC_API XXH64_hash_t XXH64_digest(const XXH64_state_t* state) +/*! @ingroup XXH64_family */ +XXH_PUBLIC_API XXH64_hash_t XXH64_digest(XXH_NOESCAPE const XXH64_state_t* state) { xxh_u64 h64; @@ -2625,20 +3591,20 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_digest(const XXH64_state_t* state) return XXH64_finalize(h64, (const xxh_u8*)state->mem64, (size_t)state->total_len, XXH_aligned); } - +#endif /* !XXH_NO_STREAM */ /******* Canonical representation *******/ -/*! @ingroup xxh64_family */ -XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash) +/*! @ingroup XXH64_family */ +XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH_NOESCAPE XXH64_canonical_t* dst, XXH64_hash_t hash) { - /* XXH_STATIC_ASSERT(sizeof(XXH64_canonical_t) == sizeof(XXH64_hash_t)); */ + XXH_STATIC_ASSERT(sizeof(XXH64_canonical_t) == sizeof(XXH64_hash_t)); if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap64(hash); XXH_memcpy(dst, &hash, sizeof(*dst)); } -/*! @ingroup xxh64_family */ -XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src) +/*! @ingroup XXH64_family */ +XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(XXH_NOESCAPE const XXH64_canonical_t* src) { return XXH_readBE64(src); } @@ -2651,7 +3617,7 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src ************************************************************************ */ /*! * @} - * @defgroup xxh3_impl XXH3 implementation + * @defgroup XXH3_impl XXH3 implementation * @ingroup impl * @{ */ @@ -2659,11 +3625,19 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src /* === Compiler specifics === */ #if ((defined(sun) || defined(__sun)) && __cplusplus) /* Solaris includes __STDC_VERSION__ with C++. Tested with GCC 5.5 */ -# define XXH_RESTRICT /* disable */ +# define XXH_RESTRICT /* disable */ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* >= C99 */ # define XXH_RESTRICT restrict +#elif (defined (__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))) \ + || (defined (__clang__)) \ + || (defined (_MSC_VER) && (_MSC_VER >= 1400)) \ + || (defined (__INTEL_COMPILER) && (__INTEL_COMPILER >= 1300)) +/* + * There are a LOT more compilers that recognize __restrict but this + * covers the major ones. + */ +# define XXH_RESTRICT __restrict #else -/* Note: it might be useful to define __restrict or __restrict__ for some C++ compilers */ # define XXH_RESTRICT /* disable */ #endif @@ -2677,10 +3651,26 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src # define XXH_unlikely(x) (x) #endif +#ifndef XXH_HAS_INCLUDE +# ifdef __has_include +/* + * Not defined as XXH_HAS_INCLUDE(x) (function-like) because + * this causes segfaults in Apple Clang 4.2 (on Mac OS X 10.7 Lion) + */ +# define XXH_HAS_INCLUDE __has_include +# else +# define XXH_HAS_INCLUDE(x) 0 +# endif +#endif + #if defined(__GNUC__) || defined(__clang__) +# if defined(__ARM_FEATURE_SVE) +# include +# endif # if defined(__ARM_NEON__) || defined(__ARM_NEON) \ - || defined(__aarch64__) || defined(_M_ARM) \ - || defined(_M_ARM64) || defined(_M_ARM64EC) + || (defined(_M_ARM) && _M_ARM >= 7) \ + || defined(_M_ARM64) || defined(_M_ARM64EC) \ + || (defined(__wasm_simd128__) && XXH_HAS_INCLUDE()) /* WASM SIMD128 via SIMDe */ # define inline __inline__ /* circumvent a clang bug */ # include # undef inline @@ -2791,7 +3781,7 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src * Note that these are actually implemented as macros. * * If this is not defined, it is detected automatically. - * @ref XXH_X86DISPATCH overrides this. + * internal macro XXH_X86DISPATCH overrides this. */ enum XXH_VECTOR_TYPE /* fake enum */ { XXH_SCALAR = 0, /*!< Portable scalar version */ @@ -2803,8 +3793,13 @@ enum XXH_VECTOR_TYPE /* fake enum */ { */ XXH_AVX2 = 2, /*!< AVX2 for Haswell and Bulldozer */ XXH_AVX512 = 3, /*!< AVX512 for Skylake and Icelake */ - XXH_NEON = 4, /*!< NEON for most ARMv7-A and all AArch64 */ + XXH_NEON = 4, /*!< + * NEON for most ARMv7-A, all AArch64, and WASM SIMD128 + * via the SIMDeverywhere polyfill provided with the + * Emscripten SDK. + */ XXH_VSX = 5, /*!< VSX and ZVector for POWER8/z13 (64-bit) */ + XXH_SVE = 6, /*!< SVE for some ARMv8-A and ARMv9-A */ }; /*! * @ingroup tuning @@ -2826,12 +3821,16 @@ enum XXH_VECTOR_TYPE /* fake enum */ { # define XXH_AVX512 3 # define XXH_NEON 4 # define XXH_VSX 5 +# define XXH_SVE 6 #endif #ifndef XXH_VECTOR /* can be defined on command line */ -# if ( \ +# if defined(__ARM_FEATURE_SVE) +# define XXH_VECTOR XXH_SVE +# elif ( \ defined(__ARM_NEON__) || defined(__ARM_NEON) /* gcc */ \ || defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC) /* msvc */ \ + || (defined(__wasm_simd128__) && XXH_HAS_INCLUDE()) /* wasm simd128 via SIMDe */ \ ) && ( \ defined(_WIN32) || defined(__LITTLE_ENDIAN__) /* little endian only */ \ || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) \ @@ -2852,6 +3851,17 @@ enum XXH_VECTOR_TYPE /* fake enum */ { # endif #endif +/* __ARM_FEATURE_SVE is only supported by GCC & Clang. */ +#if (XXH_VECTOR == XXH_SVE) && !defined(__ARM_FEATURE_SVE) +# ifdef _MSC_VER +# pragma warning(once : 4606) +# else +# warning "__ARM_FEATURE_SVE isn't supported. Use SCALAR instead." +# endif +# undef XXH_VECTOR +# define XXH_VECTOR XXH_SCALAR +#endif + /* * Controls the alignment of the accumulator, * for compatibility with aligned vector loads, which are usually faster. @@ -2871,16 +3881,26 @@ enum XXH_VECTOR_TYPE /* fake enum */ { # define XXH_ACC_ALIGN 16 # elif XXH_VECTOR == XXH_AVX512 /* avx512 */ # define XXH_ACC_ALIGN 64 +# elif XXH_VECTOR == XXH_SVE /* sve */ +# define XXH_ACC_ALIGN 64 # endif #endif #if defined(XXH_X86DISPATCH) || XXH_VECTOR == XXH_SSE2 \ || XXH_VECTOR == XXH_AVX2 || XXH_VECTOR == XXH_AVX512 # define XXH_SEC_ALIGN XXH_ACC_ALIGN +#elif XXH_VECTOR == XXH_SVE +# define XXH_SEC_ALIGN XXH_ACC_ALIGN #else # define XXH_SEC_ALIGN 8 #endif +#if defined(__GNUC__) || defined(__clang__) +# define XXH_ALIASING __attribute__((may_alias)) +#else +# define XXH_ALIASING /* nothing */ +#endif + /* * UGLY HACK: * GCC usually generates the best code with -O3 for xxHash. @@ -2904,153 +3924,126 @@ enum XXH_VECTOR_TYPE /* fake enum */ { */ #if XXH_VECTOR == XXH_AVX2 /* AVX2 */ \ && defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ - && defined(__OPTIMIZE__) && !defined(__OPTIMIZE_SIZE__) /* respect -O0 and -Os */ + && defined(__OPTIMIZE__) && XXH_SIZE_OPT <= 0 /* respect -O0 and -Os */ # pragma GCC push_options # pragma GCC optimize("-O2") #endif - #if XXH_VECTOR == XXH_NEON + /* - * NEON's setup for vmlal_u32 is a little more complicated than it is on - * SSE2, AVX2, and VSX. + * UGLY HACK: While AArch64 GCC on Linux does not seem to care, on macOS, GCC -O3 + * optimizes out the entire hashLong loop because of the aliasing violation. * - * While PMULUDQ and VMULEUW both perform a mask, VMLAL.U32 performs an upcast. - * - * To do the same operation, the 128-bit 'Q' register needs to be split into - * two 64-bit 'D' registers, performing this operation:: - * - * [ a | b ] - * | '---------. .--------' | - * | x | - * | .---------' '--------. | - * [ a & 0xFFFFFFFF | b & 0xFFFFFFFF ],[ a >> 32 | b >> 32 ] - * - * Due to significant changes in aarch64, the fastest method for aarch64 is - * completely different than the fastest method for ARMv7-A. - * - * ARMv7-A treats D registers as unions overlaying Q registers, so modifying - * D11 will modify the high half of Q5. This is similar to how modifying AH - * will only affect bits 8-15 of AX on x86. - * - * VZIP takes two registers, and puts even lanes in one register and odd lanes - * in the other. - * - * On ARMv7-A, this strangely modifies both parameters in place instead of - * taking the usual 3-operand form. - * - * Therefore, if we want to do this, we can simply use a D-form VZIP.32 on the - * lower and upper halves of the Q register to end up with the high and low - * halves where we want - all in one instruction. - * - * vzip.32 d10, d11 @ d10 = { d10[0], d11[0] }; d11 = { d10[1], d11[1] } - * - * Unfortunately we need inline assembly for this: Instructions modifying two - * registers at once is not possible in GCC or Clang's IR, and they have to - * create a copy. - * - * aarch64 requires a different approach. - * - * In order to make it easier to write a decent compiler for aarch64, many - * quirks were removed, such as conditional execution. - * - * NEON was also affected by this. - * - * aarch64 cannot access the high bits of a Q-form register, and writes to a - * D-form register zero the high bits, similar to how writes to W-form scalar - * registers (or DWORD registers on x86_64) work. - * - * The formerly free vget_high intrinsics now require a vext (with a few - * exceptions) - * - * Additionally, VZIP was replaced by ZIP1 and ZIP2, which are the equivalent - * of PUNPCKL* and PUNPCKH* in SSE, respectively, in order to only modify one - * operand. - * - * The equivalent of the VZIP.32 on the lower and upper halves would be this - * mess: - * - * ext v2.4s, v0.4s, v0.4s, #2 // v2 = { v0[2], v0[3], v0[0], v0[1] } - * zip1 v1.2s, v0.2s, v2.2s // v1 = { v0[0], v2[0] } - * zip2 v0.2s, v0.2s, v1.2s // v0 = { v0[1], v2[1] } - * - * Instead, we use a literal downcast, vmovn_u64 (XTN), and vshrn_n_u64 (SHRN): - * - * shrn v1.2s, v0.2d, #32 // v1 = (uint32x2_t)(v0 >> 32); - * xtn v0.2s, v0.2d // v0 = (uint32x2_t)(v0 & 0xFFFFFFFF); - * - * This is available on ARMv7-A, but is less efficient than a single VZIP.32. + * However, GCC is also inefficient at load-store optimization with vld1q/vst1q, + * so the only option is to mark it as aliasing. */ +typedef uint64x2_t xxh_aliasing_uint64x2_t XXH_ALIASING; /*! - * Function-like macro: - * void XXH_SPLIT_IN_PLACE(uint64x2_t &in, uint32x2_t &outLo, uint32x2_t &outHi) - * { - * outLo = (uint32x2_t)(in & 0xFFFFFFFF); - * outHi = (uint32x2_t)(in >> 32); - * in = UNDEFINED; - * } + * @internal + * @brief `vld1q_u64` but faster and alignment-safe. + * + * On AArch64, unaligned access is always safe, but on ARMv7-a, it is only + * *conditionally* safe (`vld1` has an alignment bit like `movdq[ua]` in x86). + * + * GCC for AArch64 sees `vld1q_u8` as an intrinsic instead of a load, so it + * prohibits load-store optimizations. Therefore, a direct dereference is used. + * + * Otherwise, `vld1q_u8` is used with `vreinterpretq_u8_u64` to do a safe + * unaligned load. */ -# if !defined(XXH_NO_VZIP_HACK) /* define to disable */ \ - && (defined(__GNUC__) || defined(__clang__)) \ - && (defined(__arm__) || defined(__thumb__) || defined(_M_ARM)) -# define XXH_SPLIT_IN_PLACE(in, outLo, outHi) \ - do { \ - /* Undocumented GCC/Clang operand modifier: %e0 = lower D half, %f0 = upper D half */ \ - /* https://github.com/gcc-mirror/gcc/blob/38cf91e5/gcc/config/arm/arm.c#L22486 */ \ - /* https://github.com/llvm-mirror/llvm/blob/2c4ca683/lib/Target/ARM/ARMAsmPrinter.cpp#L399 */ \ - __asm__("vzip.32 %e0, %f0" : "+w" (in)); \ - (outLo) = vget_low_u32 (vreinterpretq_u32_u64(in)); \ - (outHi) = vget_high_u32(vreinterpretq_u32_u64(in)); \ - } while (0) -# else -# define XXH_SPLIT_IN_PLACE(in, outLo, outHi) \ - do { \ - (outLo) = vmovn_u64 (in); \ - (outHi) = vshrn_n_u64 ((in), 32); \ - } while (0) -# endif +#if defined(__aarch64__) && defined(__GNUC__) && !defined(__clang__) +XXH_FORCE_INLINE uint64x2_t XXH_vld1q_u64(void const* ptr) /* silence -Wcast-align */ +{ + return *(xxh_aliasing_uint64x2_t const *)ptr; +} +#else +XXH_FORCE_INLINE uint64x2_t XXH_vld1q_u64(void const* ptr) +{ + return vreinterpretq_u64_u8(vld1q_u8((uint8_t const*)ptr)); +} +#endif + +/*! + * @internal + * @brief `vmlal_u32` on low and high halves of a vector. + * + * This is a workaround for AArch64 GCC < 11 which implemented arm_neon.h with + * inline assembly and were therefore incapable of merging the `vget_{low, high}_u32` + * with `vmlal_u32`. + */ +#if defined(__aarch64__) && defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 11 +XXH_FORCE_INLINE uint64x2_t +XXH_vmlal_low_u32(uint64x2_t acc, uint32x4_t lhs, uint32x4_t rhs) +{ + /* Inline assembly is the only way */ + __asm__("umlal %0.2d, %1.2s, %2.2s" : "+w" (acc) : "w" (lhs), "w" (rhs)); + return acc; +} +XXH_FORCE_INLINE uint64x2_t +XXH_vmlal_high_u32(uint64x2_t acc, uint32x4_t lhs, uint32x4_t rhs) +{ + /* This intrinsic works as expected */ + return vmlal_high_u32(acc, lhs, rhs); +} +#else +/* Portable intrinsic versions */ +XXH_FORCE_INLINE uint64x2_t +XXH_vmlal_low_u32(uint64x2_t acc, uint32x4_t lhs, uint32x4_t rhs) +{ + return vmlal_u32(acc, vget_low_u32(lhs), vget_low_u32(rhs)); +} +/*! @copydoc XXH_vmlal_low_u32 + * Assume the compiler converts this to vmlal_high_u32 on aarch64 */ +XXH_FORCE_INLINE uint64x2_t +XXH_vmlal_high_u32(uint64x2_t acc, uint32x4_t lhs, uint32x4_t rhs) +{ + return vmlal_u32(acc, vget_high_u32(lhs), vget_high_u32(rhs)); +} +#endif /*! * @ingroup tuning * @brief Controls the NEON to scalar ratio for XXH3 * - * On AArch64 when not optimizing for size, XXH3 will run 6 lanes using NEON and - * 2 lanes on scalar by default. + * This can be set to 2, 4, 6, or 8. * - * This can be set to 2, 4, 6, or 8. ARMv7 will default to all 8 NEON lanes, as the - * emulated 64-bit arithmetic is too slow. + * ARM Cortex CPUs are _very_ sensitive to how their pipelines are used. * - * Modern ARM CPUs are _very_ sensitive to how their pipelines are used. + * For example, the Cortex-A73 can dispatch 3 micro-ops per cycle, but only 2 of those + * can be NEON. If you are only using NEON instructions, you are only using 2/3 of the CPU + * bandwidth. * - * For example, the Cortex-A73 can dispatch 3 micro-ops per cycle, but it can't - * have more than 2 NEON (F0/F1) micro-ops. If you are only using NEON instructions, - * you are only using 2/3 of the CPU bandwidth. - * - * This is even more noticeable on the more advanced cores like the A76 which + * This is even more noticeable on the more advanced cores like the Cortex-A76 which * can dispatch 8 micro-ops per cycle, but still only 2 NEON micro-ops at once. * - * Therefore, @ref XXH3_NEON_LANES lanes will be processed using NEON, and the - * remaining lanes will use scalar instructions. This improves the bandwidth - * and also gives the integer pipelines something to do besides twiddling loop - * counters and pointers. + * Therefore, to make the most out of the pipeline, it is beneficial to run 6 NEON lanes + * and 2 scalar lanes, which is chosen by default. + * + * This does not apply to Apple processors or 32-bit processors, which run better with + * full NEON. These will default to 8. Additionally, size-optimized builds run 8 lanes. * * This change benefits CPUs with large micro-op buffers without negatively affecting - * other CPUs: + * most other CPUs: * * | Chipset | Dispatch type | NEON only | 6:2 hybrid | Diff. | * |:----------------------|:--------------------|----------:|-----------:|------:| * | Snapdragon 730 (A76) | 2 NEON/8 micro-ops | 8.8 GB/s | 10.1 GB/s | ~16% | * | Snapdragon 835 (A73) | 2 NEON/3 micro-ops | 5.1 GB/s | 5.3 GB/s | ~5% | * | Marvell PXA1928 (A53) | In-order dual-issue | 1.9 GB/s | 1.9 GB/s | 0% | + * | Apple M1 | 4 NEON/8 micro-ops | 37.3 GB/s | 36.1 GB/s | ~-3% | * * It also seems to fix some bad codegen on GCC, making it almost as fast as clang. * + * When using WASM SIMD128, if this is 2 or 6, SIMDe will scalarize 2 of the lanes meaning + * it effectively becomes worse 4. + * * @see XXH3_accumulate_512_neon() */ # ifndef XXH3_NEON_LANES # if (defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64) || defined(_M_ARM64EC)) \ - && !defined(__OPTIMIZE_SIZE__) + && !defined(__APPLE__) && XXH_SIZE_OPT <= 0 # define XXH3_NEON_LANES 6 # else # define XXH3_NEON_LANES XXH_ACC_NB @@ -3067,27 +4060,42 @@ enum XXH_VECTOR_TYPE /* fake enum */ { * inconsistent intrinsics, spotty coverage, and multiple endiannesses. */ #if XXH_VECTOR == XXH_VSX +/* Annoyingly, these headers _may_ define three macros: `bool`, `vector`, + * and `pixel`. This is a problem for obvious reasons. + * + * These keywords are unnecessary; the spec literally says they are + * equivalent to `__bool`, `__vector`, and `__pixel` and may be undef'd + * after including the header. + * + * We use pragma push_macro/pop_macro to keep the namespace clean. */ +# pragma push_macro("bool") +# pragma push_macro("vector") +# pragma push_macro("pixel") +/* silence potential macro redefined warnings */ +# undef bool +# undef vector +# undef pixel + # if defined(__s390x__) # include # else -/* gcc's altivec.h can have the unwanted consequence to unconditionally - * #define bool, vector, and pixel keywords, - * with bad consequences for programs already using these keywords for other purposes. - * The paragraph defining these macros is skipped when __APPLE_ALTIVEC__ is defined. - * __APPLE_ALTIVEC__ is _generally_ defined automatically by the compiler, - * but it seems that, in some cases, it isn't. - * Force the build macro to be defined, so that keywords are not altered. - */ -# if defined(__GNUC__) && !defined(__APPLE_ALTIVEC__) -# define __APPLE_ALTIVEC__ -# endif # include # endif +/* Restore the original macro values, if applicable. */ +# pragma pop_macro("pixel") +# pragma pop_macro("vector") +# pragma pop_macro("bool") + typedef __vector unsigned long long xxh_u64x2; typedef __vector unsigned char xxh_u8x16; typedef __vector unsigned xxh_u32x4; +/* + * UGLY HACK: Similar to aarch64 macOS GCC, s390x GCC has the same aliasing issue. + */ +typedef xxh_u64x2 xxh_aliasing_u64x2 XXH_ALIASING; + # ifndef XXH_VSX_BE # if defined(__BIG_ENDIAN__) \ || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) @@ -3139,8 +4147,9 @@ XXH_FORCE_INLINE xxh_u64x2 XXH_vec_loadu(const void *ptr) /* s390x is always big endian, no issue on this platform */ # define XXH_vec_mulo vec_mulo # define XXH_vec_mule vec_mule -# elif defined(__clang__) && XXH_HAS_BUILTIN(__builtin_altivec_vmuleuw) +# elif defined(__clang__) && XXH_HAS_BUILTIN(__builtin_altivec_vmuleuw) && !defined(__ibmxl__) /* Clang has a better way to control this, we can just use the builtin which doesn't swap. */ + /* The IBM XL Compiler (which defined __clang__) only implements the vec_* operations */ # define XXH_vec_mulo __builtin_altivec_vmulouw # define XXH_vec_mule __builtin_altivec_vmuleuw # else @@ -3161,13 +4170,28 @@ XXH_FORCE_INLINE xxh_u64x2 XXH_vec_mule(xxh_u32x4 a, xxh_u32x4 b) # endif /* XXH_vec_mulo, XXH_vec_mule */ #endif /* XXH_VECTOR == XXH_VSX */ +#if XXH_VECTOR == XXH_SVE +#define ACCRND(acc, offset) \ +do { \ + svuint64_t input_vec = svld1_u64(mask, xinput + offset); \ + svuint64_t secret_vec = svld1_u64(mask, xsecret + offset); \ + svuint64_t mixed = sveor_u64_x(mask, secret_vec, input_vec); \ + svuint64_t swapped = svtbl_u64(input_vec, kSwap); \ + svuint64_t mixed_lo = svextw_u64_x(mask, mixed); \ + svuint64_t mixed_hi = svlsr_n_u64_x(mask, mixed, 32); \ + svuint64_t mul = svmad_u64_x(mask, mixed_lo, mixed_hi, swapped); \ + acc = svadd_u64_x(mask, acc, mul); \ +} while (0) +#endif /* XXH_VECTOR == XXH_SVE */ /* prefetch * can be disabled, by declaring XXH_NO_PREFETCH build macro */ #if defined(XXH_NO_PREFETCH) # define XXH_PREFETCH(ptr) (void)(ptr) /* disabled */ #else -# if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86)) /* _mm_prefetch() not defined outside of x86/x64 */ +# if XXH_SIZE_OPT >= 1 +# define XXH_PREFETCH(ptr) (void)(ptr) +# elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86)) /* _mm_prefetch() not defined outside of x86/x64 */ # include /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */ # define XXH_PREFETCH(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0) # elif defined(__GNUC__) && ( (__GNUC__ >= 4) || ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) ) ) @@ -3204,6 +4228,8 @@ XXH_ALIGN(64) static const xxh_u8 XXH3_kSecret[XXH_SECRET_DEFAULT_SIZE] = { 0x45, 0xcb, 0x3a, 0x8f, 0x95, 0x16, 0x04, 0x28, 0xaf, 0xd7, 0xfb, 0xca, 0xbb, 0x4b, 0x40, 0x7e, }; +static const xxh_u64 PRIME_MX1 = 0x165667919E3779F9ULL; /*!< 0b0001011001010110011001111001000110011110001101110111100111111001 */ +static const xxh_u64 PRIME_MX2 = 0x9FB21C651E98DF25ULL; /*!< 0b1001111110110010000111000110010100011110100110001101111100100101 */ #ifdef XXH_OLD_NAMES # define kSecret XXH3_kSecret @@ -3395,7 +4421,7 @@ XXH3_mul128_fold64(xxh_u64 lhs, xxh_u64 rhs) } /*! Seems to produce slightly better code on GCC for some reason. */ -XXH_FORCE_INLINE xxh_u64 XXH_xorshift64(xxh_u64 v64, int shift) +XXH_FORCE_INLINE XXH_CONSTF xxh_u64 XXH_xorshift64(xxh_u64 v64, int shift) { XXH_ASSERT(0 <= shift && shift < 64); return v64 ^ (v64 >> shift); @@ -3408,7 +4434,7 @@ XXH_FORCE_INLINE xxh_u64 XXH_xorshift64(xxh_u64 v64, int shift) static XXH64_hash_t XXH3_avalanche(xxh_u64 h64) { h64 = XXH_xorshift64(h64, 37); - h64 *= 0x165667919E3779F9ULL; + h64 *= PRIME_MX1; h64 = XXH_xorshift64(h64, 32); return h64; } @@ -3422,9 +4448,9 @@ static XXH64_hash_t XXH3_rrmxmx(xxh_u64 h64, xxh_u64 len) { /* this mix is inspired by Pelle Evensen's rrmxmx */ h64 ^= XXH_rotl64(h64, 49) ^ XXH_rotl64(h64, 24); - h64 *= 0x9FB21C651E98DF25ULL; + h64 *= PRIME_MX2; h64 ^= (h64 >> 35) + len ; - h64 *= 0x9FB21C651E98DF25ULL; + h64 *= PRIME_MX2; return XXH_xorshift64(h64, 28); } @@ -3462,7 +4488,7 @@ static XXH64_hash_t XXH3_rrmxmx(xxh_u64 h64, xxh_u64 len) * * This adds an extra layer of strength for custom secrets. */ -XXH_FORCE_INLINE XXH64_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH64_hash_t XXH3_len_1to3_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(input != NULL); @@ -3484,7 +4510,7 @@ XXH3_len_1to3_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_h } } -XXH_FORCE_INLINE XXH64_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH64_hash_t XXH3_len_4to8_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(input != NULL); @@ -3500,7 +4526,7 @@ XXH3_len_4to8_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_h } } -XXH_FORCE_INLINE XXH64_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH64_hash_t XXH3_len_9to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(input != NULL); @@ -3517,7 +4543,7 @@ XXH3_len_9to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_ } } -XXH_FORCE_INLINE XXH64_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH64_hash_t XXH3_len_0to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(len <= 16); @@ -3587,7 +4613,7 @@ XXH_FORCE_INLINE xxh_u64 XXH3_mix16B(const xxh_u8* XXH_RESTRICT input, } /* For mid range keys, XXH3 uses a Mum-hash variant. */ -XXH_FORCE_INLINE XXH64_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH64_hash_t XXH3_len_17to128_64b(const xxh_u8* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, XXH64_hash_t seed) @@ -3596,6 +4622,14 @@ XXH3_len_17to128_64b(const xxh_u8* XXH_RESTRICT input, size_t len, XXH_ASSERT(16 < len && len <= 128); { xxh_u64 acc = len * XXH_PRIME64_1; +#if XXH_SIZE_OPT >= 1 + /* Smaller and cleaner, but slightly slower. */ + unsigned int i = (unsigned int)(len - 1) / 32; + do { + acc += XXH3_mix16B(input+16 * i, secret+32*i, seed); + acc += XXH3_mix16B(input+len-16*(i+1), secret+32*i+16, seed); + } while (i-- != 0); +#else if (len > 32) { if (len > 64) { if (len > 96) { @@ -3610,14 +4644,17 @@ XXH3_len_17to128_64b(const xxh_u8* XXH_RESTRICT input, size_t len, } acc += XXH3_mix16B(input+0, secret+0, seed); acc += XXH3_mix16B(input+len-16, secret+16, seed); - +#endif return XXH3_avalanche(acc); } } +/*! + * @brief Maximum size of "short" key in bytes. + */ #define XXH3_MIDSIZE_MAX 240 -XXH_NO_INLINE XXH64_hash_t +XXH_NO_INLINE XXH_PUREF XXH64_hash_t XXH3_len_129to240_64b(const xxh_u8* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, XXH64_hash_t seed) @@ -3629,13 +4666,17 @@ XXH3_len_129to240_64b(const xxh_u8* XXH_RESTRICT input, size_t len, #define XXH3_MIDSIZE_LASTOFFSET 17 { xxh_u64 acc = len * XXH_PRIME64_1; - int const nbRounds = (int)len / 16; - int i; + xxh_u64 acc_end; + unsigned int const nbRounds = (unsigned int)len / 16; + unsigned int i; + XXH_ASSERT(128 < len && len <= XXH3_MIDSIZE_MAX); for (i=0; i<8; i++) { acc += XXH3_mix16B(input+(16*i), secret+(16*i), seed); } - acc = XXH3_avalanche(acc); + /* last bytes */ + acc_end = XXH3_mix16B(input + len - 16, secret + XXH3_SECRET_SIZE_MIN - XXH3_MIDSIZE_LASTOFFSET, seed); XXH_ASSERT(nbRounds >= 8); + acc = XXH3_avalanche(acc); #if defined(__clang__) /* Clang */ \ && (defined(__ARM_NEON) || defined(__ARM_NEON__)) /* NEON */ \ && !defined(XXH_ENABLE_AUTOVECTORIZE) /* Define to disable */ @@ -3662,11 +4703,13 @@ XXH3_len_129to240_64b(const xxh_u8* XXH_RESTRICT input, size_t len, #pragma clang loop vectorize(disable) #endif for (i=8 ; i < nbRounds; i++) { - acc += XXH3_mix16B(input+(16*i), secret+(16*(i-8)) + XXH3_MIDSIZE_STARTOFFSET, seed); + /* + * Prevents clang for unrolling the acc loop and interleaving with this one. + */ + XXH_COMPILER_GUARD(acc); + acc_end += XXH3_mix16B(input+(16*i), secret+(16*(i-8)) + XXH3_MIDSIZE_STARTOFFSET, seed); } - /* last bytes */ - acc += XXH3_mix16B(input + len - 16, secret + XXH3_SECRET_SIZE_MIN - XXH3_MIDSIZE_LASTOFFSET, seed); - return XXH3_avalanche(acc); + return XXH3_avalanche(acc + acc_end); } } @@ -3682,6 +4725,47 @@ XXH3_len_129to240_64b(const xxh_u8* XXH_RESTRICT input, size_t len, # define ACC_NB XXH_ACC_NB #endif +#ifndef XXH_PREFETCH_DIST +# ifdef __clang__ +# define XXH_PREFETCH_DIST 320 +# else +# if (XXH_VECTOR == XXH_AVX512) +# define XXH_PREFETCH_DIST 512 +# else +# define XXH_PREFETCH_DIST 384 +# endif +# endif /* __clang__ */ +#endif /* XXH_PREFETCH_DIST */ + +/* + * These macros are to generate an XXH3_accumulate() function. + * The two arguments select the name suffix and target attribute. + * + * The name of this symbol is XXH3_accumulate_() and it calls + * XXH3_accumulate_512_(). + * + * It may be useful to hand implement this function if the compiler fails to + * optimize the inline function. + */ +#define XXH3_ACCUMULATE_TEMPLATE(name) \ +void \ +XXH3_accumulate_##name(xxh_u64* XXH_RESTRICT acc, \ + const xxh_u8* XXH_RESTRICT input, \ + const xxh_u8* XXH_RESTRICT secret, \ + size_t nbStripes) \ +{ \ + size_t n; \ + for (n = 0; n < nbStripes; n++ ) { \ + const xxh_u8* const in = input + n*XXH_STRIPE_LEN; \ + XXH_PREFETCH(in + XXH_PREFETCH_DIST); \ + XXH3_accumulate_512_##name( \ + acc, \ + in, \ + secret + n*XXH_SECRET_CONSUME_RATE); \ + } \ +} + + XXH_FORCE_INLINE void XXH_writeLE64(void* dst, xxh_u64 v64) { if (!XXH_CPU_LITTLE_ENDIAN) v64 = XXH_swap64(v64); @@ -3750,7 +4834,7 @@ XXH3_accumulate_512_avx512(void* XXH_RESTRICT acc, /* data_key = data_vec ^ key_vec; */ __m512i const data_key = _mm512_xor_si512 (data_vec, key_vec); /* data_key_lo = data_key >> 32; */ - __m512i const data_key_lo = _mm512_shuffle_epi32 (data_key, (_MM_PERM_ENUM)_MM_SHUFFLE(0, 3, 0, 1)); + __m512i const data_key_lo = _mm512_srli_epi64 (data_key, 32); /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ __m512i const product = _mm512_mul_epu32 (data_key, data_key_lo); /* xacc[0] += swap(data_vec); */ @@ -3760,6 +4844,7 @@ XXH3_accumulate_512_avx512(void* XXH_RESTRICT acc, *xacc = _mm512_add_epi64(product, sum); } } +XXH_FORCE_INLINE XXH_TARGET_AVX512 XXH3_ACCUMULATE_TEMPLATE(avx512) /* * XXH3_scrambleAcc: Scrambles the accumulators to improve mixing. @@ -3793,13 +4878,12 @@ XXH3_scrambleAcc_avx512(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) /* xacc[0] ^= (xacc[0] >> 47) */ __m512i const acc_vec = *xacc; __m512i const shifted = _mm512_srli_epi64 (acc_vec, 47); - __m512i const data_vec = _mm512_xor_si512 (acc_vec, shifted); /* xacc[0] ^= secret; */ __m512i const key_vec = _mm512_loadu_si512 (secret); - __m512i const data_key = _mm512_xor_si512 (data_vec, key_vec); + __m512i const data_key = _mm512_ternarylogic_epi32(key_vec, acc_vec, shifted, 0x96 /* key_vec ^ acc_vec ^ shifted */); /* xacc[0] *= XXH_PRIME32_1; */ - __m512i const data_key_hi = _mm512_shuffle_epi32 (data_key, (_MM_PERM_ENUM)_MM_SHUFFLE(0, 3, 0, 1)); + __m512i const data_key_hi = _mm512_srli_epi64 (data_key, 32); __m512i const prod_lo = _mm512_mul_epu32 (data_key, prime32); __m512i const prod_hi = _mm512_mul_epu32 (data_key_hi, prime32); *xacc = _mm512_add_epi64(prod_lo, _mm512_slli_epi64(prod_hi, 32)); @@ -3814,7 +4898,8 @@ XXH3_initCustomSecret_avx512(void* XXH_RESTRICT customSecret, xxh_u64 seed64) XXH_ASSERT(((size_t)customSecret & 63) == 0); (void)(&XXH_writeLE64); { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / sizeof(__m512i); - __m512i const seed = _mm512_mask_set1_epi64(_mm512_set1_epi64((xxh_i64)seed64), 0xAA, (xxh_i64)(0U - seed64)); + __m512i const seed_pos = _mm512_set1_epi64((xxh_i64)seed64); + __m512i const seed = _mm512_mask_sub_epi64(seed_pos, 0xAA, _mm512_set1_epi8(0), seed_pos); const __m512i* const src = (const __m512i*) ((const void*) XXH3_kSecret); __m512i* const dest = ( __m512i*) customSecret; @@ -3822,14 +4907,7 @@ XXH3_initCustomSecret_avx512(void* XXH_RESTRICT customSecret, xxh_u64 seed64) XXH_ASSERT(((size_t)src & 63) == 0); /* control alignment */ XXH_ASSERT(((size_t)dest & 63) == 0); for (i=0; i < nbRounds; ++i) { - /* GCC has a bug, _mm512_stream_load_si512 accepts 'void*', not 'void const*', - * this will warn "discards 'const' qualifier". */ - union { - const __m512i* cp; - void* p; - } remote_const_void; - remote_const_void.cp = src + i; - dest[i] = _mm512_add_epi64(_mm512_stream_load_si512(remote_const_void.p), seed); + dest[i] = _mm512_add_epi64(_mm512_load_si512(src + i), seed); } } } @@ -3865,7 +4943,7 @@ XXH3_accumulate_512_avx2( void* XXH_RESTRICT acc, /* data_key = data_vec ^ key_vec; */ __m256i const data_key = _mm256_xor_si256 (data_vec, key_vec); /* data_key_lo = data_key >> 32; */ - __m256i const data_key_lo = _mm256_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); + __m256i const data_key_lo = _mm256_srli_epi64 (data_key, 32); /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ __m256i const product = _mm256_mul_epu32 (data_key, data_key_lo); /* xacc[i] += swap(data_vec); */ @@ -3875,6 +4953,7 @@ XXH3_accumulate_512_avx2( void* XXH_RESTRICT acc, xacc[i] = _mm256_add_epi64(product, sum); } } } +XXH_FORCE_INLINE XXH_TARGET_AVX2 XXH3_ACCUMULATE_TEMPLATE(avx2) XXH_FORCE_INLINE XXH_TARGET_AVX2 void XXH3_scrambleAcc_avx2(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) @@ -3897,7 +4976,7 @@ XXH3_scrambleAcc_avx2(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) __m256i const data_key = _mm256_xor_si256 (data_vec, key_vec); /* xacc[i] *= XXH_PRIME32_1; */ - __m256i const data_key_hi = _mm256_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); + __m256i const data_key_hi = _mm256_srli_epi64 (data_key, 32); __m256i const prod_lo = _mm256_mul_epu32 (data_key, prime32); __m256i const prod_hi = _mm256_mul_epu32 (data_key_hi, prime32); xacc[i] = _mm256_add_epi64(prod_lo, _mm256_slli_epi64(prod_hi, 32)); @@ -3929,12 +5008,12 @@ XXH_FORCE_INLINE XXH_TARGET_AVX2 void XXH3_initCustomSecret_avx2(void* XXH_RESTR XXH_ASSERT(((size_t)dest & 31) == 0); /* GCC -O2 need unroll loop manually */ - dest[0] = _mm256_add_epi64(_mm256_stream_load_si256(src+0), seed); - dest[1] = _mm256_add_epi64(_mm256_stream_load_si256(src+1), seed); - dest[2] = _mm256_add_epi64(_mm256_stream_load_si256(src+2), seed); - dest[3] = _mm256_add_epi64(_mm256_stream_load_si256(src+3), seed); - dest[4] = _mm256_add_epi64(_mm256_stream_load_si256(src+4), seed); - dest[5] = _mm256_add_epi64(_mm256_stream_load_si256(src+5), seed); + dest[0] = _mm256_add_epi64(_mm256_load_si256(src+0), seed); + dest[1] = _mm256_add_epi64(_mm256_load_si256(src+1), seed); + dest[2] = _mm256_add_epi64(_mm256_load_si256(src+2), seed); + dest[3] = _mm256_add_epi64(_mm256_load_si256(src+3), seed); + dest[4] = _mm256_add_epi64(_mm256_load_si256(src+4), seed); + dest[5] = _mm256_add_epi64(_mm256_load_si256(src+5), seed); } } @@ -3981,6 +5060,7 @@ XXH3_accumulate_512_sse2( void* XXH_RESTRICT acc, xacc[i] = _mm_add_epi64(product, sum); } } } +XXH_FORCE_INLINE XXH_TARGET_SSE2 XXH3_ACCUMULATE_TEMPLATE(sse2) XXH_FORCE_INLINE XXH_TARGET_SSE2 void XXH3_scrambleAcc_sse2(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) @@ -4059,14 +5139,28 @@ XXH3_scalarScrambleRound(void* XXH_RESTRICT acc, /*! * @internal - * @brief The bulk processing loop for NEON. + * @brief The bulk processing loop for NEON and WASM SIMD128. * * The NEON code path is actually partially scalar when running on AArch64. This * is to optimize the pipelining and can have up to 15% speedup depending on the * CPU, and it also mitigates some GCC codegen issues. * * @see XXH3_NEON_LANES for configuring this and details about this optimization. + * + * NEON's 32-bit to 64-bit long multiply takes a half vector of 32-bit + * integers instead of the other platforms which mask full 64-bit vectors, + * so the setup is more complicated than just shifting right. + * + * Additionally, there is an optimization for 4 lanes at once noted below. + * + * Since, as stated, the most optimal amount of lanes for Cortexes is 6, + * there needs to be *three* versions of the accumulate operation used + * for the remaining 2 lanes. + * + * WASM's SIMD128 uses SIMDe's arm_neon.h polyfill because the intrinsics overlap + * nearly perfectly. */ + XXH_FORCE_INLINE void XXH3_accumulate_512_neon( void* XXH_RESTRICT acc, const void* XXH_RESTRICT input, @@ -4074,101 +5168,182 @@ XXH3_accumulate_512_neon( void* XXH_RESTRICT acc, { XXH_ASSERT((((size_t)acc) & 15) == 0); XXH_STATIC_ASSERT(XXH3_NEON_LANES > 0 && XXH3_NEON_LANES <= XXH_ACC_NB && XXH3_NEON_LANES % 2 == 0); - { - uint64x2_t* const xacc = (uint64x2_t *) acc; + { /* GCC for darwin arm64 does not like aliasing here */ + xxh_aliasing_uint64x2_t* const xacc = (xxh_aliasing_uint64x2_t*) acc; /* We don't use a uint32x4_t pointer because it causes bus errors on ARMv7. */ - uint8_t const* const xinput = (const uint8_t *) input; - uint8_t const* const xsecret = (const uint8_t *) secret; + uint8_t const* xinput = (const uint8_t *) input; + uint8_t const* xsecret = (const uint8_t *) secret; size_t i; - /* NEON for the first few lanes (these loops are normally interleaved) */ - for (i=0; i < XXH3_NEON_LANES / 2; i++) { - /* data_vec = xinput[i]; */ - uint8x16_t data_vec = vld1q_u8(xinput + (i * 16)); - /* key_vec = xsecret[i]; */ - uint8x16_t key_vec = vld1q_u8(xsecret + (i * 16)); - uint64x2_t data_key; - uint32x2_t data_key_lo, data_key_hi; - /* xacc[i] += swap(data_vec); */ - uint64x2_t const data64 = vreinterpretq_u64_u8(data_vec); - uint64x2_t const swapped = vextq_u64(data64, data64, 1); - xacc[i] = vaddq_u64 (xacc[i], swapped); - /* data_key = data_vec ^ key_vec; */ - data_key = vreinterpretq_u64_u8(veorq_u8(data_vec, key_vec)); - /* data_key_lo = (uint32x2_t) (data_key & 0xFFFFFFFF); - * data_key_hi = (uint32x2_t) (data_key >> 32); - * data_key = UNDEFINED; */ - XXH_SPLIT_IN_PLACE(data_key, data_key_lo, data_key_hi); - /* xacc[i] += (uint64x2_t) data_key_lo * (uint64x2_t) data_key_hi; */ - xacc[i] = vmlal_u32 (xacc[i], data_key_lo, data_key_hi); - - } - /* Scalar for the remainder. This may be a zero iteration loop. */ +#ifdef __wasm_simd128__ + /* + * On WASM SIMD128, Clang emits direct address loads when XXH3_kSecret + * is constant propagated, which results in it converting it to this + * inside the loop: + * + * a = v128.load(XXH3_kSecret + 0 + $secret_offset, offset = 0) + * b = v128.load(XXH3_kSecret + 16 + $secret_offset, offset = 0) + * ... + * + * This requires a full 32-bit address immediate (and therefore a 6 byte + * instruction) as well as an add for each offset. + * + * Putting an asm guard prevents it from folding (at the cost of losing + * the alignment hint), and uses the free offset in `v128.load` instead + * of adding secret_offset each time which overall reduces code size by + * about a kilobyte and improves performance. + */ + XXH_COMPILER_GUARD(xsecret); +#endif + /* Scalar lanes use the normal scalarRound routine */ for (i = XXH3_NEON_LANES; i < XXH_ACC_NB; i++) { XXH3_scalarRound(acc, input, secret, i); } + i = 0; + /* 4 NEON lanes at a time. */ + for (; i+1 < XXH3_NEON_LANES / 2; i+=2) { + /* data_vec = xinput[i]; */ + uint64x2_t data_vec_1 = XXH_vld1q_u64(xinput + (i * 16)); + uint64x2_t data_vec_2 = XXH_vld1q_u64(xinput + ((i+1) * 16)); + /* key_vec = xsecret[i]; */ + uint64x2_t key_vec_1 = XXH_vld1q_u64(xsecret + (i * 16)); + uint64x2_t key_vec_2 = XXH_vld1q_u64(xsecret + ((i+1) * 16)); + /* data_swap = swap(data_vec) */ + uint64x2_t data_swap_1 = vextq_u64(data_vec_1, data_vec_1, 1); + uint64x2_t data_swap_2 = vextq_u64(data_vec_2, data_vec_2, 1); + /* data_key = data_vec ^ key_vec; */ + uint64x2_t data_key_1 = veorq_u64(data_vec_1, key_vec_1); + uint64x2_t data_key_2 = veorq_u64(data_vec_2, key_vec_2); + + /* + * If we reinterpret the 64x2 vectors as 32x4 vectors, we can use a + * de-interleave operation for 4 lanes in 1 step with `vuzpq_u32` to + * get one vector with the low 32 bits of each lane, and one vector + * with the high 32 bits of each lane. + * + * The intrinsic returns a double vector because the original ARMv7-a + * instruction modified both arguments in place. AArch64 and SIMD128 emit + * two instructions from this intrinsic. + * + * [ dk11L | dk11H | dk12L | dk12H ] -> [ dk11L | dk12L | dk21L | dk22L ] + * [ dk21L | dk21H | dk22L | dk22H ] -> [ dk11H | dk12H | dk21H | dk22H ] + */ + uint32x4x2_t unzipped = vuzpq_u32( + vreinterpretq_u32_u64(data_key_1), + vreinterpretq_u32_u64(data_key_2) + ); + /* data_key_lo = data_key & 0xFFFFFFFF */ + uint32x4_t data_key_lo = unzipped.val[0]; + /* data_key_hi = data_key >> 32 */ + uint32x4_t data_key_hi = unzipped.val[1]; + /* + * Then, we can split the vectors horizontally and multiply which, as for most + * widening intrinsics, have a variant that works on both high half vectors + * for free on AArch64. A similar instruction is available on SIMD128. + * + * sum = data_swap + (u64x2) data_key_lo * (u64x2) data_key_hi + */ + uint64x2_t sum_1 = XXH_vmlal_low_u32(data_swap_1, data_key_lo, data_key_hi); + uint64x2_t sum_2 = XXH_vmlal_high_u32(data_swap_2, data_key_lo, data_key_hi); + /* + * Clang reorders + * a += b * c; // umlal swap.2d, dkl.2s, dkh.2s + * c += a; // add acc.2d, acc.2d, swap.2d + * to + * c += a; // add acc.2d, acc.2d, swap.2d + * c += b * c; // umlal acc.2d, dkl.2s, dkh.2s + * + * While it would make sense in theory since the addition is faster, + * for reasons likely related to umlal being limited to certain NEON + * pipelines, this is worse. A compiler guard fixes this. + */ + XXH_COMPILER_GUARD_CLANG_NEON(sum_1); + XXH_COMPILER_GUARD_CLANG_NEON(sum_2); + /* xacc[i] = acc_vec + sum; */ + xacc[i] = vaddq_u64(xacc[i], sum_1); + xacc[i+1] = vaddq_u64(xacc[i+1], sum_2); + } + /* Operate on the remaining NEON lanes 2 at a time. */ + for (; i < XXH3_NEON_LANES / 2; i++) { + /* data_vec = xinput[i]; */ + uint64x2_t data_vec = XXH_vld1q_u64(xinput + (i * 16)); + /* key_vec = xsecret[i]; */ + uint64x2_t key_vec = XXH_vld1q_u64(xsecret + (i * 16)); + /* acc_vec_2 = swap(data_vec) */ + uint64x2_t data_swap = vextq_u64(data_vec, data_vec, 1); + /* data_key = data_vec ^ key_vec; */ + uint64x2_t data_key = veorq_u64(data_vec, key_vec); + /* For two lanes, just use VMOVN and VSHRN. */ + /* data_key_lo = data_key & 0xFFFFFFFF; */ + uint32x2_t data_key_lo = vmovn_u64(data_key); + /* data_key_hi = data_key >> 32; */ + uint32x2_t data_key_hi = vshrn_n_u64(data_key, 32); + /* sum = data_swap + (u64x2) data_key_lo * (u64x2) data_key_hi; */ + uint64x2_t sum = vmlal_u32(data_swap, data_key_lo, data_key_hi); + /* Same Clang workaround as before */ + XXH_COMPILER_GUARD_CLANG_NEON(sum); + /* xacc[i] = acc_vec + sum; */ + xacc[i] = vaddq_u64 (xacc[i], sum); + } } } +XXH_FORCE_INLINE XXH3_ACCUMULATE_TEMPLATE(neon) XXH_FORCE_INLINE void XXH3_scrambleAcc_neon(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) { XXH_ASSERT((((size_t)acc) & 15) == 0); - { uint64x2_t* xacc = (uint64x2_t*) acc; + { xxh_aliasing_uint64x2_t* xacc = (xxh_aliasing_uint64x2_t*) acc; uint8_t const* xsecret = (uint8_t const*) secret; - uint32x2_t prime = vdup_n_u32 (XXH_PRIME32_1); size_t i; - /* NEON for the first few lanes (these loops are normally interleaved) */ - for (i=0; i < XXH3_NEON_LANES / 2; i++) { - /* xacc[i] ^= (xacc[i] >> 47); */ - uint64x2_t acc_vec = xacc[i]; - uint64x2_t shifted = vshrq_n_u64 (acc_vec, 47); - uint64x2_t data_vec = veorq_u64 (acc_vec, shifted); + /* WASM uses operator overloads and doesn't need these. */ +#ifndef __wasm_simd128__ + /* { prime32_1, prime32_1 } */ + uint32x2_t const kPrimeLo = vdup_n_u32(XXH_PRIME32_1); + /* { 0, prime32_1, 0, prime32_1 } */ + uint32x4_t const kPrimeHi = vreinterpretq_u32_u64(vdupq_n_u64((xxh_u64)XXH_PRIME32_1 << 32)); +#endif - /* xacc[i] ^= xsecret[i]; */ - uint8x16_t key_vec = vld1q_u8 (xsecret + (i * 16)); - uint64x2_t data_key = veorq_u64 (data_vec, vreinterpretq_u64_u8(key_vec)); - - /* xacc[i] *= XXH_PRIME32_1 */ - uint32x2_t data_key_lo, data_key_hi; - /* data_key_lo = (uint32x2_t) (xacc[i] & 0xFFFFFFFF); - * data_key_hi = (uint32x2_t) (xacc[i] >> 32); - * xacc[i] = UNDEFINED; */ - XXH_SPLIT_IN_PLACE(data_key, data_key_lo, data_key_hi); - { /* - * prod_hi = (data_key >> 32) * XXH_PRIME32_1; - * - * Avoid vmul_u32 + vshll_n_u32 since Clang 6 and 7 will - * incorrectly "optimize" this: - * tmp = vmul_u32(vmovn_u64(a), vmovn_u64(b)); - * shifted = vshll_n_u32(tmp, 32); - * to this: - * tmp = "vmulq_u64"(a, b); // no such thing! - * shifted = vshlq_n_u64(tmp, 32); - * - * However, unlike SSE, Clang lacks a 64-bit multiply routine - * for NEON, and it scalarizes two 64-bit multiplies instead. - * - * vmull_u32 has the same timing as vmul_u32, and it avoids - * this bug completely. - * See https://bugs.llvm.org/show_bug.cgi?id=39967 - */ - uint64x2_t prod_hi = vmull_u32 (data_key_hi, prime); - /* xacc[i] = prod_hi << 32; */ - xacc[i] = vshlq_n_u64(prod_hi, 32); - /* xacc[i] += (prod_hi & 0xFFFFFFFF) * XXH_PRIME32_1; */ - xacc[i] = vmlal_u32(xacc[i], data_key_lo, prime); - } - } - /* Scalar for the remainder. This may be a zero iteration loop. */ + /* AArch64 uses both scalar and neon at the same time */ for (i = XXH3_NEON_LANES; i < XXH_ACC_NB; i++) { XXH3_scalarScrambleRound(acc, secret, i); } + for (i=0; i < XXH3_NEON_LANES / 2; i++) { + /* xacc[i] ^= (xacc[i] >> 47); */ + uint64x2_t acc_vec = xacc[i]; + uint64x2_t shifted = vshrq_n_u64(acc_vec, 47); + uint64x2_t data_vec = veorq_u64(acc_vec, shifted); + + /* xacc[i] ^= xsecret[i]; */ + uint64x2_t key_vec = XXH_vld1q_u64(xsecret + (i * 16)); + uint64x2_t data_key = veorq_u64(data_vec, key_vec); + /* xacc[i] *= XXH_PRIME32_1 */ +#ifdef __wasm_simd128__ + /* SIMD128 has multiply by u64x2, use it instead of expanding and scalarizing */ + xacc[i] = data_key * XXH_PRIME32_1; +#else + /* + * Expanded version with portable NEON intrinsics + * + * lo(x) * lo(y) + (hi(x) * lo(y) << 32) + * + * prod_hi = hi(data_key) * lo(prime) << 32 + * + * Since we only need 32 bits of this multiply a trick can be used, reinterpreting the vector + * as a uint32x4_t and multiplying by { 0, prime, 0, prime } to cancel out the unwanted bits + * and avoid the shift. + */ + uint32x4_t prod_hi = vmulq_u32 (vreinterpretq_u32_u64(data_key), kPrimeHi); + /* Extract low bits for vmlal_u32 */ + uint32x2_t data_key_lo = vmovn_u64(data_key); + /* xacc[i] = prod_hi + lo(data_key) * XXH_PRIME32_1; */ + xacc[i] = vmlal_u32(vreinterpretq_u64_u32(prod_hi), data_key_lo, kPrimeLo); +#endif + } } } - #endif #if (XXH_VECTOR == XXH_VSX) @@ -4179,23 +5354,23 @@ XXH3_accumulate_512_vsx( void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) { /* presumed aligned */ - unsigned int* const xacc = (unsigned int*) acc; - xxh_u64x2 const* const xinput = (xxh_u64x2 const*) input; /* no alignment restriction */ - xxh_u64x2 const* const xsecret = (xxh_u64x2 const*) secret; /* no alignment restriction */ + xxh_aliasing_u64x2* const xacc = (xxh_aliasing_u64x2*) acc; + xxh_u8 const* const xinput = (xxh_u8 const*) input; /* no alignment restriction */ + xxh_u8 const* const xsecret = (xxh_u8 const*) secret; /* no alignment restriction */ xxh_u64x2 const v32 = { 32, 32 }; size_t i; for (i = 0; i < XXH_STRIPE_LEN / sizeof(xxh_u64x2); i++) { /* data_vec = xinput[i]; */ - xxh_u64x2 const data_vec = XXH_vec_loadu(xinput + i); + xxh_u64x2 const data_vec = XXH_vec_loadu(xinput + 16*i); /* key_vec = xsecret[i]; */ - xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + i); + xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + 16*i); xxh_u64x2 const data_key = data_vec ^ key_vec; /* shuffled = (data_key << 32) | (data_key >> 32); */ xxh_u32x4 const shuffled = (xxh_u32x4)vec_rl(data_key, v32); /* product = ((xxh_u64x2)data_key & 0xFFFFFFFF) * ((xxh_u64x2)shuffled & 0xFFFFFFFF); */ xxh_u64x2 const product = XXH_vec_mulo((xxh_u32x4)data_key, shuffled); /* acc_vec = xacc[i]; */ - xxh_u64x2 acc_vec = (xxh_u64x2)vec_xl(0, xacc + 4 * i); + xxh_u64x2 acc_vec = xacc[i]; acc_vec += product; /* swap high and low halves */ @@ -4204,18 +5379,18 @@ XXH3_accumulate_512_vsx( void* XXH_RESTRICT acc, #else acc_vec += vec_xxpermdi(data_vec, data_vec, 2); #endif - /* xacc[i] = acc_vec; */ - vec_xst((xxh_u32x4)acc_vec, 0, xacc + 4 * i); + xacc[i] = acc_vec; } } +XXH_FORCE_INLINE XXH3_ACCUMULATE_TEMPLATE(vsx) XXH_FORCE_INLINE void XXH3_scrambleAcc_vsx(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) { XXH_ASSERT((((size_t)acc) & 15) == 0); - { xxh_u64x2* const xacc = (xxh_u64x2*) acc; - const xxh_u64x2* const xsecret = (const xxh_u64x2*) secret; + { xxh_aliasing_u64x2* const xacc = (xxh_aliasing_u64x2*) acc; + const xxh_u8* const xsecret = (const xxh_u8*) secret; /* constants */ xxh_u64x2 const v32 = { 32, 32 }; xxh_u64x2 const v47 = { 47, 47 }; @@ -4227,7 +5402,7 @@ XXH3_scrambleAcc_vsx(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) xxh_u64x2 const data_vec = acc_vec ^ (acc_vec >> v47); /* xacc[i] ^= xsecret[i]; */ - xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + i); + xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + 16*i); xxh_u64x2 const data_key = data_vec ^ key_vec; /* xacc[i] *= XXH_PRIME32_1 */ @@ -4241,8 +5416,148 @@ XXH3_scrambleAcc_vsx(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) #endif +#if (XXH_VECTOR == XXH_SVE) + +XXH_FORCE_INLINE void +XXH3_accumulate_512_sve( void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + uint64_t *xacc = (uint64_t *)acc; + const uint64_t *xinput = (const uint64_t *)(const void *)input; + const uint64_t *xsecret = (const uint64_t *)(const void *)secret; + svuint64_t kSwap = sveor_n_u64_z(svptrue_b64(), svindex_u64(0, 1), 1); + uint64_t element_count = svcntd(); + if (element_count >= 8) { + svbool_t mask = svptrue_pat_b64(SV_VL8); + svuint64_t vacc = svld1_u64(mask, xacc); + ACCRND(vacc, 0); + svst1_u64(mask, xacc, vacc); + } else if (element_count == 2) { /* sve128 */ + svbool_t mask = svptrue_pat_b64(SV_VL2); + svuint64_t acc0 = svld1_u64(mask, xacc + 0); + svuint64_t acc1 = svld1_u64(mask, xacc + 2); + svuint64_t acc2 = svld1_u64(mask, xacc + 4); + svuint64_t acc3 = svld1_u64(mask, xacc + 6); + ACCRND(acc0, 0); + ACCRND(acc1, 2); + ACCRND(acc2, 4); + ACCRND(acc3, 6); + svst1_u64(mask, xacc + 0, acc0); + svst1_u64(mask, xacc + 2, acc1); + svst1_u64(mask, xacc + 4, acc2); + svst1_u64(mask, xacc + 6, acc3); + } else { + svbool_t mask = svptrue_pat_b64(SV_VL4); + svuint64_t acc0 = svld1_u64(mask, xacc + 0); + svuint64_t acc1 = svld1_u64(mask, xacc + 4); + ACCRND(acc0, 0); + ACCRND(acc1, 4); + svst1_u64(mask, xacc + 0, acc0); + svst1_u64(mask, xacc + 4, acc1); + } +} + +XXH_FORCE_INLINE void +XXH3_accumulate_sve(xxh_u64* XXH_RESTRICT acc, + const xxh_u8* XXH_RESTRICT input, + const xxh_u8* XXH_RESTRICT secret, + size_t nbStripes) +{ + if (nbStripes != 0) { + uint64_t *xacc = (uint64_t *)acc; + const uint64_t *xinput = (const uint64_t *)(const void *)input; + const uint64_t *xsecret = (const uint64_t *)(const void *)secret; + svuint64_t kSwap = sveor_n_u64_z(svptrue_b64(), svindex_u64(0, 1), 1); + uint64_t element_count = svcntd(); + if (element_count >= 8) { + svbool_t mask = svptrue_pat_b64(SV_VL8); + svuint64_t vacc = svld1_u64(mask, xacc + 0); + do { + /* svprfd(svbool_t, void *, enum svfprop); */ + svprfd(mask, xinput + 128, SV_PLDL1STRM); + ACCRND(vacc, 0); + xinput += 8; + xsecret += 1; + nbStripes--; + } while (nbStripes != 0); + + svst1_u64(mask, xacc + 0, vacc); + } else if (element_count == 2) { /* sve128 */ + svbool_t mask = svptrue_pat_b64(SV_VL2); + svuint64_t acc0 = svld1_u64(mask, xacc + 0); + svuint64_t acc1 = svld1_u64(mask, xacc + 2); + svuint64_t acc2 = svld1_u64(mask, xacc + 4); + svuint64_t acc3 = svld1_u64(mask, xacc + 6); + do { + svprfd(mask, xinput + 128, SV_PLDL1STRM); + ACCRND(acc0, 0); + ACCRND(acc1, 2); + ACCRND(acc2, 4); + ACCRND(acc3, 6); + xinput += 8; + xsecret += 1; + nbStripes--; + } while (nbStripes != 0); + + svst1_u64(mask, xacc + 0, acc0); + svst1_u64(mask, xacc + 2, acc1); + svst1_u64(mask, xacc + 4, acc2); + svst1_u64(mask, xacc + 6, acc3); + } else { + svbool_t mask = svptrue_pat_b64(SV_VL4); + svuint64_t acc0 = svld1_u64(mask, xacc + 0); + svuint64_t acc1 = svld1_u64(mask, xacc + 4); + do { + svprfd(mask, xinput + 128, SV_PLDL1STRM); + ACCRND(acc0, 0); + ACCRND(acc1, 4); + xinput += 8; + xsecret += 1; + nbStripes--; + } while (nbStripes != 0); + + svst1_u64(mask, xacc + 0, acc0); + svst1_u64(mask, xacc + 4, acc1); + } + } +} + +#endif + /* scalar variants - universal */ +#if defined(__aarch64__) && (defined(__GNUC__) || defined(__clang__)) +/* + * In XXH3_scalarRound(), GCC and Clang have a similar codegen issue, where they + * emit an excess mask and a full 64-bit multiply-add (MADD X-form). + * + * While this might not seem like much, as AArch64 is a 64-bit architecture, only + * big Cortex designs have a full 64-bit multiplier. + * + * On the little cores, the smaller 32-bit multiplier is used, and full 64-bit + * multiplies expand to 2-3 multiplies in microcode. This has a major penalty + * of up to 4 latency cycles and 2 stall cycles in the multiply pipeline. + * + * Thankfully, AArch64 still provides the 32-bit long multiply-add (UMADDL) which does + * not have this penalty and does the mask automatically. + */ +XXH_FORCE_INLINE xxh_u64 +XXH_mult32to64_add64(xxh_u64 lhs, xxh_u64 rhs, xxh_u64 acc) +{ + xxh_u64 ret; + /* note: %x = 64-bit register, %w = 32-bit register */ + __asm__("umaddl %x0, %w1, %w2, %x3" : "=r" (ret) : "r" (lhs), "r" (rhs), "r" (acc)); + return ret; +} +#else +XXH_FORCE_INLINE xxh_u64 +XXH_mult32to64_add64(xxh_u64 lhs, xxh_u64 rhs, xxh_u64 acc) +{ + return XXH_mult32to64((xxh_u32)lhs, (xxh_u32)rhs) + acc; +} +#endif + /*! * @internal * @brief Scalar round for @ref XXH3_accumulate_512_scalar(). @@ -4265,7 +5580,7 @@ XXH3_scalarRound(void* XXH_RESTRICT acc, xxh_u64 const data_val = XXH_readLE64(xinput + lane * 8); xxh_u64 const data_key = data_val ^ XXH_readLE64(xsecret + lane * 8); xacc[lane ^ 1] += data_val; /* swap adjacent lanes */ - xacc[lane] += XXH_mult32to64(data_key & 0xFFFFFFFF, data_key >> 32); + xacc[lane] = XXH_mult32to64_add64(data_key /* & 0xFFFFFFFF */, data_key >> 32, xacc[lane]); } } @@ -4279,10 +5594,18 @@ XXH3_accumulate_512_scalar(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) { size_t i; + /* ARM GCC refuses to unroll this loop, resulting in a 24% slowdown on ARMv6. */ +#if defined(__GNUC__) && !defined(__clang__) \ + && (defined(__arm__) || defined(__thumb2__)) \ + && defined(__ARM_FEATURE_UNALIGNED) /* no unaligned access just wastes bytes */ \ + && XXH_SIZE_OPT <= 0 +# pragma GCC unroll 8 +#endif for (i=0; i < XXH_ACC_NB; i++) { XXH3_scalarRound(acc, input, secret, i); } } +XXH_FORCE_INLINE XXH3_ACCUMULATE_TEMPLATE(scalar) /*! * @internal @@ -4334,10 +5657,10 @@ XXH3_initCustomSecret_scalar(void* XXH_RESTRICT customSecret, xxh_u64 seed64) const xxh_u8* kSecretPtr = XXH3_kSecret; XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 15) == 0); -#if defined(__clang__) && defined(__aarch64__) +#if defined(__GNUC__) && defined(__aarch64__) /* * UGLY HACK: - * Clang generates a bunch of MOV/MOVK pairs for aarch64, and they are + * GCC and Clang generate a bunch of MOV/MOVK pairs for aarch64, and they are * placed sequentially, in order, at the top of the unrolled loop. * * While MOVK is great for generating constants (2 cycles for a 64-bit @@ -4352,7 +5675,7 @@ XXH3_initCustomSecret_scalar(void* XXH_RESTRICT customSecret, xxh_u64 seed64) * ADD * SUB STR * STR - * By forcing loads from memory (as the asm line causes Clang to assume + * By forcing loads from memory (as the asm line causes the compiler to assume * that XXH3_kSecretPtr has been changed), the pipelines are used more * efficiently: * I L S @@ -4369,17 +5692,11 @@ XXH3_initCustomSecret_scalar(void* XXH_RESTRICT customSecret, xxh_u64 seed64) */ XXH_COMPILER_GUARD(kSecretPtr); #endif - /* - * Note: in debug mode, this overrides the asm optimization - * and Clang will emit MOVK chains again. - */ - XXH_ASSERT(kSecretPtr == XXH3_kSecret); - { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / 16; int i; for (i=0; i < nbRounds; i++) { /* - * The asm hack causes Clang to assume that kSecretPtr aliases with + * The asm hack causes the compiler to assume that kSecretPtr aliases with * customSecret, and on aarch64, this prevented LDP from merging two * loads together for free. Putting the loads together before the stores * properly generates LDP. @@ -4392,7 +5709,7 @@ XXH3_initCustomSecret_scalar(void* XXH_RESTRICT customSecret, xxh_u64 seed64) } -typedef void (*XXH3_f_accumulate_512)(void* XXH_RESTRICT, const void*, const void*); +typedef void (*XXH3_f_accumulate)(xxh_u64* XXH_RESTRICT, const xxh_u8* XXH_RESTRICT, const xxh_u8* XXH_RESTRICT, size_t); typedef void (*XXH3_f_scrambleAcc)(void* XXH_RESTRICT, const void*); typedef void (*XXH3_f_initCustomSecret)(void* XXH_RESTRICT, xxh_u64); @@ -4400,82 +5717,63 @@ typedef void (*XXH3_f_initCustomSecret)(void* XXH_RESTRICT, xxh_u64); #if (XXH_VECTOR == XXH_AVX512) #define XXH3_accumulate_512 XXH3_accumulate_512_avx512 +#define XXH3_accumulate XXH3_accumulate_avx512 #define XXH3_scrambleAcc XXH3_scrambleAcc_avx512 #define XXH3_initCustomSecret XXH3_initCustomSecret_avx512 #elif (XXH_VECTOR == XXH_AVX2) #define XXH3_accumulate_512 XXH3_accumulate_512_avx2 +#define XXH3_accumulate XXH3_accumulate_avx2 #define XXH3_scrambleAcc XXH3_scrambleAcc_avx2 #define XXH3_initCustomSecret XXH3_initCustomSecret_avx2 #elif (XXH_VECTOR == XXH_SSE2) #define XXH3_accumulate_512 XXH3_accumulate_512_sse2 +#define XXH3_accumulate XXH3_accumulate_sse2 #define XXH3_scrambleAcc XXH3_scrambleAcc_sse2 #define XXH3_initCustomSecret XXH3_initCustomSecret_sse2 #elif (XXH_VECTOR == XXH_NEON) #define XXH3_accumulate_512 XXH3_accumulate_512_neon +#define XXH3_accumulate XXH3_accumulate_neon #define XXH3_scrambleAcc XXH3_scrambleAcc_neon #define XXH3_initCustomSecret XXH3_initCustomSecret_scalar #elif (XXH_VECTOR == XXH_VSX) #define XXH3_accumulate_512 XXH3_accumulate_512_vsx +#define XXH3_accumulate XXH3_accumulate_vsx #define XXH3_scrambleAcc XXH3_scrambleAcc_vsx #define XXH3_initCustomSecret XXH3_initCustomSecret_scalar +#elif (XXH_VECTOR == XXH_SVE) +#define XXH3_accumulate_512 XXH3_accumulate_512_sve +#define XXH3_accumulate XXH3_accumulate_sve +#define XXH3_scrambleAcc XXH3_scrambleAcc_scalar +#define XXH3_initCustomSecret XXH3_initCustomSecret_scalar + #else /* scalar */ #define XXH3_accumulate_512 XXH3_accumulate_512_scalar +#define XXH3_accumulate XXH3_accumulate_scalar #define XXH3_scrambleAcc XXH3_scrambleAcc_scalar #define XXH3_initCustomSecret XXH3_initCustomSecret_scalar #endif - - -#ifndef XXH_PREFETCH_DIST -# ifdef __clang__ -# define XXH_PREFETCH_DIST 320 -# else -# if (XXH_VECTOR == XXH_AVX512) -# define XXH_PREFETCH_DIST 512 -# else -# define XXH_PREFETCH_DIST 384 -# endif -# endif /* __clang__ */ -#endif /* XXH_PREFETCH_DIST */ - -/* - * XXH3_accumulate() - * Loops over XXH3_accumulate_512(). - * Assumption: nbStripes will not overflow the secret size - */ -XXH_FORCE_INLINE void -XXH3_accumulate( xxh_u64* XXH_RESTRICT acc, - const xxh_u8* XXH_RESTRICT input, - const xxh_u8* XXH_RESTRICT secret, - size_t nbStripes, - XXH3_f_accumulate_512 f_acc512) -{ - size_t n; - for (n = 0; n < nbStripes; n++ ) { - const xxh_u8* const in = input + n*XXH_STRIPE_LEN; - XXH_PREFETCH(in + XXH_PREFETCH_DIST); - f_acc512(acc, - in, - secret + n*XXH_SECRET_CONSUME_RATE); - } -} +#if XXH_SIZE_OPT >= 1 /* don't do SIMD for initialization */ +# undef XXH3_initCustomSecret +# define XXH3_initCustomSecret XXH3_initCustomSecret_scalar +#endif XXH_FORCE_INLINE void XXH3_hashLong_internal_loop(xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, - XXH3_f_accumulate_512 f_acc512, + XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble) { size_t const nbStripesPerBlock = (secretSize - XXH_STRIPE_LEN) / XXH_SECRET_CONSUME_RATE; @@ -4487,7 +5785,7 @@ XXH3_hashLong_internal_loop(xxh_u64* XXH_RESTRICT acc, XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); for (n = 0; n < nb_blocks; n++) { - XXH3_accumulate(acc, input + n*block_len, secret, nbStripesPerBlock, f_acc512); + f_acc(acc, input + n*block_len, secret, nbStripesPerBlock); f_scramble(acc, secret + secretSize - XXH_STRIPE_LEN); } @@ -4495,12 +5793,12 @@ XXH3_hashLong_internal_loop(xxh_u64* XXH_RESTRICT acc, XXH_ASSERT(len > XXH_STRIPE_LEN); { size_t const nbStripes = ((len - 1) - (block_len * nb_blocks)) / XXH_STRIPE_LEN; XXH_ASSERT(nbStripes <= (secretSize / XXH_SECRET_CONSUME_RATE)); - XXH3_accumulate(acc, input + nb_blocks*block_len, secret, nbStripes, f_acc512); + f_acc(acc, input + nb_blocks*block_len, secret, nbStripes); /* last stripe */ { const xxh_u8* const p = input + len - XXH_STRIPE_LEN; #define XXH_SECRET_LASTACC_START 7 /* not aligned on 8, last secret is different from acc & scrambler */ - f_acc512(acc, p, secret + secretSize - XXH_STRIPE_LEN - XXH_SECRET_LASTACC_START); + XXH3_accumulate_512(acc, p, secret + secretSize - XXH_STRIPE_LEN - XXH_SECRET_LASTACC_START); } } } @@ -4545,12 +5843,12 @@ XXH3_mergeAccs(const xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT secre XXH_FORCE_INLINE XXH64_hash_t XXH3_hashLong_64b_internal(const void* XXH_RESTRICT input, size_t len, const void* XXH_RESTRICT secret, size_t secretSize, - XXH3_f_accumulate_512 f_acc512, + XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble) { XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[XXH_ACC_NB] = XXH3_INIT_ACC; - XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, (const xxh_u8*)secret, secretSize, f_acc512, f_scramble); + XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, (const xxh_u8*)secret, secretSize, f_acc, f_scramble); /* converge into final hash */ XXH_STATIC_ASSERT(sizeof(acc) == 64); @@ -4564,13 +5862,15 @@ XXH3_hashLong_64b_internal(const void* XXH_RESTRICT input, size_t len, * It's important for performance to transmit secret's size (when it's static) * so that the compiler can properly optimize the vectorized loop. * This makes a big performance difference for "medium" keys (<1 KB) when using AVX instruction set. + * When the secret size is unknown, or on GCC 12 where the mix of NO_INLINE and FORCE_INLINE + * breaks -Og, this is XXH_NO_INLINE. */ -XXH_FORCE_INLINE XXH64_hash_t +XXH3_WITH_SECRET_INLINE XXH64_hash_t XXH3_hashLong_64b_withSecret(const void* XXH_RESTRICT input, size_t len, XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) { (void)seed64; - return XXH3_hashLong_64b_internal(input, len, secret, secretLen, XXH3_accumulate_512, XXH3_scrambleAcc); + return XXH3_hashLong_64b_internal(input, len, secret, secretLen, XXH3_accumulate, XXH3_scrambleAcc); } /* @@ -4579,12 +5879,12 @@ XXH3_hashLong_64b_withSecret(const void* XXH_RESTRICT input, size_t len, * Note that inside this no_inline function, we do inline the internal loop, * and provide a statically defined secret size to allow optimization of vector loop. */ -XXH_NO_INLINE XXH64_hash_t +XXH_NO_INLINE XXH_PUREF XXH64_hash_t XXH3_hashLong_64b_default(const void* XXH_RESTRICT input, size_t len, XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) { (void)seed64; (void)secret; (void)secretLen; - return XXH3_hashLong_64b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_accumulate_512, XXH3_scrambleAcc); + return XXH3_hashLong_64b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_accumulate, XXH3_scrambleAcc); } /* @@ -4601,18 +5901,20 @@ XXH3_hashLong_64b_default(const void* XXH_RESTRICT input, size_t len, XXH_FORCE_INLINE XXH64_hash_t XXH3_hashLong_64b_withSeed_internal(const void* input, size_t len, XXH64_hash_t seed, - XXH3_f_accumulate_512 f_acc512, + XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble, XXH3_f_initCustomSecret f_initSec) { +#if XXH_SIZE_OPT <= 0 if (seed == 0) return XXH3_hashLong_64b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), - f_acc512, f_scramble); + f_acc, f_scramble); +#endif { XXH_ALIGN(XXH_SEC_ALIGN) xxh_u8 secret[XXH_SECRET_DEFAULT_SIZE]; f_initSec(secret, seed); return XXH3_hashLong_64b_internal(input, len, secret, sizeof(secret), - f_acc512, f_scramble); + f_acc, f_scramble); } } @@ -4620,12 +5922,12 @@ XXH3_hashLong_64b_withSeed_internal(const void* input, size_t len, * It's important for performance that XXH3_hashLong is not inlined. */ XXH_NO_INLINE XXH64_hash_t -XXH3_hashLong_64b_withSeed(const void* input, size_t len, - XXH64_hash_t seed, const xxh_u8* secret, size_t secretLen) +XXH3_hashLong_64b_withSeed(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) { (void)secret; (void)secretLen; return XXH3_hashLong_64b_withSeed_internal(input, len, seed, - XXH3_accumulate_512, XXH3_scrambleAcc, XXH3_initCustomSecret); + XXH3_accumulate, XXH3_scrambleAcc, XXH3_initCustomSecret); } @@ -4657,37 +5959,37 @@ XXH3_64bits_internal(const void* XXH_RESTRICT input, size_t len, /* === Public entry point === */ -/*! @ingroup xxh3_family */ -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits(const void* input, size_t len) +/*! @ingroup XXH3_family */ +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits(XXH_NOESCAPE const void* input, size_t length) { - return XXH3_64bits_internal(input, len, 0, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_default); + return XXH3_64bits_internal(input, length, 0, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_default); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH64_hash_t -XXH3_64bits_withSecret(const void* input, size_t len, const void* secret, size_t secretSize) +XXH3_64bits_withSecret(XXH_NOESCAPE const void* input, size_t length, XXH_NOESCAPE const void* secret, size_t secretSize) { - return XXH3_64bits_internal(input, len, 0, secret, secretSize, XXH3_hashLong_64b_withSecret); + return XXH3_64bits_internal(input, length, 0, secret, secretSize, XXH3_hashLong_64b_withSecret); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH64_hash_t -XXH3_64bits_withSeed(const void* input, size_t len, XXH64_hash_t seed) +XXH3_64bits_withSeed(XXH_NOESCAPE const void* input, size_t length, XXH64_hash_t seed) { - return XXH3_64bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_withSeed); + return XXH3_64bits_internal(input, length, seed, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_withSeed); } XXH_PUBLIC_API XXH64_hash_t -XXH3_64bits_withSecretandSeed(const void* input, size_t len, const void* secret, size_t secretSize, XXH64_hash_t seed) +XXH3_64bits_withSecretandSeed(XXH_NOESCAPE const void* input, size_t length, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed) { - if (len <= XXH3_MIDSIZE_MAX) - return XXH3_64bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), NULL); - return XXH3_hashLong_64b_withSecret(input, len, seed, (const xxh_u8*)secret, secretSize); + if (length <= XXH3_MIDSIZE_MAX) + return XXH3_64bits_internal(input, length, seed, XXH3_kSecret, sizeof(XXH3_kSecret), NULL); + return XXH3_hashLong_64b_withSecret(input, length, seed, (const xxh_u8*)secret, secretSize); } /* === XXH3 streaming === */ - +#ifndef XXH_NO_STREAM /* * Malloc's a pointer that is always aligned to align. * @@ -4711,7 +6013,7 @@ XXH3_64bits_withSecretandSeed(const void* input, size_t len, const void* secret, * * Align must be a power of 2 and 8 <= align <= 128. */ -static void* XXH_alignedMalloc(size_t s, size_t align) +static XXH_MALLOCF void* XXH_alignedMalloc(size_t s, size_t align) { XXH_ASSERT(align <= 128 && align >= 8); /* range check */ XXH_ASSERT((align & (align-1)) == 0); /* power of 2 */ @@ -4753,7 +6055,15 @@ static void XXH_alignedFree(void* p) XXH_free(base); } } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ +/*! + * @brief Allocate an @ref XXH3_state_t. + * + * @return An allocated pointer of @ref XXH3_state_t on success. + * @return `NULL` on failure. + * + * @note Must be freed with XXH3_freeState(). + */ XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void) { XXH3_state_t* const state = (XXH3_state_t*)XXH_alignedMalloc(sizeof(XXH3_state_t), 64); @@ -4762,16 +6072,25 @@ XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void) return state; } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ +/*! + * @brief Frees an @ref XXH3_state_t. + * + * @param statePtr A pointer to an @ref XXH3_state_t allocated with @ref XXH3_createState(). + * + * @return @ref XXH_OK. + * + * @note Must be allocated with XXH3_createState(). + */ XXH_PUBLIC_API XXH_errorcode XXH3_freeState(XXH3_state_t* statePtr) { XXH_alignedFree(statePtr); return XXH_OK; } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API void -XXH3_copyState(XXH3_state_t* dst_state, const XXH3_state_t* src_state) +XXH3_copyState(XXH_NOESCAPE XXH3_state_t* dst_state, XXH_NOESCAPE const XXH3_state_t* src_state) { XXH_memcpy(dst_state, src_state, sizeof(*dst_state)); } @@ -4803,18 +6122,18 @@ XXH3_reset_internal(XXH3_state_t* statePtr, statePtr->nbStripesPerBlock = statePtr->secretLimit / XXH_SECRET_CONSUME_RATE; } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_64bits_reset(XXH3_state_t* statePtr) +XXH3_64bits_reset(XXH_NOESCAPE XXH3_state_t* statePtr) { if (statePtr == NULL) return XXH_ERROR; XXH3_reset_internal(statePtr, 0, XXH3_kSecret, XXH_SECRET_DEFAULT_SIZE); return XXH_OK; } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_64bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize) +XXH3_64bits_reset_withSecret(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize) { if (statePtr == NULL) return XXH_ERROR; XXH3_reset_internal(statePtr, 0, secret, secretSize); @@ -4823,9 +6142,9 @@ XXH3_64bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t return XXH_OK; } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_64bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed) +XXH3_64bits_reset_withSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH64_hash_t seed) { if (statePtr == NULL) return XXH_ERROR; if (seed==0) return XXH3_64bits_reset(statePtr); @@ -4835,9 +6154,9 @@ XXH3_64bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed) return XXH_OK; } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_64bits_reset_withSecretandSeed(XXH3_state_t* statePtr, const void* secret, size_t secretSize, XXH64_hash_t seed64) +XXH3_64bits_reset_withSecretandSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed64) { if (statePtr == NULL) return XXH_ERROR; if (secret == NULL) return XXH_ERROR; @@ -4847,35 +6166,61 @@ XXH3_64bits_reset_withSecretandSeed(XXH3_state_t* statePtr, const void* secret, return XXH_OK; } -/* Note : when XXH3_consumeStripes() is invoked, - * there must be a guarantee that at least one more byte must be consumed from input - * so that the function can blindly consume all stripes using the "normal" secret segment */ -XXH_FORCE_INLINE void +/*! + * @internal + * @brief Processes a large input for XXH3_update() and XXH3_digest_long(). + * + * Unlike XXH3_hashLong_internal_loop(), this can process data that overlaps a block. + * + * @param acc Pointer to the 8 accumulator lanes + * @param nbStripesSoFarPtr In/out pointer to the number of leftover stripes in the block* + * @param nbStripesPerBlock Number of stripes in a block + * @param input Input pointer + * @param nbStripes Number of stripes to process + * @param secret Secret pointer + * @param secretLimit Offset of the last block in @p secret + * @param f_acc Pointer to an XXH3_accumulate implementation + * @param f_scramble Pointer to an XXH3_scrambleAcc implementation + * @return Pointer past the end of @p input after processing + */ +XXH_FORCE_INLINE const xxh_u8 * XXH3_consumeStripes(xxh_u64* XXH_RESTRICT acc, size_t* XXH_RESTRICT nbStripesSoFarPtr, size_t nbStripesPerBlock, const xxh_u8* XXH_RESTRICT input, size_t nbStripes, const xxh_u8* XXH_RESTRICT secret, size_t secretLimit, - XXH3_f_accumulate_512 f_acc512, + XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble) { - XXH_ASSERT(nbStripes <= nbStripesPerBlock); /* can handle max 1 scramble per invocation */ - XXH_ASSERT(*nbStripesSoFarPtr < nbStripesPerBlock); - if (nbStripesPerBlock - *nbStripesSoFarPtr <= nbStripes) { - /* need a scrambling operation */ - size_t const nbStripesToEndofBlock = nbStripesPerBlock - *nbStripesSoFarPtr; - size_t const nbStripesAfterBlock = nbStripes - nbStripesToEndofBlock; - XXH3_accumulate(acc, input, secret + nbStripesSoFarPtr[0] * XXH_SECRET_CONSUME_RATE, nbStripesToEndofBlock, f_acc512); - f_scramble(acc, secret + secretLimit); - XXH3_accumulate(acc, input + nbStripesToEndofBlock * XXH_STRIPE_LEN, secret, nbStripesAfterBlock, f_acc512); - *nbStripesSoFarPtr = nbStripesAfterBlock; - } else { - XXH3_accumulate(acc, input, secret + nbStripesSoFarPtr[0] * XXH_SECRET_CONSUME_RATE, nbStripes, f_acc512); + const xxh_u8* initialSecret = secret + *nbStripesSoFarPtr * XXH_SECRET_CONSUME_RATE; + /* Process full blocks */ + if (nbStripes >= (nbStripesPerBlock - *nbStripesSoFarPtr)) { + /* Process the initial partial block... */ + size_t nbStripesThisIter = nbStripesPerBlock - *nbStripesSoFarPtr; + + do { + /* Accumulate and scramble */ + f_acc(acc, input, initialSecret, nbStripesThisIter); + f_scramble(acc, secret + secretLimit); + input += nbStripesThisIter * XXH_STRIPE_LEN; + nbStripes -= nbStripesThisIter; + /* Then continue the loop with the full block size */ + nbStripesThisIter = nbStripesPerBlock; + initialSecret = secret; + } while (nbStripes >= nbStripesPerBlock); + *nbStripesSoFarPtr = 0; + } + /* Process a partial block */ + if (nbStripes > 0) { + f_acc(acc, input, initialSecret, nbStripes); + input += nbStripes * XXH_STRIPE_LEN; *nbStripesSoFarPtr += nbStripes; } + /* Return end pointer */ + return input; } #ifndef XXH3_STREAM_USE_STACK -# ifndef __clang__ /* clang doesn't need additional stack space */ +# if XXH_SIZE_OPT <= 0 && !defined(__clang__) /* clang doesn't need additional stack space */ # define XXH3_STREAM_USE_STACK 1 # endif #endif @@ -4885,7 +6230,7 @@ XXH3_consumeStripes(xxh_u64* XXH_RESTRICT acc, XXH_FORCE_INLINE XXH_errorcode XXH3_update(XXH3_state_t* XXH_RESTRICT const state, const xxh_u8* XXH_RESTRICT input, size_t len, - XXH3_f_accumulate_512 f_acc512, + XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble) { if (input==NULL) { @@ -4901,7 +6246,8 @@ XXH3_update(XXH3_state_t* XXH_RESTRICT const state, * when operating accumulators directly into state. * Operating into stack space seems to enable proper optimization. * clang, on the other hand, doesn't seem to need this trick */ - XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[8]; memcpy(acc, state->acc, sizeof(acc)); + XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[8]; + XXH_memcpy(acc, state->acc, sizeof(acc)); #else xxh_u64* XXH_RESTRICT const acc = state->acc; #endif @@ -4909,7 +6255,7 @@ XXH3_update(XXH3_state_t* XXH_RESTRICT const state, XXH_ASSERT(state->bufferedSize <= XXH3_INTERNALBUFFER_SIZE); /* small input : just fill in tmp buffer */ - if (state->bufferedSize + len <= XXH3_INTERNALBUFFER_SIZE) { + if (len <= XXH3_INTERNALBUFFER_SIZE - state->bufferedSize) { XXH_memcpy(state->buffer + state->bufferedSize, input, len); state->bufferedSize += (XXH32_hash_t)len; return XXH_OK; @@ -4931,57 +6277,20 @@ XXH3_update(XXH3_state_t* XXH_RESTRICT const state, &state->nbStripesSoFar, state->nbStripesPerBlock, state->buffer, XXH3_INTERNALBUFFER_STRIPES, secret, state->secretLimit, - f_acc512, f_scramble); + f_acc, f_scramble); state->bufferedSize = 0; } XXH_ASSERT(input < bEnd); - - /* large input to consume : ingest per full block */ - if ((size_t)(bEnd - input) > state->nbStripesPerBlock * XXH_STRIPE_LEN) { + if (bEnd - input > XXH3_INTERNALBUFFER_SIZE) { size_t nbStripes = (size_t)(bEnd - 1 - input) / XXH_STRIPE_LEN; - XXH_ASSERT(state->nbStripesPerBlock >= state->nbStripesSoFar); - /* join to current block's end */ - { size_t const nbStripesToEnd = state->nbStripesPerBlock - state->nbStripesSoFar; - XXH_ASSERT(nbStripesToEnd <= nbStripes); - XXH3_accumulate(acc, input, secret + state->nbStripesSoFar * XXH_SECRET_CONSUME_RATE, nbStripesToEnd, f_acc512); - f_scramble(acc, secret + state->secretLimit); - state->nbStripesSoFar = 0; - input += nbStripesToEnd * XXH_STRIPE_LEN; - nbStripes -= nbStripesToEnd; - } - /* consume per entire blocks */ - while(nbStripes >= state->nbStripesPerBlock) { - XXH3_accumulate(acc, input, secret, state->nbStripesPerBlock, f_acc512); - f_scramble(acc, secret + state->secretLimit); - input += state->nbStripesPerBlock * XXH_STRIPE_LEN; - nbStripes -= state->nbStripesPerBlock; - } - /* consume last partial block */ - XXH3_accumulate(acc, input, secret, nbStripes, f_acc512); - input += nbStripes * XXH_STRIPE_LEN; - XXH_ASSERT(input < bEnd); /* at least some bytes left */ - state->nbStripesSoFar = nbStripes; - /* buffer predecessor of last partial stripe */ - XXH_memcpy(state->buffer + sizeof(state->buffer) - XXH_STRIPE_LEN, input - XXH_STRIPE_LEN, XXH_STRIPE_LEN); - XXH_ASSERT(bEnd - input <= XXH_STRIPE_LEN); - } else { - /* content to consume <= block size */ - /* Consume input by a multiple of internal buffer size */ - if (bEnd - input > XXH3_INTERNALBUFFER_SIZE) { - const xxh_u8* const limit = bEnd - XXH3_INTERNALBUFFER_SIZE; - do { - XXH3_consumeStripes(acc, + input = XXH3_consumeStripes(acc, &state->nbStripesSoFar, state->nbStripesPerBlock, - input, XXH3_INTERNALBUFFER_STRIPES, - secret, state->secretLimit, - f_acc512, f_scramble); - input += XXH3_INTERNALBUFFER_SIZE; - } while (inputbuffer + sizeof(state->buffer) - XXH_STRIPE_LEN, input - XXH_STRIPE_LEN, XXH_STRIPE_LEN); - } - } + input, nbStripes, + secret, state->secretLimit, + f_acc, f_scramble); + XXH_memcpy(state->buffer + sizeof(state->buffer) - XXH_STRIPE_LEN, input - XXH_STRIPE_LEN, XXH_STRIPE_LEN); + } /* Some remaining input (always) : buffer it */ XXH_ASSERT(input < bEnd); XXH_ASSERT(bEnd - input <= XXH3_INTERNALBUFFER_SIZE); @@ -4990,19 +6299,19 @@ XXH3_update(XXH3_state_t* XXH_RESTRICT const state, state->bufferedSize = (XXH32_hash_t)(bEnd-input); #if defined(XXH3_STREAM_USE_STACK) && XXH3_STREAM_USE_STACK >= 1 /* save stack accumulators into state */ - memcpy(state->acc, acc, sizeof(acc)); + XXH_memcpy(state->acc, acc, sizeof(acc)); #endif } return XXH_OK; } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_64bits_update(XXH3_state_t* state, const void* input, size_t len) +XXH3_64bits_update(XXH_NOESCAPE XXH3_state_t* state, XXH_NOESCAPE const void* input, size_t len) { return XXH3_update(state, (const xxh_u8*)input, len, - XXH3_accumulate_512, XXH3_scrambleAcc); + XXH3_accumulate, XXH3_scrambleAcc); } @@ -5011,37 +6320,40 @@ XXH3_digest_long (XXH64_hash_t* acc, const XXH3_state_t* state, const unsigned char* secret) { + xxh_u8 lastStripe[XXH_STRIPE_LEN]; + const xxh_u8* lastStripePtr; + /* * Digest on a local copy. This way, the state remains unaltered, and it can * continue ingesting more input afterwards. */ XXH_memcpy(acc, state->acc, sizeof(state->acc)); if (state->bufferedSize >= XXH_STRIPE_LEN) { + /* Consume remaining stripes then point to remaining data in buffer */ size_t const nbStripes = (state->bufferedSize - 1) / XXH_STRIPE_LEN; size_t nbStripesSoFar = state->nbStripesSoFar; XXH3_consumeStripes(acc, &nbStripesSoFar, state->nbStripesPerBlock, state->buffer, nbStripes, secret, state->secretLimit, - XXH3_accumulate_512, XXH3_scrambleAcc); - /* last stripe */ - XXH3_accumulate_512(acc, - state->buffer + state->bufferedSize - XXH_STRIPE_LEN, - secret + state->secretLimit - XXH_SECRET_LASTACC_START); + XXH3_accumulate, XXH3_scrambleAcc); + lastStripePtr = state->buffer + state->bufferedSize - XXH_STRIPE_LEN; } else { /* bufferedSize < XXH_STRIPE_LEN */ - xxh_u8 lastStripe[XXH_STRIPE_LEN]; + /* Copy to temp buffer */ size_t const catchupSize = XXH_STRIPE_LEN - state->bufferedSize; XXH_ASSERT(state->bufferedSize > 0); /* there is always some input buffered */ XXH_memcpy(lastStripe, state->buffer + sizeof(state->buffer) - catchupSize, catchupSize); XXH_memcpy(lastStripe + catchupSize, state->buffer, state->bufferedSize); - XXH3_accumulate_512(acc, - lastStripe, - secret + state->secretLimit - XXH_SECRET_LASTACC_START); + lastStripePtr = lastStripe; } + /* Last stripe */ + XXH3_accumulate_512(acc, + lastStripePtr, + secret + state->secretLimit - XXH_SECRET_LASTACC_START); } -/*! @ingroup xxh3_family */ -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t* state) +/*! @ingroup XXH3_family */ +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (XXH_NOESCAPE const XXH3_state_t* state) { const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; if (state->totalLen > XXH3_MIDSIZE_MAX) { @@ -5057,7 +6369,7 @@ XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t* state) return XXH3_64bits_withSecret(state->buffer, (size_t)(state->totalLen), secret, state->secretLimit + XXH_STRIPE_LEN); } - +#endif /* !XXH_NO_STREAM */ /* ========================================== @@ -5077,7 +6389,7 @@ XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t* state) * fast for a _128-bit_ hash on 32-bit (it usually clears XXH64). */ -XXH_FORCE_INLINE XXH128_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH128_hash_t XXH3_len_1to3_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { /* A doubled version of 1to3_64b with different constants. */ @@ -5106,7 +6418,7 @@ XXH3_len_1to3_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_ } } -XXH_FORCE_INLINE XXH128_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH128_hash_t XXH3_len_4to8_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(input != NULL); @@ -5126,14 +6438,14 @@ XXH3_len_4to8_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_ m128.low64 ^= (m128.high64 >> 3); m128.low64 = XXH_xorshift64(m128.low64, 35); - m128.low64 *= 0x9FB21C651E98DF25ULL; + m128.low64 *= PRIME_MX2; m128.low64 = XXH_xorshift64(m128.low64, 28); m128.high64 = XXH3_avalanche(m128.high64); return m128; } } -XXH_FORCE_INLINE XXH128_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH128_hash_t XXH3_len_9to16_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(input != NULL); @@ -5208,7 +6520,7 @@ XXH3_len_9to16_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64 /* * Assumption: `secret` size is >= XXH3_SECRET_SIZE_MIN */ -XXH_FORCE_INLINE XXH128_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH128_hash_t XXH3_len_0to16_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(len <= 16); @@ -5239,7 +6551,7 @@ XXH128_mix32B(XXH128_hash_t acc, const xxh_u8* input_1, const xxh_u8* input_2, } -XXH_FORCE_INLINE XXH128_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH128_hash_t XXH3_len_17to128_128b(const xxh_u8* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, XXH64_hash_t seed) @@ -5250,6 +6562,16 @@ XXH3_len_17to128_128b(const xxh_u8* XXH_RESTRICT input, size_t len, { XXH128_hash_t acc; acc.low64 = len * XXH_PRIME64_1; acc.high64 = 0; + +#if XXH_SIZE_OPT >= 1 + { + /* Smaller, but slightly slower. */ + unsigned int i = (unsigned int)(len - 1) / 32; + do { + acc = XXH128_mix32B(acc, input+16*i, input+len-16*(i+1), secret+32*i, seed); + } while (i-- != 0); + } +#else if (len > 32) { if (len > 64) { if (len > 96) { @@ -5260,6 +6582,7 @@ XXH3_len_17to128_128b(const xxh_u8* XXH_RESTRICT input, size_t len, acc = XXH128_mix32B(acc, input+16, input+len-32, secret+32, seed); } acc = XXH128_mix32B(acc, input, input+len-16, secret, seed); +#endif { XXH128_hash_t h128; h128.low64 = acc.low64 + acc.high64; h128.high64 = (acc.low64 * XXH_PRIME64_1) @@ -5272,7 +6595,7 @@ XXH3_len_17to128_128b(const xxh_u8* XXH_RESTRICT input, size_t len, } } -XXH_NO_INLINE XXH128_hash_t +XXH_NO_INLINE XXH_PUREF XXH128_hash_t XXH3_len_129to240_128b(const xxh_u8* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, XXH64_hash_t seed) @@ -5281,25 +6604,34 @@ XXH3_len_129to240_128b(const xxh_u8* XXH_RESTRICT input, size_t len, XXH_ASSERT(128 < len && len <= XXH3_MIDSIZE_MAX); { XXH128_hash_t acc; - int const nbRounds = (int)len / 32; - int i; + unsigned i; acc.low64 = len * XXH_PRIME64_1; acc.high64 = 0; - for (i=0; i<4; i++) { + /* + * We set as `i` as offset + 32. We do this so that unchanged + * `len` can be used as upper bound. This reaches a sweet spot + * where both x86 and aarch64 get simple agen and good codegen + * for the loop. + */ + for (i = 32; i < 160; i += 32) { acc = XXH128_mix32B(acc, - input + (32 * i), - input + (32 * i) + 16, - secret + (32 * i), + input + i - 32, + input + i - 16, + secret + i - 32, seed); } acc.low64 = XXH3_avalanche(acc.low64); acc.high64 = XXH3_avalanche(acc.high64); - XXH_ASSERT(nbRounds >= 4); - for (i=4 ; i < nbRounds; i++) { + /* + * NB: `i <= len` will duplicate the last 32-bytes if + * len % 32 was zero. This is an unfortunate necessity to keep + * the hash result stable. + */ + for (i=160; i <= len; i += 32) { acc = XXH128_mix32B(acc, - input + (32 * i), - input + (32 * i) + 16, - secret + XXH3_MIDSIZE_STARTOFFSET + (32 * (i - 4)), + input + i - 32, + input + i - 16, + secret + XXH3_MIDSIZE_STARTOFFSET + i - 160, seed); } /* last bytes */ @@ -5307,7 +6639,7 @@ XXH3_len_129to240_128b(const xxh_u8* XXH_RESTRICT input, size_t len, input + len - 16, input + len - 32, secret + XXH3_SECRET_SIZE_MIN - XXH3_MIDSIZE_LASTOFFSET - 16, - 0ULL - seed); + (XXH64_hash_t)0 - seed); { XXH128_hash_t h128; h128.low64 = acc.low64 + acc.high64; @@ -5324,12 +6656,12 @@ XXH3_len_129to240_128b(const xxh_u8* XXH_RESTRICT input, size_t len, XXH_FORCE_INLINE XXH128_hash_t XXH3_hashLong_128b_internal(const void* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, - XXH3_f_accumulate_512 f_acc512, + XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble) { XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[XXH_ACC_NB] = XXH3_INIT_ACC; - XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, secret, secretSize, f_acc512, f_scramble); + XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, secret, secretSize, f_acc, f_scramble); /* converge into final hash */ XXH_STATIC_ASSERT(sizeof(acc) == 64); @@ -5347,47 +6679,50 @@ XXH3_hashLong_128b_internal(const void* XXH_RESTRICT input, size_t len, } /* - * It's important for performance that XXH3_hashLong is not inlined. + * It's important for performance that XXH3_hashLong() is not inlined. */ -XXH_NO_INLINE XXH128_hash_t +XXH_NO_INLINE XXH_PUREF XXH128_hash_t XXH3_hashLong_128b_default(const void* XXH_RESTRICT input, size_t len, XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen) { (void)seed64; (void)secret; (void)secretLen; return XXH3_hashLong_128b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), - XXH3_accumulate_512, XXH3_scrambleAcc); + XXH3_accumulate, XXH3_scrambleAcc); } /* - * It's important for performance to pass @secretLen (when it's static) + * It's important for performance to pass @p secretLen (when it's static) * to the compiler, so that it can properly optimize the vectorized loop. + * + * When the secret size is unknown, or on GCC 12 where the mix of NO_INLINE and FORCE_INLINE + * breaks -Og, this is XXH_NO_INLINE. */ -XXH_FORCE_INLINE XXH128_hash_t +XXH3_WITH_SECRET_INLINE XXH128_hash_t XXH3_hashLong_128b_withSecret(const void* XXH_RESTRICT input, size_t len, XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen) { (void)seed64; return XXH3_hashLong_128b_internal(input, len, (const xxh_u8*)secret, secretLen, - XXH3_accumulate_512, XXH3_scrambleAcc); + XXH3_accumulate, XXH3_scrambleAcc); } XXH_FORCE_INLINE XXH128_hash_t XXH3_hashLong_128b_withSeed_internal(const void* XXH_RESTRICT input, size_t len, XXH64_hash_t seed64, - XXH3_f_accumulate_512 f_acc512, + XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble, XXH3_f_initCustomSecret f_initSec) { if (seed64 == 0) return XXH3_hashLong_128b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), - f_acc512, f_scramble); + f_acc, f_scramble); { XXH_ALIGN(XXH_SEC_ALIGN) xxh_u8 secret[XXH_SECRET_DEFAULT_SIZE]; f_initSec(secret, seed64); return XXH3_hashLong_128b_internal(input, len, (const xxh_u8*)secret, sizeof(secret), - f_acc512, f_scramble); + f_acc, f_scramble); } } @@ -5400,7 +6735,7 @@ XXH3_hashLong_128b_withSeed(const void* input, size_t len, { (void)secret; (void)secretLen; return XXH3_hashLong_128b_withSeed_internal(input, len, seed64, - XXH3_accumulate_512, XXH3_scrambleAcc, XXH3_initCustomSecret); + XXH3_accumulate, XXH3_scrambleAcc, XXH3_initCustomSecret); } typedef XXH128_hash_t (*XXH3_hashLong128_f)(const void* XXH_RESTRICT, size_t, @@ -5430,94 +6765,93 @@ XXH3_128bits_internal(const void* input, size_t len, /* === Public XXH128 API === */ -/*! @ingroup xxh3_family */ -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits(const void* input, size_t len) +/*! @ingroup XXH3_family */ +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits(XXH_NOESCAPE const void* input, size_t len) { return XXH3_128bits_internal(input, len, 0, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_128b_default); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH128_hash_t -XXH3_128bits_withSecret(const void* input, size_t len, const void* secret, size_t secretSize) +XXH3_128bits_withSecret(XXH_NOESCAPE const void* input, size_t len, XXH_NOESCAPE const void* secret, size_t secretSize) { return XXH3_128bits_internal(input, len, 0, (const xxh_u8*)secret, secretSize, XXH3_hashLong_128b_withSecret); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH128_hash_t -XXH3_128bits_withSeed(const void* input, size_t len, XXH64_hash_t seed) +XXH3_128bits_withSeed(XXH_NOESCAPE const void* input, size_t len, XXH64_hash_t seed) { return XXH3_128bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_128b_withSeed); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH128_hash_t -XXH3_128bits_withSecretandSeed(const void* input, size_t len, const void* secret, size_t secretSize, XXH64_hash_t seed) +XXH3_128bits_withSecretandSeed(XXH_NOESCAPE const void* input, size_t len, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed) { if (len <= XXH3_MIDSIZE_MAX) return XXH3_128bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), NULL); return XXH3_hashLong_128b_withSecret(input, len, seed, secret, secretSize); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH128_hash_t -XXH128(const void* input, size_t len, XXH64_hash_t seed) +XXH128(XXH_NOESCAPE const void* input, size_t len, XXH64_hash_t seed) { return XXH3_128bits_withSeed(input, len, seed); } /* === XXH3 128-bit streaming === */ - +#ifndef XXH_NO_STREAM /* * All initialization and update functions are identical to 64-bit streaming variant. * The only difference is the finalization routine. */ -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_128bits_reset(XXH3_state_t* statePtr) +XXH3_128bits_reset(XXH_NOESCAPE XXH3_state_t* statePtr) { return XXH3_64bits_reset(statePtr); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_128bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize) +XXH3_128bits_reset_withSecret(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize) { return XXH3_64bits_reset_withSecret(statePtr, secret, secretSize); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_128bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed) +XXH3_128bits_reset_withSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH64_hash_t seed) { return XXH3_64bits_reset_withSeed(statePtr, seed); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, const void* secret, size_t secretSize, XXH64_hash_t seed) +XXH3_128bits_reset_withSecretandSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed) { return XXH3_64bits_reset_withSecretandSeed(statePtr, secret, secretSize, seed); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_128bits_update(XXH3_state_t* state, const void* input, size_t len) +XXH3_128bits_update(XXH_NOESCAPE XXH3_state_t* state, XXH_NOESCAPE const void* input, size_t len) { - return XXH3_update(state, (const xxh_u8*)input, len, - XXH3_accumulate_512, XXH3_scrambleAcc); + return XXH3_64bits_update(state, input, len); } -/*! @ingroup xxh3_family */ -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (const XXH3_state_t* state) +/*! @ingroup XXH3_family */ +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (XXH_NOESCAPE const XXH3_state_t* state) { const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; if (state->totalLen > XXH3_MIDSIZE_MAX) { @@ -5541,13 +6875,13 @@ XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (const XXH3_state_t* state) return XXH3_128bits_withSecret(state->buffer, (size_t)(state->totalLen), secret, state->secretLimit + XXH_STRIPE_LEN); } - +#endif /* !XXH_NO_STREAM */ /* 128-bit utility functions */ #include /* memcmp, memcpy */ /* return : 1 is equal, 0 if different */ -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2) { /* note : XXH128_hash_t is compact, it has no padding byte */ @@ -5555,11 +6889,11 @@ XXH_PUBLIC_API int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2) } /* This prototype is compatible with stdlib's qsort(). - * return : >0 if *h128_1 > *h128_2 - * <0 if *h128_1 < *h128_2 - * =0 if *h128_1 == *h128_2 */ -/*! @ingroup xxh3_family */ -XXH_PUBLIC_API int XXH128_cmp(const void* h128_1, const void* h128_2) + * @return : >0 if *h128_1 > *h128_2 + * <0 if *h128_1 < *h128_2 + * =0 if *h128_1 == *h128_2 */ +/*! @ingroup XXH3_family */ +XXH_PUBLIC_API int XXH128_cmp(XXH_NOESCAPE const void* h128_1, XXH_NOESCAPE const void* h128_2) { XXH128_hash_t const h1 = *(const XXH128_hash_t*)h128_1; XXH128_hash_t const h2 = *(const XXH128_hash_t*)h128_2; @@ -5571,9 +6905,9 @@ XXH_PUBLIC_API int XXH128_cmp(const void* h128_1, const void* h128_2) /*====== Canonical representation ======*/ -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API void -XXH128_canonicalFromHash(XXH128_canonical_t* dst, XXH128_hash_t hash) +XXH128_canonicalFromHash(XXH_NOESCAPE XXH128_canonical_t* dst, XXH128_hash_t hash) { XXH_STATIC_ASSERT(sizeof(XXH128_canonical_t) == sizeof(XXH128_hash_t)); if (XXH_CPU_LITTLE_ENDIAN) { @@ -5584,9 +6918,9 @@ XXH128_canonicalFromHash(XXH128_canonical_t* dst, XXH128_hash_t hash) XXH_memcpy((char*)dst + sizeof(hash.high64), &hash.low64, sizeof(hash.low64)); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH128_hash_t -XXH128_hashFromCanonical(const XXH128_canonical_t* src) +XXH128_hashFromCanonical(XXH_NOESCAPE const XXH128_canonical_t* src) { XXH128_hash_t h; h.high64 = XXH_readBE64(src); @@ -5608,9 +6942,9 @@ XXH_FORCE_INLINE void XXH3_combine16(void* dst, XXH128_hash_t h128) XXH_writeLE64( (char*)dst+8, XXH_readLE64((char*)dst+8) ^ h128.high64 ); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_generateSecret(void* secretBuffer, size_t secretSize, const void* customSeed, size_t customSeedSize) +XXH3_generateSecret(XXH_NOESCAPE void* secretBuffer, size_t secretSize, XXH_NOESCAPE const void* customSeed, size_t customSeedSize) { #if (XXH_DEBUGLEVEL >= 1) XXH_ASSERT(secretBuffer != NULL); @@ -5653,9 +6987,9 @@ XXH3_generateSecret(void* secretBuffer, size_t secretSize, const void* customSee return XXH_OK; } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API void -XXH3_generateSecret_fromSeed(void* secretBuffer, XXH64_hash_t seed) +XXH3_generateSecret_fromSeed(XXH_NOESCAPE void* secretBuffer, XXH64_hash_t seed) { XXH_ALIGN(XXH_SEC_ALIGN) xxh_u8 secret[XXH_SECRET_DEFAULT_SIZE]; XXH3_initCustomSecret(secret, seed); @@ -5668,7 +7002,7 @@ XXH3_generateSecret_fromSeed(void* secretBuffer, XXH64_hash_t seed) /* Pop our optimization override from above */ #if XXH_VECTOR == XXH_AVX2 /* AVX2 */ \ && defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ - && defined(__OPTIMIZE__) && !defined(__OPTIMIZE_SIZE__) /* respect -O0 and -Os */ + && defined(__OPTIMIZE__) && XXH_SIZE_OPT <= 0 /* respect -O0 and -Os */ # pragma GCC pop_options #endif @@ -5683,7 +7017,7 @@ XXH3_generateSecret_fromSeed(void* secretBuffer, XXH64_hash_t seed) #if defined (__cplusplus) -} +} /* extern "C" */ #endif #endif /* USE_EXTERNAL_ZSTD */ diff --git a/vendor/github.com/DataDog/zstd/zdict.c b/vendor/github.com/DataDog/zstd/zdict.c index 175865df..eeba2f09 100644 --- a/vendor/github.com/DataDog/zstd/zdict.c +++ b/vendor/github.com/DataDog/zstd/zdict.c @@ -75,9 +75,9 @@ static const U32 g_selectivity_default = 9; * Console display ***************************************/ #undef DISPLAY -#define DISPLAY(...) { fprintf(stderr, __VA_ARGS__); fflush( stderr ); } +#define DISPLAY(...) do { fprintf(stderr, __VA_ARGS__); fflush( stderr ); } while (0) #undef DISPLAYLEVEL -#define DISPLAYLEVEL(l, ...) if (notificationLevel>=l) { DISPLAY(__VA_ARGS__); } /* 0 : no display; 1: errors; 2: default; 3: details; 4: debug */ +#define DISPLAYLEVEL(l, ...) do { if (notificationLevel>=l) { DISPLAY(__VA_ARGS__); } } while (0) /* 0 : no display; 1: errors; 2: default; 3: details; 4: debug */ static clock_t ZDICT_clockSpan(clock_t nPrevious) { return clock() - nPrevious; } @@ -478,10 +478,16 @@ static size_t ZDICT_trainBuffer_legacy(dictItem* dictList, U32 dictListSize, clock_t const refreshRate = CLOCKS_PER_SEC * 3 / 10; # undef DISPLAYUPDATE -# define DISPLAYUPDATE(l, ...) if (notificationLevel>=l) { \ - if (ZDICT_clockSpan(displayClock) > refreshRate) \ - { displayClock = clock(); DISPLAY(__VA_ARGS__); \ - if (notificationLevel>=4) fflush(stderr); } } +# define DISPLAYUPDATE(l, ...) \ + do { \ + if (notificationLevel>=l) { \ + if (ZDICT_clockSpan(displayClock) > refreshRate) { \ + displayClock = clock(); \ + DISPLAY(__VA_ARGS__); \ + } \ + if (notificationLevel>=4) fflush(stderr); \ + } \ + } while (0) /* init */ DISPLAYLEVEL(2, "\r%70s\r", ""); /* clean display line */ diff --git a/vendor/github.com/DataDog/zstd/zstd.go b/vendor/github.com/DataDog/zstd/zstd.go index 2cf5c61b..8499bf10 100644 --- a/vendor/github.com/DataDog/zstd/zstd.go +++ b/vendor/github.com/DataDog/zstd/zstd.go @@ -60,8 +60,8 @@ func cCompressBound(srcSize int) int { // decompressSizeHint tries to give a hint on how much of the output buffer size we should have // based on zstd frame descriptors. To prevent DOS from maliciously-created payloads, limit the size func decompressSizeHint(src []byte) int { - // 1 MB or 10x input size - upperBound := 10 * len(src) + // 1 MB or 50x input size + upperBound := 50 * len(src) if upperBound < decompressSizeBufferLimit { upperBound = decompressSizeBufferLimit } @@ -143,12 +143,7 @@ func Decompress(dst, src []byte) ([]byte, error) { dst = make([]byte, bound) } - written := int(C.ZSTD_decompress( - unsafe.Pointer(&dst[0]), - C.size_t(len(dst)), - unsafe.Pointer(&src[0]), - C.size_t(len(src)))) - err := getError(written) + written, err := DecompressInto(dst, src) if err == nil { return dst[:written], nil } @@ -161,3 +156,19 @@ func Decompress(dst, src []byte) ([]byte, error) { defer r.Close() return ioutil.ReadAll(r) } + +// DecompressInto decompresses src into dst. Unlike Decompress, DecompressInto +// requires that dst be sufficiently large to hold the decompressed payload. +// DecompressInto may be used when the caller knows the size of the decompressed +// payload before attempting decompression. +// +// It returns the number of bytes copied and an error if any is encountered. If +// dst is too small, DecompressInto errors. +func DecompressInto(dst, src []byte) (int, error) { + written := int(C.ZSTD_decompress( + unsafe.Pointer(&dst[0]), + C.size_t(len(dst)), + unsafe.Pointer(&src[0]), + C.size_t(len(src)))) + return written, getError(written) +} diff --git a/vendor/github.com/DataDog/zstd/zstd.h b/vendor/github.com/DataDog/zstd/zstd.h index c26aceed..23537a12 100644 --- a/vendor/github.com/DataDog/zstd/zstd.h +++ b/vendor/github.com/DataDog/zstd/zstd.h @@ -107,7 +107,7 @@ extern "C" { /*------ Version ------*/ #define ZSTD_VERSION_MAJOR 1 #define ZSTD_VERSION_MINOR 5 -#define ZSTD_VERSION_RELEASE 5 +#define ZSTD_VERSION_RELEASE 6 #define ZSTD_VERSION_NUMBER (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE) /*! ZSTD_versionNumber() : @@ -229,7 +229,7 @@ ZSTDLIB_API size_t ZSTD_findFrameCompressedSize(const void* src, size_t srcSize) * for example to size a static array on stack. * Will produce constant value 0 if srcSize too large. */ -#define ZSTD_MAX_INPUT_SIZE ((sizeof(size_t)==8) ? 0xFF00FF00FF00FF00LLU : 0xFF00FF00U) +#define ZSTD_MAX_INPUT_SIZE ((sizeof(size_t)==8) ? 0xFF00FF00FF00FF00ULL : 0xFF00FF00U) #define ZSTD_COMPRESSBOUND(srcSize) (((size_t)(srcSize) >= ZSTD_MAX_INPUT_SIZE) ? 0 : (srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0)) /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */ ZSTDLIB_API size_t ZSTD_compressBound(size_t srcSize); /*!< maximum compressed size in worst case single-pass scenario */ /* ZSTD_isError() : @@ -250,7 +250,7 @@ ZSTDLIB_API int ZSTD_defaultCLevel(void); /*!< default compres /*= Compression context * When compressing many times, * it is recommended to allocate a context just once, - * and re-use it for each successive compression operation. + * and reuse it for each successive compression operation. * This will make workload friendlier for system's memory. * Note : re-using context is just a speed / resource optimization. * It doesn't change the compression ratio, which remains identical. @@ -263,9 +263,9 @@ ZSTDLIB_API size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx); /* accept NULL pointer * /*! ZSTD_compressCCtx() : * Same as ZSTD_compress(), using an explicit ZSTD_CCtx. - * Important : in order to behave similarly to `ZSTD_compress()`, - * this function compresses at requested compression level, - * __ignoring any other parameter__ . + * Important : in order to mirror `ZSTD_compress()` behavior, + * this function compresses at the requested compression level, + * __ignoring any other advanced parameter__ . * If any advanced parameter was set using the advanced API, * they will all be reset. Only `compressionLevel` remains. */ @@ -277,7 +277,7 @@ ZSTDLIB_API size_t ZSTD_compressCCtx(ZSTD_CCtx* cctx, /*= Decompression context * When decompressing many times, * it is recommended to allocate a context only once, - * and re-use it for each successive compression operation. + * and reuse it for each successive compression operation. * This will make workload friendlier for system's memory. * Use one context per thread for parallel execution. */ typedef struct ZSTD_DCtx_s ZSTD_DCtx; @@ -287,7 +287,7 @@ ZSTDLIB_API size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx); /* accept NULL pointer * /*! ZSTD_decompressDCtx() : * Same as ZSTD_decompress(), * requires an allocated ZSTD_DCtx. - * Compatible with sticky parameters. + * Compatible with sticky parameters (see below). */ ZSTDLIB_API size_t ZSTD_decompressDCtx(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, @@ -303,12 +303,12 @@ ZSTDLIB_API size_t ZSTD_decompressDCtx(ZSTD_DCtx* dctx, * using ZSTD_CCtx_set*() functions. * Pushed parameters are sticky : they are valid for next compressed frame, and any subsequent frame. * "sticky" parameters are applicable to `ZSTD_compress2()` and `ZSTD_compressStream*()` ! - * __They do not apply to "simple" one-shot variants such as ZSTD_compressCCtx()__ . + * __They do not apply to one-shot variants such as ZSTD_compressCCtx()__ . * * It's possible to reset all parameters to "default" using ZSTD_CCtx_reset(). * * This API supersedes all other "advanced" API entry points in the experimental section. - * In the future, we expect to remove from experimental API entry points which are redundant with this API. + * In the future, we expect to remove API entry points from experimental which are redundant with this API. */ @@ -391,6 +391,19 @@ typedef enum { * The higher the value of selected strategy, the more complex it is, * resulting in stronger and slower compression. * Special: value 0 means "use default strategy". */ + + ZSTD_c_targetCBlockSize=130, /* v1.5.6+ + * Attempts to fit compressed block size into approximatively targetCBlockSize. + * Bound by ZSTD_TARGETCBLOCKSIZE_MIN and ZSTD_TARGETCBLOCKSIZE_MAX. + * Note that it's not a guarantee, just a convergence target (default:0). + * No target when targetCBlockSize == 0. + * This is helpful in low bandwidth streaming environments to improve end-to-end latency, + * when a client can make use of partial documents (a prominent example being Chrome). + * Note: this parameter is stable since v1.5.6. + * It was present as an experimental parameter in earlier versions, + * but it's not recommended using it with earlier library versions + * due to massive performance regressions. + */ /* LDM mode parameters */ ZSTD_c_enableLongDistanceMatching=160, /* Enable long distance matching. * This parameter is designed to improve compression ratio @@ -470,7 +483,6 @@ typedef enum { * ZSTD_c_forceMaxWindow * ZSTD_c_forceAttachDict * ZSTD_c_literalCompressionMode - * ZSTD_c_targetCBlockSize * ZSTD_c_srcSizeHint * ZSTD_c_enableDedicatedDictSearch * ZSTD_c_stableInBuffer @@ -491,7 +503,7 @@ typedef enum { ZSTD_c_experimentalParam3=1000, ZSTD_c_experimentalParam4=1001, ZSTD_c_experimentalParam5=1002, - ZSTD_c_experimentalParam6=1003, + /* was ZSTD_c_experimentalParam6=1003; is now ZSTD_c_targetCBlockSize */ ZSTD_c_experimentalParam7=1004, ZSTD_c_experimentalParam8=1005, ZSTD_c_experimentalParam9=1006, @@ -576,6 +588,7 @@ ZSTDLIB_API size_t ZSTD_CCtx_reset(ZSTD_CCtx* cctx, ZSTD_ResetDirective reset); /*! ZSTD_compress2() : * Behave the same as ZSTD_compressCCtx(), but compression parameters are set using the advanced API. + * (note that this entry point doesn't even expose a compression level parameter). * ZSTD_compress2() always starts a new frame. * Should cctx hold data from a previously unfinished frame, everything about it is forgotten. * - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*() @@ -619,6 +632,7 @@ typedef enum { * ZSTD_d_forceIgnoreChecksum * ZSTD_d_refMultipleDDicts * ZSTD_d_disableHuffmanAssembly + * ZSTD_d_maxBlockSize * Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them. * note : never ever use experimentalParam? names directly */ @@ -626,7 +640,8 @@ typedef enum { ZSTD_d_experimentalParam2=1001, ZSTD_d_experimentalParam3=1002, ZSTD_d_experimentalParam4=1003, - ZSTD_d_experimentalParam5=1004 + ZSTD_d_experimentalParam5=1004, + ZSTD_d_experimentalParam6=1005 } ZSTD_dParameter; @@ -681,14 +696,14 @@ typedef struct ZSTD_outBuffer_s { * A ZSTD_CStream object is required to track streaming operation. * Use ZSTD_createCStream() and ZSTD_freeCStream() to create/release resources. * ZSTD_CStream objects can be reused multiple times on consecutive compression operations. -* It is recommended to re-use ZSTD_CStream since it will play nicer with system's memory, by re-using already allocated memory. +* It is recommended to reuse ZSTD_CStream since it will play nicer with system's memory, by re-using already allocated memory. * * For parallel execution, use one separate ZSTD_CStream per thread. * * note : since v1.3.0, ZSTD_CStream and ZSTD_CCtx are the same thing. * * Parameters are sticky : when starting a new compression on the same context, -* it will re-use the same sticky parameters as previous compression session. +* it will reuse the same sticky parameters as previous compression session. * When in doubt, it's recommended to fully initialize the context before usage. * Use ZSTD_CCtx_reset() to reset the context and ZSTD_CCtx_setParameter(), * ZSTD_CCtx_setPledgedSrcSize(), or ZSTD_CCtx_loadDictionary() and friends to @@ -777,6 +792,11 @@ typedef enum { * only ZSTD_e_end or ZSTD_e_flush operations are allowed. * Before starting a new compression job, or changing compression parameters, * it is required to fully flush internal buffers. + * - note: if an operation ends with an error, it may leave @cctx in an undefined state. + * Therefore, it's UB to invoke ZSTD_compressStream2() of ZSTD_compressStream() on such a state. + * In order to be re-employed after an error, a state must be reset, + * which can be done explicitly (ZSTD_CCtx_reset()), + * or is sometimes implied by methods starting a new compression job (ZSTD_initCStream(), ZSTD_compressCCtx()) */ ZSTDLIB_API size_t ZSTD_compressStream2( ZSTD_CCtx* cctx, ZSTD_outBuffer* output, @@ -836,7 +856,7 @@ ZSTDLIB_API size_t ZSTD_endStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output); * * A ZSTD_DStream object is required to track streaming operations. * Use ZSTD_createDStream() and ZSTD_freeDStream() to create/release resources. -* ZSTD_DStream objects can be re-used multiple times. +* ZSTD_DStream objects can be reused multiple times. * * Use ZSTD_initDStream() to start a new decompression operation. * @return : recommended first input size @@ -890,6 +910,12 @@ ZSTDLIB_API size_t ZSTD_initDStream(ZSTD_DStream* zds); * @return : 0 when a frame is completely decoded and fully flushed, * or an error code, which can be tested using ZSTD_isError(), * or any other value > 0, which means there is some decoding or flushing to do to complete current frame. + * + * Note: when an operation returns with an error code, the @zds state may be left in undefined state. + * It's UB to invoke `ZSTD_decompressStream()` on such a state. + * In order to re-use such a state, it must be first reset, + * which can be done explicitly (`ZSTD_DCtx_reset()`), + * or is implied for operations starting some new decompression job (`ZSTD_initDStream`, `ZSTD_decompressDCtx()`, `ZSTD_decompress_usingDict()`) */ ZSTDLIB_API size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inBuffer* input); @@ -1022,7 +1048,7 @@ ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame(const void* src, size_t srcSize); * * This API allows dictionaries to be used with ZSTD_compress2(), * ZSTD_compressStream2(), and ZSTD_decompressDCtx(). - * Dictionaries are sticky, they remain valid when same context is re-used, + * Dictionaries are sticky, they remain valid when same context is reused, * they only reset when the context is reset * with ZSTD_reset_parameters or ZSTD_reset_session_and_parameters. * In contrast, Prefixes are single-use. @@ -1240,7 +1266,7 @@ ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict); #define ZSTD_LDM_HASHRATELOG_MAX (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN) /* Advanced parameter bounds */ -#define ZSTD_TARGETCBLOCKSIZE_MIN 64 +#define ZSTD_TARGETCBLOCKSIZE_MIN 1340 /* suitable to fit into an ethernet / wifi / 4G transport frame */ #define ZSTD_TARGETCBLOCKSIZE_MAX ZSTD_BLOCKSIZE_MAX #define ZSTD_SRCSIZEHINT_MIN 0 #define ZSTD_SRCSIZEHINT_MAX INT_MAX @@ -1528,25 +1554,38 @@ typedef enum { ZSTDLIB_STATIC_API size_t ZSTD_sequenceBound(size_t srcSize); /*! ZSTD_generateSequences() : + * WARNING: This function is meant for debugging and informational purposes ONLY! + * Its implementation is flawed, and it will be deleted in a future version. + * It is not guaranteed to succeed, as there are several cases where it will give + * up and fail. You should NOT use this function in production code. + * + * This function is deprecated, and will be removed in a future version. + * * Generate sequences using ZSTD_compress2(), given a source buffer. * + * @param zc The compression context to be used for ZSTD_compress2(). Set any + * compression parameters you need on this context. + * @param outSeqs The output sequences buffer of size @p outSeqsSize + * @param outSeqsSize The size of the output sequences buffer. + * ZSTD_sequenceBound(srcSize) is an upper bound on the number + * of sequences that can be generated. + * @param src The source buffer to generate sequences from of size @p srcSize. + * @param srcSize The size of the source buffer. + * * Each block will end with a dummy sequence * with offset == 0, matchLength == 0, and litLength == length of last literals. * litLength may be == 0, and if so, then the sequence of (of: 0 ml: 0 ll: 0) * simply acts as a block delimiter. * - * @zc can be used to insert custom compression params. - * This function invokes ZSTD_compress2(). - * - * The output of this function can be fed into ZSTD_compressSequences() with CCtx - * setting of ZSTD_c_blockDelimiters as ZSTD_sf_explicitBlockDelimiters - * @return : number of sequences generated + * @returns The number of sequences generated, necessarily less than + * ZSTD_sequenceBound(srcSize), or an error code that can be checked + * with ZSTD_isError(). */ - +ZSTD_DEPRECATED("For debugging only, will be replaced by ZSTD_extractSequences()") ZSTDLIB_STATIC_API size_t -ZSTD_generateSequences( ZSTD_CCtx* zc, - ZSTD_Sequence* outSeqs, size_t outSeqsSize, - const void* src, size_t srcSize); +ZSTD_generateSequences(ZSTD_CCtx* zc, + ZSTD_Sequence* outSeqs, size_t outSeqsSize, + const void* src, size_t srcSize); /*! ZSTD_mergeBlockDelimiters() : * Given an array of ZSTD_Sequence, remove all sequences that represent block delimiters/last literals @@ -1641,56 +1680,59 @@ ZSTDLIB_API unsigned ZSTD_isSkippableFrame(const void* buffer, size_t size); /*! ZSTD_estimate*() : * These functions make it possible to estimate memory usage * of a future {D,C}Ctx, before its creation. + * This is useful in combination with ZSTD_initStatic(), + * which makes it possible to employ a static buffer for ZSTD_CCtx* state. * * ZSTD_estimateCCtxSize() will provide a memory budget large enough - * for any compression level up to selected one. - * Note : Unlike ZSTD_estimateCStreamSize*(), this estimate - * does not include space for a window buffer. - * Therefore, the estimation is only guaranteed for single-shot compressions, not streaming. + * to compress data of any size using one-shot compression ZSTD_compressCCtx() or ZSTD_compress2() + * associated with any compression level up to max specified one. * The estimate will assume the input may be arbitrarily large, * which is the worst case. * + * Note that the size estimation is specific for one-shot compression, + * it is not valid for streaming (see ZSTD_estimateCStreamSize*()) + * nor other potential ways of using a ZSTD_CCtx* state. + * * When srcSize can be bound by a known and rather "small" value, - * this fact can be used to provide a tighter estimation - * because the CCtx compression context will need less memory. - * This tighter estimation can be provided by more advanced functions + * this knowledge can be used to provide a tighter budget estimation + * because the ZSTD_CCtx* state will need less memory for small inputs. + * This tighter estimation can be provided by employing more advanced functions * ZSTD_estimateCCtxSize_usingCParams(), which can be used in tandem with ZSTD_getCParams(), * and ZSTD_estimateCCtxSize_usingCCtxParams(), which can be used in tandem with ZSTD_CCtxParams_setParameter(). * Both can be used to estimate memory using custom compression parameters and arbitrary srcSize limits. * * Note : only single-threaded compression is supported. * ZSTD_estimateCCtxSize_usingCCtxParams() will return an error code if ZSTD_c_nbWorkers is >= 1. - * - * Note 2 : ZSTD_estimateCCtxSize* functions are not compatible with the Block-Level Sequence Producer API at this time. - * Size estimates assume that no external sequence producer is registered. */ -ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize(int compressionLevel); +ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize(int maxCompressionLevel); ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams); ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params); ZSTDLIB_STATIC_API size_t ZSTD_estimateDCtxSize(void); /*! ZSTD_estimateCStreamSize() : - * ZSTD_estimateCStreamSize() will provide a budget large enough for any compression level up to selected one. - * It will also consider src size to be arbitrarily "large", which is worst case. + * ZSTD_estimateCStreamSize() will provide a memory budget large enough for streaming compression + * using any compression level up to the max specified one. + * It will also consider src size to be arbitrarily "large", which is a worst case scenario. * If srcSize is known to always be small, ZSTD_estimateCStreamSize_usingCParams() can provide a tighter estimation. * ZSTD_estimateCStreamSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel. * ZSTD_estimateCStreamSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParams_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_c_nbWorkers is >= 1. * Note : CStream size estimation is only correct for single-threaded compression. - * ZSTD_DStream memory budget depends on window Size. + * ZSTD_estimateCStreamSize_usingCCtxParams() will return an error code if ZSTD_c_nbWorkers is >= 1. + * Note 2 : ZSTD_estimateCStreamSize* functions are not compatible with the Block-Level Sequence Producer API at this time. + * Size estimates assume that no external sequence producer is registered. + * + * ZSTD_DStream memory budget depends on frame's window Size. * This information can be passed manually, using ZSTD_estimateDStreamSize, * or deducted from a valid frame Header, using ZSTD_estimateDStreamSize_fromFrame(); + * Any frame requesting a window size larger than max specified one will be rejected. * Note : if streaming is init with function ZSTD_init?Stream_usingDict(), * an internal ?Dict will be created, which additional size is not estimated here. * In this case, get total size by adding ZSTD_estimate?DictSize - * Note 2 : only single-threaded compression is supported. - * ZSTD_estimateCStreamSize_usingCCtxParams() will return an error code if ZSTD_c_nbWorkers is >= 1. - * Note 3 : ZSTD_estimateCStreamSize* functions are not compatible with the Block-Level Sequence Producer API at this time. - * Size estimates assume that no external sequence producer is registered. */ -ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize(int compressionLevel); +ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize(int maxCompressionLevel); ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams); ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params* params); -ZSTDLIB_STATIC_API size_t ZSTD_estimateDStreamSize(size_t windowSize); +ZSTDLIB_STATIC_API size_t ZSTD_estimateDStreamSize(size_t maxWindowSize); ZSTDLIB_STATIC_API size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize); /*! ZSTD_estimate?DictSize() : @@ -1947,11 +1989,6 @@ ZSTDLIB_STATIC_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const vo */ #define ZSTD_c_literalCompressionMode ZSTD_c_experimentalParam5 -/* Tries to fit compressed block size to be around targetCBlockSize. - * No target when targetCBlockSize == 0. - * There is no guarantee on compressed block size (default:0) */ -#define ZSTD_c_targetCBlockSize ZSTD_c_experimentalParam6 - /* User's best guess of source size. * Hint is not valid when srcSizeHint == 0. * There is no guarantee that hint is close to actual source size, @@ -2431,6 +2468,22 @@ ZSTDLIB_STATIC_API size_t ZSTD_DCtx_getParameter(ZSTD_DCtx* dctx, ZSTD_dParamete */ #define ZSTD_d_disableHuffmanAssembly ZSTD_d_experimentalParam5 +/* ZSTD_d_maxBlockSize + * Allowed values are between 1KB and ZSTD_BLOCKSIZE_MAX (128KB). + * The default is ZSTD_BLOCKSIZE_MAX, and setting to 0 will set to the default. + * + * Forces the decompressor to reject blocks whose content size is + * larger than the configured maxBlockSize. When maxBlockSize is + * larger than the windowSize, the windowSize is used instead. + * This saves memory on the decoder when you know all blocks are small. + * + * This option is typically used in conjunction with ZSTD_c_maxBlockSize. + * + * WARNING: This causes the decoder to reject otherwise valid frames + * that have block sizes larger than the configured maxBlockSize. + */ +#define ZSTD_d_maxBlockSize ZSTD_d_experimentalParam6 + /*! ZSTD_DCtx_setFormat() : * This function is REDUNDANT. Prefer ZSTD_DCtx_setParameter(). @@ -2558,7 +2611,7 @@ size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs, * explicitly specified. * * start a new frame, using same parameters from previous frame. - * This is typically useful to skip dictionary loading stage, since it will re-use it in-place. + * This is typically useful to skip dictionary loading stage, since it will reuse it in-place. * Note that zcs must be init at least once before using ZSTD_resetCStream(). * If pledgedSrcSize is not known at reset time, use macro ZSTD_CONTENTSIZE_UNKNOWN. * If pledgedSrcSize > 0, its value must be correct, as it will be written in header, and controlled at the end. @@ -2634,7 +2687,7 @@ ZSTDLIB_STATIC_API size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const Z * * ZSTD_DCtx_reset(zds, ZSTD_reset_session_only); * - * re-use decompression parameters from previous init; saves dictionary loading + * reuse decompression parameters from previous init; saves dictionary loading */ ZSTD_DEPRECATED("use ZSTD_DCtx_reset, see zstd.h for detailed instructions") ZSTDLIB_STATIC_API size_t ZSTD_resetDStream(ZSTD_DStream* zds); @@ -2766,7 +2819,7 @@ ZSTDLIB_STATIC_API size_t ZSTD_resetDStream(ZSTD_DStream* zds); #define ZSTD_SEQUENCE_PRODUCER_ERROR ((size_t)(-1)) -typedef size_t ZSTD_sequenceProducer_F ( +typedef size_t (*ZSTD_sequenceProducer_F) ( void* sequenceProducerState, ZSTD_Sequence* outSeqs, size_t outSeqsCapacity, const void* src, size_t srcSize, @@ -2798,7 +2851,23 @@ ZSTDLIB_STATIC_API void ZSTD_registerSequenceProducer( ZSTD_CCtx* cctx, void* sequenceProducerState, - ZSTD_sequenceProducer_F* sequenceProducer + ZSTD_sequenceProducer_F sequenceProducer +); + +/*! ZSTD_CCtxParams_registerSequenceProducer() : + * Same as ZSTD_registerSequenceProducer(), but operates on ZSTD_CCtx_params. + * This is used for accurate size estimation with ZSTD_estimateCCtxSize_usingCCtxParams(), + * which is needed when creating a ZSTD_CCtx with ZSTD_initStaticCCtx(). + * + * If you are using the external sequence producer API in a scenario where ZSTD_initStaticCCtx() + * is required, then this function is for you. Otherwise, you probably don't need it. + * + * See tests/zstreamtest.c for example usage. */ +ZSTDLIB_STATIC_API void +ZSTD_CCtxParams_registerSequenceProducer( + ZSTD_CCtx_params* params, + void* sequenceProducerState, + ZSTD_sequenceProducer_F sequenceProducer ); @@ -2821,7 +2890,7 @@ ZSTD_registerSequenceProducer( A ZSTD_CCtx object is required to track streaming operations. Use ZSTD_createCCtx() / ZSTD_freeCCtx() to manage resource. - ZSTD_CCtx object can be re-used multiple times within successive compression operations. + ZSTD_CCtx object can be reused multiple times within successive compression operations. Start by initializing a context. Use ZSTD_compressBegin(), or ZSTD_compressBegin_usingDict() for dictionary compression. @@ -2842,7 +2911,7 @@ ZSTD_registerSequenceProducer( It's possible to use srcSize==0, in which case, it will write a final empty block to end the frame. Without last block mark, frames are considered unfinished (hence corrupted) by compliant decoders. - `ZSTD_CCtx` object can be re-used (ZSTD_compressBegin()) to compress again. + `ZSTD_CCtx` object can be reused (ZSTD_compressBegin()) to compress again. */ /*===== Buffer-less streaming compression functions =====*/ @@ -2874,7 +2943,7 @@ size_t ZSTD_compressBegin_usingCDict_advanced(ZSTD_CCtx* const cctx, const ZSTD_ A ZSTD_DCtx object is required to track streaming operations. Use ZSTD_createDCtx() / ZSTD_freeDCtx() to manage it. - A ZSTD_DCtx object can be re-used multiple times. + A ZSTD_DCtx object can be reused multiple times. First typical operation is to retrieve frame parameters, using ZSTD_getFrameHeader(). Frame header is extracted from the beginning of compressed frame, so providing only the frame's beginning is enough. diff --git a/vendor/github.com/DataDog/zstd/zstd_bulk.go b/vendor/github.com/DataDog/zstd/zstd_bulk.go index 0616df9b..6294a653 100644 --- a/vendor/github.com/DataDog/zstd/zstd_bulk.go +++ b/vendor/github.com/DataDog/zstd/zstd_bulk.go @@ -112,12 +112,12 @@ func (p *BulkProcessor) Decompress(dst, src []byte) ([]byte, error) { contentSize := decompressSizeHint(src) if cap(dst) >= contentSize { - dst = dst[0:contentSize] + dst = dst[0:cap(dst)] } else { dst = make([]byte, contentSize) } - if contentSize == 0 { + if len(dst) == 0 { return dst, nil } @@ -125,7 +125,7 @@ func (p *BulkProcessor) Decompress(dst, src []byte) ([]byte, error) { cWritten := C.ZSTD_decompress_usingDDict( dctx, unsafe.Pointer(&dst[0]), - C.size_t(contentSize), + C.size_t(len(dst)), unsafe.Pointer(&src[0]), C.size_t(len(src)), p.dDict, diff --git a/vendor/github.com/DataDog/zstd/zstd_compress.c b/vendor/github.com/DataDog/zstd/zstd_compress.c index 728514ae..090c8c0e 100644 --- a/vendor/github.com/DataDog/zstd/zstd_compress.c +++ b/vendor/github.com/DataDog/zstd/zstd_compress.c @@ -179,6 +179,7 @@ static void ZSTD_freeCCtxContent(ZSTD_CCtx* cctx) size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx) { + DEBUGLOG(3, "ZSTD_freeCCtx (address: %p)", (void*)cctx); if (cctx==NULL) return 0; /* support free on NULL */ RETURN_ERROR_IF(cctx->staticSize, memory_allocation, "not compatible with static CCtx"); @@ -650,10 +651,11 @@ static size_t ZSTD_cParam_clampBounds(ZSTD_cParameter cParam, int* value) return 0; } -#define BOUNDCHECK(cParam, val) { \ - RETURN_ERROR_IF(!ZSTD_cParam_withinBounds(cParam,val), \ - parameter_outOfBound, "Param out of bounds"); \ -} +#define BOUNDCHECK(cParam, val) \ + do { \ + RETURN_ERROR_IF(!ZSTD_cParam_withinBounds(cParam,val), \ + parameter_outOfBound, "Param out of bounds"); \ + } while (0) static int ZSTD_isUpdateAuthorized(ZSTD_cParameter param) @@ -869,7 +871,7 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams, #else FORWARD_IF_ERROR(ZSTD_cParam_clampBounds(param, &value), ""); CCtxParams->nbWorkers = value; - return CCtxParams->nbWorkers; + return (size_t)(CCtxParams->nbWorkers); #endif case ZSTD_c_jobSize : @@ -893,7 +895,7 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams, #else FORWARD_IF_ERROR(ZSTD_cParam_clampBounds(ZSTD_c_overlapLog, &value), ""); CCtxParams->overlapLog = value; - return CCtxParams->overlapLog; + return (size_t)CCtxParams->overlapLog; #endif case ZSTD_c_rsyncable : @@ -903,7 +905,7 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams, #else FORWARD_IF_ERROR(ZSTD_cParam_clampBounds(ZSTD_c_overlapLog, &value), ""); CCtxParams->rsyncable = value; - return CCtxParams->rsyncable; + return (size_t)CCtxParams->rsyncable; #endif case ZSTD_c_enableDedicatedDictSearch : @@ -940,8 +942,10 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams, return CCtxParams->ldmParams.hashRateLog; case ZSTD_c_targetCBlockSize : - if (value!=0) /* 0 ==> default */ + if (value!=0) { /* 0 ==> default */ + value = MAX(value, ZSTD_TARGETCBLOCKSIZE_MIN); BOUNDCHECK(ZSTD_c_targetCBlockSize, value); + } CCtxParams->targetCBlockSize = (U32)value; return CCtxParams->targetCBlockSize; @@ -969,7 +973,7 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams, case ZSTD_c_validateSequences: BOUNDCHECK(ZSTD_c_validateSequences, value); CCtxParams->validateSequences = value; - return CCtxParams->validateSequences; + return (size_t)CCtxParams->validateSequences; case ZSTD_c_useBlockSplitter: BOUNDCHECK(ZSTD_c_useBlockSplitter, value); @@ -984,7 +988,7 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams, case ZSTD_c_deterministicRefPrefix: BOUNDCHECK(ZSTD_c_deterministicRefPrefix, value); CCtxParams->deterministicRefPrefix = !!value; - return CCtxParams->deterministicRefPrefix; + return (size_t)CCtxParams->deterministicRefPrefix; case ZSTD_c_prefetchCDictTables: BOUNDCHECK(ZSTD_c_prefetchCDictTables, value); @@ -994,7 +998,7 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams, case ZSTD_c_enableSeqProducerFallback: BOUNDCHECK(ZSTD_c_enableSeqProducerFallback, value); CCtxParams->enableMatchFinderFallback = value; - return CCtxParams->enableMatchFinderFallback; + return (size_t)CCtxParams->enableMatchFinderFallback; case ZSTD_c_maxBlockSize: if (value!=0) /* 0 ==> default */ @@ -1364,7 +1368,6 @@ size_t ZSTD_CCtx_reset(ZSTD_CCtx* cctx, ZSTD_ResetDirective reset) RETURN_ERROR_IF(cctx->streamStage != zcss_init, stage_wrong, "Reset parameters is only possible during init stage."); ZSTD_clearAllDicts(cctx); - ZSTD_memset(&cctx->externalMatchCtx, 0, sizeof(cctx->externalMatchCtx)); return ZSTD_CCtxParams_reset(&cctx->requestedParams); } return 0; @@ -1392,11 +1395,12 @@ size_t ZSTD_checkCParams(ZSTD_compressionParameters cParams) static ZSTD_compressionParameters ZSTD_clampCParams(ZSTD_compressionParameters cParams) { -# define CLAMP_TYPE(cParam, val, type) { \ - ZSTD_bounds const bounds = ZSTD_cParam_getBounds(cParam); \ - if ((int)valbounds.upperBound) val=(type)bounds.upperBound; \ - } +# define CLAMP_TYPE(cParam, val, type) \ + do { \ + ZSTD_bounds const bounds = ZSTD_cParam_getBounds(cParam); \ + if ((int)valbounds.upperBound) val=(type)bounds.upperBound; \ + } while (0) # define CLAMP(cParam, val) CLAMP_TYPE(cParam, val, unsigned) CLAMP(ZSTD_c_windowLog, cParams.windowLog); CLAMP(ZSTD_c_chainLog, cParams.chainLog); @@ -1468,6 +1472,48 @@ ZSTD_adjustCParams_internal(ZSTD_compressionParameters cPar, const U64 maxWindowResize = 1ULL << (ZSTD_WINDOWLOG_MAX-1); assert(ZSTD_checkCParams(cPar)==0); + /* Cascade the selected strategy down to the next-highest one built into + * this binary. */ +#ifdef ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR + if (cPar.strategy == ZSTD_btultra2) { + cPar.strategy = ZSTD_btultra; + } + if (cPar.strategy == ZSTD_btultra) { + cPar.strategy = ZSTD_btopt; + } +#endif +#ifdef ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR + if (cPar.strategy == ZSTD_btopt) { + cPar.strategy = ZSTD_btlazy2; + } +#endif +#ifdef ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR + if (cPar.strategy == ZSTD_btlazy2) { + cPar.strategy = ZSTD_lazy2; + } +#endif +#ifdef ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR + if (cPar.strategy == ZSTD_lazy2) { + cPar.strategy = ZSTD_lazy; + } +#endif +#ifdef ZSTD_EXCLUDE_LAZY_BLOCK_COMPRESSOR + if (cPar.strategy == ZSTD_lazy) { + cPar.strategy = ZSTD_greedy; + } +#endif +#ifdef ZSTD_EXCLUDE_GREEDY_BLOCK_COMPRESSOR + if (cPar.strategy == ZSTD_greedy) { + cPar.strategy = ZSTD_dfast; + } +#endif +#ifdef ZSTD_EXCLUDE_DFAST_BLOCK_COMPRESSOR + if (cPar.strategy == ZSTD_dfast) { + cPar.strategy = ZSTD_fast; + cPar.targetLength = 0; + } +#endif + switch (mode) { case ZSTD_cpm_unknown: case ZSTD_cpm_noAttachDict: @@ -1618,8 +1664,8 @@ ZSTD_sizeof_matchState(const ZSTD_compressionParameters* const cParams, + ZSTD_cwksp_aligned_alloc_size((MaxLL+1) * sizeof(U32)) + ZSTD_cwksp_aligned_alloc_size((MaxOff+1) * sizeof(U32)) + ZSTD_cwksp_aligned_alloc_size((1<strategy, useRowMatchFinder) ? ZSTD_cwksp_aligned_alloc_size(hSize) : 0; @@ -1708,7 +1754,7 @@ size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params) * be needed. However, we still allocate two 0-sized buffers, which can * take space under ASAN. */ return ZSTD_estimateCCtxSize_usingCCtxParams_internal( - &cParams, ¶ms->ldmParams, 1, useRowMatchFinder, 0, 0, ZSTD_CONTENTSIZE_UNKNOWN, params->useSequenceProducer, params->maxBlockSize); + &cParams, ¶ms->ldmParams, 1, useRowMatchFinder, 0, 0, ZSTD_CONTENTSIZE_UNKNOWN, ZSTD_hasExtSeqProd(params), params->maxBlockSize); } size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams) @@ -1769,7 +1815,7 @@ size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params* params) return ZSTD_estimateCCtxSize_usingCCtxParams_internal( &cParams, ¶ms->ldmParams, 1, useRowMatchFinder, inBuffSize, outBuffSize, - ZSTD_CONTENTSIZE_UNKNOWN, params->useSequenceProducer, params->maxBlockSize); + ZSTD_CONTENTSIZE_UNKNOWN, ZSTD_hasExtSeqProd(params), params->maxBlockSize); } } @@ -2002,8 +2048,8 @@ ZSTD_reset_matchState(ZSTD_matchState_t* ms, ms->opt.litLengthFreq = (unsigned*)ZSTD_cwksp_reserve_aligned(ws, (MaxLL+1) * sizeof(unsigned)); ms->opt.matchLengthFreq = (unsigned*)ZSTD_cwksp_reserve_aligned(ws, (MaxML+1) * sizeof(unsigned)); ms->opt.offCodeFreq = (unsigned*)ZSTD_cwksp_reserve_aligned(ws, (MaxOff+1) * sizeof(unsigned)); - ms->opt.matchTable = (ZSTD_match_t*)ZSTD_cwksp_reserve_aligned(ws, (ZSTD_OPT_NUM+1) * sizeof(ZSTD_match_t)); - ms->opt.priceTable = (ZSTD_optimal_t*)ZSTD_cwksp_reserve_aligned(ws, (ZSTD_OPT_NUM+1) * sizeof(ZSTD_optimal_t)); + ms->opt.matchTable = (ZSTD_match_t*)ZSTD_cwksp_reserve_aligned(ws, ZSTD_OPT_SIZE * sizeof(ZSTD_match_t)); + ms->opt.priceTable = (ZSTD_optimal_t*)ZSTD_cwksp_reserve_aligned(ws, ZSTD_OPT_SIZE * sizeof(ZSTD_optimal_t)); } ms->cParams = *cParams; @@ -2075,7 +2121,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, { size_t const windowSize = MAX(1, (size_t)MIN(((U64)1 << params->cParams.windowLog), pledgedSrcSize)); size_t const blockSize = MIN(params->maxBlockSize, windowSize); - size_t const maxNbSeq = ZSTD_maxNbSeq(blockSize, params->cParams.minMatch, params->useSequenceProducer); + size_t const maxNbSeq = ZSTD_maxNbSeq(blockSize, params->cParams.minMatch, ZSTD_hasExtSeqProd(params)); size_t const buffOutSize = (zbuff == ZSTDb_buffered && params->outBufferMode == ZSTD_bm_buffered) ? ZSTD_compressBound(blockSize) + 1 : 0; @@ -2092,8 +2138,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, size_t const neededSpace = ZSTD_estimateCCtxSize_usingCCtxParams_internal( ¶ms->cParams, ¶ms->ldmParams, zc->staticSize != 0, params->useRowMatchFinder, - buffInSize, buffOutSize, pledgedSrcSize, params->useSequenceProducer, params->maxBlockSize); - int resizeWorkspace; + buffInSize, buffOutSize, pledgedSrcSize, ZSTD_hasExtSeqProd(params), params->maxBlockSize); FORWARD_IF_ERROR(neededSpace, "cctx size estimate failed!"); @@ -2102,7 +2147,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, { /* Check if workspace is large enough, alloc a new one if needed */ int const workspaceTooSmall = ZSTD_cwksp_sizeof(ws) < neededSpace; int const workspaceWasteful = ZSTD_cwksp_check_wasteful(ws, neededSpace); - resizeWorkspace = workspaceTooSmall || workspaceWasteful; + int resizeWorkspace = workspaceTooSmall || workspaceWasteful; DEBUGLOG(4, "Need %zu B workspace", neededSpace); DEBUGLOG(4, "windowSize: %zu - blockSize: %zu", windowSize, blockSize); @@ -2177,10 +2222,10 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, } /* reserve space for block-level external sequences */ - if (params->useSequenceProducer) { + if (ZSTD_hasExtSeqProd(params)) { size_t const maxNbExternalSeq = ZSTD_sequenceBound(blockSize); - zc->externalMatchCtx.seqBufferCapacity = maxNbExternalSeq; - zc->externalMatchCtx.seqBuffer = + zc->extSeqBufCapacity = maxNbExternalSeq; + zc->extSeqBuf = (ZSTD_Sequence*)ZSTD_cwksp_reserve_aligned(ws, maxNbExternalSeq * sizeof(ZSTD_Sequence)); } @@ -2565,7 +2610,7 @@ ZSTD_reduceTable_internal (U32* const table, U32 const size, U32 const reducerVa assert(size < (1U<<31)); /* can be casted to int */ #if ZSTD_MEMORY_SANITIZER && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE) - /* To validate that the table re-use logic is sound, and that we don't + /* To validate that the table reuse logic is sound, and that we don't * access table space that we haven't cleaned, we re-"poison" the table * space every time we mark it dirty. * @@ -2993,40 +3038,43 @@ ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_paramS static const ZSTD_blockCompressor blockCompressor[4][ZSTD_STRATEGY_MAX+1] = { { ZSTD_compressBlock_fast /* default for 0 */, ZSTD_compressBlock_fast, - ZSTD_compressBlock_doubleFast, - ZSTD_compressBlock_greedy, - ZSTD_compressBlock_lazy, - ZSTD_compressBlock_lazy2, - ZSTD_compressBlock_btlazy2, - ZSTD_compressBlock_btopt, - ZSTD_compressBlock_btultra, - ZSTD_compressBlock_btultra2 }, + ZSTD_COMPRESSBLOCK_DOUBLEFAST, + ZSTD_COMPRESSBLOCK_GREEDY, + ZSTD_COMPRESSBLOCK_LAZY, + ZSTD_COMPRESSBLOCK_LAZY2, + ZSTD_COMPRESSBLOCK_BTLAZY2, + ZSTD_COMPRESSBLOCK_BTOPT, + ZSTD_COMPRESSBLOCK_BTULTRA, + ZSTD_COMPRESSBLOCK_BTULTRA2 + }, { ZSTD_compressBlock_fast_extDict /* default for 0 */, ZSTD_compressBlock_fast_extDict, - ZSTD_compressBlock_doubleFast_extDict, - ZSTD_compressBlock_greedy_extDict, - ZSTD_compressBlock_lazy_extDict, - ZSTD_compressBlock_lazy2_extDict, - ZSTD_compressBlock_btlazy2_extDict, - ZSTD_compressBlock_btopt_extDict, - ZSTD_compressBlock_btultra_extDict, - ZSTD_compressBlock_btultra_extDict }, + ZSTD_COMPRESSBLOCK_DOUBLEFAST_EXTDICT, + ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT, + ZSTD_COMPRESSBLOCK_LAZY_EXTDICT, + ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT, + ZSTD_COMPRESSBLOCK_BTLAZY2_EXTDICT, + ZSTD_COMPRESSBLOCK_BTOPT_EXTDICT, + ZSTD_COMPRESSBLOCK_BTULTRA_EXTDICT, + ZSTD_COMPRESSBLOCK_BTULTRA_EXTDICT + }, { ZSTD_compressBlock_fast_dictMatchState /* default for 0 */, ZSTD_compressBlock_fast_dictMatchState, - ZSTD_compressBlock_doubleFast_dictMatchState, - ZSTD_compressBlock_greedy_dictMatchState, - ZSTD_compressBlock_lazy_dictMatchState, - ZSTD_compressBlock_lazy2_dictMatchState, - ZSTD_compressBlock_btlazy2_dictMatchState, - ZSTD_compressBlock_btopt_dictMatchState, - ZSTD_compressBlock_btultra_dictMatchState, - ZSTD_compressBlock_btultra_dictMatchState }, + ZSTD_COMPRESSBLOCK_DOUBLEFAST_DICTMATCHSTATE, + ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE, + ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE, + ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE, + ZSTD_COMPRESSBLOCK_BTLAZY2_DICTMATCHSTATE, + ZSTD_COMPRESSBLOCK_BTOPT_DICTMATCHSTATE, + ZSTD_COMPRESSBLOCK_BTULTRA_DICTMATCHSTATE, + ZSTD_COMPRESSBLOCK_BTULTRA_DICTMATCHSTATE + }, { NULL /* default for 0 */, NULL, NULL, - ZSTD_compressBlock_greedy_dedicatedDictSearch, - ZSTD_compressBlock_lazy_dedicatedDictSearch, - ZSTD_compressBlock_lazy2_dedicatedDictSearch, + ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH, + ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH, + ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH, NULL, NULL, NULL, @@ -3039,18 +3087,26 @@ ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_paramS DEBUGLOG(4, "Selected block compressor: dictMode=%d strat=%d rowMatchfinder=%d", (int)dictMode, (int)strat, (int)useRowMatchFinder); if (ZSTD_rowMatchFinderUsed(strat, useRowMatchFinder)) { static const ZSTD_blockCompressor rowBasedBlockCompressors[4][3] = { - { ZSTD_compressBlock_greedy_row, - ZSTD_compressBlock_lazy_row, - ZSTD_compressBlock_lazy2_row }, - { ZSTD_compressBlock_greedy_extDict_row, - ZSTD_compressBlock_lazy_extDict_row, - ZSTD_compressBlock_lazy2_extDict_row }, - { ZSTD_compressBlock_greedy_dictMatchState_row, - ZSTD_compressBlock_lazy_dictMatchState_row, - ZSTD_compressBlock_lazy2_dictMatchState_row }, - { ZSTD_compressBlock_greedy_dedicatedDictSearch_row, - ZSTD_compressBlock_lazy_dedicatedDictSearch_row, - ZSTD_compressBlock_lazy2_dedicatedDictSearch_row } + { + ZSTD_COMPRESSBLOCK_GREEDY_ROW, + ZSTD_COMPRESSBLOCK_LAZY_ROW, + ZSTD_COMPRESSBLOCK_LAZY2_ROW + }, + { + ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT_ROW, + ZSTD_COMPRESSBLOCK_LAZY_EXTDICT_ROW, + ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT_ROW + }, + { + ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE_ROW, + ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE_ROW, + ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE_ROW + }, + { + ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH_ROW, + ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH_ROW, + ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH_ROW + } }; DEBUGLOG(4, "Selecting a row-based matchfinder"); assert(useRowMatchFinder != ZSTD_ps_auto); @@ -3193,7 +3249,7 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize) /* External matchfinder + LDM is technically possible, just not implemented yet. * We need to revisit soon and implement it. */ RETURN_ERROR_IF( - zc->appliedParams.useSequenceProducer, + ZSTD_hasExtSeqProd(&zc->appliedParams), parameter_combination_unsupported, "Long-distance matching with external sequence producer enabled is not currently supported." ); @@ -3212,7 +3268,7 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize) /* External matchfinder + LDM is technically possible, just not implemented yet. * We need to revisit soon and implement it. */ RETURN_ERROR_IF( - zc->appliedParams.useSequenceProducer, + ZSTD_hasExtSeqProd(&zc->appliedParams), parameter_combination_unsupported, "Long-distance matching with external sequence producer enabled is not currently supported." ); @@ -3231,18 +3287,18 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize) zc->appliedParams.useRowMatchFinder, src, srcSize); assert(ldmSeqStore.pos == ldmSeqStore.size); - } else if (zc->appliedParams.useSequenceProducer) { + } else if (ZSTD_hasExtSeqProd(&zc->appliedParams)) { assert( - zc->externalMatchCtx.seqBufferCapacity >= ZSTD_sequenceBound(srcSize) + zc->extSeqBufCapacity >= ZSTD_sequenceBound(srcSize) ); - assert(zc->externalMatchCtx.mFinder != NULL); + assert(zc->appliedParams.extSeqProdFunc != NULL); { U32 const windowSize = (U32)1 << zc->appliedParams.cParams.windowLog; - size_t const nbExternalSeqs = (zc->externalMatchCtx.mFinder)( - zc->externalMatchCtx.mState, - zc->externalMatchCtx.seqBuffer, - zc->externalMatchCtx.seqBufferCapacity, + size_t const nbExternalSeqs = (zc->appliedParams.extSeqProdFunc)( + zc->appliedParams.extSeqProdState, + zc->extSeqBuf, + zc->extSeqBufCapacity, src, srcSize, NULL, 0, /* dict and dictSize, currently not supported */ zc->appliedParams.compressionLevel, @@ -3250,21 +3306,21 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize) ); size_t const nbPostProcessedSeqs = ZSTD_postProcessSequenceProducerResult( - zc->externalMatchCtx.seqBuffer, + zc->extSeqBuf, nbExternalSeqs, - zc->externalMatchCtx.seqBufferCapacity, + zc->extSeqBufCapacity, srcSize ); /* Return early if there is no error, since we don't need to worry about last literals */ if (!ZSTD_isError(nbPostProcessedSeqs)) { ZSTD_sequencePosition seqPos = {0,0,0}; - size_t const seqLenSum = ZSTD_fastSequenceLengthSum(zc->externalMatchCtx.seqBuffer, nbPostProcessedSeqs); + size_t const seqLenSum = ZSTD_fastSequenceLengthSum(zc->extSeqBuf, nbPostProcessedSeqs); RETURN_ERROR_IF(seqLenSum > srcSize, externalSequences_invalid, "External sequences imply too large a block!"); FORWARD_IF_ERROR( ZSTD_copySequencesToSeqStoreExplicitBlockDelim( zc, &seqPos, - zc->externalMatchCtx.seqBuffer, nbPostProcessedSeqs, + zc->extSeqBuf, nbPostProcessedSeqs, src, srcSize, zc->appliedParams.searchForExternalRepcodes ), @@ -3281,9 +3337,11 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize) } /* Fallback to software matchfinder */ - { ZSTD_blockCompressor const blockCompressor = ZSTD_selectBlockCompressor(zc->appliedParams.cParams.strategy, - zc->appliedParams.useRowMatchFinder, - dictMode); + { ZSTD_blockCompressor const blockCompressor = + ZSTD_selectBlockCompressor( + zc->appliedParams.cParams.strategy, + zc->appliedParams.useRowMatchFinder, + dictMode); ms->ldmSeqStore = NULL; DEBUGLOG( 5, @@ -3293,9 +3351,10 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize) lastLLSize = blockCompressor(ms, &zc->seqStore, zc->blockState.nextCBlock->rep, src, srcSize); } } } else { /* not long range mode and no external matchfinder */ - ZSTD_blockCompressor const blockCompressor = ZSTD_selectBlockCompressor(zc->appliedParams.cParams.strategy, - zc->appliedParams.useRowMatchFinder, - dictMode); + ZSTD_blockCompressor const blockCompressor = ZSTD_selectBlockCompressor( + zc->appliedParams.cParams.strategy, + zc->appliedParams.useRowMatchFinder, + dictMode); ms->ldmSeqStore = NULL; lastLLSize = blockCompressor(ms, &zc->seqStore, zc->blockState.nextCBlock->rep, src, srcSize); } @@ -3305,29 +3364,38 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize) return ZSTDbss_compress; } -static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc) +static size_t ZSTD_copyBlockSequences(SeqCollector* seqCollector, const seqStore_t* seqStore, const U32 prevRepcodes[ZSTD_REP_NUM]) { - const seqStore_t* seqStore = ZSTD_getSeqStore(zc); - const seqDef* seqStoreSeqs = seqStore->sequencesStart; - size_t seqStoreSeqSize = seqStore->sequences - seqStoreSeqs; - size_t seqStoreLiteralsSize = (size_t)(seqStore->lit - seqStore->litStart); - size_t literalsRead = 0; - size_t lastLLSize; + const seqDef* inSeqs = seqStore->sequencesStart; + const size_t nbInSequences = seqStore->sequences - inSeqs; + const size_t nbInLiterals = (size_t)(seqStore->lit - seqStore->litStart); - ZSTD_Sequence* outSeqs = &zc->seqCollector.seqStart[zc->seqCollector.seqIndex]; + ZSTD_Sequence* outSeqs = seqCollector->seqIndex == 0 ? seqCollector->seqStart : seqCollector->seqStart + seqCollector->seqIndex; + const size_t nbOutSequences = nbInSequences + 1; + size_t nbOutLiterals = 0; + repcodes_t repcodes; size_t i; - repcodes_t updatedRepcodes; - assert(zc->seqCollector.seqIndex + 1 < zc->seqCollector.maxSequences); - /* Ensure we have enough space for last literals "sequence" */ - assert(zc->seqCollector.maxSequences >= seqStoreSeqSize + 1); - ZSTD_memcpy(updatedRepcodes.rep, zc->blockState.prevCBlock->rep, sizeof(repcodes_t)); - for (i = 0; i < seqStoreSeqSize; ++i) { - U32 rawOffset = seqStoreSeqs[i].offBase - ZSTD_REP_NUM; - outSeqs[i].litLength = seqStoreSeqs[i].litLength; - outSeqs[i].matchLength = seqStoreSeqs[i].mlBase + MINMATCH; + /* Bounds check that we have enough space for every input sequence + * and the block delimiter + */ + assert(seqCollector->seqIndex <= seqCollector->maxSequences); + RETURN_ERROR_IF( + nbOutSequences > (size_t)(seqCollector->maxSequences - seqCollector->seqIndex), + dstSize_tooSmall, + "Not enough space to copy sequences"); + + ZSTD_memcpy(&repcodes, prevRepcodes, sizeof(repcodes)); + for (i = 0; i < nbInSequences; ++i) { + U32 rawOffset; + outSeqs[i].litLength = inSeqs[i].litLength; + outSeqs[i].matchLength = inSeqs[i].mlBase + MINMATCH; outSeqs[i].rep = 0; + /* Handle the possible single length >= 64K + * There can only be one because we add MINMATCH to every match length, + * and blocks are at most 128K. + */ if (i == seqStore->longLengthPos) { if (seqStore->longLengthType == ZSTD_llt_literalLength) { outSeqs[i].litLength += 0x10000; @@ -3336,41 +3404,55 @@ static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc) } } - if (seqStoreSeqs[i].offBase <= ZSTD_REP_NUM) { - /* Derive the correct offset corresponding to a repcode */ - outSeqs[i].rep = seqStoreSeqs[i].offBase; + /* Determine the raw offset given the offBase, which may be a repcode. */ + if (OFFBASE_IS_REPCODE(inSeqs[i].offBase)) { + const U32 repcode = OFFBASE_TO_REPCODE(inSeqs[i].offBase); + assert(repcode > 0); + outSeqs[i].rep = repcode; if (outSeqs[i].litLength != 0) { - rawOffset = updatedRepcodes.rep[outSeqs[i].rep - 1]; + rawOffset = repcodes.rep[repcode - 1]; } else { - if (outSeqs[i].rep == 3) { - rawOffset = updatedRepcodes.rep[0] - 1; + if (repcode == 3) { + assert(repcodes.rep[0] > 1); + rawOffset = repcodes.rep[0] - 1; } else { - rawOffset = updatedRepcodes.rep[outSeqs[i].rep]; + rawOffset = repcodes.rep[repcode]; } } + } else { + rawOffset = OFFBASE_TO_OFFSET(inSeqs[i].offBase); } outSeqs[i].offset = rawOffset; - /* seqStoreSeqs[i].offset == offCode+1, and ZSTD_updateRep() expects offCode - so we provide seqStoreSeqs[i].offset - 1 */ - ZSTD_updateRep(updatedRepcodes.rep, - seqStoreSeqs[i].offBase, - seqStoreSeqs[i].litLength == 0); - literalsRead += outSeqs[i].litLength; + + /* Update repcode history for the sequence */ + ZSTD_updateRep(repcodes.rep, + inSeqs[i].offBase, + inSeqs[i].litLength == 0); + + nbOutLiterals += outSeqs[i].litLength; } /* Insert last literals (if any exist) in the block as a sequence with ml == off == 0. * If there are no last literals, then we'll emit (of: 0, ml: 0, ll: 0), which is a marker * for the block boundary, according to the API. */ - assert(seqStoreLiteralsSize >= literalsRead); - lastLLSize = seqStoreLiteralsSize - literalsRead; - outSeqs[i].litLength = (U32)lastLLSize; - outSeqs[i].matchLength = outSeqs[i].offset = outSeqs[i].rep = 0; - seqStoreSeqSize++; - zc->seqCollector.seqIndex += seqStoreSeqSize; + assert(nbInLiterals >= nbOutLiterals); + { + const size_t lastLLSize = nbInLiterals - nbOutLiterals; + outSeqs[nbInSequences].litLength = (U32)lastLLSize; + outSeqs[nbInSequences].matchLength = 0; + outSeqs[nbInSequences].offset = 0; + assert(nbOutSequences == nbInSequences + 1); + } + seqCollector->seqIndex += nbOutSequences; + assert(seqCollector->seqIndex <= seqCollector->maxSequences); + + return 0; } size_t ZSTD_sequenceBound(size_t srcSize) { - return (srcSize / ZSTD_MINMATCH_MIN) + 1; + const size_t maxNbSeq = (srcSize / ZSTD_MINMATCH_MIN) + 1; + const size_t maxNbDelims = (srcSize / ZSTD_BLOCKSIZE_MAX_MIN) + 1; + return maxNbSeq + maxNbDelims; } size_t ZSTD_generateSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs, @@ -3379,6 +3461,16 @@ size_t ZSTD_generateSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs, const size_t dstCapacity = ZSTD_compressBound(srcSize); void* dst = ZSTD_customMalloc(dstCapacity, ZSTD_defaultCMem); SeqCollector seqCollector; + { + int targetCBlockSize; + FORWARD_IF_ERROR(ZSTD_CCtx_getParameter(zc, ZSTD_c_targetCBlockSize, &targetCBlockSize), ""); + RETURN_ERROR_IF(targetCBlockSize != 0, parameter_unsupported, "targetCBlockSize != 0"); + } + { + int nbWorkers; + FORWARD_IF_ERROR(ZSTD_CCtx_getParameter(zc, ZSTD_c_nbWorkers, &nbWorkers), ""); + RETURN_ERROR_IF(nbWorkers != 0, parameter_unsupported, "nbWorkers != 0"); + } RETURN_ERROR_IF(dst == NULL, memory_allocation, "NULL pointer!"); @@ -3388,8 +3480,12 @@ size_t ZSTD_generateSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs, seqCollector.maxSequences = outSeqsSize; zc->seqCollector = seqCollector; - ZSTD_compress2(zc, dst, dstCapacity, src, srcSize); - ZSTD_customFree(dst, ZSTD_defaultCMem); + { + const size_t ret = ZSTD_compress2(zc, dst, dstCapacity, src, srcSize); + ZSTD_customFree(dst, ZSTD_defaultCMem); + FORWARD_IF_ERROR(ret, "ZSTD_compress2 failed"); + } + assert(zc->seqCollector.seqIndex <= ZSTD_sequenceBound(srcSize)); return zc->seqCollector.seqIndex; } @@ -3982,8 +4078,9 @@ ZSTD_compressSeqStore_singleBlock(ZSTD_CCtx* zc, cSeqsSize = 1; } + /* Sequence collection not supported when block splitting */ if (zc->seqCollector.collectSequences) { - ZSTD_copyBlockSequences(zc); + FORWARD_IF_ERROR(ZSTD_copyBlockSequences(&zc->seqCollector, seqStore, dRepOriginal.rep), "copyBlockSequences failed"); ZSTD_blockState_confirmRepcodesAndEntropyTables(&zc->blockState); return 0; } @@ -4205,6 +4302,7 @@ ZSTD_compressBlock_splitBlock(ZSTD_CCtx* zc, if (bss == ZSTDbss_noCompress) { if (zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode == FSE_repeat_valid) zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode = FSE_repeat_check; + RETURN_ERROR_IF(zc->seqCollector.collectSequences, sequenceProducer_failed, "Uncompressible block"); cSize = ZSTD_noCompressBlock(dst, dstCapacity, src, srcSize, lastBlock); FORWARD_IF_ERROR(cSize, "ZSTD_noCompressBlock failed"); DEBUGLOG(4, "ZSTD_compressBlock_splitBlock: Nocompress block"); @@ -4237,11 +4335,15 @@ ZSTD_compressBlock_internal(ZSTD_CCtx* zc, { const size_t bss = ZSTD_buildSeqStore(zc, src, srcSize); FORWARD_IF_ERROR(bss, "ZSTD_buildSeqStore failed"); - if (bss == ZSTDbss_noCompress) { cSize = 0; goto out; } + if (bss == ZSTDbss_noCompress) { + RETURN_ERROR_IF(zc->seqCollector.collectSequences, sequenceProducer_failed, "Uncompressible block"); + cSize = 0; + goto out; + } } if (zc->seqCollector.collectSequences) { - ZSTD_copyBlockSequences(zc); + FORWARD_IF_ERROR(ZSTD_copyBlockSequences(&zc->seqCollector, ZSTD_getSeqStore(zc), zc->blockState.prevCBlock->rep), "copyBlockSequences failed"); ZSTD_blockState_confirmRepcodesAndEntropyTables(&zc->blockState); return 0; } @@ -4554,19 +4656,15 @@ size_t ZSTD_writeLastEmptyBlock(void* dst, size_t dstCapacity) } } -size_t ZSTD_referenceExternalSequences(ZSTD_CCtx* cctx, rawSeq* seq, size_t nbSeq) +void ZSTD_referenceExternalSequences(ZSTD_CCtx* cctx, rawSeq* seq, size_t nbSeq) { - RETURN_ERROR_IF(cctx->stage != ZSTDcs_init, stage_wrong, - "wrong cctx stage"); - RETURN_ERROR_IF(cctx->appliedParams.ldmParams.enableLdm == ZSTD_ps_enable, - parameter_unsupported, - "incompatible with ldm"); + assert(cctx->stage == ZSTDcs_init); + assert(nbSeq == 0 || cctx->appliedParams.ldmParams.enableLdm != ZSTD_ps_enable); cctx->externSeqStore.seq = seq; cctx->externSeqStore.size = nbSeq; cctx->externSeqStore.capacity = nbSeq; cctx->externSeqStore.pos = 0; cctx->externSeqStore.posInSequence = 0; - return 0; } @@ -4761,12 +4859,19 @@ static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms, ZSTD_fillHashTable(ms, iend, dtlm, tfp); break; case ZSTD_dfast: +#ifndef ZSTD_EXCLUDE_DFAST_BLOCK_COMPRESSOR ZSTD_fillDoubleHashTable(ms, iend, dtlm, tfp); +#else + assert(0); /* shouldn't be called: cparams should've been adjusted. */ +#endif break; case ZSTD_greedy: case ZSTD_lazy: case ZSTD_lazy2: +#if !defined(ZSTD_EXCLUDE_GREEDY_BLOCK_COMPRESSOR) \ + || !defined(ZSTD_EXCLUDE_LAZY_BLOCK_COMPRESSOR) \ + || !defined(ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR) assert(srcSize >= HASH_READ_SIZE); if (ms->dedicatedDictSearch) { assert(ms->chainTable != NULL); @@ -4783,14 +4888,23 @@ static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms, DEBUGLOG(4, "Using chain-based hash table for lazy dict"); } } +#else + assert(0); /* shouldn't be called: cparams should've been adjusted. */ +#endif break; case ZSTD_btlazy2: /* we want the dictionary table fully sorted */ case ZSTD_btopt: case ZSTD_btultra: case ZSTD_btultra2: +#if !defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR) \ + || !defined(ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR) \ + || !defined(ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR) assert(srcSize >= HASH_READ_SIZE); ZSTD_updateTree(ms, iend-HASH_READ_SIZE, iend); +#else + assert(0); /* shouldn't be called: cparams should've been adjusted. */ +#endif break; default: @@ -4837,11 +4951,10 @@ size_t ZSTD_loadCEntropy(ZSTD_compressedBlockState_t* bs, void* workspace, /* We only set the loaded table as valid if it contains all non-zero * weights. Otherwise, we set it to check */ - if (!hasZeroWeights) + if (!hasZeroWeights && maxSymbolValue == 255) bs->entropy.huf.repeatMode = HUF_repeat_valid; RETURN_ERROR_IF(HUF_isError(hufHeaderSize), dictionary_corrupted, ""); - RETURN_ERROR_IF(maxSymbolValue < 255, dictionary_corrupted, ""); dictPtr += hufHeaderSize; } @@ -5108,14 +5221,13 @@ static size_t ZSTD_writeEpilogue(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity) { BYTE* const ostart = (BYTE*)dst; BYTE* op = ostart; - size_t fhSize = 0; DEBUGLOG(4, "ZSTD_writeEpilogue"); RETURN_ERROR_IF(cctx->stage == ZSTDcs_created, stage_wrong, "init missing"); /* special case : empty frame */ if (cctx->stage == ZSTDcs_init) { - fhSize = ZSTD_writeFrameHeader(dst, dstCapacity, &cctx->appliedParams, 0, 0); + size_t fhSize = ZSTD_writeFrameHeader(dst, dstCapacity, &cctx->appliedParams, 0, 0); FORWARD_IF_ERROR(fhSize, "ZSTD_writeFrameHeader failed"); dstCapacity -= fhSize; op += fhSize; @@ -5125,8 +5237,9 @@ static size_t ZSTD_writeEpilogue(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity) if (cctx->stage != ZSTDcs_ending) { /* write one last empty block, make it the "last" block */ U32 const cBlockHeader24 = 1 /* last block */ + (((U32)bt_raw)<<1) + 0; - RETURN_ERROR_IF(dstCapacity<4, dstSize_tooSmall, "no room for epilogue"); - MEM_writeLE32(op, cBlockHeader24); + ZSTD_STATIC_ASSERT(ZSTD_BLOCKHEADERSIZE == 3); + RETURN_ERROR_IF(dstCapacity<3, dstSize_tooSmall, "no room for epilogue"); + MEM_writeLE24(op, cBlockHeader24); op += ZSTD_blockHeaderSize; dstCapacity -= ZSTD_blockHeaderSize; } @@ -5456,7 +5569,7 @@ ZSTD_CDict* ZSTD_createCDict_advanced2( cctxParams.useRowMatchFinder, cctxParams.enableDedicatedDictSearch, customMem); - if (ZSTD_isError( ZSTD_initCDict_internal(cdict, + if (!cdict || ZSTD_isError( ZSTD_initCDict_internal(cdict, dict, dictSize, dictLoadMethod, dictContentType, cctxParams) )) { @@ -5880,7 +5993,7 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream* zcs, if (zcs->appliedParams.inBufferMode == ZSTD_bm_stable) { assert(input->pos >= zcs->stableIn_notConsumed); input->pos -= zcs->stableIn_notConsumed; - ip -= zcs->stableIn_notConsumed; + if (ip) ip -= zcs->stableIn_notConsumed; zcs->stableIn_notConsumed = 0; } if (zcs->appliedParams.inBufferMode == ZSTD_bm_buffered) { @@ -6139,7 +6252,7 @@ static size_t ZSTD_CCtx_init_compressStream2(ZSTD_CCtx* cctx, #ifdef ZSTD_MULTITHREAD /* If external matchfinder is enabled, make sure to fail before checking job size (for consistency) */ RETURN_ERROR_IF( - params.useSequenceProducer == 1 && params.nbWorkers >= 1, + ZSTD_hasExtSeqProd(¶ms) && params.nbWorkers >= 1, parameter_combination_unsupported, "External sequence producer isn't supported with nbWorkers >= 1" ); @@ -6431,7 +6544,7 @@ ZSTD_copySequencesToSeqStoreExplicitBlockDelim(ZSTD_CCtx* cctx, if (cctx->appliedParams.validateSequences) { seqPos->posInSrc += litLength + matchLength; FORWARD_IF_ERROR(ZSTD_validateSequence(offBase, matchLength, cctx->appliedParams.cParams.minMatch, seqPos->posInSrc, - cctx->appliedParams.cParams.windowLog, dictSize, cctx->appliedParams.useSequenceProducer), + cctx->appliedParams.cParams.windowLog, dictSize, ZSTD_hasExtSeqProd(&cctx->appliedParams)), "Sequence validation failed"); } RETURN_ERROR_IF(idx - seqPos->idx >= cctx->seqStore.maxNbSeq, externalSequences_invalid, @@ -6569,7 +6682,7 @@ ZSTD_copySequencesToSeqStoreNoBlockDelim(ZSTD_CCtx* cctx, ZSTD_sequencePosition* if (cctx->appliedParams.validateSequences) { seqPos->posInSrc += litLength + matchLength; FORWARD_IF_ERROR(ZSTD_validateSequence(offBase, matchLength, cctx->appliedParams.cParams.minMatch, seqPos->posInSrc, - cctx->appliedParams.cParams.windowLog, dictSize, cctx->appliedParams.useSequenceProducer), + cctx->appliedParams.cParams.windowLog, dictSize, ZSTD_hasExtSeqProd(&cctx->appliedParams)), "Sequence validation failed"); } DEBUGLOG(6, "Storing sequence: (of: %u, ml: %u, ll: %u)", offBase, matchLength, litLength); @@ -7015,20 +7128,28 @@ ZSTD_parameters ZSTD_getParams(int compressionLevel, unsigned long long srcSizeH } void ZSTD_registerSequenceProducer( - ZSTD_CCtx* zc, void* mState, - ZSTD_sequenceProducer_F* mFinder + ZSTD_CCtx* zc, + void* extSeqProdState, + ZSTD_sequenceProducer_F extSeqProdFunc ) { - if (mFinder != NULL) { - ZSTD_externalMatchCtx emctx; - emctx.mState = mState; - emctx.mFinder = mFinder; - emctx.seqBuffer = NULL; - emctx.seqBufferCapacity = 0; - zc->externalMatchCtx = emctx; - zc->requestedParams.useSequenceProducer = 1; + assert(zc != NULL); + ZSTD_CCtxParams_registerSequenceProducer( + &zc->requestedParams, extSeqProdState, extSeqProdFunc + ); +} + +void ZSTD_CCtxParams_registerSequenceProducer( + ZSTD_CCtx_params* params, + void* extSeqProdState, + ZSTD_sequenceProducer_F extSeqProdFunc +) { + assert(params != NULL); + if (extSeqProdFunc != NULL) { + params->extSeqProdFunc = extSeqProdFunc; + params->extSeqProdState = extSeqProdState; } else { - ZSTD_memset(&zc->externalMatchCtx, 0, sizeof(zc->externalMatchCtx)); - zc->requestedParams.useSequenceProducer = 0; + params->extSeqProdFunc = NULL; + params->extSeqProdState = NULL; } } diff --git a/vendor/github.com/DataDog/zstd/zstd_compress_internal.h b/vendor/github.com/DataDog/zstd/zstd_compress_internal.h index c3746035..9e611dfe 100644 --- a/vendor/github.com/DataDog/zstd/zstd_compress_internal.h +++ b/vendor/github.com/DataDog/zstd/zstd_compress_internal.h @@ -40,7 +40,7 @@ extern "C" { It's not a big deal though : candidate will just be sorted again. Additionally, candidate position 1 will be lost. But candidate 1 cannot hide a large tree of candidates, so it's a minimal loss. - The benefit is that ZSTD_DUBT_UNSORTED_MARK cannot be mishandled after table re-use with a different strategy. + The benefit is that ZSTD_DUBT_UNSORTED_MARK cannot be mishandled after table reuse with a different strategy. This constant is required by ZSTD_compressBlock_btlazy2() and ZSTD_reduceTable_internal() */ @@ -160,23 +160,24 @@ typedef struct { UNUSED_ATTR static const rawSeqStore_t kNullRawSeqStore = {NULL, 0, 0, 0, 0}; typedef struct { - int price; - U32 off; - U32 mlen; - U32 litlen; - U32 rep[ZSTD_REP_NUM]; + int price; /* price from beginning of segment to this position */ + U32 off; /* offset of previous match */ + U32 mlen; /* length of previous match */ + U32 litlen; /* nb of literals since previous match */ + U32 rep[ZSTD_REP_NUM]; /* offset history after previous match */ } ZSTD_optimal_t; typedef enum { zop_dynamic=0, zop_predef } ZSTD_OptPrice_e; +#define ZSTD_OPT_SIZE (ZSTD_OPT_NUM+3) typedef struct { /* All tables are allocated inside cctx->workspace by ZSTD_resetCCtx_internal() */ unsigned* litFreq; /* table of literals statistics, of size 256 */ unsigned* litLengthFreq; /* table of litLength statistics, of size (MaxLL+1) */ unsigned* matchLengthFreq; /* table of matchLength statistics, of size (MaxML+1) */ unsigned* offCodeFreq; /* table of offCode statistics, of size (MaxOff+1) */ - ZSTD_match_t* matchTable; /* list of found matches, of size ZSTD_OPT_NUM+1 */ - ZSTD_optimal_t* priceTable; /* All positions tracked by optimal parser, of size ZSTD_OPT_NUM+1 */ + ZSTD_match_t* matchTable; /* list of found matches, of size ZSTD_OPT_SIZE */ + ZSTD_optimal_t* priceTable; /* All positions tracked by optimal parser, of size ZSTD_OPT_SIZE */ U32 litSum; /* nb of literals */ U32 litLengthSum; /* nb of litLength codes */ @@ -229,7 +230,7 @@ struct ZSTD_matchState_t { U32 rowHashLog; /* For row-based matchfinder: Hashlog based on nb of rows in the hashTable.*/ BYTE* tagTable; /* For row-based matchFinder: A row-based table containing the hashes and head index. */ U32 hashCache[ZSTD_ROW_HASH_CACHE_SIZE]; /* For row-based matchFinder: a cache of hashes to improve speed */ - U64 hashSalt; /* For row-based matchFinder: salts the hash for re-use of tag table */ + U64 hashSalt; /* For row-based matchFinder: salts the hash for reuse of tag table */ U32 hashSaltEntropy; /* For row-based matchFinder: collects entropy for salt generation */ U32* hashTable; @@ -361,10 +362,11 @@ struct ZSTD_CCtx_params_s { * if the external matchfinder returns an error code. */ int enableMatchFinderFallback; - /* Indicates whether an external matchfinder has been referenced. - * Users can't set this externally. - * It is set internally in ZSTD_registerSequenceProducer(). */ - int useSequenceProducer; + /* Parameters for the external sequence producer API. + * Users set these parameters through ZSTD_registerSequenceProducer(). + * It is not possible to set these parameters individually through the public API. */ + void* extSeqProdState; + ZSTD_sequenceProducer_F extSeqProdFunc; /* Adjust the max block size*/ size_t maxBlockSize; @@ -402,14 +404,6 @@ typedef struct { ZSTD_entropyCTablesMetadata_t entropyMetadata; } ZSTD_blockSplitCtx; -/* Context for block-level external matchfinder API */ -typedef struct { - void* mState; - ZSTD_sequenceProducer_F* mFinder; - ZSTD_Sequence* seqBuffer; - size_t seqBufferCapacity; -} ZSTD_externalMatchCtx; - struct ZSTD_CCtx_s { ZSTD_compressionStage_e stage; int cParamsChanged; /* == 1 if cParams(except wlog) or compression level are changed in requestedParams. Triggers transmission of new params to ZSTDMT (if available) then reset to 0. */ @@ -480,8 +474,9 @@ struct ZSTD_CCtx_s { /* Workspace for block splitter */ ZSTD_blockSplitCtx blockSplitCtx; - /* Workspace for external matchfinder */ - ZSTD_externalMatchCtx externalMatchCtx; + /* Buffer for output from external sequence producer */ + ZSTD_Sequence* extSeqBuf; + size_t extSeqBufCapacity; }; typedef enum { ZSTD_dtlm_fast, ZSTD_dtlm_full } ZSTD_dictTableLoadMethod_e; @@ -1054,7 +1049,9 @@ MEM_STATIC U32 ZSTD_window_needOverflowCorrection(ZSTD_window_t const window, * The least significant cycleLog bits of the indices must remain the same, * which may be 0. Every index up to maxDist in the past must be valid. */ -MEM_STATIC U32 ZSTD_window_correctOverflow(ZSTD_window_t* window, U32 cycleLog, +MEM_STATIC +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +U32 ZSTD_window_correctOverflow(ZSTD_window_t* window, U32 cycleLog, U32 maxDist, void const* src) { /* preemptive overflow correction: @@ -1247,7 +1244,9 @@ MEM_STATIC void ZSTD_window_init(ZSTD_window_t* window) { * forget about the extDict. Handles overlap of the prefix and extDict. * Returns non-zero if the segment is contiguous. */ -MEM_STATIC U32 ZSTD_window_update(ZSTD_window_t* window, +MEM_STATIC +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +U32 ZSTD_window_update(ZSTD_window_t* window, void const* src, size_t srcSize, int forceNonContiguous) { @@ -1468,11 +1467,10 @@ size_t ZSTD_writeLastEmptyBlock(void* dst, size_t dstCapacity); * This cannot be used when long range matching is enabled. * Zstd will use these sequences, and pass the literals to a secondary block * compressor. - * @return : An error code on failure. * NOTE: seqs are not verified! Invalid sequences can cause out-of-bounds memory * access and data corruption. */ -size_t ZSTD_referenceExternalSequences(ZSTD_CCtx* cctx, rawSeq* seq, size_t nbSeq); +void ZSTD_referenceExternalSequences(ZSTD_CCtx* cctx, rawSeq* seq, size_t nbSeq); /** ZSTD_cycleLog() : * condition for correct operation : hashLog > 1 */ @@ -1510,6 +1508,10 @@ ZSTD_copySequencesToSeqStoreNoBlockDelim(ZSTD_CCtx* cctx, ZSTD_sequencePosition* const ZSTD_Sequence* const inSeqs, size_t inSeqsSize, const void* src, size_t blockSize, ZSTD_paramSwitch_e externalRepSearch); +/* Returns 1 if an external sequence producer is registered, otherwise returns 0. */ +MEM_STATIC int ZSTD_hasExtSeqProd(const ZSTD_CCtx_params* params) { + return params->extSeqProdFunc != NULL; +} /* =============================================================== * Deprecated definitions that are still used internally to avoid diff --git a/vendor/github.com/DataDog/zstd/zstd_compress_superblock.c b/vendor/github.com/DataDog/zstd/zstd_compress_superblock.c index 61302a4b..24413d09 100644 --- a/vendor/github.com/DataDog/zstd/zstd_compress_superblock.c +++ b/vendor/github.com/DataDog/zstd/zstd_compress_superblock.c @@ -77,8 +77,8 @@ ZSTD_compressSubBlock_literal(const HUF_CElt* hufTable, } { int const flags = bmi2 ? HUF_flags_bmi2 : 0; - const size_t cSize = singleStream ? HUF_compress1X_usingCTable(op, oend-op, literals, litSize, hufTable, flags) - : HUF_compress4X_usingCTable(op, oend-op, literals, litSize, hufTable, flags); + const size_t cSize = singleStream ? HUF_compress1X_usingCTable(op, (size_t)(oend-op), literals, litSize, hufTable, flags) + : HUF_compress4X_usingCTable(op, (size_t)(oend-op), literals, litSize, hufTable, flags); op += cSize; cLitSize += cSize; if (cSize == 0 || ERR_isError(cSize)) { @@ -103,7 +103,7 @@ ZSTD_compressSubBlock_literal(const HUF_CElt* hufTable, switch(lhSize) { case 3: /* 2 - 2 - 10 - 10 */ - { U32 const lhc = hType + ((!singleStream) << 2) + ((U32)litSize<<4) + ((U32)cLitSize<<14); + { U32 const lhc = hType + ((U32)(!singleStream) << 2) + ((U32)litSize<<4) + ((U32)cLitSize<<14); MEM_writeLE24(ostart, lhc); break; } @@ -123,30 +123,30 @@ ZSTD_compressSubBlock_literal(const HUF_CElt* hufTable, } *entropyWritten = 1; DEBUGLOG(5, "Compressed literals: %u -> %u", (U32)litSize, (U32)(op-ostart)); - return op-ostart; + return (size_t)(op-ostart); } static size_t ZSTD_seqDecompressedSize(seqStore_t const* seqStore, - const seqDef* sequences, size_t nbSeq, - size_t litSize, int lastSequence) + const seqDef* sequences, size_t nbSeqs, + size_t litSize, int lastSubBlock) { - const seqDef* const sstart = sequences; - const seqDef* const send = sequences + nbSeq; - const seqDef* sp = sstart; size_t matchLengthSum = 0; size_t litLengthSum = 0; - (void)(litLengthSum); /* suppress unused variable warning on some environments */ - while (send-sp > 0) { - ZSTD_sequenceLength const seqLen = ZSTD_getSequenceLength(seqStore, sp); + size_t n; + for (n=0; n>8) + 0x80), op[1] = (BYTE)nbSeq, op+=2; else op[0]=0xFF, MEM_writeLE16(op+1, (U16)(nbSeq - LONGNBSEQ)), op+=3; if (nbSeq==0) { - return op - ostart; + return (size_t)(op - ostart); } /* seqHead : flags for FSE encoding type */ @@ -210,7 +210,7 @@ ZSTD_compressSubBlock_sequences(const ZSTD_fseCTables_t* fseTables, } { size_t const bitstreamSize = ZSTD_encodeSequences( - op, oend - op, + op, (size_t)(oend - op), fseTables->matchlengthCTable, mlCode, fseTables->offcodeCTable, ofCode, fseTables->litlengthCTable, llCode, @@ -254,7 +254,7 @@ ZSTD_compressSubBlock_sequences(const ZSTD_fseCTables_t* fseTables, #endif *entropyWritten = 1; - return op - ostart; + return (size_t)(op - ostart); } /** ZSTD_compressSubBlock() : @@ -280,7 +280,8 @@ static size_t ZSTD_compressSubBlock(const ZSTD_entropyCTables_t* entropy, litSize, nbSeq, writeLitEntropy, writeSeqEntropy, lastBlock); { size_t cLitSize = ZSTD_compressSubBlock_literal((const HUF_CElt*)entropy->huf.CTable, &entropyMetadata->hufMetadata, literals, litSize, - op, oend-op, bmi2, writeLitEntropy, litEntropyWritten); + op, (size_t)(oend-op), + bmi2, writeLitEntropy, litEntropyWritten); FORWARD_IF_ERROR(cLitSize, "ZSTD_compressSubBlock_literal failed"); if (cLitSize == 0) return 0; op += cLitSize; @@ -290,18 +291,18 @@ static size_t ZSTD_compressSubBlock(const ZSTD_entropyCTables_t* entropy, sequences, nbSeq, llCode, mlCode, ofCode, cctxParams, - op, oend-op, + op, (size_t)(oend-op), bmi2, writeSeqEntropy, seqEntropyWritten); FORWARD_IF_ERROR(cSeqSize, "ZSTD_compressSubBlock_sequences failed"); if (cSeqSize == 0) return 0; op += cSeqSize; } /* Write block header */ - { size_t cSize = (op-ostart)-ZSTD_blockHeaderSize; + { size_t cSize = (size_t)(op-ostart) - ZSTD_blockHeaderSize; U32 const cBlockHeader24 = lastBlock + (((U32)bt_compressed)<<1) + (U32)(cSize << 3); MEM_writeLE24(ostart, cBlockHeader24); } - return op-ostart; + return (size_t)(op-ostart); } static size_t ZSTD_estimateSubBlockSize_literal(const BYTE* literals, size_t litSize, @@ -390,7 +391,11 @@ static size_t ZSTD_estimateSubBlockSize_sequences(const BYTE* ofCodeTable, return cSeqSizeEstimate + sequencesSectionHeaderSize; } -static size_t ZSTD_estimateSubBlockSize(const BYTE* literals, size_t litSize, +typedef struct { + size_t estLitSize; + size_t estBlockSize; +} EstimatedBlockSize; +static EstimatedBlockSize ZSTD_estimateSubBlockSize(const BYTE* literals, size_t litSize, const BYTE* ofCodeTable, const BYTE* llCodeTable, const BYTE* mlCodeTable, @@ -398,15 +403,17 @@ static size_t ZSTD_estimateSubBlockSize(const BYTE* literals, size_t litSize, const ZSTD_entropyCTables_t* entropy, const ZSTD_entropyCTablesMetadata_t* entropyMetadata, void* workspace, size_t wkspSize, - int writeLitEntropy, int writeSeqEntropy) { - size_t cSizeEstimate = 0; - cSizeEstimate += ZSTD_estimateSubBlockSize_literal(literals, litSize, - &entropy->huf, &entropyMetadata->hufMetadata, - workspace, wkspSize, writeLitEntropy); - cSizeEstimate += ZSTD_estimateSubBlockSize_sequences(ofCodeTable, llCodeTable, mlCodeTable, + int writeLitEntropy, int writeSeqEntropy) +{ + EstimatedBlockSize ebs; + ebs.estLitSize = ZSTD_estimateSubBlockSize_literal(literals, litSize, + &entropy->huf, &entropyMetadata->hufMetadata, + workspace, wkspSize, writeLitEntropy); + ebs.estBlockSize = ZSTD_estimateSubBlockSize_sequences(ofCodeTable, llCodeTable, mlCodeTable, nbSeq, &entropy->fse, &entropyMetadata->fseMetadata, workspace, wkspSize, writeSeqEntropy); - return cSizeEstimate + ZSTD_blockHeaderSize; + ebs.estBlockSize += ebs.estLitSize + ZSTD_blockHeaderSize; + return ebs; } static int ZSTD_needSequenceEntropyTables(ZSTD_fseCTablesMetadata_t const* fseMetadata) @@ -420,13 +427,56 @@ static int ZSTD_needSequenceEntropyTables(ZSTD_fseCTablesMetadata_t const* fseMe return 0; } +static size_t countLiterals(seqStore_t const* seqStore, const seqDef* sp, size_t seqCount) +{ + size_t n, total = 0; + assert(sp != NULL); + for (n=0; n %zu bytes", seqCount, (const void*)sp, total); + return total; +} + +#define BYTESCALE 256 + +static size_t sizeBlockSequences(const seqDef* sp, size_t nbSeqs, + size_t targetBudget, size_t avgLitCost, size_t avgSeqCost, + int firstSubBlock) +{ + size_t n, budget = 0, inSize=0; + /* entropy headers */ + size_t const headerSize = (size_t)firstSubBlock * 120 * BYTESCALE; /* generous estimate */ + assert(firstSubBlock==0 || firstSubBlock==1); + budget += headerSize; + + /* first sequence => at least one sequence*/ + budget += sp[0].litLength * avgLitCost + avgSeqCost; + if (budget > targetBudget) return 1; + inSize = sp[0].litLength + (sp[0].mlBase+MINMATCH); + + /* loop over sequences */ + for (n=1; n targetBudget) + /* though continue to expand until the sub-block is deemed compressible */ + && (budget < inSize * BYTESCALE) ) + break; + } + + return n; +} + /** ZSTD_compressSubBlock_multi() : * Breaks super-block into multiple sub-blocks and compresses them. - * Entropy will be written to the first block. - * The following blocks will use repeat mode to compress. - * All sub-blocks are compressed blocks (no raw or rle blocks). - * @return : compressed size of the super block (which is multiple ZSTD blocks) - * Or 0 if it failed to compress. */ + * Entropy will be written into the first block. + * The following blocks use repeat_mode to compress. + * Sub-blocks are all compressed, except the last one when beneficial. + * @return : compressed size of the super block (which features multiple ZSTD blocks) + * or 0 if it failed to compress. */ static size_t ZSTD_compressSubBlock_multi(const seqStore_t* seqStorePtr, const ZSTD_compressedBlockState_t* prevCBlock, ZSTD_compressedBlockState_t* nextCBlock, @@ -439,10 +489,12 @@ static size_t ZSTD_compressSubBlock_multi(const seqStore_t* seqStorePtr, { const seqDef* const sstart = seqStorePtr->sequencesStart; const seqDef* const send = seqStorePtr->sequences; - const seqDef* sp = sstart; + const seqDef* sp = sstart; /* tracks progresses within seqStorePtr->sequences */ + size_t const nbSeqs = (size_t)(send - sstart); const BYTE* const lstart = seqStorePtr->litStart; const BYTE* const lend = seqStorePtr->lit; const BYTE* lp = lstart; + size_t const nbLiterals = (size_t)(lend - lstart); BYTE const* ip = (BYTE const*)src; BYTE const* const iend = ip + srcSize; BYTE* const ostart = (BYTE*)dst; @@ -451,96 +503,152 @@ static size_t ZSTD_compressSubBlock_multi(const seqStore_t* seqStorePtr, const BYTE* llCodePtr = seqStorePtr->llCode; const BYTE* mlCodePtr = seqStorePtr->mlCode; const BYTE* ofCodePtr = seqStorePtr->ofCode; - size_t targetCBlockSize = cctxParams->targetCBlockSize; - size_t litSize, seqCount; - int writeLitEntropy = entropyMetadata->hufMetadata.hType == set_compressed; + size_t const minTarget = ZSTD_TARGETCBLOCKSIZE_MIN; /* enforce minimum size, to reduce undesirable side effects */ + size_t const targetCBlockSize = MAX(minTarget, cctxParams->targetCBlockSize); + int writeLitEntropy = (entropyMetadata->hufMetadata.hType == set_compressed); int writeSeqEntropy = 1; - int lastSequence = 0; - DEBUGLOG(5, "ZSTD_compressSubBlock_multi (litSize=%u, nbSeq=%u)", - (unsigned)(lend-lp), (unsigned)(send-sstart)); + DEBUGLOG(5, "ZSTD_compressSubBlock_multi (srcSize=%u, litSize=%u, nbSeq=%u)", + (unsigned)srcSize, (unsigned)(lend-lstart), (unsigned)(send-sstart)); - litSize = 0; - seqCount = 0; - do { - size_t cBlockSizeEstimate = 0; - if (sstart == send) { - lastSequence = 1; - } else { - const seqDef* const sequence = sp + seqCount; - lastSequence = sequence == send - 1; - litSize += ZSTD_getSequenceLength(seqStorePtr, sequence).litLength; - seqCount++; + /* let's start by a general estimation for the full block */ + if (nbSeqs > 0) { + EstimatedBlockSize const ebs = + ZSTD_estimateSubBlockSize(lp, nbLiterals, + ofCodePtr, llCodePtr, mlCodePtr, nbSeqs, + &nextCBlock->entropy, entropyMetadata, + workspace, wkspSize, + writeLitEntropy, writeSeqEntropy); + /* quick estimation */ + size_t const avgLitCost = nbLiterals ? (ebs.estLitSize * BYTESCALE) / nbLiterals : BYTESCALE; + size_t const avgSeqCost = ((ebs.estBlockSize - ebs.estLitSize) * BYTESCALE) / nbSeqs; + const size_t nbSubBlocks = MAX((ebs.estBlockSize + (targetCBlockSize/2)) / targetCBlockSize, 1); + size_t n, avgBlockBudget, blockBudgetSupp=0; + avgBlockBudget = (ebs.estBlockSize * BYTESCALE) / nbSubBlocks; + DEBUGLOG(5, "estimated fullblock size=%u bytes ; avgLitCost=%.2f ; avgSeqCost=%.2f ; targetCBlockSize=%u, nbSubBlocks=%u ; avgBlockBudget=%.0f bytes", + (unsigned)ebs.estBlockSize, (double)avgLitCost/BYTESCALE, (double)avgSeqCost/BYTESCALE, + (unsigned)targetCBlockSize, (unsigned)nbSubBlocks, (double)avgBlockBudget/BYTESCALE); + /* simplification: if estimates states that the full superblock doesn't compress, just bail out immediately + * this will result in the production of a single uncompressed block covering @srcSize.*/ + if (ebs.estBlockSize > srcSize) return 0; + + /* compress and write sub-blocks */ + assert(nbSubBlocks>0); + for (n=0; n < nbSubBlocks-1; n++) { + /* determine nb of sequences for current sub-block + nbLiterals from next sequence */ + size_t const seqCount = sizeBlockSequences(sp, (size_t)(send-sp), + avgBlockBudget + blockBudgetSupp, avgLitCost, avgSeqCost, n==0); + /* if reached last sequence : break to last sub-block (simplification) */ + assert(seqCount <= (size_t)(send-sp)); + if (sp + seqCount == send) break; + assert(seqCount > 0); + /* compress sub-block */ + { int litEntropyWritten = 0; + int seqEntropyWritten = 0; + size_t litSize = countLiterals(seqStorePtr, sp, seqCount); + const size_t decompressedSize = + ZSTD_seqDecompressedSize(seqStorePtr, sp, seqCount, litSize, 0); + size_t const cSize = ZSTD_compressSubBlock(&nextCBlock->entropy, entropyMetadata, + sp, seqCount, + lp, litSize, + llCodePtr, mlCodePtr, ofCodePtr, + cctxParams, + op, (size_t)(oend-op), + bmi2, writeLitEntropy, writeSeqEntropy, + &litEntropyWritten, &seqEntropyWritten, + 0); + FORWARD_IF_ERROR(cSize, "ZSTD_compressSubBlock failed"); + + /* check compressibility, update state components */ + if (cSize > 0 && cSize < decompressedSize) { + DEBUGLOG(5, "Committed sub-block compressing %u bytes => %u bytes", + (unsigned)decompressedSize, (unsigned)cSize); + assert(ip + decompressedSize <= iend); + ip += decompressedSize; + lp += litSize; + op += cSize; + llCodePtr += seqCount; + mlCodePtr += seqCount; + ofCodePtr += seqCount; + /* Entropy only needs to be written once */ + if (litEntropyWritten) { + writeLitEntropy = 0; + } + if (seqEntropyWritten) { + writeSeqEntropy = 0; + } + sp += seqCount; + blockBudgetSupp = 0; + } } + /* otherwise : do not compress yet, coalesce current sub-block with following one */ } - if (lastSequence) { - assert(lp <= lend); - assert(litSize <= (size_t)(lend - lp)); - litSize = (size_t)(lend - lp); - } - /* I think there is an optimization opportunity here. - * Calling ZSTD_estimateSubBlockSize for every sequence can be wasteful - * since it recalculates estimate from scratch. - * For example, it would recount literal distribution and symbol codes every time. - */ - cBlockSizeEstimate = ZSTD_estimateSubBlockSize(lp, litSize, ofCodePtr, llCodePtr, mlCodePtr, seqCount, - &nextCBlock->entropy, entropyMetadata, - workspace, wkspSize, writeLitEntropy, writeSeqEntropy); - if (cBlockSizeEstimate > targetCBlockSize || lastSequence) { - int litEntropyWritten = 0; - int seqEntropyWritten = 0; - const size_t decompressedSize = ZSTD_seqDecompressedSize(seqStorePtr, sp, seqCount, litSize, lastSequence); - const size_t cSize = ZSTD_compressSubBlock(&nextCBlock->entropy, entropyMetadata, - sp, seqCount, - lp, litSize, - llCodePtr, mlCodePtr, ofCodePtr, - cctxParams, - op, oend-op, - bmi2, writeLitEntropy, writeSeqEntropy, - &litEntropyWritten, &seqEntropyWritten, - lastBlock && lastSequence); - FORWARD_IF_ERROR(cSize, "ZSTD_compressSubBlock failed"); - if (cSize > 0 && cSize < decompressedSize) { - DEBUGLOG(5, "Committed the sub-block"); - assert(ip + decompressedSize <= iend); - ip += decompressedSize; - sp += seqCount; - lp += litSize; - op += cSize; - llCodePtr += seqCount; - mlCodePtr += seqCount; - ofCodePtr += seqCount; - litSize = 0; - seqCount = 0; - /* Entropy only needs to be written once */ - if (litEntropyWritten) { - writeLitEntropy = 0; - } - if (seqEntropyWritten) { - writeSeqEntropy = 0; - } + } /* if (nbSeqs > 0) */ + + /* write last block */ + DEBUGLOG(5, "Generate last sub-block: %u sequences remaining", (unsigned)(send - sp)); + { int litEntropyWritten = 0; + int seqEntropyWritten = 0; + size_t litSize = (size_t)(lend - lp); + size_t seqCount = (size_t)(send - sp); + const size_t decompressedSize = + ZSTD_seqDecompressedSize(seqStorePtr, sp, seqCount, litSize, 1); + size_t const cSize = ZSTD_compressSubBlock(&nextCBlock->entropy, entropyMetadata, + sp, seqCount, + lp, litSize, + llCodePtr, mlCodePtr, ofCodePtr, + cctxParams, + op, (size_t)(oend-op), + bmi2, writeLitEntropy, writeSeqEntropy, + &litEntropyWritten, &seqEntropyWritten, + lastBlock); + FORWARD_IF_ERROR(cSize, "ZSTD_compressSubBlock failed"); + + /* update pointers, the nb of literals borrowed from next sequence must be preserved */ + if (cSize > 0 && cSize < decompressedSize) { + DEBUGLOG(5, "Last sub-block compressed %u bytes => %u bytes", + (unsigned)decompressedSize, (unsigned)cSize); + assert(ip + decompressedSize <= iend); + ip += decompressedSize; + lp += litSize; + op += cSize; + llCodePtr += seqCount; + mlCodePtr += seqCount; + ofCodePtr += seqCount; + /* Entropy only needs to be written once */ + if (litEntropyWritten) { + writeLitEntropy = 0; } + if (seqEntropyWritten) { + writeSeqEntropy = 0; + } + sp += seqCount; } - } while (!lastSequence); + } + + if (writeLitEntropy) { - DEBUGLOG(5, "ZSTD_compressSubBlock_multi has literal entropy tables unwritten"); + DEBUGLOG(5, "Literal entropy tables were never written"); ZSTD_memcpy(&nextCBlock->entropy.huf, &prevCBlock->entropy.huf, sizeof(prevCBlock->entropy.huf)); } if (writeSeqEntropy && ZSTD_needSequenceEntropyTables(&entropyMetadata->fseMetadata)) { /* If we haven't written our entropy tables, then we've violated our contract and * must emit an uncompressed block. */ - DEBUGLOG(5, "ZSTD_compressSubBlock_multi has sequence entropy tables unwritten"); + DEBUGLOG(5, "Sequence entropy tables were never written => cancel, emit an uncompressed block"); return 0; } + if (ip < iend) { - size_t const cSize = ZSTD_noCompressBlock(op, oend - op, ip, iend - ip, lastBlock); - DEBUGLOG(5, "ZSTD_compressSubBlock_multi last sub-block uncompressed, %zu bytes", (size_t)(iend - ip)); + /* some data left : last part of the block sent uncompressed */ + size_t const rSize = (size_t)((iend - ip)); + size_t const cSize = ZSTD_noCompressBlock(op, (size_t)(oend - op), ip, rSize, lastBlock); + DEBUGLOG(5, "Generate last uncompressed sub-block of %u bytes", (unsigned)(rSize)); FORWARD_IF_ERROR(cSize, "ZSTD_noCompressBlock failed"); assert(cSize != 0); op += cSize; /* We have to regenerate the repcodes because we've skipped some sequences */ if (sp < send) { - seqDef const* seq; + const seqDef* seq; repcodes_t rep; ZSTD_memcpy(&rep, prevCBlock->rep, sizeof(rep)); for (seq = sstart; seq < sp; ++seq) { @@ -549,14 +657,17 @@ static size_t ZSTD_compressSubBlock_multi(const seqStore_t* seqStorePtr, ZSTD_memcpy(nextCBlock->rep, &rep, sizeof(rep)); } } - DEBUGLOG(5, "ZSTD_compressSubBlock_multi compressed"); - return op-ostart; + + DEBUGLOG(5, "ZSTD_compressSubBlock_multi compressed all subBlocks: total compressed size = %u", + (unsigned)(op-ostart)); + return (size_t)(op-ostart); } size_t ZSTD_compressSuperBlock(ZSTD_CCtx* zc, void* dst, size_t dstCapacity, - void const* src, size_t srcSize, - unsigned lastBlock) { + const void* src, size_t srcSize, + unsigned lastBlock) +{ ZSTD_entropyCTablesMetadata_t entropyMetadata; FORWARD_IF_ERROR(ZSTD_buildBlockEntropyStats(&zc->seqStore, diff --git a/vendor/github.com/DataDog/zstd/zstd_cwksp.h b/vendor/github.com/DataDog/zstd/zstd_cwksp.h index a2746c53..7440db30 100644 --- a/vendor/github.com/DataDog/zstd/zstd_cwksp.h +++ b/vendor/github.com/DataDog/zstd/zstd_cwksp.h @@ -193,6 +193,7 @@ MEM_STATIC void ZSTD_cwksp_assert_internal_consistency(ZSTD_cwksp* ws) { { intptr_t const offset = __msan_test_shadow(ws->initOnceStart, (U8*)ZSTD_cwksp_initialAllocStart(ws) - (U8*)ws->initOnceStart); + (void)offset; #if defined(ZSTD_MSAN_PRINT) if(offset!=-1) { __msan_print_shadow((U8*)ws->initOnceStart + offset - 8, 32); @@ -434,7 +435,7 @@ MEM_STATIC void* ZSTD_cwksp_reserve_aligned(ZSTD_cwksp* ws, size_t bytes) /** * Aligned on 64 bytes. These buffers have the special property that - * their values remain constrained, allowing us to re-use them without + * their values remain constrained, allowing us to reuse them without * memset()-ing them. */ MEM_STATIC void* ZSTD_cwksp_reserve_table(ZSTD_cwksp* ws, size_t bytes) @@ -526,7 +527,7 @@ MEM_STATIC void ZSTD_cwksp_mark_tables_dirty(ZSTD_cwksp* ws) DEBUGLOG(4, "cwksp: ZSTD_cwksp_mark_tables_dirty"); #if ZSTD_MEMORY_SANITIZER && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE) - /* To validate that the table re-use logic is sound, and that we don't + /* To validate that the table reuse logic is sound, and that we don't * access table space that we haven't cleaned, we re-"poison" the table * space every time we mark it dirty. * Since tableValidEnd space and initOnce space may overlap we don't poison @@ -603,9 +604,9 @@ MEM_STATIC void ZSTD_cwksp_clear(ZSTD_cwksp* ws) { DEBUGLOG(4, "cwksp: clearing!"); #if ZSTD_MEMORY_SANITIZER && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE) - /* To validate that the context re-use logic is sound, and that we don't + /* To validate that the context reuse logic is sound, and that we don't * access stuff that this compression hasn't initialized, we re-"poison" - * the workspace except for the areas in which we expect memory re-use + * the workspace except for the areas in which we expect memory reuse * without initialization (objects, valid tables area and init once * memory). */ { @@ -636,6 +637,15 @@ MEM_STATIC void ZSTD_cwksp_clear(ZSTD_cwksp* ws) { ZSTD_cwksp_assert_internal_consistency(ws); } +MEM_STATIC size_t ZSTD_cwksp_sizeof(const ZSTD_cwksp* ws) { + return (size_t)((BYTE*)ws->workspaceEnd - (BYTE*)ws->workspace); +} + +MEM_STATIC size_t ZSTD_cwksp_used(const ZSTD_cwksp* ws) { + return (size_t)((BYTE*)ws->tableEnd - (BYTE*)ws->workspace) + + (size_t)((BYTE*)ws->workspaceEnd - (BYTE*)ws->allocStart); +} + /** * The provided workspace takes ownership of the buffer [start, start+size). * Any existing values in the workspace are ignored (the previously managed @@ -667,6 +677,11 @@ MEM_STATIC size_t ZSTD_cwksp_create(ZSTD_cwksp* ws, size_t size, ZSTD_customMem MEM_STATIC void ZSTD_cwksp_free(ZSTD_cwksp* ws, ZSTD_customMem customMem) { void *ptr = ws->workspace; DEBUGLOG(4, "cwksp: freeing workspace"); +#if ZSTD_MEMORY_SANITIZER && !defined(ZSTD_MSAN_DONT_POISON_WORKSPACE) + if (ptr != NULL && customMem.customFree != NULL) { + __msan_unpoison(ptr, ZSTD_cwksp_sizeof(ws)); + } +#endif ZSTD_memset(ws, 0, sizeof(ZSTD_cwksp)); ZSTD_customFree(ptr, customMem); } @@ -680,15 +695,6 @@ MEM_STATIC void ZSTD_cwksp_move(ZSTD_cwksp* dst, ZSTD_cwksp* src) { ZSTD_memset(src, 0, sizeof(ZSTD_cwksp)); } -MEM_STATIC size_t ZSTD_cwksp_sizeof(const ZSTD_cwksp* ws) { - return (size_t)((BYTE*)ws->workspaceEnd - (BYTE*)ws->workspace); -} - -MEM_STATIC size_t ZSTD_cwksp_used(const ZSTD_cwksp* ws) { - return (size_t)((BYTE*)ws->tableEnd - (BYTE*)ws->workspace) - + (size_t)((BYTE*)ws->workspaceEnd - (BYTE*)ws->allocStart); -} - MEM_STATIC int ZSTD_cwksp_reserve_failed(const ZSTD_cwksp* ws) { return ws->allocFailed; } diff --git a/vendor/github.com/DataDog/zstd/zstd_decompress.c b/vendor/github.com/DataDog/zstd/zstd_decompress.c index d48e87be..565e6d1a 100644 --- a/vendor/github.com/DataDog/zstd/zstd_decompress.c +++ b/vendor/github.com/DataDog/zstd/zstd_decompress.c @@ -56,18 +56,19 @@ /*-******************************************************* * Dependencies *********************************************************/ -#include "allocations.h" /* ZSTD_customMalloc, ZSTD_customCalloc, ZSTD_customFree */ #include "zstd_deps.h" /* ZSTD_memcpy, ZSTD_memmove, ZSTD_memset */ +#include "allocations.h" /* ZSTD_customMalloc, ZSTD_customCalloc, ZSTD_customFree */ +#include "error_private.h" +#include "zstd_internal.h" /* blockProperties_t */ #include "mem.h" /* low level memory routines */ +#include "bits.h" /* ZSTD_highbit32 */ #define FSE_STATIC_LINKING_ONLY #include "fse.h" #include "huf.h" #include "xxhash.h" /* XXH64_reset, XXH64_update, XXH64_digest, XXH64 */ -#include "zstd_internal.h" /* blockProperties_t */ #include "zstd_decompress_internal.h" /* ZSTD_DCtx */ #include "zstd_ddict.h" /* ZSTD_DDictDictContent */ #include "zstd_decompress_block.h" /* ZSTD_decompressBlock_internal */ -#include "bits.h" /* ZSTD_highbit32 */ #if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1) #include "zstd_legacy.h" @@ -246,6 +247,7 @@ static void ZSTD_DCtx_resetParameters(ZSTD_DCtx* dctx) dctx->forceIgnoreChecksum = ZSTD_d_validateChecksum; dctx->refMultipleDDicts = ZSTD_rmd_refSingleDDict; dctx->disableHufAsm = 0; + dctx->maxBlockSizeParam = 0; } static void ZSTD_initDCtx_internal(ZSTD_DCtx* dctx) @@ -266,6 +268,7 @@ static void ZSTD_initDCtx_internal(ZSTD_DCtx* dctx) #endif dctx->noForwardProgress = 0; dctx->oversizedDuration = 0; + dctx->isFrameDecompression = 1; #if DYNAMIC_BMI2 dctx->bmi2 = ZSTD_cpuSupportsBmi2(); #endif @@ -727,17 +730,17 @@ static ZSTD_frameSizeInfo ZSTD_errorFrameSizeInfo(size_t ret) return frameSizeInfo; } -static ZSTD_frameSizeInfo ZSTD_findFrameSizeInfo(const void* src, size_t srcSize) +static ZSTD_frameSizeInfo ZSTD_findFrameSizeInfo(const void* src, size_t srcSize, ZSTD_format_e format) { ZSTD_frameSizeInfo frameSizeInfo; ZSTD_memset(&frameSizeInfo, 0, sizeof(ZSTD_frameSizeInfo)); #if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1) - if (ZSTD_isLegacy(src, srcSize)) + if (format == ZSTD_f_zstd1 && ZSTD_isLegacy(src, srcSize)) return ZSTD_findFrameSizeInfoLegacy(src, srcSize); #endif - if ((srcSize >= ZSTD_SKIPPABLEHEADERSIZE) + if (format == ZSTD_f_zstd1 && (srcSize >= ZSTD_SKIPPABLEHEADERSIZE) && (MEM_readLE32(src) & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) { frameSizeInfo.compressedSize = readSkippableFrameSize(src, srcSize); assert(ZSTD_isError(frameSizeInfo.compressedSize) || @@ -751,7 +754,7 @@ static ZSTD_frameSizeInfo ZSTD_findFrameSizeInfo(const void* src, size_t srcSize ZSTD_frameHeader zfh; /* Extract Frame Header */ - { size_t const ret = ZSTD_getFrameHeader(&zfh, src, srcSize); + { size_t const ret = ZSTD_getFrameHeader_advanced(&zfh, src, srcSize, format); if (ZSTD_isError(ret)) return ZSTD_errorFrameSizeInfo(ret); if (ret > 0) @@ -794,15 +797,17 @@ static ZSTD_frameSizeInfo ZSTD_findFrameSizeInfo(const void* src, size_t srcSize } } +static size_t ZSTD_findFrameCompressedSize_advanced(const void *src, size_t srcSize, ZSTD_format_e format) { + ZSTD_frameSizeInfo const frameSizeInfo = ZSTD_findFrameSizeInfo(src, srcSize, format); + return frameSizeInfo.compressedSize; +} + /** ZSTD_findFrameCompressedSize() : - * compatible with legacy mode - * `src` must point to the start of a ZSTD frame, ZSTD legacy frame, or skippable frame - * `srcSize` must be at least as large as the frame contained - * @return : the compressed size of the frame starting at `src` */ + * See docs in zstd.h + * Note: compatible with legacy mode */ size_t ZSTD_findFrameCompressedSize(const void *src, size_t srcSize) { - ZSTD_frameSizeInfo const frameSizeInfo = ZSTD_findFrameSizeInfo(src, srcSize); - return frameSizeInfo.compressedSize; + return ZSTD_findFrameCompressedSize_advanced(src, srcSize, ZSTD_f_zstd1); } /** ZSTD_decompressBound() : @@ -816,7 +821,7 @@ unsigned long long ZSTD_decompressBound(const void* src, size_t srcSize) unsigned long long bound = 0; /* Iterate over each frame */ while (srcSize > 0) { - ZSTD_frameSizeInfo const frameSizeInfo = ZSTD_findFrameSizeInfo(src, srcSize); + ZSTD_frameSizeInfo const frameSizeInfo = ZSTD_findFrameSizeInfo(src, srcSize, ZSTD_f_zstd1); size_t const compressedSize = frameSizeInfo.compressedSize; unsigned long long const decompressedBound = frameSizeInfo.decompressedBound; if (ZSTD_isError(compressedSize) || decompressedBound == ZSTD_CONTENTSIZE_ERROR) @@ -836,7 +841,7 @@ size_t ZSTD_decompressionMargin(void const* src, size_t srcSize) /* Iterate over each frame */ while (srcSize > 0) { - ZSTD_frameSizeInfo const frameSizeInfo = ZSTD_findFrameSizeInfo(src, srcSize); + ZSTD_frameSizeInfo const frameSizeInfo = ZSTD_findFrameSizeInfo(src, srcSize, ZSTD_f_zstd1); size_t const compressedSize = frameSizeInfo.compressedSize; unsigned long long const decompressedBound = frameSizeInfo.decompressedBound; ZSTD_frameHeader zfh; @@ -972,6 +977,10 @@ static size_t ZSTD_decompressFrame(ZSTD_DCtx* dctx, ip += frameHeaderSize; remainingSrcSize -= frameHeaderSize; } + /* Shrink the blockSizeMax if enabled */ + if (dctx->maxBlockSizeParam != 0) + dctx->fParams.blockSizeMax = MIN(dctx->fParams.blockSizeMax, (unsigned)dctx->maxBlockSizeParam); + /* Loop on each block */ while (1) { BYTE* oBlockEnd = oend; @@ -1004,7 +1013,8 @@ static size_t ZSTD_decompressFrame(ZSTD_DCtx* dctx, switch(blockProperties.blockType) { case bt_compressed: - decodedSize = ZSTD_decompressBlock_internal(dctx, op, (size_t)(oBlockEnd-op), ip, cBlockSize, /* frame */ 1, not_streaming); + assert(dctx->isFrameDecompression == 1); + decodedSize = ZSTD_decompressBlock_internal(dctx, op, (size_t)(oBlockEnd-op), ip, cBlockSize, not_streaming); break; case bt_raw : /* Use oend instead of oBlockEnd because this function is safe to overlap. It uses memmove. */ @@ -1017,12 +1027,14 @@ static size_t ZSTD_decompressFrame(ZSTD_DCtx* dctx, default: RETURN_ERROR(corruption_detected, "invalid block type"); } - - if (ZSTD_isError(decodedSize)) return decodedSize; - if (dctx->validateChecksum) + FORWARD_IF_ERROR(decodedSize, "Block decompression failure"); + DEBUGLOG(5, "Decompressed block of dSize = %u", (unsigned)decodedSize); + if (dctx->validateChecksum) { XXH64_update(&dctx->xxhState, op, decodedSize); - if (decodedSize != 0) + } + if (decodedSize) /* support dst = NULL,0 */ { op += decodedSize; + } assert(ip != NULL); ip += cBlockSize; remainingSrcSize -= cBlockSize; @@ -1052,7 +1064,9 @@ static size_t ZSTD_decompressFrame(ZSTD_DCtx* dctx, return (size_t)(op-ostart); } -static size_t ZSTD_decompressMultiFrame(ZSTD_DCtx* dctx, +static +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +size_t ZSTD_decompressMultiFrame(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize, const void* dict, size_t dictSize, @@ -1072,7 +1086,7 @@ static size_t ZSTD_decompressMultiFrame(ZSTD_DCtx* dctx, while (srcSize >= ZSTD_startingInputLength(dctx->format)) { #if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1) - if (ZSTD_isLegacy(src, srcSize)) { + if (dctx->format == ZSTD_f_zstd1 && ZSTD_isLegacy(src, srcSize)) { size_t decodedSize; size_t const frameSize = ZSTD_findFrameCompressedSizeLegacy(src, srcSize); if (ZSTD_isError(frameSize)) return frameSize; @@ -1082,6 +1096,15 @@ static size_t ZSTD_decompressMultiFrame(ZSTD_DCtx* dctx, decodedSize = ZSTD_decompressLegacy(dst, dstCapacity, src, frameSize, dict, dictSize); if (ZSTD_isError(decodedSize)) return decodedSize; + { + unsigned long long const expectedSize = ZSTD_getFrameContentSize(src, srcSize); + RETURN_ERROR_IF(expectedSize == ZSTD_CONTENTSIZE_ERROR, corruption_detected, "Corrupted frame header!"); + if (expectedSize != ZSTD_CONTENTSIZE_UNKNOWN) { + RETURN_ERROR_IF(expectedSize != decodedSize, corruption_detected, + "Frame header size does not match decoded size!"); + } + } + assert(decodedSize <= dstCapacity); dst = (BYTE*)dst + decodedSize; dstCapacity -= decodedSize; @@ -1093,7 +1116,7 @@ static size_t ZSTD_decompressMultiFrame(ZSTD_DCtx* dctx, } #endif - if (srcSize >= 4) { + if (dctx->format == ZSTD_f_zstd1 && srcSize >= 4) { U32 const magicNumber = MEM_readLE32(src); DEBUGLOG(5, "reading magic number %08X", (unsigned)magicNumber); if ((magicNumber & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) { @@ -1320,7 +1343,8 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, c { case bt_compressed: DEBUGLOG(5, "ZSTD_decompressContinue: case bt_compressed"); - rSize = ZSTD_decompressBlock_internal(dctx, dst, dstCapacity, src, srcSize, /* frame */ 1, is_streaming); + assert(dctx->isFrameDecompression == 1); + rSize = ZSTD_decompressBlock_internal(dctx, dst, dstCapacity, src, srcSize, is_streaming); dctx->expected = 0; /* Streaming not supported */ break; case bt_raw : @@ -1389,6 +1413,7 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, c case ZSTDds_decodeSkippableHeader: assert(src != NULL); assert(srcSize <= ZSTD_SKIPPABLEHEADERSIZE); + assert(dctx->format != ZSTD_f_zstd1_magicless); ZSTD_memcpy(dctx->headerBuffer + (ZSTD_SKIPPABLEHEADERSIZE - srcSize), src, srcSize); /* complete skippable header */ dctx->expected = MEM_readLE32(dctx->headerBuffer + ZSTD_FRAMEIDSIZE); /* note : dctx->expected can grow seriously large, beyond local buffer size */ dctx->stage = ZSTDds_skipFrame; @@ -1549,6 +1574,7 @@ size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx) dctx->litEntropy = dctx->fseEntropy = 0; dctx->dictID = 0; dctx->bType = bt_reserved; + dctx->isFrameDecompression = 1; ZSTD_STATIC_ASSERT(sizeof(dctx->entropy.rep) == sizeof(repStartValue)); ZSTD_memcpy(dctx->entropy.rep, repStartValue, sizeof(repStartValue)); /* initial repcodes */ dctx->LLTptr = dctx->entropy.LLTable; @@ -1820,6 +1846,10 @@ ZSTD_bounds ZSTD_dParam_getBounds(ZSTD_dParameter dParam) bounds.lowerBound = 0; bounds.upperBound = 1; return bounds; + case ZSTD_d_maxBlockSize: + bounds.lowerBound = ZSTD_BLOCKSIZE_MAX_MIN; + bounds.upperBound = ZSTD_BLOCKSIZE_MAX; + return bounds; default:; } @@ -1864,6 +1894,9 @@ size_t ZSTD_DCtx_getParameter(ZSTD_DCtx* dctx, ZSTD_dParameter param, int* value case ZSTD_d_disableHuffmanAssembly: *value = (int)dctx->disableHufAsm; return 0; + case ZSTD_d_maxBlockSize: + *value = dctx->maxBlockSizeParam; + return 0; default:; } RETURN_ERROR(parameter_unsupported, ""); @@ -1901,6 +1934,10 @@ size_t ZSTD_DCtx_setParameter(ZSTD_DCtx* dctx, ZSTD_dParameter dParam, int value CHECK_DBOUNDS(ZSTD_d_disableHuffmanAssembly, value); dctx->disableHufAsm = value != 0; return 0; + case ZSTD_d_maxBlockSize: + if (value != 0) CHECK_DBOUNDS(ZSTD_d_maxBlockSize, value); + dctx->maxBlockSizeParam = value; + return 0; default:; } RETURN_ERROR(parameter_unsupported, ""); @@ -1912,6 +1949,7 @@ size_t ZSTD_DCtx_reset(ZSTD_DCtx* dctx, ZSTD_ResetDirective reset) || (reset == ZSTD_reset_session_and_parameters) ) { dctx->streamStage = zdss_init; dctx->noForwardProgress = 0; + dctx->isFrameDecompression = 1; } if ( (reset == ZSTD_reset_parameters) || (reset == ZSTD_reset_session_and_parameters) ) { @@ -1928,11 +1966,17 @@ size_t ZSTD_sizeof_DStream(const ZSTD_DStream* dctx) return ZSTD_sizeof_DCtx(dctx); } -size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long long frameContentSize) +static size_t ZSTD_decodingBufferSize_internal(unsigned long long windowSize, unsigned long long frameContentSize, size_t blockSizeMax) { - size_t const blockSize = (size_t) MIN(windowSize, ZSTD_BLOCKSIZE_MAX); - /* space is needed to store the litbuffer after the output of a given block without stomping the extDict of a previous run, as well as to cover both windows against wildcopy*/ - unsigned long long const neededRBSize = windowSize + blockSize + ZSTD_BLOCKSIZE_MAX + (WILDCOPY_OVERLENGTH * 2); + size_t const blockSize = MIN((size_t)MIN(windowSize, ZSTD_BLOCKSIZE_MAX), blockSizeMax); + /* We need blockSize + WILDCOPY_OVERLENGTH worth of buffer so that if a block + * ends at windowSize + WILDCOPY_OVERLENGTH + 1 bytes, we can start writing + * the block at the beginning of the output buffer, and maintain a full window. + * + * We need another blockSize worth of buffer so that we can store split + * literals at the end of the block without overwriting the extDict window. + */ + unsigned long long const neededRBSize = windowSize + (blockSize * 2) + (WILDCOPY_OVERLENGTH * 2); unsigned long long const neededSize = MIN(frameContentSize, neededRBSize); size_t const minRBSize = (size_t) neededSize; RETURN_ERROR_IF((unsigned long long)minRBSize != neededSize, @@ -1940,6 +1984,11 @@ size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long return minRBSize; } +size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long long frameContentSize) +{ + return ZSTD_decodingBufferSize_internal(windowSize, frameContentSize, ZSTD_BLOCKSIZE_MAX); +} + size_t ZSTD_estimateDStreamSize(size_t windowSize) { size_t const blockSize = MIN(windowSize, ZSTD_BLOCKSIZE_MAX); @@ -2135,12 +2184,12 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB if (zds->fParams.frameContentSize != ZSTD_CONTENTSIZE_UNKNOWN && zds->fParams.frameType != ZSTD_skippableFrame && (U64)(size_t)(oend-op) >= zds->fParams.frameContentSize) { - size_t const cSize = ZSTD_findFrameCompressedSize(istart, (size_t)(iend-istart)); + size_t const cSize = ZSTD_findFrameCompressedSize_advanced(istart, (size_t)(iend-istart), zds->format); if (cSize <= (size_t)(iend-istart)) { /* shortcut : using single-pass mode */ size_t const decompressedSize = ZSTD_decompress_usingDDict(zds, op, (size_t)(oend-op), istart, cSize, ZSTD_getDDict(zds)); if (ZSTD_isError(decompressedSize)) return decompressedSize; - DEBUGLOG(4, "shortcut to single-pass ZSTD_decompress_usingDDict()") + DEBUGLOG(4, "shortcut to single-pass ZSTD_decompress_usingDDict()"); assert(istart != NULL); ip = istart + cSize; op = op ? op + decompressedSize : op; /* can occur if frameContentSize = 0 (empty frame) */ @@ -2162,7 +2211,8 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB DEBUGLOG(4, "Consume header"); FORWARD_IF_ERROR(ZSTD_decompressBegin_usingDDict(zds, ZSTD_getDDict(zds)), ""); - if ((MEM_readLE32(zds->headerBuffer) & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) { /* skippable frame */ + if (zds->format == ZSTD_f_zstd1 + && (MEM_readLE32(zds->headerBuffer) & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) { /* skippable frame */ zds->expected = MEM_readLE32(zds->headerBuffer + ZSTD_FRAMEIDSIZE); zds->stage = ZSTDds_skipFrame; } else { @@ -2178,11 +2228,13 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB zds->fParams.windowSize = MAX(zds->fParams.windowSize, 1U << ZSTD_WINDOWLOG_ABSOLUTEMIN); RETURN_ERROR_IF(zds->fParams.windowSize > zds->maxWindowSize, frameParameter_windowTooLarge, ""); + if (zds->maxBlockSizeParam != 0) + zds->fParams.blockSizeMax = MIN(zds->fParams.blockSizeMax, (unsigned)zds->maxBlockSizeParam); /* Adapt buffer sizes to frame header instructions */ { size_t const neededInBuffSize = MAX(zds->fParams.blockSizeMax, 4 /* frame checksum */); size_t const neededOutBuffSize = zds->outBufferMode == ZSTD_bm_buffered - ? ZSTD_decodingBufferSize_min(zds->fParams.windowSize, zds->fParams.frameContentSize) + ? ZSTD_decodingBufferSize_internal(zds->fParams.windowSize, zds->fParams.frameContentSize, zds->fParams.blockSizeMax) : 0; ZSTD_DCtx_updateOversizedDuration(zds, neededInBuffSize, neededOutBuffSize); diff --git a/vendor/github.com/DataDog/zstd/zstd_decompress_block.c b/vendor/github.com/DataDog/zstd/zstd_decompress_block.c index 98767b14..1f6cf7b3 100644 --- a/vendor/github.com/DataDog/zstd/zstd_decompress_block.c +++ b/vendor/github.com/DataDog/zstd/zstd_decompress_block.c @@ -52,6 +52,13 @@ static void ZSTD_copy4(void* dst, const void* src) { ZSTD_memcpy(dst, src, 4); } * Block decoding ***************************************************************/ +static size_t ZSTD_blockSizeMax(ZSTD_DCtx const* dctx) +{ + size_t const blockSizeMax = dctx->isFrameDecompression ? dctx->fParams.blockSizeMax : ZSTD_BLOCKSIZE_MAX; + assert(blockSizeMax <= ZSTD_BLOCKSIZE_MAX); + return blockSizeMax; +} + /*! ZSTD_getcBlockSize() : * Provides the size of compressed block from block header `src` */ size_t ZSTD_getcBlockSize(const void* src, size_t srcSize, @@ -74,41 +81,49 @@ size_t ZSTD_getcBlockSize(const void* src, size_t srcSize, static void ZSTD_allocateLiteralsBuffer(ZSTD_DCtx* dctx, void* const dst, const size_t dstCapacity, const size_t litSize, const streaming_operation streaming, const size_t expectedWriteSize, const unsigned splitImmediately) { - if (streaming == not_streaming && dstCapacity > ZSTD_BLOCKSIZE_MAX + WILDCOPY_OVERLENGTH + litSize + WILDCOPY_OVERLENGTH) - { - /* room for litbuffer to fit without read faulting */ - dctx->litBuffer = (BYTE*)dst + ZSTD_BLOCKSIZE_MAX + WILDCOPY_OVERLENGTH; + size_t const blockSizeMax = ZSTD_blockSizeMax(dctx); + assert(litSize <= blockSizeMax); + assert(dctx->isFrameDecompression || streaming == not_streaming); + assert(expectedWriteSize <= blockSizeMax); + if (streaming == not_streaming && dstCapacity > blockSizeMax + WILDCOPY_OVERLENGTH + litSize + WILDCOPY_OVERLENGTH) { + /* If we aren't streaming, we can just put the literals after the output + * of the current block. We don't need to worry about overwriting the + * extDict of our window, because it doesn't exist. + * So if we have space after the end of the block, just put it there. + */ + dctx->litBuffer = (BYTE*)dst + blockSizeMax + WILDCOPY_OVERLENGTH; dctx->litBufferEnd = dctx->litBuffer + litSize; dctx->litBufferLocation = ZSTD_in_dst; - } - else if (litSize > ZSTD_LITBUFFEREXTRASIZE) - { - /* won't fit in litExtraBuffer, so it will be split between end of dst and extra buffer */ + } else if (litSize <= ZSTD_LITBUFFEREXTRASIZE) { + /* Literals fit entirely within the extra buffer, put them there to avoid + * having to split the literals. + */ + dctx->litBuffer = dctx->litExtraBuffer; + dctx->litBufferEnd = dctx->litBuffer + litSize; + dctx->litBufferLocation = ZSTD_not_in_dst; + } else { + assert(blockSizeMax > ZSTD_LITBUFFEREXTRASIZE); + /* Literals must be split between the output block and the extra lit + * buffer. We fill the extra lit buffer with the tail of the literals, + * and put the rest of the literals at the end of the block, with + * WILDCOPY_OVERLENGTH of buffer room to allow for overreads. + * This MUST not write more than our maxBlockSize beyond dst, because in + * streaming mode, that could overwrite part of our extDict window. + */ if (splitImmediately) { /* won't fit in litExtraBuffer, so it will be split between end of dst and extra buffer */ dctx->litBuffer = (BYTE*)dst + expectedWriteSize - litSize + ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH; dctx->litBufferEnd = dctx->litBuffer + litSize - ZSTD_LITBUFFEREXTRASIZE; - } - else { + } else { /* initially this will be stored entirely in dst during huffman decoding, it will partially be shifted to litExtraBuffer after */ dctx->litBuffer = (BYTE*)dst + expectedWriteSize - litSize; dctx->litBufferEnd = (BYTE*)dst + expectedWriteSize; } dctx->litBufferLocation = ZSTD_split; - } - else - { - /* fits entirely within litExtraBuffer, so no split is necessary */ - dctx->litBuffer = dctx->litExtraBuffer; - dctx->litBufferEnd = dctx->litBuffer + litSize; - dctx->litBufferLocation = ZSTD_not_in_dst; + assert(dctx->litBufferEnd <= (BYTE*)dst + expectedWriteSize); } } -/* Hidden declaration for fullbench */ -size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, - const void* src, size_t srcSize, - void* dst, size_t dstCapacity, const streaming_operation streaming); /*! ZSTD_decodeLiteralsBlock() : * Where it is possible to do so without being stomped by the output during decompression, the literals block will be stored * in the dstBuffer. If there is room to do so, it will be stored in full in the excess dst space after where the current @@ -117,7 +132,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, * * @return : nb of bytes read from src (< srcSize ) * note : symbol not declared but exposed for fullbench */ -size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, +static size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, const void* src, size_t srcSize, /* note : srcSize < BLOCKSIZE */ void* dst, size_t dstCapacity, const streaming_operation streaming) { @@ -126,6 +141,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, { const BYTE* const istart = (const BYTE*) src; symbolEncodingType_e const litEncType = (symbolEncodingType_e)(istart[0] & 3); + size_t const blockSizeMax = ZSTD_blockSizeMax(dctx); switch(litEncType) { @@ -141,7 +157,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, U32 const lhlCode = (istart[0] >> 2) & 3; U32 const lhc = MEM_readLE32(istart); size_t hufSuccess; - size_t expectedWriteSize = MIN(ZSTD_BLOCKSIZE_MAX, dstCapacity); + size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity); int const flags = 0 | (ZSTD_DCtx_get_bmi2(dctx) ? HUF_flags_bmi2 : 0) | (dctx->disableHufAsm ? HUF_flags_disableAsm : 0); @@ -168,7 +184,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, break; } RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled"); - RETURN_ERROR_IF(litSize > ZSTD_BLOCKSIZE_MAX, corruption_detected, ""); + RETURN_ERROR_IF(litSize > blockSizeMax, corruption_detected, ""); if (!singleStream) RETURN_ERROR_IF(litSize < MIN_LITERALS_FOR_4_STREAMS, literals_headerWrong, "Not enough literals (%zu) for the 4-streams mode (min %u)", @@ -215,10 +231,12 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, } if (dctx->litBufferLocation == ZSTD_split) { + assert(litSize > ZSTD_LITBUFFEREXTRASIZE); ZSTD_memcpy(dctx->litExtraBuffer, dctx->litBufferEnd - ZSTD_LITBUFFEREXTRASIZE, ZSTD_LITBUFFEREXTRASIZE); ZSTD_memmove(dctx->litBuffer + ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH, dctx->litBuffer, litSize - ZSTD_LITBUFFEREXTRASIZE); dctx->litBuffer += ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH; dctx->litBufferEnd -= WILDCOPY_OVERLENGTH; + assert(dctx->litBufferEnd <= (BYTE*)dst + blockSizeMax); } RETURN_ERROR_IF(HUF_isError(hufSuccess), corruption_detected, ""); @@ -233,7 +251,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, case set_basic: { size_t litSize, lhSize; U32 const lhlCode = ((istart[0]) >> 2) & 3; - size_t expectedWriteSize = MIN(ZSTD_BLOCKSIZE_MAX, dstCapacity); + size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity); switch(lhlCode) { case 0: case 2: default: /* note : default is impossible, since lhlCode into [0..3] */ @@ -252,6 +270,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, } RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled"); + RETURN_ERROR_IF(litSize > blockSizeMax, corruption_detected, ""); RETURN_ERROR_IF(expectedWriteSize < litSize, dstSize_tooSmall, ""); ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 1); if (lhSize+litSize+WILDCOPY_OVERLENGTH > srcSize) { /* risk reading beyond src buffer with wildcopy */ @@ -280,7 +299,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, case set_rle: { U32 const lhlCode = ((istart[0]) >> 2) & 3; size_t litSize, lhSize; - size_t expectedWriteSize = MIN(ZSTD_BLOCKSIZE_MAX, dstCapacity); + size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity); switch(lhlCode) { case 0: case 2: default: /* note : default is impossible, since lhlCode into [0..3] */ @@ -299,7 +318,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, break; } RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled"); - RETURN_ERROR_IF(litSize > ZSTD_BLOCKSIZE_MAX, corruption_detected, ""); + RETURN_ERROR_IF(litSize > blockSizeMax, corruption_detected, ""); RETURN_ERROR_IF(expectedWriteSize < litSize, dstSize_tooSmall, ""); ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 1); if (dctx->litBufferLocation == ZSTD_split) @@ -321,6 +340,18 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, } } +/* Hidden declaration for fullbench */ +size_t ZSTD_decodeLiteralsBlock_wrapper(ZSTD_DCtx* dctx, + const void* src, size_t srcSize, + void* dst, size_t dstCapacity); +size_t ZSTD_decodeLiteralsBlock_wrapper(ZSTD_DCtx* dctx, + const void* src, size_t srcSize, + void* dst, size_t dstCapacity) +{ + dctx->isFrameDecompression = 0; + return ZSTD_decodeLiteralsBlock(dctx, src, srcSize, dst, dstCapacity, not_streaming); +} + /* Default FSE distribution tables. * These are pre-calculated FSE decoding tables using default distributions as defined in specification : * https://github.com/facebook/zstd/blob/release/doc/zstd_compression_format.md#default-distributions @@ -676,11 +707,6 @@ size_t ZSTD_decodeSeqHeaders(ZSTD_DCtx* dctx, int* nbSeqPtr, /* SeqHead */ nbSeq = *ip++; - if (!nbSeq) { - *nbSeqPtr=0; - RETURN_ERROR_IF(srcSize != 1, srcSize_wrong, ""); - return 1; - } if (nbSeq > 0x7F) { if (nbSeq == 0xFF) { RETURN_ERROR_IF(ip+2 > iend, srcSize_wrong, ""); @@ -693,8 +719,16 @@ size_t ZSTD_decodeSeqHeaders(ZSTD_DCtx* dctx, int* nbSeqPtr, } *nbSeqPtr = nbSeq; + if (nbSeq == 0) { + /* No sequence : section ends immediately */ + RETURN_ERROR_IF(ip != iend, corruption_detected, + "extraneous data present in the Sequences section"); + return (size_t)(ip - istart); + } + /* FSE table descriptors */ RETURN_ERROR_IF(ip+1 > iend, srcSize_wrong, ""); /* minimum possible size: 1 byte for symbol encoding types */ + RETURN_ERROR_IF(*ip & 3, corruption_detected, ""); /* The last field, Reserved, must be all-zeroes. */ { symbolEncodingType_e const LLtype = (symbolEncodingType_e)(*ip >> 6); symbolEncodingType_e const OFtype = (symbolEncodingType_e)((*ip >> 4) & 3); symbolEncodingType_e const MLtype = (symbolEncodingType_e)((*ip >> 2) & 3); @@ -841,7 +875,7 @@ static void ZSTD_safecopy(BYTE* op, const BYTE* const oend_w, BYTE const* ip, pt /* ZSTD_safecopyDstBeforeSrc(): * This version allows overlap with dst before src, or handles the non-overlap case with dst after src * Kept separate from more common ZSTD_safecopy case to avoid performance impact to the safecopy common case */ -static void ZSTD_safecopyDstBeforeSrc(BYTE* op, BYTE const* ip, ptrdiff_t length) { +static void ZSTD_safecopyDstBeforeSrc(BYTE* op, const BYTE* ip, ptrdiff_t length) { ptrdiff_t const diff = op - ip; BYTE* const oend = op + length; @@ -870,6 +904,7 @@ static void ZSTD_safecopyDstBeforeSrc(BYTE* op, BYTE const* ip, ptrdiff_t length * to be optimized for many small sequences, since those fall into ZSTD_execSequence(). */ FORCE_NOINLINE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_execSequenceEnd(BYTE* op, BYTE* const oend, seq_t sequence, const BYTE** litPtr, const BYTE* const litLimit, @@ -917,6 +952,7 @@ size_t ZSTD_execSequenceEnd(BYTE* op, * This version is intended to be used during instances where the litBuffer is still split. It is kept separate to avoid performance impact for the good case. */ FORCE_NOINLINE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_execSequenceEndSplitLitBuffer(BYTE* op, BYTE* const oend, const BYTE* const oend_w, seq_t sequence, const BYTE** litPtr, const BYTE* const litLimit, @@ -962,6 +998,7 @@ size_t ZSTD_execSequenceEndSplitLitBuffer(BYTE* op, } HINT_INLINE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_execSequence(BYTE* op, BYTE* const oend, seq_t sequence, const BYTE** litPtr, const BYTE* const litLimit, @@ -1060,6 +1097,7 @@ size_t ZSTD_execSequence(BYTE* op, } HINT_INLINE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_execSequenceSplitLitBuffer(BYTE* op, BYTE* const oend, const BYTE* const oend_w, seq_t sequence, const BYTE** litPtr, const BYTE* const litLimit, @@ -1182,14 +1220,20 @@ ZSTD_updateFseStateWithDInfo(ZSTD_fseState* DStatePtr, BIT_DStream_t* bitD, U16 typedef enum { ZSTD_lo_isRegularOffset, ZSTD_lo_isLongOffset=1 } ZSTD_longOffset_e; +/** + * ZSTD_decodeSequence(): + * @p longOffsets : tells the decoder to reload more bit while decoding large offsets + * only used in 32-bit mode + * @return : Sequence (litL + matchL + offset) + */ FORCE_INLINE_TEMPLATE seq_t -ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets) +ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets, const int isLastSeq) { seq_t seq; /* - * ZSTD_seqSymbol is a structure with a total of 64 bits wide. So it can be - * loaded in one operation and extracted its fields by simply shifting or - * bit-extracting on aarch64. + * ZSTD_seqSymbol is a 64 bits wide structure. + * It can be loaded in one operation + * and its fields extracted by simply shifting or bit-extracting on aarch64. * GCC doesn't recognize this and generates more unnecessary ldr/ldrb/ldrh * operations that cause performance drop. This can be avoided by using this * ZSTD_memcpy hack. @@ -1262,7 +1306,7 @@ ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets) } else { offset = ofBase + ll0 + BIT_readBitsFast(&seqState->DStream, 1); { size_t temp = (offset==3) ? seqState->prevOffset[0] - 1 : seqState->prevOffset[offset]; - temp += !temp; /* 0 is not valid; input is corrupted; force offset to 1 */ + temp -= !temp; /* 0 is not valid: input corrupted => force offset to -1 => corruption detected at execSequence */ if (offset != 1) seqState->prevOffset[2] = seqState->prevOffset[1]; seqState->prevOffset[1] = seqState->prevOffset[0]; seqState->prevOffset[0] = offset = temp; @@ -1289,17 +1333,22 @@ ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets) DEBUGLOG(6, "seq: litL=%u, matchL=%u, offset=%u", (U32)seq.litLength, (U32)seq.matchLength, (U32)seq.offset); - ZSTD_updateFseStateWithDInfo(&seqState->stateLL, &seqState->DStream, llNext, llnbBits); /* <= 9 bits */ - ZSTD_updateFseStateWithDInfo(&seqState->stateML, &seqState->DStream, mlNext, mlnbBits); /* <= 9 bits */ - if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream); /* <= 18 bits */ - ZSTD_updateFseStateWithDInfo(&seqState->stateOffb, &seqState->DStream, ofNext, ofnbBits); /* <= 8 bits */ + if (!isLastSeq) { + /* don't update FSE state for last Sequence */ + ZSTD_updateFseStateWithDInfo(&seqState->stateLL, &seqState->DStream, llNext, llnbBits); /* <= 9 bits */ + ZSTD_updateFseStateWithDInfo(&seqState->stateML, &seqState->DStream, mlNext, mlnbBits); /* <= 9 bits */ + if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream); /* <= 18 bits */ + ZSTD_updateFseStateWithDInfo(&seqState->stateOffb, &seqState->DStream, ofNext, ofnbBits); /* <= 8 bits */ + BIT_reloadDStream(&seqState->DStream); + } } return seq; } -#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -MEM_STATIC int ZSTD_dictionaryIsActive(ZSTD_DCtx const* dctx, BYTE const* prefixStart, BYTE const* oLitEnd) +#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) +#if DEBUGLEVEL >= 1 +static int ZSTD_dictionaryIsActive(ZSTD_DCtx const* dctx, BYTE const* prefixStart, BYTE const* oLitEnd) { size_t const windowSize = dctx->fParams.windowSize; /* No dictionary used. */ @@ -1313,30 +1362,33 @@ MEM_STATIC int ZSTD_dictionaryIsActive(ZSTD_DCtx const* dctx, BYTE const* prefix /* Dictionary is active. */ return 1; } +#endif -MEM_STATIC void ZSTD_assertValidSequence( +static void ZSTD_assertValidSequence( ZSTD_DCtx const* dctx, BYTE const* op, BYTE const* oend, seq_t const seq, BYTE const* prefixStart, BYTE const* virtualStart) { #if DEBUGLEVEL >= 1 - size_t const windowSize = dctx->fParams.windowSize; - size_t const sequenceSize = seq.litLength + seq.matchLength; - BYTE const* const oLitEnd = op + seq.litLength; - DEBUGLOG(6, "Checking sequence: litL=%u matchL=%u offset=%u", - (U32)seq.litLength, (U32)seq.matchLength, (U32)seq.offset); - assert(op <= oend); - assert((size_t)(oend - op) >= sequenceSize); - assert(sequenceSize <= ZSTD_BLOCKSIZE_MAX); - if (ZSTD_dictionaryIsActive(dctx, prefixStart, oLitEnd)) { - size_t const dictSize = (size_t)((char const*)dctx->dictContentEndForFuzzing - (char const*)dctx->dictContentBeginForFuzzing); - /* Offset must be within the dictionary. */ - assert(seq.offset <= (size_t)(oLitEnd - virtualStart)); - assert(seq.offset <= windowSize + dictSize); - } else { - /* Offset must be within our window. */ - assert(seq.offset <= windowSize); + if (dctx->isFrameDecompression) { + size_t const windowSize = dctx->fParams.windowSize; + size_t const sequenceSize = seq.litLength + seq.matchLength; + BYTE const* const oLitEnd = op + seq.litLength; + DEBUGLOG(6, "Checking sequence: litL=%u matchL=%u offset=%u", + (U32)seq.litLength, (U32)seq.matchLength, (U32)seq.offset); + assert(op <= oend); + assert((size_t)(oend - op) >= sequenceSize); + assert(sequenceSize <= ZSTD_blockSizeMax(dctx)); + if (ZSTD_dictionaryIsActive(dctx, prefixStart, oLitEnd)) { + size_t const dictSize = (size_t)((char const*)dctx->dictContentEndForFuzzing - (char const*)dctx->dictContentBeginForFuzzing); + /* Offset must be within the dictionary. */ + assert(seq.offset <= (size_t)(oLitEnd - virtualStart)); + assert(seq.offset <= windowSize + dictSize); + } else { + /* Offset must be within our window. */ + assert(seq.offset <= windowSize); + } } #else (void)dctx, (void)op, (void)oend, (void)seq, (void)prefixStart, (void)virtualStart; @@ -1352,23 +1404,21 @@ DONT_VECTORIZE ZSTD_decompressSequences_bodySplitLitBuffer( ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset, - const int frame) + const ZSTD_longOffset_e isLongOffset) { const BYTE* ip = (const BYTE*)seqStart; const BYTE* const iend = ip + seqSize; BYTE* const ostart = (BYTE*)dst; - BYTE* const oend = ostart + maxDstSize; + BYTE* const oend = ZSTD_maybeNullPtrAdd(ostart, maxDstSize); BYTE* op = ostart; const BYTE* litPtr = dctx->litPtr; const BYTE* litBufferEnd = dctx->litBufferEnd; const BYTE* const prefixStart = (const BYTE*) (dctx->prefixStart); const BYTE* const vBase = (const BYTE*) (dctx->virtualStart); const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd); - DEBUGLOG(5, "ZSTD_decompressSequences_bodySplitLitBuffer"); - (void)frame; + DEBUGLOG(5, "ZSTD_decompressSequences_bodySplitLitBuffer (%i seqs)", nbSeq); - /* Regen sequences */ + /* Literals are split between internal buffer & output buffer */ if (nbSeq) { seqState_t seqState; dctx->fseEntropy = 1; @@ -1387,8 +1437,7 @@ ZSTD_decompressSequences_bodySplitLitBuffer( ZSTD_DCtx* dctx, BIT_DStream_completed < BIT_DStream_overflow); /* decompress without overrunning litPtr begins */ - { - seq_t sequence = ZSTD_decodeSequence(&seqState, isLongOffset); + { seq_t sequence = {0,0,0}; /* some static analyzer believe that @sequence is not initialized (it necessarily is, since for(;;) loop as at least one iteration) */ /* Align the decompression loop to 32 + 16 bytes. * * zstd compiled with gcc-9 on an Intel i9-9900k shows 10% decompression @@ -1450,27 +1499,26 @@ ZSTD_decompressSequences_bodySplitLitBuffer( ZSTD_DCtx* dctx, #endif /* Handle the initial state where litBuffer is currently split between dst and litExtraBuffer */ - for (; litPtr + sequence.litLength <= dctx->litBufferEnd; ) { - size_t const oneSeqSize = ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequence.litLength - WILDCOPY_OVERLENGTH, sequence, &litPtr, litBufferEnd, prefixStart, vBase, dictEnd); + for ( ; nbSeq; nbSeq--) { + sequence = ZSTD_decodeSequence(&seqState, isLongOffset, nbSeq==1); + if (litPtr + sequence.litLength > dctx->litBufferEnd) break; + { size_t const oneSeqSize = ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequence.litLength - WILDCOPY_OVERLENGTH, sequence, &litPtr, litBufferEnd, prefixStart, vBase, dictEnd); #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) - assert(!ZSTD_isError(oneSeqSize)); - if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase); + assert(!ZSTD_isError(oneSeqSize)); + ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase); #endif - if (UNLIKELY(ZSTD_isError(oneSeqSize))) - return oneSeqSize; - DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize); - op += oneSeqSize; - if (UNLIKELY(!--nbSeq)) - break; - BIT_reloadDStream(&(seqState.DStream)); - sequence = ZSTD_decodeSequence(&seqState, isLongOffset); - } + if (UNLIKELY(ZSTD_isError(oneSeqSize))) + return oneSeqSize; + DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize); + op += oneSeqSize; + } } + DEBUGLOG(6, "reached: (litPtr + sequence.litLength > dctx->litBufferEnd)"); /* If there are more sequences, they will need to read literals from litExtraBuffer; copy over the remainder from dst and update litPtr and litEnd */ if (nbSeq > 0) { const size_t leftoverLit = dctx->litBufferEnd - litPtr; - if (leftoverLit) - { + DEBUGLOG(6, "There are %i sequences left, and %zu/%zu literals left in buffer", nbSeq, leftoverLit, sequence.litLength); + if (leftoverLit) { RETURN_ERROR_IF(leftoverLit > (size_t)(oend - op), dstSize_tooSmall, "remaining lit must fit within dstBuffer"); ZSTD_safecopyDstBeforeSrc(op, litPtr, leftoverLit); sequence.litLength -= leftoverLit; @@ -1479,24 +1527,22 @@ ZSTD_decompressSequences_bodySplitLitBuffer( ZSTD_DCtx* dctx, litPtr = dctx->litExtraBuffer; litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE; dctx->litBufferLocation = ZSTD_not_in_dst; - { - size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequence, &litPtr, litBufferEnd, prefixStart, vBase, dictEnd); + { size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequence, &litPtr, litBufferEnd, prefixStart, vBase, dictEnd); #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) assert(!ZSTD_isError(oneSeqSize)); - if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase); + ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase); #endif if (UNLIKELY(ZSTD_isError(oneSeqSize))) return oneSeqSize; DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize); op += oneSeqSize; - if (--nbSeq) - BIT_reloadDStream(&(seqState.DStream)); } + nbSeq--; } } - if (nbSeq > 0) /* there is remaining lit from extra buffer */ - { + if (nbSeq > 0) { + /* there is remaining lit from extra buffer */ #if defined(__GNUC__) && defined(__x86_64__) __asm__(".p2align 6"); @@ -1515,35 +1561,34 @@ ZSTD_decompressSequences_bodySplitLitBuffer( ZSTD_DCtx* dctx, # endif #endif - for (; ; ) { - seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset); + for ( ; nbSeq ; nbSeq--) { + seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset, nbSeq==1); size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequence, &litPtr, litBufferEnd, prefixStart, vBase, dictEnd); #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) assert(!ZSTD_isError(oneSeqSize)); - if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase); + ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase); #endif if (UNLIKELY(ZSTD_isError(oneSeqSize))) return oneSeqSize; DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize); op += oneSeqSize; - if (UNLIKELY(!--nbSeq)) - break; - BIT_reloadDStream(&(seqState.DStream)); } } /* check if reached exact end */ DEBUGLOG(5, "ZSTD_decompressSequences_bodySplitLitBuffer: after decode loop, remaining nbSeq : %i", nbSeq); RETURN_ERROR_IF(nbSeq, corruption_detected, ""); - RETURN_ERROR_IF(BIT_reloadDStream(&seqState.DStream) < BIT_DStream_completed, corruption_detected, ""); + DEBUGLOG(5, "bitStream : start=%p, ptr=%p, bitsConsumed=%u", seqState.DStream.start, seqState.DStream.ptr, seqState.DStream.bitsConsumed); + RETURN_ERROR_IF(!BIT_endOfDStream(&seqState.DStream), corruption_detected, ""); /* save reps for next block */ { U32 i; for (i=0; ientropy.rep[i] = (U32)(seqState.prevOffset[i]); } } /* last literal segment */ - if (dctx->litBufferLocation == ZSTD_split) /* split hasn't been reached yet, first get dst then copy litExtraBuffer */ - { - size_t const lastLLSize = litBufferEnd - litPtr; + if (dctx->litBufferLocation == ZSTD_split) { + /* split hasn't been reached yet, first get dst then copy litExtraBuffer */ + size_t const lastLLSize = (size_t)(litBufferEnd - litPtr); + DEBUGLOG(6, "copy last literals from segment : %u", (U32)lastLLSize); RETURN_ERROR_IF(lastLLSize > (size_t)(oend - op), dstSize_tooSmall, ""); if (op != NULL) { ZSTD_memmove(op, litPtr, lastLLSize); @@ -1553,15 +1598,17 @@ ZSTD_decompressSequences_bodySplitLitBuffer( ZSTD_DCtx* dctx, litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE; dctx->litBufferLocation = ZSTD_not_in_dst; } - { size_t const lastLLSize = litBufferEnd - litPtr; + /* copy last literals from internal buffer */ + { size_t const lastLLSize = (size_t)(litBufferEnd - litPtr); + DEBUGLOG(6, "copy last literals from internal buffer : %u", (U32)lastLLSize); RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall, ""); if (op != NULL) { ZSTD_memcpy(op, litPtr, lastLLSize); op += lastLLSize; - } - } + } } - return op-ostart; + DEBUGLOG(6, "decoded block of size %u bytes", (U32)(op - ostart)); + return (size_t)(op - ostart); } FORCE_INLINE_TEMPLATE size_t @@ -1569,13 +1616,12 @@ DONT_VECTORIZE ZSTD_decompressSequences_body(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset, - const int frame) + const ZSTD_longOffset_e isLongOffset) { const BYTE* ip = (const BYTE*)seqStart; const BYTE* const iend = ip + seqSize; BYTE* const ostart = (BYTE*)dst; - BYTE* const oend = dctx->litBufferLocation == ZSTD_not_in_dst ? ostart + maxDstSize : dctx->litBuffer; + BYTE* const oend = dctx->litBufferLocation == ZSTD_not_in_dst ? ZSTD_maybeNullPtrAdd(ostart, maxDstSize) : dctx->litBuffer; BYTE* op = ostart; const BYTE* litPtr = dctx->litPtr; const BYTE* const litEnd = litPtr + dctx->litSize; @@ -1583,7 +1629,6 @@ ZSTD_decompressSequences_body(ZSTD_DCtx* dctx, const BYTE* const vBase = (const BYTE*)(dctx->virtualStart); const BYTE* const dictEnd = (const BYTE*)(dctx->dictEnd); DEBUGLOG(5, "ZSTD_decompressSequences_body: nbSeq = %d", nbSeq); - (void)frame; /* Regen sequences */ if (nbSeq) { @@ -1598,11 +1643,6 @@ ZSTD_decompressSequences_body(ZSTD_DCtx* dctx, ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr); assert(dst != NULL); - ZSTD_STATIC_ASSERT( - BIT_DStream_unfinished < BIT_DStream_completed && - BIT_DStream_endOfBuffer < BIT_DStream_completed && - BIT_DStream_completed < BIT_DStream_overflow); - #if defined(__GNUC__) && defined(__x86_64__) __asm__(".p2align 6"); __asm__("nop"); @@ -1617,73 +1657,70 @@ ZSTD_decompressSequences_body(ZSTD_DCtx* dctx, # endif #endif - for ( ; ; ) { - seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset); + for ( ; nbSeq ; nbSeq--) { + seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset, nbSeq==1); size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequence, &litPtr, litEnd, prefixStart, vBase, dictEnd); #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) assert(!ZSTD_isError(oneSeqSize)); - if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase); + ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase); #endif if (UNLIKELY(ZSTD_isError(oneSeqSize))) return oneSeqSize; DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize); op += oneSeqSize; - if (UNLIKELY(!--nbSeq)) - break; - BIT_reloadDStream(&(seqState.DStream)); } /* check if reached exact end */ - DEBUGLOG(5, "ZSTD_decompressSequences_body: after decode loop, remaining nbSeq : %i", nbSeq); - RETURN_ERROR_IF(nbSeq, corruption_detected, ""); - RETURN_ERROR_IF(BIT_reloadDStream(&seqState.DStream) < BIT_DStream_completed, corruption_detected, ""); + assert(nbSeq == 0); + RETURN_ERROR_IF(!BIT_endOfDStream(&seqState.DStream), corruption_detected, ""); /* save reps for next block */ { U32 i; for (i=0; ientropy.rep[i] = (U32)(seqState.prevOffset[i]); } } /* last literal segment */ - { size_t const lastLLSize = litEnd - litPtr; + { size_t const lastLLSize = (size_t)(litEnd - litPtr); + DEBUGLOG(6, "copy last literals : %u", (U32)lastLLSize); RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall, ""); if (op != NULL) { ZSTD_memcpy(op, litPtr, lastLLSize); op += lastLLSize; - } - } + } } - return op-ostart; + DEBUGLOG(6, "decoded block of size %u bytes", (U32)(op - ostart)); + return (size_t)(op - ostart); } static size_t ZSTD_decompressSequences_default(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset, - const int frame) + const ZSTD_longOffset_e isLongOffset) { - return ZSTD_decompressSequences_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); + return ZSTD_decompressSequences_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); } static size_t ZSTD_decompressSequencesSplitLitBuffer_default(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset, - const int frame) + const ZSTD_longOffset_e isLongOffset) { - return ZSTD_decompressSequences_bodySplitLitBuffer(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); + return ZSTD_decompressSequences_bodySplitLitBuffer(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); } #endif /* ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG */ #ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT -FORCE_INLINE_TEMPLATE size_t -ZSTD_prefetchMatch(size_t prefetchPos, seq_t const sequence, +FORCE_INLINE_TEMPLATE + +size_t ZSTD_prefetchMatch(size_t prefetchPos, seq_t const sequence, const BYTE* const prefixStart, const BYTE* const dictEnd) { prefetchPos += sequence.litLength; { const BYTE* const matchBase = (sequence.offset > prefetchPos) ? dictEnd : prefixStart; - const BYTE* const match = matchBase + prefetchPos - sequence.offset; /* note : this operation can overflow when seq.offset is really too large, which can only happen when input is corrupted. - * No consequence though : memory address is only used for prefetching, not for dereferencing */ + /* note : this operation can overflow when seq.offset is really too large, which can only happen when input is corrupted. + * No consequence though : memory address is only used for prefetching, not for dereferencing */ + const BYTE* const match = ZSTD_wrappedPtrSub(ZSTD_wrappedPtrAdd(matchBase, prefetchPos), sequence.offset); PREFETCH_L1(match); PREFETCH_L1(match+CACHELINE_SIZE); /* note : it's safe to invoke PREFETCH() on any memory address, including invalid ones */ } return prefetchPos + sequence.matchLength; @@ -1698,20 +1735,18 @@ ZSTD_decompressSequencesLong_body( ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset, - const int frame) + const ZSTD_longOffset_e isLongOffset) { const BYTE* ip = (const BYTE*)seqStart; const BYTE* const iend = ip + seqSize; BYTE* const ostart = (BYTE*)dst; - BYTE* const oend = dctx->litBufferLocation == ZSTD_in_dst ? dctx->litBuffer : ostart + maxDstSize; + BYTE* const oend = dctx->litBufferLocation == ZSTD_in_dst ? dctx->litBuffer : ZSTD_maybeNullPtrAdd(ostart, maxDstSize); BYTE* op = ostart; const BYTE* litPtr = dctx->litPtr; const BYTE* litBufferEnd = dctx->litBufferEnd; const BYTE* const prefixStart = (const BYTE*) (dctx->prefixStart); const BYTE* const dictStart = (const BYTE*) (dctx->virtualStart); const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd); - (void)frame; /* Regen sequences */ if (nbSeq) { @@ -1736,20 +1771,17 @@ ZSTD_decompressSequencesLong_body( ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr); /* prepare in advance */ - for (seqNb=0; (BIT_reloadDStream(&seqState.DStream) <= BIT_DStream_completed) && (seqNblitBufferLocation == ZSTD_split && litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength > dctx->litBufferEnd) - { + if (dctx->litBufferLocation == ZSTD_split && litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength > dctx->litBufferEnd) { /* lit buffer is reaching split point, empty out the first buffer and transition to litExtraBuffer */ const size_t leftoverLit = dctx->litBufferEnd - litPtr; if (leftoverLit) @@ -1762,26 +1794,26 @@ ZSTD_decompressSequencesLong_body( litPtr = dctx->litExtraBuffer; litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE; dctx->litBufferLocation = ZSTD_not_in_dst; - oneSeqSize = ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd); + { size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd); #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) - assert(!ZSTD_isError(oneSeqSize)); - if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], prefixStart, dictStart); + assert(!ZSTD_isError(oneSeqSize)); + ZSTD_assertValidSequence(dctx, op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], prefixStart, dictStart); #endif - if (ZSTD_isError(oneSeqSize)) return oneSeqSize; + if (ZSTD_isError(oneSeqSize)) return oneSeqSize; - prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd); - sequences[seqNb & STORED_SEQS_MASK] = sequence; - op += oneSeqSize; - } + prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd); + sequences[seqNb & STORED_SEQS_MASK] = sequence; + op += oneSeqSize; + } } else { /* lit buffer is either wholly contained in first or second split, or not split at all*/ - oneSeqSize = dctx->litBufferLocation == ZSTD_split ? + size_t const oneSeqSize = dctx->litBufferLocation == ZSTD_split ? ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength - WILDCOPY_OVERLENGTH, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd) : ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd); #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) assert(!ZSTD_isError(oneSeqSize)); - if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], prefixStart, dictStart); + ZSTD_assertValidSequence(dctx, op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], prefixStart, dictStart); #endif if (ZSTD_isError(oneSeqSize)) return oneSeqSize; @@ -1790,17 +1822,15 @@ ZSTD_decompressSequencesLong_body( op += oneSeqSize; } } - RETURN_ERROR_IF(seqNblitBufferLocation == ZSTD_split && litPtr + sequence->litLength > dctx->litBufferEnd) - { + if (dctx->litBufferLocation == ZSTD_split && litPtr + sequence->litLength > dctx->litBufferEnd) { const size_t leftoverLit = dctx->litBufferEnd - litPtr; - if (leftoverLit) - { + if (leftoverLit) { RETURN_ERROR_IF(leftoverLit > (size_t)(oend - op), dstSize_tooSmall, "remaining lit must fit within dstBuffer"); ZSTD_safecopyDstBeforeSrc(op, litPtr, leftoverLit); sequence->litLength -= leftoverLit; @@ -1809,11 +1839,10 @@ ZSTD_decompressSequencesLong_body( litPtr = dctx->litExtraBuffer; litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE; dctx->litBufferLocation = ZSTD_not_in_dst; - { - size_t const oneSeqSize = ZSTD_execSequence(op, oend, *sequence, &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd); + { size_t const oneSeqSize = ZSTD_execSequence(op, oend, *sequence, &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd); #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) assert(!ZSTD_isError(oneSeqSize)); - if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequences[seqNb&STORED_SEQS_MASK], prefixStart, dictStart); + ZSTD_assertValidSequence(dctx, op, oend, sequences[seqNb&STORED_SEQS_MASK], prefixStart, dictStart); #endif if (ZSTD_isError(oneSeqSize)) return oneSeqSize; op += oneSeqSize; @@ -1826,7 +1855,7 @@ ZSTD_decompressSequencesLong_body( ZSTD_execSequence(op, oend, *sequence, &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd); #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) assert(!ZSTD_isError(oneSeqSize)); - if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequences[seqNb&STORED_SEQS_MASK], prefixStart, dictStart); + ZSTD_assertValidSequence(dctx, op, oend, sequences[seqNb&STORED_SEQS_MASK], prefixStart, dictStart); #endif if (ZSTD_isError(oneSeqSize)) return oneSeqSize; op += oneSeqSize; @@ -1838,8 +1867,7 @@ ZSTD_decompressSequencesLong_body( } /* last literal segment */ - if (dctx->litBufferLocation == ZSTD_split) /* first deplete literal buffer in dst, then copy litExtraBuffer */ - { + if (dctx->litBufferLocation == ZSTD_split) { /* first deplete literal buffer in dst, then copy litExtraBuffer */ size_t const lastLLSize = litBufferEnd - litPtr; RETURN_ERROR_IF(lastLLSize > (size_t)(oend - op), dstSize_tooSmall, ""); if (op != NULL) { @@ -1857,17 +1885,16 @@ ZSTD_decompressSequencesLong_body( } } - return op-ostart; + return (size_t)(op - ostart); } static size_t ZSTD_decompressSequencesLong_default(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset, - const int frame) + const ZSTD_longOffset_e isLongOffset) { - return ZSTD_decompressSequencesLong_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); + return ZSTD_decompressSequencesLong_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); } #endif /* ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT */ @@ -1881,20 +1908,18 @@ DONT_VECTORIZE ZSTD_decompressSequences_bmi2(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset, - const int frame) + const ZSTD_longOffset_e isLongOffset) { - return ZSTD_decompressSequences_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); + return ZSTD_decompressSequences_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); } static BMI2_TARGET_ATTRIBUTE size_t DONT_VECTORIZE ZSTD_decompressSequencesSplitLitBuffer_bmi2(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset, - const int frame) + const ZSTD_longOffset_e isLongOffset) { - return ZSTD_decompressSequences_bodySplitLitBuffer(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); + return ZSTD_decompressSequences_bodySplitLitBuffer(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); } #endif /* ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG */ @@ -1903,10 +1928,9 @@ static BMI2_TARGET_ATTRIBUTE size_t ZSTD_decompressSequencesLong_bmi2(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset, - const int frame) + const ZSTD_longOffset_e isLongOffset) { - return ZSTD_decompressSequencesLong_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); + return ZSTD_decompressSequencesLong_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); } #endif /* ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT */ @@ -1916,37 +1940,34 @@ typedef size_t (*ZSTD_decompressSequences_t)( ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset, - const int frame); + const ZSTD_longOffset_e isLongOffset); #ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG static size_t ZSTD_decompressSequences(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset, - const int frame) + const ZSTD_longOffset_e isLongOffset) { DEBUGLOG(5, "ZSTD_decompressSequences"); #if DYNAMIC_BMI2 if (ZSTD_DCtx_get_bmi2(dctx)) { - return ZSTD_decompressSequences_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); + return ZSTD_decompressSequences_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); } #endif - return ZSTD_decompressSequences_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); + return ZSTD_decompressSequences_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); } static size_t ZSTD_decompressSequencesSplitLitBuffer(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset, - const int frame) + const ZSTD_longOffset_e isLongOffset) { DEBUGLOG(5, "ZSTD_decompressSequencesSplitLitBuffer"); #if DYNAMIC_BMI2 if (ZSTD_DCtx_get_bmi2(dctx)) { - return ZSTD_decompressSequencesSplitLitBuffer_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); + return ZSTD_decompressSequencesSplitLitBuffer_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); } #endif - return ZSTD_decompressSequencesSplitLitBuffer_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); + return ZSTD_decompressSequencesSplitLitBuffer_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); } #endif /* ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG */ @@ -1961,16 +1982,15 @@ static size_t ZSTD_decompressSequencesLong(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset, - const int frame) + const ZSTD_longOffset_e isLongOffset) { DEBUGLOG(5, "ZSTD_decompressSequencesLong"); #if DYNAMIC_BMI2 if (ZSTD_DCtx_get_bmi2(dctx)) { - return ZSTD_decompressSequencesLong_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); + return ZSTD_decompressSequencesLong_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); } #endif - return ZSTD_decompressSequencesLong_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); + return ZSTD_decompressSequencesLong_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); } #endif /* ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT */ @@ -2052,20 +2072,20 @@ static size_t ZSTD_maxShortOffset(void) size_t ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, - const void* src, size_t srcSize, const int frame, const streaming_operation streaming) + const void* src, size_t srcSize, const streaming_operation streaming) { /* blockType == blockCompressed */ const BYTE* ip = (const BYTE*)src; - DEBUGLOG(5, "ZSTD_decompressBlock_internal (size : %u)", (U32)srcSize); + DEBUGLOG(5, "ZSTD_decompressBlock_internal (cSize : %u)", (unsigned)srcSize); /* Note : the wording of the specification - * allows compressed block to be sized exactly ZSTD_BLOCKSIZE_MAX. + * allows compressed block to be sized exactly ZSTD_blockSizeMax(dctx). * This generally does not happen, as it makes little sense, * since an uncompressed block would feature same size and have no decompression cost. * Also, note that decoder from reference libzstd before < v1.5.4 * would consider this edge case as an error. - * As a consequence, avoid generating compressed blocks of size ZSTD_BLOCKSIZE_MAX + * As a consequence, avoid generating compressed blocks of size ZSTD_blockSizeMax(dctx) * for broader compatibility with the deployed ecosystem of zstd decoders */ - RETURN_ERROR_IF(srcSize > ZSTD_BLOCKSIZE_MAX, srcSize_wrong, ""); + RETURN_ERROR_IF(srcSize > ZSTD_blockSizeMax(dctx), srcSize_wrong, ""); /* Decode literals section */ { size_t const litCSize = ZSTD_decodeLiteralsBlock(dctx, src, srcSize, dst, dstCapacity, streaming); @@ -2080,8 +2100,8 @@ ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx, /* Compute the maximum block size, which must also work when !frame and fParams are unset. * Additionally, take the min with dstCapacity to ensure that the totalHistorySize fits in a size_t. */ - size_t const blockSizeMax = MIN(dstCapacity, (frame ? dctx->fParams.blockSizeMax : ZSTD_BLOCKSIZE_MAX)); - size_t const totalHistorySize = ZSTD_totalHistorySize((BYTE*)dst + blockSizeMax, (BYTE const*)dctx->virtualStart); + size_t const blockSizeMax = MIN(dstCapacity, ZSTD_blockSizeMax(dctx)); + size_t const totalHistorySize = ZSTD_totalHistorySize(ZSTD_maybeNullPtrAdd((BYTE*)dst, blockSizeMax), (BYTE const*)dctx->virtualStart); /* isLongOffset must be true if there are long offsets. * Offsets are long if they are larger than ZSTD_maxShortOffset(). * We don't expect that to be the case in 64-bit mode. @@ -2146,21 +2166,22 @@ ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx, { #endif #ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT - return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset, frame); + return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset); #endif } #ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG /* else */ if (dctx->litBufferLocation == ZSTD_split) - return ZSTD_decompressSequencesSplitLitBuffer(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset, frame); + return ZSTD_decompressSequencesSplitLitBuffer(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset); else - return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset, frame); + return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset); #endif } } +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR void ZSTD_checkContinuity(ZSTD_DCtx* dctx, const void* dst, size_t dstSize) { if (dst != dctx->previousDstEnd && dstSize > 0) { /* not contiguous */ @@ -2177,8 +2198,10 @@ size_t ZSTD_decompressBlock_deprecated(ZSTD_DCtx* dctx, const void* src, size_t srcSize) { size_t dSize; + dctx->isFrameDecompression = 0; ZSTD_checkContinuity(dctx, dst, dstCapacity); - dSize = ZSTD_decompressBlock_internal(dctx, dst, dstCapacity, src, srcSize, /* frame */ 0, not_streaming); + dSize = ZSTD_decompressBlock_internal(dctx, dst, dstCapacity, src, srcSize, not_streaming); + FORWARD_IF_ERROR(dSize, ""); dctx->previousDstEnd = (char*)dst + dSize; return dSize; } diff --git a/vendor/github.com/DataDog/zstd/zstd_decompress_block.h b/vendor/github.com/DataDog/zstd/zstd_decompress_block.h index a6df799e..b727de20 100644 --- a/vendor/github.com/DataDog/zstd/zstd_decompress_block.h +++ b/vendor/github.com/DataDog/zstd/zstd_decompress_block.h @@ -48,7 +48,7 @@ typedef enum { */ size_t ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, - const void* src, size_t srcSize, const int frame, const streaming_operation streaming); + const void* src, size_t srcSize, const streaming_operation streaming); /* ZSTD_buildFSETable() : * generate FSE decoding table for one symbol (ll, ml or off) diff --git a/vendor/github.com/DataDog/zstd/zstd_decompress_internal.h b/vendor/github.com/DataDog/zstd/zstd_decompress_internal.h index 7ce46329..d088b141 100644 --- a/vendor/github.com/DataDog/zstd/zstd_decompress_internal.h +++ b/vendor/github.com/DataDog/zstd/zstd_decompress_internal.h @@ -154,6 +154,7 @@ struct ZSTD_DCtx_s size_t litSize; size_t rleSize; size_t staticSize; + int isFrameDecompression; #if DYNAMIC_BMI2 != 0 int bmi2; /* == 1 if the CPU supports BMI2 and 0 otherwise. CPU support is determined dynamically once per context lifetime. */ #endif @@ -167,6 +168,7 @@ struct ZSTD_DCtx_s ZSTD_DDictHashSet* ddictSet; /* Hash set for multiple ddicts */ ZSTD_refMultipleDDicts_e refMultipleDDicts; /* User specified: if == 1, will allow references to multiple DDicts. Default == 0 (disabled) */ int disableHufAsm; + int maxBlockSizeParam; /* streaming */ ZSTD_dStreamStage streamStage; diff --git a/vendor/github.com/DataDog/zstd/zstd_double_fast.c b/vendor/github.com/DataDog/zstd/zstd_double_fast.c index 458533f7..7f7b86eb 100644 --- a/vendor/github.com/DataDog/zstd/zstd_double_fast.c +++ b/vendor/github.com/DataDog/zstd/zstd_double_fast.c @@ -12,7 +12,11 @@ #include "zstd_compress_internal.h" #include "zstd_double_fast.h" -static void ZSTD_fillDoubleHashTableForCDict(ZSTD_matchState_t* ms, +#ifndef ZSTD_EXCLUDE_DFAST_BLOCK_COMPRESSOR + +static +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +void ZSTD_fillDoubleHashTableForCDict(ZSTD_matchState_t* ms, void const* end, ZSTD_dictTableLoadMethod_e dtlm) { const ZSTD_compressionParameters* const cParams = &ms->cParams; @@ -48,7 +52,9 @@ static void ZSTD_fillDoubleHashTableForCDict(ZSTD_matchState_t* ms, } } } -static void ZSTD_fillDoubleHashTableForCCtx(ZSTD_matchState_t* ms, +static +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +void ZSTD_fillDoubleHashTableForCCtx(ZSTD_matchState_t* ms, void const* end, ZSTD_dictTableLoadMethod_e dtlm) { const ZSTD_compressionParameters* const cParams = &ms->cParams; @@ -96,6 +102,7 @@ void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms, FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_compressBlock_doubleFast_noDict_generic( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize, U32 const mls /* template */) @@ -306,6 +313,7 @@ _match_stored: FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_compressBlock_doubleFast_dictMatchState_generic( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize, @@ -349,8 +357,8 @@ size_t ZSTD_compressBlock_doubleFast_dictMatchState_generic( if (ms->prefetchCDictTables) { size_t const hashTableBytes = (((size_t)1) << dictCParams->hashLog) * sizeof(U32); size_t const chainTableBytes = (((size_t)1) << dictCParams->chainLog) * sizeof(U32); - PREFETCH_AREA(dictHashLong, hashTableBytes) - PREFETCH_AREA(dictHashSmall, chainTableBytes) + PREFETCH_AREA(dictHashLong, hashTableBytes); + PREFETCH_AREA(dictHashSmall, chainTableBytes); } /* init */ @@ -590,7 +598,9 @@ size_t ZSTD_compressBlock_doubleFast_dictMatchState( } -static size_t ZSTD_compressBlock_doubleFast_extDict_generic( +static +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +size_t ZSTD_compressBlock_doubleFast_extDict_generic( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize, U32 const mls /* template */) @@ -758,4 +768,6 @@ size_t ZSTD_compressBlock_doubleFast_extDict( } } +#endif /* ZSTD_EXCLUDE_DFAST_BLOCK_COMPRESSOR */ + #endif /* USE_EXTERNAL_ZSTD */ diff --git a/vendor/github.com/DataDog/zstd/zstd_double_fast.h b/vendor/github.com/DataDog/zstd/zstd_double_fast.h index bdafd495..43c2bfd7 100644 --- a/vendor/github.com/DataDog/zstd/zstd_double_fast.h +++ b/vendor/github.com/DataDog/zstd/zstd_double_fast.h @@ -19,9 +19,12 @@ extern "C" { #include "mem.h" /* U32 */ #include "zstd_compress_internal.h" /* ZSTD_CCtx, size_t */ +#ifndef ZSTD_EXCLUDE_DFAST_BLOCK_COMPRESSOR + void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms, void const* end, ZSTD_dictTableLoadMethod_e dtlm, ZSTD_tableFillPurpose_e tfp); + size_t ZSTD_compressBlock_doubleFast( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); @@ -32,6 +35,14 @@ size_t ZSTD_compressBlock_doubleFast_extDict( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); +#define ZSTD_COMPRESSBLOCK_DOUBLEFAST ZSTD_compressBlock_doubleFast +#define ZSTD_COMPRESSBLOCK_DOUBLEFAST_DICTMATCHSTATE ZSTD_compressBlock_doubleFast_dictMatchState +#define ZSTD_COMPRESSBLOCK_DOUBLEFAST_EXTDICT ZSTD_compressBlock_doubleFast_extDict +#else +#define ZSTD_COMPRESSBLOCK_DOUBLEFAST NULL +#define ZSTD_COMPRESSBLOCK_DOUBLEFAST_DICTMATCHSTATE NULL +#define ZSTD_COMPRESSBLOCK_DOUBLEFAST_EXTDICT NULL +#endif /* ZSTD_EXCLUDE_DFAST_BLOCK_COMPRESSOR */ #if defined (__cplusplus) } diff --git a/vendor/github.com/DataDog/zstd/zstd_fast.c b/vendor/github.com/DataDog/zstd/zstd_fast.c index 1b60c21f..1759f77a 100644 --- a/vendor/github.com/DataDog/zstd/zstd_fast.c +++ b/vendor/github.com/DataDog/zstd/zstd_fast.c @@ -12,7 +12,9 @@ #include "zstd_compress_internal.h" /* ZSTD_hashPtr, ZSTD_count, ZSTD_storeSeq */ #include "zstd_fast.h" -static void ZSTD_fillHashTableForCDict(ZSTD_matchState_t* ms, +static +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +void ZSTD_fillHashTableForCDict(ZSTD_matchState_t* ms, const void* const end, ZSTD_dictTableLoadMethod_e dtlm) { @@ -47,7 +49,9 @@ static void ZSTD_fillHashTableForCDict(ZSTD_matchState_t* ms, } } } } } -static void ZSTD_fillHashTableForCCtx(ZSTD_matchState_t* ms, +static +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +void ZSTD_fillHashTableForCCtx(ZSTD_matchState_t* ms, const void* const end, ZSTD_dictTableLoadMethod_e dtlm) { @@ -140,8 +144,9 @@ void ZSTD_fillHashTable(ZSTD_matchState_t* ms, * * This is also the work we do at the beginning to enter the loop initially. */ -FORCE_INLINE_TEMPLATE size_t -ZSTD_compressBlock_fast_noDict_generic( +FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +size_t ZSTD_compressBlock_fast_noDict_generic( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize, U32 const mls, U32 const hasStep) @@ -457,6 +462,7 @@ size_t ZSTD_compressBlock_fast( } FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_compressBlock_fast_dictMatchState_generic( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize, U32 const mls, U32 const hasStep) @@ -503,7 +509,7 @@ size_t ZSTD_compressBlock_fast_dictMatchState_generic( if (ms->prefetchCDictTables) { size_t const hashTableBytes = (((size_t)1) << dictCParams->hashLog) * sizeof(U32); - PREFETCH_AREA(dictHashTable, hashTableBytes) + PREFETCH_AREA(dictHashTable, hashTableBytes); } /* init */ @@ -682,7 +688,9 @@ size_t ZSTD_compressBlock_fast_dictMatchState( } -static size_t ZSTD_compressBlock_fast_extDict_generic( +static +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +size_t ZSTD_compressBlock_fast_extDict_generic( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize, U32 const mls, U32 const hasStep) { diff --git a/vendor/github.com/DataDog/zstd/zstd_internal.h b/vendor/github.com/DataDog/zstd/zstd_internal.h index 09707543..6bb1d4b6 100644 --- a/vendor/github.com/DataDog/zstd/zstd_internal.h +++ b/vendor/github.com/DataDog/zstd/zstd_internal.h @@ -179,7 +179,7 @@ static void ZSTD_copy8(void* dst, const void* src) { ZSTD_memcpy(dst, src, 8); #endif } -#define COPY8(d,s) { ZSTD_copy8(d,s); d+=8; s+=8; } +#define COPY8(d,s) do { ZSTD_copy8(d,s); d+=8; s+=8; } while (0) /* Need to use memmove here since the literal buffer can now be located within the dst buffer. In circumstances where the op "catches up" to where the @@ -199,7 +199,7 @@ static void ZSTD_copy16(void* dst, const void* src) { ZSTD_memcpy(dst, copy16_buf, 16); #endif } -#define COPY16(d,s) { ZSTD_copy16(d,s); d+=16; s+=16; } +#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0) #define WILDCOPY_OVERLENGTH 32 #define WILDCOPY_VECLEN 16 @@ -228,7 +228,7 @@ void ZSTD_wildcopy(void* dst, const void* src, ptrdiff_t length, ZSTD_overlap_e if (ovtype == ZSTD_overlap_src_before_dst && diff < WILDCOPY_VECLEN) { /* Handle short offset copies. */ do { - COPY8(op, ip) + COPY8(op, ip); } while (op < oend); } else { assert(diff >= WILDCOPY_VECLEN || diff <= -WILDCOPY_VECLEN); @@ -367,13 +367,13 @@ typedef struct { /*! ZSTD_getcBlockSize() : * Provides the size of compressed block from block header `src` */ -/* Used by: decompress, fullbench (does not get its definition from here) */ +/* Used by: decompress, fullbench */ size_t ZSTD_getcBlockSize(const void* src, size_t srcSize, blockProperties_t* bpPtr); /*! ZSTD_decodeSeqHeaders() : * decode sequence header from src */ -/* Used by: decompress, fullbench (does not get its definition from here) */ +/* Used by: zstd_decompress_block, fullbench */ size_t ZSTD_decodeSeqHeaders(ZSTD_DCtx* dctx, int* nbSeqPtr, const void* src, size_t srcSize); diff --git a/vendor/github.com/DataDog/zstd/zstd_lazy.c b/vendor/github.com/DataDog/zstd/zstd_lazy.c index 9463e667..3a90f129 100644 --- a/vendor/github.com/DataDog/zstd/zstd_lazy.c +++ b/vendor/github.com/DataDog/zstd/zstd_lazy.c @@ -13,6 +13,11 @@ #include "zstd_lazy.h" #include "bits.h" /* ZSTD_countTrailingZeros64 */ +#if !defined(ZSTD_EXCLUDE_GREEDY_BLOCK_COMPRESSOR) \ + || !defined(ZSTD_EXCLUDE_LAZY_BLOCK_COMPRESSOR) \ + || !defined(ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR) \ + || !defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR) + #define kLazySkippingStep 8 @@ -20,8 +25,9 @@ * Binary Tree search ***************************************/ -static void -ZSTD_updateDUBT(ZSTD_matchState_t* ms, +static +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +void ZSTD_updateDUBT(ZSTD_matchState_t* ms, const BYTE* ip, const BYTE* iend, U32 mls) { @@ -64,8 +70,9 @@ ZSTD_updateDUBT(ZSTD_matchState_t* ms, * sort one already inserted but unsorted position * assumption : curr >= btlow == (curr - btmask) * doesn't fail */ -static void -ZSTD_insertDUBT1(const ZSTD_matchState_t* ms, +static +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +void ZSTD_insertDUBT1(const ZSTD_matchState_t* ms, U32 curr, const BYTE* inputEnd, U32 nbCompares, U32 btLow, const ZSTD_dictMode_e dictMode) @@ -153,8 +160,9 @@ ZSTD_insertDUBT1(const ZSTD_matchState_t* ms, } -static size_t -ZSTD_DUBT_findBetterDictMatch ( +static +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +size_t ZSTD_DUBT_findBetterDictMatch ( const ZSTD_matchState_t* ms, const BYTE* const ip, const BYTE* const iend, size_t* offsetPtr, @@ -231,8 +239,9 @@ ZSTD_DUBT_findBetterDictMatch ( } -static size_t -ZSTD_DUBT_findBestMatch(ZSTD_matchState_t* ms, +static +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +size_t ZSTD_DUBT_findBestMatch(ZSTD_matchState_t* ms, const BYTE* const ip, const BYTE* const iend, size_t* offBasePtr, U32 const mls, @@ -382,8 +391,9 @@ ZSTD_DUBT_findBestMatch(ZSTD_matchState_t* ms, /** ZSTD_BtFindBestMatch() : Tree updater, providing best match */ -FORCE_INLINE_TEMPLATE size_t -ZSTD_BtFindBestMatch( ZSTD_matchState_t* ms, +FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +size_t ZSTD_BtFindBestMatch( ZSTD_matchState_t* ms, const BYTE* const ip, const BYTE* const iLimit, size_t* offBasePtr, const U32 mls /* template */, @@ -618,7 +628,9 @@ size_t ZSTD_dedicatedDictSearch_lazy_search(size_t* offsetPtr, size_t ml, U32 nb /* Update chains up to ip (excluded) Assumption : always within prefix (i.e. not within extDict) */ -FORCE_INLINE_TEMPLATE U32 ZSTD_insertAndFindFirstIndex_internal( +FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +U32 ZSTD_insertAndFindFirstIndex_internal( ZSTD_matchState_t* ms, const ZSTD_compressionParameters* const cParams, const BYTE* ip, U32 const mls, U32 const lazySkipping) @@ -652,6 +664,7 @@ U32 ZSTD_insertAndFindFirstIndex(ZSTD_matchState_t* ms, const BYTE* ip) { /* inlining is important to hardwire a hot branch (template emulation) */ FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_HcFindBestMatch( ZSTD_matchState_t* ms, const BYTE* const ip, const BYTE* const iLimit, @@ -820,7 +833,9 @@ FORCE_INLINE_TEMPLATE void ZSTD_row_prefetch(U32 const* hashTable, BYTE const* t * Fill up the hash cache starting at idx, prefetching up to ZSTD_ROW_HASH_CACHE_SIZE entries, * but not beyond iLimit. */ -FORCE_INLINE_TEMPLATE void ZSTD_row_fillHashCache(ZSTD_matchState_t* ms, const BYTE* base, +FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +void ZSTD_row_fillHashCache(ZSTD_matchState_t* ms, const BYTE* base, U32 const rowLog, U32 const mls, U32 idx, const BYTE* const iLimit) { @@ -846,7 +861,9 @@ FORCE_INLINE_TEMPLATE void ZSTD_row_fillHashCache(ZSTD_matchState_t* ms, const B * Returns the hash of base + idx, and replaces the hash in the hash cache with the byte at * base + idx + ZSTD_ROW_HASH_CACHE_SIZE. Also prefetches the appropriate rows from hashTable and tagTable. */ -FORCE_INLINE_TEMPLATE U32 ZSTD_row_nextCachedHash(U32* cache, U32 const* hashTable, +FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +U32 ZSTD_row_nextCachedHash(U32* cache, U32 const* hashTable, BYTE const* tagTable, BYTE const* base, U32 idx, U32 const hashLog, U32 const rowLog, U32 const mls, @@ -864,10 +881,12 @@ FORCE_INLINE_TEMPLATE U32 ZSTD_row_nextCachedHash(U32* cache, U32 const* hashTab /* ZSTD_row_update_internalImpl(): * Updates the hash table with positions starting from updateStartIdx until updateEndIdx. */ -FORCE_INLINE_TEMPLATE void ZSTD_row_update_internalImpl(ZSTD_matchState_t* ms, - U32 updateStartIdx, U32 const updateEndIdx, - U32 const mls, U32 const rowLog, - U32 const rowMask, U32 const useCache) +FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +void ZSTD_row_update_internalImpl(ZSTD_matchState_t* ms, + U32 updateStartIdx, U32 const updateEndIdx, + U32 const mls, U32 const rowLog, + U32 const rowMask, U32 const useCache) { U32* const hashTable = ms->hashTable; BYTE* const tagTable = ms->tagTable; @@ -893,9 +912,11 @@ FORCE_INLINE_TEMPLATE void ZSTD_row_update_internalImpl(ZSTD_matchState_t* ms, * Inserts the byte at ip into the appropriate position in the hash table, and updates ms->nextToUpdate. * Skips sections of long matches as is necessary. */ -FORCE_INLINE_TEMPLATE void ZSTD_row_update_internal(ZSTD_matchState_t* ms, const BYTE* ip, - U32 const mls, U32 const rowLog, - U32 const rowMask, U32 const useCache) +FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +void ZSTD_row_update_internal(ZSTD_matchState_t* ms, const BYTE* ip, + U32 const mls, U32 const rowLog, + U32 const rowMask, U32 const useCache) { U32 idx = ms->nextToUpdate; const BYTE* const base = ms->window.base; @@ -1103,20 +1124,21 @@ ZSTD_row_getMatchMask(const BYTE* const tagRow, const BYTE tag, const U32 headGr /* The high-level approach of the SIMD row based match finder is as follows: * - Figure out where to insert the new entry: - * - Generate a hash from a byte along with an additional 1-byte "short hash". The additional byte is our "tag" - * - The hashTable is effectively split into groups or "rows" of 16 or 32 entries of U32, and the hash determines + * - Generate a hash for current input posistion and split it into a one byte of tag and `rowHashLog` bits of index. + * - The hash is salted by a value that changes on every contex reset, so when the same table is used + * we will avoid collisions that would otherwise slow us down by intorducing phantom matches. + * - The hashTable is effectively split into groups or "rows" of 15 or 31 entries of U32, and the index determines * which row to insert into. - * - Determine the correct position within the row to insert the entry into. Each row of 16 or 32 can - * be considered as a circular buffer with a "head" index that resides in the tagTable. - * - Also insert the "tag" into the equivalent row and position in the tagTable. - * - Note: The tagTable has 17 or 33 1-byte entries per row, due to 16 or 32 tags, and 1 "head" entry. - * The 17 or 33 entry rows are spaced out to occur every 32 or 64 bytes, respectively, - * for alignment/performance reasons, leaving some bytes unused. - * - Use SIMD to efficiently compare the tags in the tagTable to the 1-byte "short hash" and + * - Determine the correct position within the row to insert the entry into. Each row of 15 or 31 can + * be considered as a circular buffer with a "head" index that resides in the tagTable (overall 16 or 32 bytes + * per row). + * - Use SIMD to efficiently compare the tags in the tagTable to the 1-byte tag calculated for the position and * generate a bitfield that we can cycle through to check the collisions in the hash table. * - Pick the longest match. + * - Insert the tag into the equivalent row and position in the tagTable. */ FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_RowFindBestMatch( ZSTD_matchState_t* ms, const BYTE* const ip, const BYTE* const iLimit, @@ -1490,8 +1512,9 @@ FORCE_INLINE_TEMPLATE size_t ZSTD_searchMax( * Common parser - lazy strategy *********************************/ -FORCE_INLINE_TEMPLATE size_t -ZSTD_compressBlock_lazy_generic( +FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +size_t ZSTD_compressBlock_lazy_generic( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], const void* src, size_t srcSize, @@ -1755,29 +1778,10 @@ _storeSequence: /* Return the last literals size */ return (size_t)(iend - anchor); } +#endif /* build exclusions */ -size_t ZSTD_compressBlock_btlazy2( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2, ZSTD_noDict); -} - -size_t ZSTD_compressBlock_lazy2( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2, ZSTD_noDict); -} - -size_t ZSTD_compressBlock_lazy( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1, ZSTD_noDict); -} - +#ifndef ZSTD_EXCLUDE_GREEDY_BLOCK_COMPRESSOR size_t ZSTD_compressBlock_greedy( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize) @@ -1785,27 +1789,6 @@ size_t ZSTD_compressBlock_greedy( return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 0, ZSTD_noDict); } -size_t ZSTD_compressBlock_btlazy2_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2, ZSTD_dictMatchState); -} - -size_t ZSTD_compressBlock_lazy2_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2, ZSTD_dictMatchState); -} - -size_t ZSTD_compressBlock_lazy_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1, ZSTD_dictMatchState); -} - size_t ZSTD_compressBlock_greedy_dictMatchState( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize) @@ -1813,21 +1796,6 @@ size_t ZSTD_compressBlock_greedy_dictMatchState( return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 0, ZSTD_dictMatchState); } - -size_t ZSTD_compressBlock_lazy2_dedicatedDictSearch( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2, ZSTD_dedicatedDictSearch); -} - -size_t ZSTD_compressBlock_lazy_dedicatedDictSearch( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1, ZSTD_dedicatedDictSearch); -} - size_t ZSTD_compressBlock_greedy_dedicatedDictSearch( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize) @@ -1835,21 +1803,6 @@ size_t ZSTD_compressBlock_greedy_dedicatedDictSearch( return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 0, ZSTD_dedicatedDictSearch); } -/* Row-based matchfinder */ -size_t ZSTD_compressBlock_lazy2_row( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 2, ZSTD_noDict); -} - -size_t ZSTD_compressBlock_lazy_row( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 1, ZSTD_noDict); -} - size_t ZSTD_compressBlock_greedy_row( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize) @@ -1857,11 +1810,48 @@ size_t ZSTD_compressBlock_greedy_row( return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 0, ZSTD_noDict); } -size_t ZSTD_compressBlock_lazy2_dictMatchState_row( +size_t ZSTD_compressBlock_greedy_dictMatchState_row( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize) { - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 2, ZSTD_dictMatchState); + return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 0, ZSTD_dictMatchState); +} + +size_t ZSTD_compressBlock_greedy_dedicatedDictSearch_row( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize) +{ + return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 0, ZSTD_dedicatedDictSearch); +} +#endif + +#ifndef ZSTD_EXCLUDE_LAZY_BLOCK_COMPRESSOR +size_t ZSTD_compressBlock_lazy( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize) +{ + return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1, ZSTD_noDict); +} + +size_t ZSTD_compressBlock_lazy_dictMatchState( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize) +{ + return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1, ZSTD_dictMatchState); +} + +size_t ZSTD_compressBlock_lazy_dedicatedDictSearch( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize) +{ + return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1, ZSTD_dedicatedDictSearch); +} + +size_t ZSTD_compressBlock_lazy_row( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize) +{ + return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 1, ZSTD_noDict); } size_t ZSTD_compressBlock_lazy_dictMatchState_row( @@ -1871,13 +1861,49 @@ size_t ZSTD_compressBlock_lazy_dictMatchState_row( return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 1, ZSTD_dictMatchState); } -size_t ZSTD_compressBlock_greedy_dictMatchState_row( +size_t ZSTD_compressBlock_lazy_dedicatedDictSearch_row( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize) { - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 0, ZSTD_dictMatchState); + return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 1, ZSTD_dedicatedDictSearch); +} +#endif + +#ifndef ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR +size_t ZSTD_compressBlock_lazy2( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize) +{ + return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2, ZSTD_noDict); } +size_t ZSTD_compressBlock_lazy2_dictMatchState( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize) +{ + return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2, ZSTD_dictMatchState); +} + +size_t ZSTD_compressBlock_lazy2_dedicatedDictSearch( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize) +{ + return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2, ZSTD_dedicatedDictSearch); +} + +size_t ZSTD_compressBlock_lazy2_row( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize) +{ + return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 2, ZSTD_noDict); +} + +size_t ZSTD_compressBlock_lazy2_dictMatchState_row( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize) +{ + return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 2, ZSTD_dictMatchState); +} size_t ZSTD_compressBlock_lazy2_dedicatedDictSearch_row( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], @@ -1885,22 +1911,30 @@ size_t ZSTD_compressBlock_lazy2_dedicatedDictSearch_row( { return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 2, ZSTD_dedicatedDictSearch); } +#endif -size_t ZSTD_compressBlock_lazy_dedicatedDictSearch_row( +#ifndef ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR +size_t ZSTD_compressBlock_btlazy2( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize) { - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 1, ZSTD_dedicatedDictSearch); + return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2, ZSTD_noDict); } -size_t ZSTD_compressBlock_greedy_dedicatedDictSearch_row( +size_t ZSTD_compressBlock_btlazy2_dictMatchState( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize) { - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 0, ZSTD_dedicatedDictSearch); + return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2, ZSTD_dictMatchState); } +#endif +#if !defined(ZSTD_EXCLUDE_GREEDY_BLOCK_COMPRESSOR) \ + || !defined(ZSTD_EXCLUDE_LAZY_BLOCK_COMPRESSOR) \ + || !defined(ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR) \ + || !defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR) FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_compressBlock_lazy_extDict_generic( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], @@ -2102,8 +2136,9 @@ _storeSequence: /* Return the last literals size */ return (size_t)(iend - anchor); } +#endif /* build exclusions */ - +#ifndef ZSTD_EXCLUDE_GREEDY_BLOCK_COMPRESSOR size_t ZSTD_compressBlock_greedy_extDict( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize) @@ -2111,6 +2146,15 @@ size_t ZSTD_compressBlock_greedy_extDict( return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 0); } +size_t ZSTD_compressBlock_greedy_extDict_row( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize) +{ + return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 0); +} +#endif + +#ifndef ZSTD_EXCLUDE_LAZY_BLOCK_COMPRESSOR size_t ZSTD_compressBlock_lazy_extDict( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize) @@ -2119,29 +2163,6 @@ size_t ZSTD_compressBlock_lazy_extDict( return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1); } -size_t ZSTD_compressBlock_lazy2_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) - -{ - return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2); -} - -size_t ZSTD_compressBlock_btlazy2_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) - -{ - return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2); -} - -size_t ZSTD_compressBlock_greedy_extDict_row( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 0); -} - size_t ZSTD_compressBlock_lazy_extDict_row( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize) @@ -2149,6 +2170,16 @@ size_t ZSTD_compressBlock_lazy_extDict_row( { return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 1); } +#endif + +#ifndef ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR +size_t ZSTD_compressBlock_lazy2_extDict( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize) + +{ + return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2); +} size_t ZSTD_compressBlock_lazy2_extDict_row( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], @@ -2156,5 +2187,16 @@ size_t ZSTD_compressBlock_lazy2_extDict_row( { return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 2); } +#endif + +#ifndef ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR +size_t ZSTD_compressBlock_btlazy2_extDict( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize) + +{ + return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2); +} +#endif #endif /* USE_EXTERNAL_ZSTD */ diff --git a/vendor/github.com/DataDog/zstd/zstd_lazy.h b/vendor/github.com/DataDog/zstd/zstd_lazy.h index abadc7c4..57b077c5 100644 --- a/vendor/github.com/DataDog/zstd/zstd_lazy.h +++ b/vendor/github.com/DataDog/zstd/zstd_lazy.h @@ -28,98 +28,173 @@ extern "C" { #define ZSTD_ROW_HASH_TAG_BITS 8 /* nb bits to use for the tag */ +#if !defined(ZSTD_EXCLUDE_GREEDY_BLOCK_COMPRESSOR) \ + || !defined(ZSTD_EXCLUDE_LAZY_BLOCK_COMPRESSOR) \ + || !defined(ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR) \ + || !defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR) U32 ZSTD_insertAndFindFirstIndex(ZSTD_matchState_t* ms, const BYTE* ip); void ZSTD_row_update(ZSTD_matchState_t* const ms, const BYTE* ip); void ZSTD_dedicatedDictSearch_lazy_loadDictionary(ZSTD_matchState_t* ms, const BYTE* const ip); void ZSTD_preserveUnsortedMark (U32* const table, U32 const size, U32 const reducerValue); /*! used in ZSTD_reduceIndex(). preemptively increase value of ZSTD_DUBT_UNSORTED_MARK */ +#endif -size_t ZSTD_compressBlock_btlazy2( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy2( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); +#ifndef ZSTD_EXCLUDE_GREEDY_BLOCK_COMPRESSOR size_t ZSTD_compressBlock_greedy( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy2_row( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy_row( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); size_t ZSTD_compressBlock_greedy_row( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); - -size_t ZSTD_compressBlock_btlazy2_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy2_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); size_t ZSTD_compressBlock_greedy_dictMatchState( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy2_dictMatchState_row( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy_dictMatchState_row( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); size_t ZSTD_compressBlock_greedy_dictMatchState_row( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); - -size_t ZSTD_compressBlock_lazy2_dedicatedDictSearch( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy_dedicatedDictSearch( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); size_t ZSTD_compressBlock_greedy_dedicatedDictSearch( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy2_dedicatedDictSearch_row( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy_dedicatedDictSearch_row( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); size_t ZSTD_compressBlock_greedy_dedicatedDictSearch_row( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); - size_t ZSTD_compressBlock_greedy_extDict( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy2_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); size_t ZSTD_compressBlock_greedy_extDict_row( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); + +#define ZSTD_COMPRESSBLOCK_GREEDY ZSTD_compressBlock_greedy +#define ZSTD_COMPRESSBLOCK_GREEDY_ROW ZSTD_compressBlock_greedy_row +#define ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE ZSTD_compressBlock_greedy_dictMatchState +#define ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE_ROW ZSTD_compressBlock_greedy_dictMatchState_row +#define ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH ZSTD_compressBlock_greedy_dedicatedDictSearch +#define ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH_ROW ZSTD_compressBlock_greedy_dedicatedDictSearch_row +#define ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT ZSTD_compressBlock_greedy_extDict +#define ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT_ROW ZSTD_compressBlock_greedy_extDict_row +#else +#define ZSTD_COMPRESSBLOCK_GREEDY NULL +#define ZSTD_COMPRESSBLOCK_GREEDY_ROW NULL +#define ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE NULL +#define ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE_ROW NULL +#define ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH NULL +#define ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH_ROW NULL +#define ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT NULL +#define ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT_ROW NULL +#endif + +#ifndef ZSTD_EXCLUDE_LAZY_BLOCK_COMPRESSOR +size_t ZSTD_compressBlock_lazy( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); +size_t ZSTD_compressBlock_lazy_row( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); +size_t ZSTD_compressBlock_lazy_dictMatchState( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); +size_t ZSTD_compressBlock_lazy_dictMatchState_row( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); +size_t ZSTD_compressBlock_lazy_dedicatedDictSearch( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); +size_t ZSTD_compressBlock_lazy_dedicatedDictSearch_row( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); +size_t ZSTD_compressBlock_lazy_extDict( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); size_t ZSTD_compressBlock_lazy_extDict_row( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); + +#define ZSTD_COMPRESSBLOCK_LAZY ZSTD_compressBlock_lazy +#define ZSTD_COMPRESSBLOCK_LAZY_ROW ZSTD_compressBlock_lazy_row +#define ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE ZSTD_compressBlock_lazy_dictMatchState +#define ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE_ROW ZSTD_compressBlock_lazy_dictMatchState_row +#define ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH ZSTD_compressBlock_lazy_dedicatedDictSearch +#define ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH_ROW ZSTD_compressBlock_lazy_dedicatedDictSearch_row +#define ZSTD_COMPRESSBLOCK_LAZY_EXTDICT ZSTD_compressBlock_lazy_extDict +#define ZSTD_COMPRESSBLOCK_LAZY_EXTDICT_ROW ZSTD_compressBlock_lazy_extDict_row +#else +#define ZSTD_COMPRESSBLOCK_LAZY NULL +#define ZSTD_COMPRESSBLOCK_LAZY_ROW NULL +#define ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE NULL +#define ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE_ROW NULL +#define ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH NULL +#define ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH_ROW NULL +#define ZSTD_COMPRESSBLOCK_LAZY_EXTDICT NULL +#define ZSTD_COMPRESSBLOCK_LAZY_EXTDICT_ROW NULL +#endif + +#ifndef ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR +size_t ZSTD_compressBlock_lazy2( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); +size_t ZSTD_compressBlock_lazy2_row( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); +size_t ZSTD_compressBlock_lazy2_dictMatchState( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); +size_t ZSTD_compressBlock_lazy2_dictMatchState_row( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); +size_t ZSTD_compressBlock_lazy2_dedicatedDictSearch( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); +size_t ZSTD_compressBlock_lazy2_dedicatedDictSearch_row( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); +size_t ZSTD_compressBlock_lazy2_extDict( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); size_t ZSTD_compressBlock_lazy2_extDict_row( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); + +#define ZSTD_COMPRESSBLOCK_LAZY2 ZSTD_compressBlock_lazy2 +#define ZSTD_COMPRESSBLOCK_LAZY2_ROW ZSTD_compressBlock_lazy2_row +#define ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE ZSTD_compressBlock_lazy2_dictMatchState +#define ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE_ROW ZSTD_compressBlock_lazy2_dictMatchState_row +#define ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH ZSTD_compressBlock_lazy2_dedicatedDictSearch +#define ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH_ROW ZSTD_compressBlock_lazy2_dedicatedDictSearch_row +#define ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT ZSTD_compressBlock_lazy2_extDict +#define ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT_ROW ZSTD_compressBlock_lazy2_extDict_row +#else +#define ZSTD_COMPRESSBLOCK_LAZY2 NULL +#define ZSTD_COMPRESSBLOCK_LAZY2_ROW NULL +#define ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE NULL +#define ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE_ROW NULL +#define ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH NULL +#define ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH_ROW NULL +#define ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT NULL +#define ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT_ROW NULL +#endif + +#ifndef ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR +size_t ZSTD_compressBlock_btlazy2( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); +size_t ZSTD_compressBlock_btlazy2_dictMatchState( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); size_t ZSTD_compressBlock_btlazy2_extDict( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); +#define ZSTD_COMPRESSBLOCK_BTLAZY2 ZSTD_compressBlock_btlazy2 +#define ZSTD_COMPRESSBLOCK_BTLAZY2_DICTMATCHSTATE ZSTD_compressBlock_btlazy2_dictMatchState +#define ZSTD_COMPRESSBLOCK_BTLAZY2_EXTDICT ZSTD_compressBlock_btlazy2_extDict +#else +#define ZSTD_COMPRESSBLOCK_BTLAZY2 NULL +#define ZSTD_COMPRESSBLOCK_BTLAZY2_DICTMATCHSTATE NULL +#define ZSTD_COMPRESSBLOCK_BTLAZY2_EXTDICT NULL +#endif + #if defined (__cplusplus) } diff --git a/vendor/github.com/DataDog/zstd/zstd_ldm.c b/vendor/github.com/DataDog/zstd/zstd_ldm.c index b6c4d968..b754d1af 100644 --- a/vendor/github.com/DataDog/zstd/zstd_ldm.c +++ b/vendor/github.com/DataDog/zstd/zstd_ldm.c @@ -247,7 +247,11 @@ static size_t ZSTD_ldm_fillFastTables(ZSTD_matchState_t* ms, break; case ZSTD_dfast: +#ifndef ZSTD_EXCLUDE_DFAST_BLOCK_COMPRESSOR ZSTD_fillDoubleHashTable(ms, iend, ZSTD_dtlm_fast, ZSTD_tfp_forCCtx); +#else + assert(0); /* shouldn't be called: cparams should've been adjusted. */ +#endif break; case ZSTD_greedy: @@ -319,7 +323,9 @@ static void ZSTD_ldm_limitTableUpdate(ZSTD_matchState_t* ms, const BYTE* anchor) } } -static size_t ZSTD_ldm_generateSequences_internal( +static +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +size_t ZSTD_ldm_generateSequences_internal( ldmState_t* ldmState, rawSeqStore_t* rawSeqStore, ldmParams_t const* params, void const* src, size_t srcSize) { @@ -690,7 +696,6 @@ size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore, /* maybeSplitSequence updates rawSeqStore->pos */ rawSeq const sequence = maybeSplitSequence(rawSeqStore, (U32)(iend - ip), minMatch); - int i; /* End signal */ if (sequence.offset == 0) break; @@ -703,6 +708,7 @@ size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore, /* Run the block compressor */ DEBUGLOG(5, "pos %u : calling block compressor on segment of size %u", (unsigned)(ip-istart), sequence.litLength); { + int i; size_t const newLitLength = blockCompressor(ms, seqStore, rep, ip, sequence.litLength); ip += sequence.litLength; diff --git a/vendor/github.com/DataDog/zstd/zstd_legacy.h b/vendor/github.com/DataDog/zstd/zstd_legacy.h index a43c232e..3bea26bc 100644 --- a/vendor/github.com/DataDog/zstd/zstd_legacy.h +++ b/vendor/github.com/DataDog/zstd/zstd_legacy.h @@ -125,6 +125,20 @@ MEM_STATIC size_t ZSTD_decompressLegacy( const void* dict,size_t dictSize) { U32 const version = ZSTD_isLegacy(src, compressedSize); + char x; + /* Avoid passing NULL to legacy decoding. */ + if (dst == NULL) { + assert(dstCapacity == 0); + dst = &x; + } + if (src == NULL) { + assert(compressedSize == 0); + src = &x; + } + if (dict == NULL) { + assert(dictSize == 0); + dict = &x; + } (void)dst; (void)dstCapacity; (void)dict; (void)dictSize; /* unused when ZSTD_LEGACY_SUPPORT >= 8 */ switch(version) { @@ -288,6 +302,12 @@ MEM_STATIC size_t ZSTD_freeLegacyStreamContext(void* legacyContext, U32 version) MEM_STATIC size_t ZSTD_initLegacyStream(void** legacyContext, U32 prevVersion, U32 newVersion, const void* dict, size_t dictSize) { + char x; + /* Avoid passing NULL to legacy decoding. */ + if (dict == NULL) { + assert(dictSize == 0); + dict = &x; + } DEBUGLOG(5, "ZSTD_initLegacyStream for v0.%u", newVersion); if (prevVersion != newVersion) ZSTD_freeLegacyStreamContext(*legacyContext, prevVersion); switch(newVersion) @@ -347,6 +367,16 @@ MEM_STATIC size_t ZSTD_initLegacyStream(void** legacyContext, U32 prevVersion, U MEM_STATIC size_t ZSTD_decompressLegacyStream(void* legacyContext, U32 version, ZSTD_outBuffer* output, ZSTD_inBuffer* input) { + static char x; + /* Avoid passing NULL to legacy decoding. */ + if (output->dst == NULL) { + assert(output->size == 0); + output->dst = &x; + } + if (input->src == NULL) { + assert(input->size == 0); + input->src = &x; + } DEBUGLOG(5, "ZSTD_decompressLegacyStream for v0.%u", version); switch(version) { diff --git a/vendor/github.com/DataDog/zstd/zstd_opt.c b/vendor/github.com/DataDog/zstd/zstd_opt.c index ca5fdb77..5c8a7406 100644 --- a/vendor/github.com/DataDog/zstd/zstd_opt.c +++ b/vendor/github.com/DataDog/zstd/zstd_opt.c @@ -13,6 +13,9 @@ #include "hist.h" #include "zstd_opt.h" +#if !defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR) \ + || !defined(ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR) \ + || !defined(ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR) #define ZSTD_LITFREQ_ADD 2 /* scaling factor for litFreq, so that frequencies adapt faster to new stats */ #define ZSTD_MAX_PRICE (1<<30) @@ -265,6 +268,7 @@ static U32 ZSTD_rawLiteralsCost(const BYTE* const literals, U32 const litLength, const optState_t* const optPtr, int optLevel) { + DEBUGLOG(8, "ZSTD_rawLiteralsCost (%u literals)", litLength); if (litLength == 0) return 0; if (!ZSTD_compressedLiterals(optPtr)) @@ -403,9 +407,11 @@ MEM_STATIC U32 ZSTD_readMINMATCH(const void* memPtr, U32 length) /* Update hashTable3 up to ip (excluded) Assumption : always within prefix (i.e. not within extDict) */ -static U32 ZSTD_insertAndFindFirstIndexHash3 (const ZSTD_matchState_t* ms, - U32* nextToUpdate3, - const BYTE* const ip) +static +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +U32 ZSTD_insertAndFindFirstIndexHash3 (const ZSTD_matchState_t* ms, + U32* nextToUpdate3, + const BYTE* const ip) { U32* const hashTable3 = ms->hashTable3; U32 const hashLog3 = ms->hashLog3; @@ -432,7 +438,9 @@ static U32 ZSTD_insertAndFindFirstIndexHash3 (const ZSTD_matchState_t* ms, * @param ip assumed <= iend-8 . * @param target The target of ZSTD_updateTree_internal() - we are filling to this position * @return : nb of positions added */ -static U32 ZSTD_insertBt1( +static +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +U32 ZSTD_insertBt1( const ZSTD_matchState_t* ms, const BYTE* const ip, const BYTE* const iend, U32 const target, @@ -551,6 +559,7 @@ static U32 ZSTD_insertBt1( } FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR void ZSTD_updateTree_internal( ZSTD_matchState_t* ms, const BYTE* const ip, const BYTE* const iend, @@ -559,7 +568,7 @@ void ZSTD_updateTree_internal( const BYTE* const base = ms->window.base; U32 const target = (U32)(ip - base); U32 idx = ms->nextToUpdate; - DEBUGLOG(6, "ZSTD_updateTree_internal, from %u to %u (dictMode:%u)", + DEBUGLOG(7, "ZSTD_updateTree_internal, from %u to %u (dictMode:%u)", idx, target, dictMode); while(idx < target) { @@ -576,7 +585,9 @@ void ZSTD_updateTree(ZSTD_matchState_t* ms, const BYTE* ip, const BYTE* iend) { ZSTD_updateTree_internal(ms, ip, iend, ms->cParams.minMatch, ZSTD_noDict); } -FORCE_INLINE_TEMPLATE U32 +FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +U32 ZSTD_insertBtAndGetAllMatches ( ZSTD_match_t* matches, /* store result (found matches) in this table (presumed large enough) */ ZSTD_matchState_t* ms, @@ -817,7 +828,9 @@ typedef U32 (*ZSTD_getAllMatchesFn)( U32 const ll0, U32 const lengthToBeat); -FORCE_INLINE_TEMPLATE U32 ZSTD_btGetAllMatches_internal( +FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +U32 ZSTD_btGetAllMatches_internal( ZSTD_match_t* matches, ZSTD_matchState_t* ms, U32* nextToUpdate3, @@ -1036,11 +1049,6 @@ ZSTD_optLdm_processMatchCandidate(ZSTD_optLdm_t* optLdm, * Optimal parser *********************************/ -static U32 ZSTD_totalLen(ZSTD_optimal_t sol) -{ - return sol.litlen + sol.mlen; -} - #if 0 /* debug */ static void @@ -1058,7 +1066,13 @@ listStats(const U32* table, int lastEltID) #endif -FORCE_INLINE_TEMPLATE size_t +#define LIT_PRICE(_p) (int)ZSTD_rawLiteralsCost(_p, 1, optStatePtr, optLevel) +#define LL_PRICE(_l) (int)ZSTD_litLengthPrice(_l, optStatePtr, optLevel) +#define LL_INCPRICE(_l) (LL_PRICE(_l) - LL_PRICE(_l-1)) + +FORCE_INLINE_TEMPLATE +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +size_t ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], @@ -1084,10 +1098,10 @@ ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms, ZSTD_optimal_t* const opt = optStatePtr->priceTable; ZSTD_match_t* const matches = optStatePtr->matchTable; - ZSTD_optimal_t lastSequence; + ZSTD_optimal_t lastStretch; ZSTD_optLdm_t optLdm; - ZSTD_memset(&lastSequence, 0, sizeof(ZSTD_optimal_t)); + ZSTD_memset(&lastStretch, 0, sizeof(ZSTD_optimal_t)); optLdm.seqStore = ms->ldmSeqStore ? *ms->ldmSeqStore : kNullRawSeqStore; optLdm.endPosInBlock = optLdm.startPosInBlock = optLdm.offset = 0; @@ -1109,19 +1123,31 @@ ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms, U32 const ll0 = !litlen; U32 nbMatches = getAllMatches(matches, ms, &nextToUpdate3, ip, iend, rep, ll0, minMatch); ZSTD_optLdm_processMatchCandidate(&optLdm, matches, &nbMatches, - (U32)(ip-istart), (U32)(iend - ip)); - if (!nbMatches) { ip++; continue; } + (U32)(ip-istart), (U32)(iend-ip)); + if (!nbMatches) { + DEBUGLOG(8, "no match found at cPos %u", (unsigned)(ip-istart)); + ip++; + continue; + } + + /* Match found: let's store this solution, and eventually find more candidates. + * During this forward pass, @opt is used to store stretches, + * defined as "a match followed by N literals". + * Note how this is different from a Sequence, which is "N literals followed by a match". + * Storing stretches allows us to store different match predecessors + * for each literal position part of a literals run. */ /* initialize opt[0] */ - { U32 i ; for (i=0; i immediate encoding */ { U32 const maxML = matches[nbMatches-1].len; @@ -1130,82 +1156,106 @@ ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms, nbMatches, maxML, maxOffBase, (U32)(ip-prefixStart)); if (maxML > sufficient_len) { - lastSequence.litlen = litlen; - lastSequence.mlen = maxML; - lastSequence.off = maxOffBase; - DEBUGLOG(6, "large match (%u>%u), immediate encoding", + lastStretch.litlen = 0; + lastStretch.mlen = maxML; + lastStretch.off = maxOffBase; + DEBUGLOG(6, "large match (%u>%u) => immediate encoding", maxML, sufficient_len); cur = 0; - last_pos = ZSTD_totalLen(lastSequence); + last_pos = maxML; goto _shortestPath; } } /* set prices for first matches starting position == 0 */ assert(opt[0].price >= 0); - { U32 const literalsPrice = (U32)opt[0].price + ZSTD_litLengthPrice(0, optStatePtr, optLevel); - U32 pos; + { U32 pos; U32 matchNb; for (pos = 1; pos < minMatch; pos++) { - opt[pos].price = ZSTD_MAX_PRICE; /* mlen, litlen and price will be fixed during forward scanning */ + opt[pos].price = ZSTD_MAX_PRICE; + opt[pos].mlen = 0; + opt[pos].litlen = litlen + pos; } for (matchNb = 0; matchNb < nbMatches; matchNb++) { U32 const offBase = matches[matchNb].off; U32 const end = matches[matchNb].len; for ( ; pos <= end ; pos++ ) { - U32 const matchPrice = ZSTD_getMatchPrice(offBase, pos, optStatePtr, optLevel); - U32 const sequencePrice = literalsPrice + matchPrice; + int const matchPrice = (int)ZSTD_getMatchPrice(offBase, pos, optStatePtr, optLevel); + int const sequencePrice = opt[0].price + matchPrice; DEBUGLOG(7, "rPos:%u => set initial price : %.2f", - pos, ZSTD_fCost((int)sequencePrice)); + pos, ZSTD_fCost(sequencePrice)); opt[pos].mlen = pos; opt[pos].off = offBase; - opt[pos].litlen = litlen; - opt[pos].price = (int)sequencePrice; - } } + opt[pos].litlen = 0; /* end of match */ + opt[pos].price = sequencePrice + LL_PRICE(0); + } + } last_pos = pos-1; + opt[pos].price = ZSTD_MAX_PRICE; } } /* check further positions */ for (cur = 1; cur <= last_pos; cur++) { const BYTE* const inr = ip + cur; - assert(cur < ZSTD_OPT_NUM); - DEBUGLOG(7, "cPos:%zi==rPos:%u", inr-istart, cur) + assert(cur <= ZSTD_OPT_NUM); + DEBUGLOG(7, "cPos:%zi==rPos:%u", inr-istart, cur); /* Fix current position with one literal if cheaper */ - { U32 const litlen = (opt[cur-1].mlen == 0) ? opt[cur-1].litlen + 1 : 1; + { U32 const litlen = opt[cur-1].litlen + 1; int const price = opt[cur-1].price - + (int)ZSTD_rawLiteralsCost(ip+cur-1, 1, optStatePtr, optLevel) - + (int)ZSTD_litLengthPrice(litlen, optStatePtr, optLevel) - - (int)ZSTD_litLengthPrice(litlen-1, optStatePtr, optLevel); + + LIT_PRICE(ip+cur-1) + + LL_INCPRICE(litlen); assert(price < 1000000000); /* overflow check */ if (price <= opt[cur].price) { + ZSTD_optimal_t const prevMatch = opt[cur]; DEBUGLOG(7, "cPos:%zi==rPos:%u : better price (%.2f<=%.2f) using literal (ll==%u) (hist:%u,%u,%u)", inr-istart, cur, ZSTD_fCost(price), ZSTD_fCost(opt[cur].price), litlen, opt[cur-1].rep[0], opt[cur-1].rep[1], opt[cur-1].rep[2]); - opt[cur].mlen = 0; - opt[cur].off = 0; + opt[cur] = opt[cur-1]; opt[cur].litlen = litlen; opt[cur].price = price; + if ( (optLevel >= 1) /* additional check only for higher modes */ + && (prevMatch.litlen == 0) /* replace a match */ + && (LL_INCPRICE(1) < 0) /* ll1 is cheaper than ll0 */ + && LIKELY(ip + cur < iend) + ) { + /* check next position, in case it would be cheaper */ + int with1literal = prevMatch.price + LIT_PRICE(ip+cur) + LL_INCPRICE(1); + int withMoreLiterals = price + LIT_PRICE(ip+cur) + LL_INCPRICE(litlen+1); + DEBUGLOG(7, "then at next rPos %u : match+1lit %.2f vs %ulits %.2f", + cur+1, ZSTD_fCost(with1literal), litlen+1, ZSTD_fCost(withMoreLiterals)); + if ( (with1literal < withMoreLiterals) + && (with1literal < opt[cur+1].price) ) { + /* update offset history - before it disappears */ + U32 const prev = cur - prevMatch.mlen; + repcodes_t const newReps = ZSTD_newRep(opt[prev].rep, prevMatch.off, opt[prev].litlen==0); + assert(cur >= prevMatch.mlen); + DEBUGLOG(7, "==> match+1lit is cheaper (%.2f < %.2f) (hist:%u,%u,%u) !", + ZSTD_fCost(with1literal), ZSTD_fCost(withMoreLiterals), + newReps.rep[0], newReps.rep[1], newReps.rep[2] ); + opt[cur+1] = prevMatch; /* mlen & offbase */ + ZSTD_memcpy(opt[cur+1].rep, &newReps, sizeof(repcodes_t)); + opt[cur+1].litlen = 1; + opt[cur+1].price = with1literal; + if (last_pos < cur+1) last_pos = cur+1; + } + } } else { - DEBUGLOG(7, "cPos:%zi==rPos:%u : literal would cost more (%.2f>%.2f) (hist:%u,%u,%u)", - inr-istart, cur, ZSTD_fCost(price), ZSTD_fCost(opt[cur].price), - opt[cur].rep[0], opt[cur].rep[1], opt[cur].rep[2]); + DEBUGLOG(7, "cPos:%zi==rPos:%u : literal would cost more (%.2f>%.2f)", + inr-istart, cur, ZSTD_fCost(price), ZSTD_fCost(opt[cur].price)); } } - /* Set the repcodes of the current position. We must do it here - * because we rely on the repcodes of the 2nd to last sequence being - * correct to set the next chunks repcodes during the backward - * traversal. + /* Offset history is not updated during match comparison. + * Do it here, now that the match is selected and confirmed. */ ZSTD_STATIC_ASSERT(sizeof(opt[cur].rep) == sizeof(repcodes_t)); assert(cur >= opt[cur].mlen); - if (opt[cur].mlen != 0) { + if (opt[cur].litlen == 0) { + /* just finished a match => alter offset history */ U32 const prev = cur - opt[cur].mlen; - repcodes_t const newReps = ZSTD_newRep(opt[prev].rep, opt[cur].off, opt[cur].litlen==0); + repcodes_t const newReps = ZSTD_newRep(opt[prev].rep, opt[cur].off, opt[prev].litlen==0); ZSTD_memcpy(opt[cur].rep, &newReps, sizeof(repcodes_t)); - } else { - ZSTD_memcpy(opt[cur].rep, opt[cur - 1].rep, sizeof(repcodes_t)); } /* last match must start at a minimum distance of 8 from oend */ @@ -1215,15 +1265,14 @@ ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms, if ( (optLevel==0) /*static_test*/ && (opt[cur+1].price <= opt[cur].price + (BITCOST_MULTIPLIER/2)) ) { - DEBUGLOG(7, "move to next rPos:%u : price is <=", cur+1); + DEBUGLOG(7, "skip current position : next rPos(%u) price is cheaper", cur+1); continue; /* skip unpromising positions; about ~+6% speed, -0.01 ratio */ } assert(opt[cur].price >= 0); - { U32 const ll0 = (opt[cur].mlen != 0); - U32 const litlen = (opt[cur].mlen == 0) ? opt[cur].litlen : 0; - U32 const previousPrice = (U32)opt[cur].price; - U32 const basePrice = previousPrice + ZSTD_litLengthPrice(0, optStatePtr, optLevel); + { U32 const ll0 = (opt[cur].litlen == 0); + int const previousPrice = opt[cur].price; + int const basePrice = previousPrice + LL_PRICE(0); U32 nbMatches = getAllMatches(matches, ms, &nextToUpdate3, inr, iend, opt[cur].rep, ll0, minMatch); U32 matchNb; @@ -1235,18 +1284,17 @@ ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms, continue; } - { U32 const maxML = matches[nbMatches-1].len; - DEBUGLOG(7, "cPos:%zi==rPos:%u, found %u matches, of maxLength=%u", - inr-istart, cur, nbMatches, maxML); + { U32 const longestML = matches[nbMatches-1].len; + DEBUGLOG(7, "cPos:%zi==rPos:%u, found %u matches, of longest ML=%u", + inr-istart, cur, nbMatches, longestML); - if ( (maxML > sufficient_len) - || (cur + maxML >= ZSTD_OPT_NUM) ) { - lastSequence.mlen = maxML; - lastSequence.off = matches[nbMatches-1].off; - lastSequence.litlen = litlen; - cur -= (opt[cur].mlen==0) ? opt[cur].litlen : 0; /* last sequence is actually only literals, fix cur to last match - note : may underflow, in which case, it's first sequence, and it's okay */ - last_pos = cur + ZSTD_totalLen(lastSequence); - if (cur > ZSTD_OPT_NUM) cur = 0; /* underflow => first match */ + if ( (longestML > sufficient_len) + || (cur + longestML >= ZSTD_OPT_NUM) + || (ip + cur + longestML >= iend) ) { + lastStretch.mlen = longestML; + lastStretch.off = matches[nbMatches-1].off; + lastStretch.litlen = 0; + last_pos = cur + longestML; goto _shortestPath; } } @@ -1258,19 +1306,24 @@ ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms, U32 mlen; DEBUGLOG(7, "testing match %u => offBase=%4u, mlen=%2u, llen=%2u", - matchNb, matches[matchNb].off, lastML, litlen); + matchNb, matches[matchNb].off, lastML, opt[cur].litlen); for (mlen = lastML; mlen >= startML; mlen--) { /* scan downward */ U32 const pos = cur + mlen; - int const price = (int)basePrice + (int)ZSTD_getMatchPrice(offset, mlen, optStatePtr, optLevel); + int const price = basePrice + (int)ZSTD_getMatchPrice(offset, mlen, optStatePtr, optLevel); if ((pos > last_pos) || (price < opt[pos].price)) { DEBUGLOG(7, "rPos:%u (ml=%2u) => new better price (%.2f<%.2f)", pos, mlen, ZSTD_fCost(price), ZSTD_fCost(opt[pos].price)); - while (last_pos < pos) { opt[last_pos+1].price = ZSTD_MAX_PRICE; last_pos++; } /* fill empty positions */ + while (last_pos < pos) { + /* fill empty positions, for future comparisons */ + last_pos++; + opt[last_pos].price = ZSTD_MAX_PRICE; + opt[last_pos].litlen = !0; /* just needs to be != 0, to mean "not an end of match" */ + } opt[pos].mlen = mlen; opt[pos].off = offset; - opt[pos].litlen = litlen; + opt[pos].litlen = 0; opt[pos].price = price; } else { DEBUGLOG(7, "rPos:%u (ml=%2u) => new price is worse (%.2f>=%.2f)", @@ -1278,47 +1331,81 @@ ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms, if (optLevel==0) break; /* early update abort; gets ~+10% speed for about -0.01 ratio loss */ } } } } + opt[last_pos+1].price = ZSTD_MAX_PRICE; } /* for (cur = 1; cur <= last_pos; cur++) */ - lastSequence = opt[last_pos]; - cur = last_pos > ZSTD_totalLen(lastSequence) ? last_pos - ZSTD_totalLen(lastSequence) : 0; /* single sequence, and it starts before `ip` */ - assert(cur < ZSTD_OPT_NUM); /* control overflow*/ + lastStretch = opt[last_pos]; + assert(cur >= lastStretch.mlen); + cur = last_pos - lastStretch.mlen; _shortestPath: /* cur, last_pos, best_mlen, best_off have to be set */ assert(opt[0].mlen == 0); + assert(last_pos >= lastStretch.mlen); + assert(cur == last_pos - lastStretch.mlen); - /* Set the next chunk's repcodes based on the repcodes of the beginning - * of the last match, and the last sequence. This avoids us having to - * update them while traversing the sequences. - */ - if (lastSequence.mlen != 0) { - repcodes_t const reps = ZSTD_newRep(opt[cur].rep, lastSequence.off, lastSequence.litlen==0); - ZSTD_memcpy(rep, &reps, sizeof(reps)); + if (lastStretch.mlen==0) { + /* no solution : all matches have been converted into literals */ + assert(lastStretch.litlen == (ip - anchor) + last_pos); + ip += last_pos; + continue; + } + assert(lastStretch.off > 0); + + /* Update offset history */ + if (lastStretch.litlen == 0) { + /* finishing on a match : update offset history */ + repcodes_t const reps = ZSTD_newRep(opt[cur].rep, lastStretch.off, opt[cur].litlen==0); + ZSTD_memcpy(rep, &reps, sizeof(repcodes_t)); } else { - ZSTD_memcpy(rep, opt[cur].rep, sizeof(repcodes_t)); + ZSTD_memcpy(rep, lastStretch.rep, sizeof(repcodes_t)); + assert(cur >= lastStretch.litlen); + cur -= lastStretch.litlen; } - { U32 const storeEnd = cur + 1; + /* Let's write the shortest path solution. + * It is stored in @opt in reverse order, + * starting from @storeEnd (==cur+2), + * effectively partially @opt overwriting. + * Content is changed too: + * - So far, @opt stored stretches, aka a match followed by literals + * - Now, it will store sequences, aka literals followed by a match + */ + { U32 const storeEnd = cur + 2; U32 storeStart = storeEnd; - U32 seqPos = cur; + U32 stretchPos = cur; DEBUGLOG(6, "start reverse traversal (last_pos:%u, cur:%u)", last_pos, cur); (void)last_pos; - assert(storeEnd < ZSTD_OPT_NUM); - DEBUGLOG(6, "last sequence copied into pos=%u (llen=%u,mlen=%u,ofc=%u)", - storeEnd, lastSequence.litlen, lastSequence.mlen, lastSequence.off); - opt[storeEnd] = lastSequence; - while (seqPos > 0) { - U32 const backDist = ZSTD_totalLen(opt[seqPos]); + assert(storeEnd < ZSTD_OPT_SIZE); + DEBUGLOG(6, "last stretch copied into pos=%u (llen=%u,mlen=%u,ofc=%u)", + storeEnd, lastStretch.litlen, lastStretch.mlen, lastStretch.off); + if (lastStretch.litlen > 0) { + /* last "sequence" is unfinished: just a bunch of literals */ + opt[storeEnd].litlen = lastStretch.litlen; + opt[storeEnd].mlen = 0; + storeStart = storeEnd-1; + opt[storeStart] = lastStretch; + } { + opt[storeEnd] = lastStretch; /* note: litlen will be fixed */ + storeStart = storeEnd; + } + while (1) { + ZSTD_optimal_t nextStretch = opt[stretchPos]; + opt[storeStart].litlen = nextStretch.litlen; + DEBUGLOG(6, "selected sequence (llen=%u,mlen=%u,ofc=%u)", + opt[storeStart].litlen, opt[storeStart].mlen, opt[storeStart].off); + if (nextStretch.mlen == 0) { + /* reaching beginning of segment */ + break; + } storeStart--; - DEBUGLOG(6, "sequence from rPos=%u copied into pos=%u (llen=%u,mlen=%u,ofc=%u)", - seqPos, storeStart, opt[seqPos].litlen, opt[seqPos].mlen, opt[seqPos].off); - opt[storeStart] = opt[seqPos]; - seqPos = (seqPos > backDist) ? seqPos - backDist : 0; + opt[storeStart] = nextStretch; /* note: litlen will be fixed */ + assert(nextStretch.litlen + nextStretch.mlen <= stretchPos); + stretchPos -= nextStretch.litlen + nextStretch.mlen; } /* save sequences */ - DEBUGLOG(6, "sending selected sequences into seqStore") + DEBUGLOG(6, "sending selected sequences into seqStore"); { U32 storePos; for (storePos=storeStart; storePos <= storeEnd; storePos++) { U32 const llen = opt[storePos].litlen; @@ -1340,6 +1427,9 @@ _shortestPath: /* cur, last_pos, best_mlen, best_off have to be set */ anchor += advance; ip = anchor; } } + DEBUGLOG(7, "new offset history : %u, %u, %u", rep[0], rep[1], rep[2]); + + /* update all costs */ ZSTD_setBasePrices(optStatePtr, optLevel); } } /* while (ip < ilimit) */ @@ -1347,21 +1437,27 @@ _shortestPath: /* cur, last_pos, best_mlen, best_off have to be set */ /* Return the last literals size */ return (size_t)(iend - anchor); } +#endif /* build exclusions */ +#ifndef ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR static size_t ZSTD_compressBlock_opt0( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], const void* src, size_t srcSize, const ZSTD_dictMode_e dictMode) { return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 0 /* optLevel */, dictMode); } +#endif +#ifndef ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR static size_t ZSTD_compressBlock_opt2( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], const void* src, size_t srcSize, const ZSTD_dictMode_e dictMode) { return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 2 /* optLevel */, dictMode); } +#endif +#ifndef ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR size_t ZSTD_compressBlock_btopt( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], const void* src, size_t srcSize) @@ -1369,20 +1465,23 @@ size_t ZSTD_compressBlock_btopt( DEBUGLOG(5, "ZSTD_compressBlock_btopt"); return ZSTD_compressBlock_opt0(ms, seqStore, rep, src, srcSize, ZSTD_noDict); } +#endif +#ifndef ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR /* ZSTD_initStats_ultra(): * make a first compression pass, just to seed stats with more accurate starting values. * only works on first block, with no dictionary and no ldm. * this function cannot error out, its narrow contract must be respected. */ -static void -ZSTD_initStats_ultra(ZSTD_matchState_t* ms, - seqStore_t* seqStore, - U32 rep[ZSTD_REP_NUM], - const void* src, size_t srcSize) +static +ZSTD_ALLOW_POINTER_OVERFLOW_ATTR +void ZSTD_initStats_ultra(ZSTD_matchState_t* ms, + seqStore_t* seqStore, + U32 rep[ZSTD_REP_NUM], + const void* src, size_t srcSize) { U32 tmpRep[ZSTD_REP_NUM]; /* updated rep codes will sink here */ ZSTD_memcpy(tmpRep, rep, sizeof(tmpRep)); @@ -1426,7 +1525,7 @@ size_t ZSTD_compressBlock_btultra2( * Consequently, this can only work if no data has been previously loaded in tables, * aka, no dictionary, no prefix, no ldm preprocessing. * The compression ratio gain is generally small (~0.5% on first block), - ** the cost is 2x cpu time on first block. */ + * the cost is 2x cpu time on first block. */ assert(srcSize <= ZSTD_BLOCKSIZE_MAX); if ( (ms->opt.litLengthSum==0) /* first block */ && (seqStore->sequences == seqStore->sequencesStart) /* no ldm */ @@ -1439,7 +1538,9 @@ size_t ZSTD_compressBlock_btultra2( return ZSTD_compressBlock_opt2(ms, seqStore, rep, src, srcSize, ZSTD_noDict); } +#endif +#ifndef ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR size_t ZSTD_compressBlock_btopt_dictMatchState( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], const void* src, size_t srcSize) @@ -1447,19 +1548,21 @@ size_t ZSTD_compressBlock_btopt_dictMatchState( return ZSTD_compressBlock_opt0(ms, seqStore, rep, src, srcSize, ZSTD_dictMatchState); } -size_t ZSTD_compressBlock_btultra_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - const void* src, size_t srcSize) -{ - return ZSTD_compressBlock_opt2(ms, seqStore, rep, src, srcSize, ZSTD_dictMatchState); -} - size_t ZSTD_compressBlock_btopt_extDict( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], const void* src, size_t srcSize) { return ZSTD_compressBlock_opt0(ms, seqStore, rep, src, srcSize, ZSTD_extDict); } +#endif + +#ifndef ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR +size_t ZSTD_compressBlock_btultra_dictMatchState( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + const void* src, size_t srcSize) +{ + return ZSTD_compressBlock_opt2(ms, seqStore, rep, src, srcSize, ZSTD_dictMatchState); +} size_t ZSTD_compressBlock_btultra_extDict( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], @@ -1467,6 +1570,7 @@ size_t ZSTD_compressBlock_btultra_extDict( { return ZSTD_compressBlock_opt2(ms, seqStore, rep, src, srcSize, ZSTD_extDict); } +#endif /* note : no btultra2 variant for extDict nor dictMatchState, * because btultra2 is not meant to work with dictionaries diff --git a/vendor/github.com/DataDog/zstd/zstd_opt.h b/vendor/github.com/DataDog/zstd/zstd_opt.h index 3eb02f57..c52431d8 100644 --- a/vendor/github.com/DataDog/zstd/zstd_opt.h +++ b/vendor/github.com/DataDog/zstd/zstd_opt.h @@ -18,28 +18,38 @@ extern "C" { #include "zstd_compress_internal.h" +#if !defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR) \ + || !defined(ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR) \ + || !defined(ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR) /* used in ZSTD_loadDictionaryContent() */ void ZSTD_updateTree(ZSTD_matchState_t* ms, const BYTE* ip, const BYTE* iend); +#endif +#ifndef ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR size_t ZSTD_compressBlock_btopt( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); -size_t ZSTD_compressBlock_btultra( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_btultra2( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); - - size_t ZSTD_compressBlock_btopt_dictMatchState( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); -size_t ZSTD_compressBlock_btultra_dictMatchState( +size_t ZSTD_compressBlock_btopt_extDict( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); -size_t ZSTD_compressBlock_btopt_extDict( +#define ZSTD_COMPRESSBLOCK_BTOPT ZSTD_compressBlock_btopt +#define ZSTD_COMPRESSBLOCK_BTOPT_DICTMATCHSTATE ZSTD_compressBlock_btopt_dictMatchState +#define ZSTD_COMPRESSBLOCK_BTOPT_EXTDICT ZSTD_compressBlock_btopt_extDict +#else +#define ZSTD_COMPRESSBLOCK_BTOPT NULL +#define ZSTD_COMPRESSBLOCK_BTOPT_DICTMATCHSTATE NULL +#define ZSTD_COMPRESSBLOCK_BTOPT_EXTDICT NULL +#endif + +#ifndef ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR +size_t ZSTD_compressBlock_btultra( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); +size_t ZSTD_compressBlock_btultra_dictMatchState( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); size_t ZSTD_compressBlock_btultra_extDict( @@ -49,6 +59,20 @@ size_t ZSTD_compressBlock_btultra_extDict( /* note : no btultra2 variant for extDict nor dictMatchState, * because btultra2 is not meant to work with dictionaries * and is only specific for the first block (no prefix) */ +size_t ZSTD_compressBlock_btultra2( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize); + +#define ZSTD_COMPRESSBLOCK_BTULTRA ZSTD_compressBlock_btultra +#define ZSTD_COMPRESSBLOCK_BTULTRA_DICTMATCHSTATE ZSTD_compressBlock_btultra_dictMatchState +#define ZSTD_COMPRESSBLOCK_BTULTRA_EXTDICT ZSTD_compressBlock_btultra_extDict +#define ZSTD_COMPRESSBLOCK_BTULTRA2 ZSTD_compressBlock_btultra2 +#else +#define ZSTD_COMPRESSBLOCK_BTULTRA NULL +#define ZSTD_COMPRESSBLOCK_BTULTRA_DICTMATCHSTATE NULL +#define ZSTD_COMPRESSBLOCK_BTULTRA_EXTDICT NULL +#define ZSTD_COMPRESSBLOCK_BTULTRA2 NULL +#endif #if defined (__cplusplus) } diff --git a/vendor/github.com/DataDog/zstd/zstd_v01.c b/vendor/github.com/DataDog/zstd/zstd_v01.c index cee369d8..2c2b9ba5 100644 --- a/vendor/github.com/DataDog/zstd/zstd_v01.c +++ b/vendor/github.com/DataDog/zstd/zstd_v01.c @@ -15,6 +15,7 @@ ******************************************/ #include /* size_t, ptrdiff_t */ #include "zstd_v01.h" +#include "compiler.h" #include "error_private.h" @@ -2119,6 +2120,7 @@ size_t ZSTDv01_decompressContinue(ZSTDv01_Dctx* dctx, void* dst, size_t maxDstSi } ctx->phase = 1; ctx->expected = ZSTD_blockHeaderSize; + if (ZSTDv01_isError(rSize)) return rSize; ctx->previousDstEnd = (void*)( ((char*)dst) + rSize); return rSize; } diff --git a/vendor/github.com/DataDog/zstd/zstd_v02.c b/vendor/github.com/DataDog/zstd/zstd_v02.c index cc33658d..cd462dea 100644 --- a/vendor/github.com/DataDog/zstd/zstd_v02.c +++ b/vendor/github.com/DataDog/zstd/zstd_v02.c @@ -12,6 +12,7 @@ #include /* size_t, ptrdiff_t */ #include "zstd_v02.h" +#include "compiler.h" #include "error_private.h" @@ -72,20 +73,6 @@ extern "C" { #include /* memcpy */ -/****************************************** -* Compiler-specific -******************************************/ -#if defined(__GNUC__) -# define MEM_STATIC static __attribute__((unused)) -#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -# define MEM_STATIC static inline -#elif defined(_MSC_VER) -# define MEM_STATIC static __inline -#else -# define MEM_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */ -#endif - - /**************************************************************** * Basic Types *****************************************************************/ @@ -876,7 +863,7 @@ extern "C" { * Streaming functions ***************************************/ -typedef struct ZSTD_DCtx_s ZSTD_DCtx; +typedef struct ZSTDv02_Dctx_s ZSTD_DCtx; /* Use above functions alternatively. @@ -2751,7 +2738,7 @@ static unsigned ZSTD_isError(size_t code) { return ERR_isError(code); } /* ************************************************************* * Decompression section ***************************************************************/ -struct ZSTD_DCtx_s +struct ZSTDv02_Dctx_s { U32 LLTable[FSE_DTABLE_SIZE_U32(LLFSELog)]; U32 OffTable[FSE_DTABLE_SIZE_U32(OffFSELog)]; @@ -3432,6 +3419,7 @@ static size_t ZSTD_decompressContinue(ZSTD_DCtx* ctx, void* dst, size_t maxDstSi } ctx->phase = 1; ctx->expected = ZSTD_blockHeaderSize; + if (ZSTD_isError(rSize)) return rSize; ctx->previousDstEnd = (void*)( ((char*)dst) + rSize); return rSize; } diff --git a/vendor/github.com/DataDog/zstd/zstd_v03.c b/vendor/github.com/DataDog/zstd/zstd_v03.c index af98cac7..9f6ceae1 100644 --- a/vendor/github.com/DataDog/zstd/zstd_v03.c +++ b/vendor/github.com/DataDog/zstd/zstd_v03.c @@ -12,6 +12,7 @@ #include /* size_t, ptrdiff_t */ #include "zstd_v03.h" +#include "compiler.h" #include "error_private.h" @@ -73,20 +74,6 @@ extern "C" { #include /* memcpy */ -/****************************************** -* Compiler-specific -******************************************/ -#if defined(__GNUC__) -# define MEM_STATIC static __attribute__((unused)) -#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -# define MEM_STATIC static inline -#elif defined(_MSC_VER) -# define MEM_STATIC static __inline -#else -# define MEM_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */ -#endif - - /**************************************************************** * Basic Types *****************************************************************/ @@ -876,7 +863,7 @@ extern "C" { * Streaming functions ***************************************/ -typedef struct ZSTD_DCtx_s ZSTD_DCtx; +typedef struct ZSTDv03_Dctx_s ZSTD_DCtx; /* Use above functions alternatively. @@ -2391,7 +2378,7 @@ static unsigned ZSTD_isError(size_t code) { return ERR_isError(code); } /* ************************************************************* * Decompression section ***************************************************************/ -struct ZSTD_DCtx_s +struct ZSTDv03_Dctx_s { U32 LLTable[FSE_DTABLE_SIZE_U32(LLFSELog)]; U32 OffTable[FSE_DTABLE_SIZE_U32(OffFSELog)]; @@ -3072,6 +3059,7 @@ static size_t ZSTD_decompressContinue(ZSTD_DCtx* ctx, void* dst, size_t maxDstSi } ctx->phase = 1; ctx->expected = ZSTD_blockHeaderSize; + if (ZSTD_isError(rSize)) return rSize; ctx->previousDstEnd = (void*)( ((char*)dst) + rSize); return rSize; } diff --git a/vendor/github.com/DataDog/zstd/zstd_v04.c b/vendor/github.com/DataDog/zstd/zstd_v04.c index b353ddc3..c93b7118 100644 --- a/vendor/github.com/DataDog/zstd/zstd_v04.c +++ b/vendor/github.com/DataDog/zstd/zstd_v04.c @@ -17,6 +17,7 @@ #include /* memcpy */ #include "zstd_v04.h" +#include "compiler.h" #include "error_private.h" @@ -38,15 +39,6 @@ extern "C" { # include /* _byteswap_ulong */ # include /* _byteswap_* */ #endif -#if defined(__GNUC__) -# define MEM_STATIC static __attribute__((unused)) -#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -# define MEM_STATIC static inline -#elif defined(_MSC_VER) -# define MEM_STATIC static __inline -#else -# define MEM_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */ -#endif /**************************************************************** @@ -3219,6 +3211,7 @@ static size_t ZSTD_decompressContinue(ZSTD_DCtx* ctx, void* dst, size_t maxDstSi } ctx->stage = ZSTDds_decodeBlockHeader; ctx->expected = ZSTD_blockHeaderSize; + if (ZSTD_isError(rSize)) return rSize; ctx->previousDstEnd = (char*)dst + rSize; return rSize; } @@ -3546,8 +3539,8 @@ static size_t ZBUFF_decompressContinue(ZBUFF_DCtx* zbc, void* dst, size_t* maxDs unsigned ZBUFFv04_isError(size_t errorCode) { return ERR_isError(errorCode); } const char* ZBUFFv04_getErrorName(size_t errorCode) { return ERR_getErrorName(errorCode); } -size_t ZBUFFv04_recommendedDInSize() { return BLOCKSIZE + 3; } -size_t ZBUFFv04_recommendedDOutSize() { return BLOCKSIZE; } +size_t ZBUFFv04_recommendedDInSize(void) { return BLOCKSIZE + 3; } +size_t ZBUFFv04_recommendedDOutSize(void) { return BLOCKSIZE; } diff --git a/vendor/github.com/DataDog/zstd/zstd_v05.c b/vendor/github.com/DataDog/zstd/zstd_v05.c index a91166a0..95fd267e 100644 --- a/vendor/github.com/DataDog/zstd/zstd_v05.c +++ b/vendor/github.com/DataDog/zstd/zstd_v05.c @@ -3601,6 +3601,7 @@ size_t ZSTDv05_decompressContinue(ZSTDv05_DCtx* dctx, void* dst, size_t maxDstSi } dctx->stage = ZSTDv05ds_decodeBlockHeader; dctx->expected = ZSTDv05_blockHeaderSize; + if (ZSTDv05_isError(rSize)) return rSize; dctx->previousDstEnd = (char*)dst + rSize; return rSize; } diff --git a/vendor/github.com/DataDog/zstd/zstd_v06.c b/vendor/github.com/DataDog/zstd/zstd_v06.c index 0fd4225f..e6d410ef 100644 --- a/vendor/github.com/DataDog/zstd/zstd_v06.c +++ b/vendor/github.com/DataDog/zstd/zstd_v06.c @@ -15,6 +15,7 @@ #include /* size_t, ptrdiff_t */ #include /* memcpy */ #include /* malloc, free, qsort */ +#include "compiler.h" #include "error_private.h" @@ -68,15 +69,6 @@ extern "C" { # include /* _byteswap_ulong */ # include /* _byteswap_* */ #endif -#if defined(__GNUC__) -# define MEM_STATIC static __attribute__((unused)) -#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -# define MEM_STATIC static inline -#elif defined(_MSC_VER) -# define MEM_STATIC static __inline -#else -# define MEM_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */ -#endif /*-************************************************************** @@ -3746,6 +3738,7 @@ size_t ZSTDv06_decompressContinue(ZSTDv06_DCtx* dctx, void* dst, size_t dstCapac } dctx->stage = ZSTDds_decodeBlockHeader; dctx->expected = ZSTDv06_blockHeaderSize; + if (ZSTDv06_isError(rSize)) return rSize; dctx->previousDstEnd = (char*)dst + rSize; return rSize; } diff --git a/vendor/github.com/DataDog/zstd/zstd_v07.c b/vendor/github.com/DataDog/zstd/zstd_v07.c index 60d77e07..a44b1d64 100644 --- a/vendor/github.com/DataDog/zstd/zstd_v07.c +++ b/vendor/github.com/DataDog/zstd/zstd_v07.c @@ -25,6 +25,7 @@ #define HUFv07_STATIC_LINKING_ONLY /* HUFv07_TABLELOG_ABSOLUTEMAX */ #define ZSTDv07_STATIC_LINKING_ONLY +#include "compiler.h" #include "error_private.h" @@ -228,15 +229,6 @@ extern "C" { # include /* _byteswap_ulong */ # include /* _byteswap_* */ #endif -#if defined(__GNUC__) -# define MEM_STATIC static __attribute__((unused)) -#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -# define MEM_STATIC static inline -#elif defined(_MSC_VER) -# define MEM_STATIC static __inline -#else -# define MEM_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */ -#endif /*-************************************************************** @@ -4016,8 +4008,8 @@ size_t ZSTDv07_decompressContinue(ZSTDv07_DCtx* dctx, void* dst, size_t dstCapac } dctx->stage = ZSTDds_decodeBlockHeader; dctx->expected = ZSTDv07_blockHeaderSize; - dctx->previousDstEnd = (char*)dst + rSize; if (ZSTDv07_isError(rSize)) return rSize; + dctx->previousDstEnd = (char*)dst + rSize; if (dctx->fParams.checksumFlag) XXH64_update(&dctx->xxhState, dst, rSize); return rSize; } diff --git a/vendor/github.com/DataDog/zstd/zstdmt_compress.c b/vendor/github.com/DataDog/zstd/zstdmt_compress.c index 215cf8ba..d8be6f50 100644 --- a/vendor/github.com/DataDog/zstd/zstdmt_compress.c +++ b/vendor/github.com/DataDog/zstd/zstdmt_compress.c @@ -16,17 +16,13 @@ #endif -/* ====== Constants ====== */ -#define ZSTDMT_OVERLAPLOG_DEFAULT 0 - - /* ====== Dependencies ====== */ -#include "allocations.h" /* ZSTD_customMalloc, ZSTD_customCalloc, ZSTD_customFree */ +#include "allocations.h" /* ZSTD_customMalloc, ZSTD_customCalloc, ZSTD_customFree */ #include "zstd_deps.h" /* ZSTD_memcpy, ZSTD_memset, INT_MAX, UINT_MAX */ #include "mem.h" /* MEM_STATIC */ #include "pool.h" /* threadpool */ #include "threading.h" /* mutex */ -#include "zstd_compress_internal.h" /* MIN, ERROR, ZSTD_*, ZSTD_highbit32 */ +#include "zstd_compress_internal.h" /* MIN, ERROR, ZSTD_*, ZSTD_highbit32 */ #include "zstd_ldm.h" #include "zstdmt_compress.h" @@ -45,12 +41,13 @@ # include # include -# define DEBUG_PRINTHEX(l,p,n) { \ - unsigned debug_u; \ - for (debug_u=0; debug_u<(n); debug_u++) \ - RAWLOG(l, "%02X ", ((const unsigned char*)(p))[debug_u]); \ - RAWLOG(l, " \n"); \ -} +# define DEBUG_PRINTHEX(l,p,n) \ + do { \ + unsigned debug_u; \ + for (debug_u=0; debug_u<(n); debug_u++) \ + RAWLOG(l, "%02X ", ((const unsigned char*)(p))[debug_u]); \ + RAWLOG(l, " \n"); \ + } while (0) static unsigned long long GetCurrentClockTimeMicroseconds(void) { @@ -62,25 +59,28 @@ static unsigned long long GetCurrentClockTimeMicroseconds(void) } } #define MUTEX_WAIT_TIME_DLEVEL 6 -#define ZSTD_PTHREAD_MUTEX_LOCK(mutex) { \ - if (DEBUGLEVEL >= MUTEX_WAIT_TIME_DLEVEL) { \ - unsigned long long const beforeTime = GetCurrentClockTimeMicroseconds(); \ - ZSTD_pthread_mutex_lock(mutex); \ - { unsigned long long const afterTime = GetCurrentClockTimeMicroseconds(); \ - unsigned long long const elapsedTime = (afterTime-beforeTime); \ - if (elapsedTime > 1000) { /* or whatever threshold you like; I'm using 1 millisecond here */ \ - DEBUGLOG(MUTEX_WAIT_TIME_DLEVEL, "Thread took %llu microseconds to acquire mutex %s \n", \ - elapsedTime, #mutex); \ - } } \ - } else { \ - ZSTD_pthread_mutex_lock(mutex); \ - } \ -} +#define ZSTD_PTHREAD_MUTEX_LOCK(mutex) \ + do { \ + if (DEBUGLEVEL >= MUTEX_WAIT_TIME_DLEVEL) { \ + unsigned long long const beforeTime = GetCurrentClockTimeMicroseconds(); \ + ZSTD_pthread_mutex_lock(mutex); \ + { unsigned long long const afterTime = GetCurrentClockTimeMicroseconds(); \ + unsigned long long const elapsedTime = (afterTime-beforeTime); \ + if (elapsedTime > 1000) { \ + /* or whatever threshold you like; I'm using 1 millisecond here */ \ + DEBUGLOG(MUTEX_WAIT_TIME_DLEVEL, \ + "Thread took %llu microseconds to acquire mutex %s \n", \ + elapsedTime, #mutex); \ + } } \ + } else { \ + ZSTD_pthread_mutex_lock(mutex); \ + } \ + } while (0) #else # define ZSTD_PTHREAD_MUTEX_LOCK(m) ZSTD_pthread_mutex_lock(m) -# define DEBUG_PRINTHEX(l,p,n) {} +# define DEBUG_PRINTHEX(l,p,n) do { } while (0) #endif @@ -101,18 +101,39 @@ typedef struct ZSTDMT_bufferPool_s { unsigned totalBuffers; unsigned nbBuffers; ZSTD_customMem cMem; - buffer_t bTable[1]; /* variable size */ + buffer_t* buffers; } ZSTDMT_bufferPool; +static void ZSTDMT_freeBufferPool(ZSTDMT_bufferPool* bufPool) +{ + DEBUGLOG(3, "ZSTDMT_freeBufferPool (address:%08X)", (U32)(size_t)bufPool); + if (!bufPool) return; /* compatibility with free on NULL */ + if (bufPool->buffers) { + unsigned u; + for (u=0; utotalBuffers; u++) { + DEBUGLOG(4, "free buffer %2u (address:%08X)", u, (U32)(size_t)bufPool->buffers[u].start); + ZSTD_customFree(bufPool->buffers[u].start, bufPool->cMem); + } + ZSTD_customFree(bufPool->buffers, bufPool->cMem); + } + ZSTD_pthread_mutex_destroy(&bufPool->poolMutex); + ZSTD_customFree(bufPool, bufPool->cMem); +} + static ZSTDMT_bufferPool* ZSTDMT_createBufferPool(unsigned maxNbBuffers, ZSTD_customMem cMem) { - ZSTDMT_bufferPool* const bufPool = (ZSTDMT_bufferPool*)ZSTD_customCalloc( - sizeof(ZSTDMT_bufferPool) + (maxNbBuffers-1) * sizeof(buffer_t), cMem); + ZSTDMT_bufferPool* const bufPool = + (ZSTDMT_bufferPool*)ZSTD_customCalloc(sizeof(ZSTDMT_bufferPool), cMem); if (bufPool==NULL) return NULL; if (ZSTD_pthread_mutex_init(&bufPool->poolMutex, NULL)) { ZSTD_customFree(bufPool, cMem); return NULL; } + bufPool->buffers = (buffer_t*)ZSTD_customCalloc(maxNbBuffers * sizeof(buffer_t), cMem); + if (bufPool->buffers==NULL) { + ZSTDMT_freeBufferPool(bufPool); + return NULL; + } bufPool->bufferSize = 64 KB; bufPool->totalBuffers = maxNbBuffers; bufPool->nbBuffers = 0; @@ -120,32 +141,19 @@ static ZSTDMT_bufferPool* ZSTDMT_createBufferPool(unsigned maxNbBuffers, ZSTD_cu return bufPool; } -static void ZSTDMT_freeBufferPool(ZSTDMT_bufferPool* bufPool) -{ - unsigned u; - DEBUGLOG(3, "ZSTDMT_freeBufferPool (address:%08X)", (U32)(size_t)bufPool); - if (!bufPool) return; /* compatibility with free on NULL */ - for (u=0; utotalBuffers; u++) { - DEBUGLOG(4, "free buffer %2u (address:%08X)", u, (U32)(size_t)bufPool->bTable[u].start); - ZSTD_customFree(bufPool->bTable[u].start, bufPool->cMem); - } - ZSTD_pthread_mutex_destroy(&bufPool->poolMutex); - ZSTD_customFree(bufPool, bufPool->cMem); -} - /* only works at initialization, not during compression */ static size_t ZSTDMT_sizeof_bufferPool(ZSTDMT_bufferPool* bufPool) { - size_t const poolSize = sizeof(*bufPool) - + (bufPool->totalBuffers - 1) * sizeof(buffer_t); + size_t const poolSize = sizeof(*bufPool); + size_t const arraySize = bufPool->totalBuffers * sizeof(buffer_t); unsigned u; size_t totalBufferSize = 0; ZSTD_pthread_mutex_lock(&bufPool->poolMutex); for (u=0; utotalBuffers; u++) - totalBufferSize += bufPool->bTable[u].capacity; + totalBufferSize += bufPool->buffers[u].capacity; ZSTD_pthread_mutex_unlock(&bufPool->poolMutex); - return poolSize + totalBufferSize; + return poolSize + arraySize + totalBufferSize; } /* ZSTDMT_setBufferSize() : @@ -188,9 +196,9 @@ static buffer_t ZSTDMT_getBuffer(ZSTDMT_bufferPool* bufPool) DEBUGLOG(5, "ZSTDMT_getBuffer: bSize = %u", (U32)bufPool->bufferSize); ZSTD_pthread_mutex_lock(&bufPool->poolMutex); if (bufPool->nbBuffers) { /* try to use an existing buffer */ - buffer_t const buf = bufPool->bTable[--(bufPool->nbBuffers)]; + buffer_t const buf = bufPool->buffers[--(bufPool->nbBuffers)]; size_t const availBufferSize = buf.capacity; - bufPool->bTable[bufPool->nbBuffers] = g_nullBuffer; + bufPool->buffers[bufPool->nbBuffers] = g_nullBuffer; if ((availBufferSize >= bSize) & ((availBufferSize>>3) <= bSize)) { /* large enough, but not too much */ DEBUGLOG(5, "ZSTDMT_getBuffer: provide buffer %u of size %u", @@ -251,14 +259,14 @@ static void ZSTDMT_releaseBuffer(ZSTDMT_bufferPool* bufPool, buffer_t buf) if (buf.start == NULL) return; /* compatible with release on NULL */ ZSTD_pthread_mutex_lock(&bufPool->poolMutex); if (bufPool->nbBuffers < bufPool->totalBuffers) { - bufPool->bTable[bufPool->nbBuffers++] = buf; /* stored for later use */ + bufPool->buffers[bufPool->nbBuffers++] = buf; /* stored for later use */ DEBUGLOG(5, "ZSTDMT_releaseBuffer: stored buffer of size %u in slot %u", (U32)buf.capacity, (U32)(bufPool->nbBuffers-1)); ZSTD_pthread_mutex_unlock(&bufPool->poolMutex); return; } ZSTD_pthread_mutex_unlock(&bufPool->poolMutex); - /* Reached bufferPool capacity (should not happen) */ + /* Reached bufferPool capacity (note: should not happen) */ DEBUGLOG(5, "ZSTDMT_releaseBuffer: pool capacity reached => freeing "); ZSTD_customFree(buf.start, bufPool->cMem); } @@ -351,16 +359,20 @@ typedef struct { int totalCCtx; int availCCtx; ZSTD_customMem cMem; - ZSTD_CCtx* cctx[1]; /* variable size */ + ZSTD_CCtx** cctxs; } ZSTDMT_CCtxPool; -/* note : all CCtx borrowed from the pool should be released back to the pool _before_ freeing the pool */ +/* note : all CCtx borrowed from the pool must be reverted back to the pool _before_ freeing the pool */ static void ZSTDMT_freeCCtxPool(ZSTDMT_CCtxPool* pool) { - int cid; - for (cid=0; cidtotalCCtx; cid++) - ZSTD_freeCCtx(pool->cctx[cid]); /* note : compatible with free on NULL */ + if (!pool) return; ZSTD_pthread_mutex_destroy(&pool->poolMutex); + if (pool->cctxs) { + int cid; + for (cid=0; cidtotalCCtx; cid++) + ZSTD_freeCCtx(pool->cctxs[cid]); /* free compatible with NULL */ + ZSTD_customFree(pool->cctxs, pool->cMem); + } ZSTD_customFree(pool, pool->cMem); } @@ -369,19 +381,24 @@ static void ZSTDMT_freeCCtxPool(ZSTDMT_CCtxPool* pool) static ZSTDMT_CCtxPool* ZSTDMT_createCCtxPool(int nbWorkers, ZSTD_customMem cMem) { - ZSTDMT_CCtxPool* const cctxPool = (ZSTDMT_CCtxPool*) ZSTD_customCalloc( - sizeof(ZSTDMT_CCtxPool) + (nbWorkers-1)*sizeof(ZSTD_CCtx*), cMem); + ZSTDMT_CCtxPool* const cctxPool = + (ZSTDMT_CCtxPool*) ZSTD_customCalloc(sizeof(ZSTDMT_CCtxPool), cMem); assert(nbWorkers > 0); if (!cctxPool) return NULL; if (ZSTD_pthread_mutex_init(&cctxPool->poolMutex, NULL)) { ZSTD_customFree(cctxPool, cMem); return NULL; } - cctxPool->cMem = cMem; cctxPool->totalCCtx = nbWorkers; + cctxPool->cctxs = (ZSTD_CCtx**)ZSTD_customCalloc(nbWorkers * sizeof(ZSTD_CCtx*), cMem); + if (!cctxPool->cctxs) { + ZSTDMT_freeCCtxPool(cctxPool); + return NULL; + } + cctxPool->cMem = cMem; + cctxPool->cctxs[0] = ZSTD_createCCtx_advanced(cMem); + if (!cctxPool->cctxs[0]) { ZSTDMT_freeCCtxPool(cctxPool); return NULL; } cctxPool->availCCtx = 1; /* at least one cctx for single-thread mode */ - cctxPool->cctx[0] = ZSTD_createCCtx_advanced(cMem); - if (!cctxPool->cctx[0]) { ZSTDMT_freeCCtxPool(cctxPool); return NULL; } DEBUGLOG(3, "cctxPool created, with %u workers", nbWorkers); return cctxPool; } @@ -403,16 +420,16 @@ static size_t ZSTDMT_sizeof_CCtxPool(ZSTDMT_CCtxPool* cctxPool) { ZSTD_pthread_mutex_lock(&cctxPool->poolMutex); { unsigned const nbWorkers = cctxPool->totalCCtx; - size_t const poolSize = sizeof(*cctxPool) - + (nbWorkers-1) * sizeof(ZSTD_CCtx*); - unsigned u; + size_t const poolSize = sizeof(*cctxPool); + size_t const arraySize = cctxPool->totalCCtx * sizeof(ZSTD_CCtx*); size_t totalCCtxSize = 0; + unsigned u; for (u=0; ucctx[u]); + totalCCtxSize += ZSTD_sizeof_CCtx(cctxPool->cctxs[u]); } ZSTD_pthread_mutex_unlock(&cctxPool->poolMutex); assert(nbWorkers > 0); - return poolSize + totalCCtxSize; + return poolSize + arraySize + totalCCtxSize; } } @@ -422,7 +439,7 @@ static ZSTD_CCtx* ZSTDMT_getCCtx(ZSTDMT_CCtxPool* cctxPool) ZSTD_pthread_mutex_lock(&cctxPool->poolMutex); if (cctxPool->availCCtx) { cctxPool->availCCtx--; - { ZSTD_CCtx* const cctx = cctxPool->cctx[cctxPool->availCCtx]; + { ZSTD_CCtx* const cctx = cctxPool->cctxs[cctxPool->availCCtx]; ZSTD_pthread_mutex_unlock(&cctxPool->poolMutex); return cctx; } } @@ -436,7 +453,7 @@ static void ZSTDMT_releaseCCtx(ZSTDMT_CCtxPool* pool, ZSTD_CCtx* cctx) if (cctx==NULL) return; /* compatibility with release on NULL */ ZSTD_pthread_mutex_lock(&pool->poolMutex); if (pool->availCCtx < pool->totalCCtx) - pool->cctx[pool->availCCtx++] = cctx; + pool->cctxs[pool->availCCtx++] = cctx; else { /* pool overflow : should not happen, since totalCCtx==nbWorkers */ DEBUGLOG(4, "CCtx pool overflow : free cctx"); @@ -602,11 +619,8 @@ static void ZSTDMT_serialState_update(serialState_t* serialState, ZSTD_pthread_mutex_unlock(&serialState->mutex); if (seqStore.size > 0) { - size_t const err = ZSTD_referenceExternalSequences( - jobCCtx, seqStore.seq, seqStore.size); + ZSTD_referenceExternalSequences(jobCCtx, seqStore.seq, seqStore.size); assert(serialState->params.ldmParams.enableLdm == ZSTD_ps_enable); - assert(!ZSTD_isError(err)); - (void)err; } } @@ -658,12 +672,13 @@ typedef struct { unsigned frameChecksumNeeded; /* used only by mtctx */ } ZSTDMT_jobDescription; -#define JOB_ERROR(e) { \ - ZSTD_PTHREAD_MUTEX_LOCK(&job->job_mutex); \ - job->cSize = e; \ - ZSTD_pthread_mutex_unlock(&job->job_mutex); \ - goto _endJob; \ -} +#define JOB_ERROR(e) \ + do { \ + ZSTD_PTHREAD_MUTEX_LOCK(&job->job_mutex); \ + job->cSize = e; \ + ZSTD_pthread_mutex_unlock(&job->job_mutex); \ + goto _endJob; \ + } while (0) /* ZSTDMT_compressionJob() is a POOL_function type */ static void ZSTDMT_compressionJob(void* jobDescription) @@ -1092,7 +1107,7 @@ ZSTD_frameProgression ZSTDMT_getFrameProgression(ZSTDMT_CCtx* mtctx) { unsigned jobNb; unsigned lastJobNb = mtctx->nextJobID + mtctx->jobReady; assert(mtctx->jobReady <= 1); DEBUGLOG(6, "ZSTDMT_getFrameProgression: jobs: from %u to <%u (jobReady:%u)", - mtctx->doneJobID, lastJobNb, mtctx->jobReady) + mtctx->doneJobID, lastJobNb, mtctx->jobReady); for (jobNb = mtctx->doneJobID ; jobNb < lastJobNb ; jobNb++) { unsigned const wJobID = jobNb & mtctx->jobIDMask; ZSTDMT_jobDescription* jobPtr = &mtctx->jobs[wJobID]; diff --git a/vendor/github.com/camunda/zeebe/clients/go/v8/internal/embedded/data/VERSION b/vendor/github.com/camunda/zeebe/clients/go/v8/internal/embedded/data/VERSION index 7dbcd5de..8727e4a6 100644 --- a/vendor/github.com/camunda/zeebe/clients/go/v8/internal/embedded/data/VERSION +++ b/vendor/github.com/camunda/zeebe/clients/go/v8/internal/embedded/data/VERSION @@ -1 +1 @@ -8.5.3 +8.5.7 diff --git a/vendor/github.com/cockroachdb/fifo/README.md b/vendor/github.com/cockroachdb/fifo/README.md new file mode 100644 index 00000000..6fc02493 --- /dev/null +++ b/vendor/github.com/cockroachdb/fifo/README.md @@ -0,0 +1,3 @@ +DEPRECATED + +Moved to [github.com/cockroachdb/crlib](https://github.com/cockroachdb/crlib/tree/main/fifo) diff --git a/vendor/github.com/cockroachdb/pebble/internal/manual/manual_32bit.go b/vendor/github.com/cockroachdb/pebble/internal/manual/manual_32bit.go index 58730879..19369fa0 100644 --- a/vendor/github.com/cockroachdb/pebble/internal/manual/manual_32bit.go +++ b/vendor/github.com/cockroachdb/pebble/internal/manual/manual_32bit.go @@ -2,8 +2,8 @@ // of this source code is governed by a BSD-style license that can be found in // the LICENSE file. -//go:build 386 || amd64p32 || arm || armbe || mips || mipsle || mips64p32 || mips64p32le || ppc || sparc -// +build 386 amd64p32 arm armbe mips mipsle mips64p32 mips64p32le ppc sparc +//go:build 386 || amd64p32 || arm || armbe || ppc || sparc +// +build 386 amd64p32 arm armbe ppc sparc package manual diff --git a/vendor/github.com/cockroachdb/pebble/internal/manual/manual_mips.go b/vendor/github.com/cockroachdb/pebble/internal/manual/manual_mips.go new file mode 100644 index 00000000..08bb8808 --- /dev/null +++ b/vendor/github.com/cockroachdb/pebble/internal/manual/manual_mips.go @@ -0,0 +1,13 @@ +// Copyright 2020 The LevelDB-Go and Pebble Authors. All rights reserved. Use +// of this source code is governed by a BSD-style license that can be found in +// the LICENSE file. + +//go:build mips || mipsle || mips64p32 || mips64p32le +// +build mips mipsle mips64p32 mips64p32le + +package manual + +const ( + // MaxArrayLen is a safe maximum length for slices on this architecture. + MaxArrayLen = 1 << 30 +) diff --git a/vendor/github.com/cockroachdb/pebble/internal/rawalloc/rawalloc_32bit.go b/vendor/github.com/cockroachdb/pebble/internal/rawalloc/rawalloc_32bit.go index 3edacea7..3112cc9e 100644 --- a/vendor/github.com/cockroachdb/pebble/internal/rawalloc/rawalloc_32bit.go +++ b/vendor/github.com/cockroachdb/pebble/internal/rawalloc/rawalloc_32bit.go @@ -12,8 +12,8 @@ // implied. See the License for the specific language governing // permissions and limitations under the License. -//go:build 386 || amd64p32 || arm || armbe || mips || mipsle || mips64p32 || mips64p32le || ppc || sparc -// +build 386 amd64p32 arm armbe mips mipsle mips64p32 mips64p32le ppc sparc +//go:build 386 || amd64p32 || arm || armbe || ppc || sparc +// +build 386 amd64p32 arm armbe ppc sparc package rawalloc diff --git a/vendor/github.com/cockroachdb/pebble/internal/rawalloc/rawalloc_mips.go b/vendor/github.com/cockroachdb/pebble/internal/rawalloc/rawalloc_mips.go new file mode 100644 index 00000000..55b45eb1 --- /dev/null +++ b/vendor/github.com/cockroachdb/pebble/internal/rawalloc/rawalloc_mips.go @@ -0,0 +1,22 @@ +// Copyright 2014 The Cockroach Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. + +//go:build mips || mipsle || mips64p32 || mips64p32le +// +build mips mipsle mips64p32 mips64p32le + +package rawalloc + +const ( + maxArrayLen = 1 << 30 +) diff --git a/vendor/github.com/getsentry/sentry-go/CHANGELOG.md b/vendor/github.com/getsentry/sentry-go/CHANGELOG.md index 046f49c4..dce9a3ff 100644 --- a/vendor/github.com/getsentry/sentry-go/CHANGELOG.md +++ b/vendor/github.com/getsentry/sentry-go/CHANGELOG.md @@ -1,5 +1,47 @@ # Changelog +## 0.29.0 + +The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.29.0. + +### Breaking Changes + +- Remove the `sentrymartini` integration ([#861](https://github.com/getsentry/sentry-go/pull/861)) +- The `WrapResponseWriter` has been moved from the `sentryhttp` package to the `internal/httputils` package. If you've imported it previosuly, you'll need to copy the implementation in your project. ([#871](https://github.com/getsentry/sentry-go/pull/871)) + +### Features + +- Add new convenience methods to continue a trace and propagate tracing headers for error-only use cases. ([#862](https://github.com/getsentry/sentry-go/pull/862)) + + If you are not using one of our integrations, you can manually continue an incoming trace by using `sentry.ContinueTrace()` by providing the `sentry-trace` and `baggage` header received from a downstream SDK. + + ```go + hub := sentry.CurrentHub() + sentry.ContinueTrace(hub, r.Header.Get(sentry.SentryTraceHeader), r.Header.Get(sentry.SentryBaggageHeader)), + ``` + + You can use `hub.GetTraceparent()` and `hub.GetBaggage()` to fetch the necessary header values for outgoing HTTP requests. + + ```go + hub := sentry.GetHubFromContext(ctx) + req, _ := http.NewRequest("GET", "http://localhost:3000", nil) + req.Header.Add(sentry.SentryTraceHeader, hub.GetTraceparent()) + req.Header.Add(sentry.SentryBaggageHeader, hub.GetBaggage()) + ``` + +### Bug Fixes + +- Initialize `HTTPTransport.limit` if `nil` ([#844](https://github.com/getsentry/sentry-go/pull/844)) +- Fix `sentry.StartTransaction()` returning a transaction with an outdated context on existing transactions ([#854](https://github.com/getsentry/sentry-go/pull/854)) +- Treat `Proxy-Authorization` as a sensitive header ([#859](https://github.com/getsentry/sentry-go/pull/859)) +- Add support for the `http.Hijacker` interface to the `sentrynegroni` package ([#871](https://github.com/getsentry/sentry-go/pull/871)) +- Go version >= 1.23: Use value from `http.Request.Pattern` for HTTP transaction names when using `sentryhttp` & `sentrynegroni` ([#875](https://github.com/getsentry/sentry-go/pull/875)) +- Go version >= 1.21: Fix closure functions name grouping ([#877](https://github.com/getsentry/sentry-go/pull/877)) + +### Misc + +- Collect `span` origins ([#849](https://github.com/getsentry/sentry-go/pull/849)) + ## 0.28.1 The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.28.1. diff --git a/vendor/github.com/getsentry/sentry-go/README.md b/vendor/github.com/getsentry/sentry-go/README.md index 73cbdbc6..3b67fb45 100644 --- a/vendor/github.com/getsentry/sentry-go/README.md +++ b/vendor/github.com/getsentry/sentry-go/README.md @@ -77,7 +77,6 @@ checkout the official documentation: - [fasthttp](https://docs.sentry.io/platforms/go/guides/fasthttp/) - [gin](https://docs.sentry.io/platforms/go/guides/gin/) - [iris](https://docs.sentry.io/platforms/go/guides/iris/) - - [martini](https://docs.sentry.io/platforms/go/guides/martini/) - [negroni](https://docs.sentry.io/platforms/go/guides/negroni/) ## Resources diff --git a/vendor/github.com/getsentry/sentry-go/client.go b/vendor/github.com/getsentry/sentry-go/client.go index f5069b71..b5b11b31 100644 --- a/vendor/github.com/getsentry/sentry-go/client.go +++ b/vendor/github.com/getsentry/sentry-go/client.go @@ -90,7 +90,7 @@ type EventProcessor func(event *Event, hint *EventHint) *Event // ApplyToEvent changes an event based on external data and/or // an event hint. type EventModifier interface { - ApplyToEvent(event *Event, hint *EventHint) *Event + ApplyToEvent(event *Event, hint *EventHint, client *Client) *Event } var globalEventProcessors []EventProcessor @@ -685,7 +685,7 @@ func (client *Client) prepareEvent(event *Event, hint *EventHint, scope EventMod } if scope != nil { - event = scope.ApplyToEvent(event, hint) + event = scope.ApplyToEvent(event, hint, client) if event == nil { return nil } diff --git a/vendor/github.com/getsentry/sentry-go/dynamic_sampling_context.go b/vendor/github.com/getsentry/sentry-go/dynamic_sampling_context.go index 36507260..6eec95ba 100644 --- a/vendor/github.com/getsentry/sentry-go/dynamic_sampling_context.go +++ b/vendor/github.com/getsentry/sentry-go/dynamic_sampling_context.go @@ -39,8 +39,6 @@ func DynamicSamplingContextFromHeader(header []byte) (DynamicSamplingContext, er } func DynamicSamplingContextFromTransaction(span *Span) DynamicSamplingContext { - entries := map[string]string{} - hub := hubFromContext(span.Context()) scope := hub.Scope() client := hub.Client() @@ -52,6 +50,8 @@ func DynamicSamplingContextFromTransaction(span *Span) DynamicSamplingContext { } } + entries := make(map[string]string) + if traceID := span.TraceID.String(); traceID != "" { entries["trace_id"] = traceID } @@ -78,20 +78,9 @@ func DynamicSamplingContextFromTransaction(span *Span) DynamicSamplingContext { } } - if userSegment := scope.user.Segment; userSegment != "" { - entries["user_segment"] = userSegment - } + entries["sampled"] = strconv.FormatBool(span.Sampled.Bool()) - if span.Sampled.Bool() { - entries["sampled"] = "true" - } else { - entries["sampled"] = "false" - } - - return DynamicSamplingContext{ - Entries: entries, - Frozen: true, - } + return DynamicSamplingContext{Entries: entries, Frozen: true} } func (d DynamicSamplingContext) HasEntries() bool { @@ -121,3 +110,43 @@ func (d DynamicSamplingContext) String() string { return "" } + +// Constructs a new DynamicSamplingContext using a scope and client. Accessing +// fields on the scope are not thread safe, and this function should only be +// called within scope methods. +func DynamicSamplingContextFromScope(scope *Scope, client *Client) DynamicSamplingContext { + entries := map[string]string{} + + if client == nil || scope == nil { + return DynamicSamplingContext{ + Entries: entries, + Frozen: false, + } + } + + propagationContext := scope.propagationContext + + if traceID := propagationContext.TraceID.String(); traceID != "" { + entries["trace_id"] = traceID + } + if sampleRate := client.options.TracesSampleRate; sampleRate != 0 { + entries["sample_rate"] = strconv.FormatFloat(sampleRate, 'f', -1, 64) + } + + if dsn := client.dsn; dsn != nil { + if publicKey := dsn.publicKey; publicKey != "" { + entries["public_key"] = publicKey + } + } + if release := client.options.Release; release != "" { + entries["release"] = release + } + if environment := client.options.Environment; environment != "" { + entries["environment"] = environment + } + + return DynamicSamplingContext{ + Entries: entries, + Frozen: true, + } +} diff --git a/vendor/github.com/getsentry/sentry-go/hub.go b/vendor/github.com/getsentry/sentry-go/hub.go index 6af1d5af..c99b6d70 100644 --- a/vendor/github.com/getsentry/sentry-go/hub.go +++ b/vendor/github.com/getsentry/sentry-go/hub.go @@ -2,6 +2,7 @@ package sentry import ( "context" + "fmt" "sync" "time" ) @@ -365,6 +366,34 @@ func (hub *Hub) Flush(timeout time.Duration) bool { return client.Flush(timeout) } +// GetTraceparent returns the current Sentry traceparent string, to be used as a HTTP header value +// or HTML meta tag value. +// This function is context aware, as in it either returns the traceparent based +// on the current span, or the scope's propagation context. +func (hub *Hub) GetTraceparent() string { + scope := hub.Scope() + + if scope.span != nil { + return scope.span.ToSentryTrace() + } + + return fmt.Sprintf("%s-%s", scope.propagationContext.TraceID, scope.propagationContext.SpanID) +} + +// GetBaggage returns the current Sentry baggage string, to be used as a HTTP header value +// or HTML meta tag value. +// This function is context aware, as in it either returns the baggage based +// on the current span or the scope's propagation context. +func (hub *Hub) GetBaggage() string { + scope := hub.Scope() + + if scope.span != nil { + return scope.span.ToBaggage() + } + + return scope.propagationContext.DynamicSamplingContext.String() +} + // HasHubOnContext checks whether Hub instance is bound to a given Context struct. func HasHubOnContext(ctx context.Context) bool { _, ok := ctx.Value(HubContextKey).(*Hub) diff --git a/vendor/github.com/getsentry/sentry-go/interfaces.go b/vendor/github.com/getsentry/sentry-go/interfaces.go index 35686a02..cacb2543 100644 --- a/vendor/github.com/getsentry/sentry-go/interfaces.go +++ b/vendor/github.com/getsentry/sentry-go/interfaces.go @@ -166,10 +166,11 @@ type Request struct { } var sensitiveHeaders = map[string]struct{}{ - "Authorization": {}, - "Cookie": {}, - "X-Forwarded-For": {}, - "X-Real-Ip": {}, + "Authorization": {}, + "Proxy-Authorization": {}, + "Cookie": {}, + "X-Forwarded-For": {}, + "X-Real-Ip": {}, } // NewRequest returns a new Sentry Request from the given http.Request. diff --git a/vendor/github.com/getsentry/sentry-go/propagation_context.go b/vendor/github.com/getsentry/sentry-go/propagation_context.go new file mode 100644 index 00000000..7a0766a8 --- /dev/null +++ b/vendor/github.com/getsentry/sentry-go/propagation_context.go @@ -0,0 +1,90 @@ +package sentry + +import ( + "crypto/rand" + "encoding/json" +) + +type PropagationContext struct { + TraceID TraceID `json:"trace_id"` + SpanID SpanID `json:"span_id"` + ParentSpanID SpanID `json:"parent_span_id"` + DynamicSamplingContext DynamicSamplingContext `json:"-"` +} + +func (p PropagationContext) MarshalJSON() ([]byte, error) { + type propagationContext PropagationContext + var parentSpanID string + if p.ParentSpanID != zeroSpanID { + parentSpanID = p.ParentSpanID.String() + } + return json.Marshal(struct { + *propagationContext + ParentSpanID string `json:"parent_span_id,omitempty"` + }{ + propagationContext: (*propagationContext)(&p), + ParentSpanID: parentSpanID, + }) +} + +func (p PropagationContext) Map() map[string]interface{} { + m := map[string]interface{}{ + "trace_id": p.TraceID, + "span_id": p.SpanID, + } + + if p.ParentSpanID != zeroSpanID { + m["parent_span_id"] = p.ParentSpanID + } + + return m +} + +func NewPropagationContext() PropagationContext { + p := PropagationContext{} + + if _, err := rand.Read(p.TraceID[:]); err != nil { + panic(err) + } + + if _, err := rand.Read(p.SpanID[:]); err != nil { + panic(err) + } + + return p +} + +func PropagationContextFromHeaders(trace, baggage string) (PropagationContext, error) { + p := NewPropagationContext() + + if _, err := rand.Read(p.SpanID[:]); err != nil { + panic(err) + } + + hasTrace := false + if trace != "" { + if tpc, valid := ParseTraceParentContext([]byte(trace)); valid { + hasTrace = true + p.TraceID = tpc.TraceID + p.ParentSpanID = tpc.ParentSpanID + } + } + + if baggage != "" { + dsc, err := DynamicSamplingContextFromHeader([]byte(baggage)) + if err != nil { + return PropagationContext{}, err + } + p.DynamicSamplingContext = dsc + } + + // In case a sentry-trace header is present but there are no sentry-related + // values in the baggage, create an empty, frozen DynamicSamplingContext. + if hasTrace && !p.DynamicSamplingContext.HasEntries() { + p.DynamicSamplingContext = DynamicSamplingContext{ + Frozen: true, + } + } + + return p, nil +} diff --git a/vendor/github.com/getsentry/sentry-go/scope.go b/vendor/github.com/getsentry/sentry-go/scope.go index 374010b6..48621c94 100644 --- a/vendor/github.com/getsentry/sentry-go/scope.go +++ b/vendor/github.com/getsentry/sentry-go/scope.go @@ -43,20 +43,22 @@ type Scope struct { Overflow() bool } eventProcessors []EventProcessor + + propagationContext PropagationContext + span *Span } // NewScope creates a new Scope. func NewScope() *Scope { - scope := Scope{ - breadcrumbs: make([]*Breadcrumb, 0), - attachments: make([]*Attachment, 0), - tags: make(map[string]string), - contexts: make(map[string]Context), - extra: make(map[string]interface{}), - fingerprint: make([]string, 0), + return &Scope{ + breadcrumbs: make([]*Breadcrumb, 0), + attachments: make([]*Attachment, 0), + tags: make(map[string]string), + contexts: make(map[string]Context), + extra: make(map[string]interface{}), + fingerprint: make([]string, 0), + propagationContext: NewPropagationContext(), } - - return &scope } // AddBreadcrumb adds new breadcrumb to the current scope @@ -292,6 +294,22 @@ func (scope *Scope) SetLevel(level Level) { scope.level = level } +// SetPropagationContext sets the propagation context for the current scope. +func (scope *Scope) SetPropagationContext(propagationContext PropagationContext) { + scope.mu.Lock() + defer scope.mu.Unlock() + + scope.propagationContext = propagationContext +} + +// SetSpan sets a span for the current scope. +func (scope *Scope) SetSpan(span *Span) { + scope.mu.Lock() + defer scope.mu.Unlock() + + scope.span = span +} + // Clone returns a copy of the current scope with all data copied over. func (scope *Scope) Clone() *Scope { scope.mu.RLock() @@ -318,6 +336,8 @@ func (scope *Scope) Clone() *Scope { clone.request = scope.request clone.requestBody = scope.requestBody clone.eventProcessors = scope.eventProcessors + clone.propagationContext = scope.propagationContext + clone.span = scope.span return clone } @@ -335,7 +355,7 @@ func (scope *Scope) AddEventProcessor(processor EventProcessor) { } // ApplyToEvent takes the data from the current scope and attaches it to the event. -func (scope *Scope) ApplyToEvent(event *Event, hint *EventHint) *Event { +func (scope *Scope) ApplyToEvent(event *Event, hint *EventHint, client *Client) *Event { scope.mu.RLock() defer scope.mu.RUnlock() @@ -363,15 +383,6 @@ func (scope *Scope) ApplyToEvent(event *Event, hint *EventHint) *Event { } for key, value := range scope.contexts { - if key == "trace" && event.Type == transactionType { - // Do not override trace context of - // transactions, otherwise it breaks the - // transaction event representation. - // For error events, the trace context is used - // to link errors and traces/spans in Sentry. - continue - } - // Ensure we are not overwriting event fields if _, ok := event.Contexts[key]; !ok { event.Contexts[key] = cloneContext(value) @@ -379,6 +390,27 @@ func (scope *Scope) ApplyToEvent(event *Event, hint *EventHint) *Event { } } + if event.Contexts == nil { + event.Contexts = make(map[string]Context) + } + + if scope.span != nil { + event.Contexts["trace"] = scope.span.traceContext().Map() + + transaction := scope.span.GetTransaction() + if transaction != nil { + event.sdkMetaData.dsc = DynamicSamplingContextFromTransaction(transaction) + } + } else { + event.Contexts["trace"] = scope.propagationContext.Map() + + dsc := scope.propagationContext.DynamicSamplingContext + if !dsc.HasEntries() && client != nil { + dsc = DynamicSamplingContextFromScope(scope, client) + } + event.sdkMetaData.dsc = dsc + } + if len(scope.extra) > 0 { if event.Extra == nil { event.Extra = make(map[string]interface{}, len(scope.extra)) diff --git a/vendor/github.com/getsentry/sentry-go/sentry.go b/vendor/github.com/getsentry/sentry-go/sentry.go index c8246de0..0fca64e2 100644 --- a/vendor/github.com/getsentry/sentry-go/sentry.go +++ b/vendor/github.com/getsentry/sentry-go/sentry.go @@ -6,7 +6,7 @@ import ( ) // The version of the SDK. -const SDKVersion = "0.28.1" +const SDKVersion = "0.29.0" // apiVersion is the minimum version of the Sentry API compatible with the // sentry-go SDK. diff --git a/vendor/github.com/getsentry/sentry-go/stacktrace.go b/vendor/github.com/getsentry/sentry-go/stacktrace.go index 2f8933ea..3b372bcf 100644 --- a/vendor/github.com/getsentry/sentry-go/stacktrace.go +++ b/vendor/github.com/getsentry/sentry-go/stacktrace.go @@ -307,6 +307,9 @@ func createFrames(frames []runtime.Frame) []Frame { } } + // Fix issues grouping errors with the new fully qualified function names + // introduced from Go 1.21 + result = cleanupFunctionNamePrefix(result) return result } diff --git a/vendor/github.com/getsentry/sentry-go/stacktrace_below_go1.21.go b/vendor/github.com/getsentry/sentry-go/stacktrace_below_go1.21.go new file mode 100644 index 00000000..35a42e4d --- /dev/null +++ b/vendor/github.com/getsentry/sentry-go/stacktrace_below_go1.21.go @@ -0,0 +1,7 @@ +//go:build !go1.21 + +package sentry + +func cleanupFunctionNamePrefix(f []Frame) []Frame { + return f +} diff --git a/vendor/github.com/getsentry/sentry-go/stacktrace_go1.21.go b/vendor/github.com/getsentry/sentry-go/stacktrace_go1.21.go new file mode 100644 index 00000000..45147c85 --- /dev/null +++ b/vendor/github.com/getsentry/sentry-go/stacktrace_go1.21.go @@ -0,0 +1,25 @@ +//go:build go1.21 + +package sentry + +import "strings" + +// Walk backwards through the results and for the current function name +// remove it's parent function's prefix, leaving only it's actual name. This +// fixes issues grouping errors with the new fully qualified function names +// introduced from Go 1.21. + +func cleanupFunctionNamePrefix(f []Frame) []Frame { + for i := len(f) - 1; i > 0; i-- { + name := f[i].Function + parentName := f[i-1].Function + "." + + if !strings.HasPrefix(name, parentName) { + continue + } + + f[i].Function = name[len(parentName):] + } + + return f +} diff --git a/vendor/github.com/getsentry/sentry-go/tracing.go b/vendor/github.com/getsentry/sentry-go/tracing.go index 1bb53d0d..0f5ade2e 100644 --- a/vendor/github.com/getsentry/sentry-go/tracing.go +++ b/vendor/github.com/getsentry/sentry-go/tracing.go @@ -18,6 +18,20 @@ const ( SentryBaggageHeader = "baggage" ) +// SpanOrigin indicates what created a trace or a span. See: https://develop.sentry.dev/sdk/performance/trace-origin/ +type SpanOrigin string + +const ( + SpanOriginManual = "manual" + SpanOriginEcho = "auto.http.echo" + SpanOriginFastHTTP = "auto.http.fasthttp" + SpanOriginFiber = "auto.http.fiber" + SpanOriginGin = "auto.http.gin" + SpanOriginStdLib = "auto.http.stdlib" + SpanOriginIris = "auto.http.iris" + SpanOriginNegroni = "auto.http.negroni" +) + // A Span is the building block of a Sentry transaction. Spans build up a tree // structure of timed operations. The span tree makes up a transaction event // that is sent to Sentry when the root span is finished. @@ -37,6 +51,7 @@ type Span struct { //nolint: maligned // prefer readability over optimal memory Data map[string]interface{} `json:"data,omitempty"` Sampled Sampled `json:"-"` Source TransactionSource `json:"-"` + Origin SpanOrigin `json:"origin,omitempty"` // mu protects concurrent writes to map fields mu sync.RWMutex @@ -113,11 +128,19 @@ func StartSpan(ctx context.Context, operation string, options ...SpanOption) *Sp parent: parent, } + _, err := rand.Read(span.SpanID[:]) + if err != nil { + panic(err) + } + if hasParent { span.TraceID = parent.TraceID + span.ParentSpanID = parent.SpanID + span.Origin = parent.Origin } else { // Only set the Source if this is a transaction span.Source = SourceCustom + span.Origin = SpanOriginManual // Implementation note: // @@ -154,13 +177,6 @@ func StartSpan(ctx context.Context, operation string, options ...SpanOption) *Sp panic(err) } } - _, err := rand.Read(span.SpanID[:]) - if err != nil { - panic(err) - } - if hasParent { - span.ParentSpanID = parent.SpanID - } // Apply options to override defaults. for _, option := range options { @@ -176,11 +192,11 @@ func StartSpan(ctx context.Context, operation string, options ...SpanOption) *Sp span.recorder.record(&span) - hub := hubFromContext(ctx) - - // Update scope so that all events include a trace context, allowing - // Sentry to correlate errors to transactions/spans. - hub.Scope().SetContext("trace", span.traceContext().Map()) + clientOptions := span.clientOptions() + if clientOptions.EnableTracing { + hub := hubFromContext(ctx) + hub.Scope().SetSpan(&span) + } // Start profiling only if it's a sampled root transaction. if span.IsTransaction() && span.Sampled.Bool() { @@ -308,17 +324,21 @@ func (s *Span) ToSentryTrace() string { // Use this function to propagate the DynamicSamplingContext to a downstream SDK, // either as the value of the "baggage" HTTP header, or as an html "baggage" meta tag. func (s *Span) ToBaggage() string { - if containingTransaction := s.GetTransaction(); containingTransaction != nil { - // In case there is currently no frozen DynamicSamplingContext attached to the transaction, - // create one from the properties of the transaction. - if !s.dynamicSamplingContext.IsFrozen() { - // This will return a frozen DynamicSamplingContext. - s.dynamicSamplingContext = DynamicSamplingContextFromTransaction(containingTransaction) - } - - return containingTransaction.dynamicSamplingContext.String() + t := s.GetTransaction() + if t == nil { + return "" } - return "" + + // In case there is currently no frozen DynamicSamplingContext attached to the transaction, + // create one from the properties of the transaction. + if !s.dynamicSamplingContext.IsFrozen() { + // This will return a frozen DynamicSamplingContext. + if dsc := DynamicSamplingContextFromTransaction(t); dsc.HasEntries() { + t.dynamicSamplingContext = dsc + } + } + + return t.dynamicSamplingContext.String() } // SetDynamicSamplingContext sets the given dynamic sampling context on the @@ -534,11 +554,10 @@ func (s *Span) toEvent() *Event { s.dynamicSamplingContext = DynamicSamplingContextFromTransaction(s) } - contexts := map[string]Context{} + contexts := make(map[string]Context, len(s.contexts)) for k, v := range s.contexts { contexts[k] = cloneContext(v) } - contexts["trace"] = s.traceContext().Map() // Make sure that the transaction source is valid transactionSource := s.Source @@ -870,6 +889,25 @@ func WithSpanSampled(sampled Sampled) SpanOption { } } +// WithSpanOrigin sets the origin of the span. +func WithSpanOrigin(origin SpanOrigin) SpanOption { + return func(s *Span) { + s.Origin = origin + } +} + +// Continue a trace based on traceparent and bagge values. +// If the SDK is configured with tracing enabled, +// this function returns populated SpanOption. +// In any other cases, it populates the propagation context on the scope. +func ContinueTrace(hub *Hub, traceparent, baggage string) SpanOption { + scope := hub.Scope() + propagationContext, _ := PropagationContextFromHeaders(traceparent, baggage) + scope.SetPropagationContext(propagationContext) + + return ContinueFromHeaders(traceparent, baggage) +} + // ContinueFromRequest returns a span option that updates the span to continue // an existing trace. If it cannot detect an existing trace in the request, the // span will be left unchanged. @@ -939,6 +977,7 @@ func SpanFromContext(ctx context.Context) *Span { func StartTransaction(ctx context.Context, name string, options ...SpanOption) *Span { currentTransaction, exists := ctx.Value(spanContextKey{}).(*Span) if exists { + currentTransaction.ctx = ctx return currentTransaction } diff --git a/vendor/github.com/getsentry/sentry-go/transport.go b/vendor/github.com/getsentry/sentry-go/transport.go index 20f69941..02fc1d4f 100644 --- a/vendor/github.com/getsentry/sentry-go/transport.go +++ b/vendor/github.com/getsentry/sentry-go/transport.go @@ -357,7 +357,6 @@ func NewHTTPTransport() *HTTPTransport { transport := HTTPTransport{ BufferSize: defaultBufferSize, Timeout: defaultTimeout, - limits: make(ratelimit.Map), } return &transport } @@ -550,9 +549,14 @@ func (t *HTTPTransport) worker() { } Logger.Printf("Sending %s failed with the following error: %s", eventType, string(b)) } + t.mu.Lock() + if t.limits == nil { + t.limits = make(ratelimit.Map) + } t.limits.Merge(ratelimit.FromResponse(response)) t.mu.Unlock() + // Drain body up to a limit and close it, allowing the // transport to reuse TCP connections. _, _ = io.CopyN(io.Discard, response.Body, maxDrainResponseBytes) @@ -690,6 +694,10 @@ func (t *HTTPSyncTransport) SendEventWithContext(ctx context.Context, event *Eve } t.mu.Lock() + if t.limits == nil { + t.limits = make(ratelimit.Map) + } + t.limits.Merge(ratelimit.FromResponse(response)) t.mu.Unlock() diff --git a/vendor/gopkg.in/ini.v1/.editorconfig b/vendor/github.com/go-ini/ini/.editorconfig similarity index 100% rename from vendor/gopkg.in/ini.v1/.editorconfig rename to vendor/github.com/go-ini/ini/.editorconfig diff --git a/vendor/gopkg.in/ini.v1/.gitignore b/vendor/github.com/go-ini/ini/.gitignore similarity index 100% rename from vendor/gopkg.in/ini.v1/.gitignore rename to vendor/github.com/go-ini/ini/.gitignore diff --git a/vendor/gopkg.in/ini.v1/.golangci.yml b/vendor/github.com/go-ini/ini/.golangci.yml similarity index 100% rename from vendor/gopkg.in/ini.v1/.golangci.yml rename to vendor/github.com/go-ini/ini/.golangci.yml diff --git a/vendor/gopkg.in/ini.v1/LICENSE b/vendor/github.com/go-ini/ini/LICENSE similarity index 100% rename from vendor/gopkg.in/ini.v1/LICENSE rename to vendor/github.com/go-ini/ini/LICENSE diff --git a/vendor/gopkg.in/ini.v1/Makefile b/vendor/github.com/go-ini/ini/Makefile similarity index 100% rename from vendor/gopkg.in/ini.v1/Makefile rename to vendor/github.com/go-ini/ini/Makefile diff --git a/vendor/gopkg.in/ini.v1/README.md b/vendor/github.com/go-ini/ini/README.md similarity index 100% rename from vendor/gopkg.in/ini.v1/README.md rename to vendor/github.com/go-ini/ini/README.md diff --git a/vendor/gopkg.in/ini.v1/codecov.yml b/vendor/github.com/go-ini/ini/codecov.yml similarity index 100% rename from vendor/gopkg.in/ini.v1/codecov.yml rename to vendor/github.com/go-ini/ini/codecov.yml diff --git a/vendor/gopkg.in/ini.v1/data_source.go b/vendor/github.com/go-ini/ini/data_source.go similarity index 100% rename from vendor/gopkg.in/ini.v1/data_source.go rename to vendor/github.com/go-ini/ini/data_source.go diff --git a/vendor/gopkg.in/ini.v1/deprecated.go b/vendor/github.com/go-ini/ini/deprecated.go similarity index 100% rename from vendor/gopkg.in/ini.v1/deprecated.go rename to vendor/github.com/go-ini/ini/deprecated.go diff --git a/vendor/gopkg.in/ini.v1/error.go b/vendor/github.com/go-ini/ini/error.go similarity index 100% rename from vendor/gopkg.in/ini.v1/error.go rename to vendor/github.com/go-ini/ini/error.go diff --git a/vendor/gopkg.in/ini.v1/file.go b/vendor/github.com/go-ini/ini/file.go similarity index 100% rename from vendor/gopkg.in/ini.v1/file.go rename to vendor/github.com/go-ini/ini/file.go diff --git a/vendor/gopkg.in/ini.v1/helper.go b/vendor/github.com/go-ini/ini/helper.go similarity index 100% rename from vendor/gopkg.in/ini.v1/helper.go rename to vendor/github.com/go-ini/ini/helper.go diff --git a/vendor/gopkg.in/ini.v1/ini.go b/vendor/github.com/go-ini/ini/ini.go similarity index 100% rename from vendor/gopkg.in/ini.v1/ini.go rename to vendor/github.com/go-ini/ini/ini.go diff --git a/vendor/gopkg.in/ini.v1/key.go b/vendor/github.com/go-ini/ini/key.go similarity index 100% rename from vendor/gopkg.in/ini.v1/key.go rename to vendor/github.com/go-ini/ini/key.go diff --git a/vendor/gopkg.in/ini.v1/parser.go b/vendor/github.com/go-ini/ini/parser.go similarity index 100% rename from vendor/gopkg.in/ini.v1/parser.go rename to vendor/github.com/go-ini/ini/parser.go diff --git a/vendor/gopkg.in/ini.v1/section.go b/vendor/github.com/go-ini/ini/section.go similarity index 100% rename from vendor/gopkg.in/ini.v1/section.go rename to vendor/github.com/go-ini/ini/section.go diff --git a/vendor/gopkg.in/ini.v1/struct.go b/vendor/github.com/go-ini/ini/struct.go similarity index 100% rename from vendor/gopkg.in/ini.v1/struct.go rename to vendor/github.com/go-ini/ini/struct.go diff --git a/vendor/github.com/gofiber/fiber/v2/app.go b/vendor/github.com/gofiber/fiber/v2/app.go index 2568e06d..cea6407a 100644 --- a/vendor/github.com/gofiber/fiber/v2/app.go +++ b/vendor/github.com/gofiber/fiber/v2/app.go @@ -30,7 +30,7 @@ import ( ) // Version of current fiber package -const Version = "2.52.4" +const Version = "2.52.5" // Handler defines a function to serve HTTP requests. type Handler = func(*Ctx) error diff --git a/vendor/github.com/gofiber/fiber/v2/ctx.go b/vendor/github.com/gofiber/fiber/v2/ctx.go index 596268e9..2589f0e3 100644 --- a/vendor/github.com/gofiber/fiber/v2/ctx.go +++ b/vendor/github.com/gofiber/fiber/v2/ctx.go @@ -967,6 +967,10 @@ func (c *Ctx) Links(link ...string) { // Locals makes it possible to pass interface{} values under keys scoped to the request // and therefore available to all following routes that match the request. +// +// All the values are removed from ctx after returning from the top +// RequestHandler. Additionally, Close method is called on each value +// implementing io.Closer before removing the value from ctx. func (c *Ctx) Locals(key interface{}, value ...interface{}) interface{} { if len(value) == 0 { return c.fasthttp.UserValue(key) diff --git a/vendor/github.com/gotd/contrib/middleware/floodwait/doc.go b/vendor/github.com/gotd/contrib/middleware/floodwait/doc.go deleted file mode 100644 index bf019481..00000000 --- a/vendor/github.com/gotd/contrib/middleware/floodwait/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package floodwait implements a tg.Invoker that handles flood wait errors. -package floodwait diff --git a/vendor/github.com/gotd/contrib/middleware/floodwait/queue.go b/vendor/github.com/gotd/contrib/middleware/floodwait/queue.go deleted file mode 100644 index bc0ef969..00000000 --- a/vendor/github.com/gotd/contrib/middleware/floodwait/queue.go +++ /dev/null @@ -1,106 +0,0 @@ -package floodwait - -import ( - "container/heap" - "sync" - "time" -) - -type scheduled struct { - request request - sendTime time.Time - index int -} - -type scheduledHeap []scheduled - -func (r scheduledHeap) Len() int { return len(r) } - -func (r scheduledHeap) Less(i, j int) bool { - return r[i].sendTime.UnixNano() < r[j].sendTime.UnixNano() -} - -func (r scheduledHeap) Swap(i, j int) { - r[i], r[j] = r[j], r[i] - r[i].index = i - r[j].index = j -} - -func (r *scheduledHeap) Push(x interface{}) { - n := len(*r) - item := x.(scheduled) - item.index = n - *r = append(*r, item) -} - -func (r *scheduledHeap) Pop() interface{} { - old := *r - n := len(old) - item := old[n-1] - item.index = -1 // for safety - *r = old[0 : n-1] - return item -} - -type queue struct { - requests scheduledHeap - requestsMux sync.Mutex -} - -func newQueue(initialCapacity int) *queue { - r := make(scheduledHeap, 0, initialCapacity) - return &queue{requests: r} -} - -func (q *queue) add(r request, t time.Time) { - q.requestsMux.Lock() - defer q.requestsMux.Unlock() - - heap.Push(&q.requests, scheduled{ - request: r, - sendTime: t, - }) -} - -func (q *queue) len() int { - q.requestsMux.Lock() - r := len(q.requests) - q.requestsMux.Unlock() - return r -} - -func (q *queue) move(k key, now time.Time, dur time.Duration) { - q.requestsMux.Lock() - defer q.requestsMux.Unlock() - - for idx, s := range q.requests { - if s.request.key != k { - continue - } - - t := s.sendTime - if t.Sub(now) > dur { - break - } - q.requests[idx].sendTime = t.Add(dur) - } - heap.Init(&q.requests) -} - -func (q *queue) gather(now time.Time, req []scheduled) []scheduled { - q.requestsMux.Lock() - defer q.requestsMux.Unlock() - - for { - if q.requests.Len() < 1 { - return req - } - - next := heap.Pop(&q.requests).(scheduled) - if now.Before(next.sendTime) { - heap.Push(&q.requests, next) - return req - } - req = append(req, next) - } -} diff --git a/vendor/github.com/gotd/contrib/middleware/floodwait/request.go b/vendor/github.com/gotd/contrib/middleware/floodwait/request.go deleted file mode 100644 index 3b62a504..00000000 --- a/vendor/github.com/gotd/contrib/middleware/floodwait/request.go +++ /dev/null @@ -1,34 +0,0 @@ -package floodwait - -import ( - "context" - - "github.com/gotd/td/bin" - "github.com/gotd/td/tg" -) - -// object is a abstraction for Telegram API object with TypeID. -type object interface { - TypeID() uint32 -} - -type key uint64 - -func (k *key) fromEncoder(encoder bin.Encoder) { - obj, ok := encoder.(object) - if !ok { - return - } - *k = key(obj.TypeID()) -} - -type request struct { - ctx context.Context - input bin.Encoder - output bin.Decoder - next tg.Invoker - key key - - retry int - result chan error -} diff --git a/vendor/github.com/gotd/contrib/middleware/floodwait/scheduler.go b/vendor/github.com/gotd/contrib/middleware/floodwait/scheduler.go deleted file mode 100644 index 043be386..00000000 --- a/vendor/github.com/gotd/contrib/middleware/floodwait/scheduler.go +++ /dev/null @@ -1,91 +0,0 @@ -package floodwait - -import ( - "context" - "sync" - "time" - - "github.com/gotd/td/bin" - "github.com/gotd/td/clock" - "github.com/gotd/td/tg" -) - -type scheduler struct { - state map[key]time.Duration - mux sync.Mutex - queue *queue - - clock clock.Clock - dec time.Duration -} - -func newScheduler(c clock.Clock, dec time.Duration) *scheduler { - const initialCapacity = 16 - - return &scheduler{ - state: make(map[key]time.Duration, initialCapacity), - queue: newQueue(initialCapacity), - clock: c, - dec: dec, - } -} - -func (s *scheduler) new(ctx context.Context, input bin.Encoder, output bin.Decoder, next tg.Invoker) <-chan error { - var k key - k.fromEncoder(input) - r := request{ - ctx: ctx, - input: input, - output: output, - next: next, - key: k, - result: make(chan error, 1), - } - - s.mux.Lock() - defer s.mux.Unlock() - s.schedule(r) - return r.result -} - -// schedule adds request to the queue. -// Assumes the mutex is locked. -func (s *scheduler) schedule(r request) { - k := r.key - - var t time.Time - if state, ok := s.state[k]; ok { - t = s.clock.Now().Add(state) - } else { - t = s.clock.Now() - } - s.queue.add(r, t) -} - -func (s *scheduler) gather(r []scheduled) []scheduled { - return s.queue.gather(s.clock.Now(), r) -} - -func (s *scheduler) nice(k key) { - s.mux.Lock() - if state, ok := s.state[k]; ok && state-s.dec > 0 { - s.state[k] = state - s.dec - } else { - delete(s.state, k) - } - s.mux.Unlock() -} - -func (s *scheduler) flood(req request, d time.Duration) { - k := req.key - - s.mux.Lock() - now := s.clock.Now() - if state, ok := s.state[k]; !ok || state < d { - s.state[k] = d - } - s.queue.add(req, now.Add(d)) - s.mux.Unlock() - - s.queue.move(k, now, d) -} diff --git a/vendor/github.com/gotd/contrib/middleware/floodwait/simple_waiter.go b/vendor/github.com/gotd/contrib/middleware/floodwait/simple_waiter.go deleted file mode 100644 index 44a9ae0b..00000000 --- a/vendor/github.com/gotd/contrib/middleware/floodwait/simple_waiter.go +++ /dev/null @@ -1,116 +0,0 @@ -package floodwait - -import ( - "context" - "time" - - "github.com/go-faster/errors" - - "github.com/gotd/td/bin" - "github.com/gotd/td/clock" - "github.com/gotd/td/telegram" - "github.com/gotd/td/tg" - "github.com/gotd/td/tgerr" -) - -// SimpleWaiter is a tg.Invoker that handles flood wait errors on underlying invoker. -// -// This implementation is more suitable for one-off tasks and programs with low level -// of concurrency and parallelism. -// -// See Waiter for a fully-blown scheduler-based flood wait handler. -type SimpleWaiter struct { - clock clock.Clock - - maxRetries uint - maxWait time.Duration -} - -// NewSimpleWaiter returns a new invoker that waits on the flood wait errors. -func NewSimpleWaiter() *SimpleWaiter { - return &SimpleWaiter{ - clock: clock.System, - } -} - -// clone returns a copy of the SimpleWaiter. -func (w *SimpleWaiter) clone() *SimpleWaiter { - return &SimpleWaiter{ - clock: w.clock, - maxWait: w.maxWait, - maxRetries: w.maxRetries, - } -} - -// WithClock sets clock to use. Default is to use system clock. -func (w *SimpleWaiter) WithClock(c clock.Clock) *SimpleWaiter { - w = w.clone() - w.clock = c - return w -} - -// WithMaxRetries sets max number of retries before giving up. Default is to keep retrying -// on flood wait errors indefinitely. -func (w *SimpleWaiter) WithMaxRetries(m uint) *SimpleWaiter { - w = w.clone() - w.maxRetries = m - return w -} - -// WithMaxWait limits wait time per attempt. SimpleWaiter will return an error if flood wait -// time exceeds that limit. Default is to wait without time limit. -// -// To limit total wait time use a context.Context with timeout or deadline set. -func (w *SimpleWaiter) WithMaxWait(m time.Duration) *SimpleWaiter { - w = w.clone() - w.maxWait = m - return w -} - -// Handle implements telegram.Middleware. -func (w *SimpleWaiter) Handle(next tg.Invoker) telegram.InvokeFunc { - return func(ctx context.Context, input bin.Encoder, output bin.Decoder) error { - var t clock.Timer - - var retries uint - for { - err := next.Invoke(ctx, input, output) - if err == nil { - return nil - } - - d, ok := tgerr.AsFloodWait(err) - if !ok { - return err - } - - retries++ - - if max := w.maxRetries; max != 0 && retries > max { - return errors.Errorf("flood wait retry limit exceeded (%d > %d): %w", retries, max, err) - } - - if d == 0 { - d = time.Second - } - - if max := w.maxWait; max != 0 && d > max { - return errors.Errorf("flood wait argument is too big (%v > %v): %w", d, max, err) - } - - if t == nil { - t = w.clock.Timer(d) - } else { - clock.StopTimer(t) - t.Reset(d) - } - select { - case <-t.C(): - continue - case <-ctx.Done(): - clock.StopTimer(t) - return ctx.Err() - } - } - } -} diff --git a/vendor/github.com/gotd/contrib/middleware/floodwait/waiter.go b/vendor/github.com/gotd/contrib/middleware/floodwait/waiter.go deleted file mode 100644 index 6ae64d47..00000000 --- a/vendor/github.com/gotd/contrib/middleware/floodwait/waiter.go +++ /dev/null @@ -1,218 +0,0 @@ -package floodwait - -import ( - "context" - "time" - - "github.com/go-faster/errors" - "go.uber.org/atomic" - "golang.org/x/sync/errgroup" - - "github.com/gotd/td/telegram" - "github.com/gotd/td/tg" - - "github.com/gotd/td/bin" - "github.com/gotd/td/clock" - "github.com/gotd/td/tgerr" -) - -const ( - defaultTick = time.Millisecond - defaultMaxWait = time.Minute - defaultMaxRetries = 5 -) - -// Waiter is a tg.Invoker that handles flood wait errors on underlying invoker. -// -// This implementation uses a request scheduler and is more suitable for long-running -// programs with high level of concurrency and parallelism. -// -// You should use Waiter if unsure which waiter implementation to use. -// -// See SimpleWaiter for a simple timer-based implementation. -type Waiter struct { - clock clock.Clock - sch *scheduler - - running atomic.Bool - tick time.Duration - maxWait time.Duration - maxRetries int - onWait func(ctx context.Context, wait FloodWait) -} - -// FloodWait event. -type FloodWait struct { - Duration time.Duration -} - -// NewWaiter returns a new invoker that waits on the flood wait errors. -// -// NB: You MUST use Run method. Example: -// -// if err := waiter.Run(ctx, func(ctx context.Context) error { -// // Client should be started after waiter. -// return client.Run(ctx, handler) -// }); err != nil { -// return errors.Wrap(err, "run client") -// } -func NewWaiter() *Waiter { - return &Waiter{ - clock: clock.System, - sch: newScheduler(clock.System, time.Second), - tick: defaultTick, - maxWait: defaultMaxWait, - maxRetries: defaultMaxRetries, - onWait: func(ctx context.Context, wait FloodWait) {}, - } -} - -// WithCallback sets callback for flood wait event. -func (w *Waiter) WithCallback(f func(ctx context.Context, wait FloodWait)) *Waiter { - w = w.clone() - w.onWait = f - return w -} - -// clone returns a copy of the Waiter. -func (w *Waiter) clone() *Waiter { - return &Waiter{ - clock: w.clock, - sch: w.sch, - tick: w.tick, - maxWait: w.maxWait, - maxRetries: w.maxRetries, - } -} - -// WithClock sets clock to use. Default is to use system clock. -func (w *Waiter) WithClock(c clock.Clock) *Waiter { - w = w.clone() - w.clock = c - return w -} - -// WithMaxWait limits wait time per attempt. Waiter will return an error if flood wait -// time exceeds that limit. Default is to wait at most a minute. -// -// To limit total wait time use a context.Context with timeout or deadline set. -func (w *Waiter) WithMaxWait(m time.Duration) *Waiter { - w = w.clone() - w.maxWait = m - return w -} - -// WithMaxRetries sets max number of retries before giving up. Default is to retry at most 5 times. -func (w *Waiter) WithMaxRetries(m int) *Waiter { - w = w.clone() - w.maxRetries = m - return w -} - -// WithTick sets gather tick interval for Waiter. Default is 1ms. -func (w *Waiter) WithTick(t time.Duration) *Waiter { - w = w.clone() - if t <= 0 { - t = time.Nanosecond - } - w.tick = t - return w -} - -// Run runs send loop. -// -// Example: -// -// if err := waiter.Run(ctx, func(ctx context.Context) error { -// // Client should be started after waiter. -// return client.Run(ctx, handler) -// }); err != nil { -// return errors.Wrap(err, "run client") -// } -func (w *Waiter) Run(ctx context.Context, f func(ctx context.Context) error) (err error) { - w.running.Store(true) - defer w.running.Store(false) - - ctx, cancel := context.WithCancel(ctx) - wg, ctx := errgroup.WithContext(ctx) - wg.Go(func() error { - defer cancel() - return f(ctx) - }) - wg.Go(func() error { - ticker := w.clock.Ticker(w.tick) - defer ticker.Stop() - - var requests []scheduled - for { - select { - case <-ticker.C(): - requests = w.sch.gather(requests[:0]) - if len(requests) < 1 { - continue - } - - for _, s := range requests { - ret, err := w.send(s) - if ret { - select { - case s.request.result <- err: - default: - } - } - } - case <-ctx.Done(): - return nil - } - } - }) - - return wg.Wait() -} - -func (w *Waiter) send(s scheduled) (bool, error) { - err := s.request.next.Invoke(s.request.ctx, s.request.input, s.request.output) - - d, ok := tgerr.AsFloodWait(err) - if !ok { - w.sch.nice(s.request.key) - return true, err - } - - // Notify about flood wait. - w.onWait(s.request.ctx, FloodWait{ - Duration: d, - }) - - s.request.retry++ - - if max := w.maxRetries; max != 0 && s.request.retry > max { - return true, errors.Errorf("flood wait retry limit exceeded (%d > %d): %w", s.request.retry, max, err) - } - - if d < time.Second { - d = time.Second - } - if max := w.maxWait; max != 0 && d > max { - return true, errors.Errorf("flood wait argument is too big (%v > %v): %w", d, max, err) - } - - w.sch.flood(s.request, d) - return false, nil -} - -// Handle implements telegram.Middleware. -func (w *Waiter) Handle(next tg.Invoker) telegram.InvokeFunc { - return func(ctx context.Context, input bin.Encoder, output bin.Decoder) error { - if !w.running.Load() { - // Return explicit error if waiter is not running. - return errors.New("the Waiter middleware is not running: Run(ctx) method is not called or exited") - } - select { - case err := <-w.sch.new(ctx, input, output, next): - return err - case <-ctx.Done(): - return ctx.Err() - } - } -} diff --git a/vendor/github.com/gotd/contrib/middleware/ratelimit/doc.go b/vendor/github.com/gotd/contrib/middleware/ratelimit/doc.go deleted file mode 100644 index e0d01d08..00000000 --- a/vendor/github.com/gotd/contrib/middleware/ratelimit/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package ratelimit implements a tg.Invoker that limits request rate. -package ratelimit diff --git a/vendor/github.com/gotd/contrib/middleware/ratelimit/ratelimit.go b/vendor/github.com/gotd/contrib/middleware/ratelimit/ratelimit.go deleted file mode 100644 index a388811d..00000000 --- a/vendor/github.com/gotd/contrib/middleware/ratelimit/ratelimit.go +++ /dev/null @@ -1,95 +0,0 @@ -package ratelimit - -import ( - "context" - "errors" - "time" - - "golang.org/x/time/rate" - - "github.com/gotd/td/bin" - "github.com/gotd/td/clock" - "github.com/gotd/td/telegram" - "github.com/gotd/td/tg" -) - -// RateLimiter is a tg.Invoker that throttles RPC calls on underlying invoker. -type RateLimiter struct { - clock clock.Clock - lim *rate.Limiter -} - -// New returns a new invoker rate limiter using lim. -func New(r rate.Limit, b int) *RateLimiter { - return &RateLimiter{ - clock: clock.System, - lim: rate.NewLimiter(r, b), - } -} - -// clone returns a copy of the RateLimiter. -func (l *RateLimiter) clone() *RateLimiter { - return &RateLimiter{ - clock: l.clock, - lim: l.lim, - } -} - -// WithClock sets clock to use. Default is to use system clock. -func (l *RateLimiter) WithClock(c clock.Clock) *RateLimiter { - l = l.clone() - l.clock = c - return l -} - -// wait blocks until rate limiter permits an event to happen. It returns an error if -// limiter’s burst size is misconfigured, the Context is canceled, or the expected -// wait time exceeds the Context’s Deadline. -func (l *RateLimiter) wait(ctx context.Context) error { - // Check if ctx is already canceled. - select { - case <-ctx.Done(): - return ctx.Err() - default: - } - - now := l.clock.Now() - - r := l.lim.ReserveN(now, 1) - if !r.OK() { - // Limiter requires n <= lim.burst for each reservation. - return errors.New("limiter's burst size must be greater than zero") - } - - delay := r.DelayFrom(now) - if delay == 0 { - return nil - } - - // Bail out earlier if we exceed context deadline. Note that - // contexts use system time instead of mockable clock. - deadline, ok := ctx.Deadline() - if ok && delay > time.Until(deadline) { - return context.DeadlineExceeded - } - - t := l.clock.Timer(delay) - defer clock.StopTimer(t) - select { - case <-t.C(): - return nil - case <-ctx.Done(): - r.CancelAt(l.clock.Now()) - return ctx.Err() - } -} - -// Handle implements telegram.Middleware. -func (l *RateLimiter) Handle(next tg.Invoker) telegram.InvokeFunc { - return func(ctx context.Context, input bin.Encoder, output bin.Decoder) error { - if err := l.wait(ctx); err != nil { - return err - } - return next.Invoke(ctx, input, output) - } -} diff --git a/vendor/github.com/gotd/td/mtproxy/faketls/client_hello.go b/vendor/github.com/gotd/td/mtproxy/faketls/client_hello.go index c8eacde2..fbd10528 100644 --- a/vendor/github.com/gotd/td/mtproxy/faketls/client_hello.go +++ b/vendor/github.com/gotd/td/mtproxy/faketls/client_hello.go @@ -44,7 +44,7 @@ func createClientHello(b *bin.Buffer, sessionID [32]byte, domain string, key [32 s := stack[lastIdx] stack = stack[:lastIdx] - length := b.Len() - s + 2 + length := b.Len() - (s + 2) binary.BigEndian.PutUint16(b.Buf[s:], uint16(length)) } diff --git a/vendor/github.com/gotd/td/telegram/client.go b/vendor/github.com/gotd/td/telegram/client.go index 4d7b390f..3f9c4c85 100644 --- a/vendor/github.com/gotd/td/telegram/client.go +++ b/vendor/github.com/gotd/td/telegram/client.go @@ -58,6 +58,14 @@ type Client struct { // DO NOT change the order of members arbitrarily. // Ref: https://pkg.go.dev/sync/atomic#pkg-note-BUG + // Connection factory fields. + connsCounter atomic.Int64 + create connConstructor // immutable + resolver dcs.Resolver // immutable + onDead func() // immutable + connBackoff func() backoff.BackOff // immutable + defaultMode manager.ConnMode // immutable + // Migration state. migrationTimeout time.Duration // immutable migration chan struct{} @@ -86,13 +94,6 @@ type Client struct { cfg *manager.AtomicConfig conn clientConn connMux sync.Mutex - // Connection factory fields. - create connConstructor // immutable - resolver dcs.Resolver // immutable - onDead func() // immutable - connBackoff func() backoff.BackOff // immutable - defaultMode manager.ConnMode // immutable - connsCounter atomic.Int64 // Restart signal channel. restart chan struct{} // immutable diff --git a/vendor/github.com/gotd/td/telegram/uploader/big.go b/vendor/github.com/gotd/td/telegram/uploader/big.go index 2261c3af..8eaa7fe0 100644 --- a/vendor/github.com/gotd/td/telegram/uploader/big.go +++ b/vendor/github.com/gotd/td/telegram/uploader/big.go @@ -53,14 +53,22 @@ func (u *Uploader) bigLoop(ctx context.Context, threads int, upload *Upload) err r := syncio.NewReader(upload.from) g.Go(func(ctx context.Context) error { last := false + totalStreamSize := 0 for { buf := u.pool.GetSize(u.partSize) n, err := io.ReadFull(r, buf.Buf) + if n > 0 { + totalStreamSize += n + } switch { case errors.Is(err, io.ErrUnexpectedEOF): last = true + if upload.totalParts == -1 { + totalParts := (totalStreamSize + u.partSize - 1) / u.partSize + upload.totalParts = int(totalParts) + } case errors.Is(err, io.EOF): u.pool.Put(buf) diff --git a/vendor/github.com/gotd/td/telegram/uploader/helpers.go b/vendor/github.com/gotd/td/telegram/uploader/helpers.go index a03c9aa1..13eb5e67 100644 --- a/vendor/github.com/gotd/td/telegram/uploader/helpers.go +++ b/vendor/github.com/gotd/td/telegram/uploader/helpers.go @@ -60,6 +60,8 @@ func (u *Uploader) FromFS(ctx context.Context, filesystem fs.FS, path string) (_ // FromReader uploads file from given io.Reader. // NB: totally stream should not exceed the limit for // small files (10 MB as docs says, may be a bit bigger). +// Support For Big Files +// https://core.telegram.org/api/files#streamed-uploads func (u *Uploader) FromReader(ctx context.Context, name string, f io.Reader) (tg.InputFileClass, error) { return u.Upload(ctx, NewUpload(name, f, -1)) } diff --git a/vendor/github.com/gotd/td/telegram/uploader/uploader.go b/vendor/github.com/gotd/td/telegram/uploader/uploader.go index bdf6f87e..cf0a73e5 100644 --- a/vendor/github.com/gotd/td/telegram/uploader/uploader.go +++ b/vendor/github.com/gotd/td/telegram/uploader/uploader.go @@ -82,6 +82,10 @@ func (u *Uploader) Upload(ctx context.Context, upload *Upload) (tg.InputFileClas if err := u.initUpload(upload); err != nil { return nil, err } + if upload.totalBytes == -1 { + upload.big = true + upload.totalParts = -1 + } if !upload.big { return u.uploadSmall(ctx, upload) diff --git a/vendor/github.com/gotd/td/tg/tl_account_accept_authorization_gen.go b/vendor/github.com/gotd/td/tg/tl_account_accept_authorization_gen.go index 74b40c83..ac1a69ec 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_accept_authorization_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_accept_authorization_gen.go @@ -291,6 +291,7 @@ func (a *AccountAcceptAuthorizationRequest) GetCredentials() (value SecureCreden // // Possible errors: // +// 400 BOT_INVALID: This is not a valid bot. // 400 PUBLIC_KEY_REQUIRED: A public key is required. // // See https://core.telegram.org/method/account.acceptAuthorization for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_account_business_chat_links_gen.go b/vendor/github.com/gotd/td/tg/tl_account_business_chat_links_gen.go index e0131d5e..56f099a5 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_business_chat_links_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_business_chat_links_gen.go @@ -32,14 +32,18 @@ var ( ) // AccountBusinessChatLinks represents TL type `account.businessChatLinks#ec43a2d1`. +// Contains info about business chat deep links »¹ created by the current account. +// +// Links: +// 1. https://core.telegram.org/api/business#business-chat-links // // See https://core.telegram.org/constructor/account.businessChatLinks for reference. type AccountBusinessChatLinks struct { - // Links field of AccountBusinessChatLinks. + // Links Links []BusinessChatLink - // Chats field of AccountBusinessChatLinks. + // Mentioned chats Chats []ChatClass - // Users field of AccountBusinessChatLinks. + // Mentioned users Users []UserClass } diff --git a/vendor/github.com/gotd/td/tg/tl_account_connected_bots_gen.go b/vendor/github.com/gotd/td/tg/tl_account_connected_bots_gen.go index c38996f8..65a042bf 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_connected_bots_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_connected_bots_gen.go @@ -32,12 +32,16 @@ var ( ) // AccountConnectedBots represents TL type `account.connectedBots#17d7f87b`. +// Info about currently connected business bots¹. +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots // // See https://core.telegram.org/constructor/account.connectedBots for reference. type AccountConnectedBots struct { - // ConnectedBots field of AccountConnectedBots. + // Info about the connected bots ConnectedBots []ConnectedBot - // Users field of AccountConnectedBots. + // Bot information Users []UserClass } diff --git a/vendor/github.com/gotd/td/tg/tl_account_create_business_chat_link_gen.go b/vendor/github.com/gotd/td/tg/tl_account_create_business_chat_link_gen.go index f92d7450..470be130 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_create_business_chat_link_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_create_business_chat_link_gen.go @@ -32,10 +32,14 @@ var ( ) // AccountCreateBusinessChatLinkRequest represents TL type `account.createBusinessChatLink#8851e68e`. +// Create a business chat deep link »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#business-chat-links // // See https://core.telegram.org/method/account.createBusinessChatLink for reference. type AccountCreateBusinessChatLinkRequest struct { - // Link field of AccountCreateBusinessChatLinkRequest. + // Info about the link to create. Link InputBusinessChatLink } @@ -161,6 +165,15 @@ func (c *AccountCreateBusinessChatLinkRequest) GetLink() (value InputBusinessCha } // AccountCreateBusinessChatLink invokes method account.createBusinessChatLink#8851e68e returning error if any. +// Create a business chat deep link »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#business-chat-links +// +// Possible errors: +// +// 400 CHATLINKS_TOO_MUCH: Too many business chat links were created, please delete some older links. +// 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. // // See https://core.telegram.org/method/account.createBusinessChatLink for reference. func (c *Client) AccountCreateBusinessChatLink(ctx context.Context, link InputBusinessChatLink) (*BusinessChatLink, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_delete_business_chat_link_gen.go b/vendor/github.com/gotd/td/tg/tl_account_delete_business_chat_link_gen.go index 101a6d4a..18c33341 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_delete_business_chat_link_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_delete_business_chat_link_gen.go @@ -32,10 +32,17 @@ var ( ) // AccountDeleteBusinessChatLinkRequest represents TL type `account.deleteBusinessChatLink#60073674`. +// Delete a business chat deep link »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#business-chat-links // // See https://core.telegram.org/method/account.deleteBusinessChatLink for reference. type AccountDeleteBusinessChatLinkRequest struct { - // Slug field of AccountDeleteBusinessChatLinkRequest. + // Slug of the link, obtained as specified here »¹. + // + // Links: + // 1) https://core.telegram.org/api/links#business-chat-links Slug string } @@ -161,6 +168,15 @@ func (d *AccountDeleteBusinessChatLinkRequest) GetSlug() (value string) { } // AccountDeleteBusinessChatLink invokes method account.deleteBusinessChatLink#60073674 returning error if any. +// Delete a business chat deep link »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#business-chat-links +// +// Possible errors: +// +// 400 CHATLINK_SLUG_EMPTY: The specified slug is empty. +// 400 CHATLINK_SLUG_EXPIRED: The specified business chat link has expired. // // See https://core.telegram.org/method/account.deleteBusinessChatLink for reference. func (c *Client) AccountDeleteBusinessChatLink(ctx context.Context, slug string) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_disable_peer_connected_bot_gen.go b/vendor/github.com/gotd/td/tg/tl_account_disable_peer_connected_bot_gen.go index 20c0018d..5fb5da72 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_disable_peer_connected_bot_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_disable_peer_connected_bot_gen.go @@ -32,10 +32,19 @@ var ( ) // AccountDisablePeerConnectedBotRequest represents TL type `account.disablePeerConnectedBot#5e437ed9`. +// Permanently disconnect a specific chat from all business bots »¹ (equivalent to +// specifying it in recipients.exclude_users during initial configuration with account +// updateConnectedBot »²); to reconnect of a chat disconnected using this method the +// user must reconnect the entire bot by invoking account.updateConnectedBot »³. +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots +// 2. https://core.telegram.org/method/account.updateConnectedBot +// 3. https://core.telegram.org/method/account.updateConnectedBot // // See https://core.telegram.org/method/account.disablePeerConnectedBot for reference. type AccountDisablePeerConnectedBotRequest struct { - // Peer field of AccountDisablePeerConnectedBotRequest. + // The chat to disconnect Peer InputPeerClass } @@ -166,6 +175,21 @@ func (d *AccountDisablePeerConnectedBotRequest) GetPeer() (value InputPeerClass) } // AccountDisablePeerConnectedBot invokes method account.disablePeerConnectedBot#5e437ed9 returning error if any. +// Permanently disconnect a specific chat from all business bots »¹ (equivalent to +// specifying it in recipients.exclude_users during initial configuration with account +// updateConnectedBot »²); to reconnect of a chat disconnected using this method the +// user must reconnect the entire bot by invoking account.updateConnectedBot »³. +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots +// 2. https://core.telegram.org/method/account.updateConnectedBot +// 3. https://core.telegram.org/method/account.updateConnectedBot +// +// Possible errors: +// +// 400 BOT_ALREADY_DISABLED: The connected business bot was already disabled for the specified peer. +// 400 BOT_NOT_CONNECTED_YET: No business bot is connected to the currently logged in user. +// 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/account.disablePeerConnectedBot for reference. func (c *Client) AccountDisablePeerConnectedBot(ctx context.Context, peer InputPeerClass) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_edit_business_chat_link_gen.go b/vendor/github.com/gotd/td/tg/tl_account_edit_business_chat_link_gen.go index 9aedcf3b..9c59d59f 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_edit_business_chat_link_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_edit_business_chat_link_gen.go @@ -32,12 +32,19 @@ var ( ) // AccountEditBusinessChatLinkRequest represents TL type `account.editBusinessChatLink#8c3410af`. +// Edit a created business chat deep link »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#business-chat-links // // See https://core.telegram.org/method/account.editBusinessChatLink for reference. type AccountEditBusinessChatLinkRequest struct { - // Slug field of AccountEditBusinessChatLinkRequest. + // Slug of the link, obtained as specified here »¹. + // + // Links: + // 1) https://core.telegram.org/api/links#business-chat-links Slug string - // Link field of AccountEditBusinessChatLinkRequest. + // New link information. Link InputBusinessChatLink } @@ -188,6 +195,15 @@ func (e *AccountEditBusinessChatLinkRequest) GetLink() (value InputBusinessChatL } // AccountEditBusinessChatLink invokes method account.editBusinessChatLink#8c3410af returning error if any. +// Edit a created business chat deep link »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#business-chat-links +// +// Possible errors: +// +// 400 CHATLINK_SLUG_EMPTY: The specified slug is empty. +// 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. // // See https://core.telegram.org/method/account.editBusinessChatLink for reference. func (c *Client) AccountEditBusinessChatLink(ctx context.Context, request *AccountEditBusinessChatLinkRequest) (*BusinessChatLink, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_emoji_statuses_gen.go b/vendor/github.com/gotd/td/tg/tl_account_emoji_statuses_gen.go index 4ef50636..91bf2f80 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_emoji_statuses_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_emoji_statuses_gen.go @@ -144,7 +144,7 @@ func (e *AccountEmojiStatusesNotModified) DecodeBare(b *bin.Buffer) error { // // See https://core.telegram.org/constructor/account.emojiStatuses for reference. type AccountEmojiStatuses struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_account_get_authorization_form_gen.go b/vendor/github.com/gotd/td/tg/tl_account_get_authorization_form_gen.go index 4803dc8a..6e90b44d 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_get_authorization_form_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_get_authorization_form_gen.go @@ -220,6 +220,7 @@ func (g *AccountGetAuthorizationFormRequest) GetPublicKey() (value string) { // // Possible errors: // +// 400 BOT_INVALID: This is not a valid bot. // 400 PUBLIC_KEY_REQUIRED: A public key is required. // // See https://core.telegram.org/method/account.getAuthorizationForm for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_account_get_bot_business_connection_gen.go b/vendor/github.com/gotd/td/tg/tl_account_get_bot_business_connection_gen.go index e1fd8a3f..ace93c4d 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_get_bot_business_connection_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_get_bot_business_connection_gen.go @@ -32,10 +32,35 @@ var ( ) // AccountGetBotBusinessConnectionRequest represents TL type `account.getBotBusinessConnection#76a86270`. +// Bots may invoke this method to re-fetch the updateBotBusinessConnect¹ constructor +// associated with a specific business connection_id, see here »² for more info on +// connected business bots. +// This is needed for example for freshly logged in bots that are receiving some +// updateBotNewBusinessMessage³, etc. updates because some users have already connected +// to the bot before it could login. +// In this case, the bot is receiving messages from the business connection, but it +// hasn't cached the associated updateBotBusinessConnect⁴ with info about the +// connection (can it reply to messages? etc.) yet, and cannot receive the old ones +// because they were sent when the bot wasn't logged into the session yet. +// This method can be used to fetch info about a not-yet-cached business connection, and +// should not be invoked if the info is already cached or to fetch changes, as eventual +// changes will automatically be sent as new updateBotBusinessConnect⁵ updates to the +// bot using the usual update delivery methods »⁶. +// +// Links: +// 1. https://core.telegram.org/constructor/updateBotBusinessConnect +// 2. https://core.telegram.org/api/business#connected-bots +// 3. https://core.telegram.org/constructor/updateBotNewBusinessMessage +// 4. https://core.telegram.org/constructor/updateBotBusinessConnect +// 5. https://core.telegram.org/constructor/updateBotBusinessConnect +// 6. https://core.telegram.org/api/updates // // See https://core.telegram.org/method/account.getBotBusinessConnection for reference. type AccountGetBotBusinessConnectionRequest struct { - // ConnectionID field of AccountGetBotBusinessConnectionRequest. + // Business connection ID »¹. + // + // Links: + // 1) https://core.telegram.org/api/business#connected-bots ConnectionID string } @@ -161,8 +186,35 @@ func (g *AccountGetBotBusinessConnectionRequest) GetConnectionID() (value string } // AccountGetBotBusinessConnection invokes method account.getBotBusinessConnection#76a86270 returning error if any. +// Bots may invoke this method to re-fetch the updateBotBusinessConnect¹ constructor +// associated with a specific business connection_id, see here »² for more info on +// connected business bots. +// This is needed for example for freshly logged in bots that are receiving some +// updateBotNewBusinessMessage³, etc. updates because some users have already connected +// to the bot before it could login. +// In this case, the bot is receiving messages from the business connection, but it +// hasn't cached the associated updateBotBusinessConnect⁴ with info about the +// connection (can it reply to messages? etc.) yet, and cannot receive the old ones +// because they were sent when the bot wasn't logged into the session yet. +// This method can be used to fetch info about a not-yet-cached business connection, and +// should not be invoked if the info is already cached or to fetch changes, as eventual +// changes will automatically be sent as new updateBotBusinessConnect⁵ updates to the +// bot using the usual update delivery methods »⁶. +// +// Links: +// 1. https://core.telegram.org/constructor/updateBotBusinessConnect +// 2. https://core.telegram.org/api/business#connected-bots +// 3. https://core.telegram.org/constructor/updateBotNewBusinessMessage +// 4. https://core.telegram.org/constructor/updateBotBusinessConnect +// 5. https://core.telegram.org/constructor/updateBotBusinessConnect +// 6. https://core.telegram.org/api/updates +// +// Possible errors: +// +// 400 CONNECTION_ID_INVALID: The specified connection ID is invalid. // // See https://core.telegram.org/method/account.getBotBusinessConnection for reference. +// Can be used by bots. func (c *Client) AccountGetBotBusinessConnection(ctx context.Context, connectionid string) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_account_get_business_chat_links_gen.go b/vendor/github.com/gotd/td/tg/tl_account_get_business_chat_links_gen.go index f0dfe710..8ec89607 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_get_business_chat_links_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_get_business_chat_links_gen.go @@ -32,6 +32,10 @@ var ( ) // AccountGetBusinessChatLinksRequest represents TL type `account.getBusinessChatLinks#6f70dde1`. +// List all created business chat deep links »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#business-chat-links // // See https://core.telegram.org/method/account.getBusinessChatLinks for reference. type AccountGetBusinessChatLinksRequest struct { @@ -128,6 +132,10 @@ func (g *AccountGetBusinessChatLinksRequest) DecodeBare(b *bin.Buffer) error { } // AccountGetBusinessChatLinks invokes method account.getBusinessChatLinks#6f70dde1 returning error if any. +// List all created business chat deep links »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#business-chat-links // // See https://core.telegram.org/method/account.getBusinessChatLinks for reference. func (c *Client) AccountGetBusinessChatLinks(ctx context.Context) (*AccountBusinessChatLinks, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_get_channel_default_emoji_statuses_gen.go b/vendor/github.com/gotd/td/tg/tl_account_get_channel_default_emoji_statuses_gen.go index 5764d45d..513fb02c 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_get_channel_default_emoji_statuses_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_get_channel_default_emoji_statuses_gen.go @@ -39,7 +39,7 @@ var ( // // See https://core.telegram.org/method/account.getChannelDefaultEmojiStatuses for reference. type AccountGetChannelDefaultEmojiStatusesRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_account_get_channel_restricted_status_emojis_gen.go b/vendor/github.com/gotd/td/tg/tl_account_get_channel_restricted_status_emojis_gen.go index d5e3dcae..401bc209 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_get_channel_restricted_status_emojis_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_get_channel_restricted_status_emojis_gen.go @@ -41,7 +41,7 @@ var ( // // See https://core.telegram.org/method/account.getChannelRestrictedStatusEmojis for reference. type AccountGetChannelRestrictedStatusEmojisRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_account_get_chat_themes_gen.go b/vendor/github.com/gotd/td/tg/tl_account_get_chat_themes_gen.go index 828484bf..f2cf88e8 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_get_chat_themes_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_get_chat_themes_gen.go @@ -39,7 +39,7 @@ var ( // // See https://core.telegram.org/method/account.getChatThemes for reference. type AccountGetChatThemesRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_account_get_connected_bots_gen.go b/vendor/github.com/gotd/td/tg/tl_account_get_connected_bots_gen.go index 2b8bd944..8053d49c 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_get_connected_bots_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_get_connected_bots_gen.go @@ -32,6 +32,10 @@ var ( ) // AccountGetConnectedBotsRequest represents TL type `account.getConnectedBots#4ea4c80f`. +// List all currently connected business bots »¹ +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots // // See https://core.telegram.org/method/account.getConnectedBots for reference. type AccountGetConnectedBotsRequest struct { @@ -128,6 +132,10 @@ func (g *AccountGetConnectedBotsRequest) DecodeBare(b *bin.Buffer) error { } // AccountGetConnectedBots invokes method account.getConnectedBots#4ea4c80f returning error if any. +// List all currently connected business bots »¹ +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots // // See https://core.telegram.org/method/account.getConnectedBots for reference. func (c *Client) AccountGetConnectedBots(ctx context.Context) (*AccountConnectedBots, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_get_default_background_emojis_gen.go b/vendor/github.com/gotd/td/tg/tl_account_get_default_background_emojis_gen.go index 67547c2e..bd8115de 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_get_default_background_emojis_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_get_default_background_emojis_gen.go @@ -41,7 +41,7 @@ var ( // // See https://core.telegram.org/method/account.getDefaultBackgroundEmojis for reference. type AccountGetDefaultBackgroundEmojisRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_account_get_default_emoji_statuses_gen.go b/vendor/github.com/gotd/td/tg/tl_account_get_default_emoji_statuses_gen.go index 0b90e510..264a08b1 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_get_default_emoji_statuses_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_get_default_emoji_statuses_gen.go @@ -39,7 +39,7 @@ var ( // // See https://core.telegram.org/method/account.getDefaultEmojiStatuses for reference. type AccountGetDefaultEmojiStatusesRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_account_get_default_group_photo_emojis_gen.go b/vendor/github.com/gotd/td/tg/tl_account_get_default_group_photo_emojis_gen.go index 35489801..91eeb72e 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_get_default_group_photo_emojis_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_get_default_group_photo_emojis_gen.go @@ -40,7 +40,7 @@ var ( // // See https://core.telegram.org/method/account.getDefaultGroupPhotoEmojis for reference. type AccountGetDefaultGroupPhotoEmojisRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_account_get_default_profile_photo_emojis_gen.go b/vendor/github.com/gotd/td/tg/tl_account_get_default_profile_photo_emojis_gen.go index 0f97f77a..2d67a2ab 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_get_default_profile_photo_emojis_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_get_default_profile_photo_emojis_gen.go @@ -40,7 +40,7 @@ var ( // // See https://core.telegram.org/method/account.getDefaultProfilePhotoEmojis for reference. type AccountGetDefaultProfilePhotoEmojisRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_account_get_reactions_notify_settings_gen.go b/vendor/github.com/gotd/td/tg/tl_account_get_reactions_notify_settings_gen.go index 0dbc640a..bfc53262 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_get_reactions_notify_settings_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_get_reactions_notify_settings_gen.go @@ -32,6 +32,10 @@ var ( ) // AccountGetReactionsNotifySettingsRequest represents TL type `account.getReactionsNotifySettings#6dd654c`. +// Get the current reaction notification settings »¹. +// +// Links: +// 1. https://core.telegram.org/api/reactions#notifications-about-reactions // // See https://core.telegram.org/method/account.getReactionsNotifySettings for reference. type AccountGetReactionsNotifySettingsRequest struct { @@ -128,6 +132,10 @@ func (g *AccountGetReactionsNotifySettingsRequest) DecodeBare(b *bin.Buffer) err } // AccountGetReactionsNotifySettings invokes method account.getReactionsNotifySettings#6dd654c returning error if any. +// Get the current reaction notification settings »¹. +// +// Links: +// 1. https://core.telegram.org/api/reactions#notifications-about-reactions // // See https://core.telegram.org/method/account.getReactionsNotifySettings for reference. func (c *Client) AccountGetReactionsNotifySettings(ctx context.Context) (*ReactionsNotifySettings, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_get_recent_emoji_statuses_gen.go b/vendor/github.com/gotd/td/tg/tl_account_get_recent_emoji_statuses_gen.go index a936822c..f3ef1f53 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_get_recent_emoji_statuses_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_get_recent_emoji_statuses_gen.go @@ -39,7 +39,7 @@ var ( // // See https://core.telegram.org/method/account.getRecentEmojiStatuses for reference. type AccountGetRecentEmojiStatusesRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_account_get_saved_ringtones_gen.go b/vendor/github.com/gotd/td/tg/tl_account_get_saved_ringtones_gen.go index ee2a5602..bdc68ecb 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_get_saved_ringtones_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_get_saved_ringtones_gen.go @@ -36,7 +36,7 @@ var ( // // See https://core.telegram.org/method/account.getSavedRingtones for reference. type AccountGetSavedRingtonesRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_account_get_themes_gen.go b/vendor/github.com/gotd/td/tg/tl_account_get_themes_gen.go index 054fc178..057b625b 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_get_themes_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_get_themes_gen.go @@ -38,7 +38,7 @@ var ( type AccountGetThemesRequest struct { // Theme format, a string that identifies the theming engines supported by the client Format string - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_account_get_wall_papers_gen.go b/vendor/github.com/gotd/td/tg/tl_account_get_wall_papers_gen.go index f03fa8ea..f3eb9482 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_get_wall_papers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_get_wall_papers_gen.go @@ -39,7 +39,7 @@ var ( // // See https://core.telegram.org/method/account.getWallPapers for reference. type AccountGetWallPapersRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_account_reorder_usernames_gen.go b/vendor/github.com/gotd/td/tg/tl_account_reorder_usernames_gen.go index 2c298429..e80bd2f6 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_reorder_usernames_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_reorder_usernames_gen.go @@ -180,6 +180,7 @@ func (r *AccountReorderUsernamesRequest) GetOrder() (value []string) { // Possible errors: // // 400 ORDER_INVALID: The specified username order is invalid. +// 400 USERNAME_NOT_MODIFIED: The username was not modified. // // See https://core.telegram.org/method/account.reorderUsernames for reference. func (c *Client) AccountReorderUsernames(ctx context.Context, order []string) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_resolve_business_chat_link_gen.go b/vendor/github.com/gotd/td/tg/tl_account_resolve_business_chat_link_gen.go index 5f5afc47..dfb4b49d 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_resolve_business_chat_link_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_resolve_business_chat_link_gen.go @@ -32,10 +32,17 @@ var ( ) // AccountResolveBusinessChatLinkRequest represents TL type `account.resolveBusinessChatLink#5492e5ee`. +// Resolve a business chat deep link »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#business-chat-links // // See https://core.telegram.org/method/account.resolveBusinessChatLink for reference. type AccountResolveBusinessChatLinkRequest struct { - // Slug field of AccountResolveBusinessChatLinkRequest. + // Slug of the link, obtained as specified here »¹. + // + // Links: + // 1) https://core.telegram.org/api/links#business-chat-links Slug string } @@ -161,6 +168,15 @@ func (r *AccountResolveBusinessChatLinkRequest) GetSlug() (value string) { } // AccountResolveBusinessChatLink invokes method account.resolveBusinessChatLink#5492e5ee returning error if any. +// Resolve a business chat deep link »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#business-chat-links +// +// Possible errors: +// +// 400 CHATLINK_SLUG_EMPTY: The specified slug is empty. +// 400 CHATLINK_SLUG_EXPIRED: The specified business chat link has expired. // // See https://core.telegram.org/method/account.resolveBusinessChatLink for reference. func (c *Client) AccountResolveBusinessChatLink(ctx context.Context, slug string) (*AccountResolvedBusinessChatLinks, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_resolved_business_chat_links_gen.go b/vendor/github.com/gotd/td/tg/tl_account_resolved_business_chat_links_gen.go index 713e2865..44b92ffa 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_resolved_business_chat_links_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_resolved_business_chat_links_gen.go @@ -32,22 +32,32 @@ var ( ) // AccountResolvedBusinessChatLinks represents TL type `account.resolvedBusinessChatLinks#9a23af21`. +// Contains info about a single resolved business chat deep link »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#business-chat-links // // See https://core.telegram.org/constructor/account.resolvedBusinessChatLinks for reference. type AccountResolvedBusinessChatLinks struct { - // Flags field of AccountResolvedBusinessChatLinks. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Peer field of AccountResolvedBusinessChatLinks. + // Destination peer Peer PeerClass - // Message field of AccountResolvedBusinessChatLinks. + // Message to pre-fill in the message input field. Message string - // Entities field of AccountResolvedBusinessChatLinks. + // Message entities for styled text¹ + // + // Links: + // 1) https://core.telegram.org/api/entities // // Use SetEntities and GetEntities helpers. Entities []MessageEntityClass - // Chats field of AccountResolvedBusinessChatLinks. + // Mentioned chats Chats []ChatClass - // Users field of AccountResolvedBusinessChatLinks. + // Mentioned users Users []UserClass } diff --git a/vendor/github.com/gotd/td/tg/tl_account_save_auto_save_settings_gen.go b/vendor/github.com/gotd/td/tg/tl_account_save_auto_save_settings_gen.go index 8c9ca0e8..337fdbca 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_save_auto_save_settings_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_save_auto_save_settings_gen.go @@ -351,7 +351,6 @@ func (s *AccountSaveAutoSaveSettingsRequest) GetSettings() (value AutoSaveSettin // 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/account.saveAutoSaveSettings for reference. -// Can be used by bots. func (c *Client) AccountSaveAutoSaveSettings(ctx context.Context, request *AccountSaveAutoSaveSettingsRequest) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_account_save_ringtone_gen.go b/vendor/github.com/gotd/td/tg/tl_account_save_ringtone_gen.go index 621e8a1a..2a8078c5 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_save_ringtone_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_save_ringtone_gen.go @@ -226,6 +226,10 @@ func (s *AccountSaveRingtoneRequest) GetIDAsNotEmpty() (*InputDocument, bool) { // 2. https://core.telegram.org/constructor/account.savedRingtoneConverted // 3. https://core.telegram.org/constructor/document // +// Possible errors: +// +// 400 RINGTONE_INVALID: The specified ringtone is invalid. +// // See https://core.telegram.org/method/account.saveRingtone for reference. func (c *Client) AccountSaveRingtone(ctx context.Context, request *AccountSaveRingtoneRequest) (AccountSavedRingtoneClass, error) { var result AccountSavedRingtoneBox diff --git a/vendor/github.com/gotd/td/tg/tl_account_save_secure_value_gen.go b/vendor/github.com/gotd/td/tg/tl_account_save_secure_value_gen.go index 813dbcc6..efaa0076 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_save_secure_value_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_save_secure_value_gen.go @@ -208,6 +208,7 @@ func (s *AccountSaveSecureValueRequest) GetSecureSecretID() (value int64) { // Possible errors: // // 400 PASSWORD_REQUIRED: A 2FA password must be configured to use Telegram Passport. +// 400 SECURE_SECRET_REQUIRED: A secure secret is required. // // See https://core.telegram.org/method/account.saveSecureValue for reference. func (c *Client) AccountSaveSecureValue(ctx context.Context, request *AccountSaveSecureValueRequest) (*SecureValue, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_save_theme_gen.go b/vendor/github.com/gotd/td/tg/tl_account_save_theme_gen.go index 1708bd20..d54b6028 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_save_theme_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_save_theme_gen.go @@ -196,6 +196,10 @@ func (s *AccountSaveThemeRequest) GetUnsave() (value bool) { // AccountSaveTheme invokes method account.saveTheme#f257106c returning error if any. // Save a theme // +// Possible errors: +// +// 400 THEME_INVALID: Invalid theme provided. +// // See https://core.telegram.org/method/account.saveTheme for reference. func (c *Client) AccountSaveTheme(ctx context.Context, request *AccountSaveThemeRequest) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_account_saved_ringtones_gen.go b/vendor/github.com/gotd/td/tg/tl_account_saved_ringtones_gen.go index 4927db97..55457184 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_saved_ringtones_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_saved_ringtones_gen.go @@ -138,7 +138,7 @@ func (s *AccountSavedRingtonesNotModified) DecodeBare(b *bin.Buffer) error { // // See https://core.telegram.org/constructor/account.savedRingtones for reference. type AccountSavedRingtones struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_account_send_verify_email_code_gen.go b/vendor/github.com/gotd/td/tg/tl_account_send_verify_email_code_gen.go index 815f28a6..c1beffd5 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_send_verify_email_code_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_send_verify_email_code_gen.go @@ -199,6 +199,7 @@ func (s *AccountSendVerifyEmailCodeRequest) GetEmail() (value string) { // Possible errors: // // 400 EMAIL_INVALID: The specified email is invalid. +// 400 EMAIL_NOT_ALLOWED: The specified email cannot be used to complete the operation. // 400 EMAIL_NOT_SETUP: In order to change the login email with emailVerifyPurposeLoginChange, an existing login email must already be set using emailVerifyPurposeLoginSetup. // 400 PHONE_HASH_EXPIRED: An invalid or expired phone_code_hash was provided. // 400 PHONE_NUMBER_INVALID: The phone number is invalid. diff --git a/vendor/github.com/gotd/td/tg/tl_account_set_global_privacy_settings_gen.go b/vendor/github.com/gotd/td/tg/tl_account_set_global_privacy_settings_gen.go index e22ccbca..7305c46f 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_set_global_privacy_settings_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_set_global_privacy_settings_gen.go @@ -166,7 +166,8 @@ func (s *AccountSetGlobalPrivacySettingsRequest) GetSettings() (value GlobalPriv // // Possible errors: // -// 400 AUTOARCHIVE_NOT_AVAILABLE: The autoarchive setting is not available at this time: please check the value of the autoarchive_setting_available field in client config » before calling this method. +// 400 AUTOARCHIVE_NOT_AVAILABLE: The autoarchive setting is not available at this time: please check the value of the autoarchive_setting_available field in client config » before calling this method. +// 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. // // See https://core.telegram.org/method/account.setGlobalPrivacySettings for reference. func (c *Client) AccountSetGlobalPrivacySettings(ctx context.Context, settings GlobalPrivacySettings) (*GlobalPrivacySettings, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_set_reactions_notify_settings_gen.go b/vendor/github.com/gotd/td/tg/tl_account_set_reactions_notify_settings_gen.go index 3567bd82..c9867de3 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_set_reactions_notify_settings_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_set_reactions_notify_settings_gen.go @@ -32,10 +32,14 @@ var ( ) // AccountSetReactionsNotifySettingsRequest represents TL type `account.setReactionsNotifySettings#316ce548`. +// Change the reaction notification settings »¹. +// +// Links: +// 1. https://core.telegram.org/api/reactions#notifications-about-reactions // // See https://core.telegram.org/method/account.setReactionsNotifySettings for reference. type AccountSetReactionsNotifySettingsRequest struct { - // Settings field of AccountSetReactionsNotifySettingsRequest. + // New reaction notification settings. Settings ReactionsNotifySettings } @@ -161,6 +165,10 @@ func (s *AccountSetReactionsNotifySettingsRequest) GetSettings() (value Reaction } // AccountSetReactionsNotifySettings invokes method account.setReactionsNotifySettings#316ce548 returning error if any. +// Change the reaction notification settings »¹. +// +// Links: +// 1. https://core.telegram.org/api/reactions#notifications-about-reactions // // See https://core.telegram.org/method/account.setReactionsNotifySettings for reference. func (c *Client) AccountSetReactionsNotifySettings(ctx context.Context, settings ReactionsNotifySettings) (*ReactionsNotifySettings, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_themes_gen.go b/vendor/github.com/gotd/td/tg/tl_account_themes_gen.go index fdd92093..1d448da0 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_themes_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_themes_gen.go @@ -138,7 +138,7 @@ func (t *AccountThemesNotModified) DecodeBare(b *bin.Buffer) error { // // See https://core.telegram.org/constructor/account.themes for reference. type AccountThemes struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_account_toggle_connected_bot_paused_gen.go b/vendor/github.com/gotd/td/tg/tl_account_toggle_connected_bot_paused_gen.go index 2a1e91a1..32464665 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_toggle_connected_bot_paused_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_toggle_connected_bot_paused_gen.go @@ -32,12 +32,17 @@ var ( ) // AccountToggleConnectedBotPausedRequest represents TL type `account.toggleConnectedBotPaused#646e1097`. +// Pause or unpause a specific chat, temporarily disconnecting it from all business bots +// »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots // // See https://core.telegram.org/method/account.toggleConnectedBotPaused for reference. type AccountToggleConnectedBotPausedRequest struct { - // Peer field of AccountToggleConnectedBotPausedRequest. + // The chat to pause Peer InputPeerClass - // Paused field of AccountToggleConnectedBotPausedRequest. + // Whether to pause or unpause the chat Paused bool } @@ -193,6 +198,15 @@ func (t *AccountToggleConnectedBotPausedRequest) GetPaused() (value bool) { } // AccountToggleConnectedBotPaused invokes method account.toggleConnectedBotPaused#646e1097 returning error if any. +// Pause or unpause a specific chat, temporarily disconnecting it from all business bots +// »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots +// +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/account.toggleConnectedBotPaused for reference. func (c *Client) AccountToggleConnectedBotPaused(ctx context.Context, request *AccountToggleConnectedBotPausedRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_toggle_sponsored_messages_gen.go b/vendor/github.com/gotd/td/tg/tl_account_toggle_sponsored_messages_gen.go index 55e139f7..5a03c2ba 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_toggle_sponsored_messages_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_toggle_sponsored_messages_gen.go @@ -32,10 +32,17 @@ var ( ) // AccountToggleSponsoredMessagesRequest represents TL type `account.toggleSponsoredMessages#b9d9a38d`. +// Disable or re-enable Telegram ads for the current Premium¹ account. +// Useful for business owners that may want to launch and view their own Telegram ads via +// the Telegram ad platform »¹. +// +// Links: +// 1. https://core.telegram.org/api/premium +// 2. https://ads.telegram.org // // See https://core.telegram.org/method/account.toggleSponsoredMessages for reference. type AccountToggleSponsoredMessagesRequest struct { - // Enabled field of AccountToggleSponsoredMessagesRequest. + // Enable or disable ads. Enabled bool } @@ -161,6 +168,13 @@ func (t *AccountToggleSponsoredMessagesRequest) GetEnabled() (value bool) { } // AccountToggleSponsoredMessages invokes method account.toggleSponsoredMessages#b9d9a38d returning error if any. +// Disable or re-enable Telegram ads for the current Premium¹ account. +// Useful for business owners that may want to launch and view their own Telegram ads via +// the Telegram ad platform »¹. +// +// Links: +// 1. https://core.telegram.org/api/premium +// 2. https://ads.telegram.org // // See https://core.telegram.org/method/account.toggleSponsoredMessages for reference. func (c *Client) AccountToggleSponsoredMessages(ctx context.Context, enabled bool) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_toggle_username_gen.go b/vendor/github.com/gotd/td/tg/tl_account_toggle_username_gen.go index e8f2dfc9..0514e634 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_toggle_username_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_toggle_username_gen.go @@ -203,6 +203,7 @@ func (t *AccountToggleUsernameRequest) GetActive() (value bool) { // // 400 USERNAMES_ACTIVE_TOO_MUCH: The maximum number of active usernames was reached. // 400 USERNAME_INVALID: The provided username is not valid. +// 400 USERNAME_NOT_MODIFIED: The username was not modified. // // See https://core.telegram.org/method/account.toggleUsername for reference. func (c *Client) AccountToggleUsername(ctx context.Context, request *AccountToggleUsernameRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_update_birthday_gen.go b/vendor/github.com/gotd/td/tg/tl_account_update_birthday_gen.go index 43c7a543..0d355dfd 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_update_birthday_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_update_birthday_gen.go @@ -32,12 +32,19 @@ var ( ) // AccountUpdateBirthdayRequest represents TL type `account.updateBirthday#cc6e0c11`. +// Update our birthday, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/profile#birthday // // See https://core.telegram.org/method/account.updateBirthday for reference. type AccountUpdateBirthdayRequest struct { - // Flags field of AccountUpdateBirthdayRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Birthday field of AccountUpdateBirthdayRequest. + // Birthday. // // Use SetBirthday and GetBirthday helpers. Birthday Birthday @@ -200,6 +207,14 @@ func (u *AccountUpdateBirthdayRequest) GetBirthday() (value Birthday, ok bool) { } // AccountUpdateBirthday invokes method account.updateBirthday#cc6e0c11 returning error if any. +// Update our birthday, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/profile#birthday +// +// Possible errors: +// +// 400 BIRTHDAY_INVALID: An invalid age was specified, must be between 0 and 150 years. // // See https://core.telegram.org/method/account.updateBirthday for reference. func (c *Client) AccountUpdateBirthday(ctx context.Context, request *AccountUpdateBirthdayRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_update_business_away_message_gen.go b/vendor/github.com/gotd/td/tg/tl_account_update_business_away_message_gen.go index 0ffe8f71..f5dd1646 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_update_business_away_message_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_update_business_away_message_gen.go @@ -32,12 +32,19 @@ var ( ) // AccountUpdateBusinessAwayMessageRequest represents TL type `account.updateBusinessAwayMessage#a26a7fa5`. +// Set a list of Telegram Business away messages¹. +// +// Links: +// 1. https://core.telegram.org/api/business#away-messages // // See https://core.telegram.org/method/account.updateBusinessAwayMessage for reference. type AccountUpdateBusinessAwayMessageRequest struct { - // Flags field of AccountUpdateBusinessAwayMessageRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Message field of AccountUpdateBusinessAwayMessageRequest. + // Away message configuration and contents. // // Use SetMessage and GetMessage helpers. Message InputBusinessAwayMessage @@ -200,6 +207,10 @@ func (u *AccountUpdateBusinessAwayMessageRequest) GetMessage() (value InputBusin } // AccountUpdateBusinessAwayMessage invokes method account.updateBusinessAwayMessage#a26a7fa5 returning error if any. +// Set a list of Telegram Business away messages¹. +// +// Links: +// 1. https://core.telegram.org/api/business#away-messages // // See https://core.telegram.org/method/account.updateBusinessAwayMessage for reference. func (c *Client) AccountUpdateBusinessAwayMessage(ctx context.Context, request *AccountUpdateBusinessAwayMessageRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_update_business_greeting_message_gen.go b/vendor/github.com/gotd/td/tg/tl_account_update_business_greeting_message_gen.go index 8ef99cb5..5f194f21 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_update_business_greeting_message_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_update_business_greeting_message_gen.go @@ -32,12 +32,19 @@ var ( ) // AccountUpdateBusinessGreetingMessageRequest represents TL type `account.updateBusinessGreetingMessage#66cdafc4`. +// Set a list of Telegram Business greeting messages¹. +// +// Links: +// 1. https://core.telegram.org/api/business#greeting-messages // // See https://core.telegram.org/method/account.updateBusinessGreetingMessage for reference. type AccountUpdateBusinessGreetingMessageRequest struct { - // Flags field of AccountUpdateBusinessGreetingMessageRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Message field of AccountUpdateBusinessGreetingMessageRequest. + // Greeting message configuration and contents. // // Use SetMessage and GetMessage helpers. Message InputBusinessGreetingMessage @@ -200,6 +207,10 @@ func (u *AccountUpdateBusinessGreetingMessageRequest) GetMessage() (value InputB } // AccountUpdateBusinessGreetingMessage invokes method account.updateBusinessGreetingMessage#66cdafc4 returning error if any. +// Set a list of Telegram Business greeting messages¹. +// +// Links: +// 1. https://core.telegram.org/api/business#greeting-messages // // See https://core.telegram.org/method/account.updateBusinessGreetingMessage for reference. func (c *Client) AccountUpdateBusinessGreetingMessage(ctx context.Context, request *AccountUpdateBusinessGreetingMessageRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_update_business_intro_gen.go b/vendor/github.com/gotd/td/tg/tl_account_update_business_intro_gen.go index 67eb6b77..a6a33986 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_update_business_intro_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_update_business_intro_gen.go @@ -32,12 +32,19 @@ var ( ) // AccountUpdateBusinessIntroRequest represents TL type `account.updateBusinessIntro#a614d034`. +// Set or remove the Telegram Business introduction »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#business-introduction // // See https://core.telegram.org/method/account.updateBusinessIntro for reference. type AccountUpdateBusinessIntroRequest struct { - // Flags field of AccountUpdateBusinessIntroRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Intro field of AccountUpdateBusinessIntroRequest. + // Telegram Business introduction, to remove it call the method without setting this flag. // // Use SetIntro and GetIntro helpers. Intro InputBusinessIntro @@ -200,6 +207,10 @@ func (u *AccountUpdateBusinessIntroRequest) GetIntro() (value InputBusinessIntro } // AccountUpdateBusinessIntro invokes method account.updateBusinessIntro#a614d034 returning error if any. +// Set or remove the Telegram Business introduction »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#business-introduction // // See https://core.telegram.org/method/account.updateBusinessIntro for reference. func (c *Client) AccountUpdateBusinessIntro(ctx context.Context, request *AccountUpdateBusinessIntroRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_update_business_location_gen.go b/vendor/github.com/gotd/td/tg/tl_account_update_business_location_gen.go index 2de177c9..a765048b 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_update_business_location_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_update_business_location_gen.go @@ -32,16 +32,28 @@ var ( ) // AccountUpdateBusinessLocationRequest represents TL type `account.updateBusinessLocation#9e6b131a`. +// Businesses »¹ may advertise their location using this method, see here »² for more +// info. +// To remove business location information invoke the method without setting any of the +// parameters. +// +// Links: +// 1. https://core.telegram.org/api/business#location +// 2. https://core.telegram.org/api/business#location // // See https://core.telegram.org/method/account.updateBusinessLocation for reference. type AccountUpdateBusinessLocationRequest struct { - // Flags field of AccountUpdateBusinessLocationRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // GeoPoint field of AccountUpdateBusinessLocationRequest. + // Optional, contains a set of geographical coordinates. // // Use SetGeoPoint and GetGeoPoint helpers. GeoPoint InputGeoPointClass - // Address field of AccountUpdateBusinessLocationRequest. + // Mandatory when setting/updating the location, contains a textual description of the + // address (max 96 UTF-8 chars). // // Use SetAddress and GetAddress helpers. Address string @@ -262,6 +274,14 @@ func (u *AccountUpdateBusinessLocationRequest) GetGeoPointAsNotEmpty() (*InputGe } // AccountUpdateBusinessLocation invokes method account.updateBusinessLocation#9e6b131a returning error if any. +// Businesses »¹ may advertise their location using this method, see here »² for more +// info. +// To remove business location information invoke the method without setting any of the +// parameters. +// +// Links: +// 1. https://core.telegram.org/api/business#location +// 2. https://core.telegram.org/api/business#location // // See https://core.telegram.org/method/account.updateBusinessLocation for reference. func (c *Client) AccountUpdateBusinessLocation(ctx context.Context, request *AccountUpdateBusinessLocationRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_update_business_work_hours_gen.go b/vendor/github.com/gotd/td/tg/tl_account_update_business_work_hours_gen.go index d0d36ce4..ce6a2e6e 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_update_business_work_hours_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_update_business_work_hours_gen.go @@ -32,12 +32,26 @@ var ( ) // AccountUpdateBusinessWorkHoursRequest represents TL type `account.updateBusinessWorkHours#4b00e066`. +// Specify a set of Telegram Business opening hours¹. +// This info will be contained in userFull².business_work_hours. +// To remove all opening hours, invoke the method without setting the business_work_hours +// field. +// Note that the opening hours specified by the user must be appropriately validated and +// transformed before invoking the method, as specified here »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#opening-hours +// 2. https://core.telegram.org/constructor/userFull +// 3. https://core.telegram.org/api/business#opening-hours // // See https://core.telegram.org/method/account.updateBusinessWorkHours for reference. type AccountUpdateBusinessWorkHoursRequest struct { - // Flags field of AccountUpdateBusinessWorkHoursRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // BusinessWorkHours field of AccountUpdateBusinessWorkHoursRequest. + // Opening hours (optional, if not set removes all opening hours). // // Use SetBusinessWorkHours and GetBusinessWorkHours helpers. BusinessWorkHours BusinessWorkHours @@ -200,6 +214,23 @@ func (u *AccountUpdateBusinessWorkHoursRequest) GetBusinessWorkHours() (value Bu } // AccountUpdateBusinessWorkHours invokes method account.updateBusinessWorkHours#4b00e066 returning error if any. +// Specify a set of Telegram Business opening hours¹. +// This info will be contained in userFull².business_work_hours. +// To remove all opening hours, invoke the method without setting the business_work_hours +// field. +// Note that the opening hours specified by the user must be appropriately validated and +// transformed before invoking the method, as specified here »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#opening-hours +// 2. https://core.telegram.org/constructor/userFull +// 3. https://core.telegram.org/api/business#opening-hours +// +// Possible errors: +// +// 400 BUSINESS_WORK_HOURS_EMPTY: No work hours were specified. +// 400 BUSINESS_WORK_HOURS_PERIOD_INVALID: The specified work hours are invalid, see here » for the exact requirements. +// 400 TIMEZONE_INVALID: The specified timezone does not exist. // // See https://core.telegram.org/method/account.updateBusinessWorkHours for reference. func (c *Client) AccountUpdateBusinessWorkHours(ctx context.Context, request *AccountUpdateBusinessWorkHoursRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_update_color_gen.go b/vendor/github.com/gotd/td/tg/tl_account_update_color_gen.go index 80e6679e..ec4f2f4d 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_update_color_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_update_color_gen.go @@ -303,6 +303,7 @@ func (u *AccountUpdateColorRequest) GetBackgroundEmojiID() (value int64, ok bool // Possible errors: // // 400 COLOR_INVALID: The specified color palette ID was invalid. +// 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. // // See https://core.telegram.org/method/account.updateColor for reference. func (c *Client) AccountUpdateColor(ctx context.Context, request *AccountUpdateColorRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_update_connected_bot_gen.go b/vendor/github.com/gotd/td/tg/tl_account_update_connected_bot_gen.go index 5d4ab9d1..2814e6ac 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_update_connected_bot_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_update_connected_bot_gen.go @@ -32,18 +32,30 @@ var ( ) // AccountUpdateConnectedBotRequest represents TL type `account.updateConnectedBot#43d8521d`. +// Connect a business bot »¹ to the current account, or to change the current +// connection settings. +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots // // See https://core.telegram.org/method/account.updateConnectedBot for reference. type AccountUpdateConnectedBotRequest struct { - // Flags field of AccountUpdateConnectedBotRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // CanReply field of AccountUpdateConnectedBotRequest. + // Whether the bot can reply to messages it receives from us, on behalf of us using the + // business connection¹. + // + // Links: + // 1) https://core.telegram.org/api/business#connected-bots CanReply bool - // Deleted field of AccountUpdateConnectedBotRequest. + // Whether to fully disconnect the bot from the current account. Deleted bool - // Bot field of AccountUpdateConnectedBotRequest. + // The bot to connect or disconnect Bot InputUserClass - // Recipients field of AccountUpdateConnectedBotRequest. + // Configuration for the business connection Recipients InputBusinessBotRecipients } @@ -281,6 +293,17 @@ func (u *AccountUpdateConnectedBotRequest) GetRecipients() (value InputBusinessB } // AccountUpdateConnectedBot invokes method account.updateConnectedBot#43d8521d returning error if any. +// Connect a business bot »¹ to the current account, or to change the current +// connection settings. +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots +// +// Possible errors: +// +// 400 BOT_BUSINESS_MISSING: The specified bot is not a business bot (the user.bot_business flag is not set). +// 400 BUSINESS_RECIPIENTS_EMPTY: You didn't set any flag in inputBusinessBotRecipients, thus the bot cannot work with any peer. +// 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. // // See https://core.telegram.org/method/account.updateConnectedBot for reference. func (c *Client) AccountUpdateConnectedBot(ctx context.Context, request *AccountUpdateConnectedBotRequest) (UpdatesClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_update_personal_channel_gen.go b/vendor/github.com/gotd/td/tg/tl_account_update_personal_channel_gen.go index b8a303a3..51d7135b 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_update_personal_channel_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_update_personal_channel_gen.go @@ -32,10 +32,21 @@ var ( ) // AccountUpdatePersonalChannelRequest represents TL type `account.updatePersonalChannel#d94305e0`. +// Associate (or remove) a personal channel »¹, that will be listed on our personal +// profile page »². +// Changing it will emit an updateUser¹ update. +// +// Links: +// 1. https://core.telegram.org/api/channel +// 2. https://core.telegram.org/api/profile#personal-channel +// 3. https://core.telegram.org/constructor/updateUser // // See https://core.telegram.org/method/account.updatePersonalChannel for reference. type AccountUpdatePersonalChannelRequest struct { - // Channel field of AccountUpdatePersonalChannelRequest. + // The channel, pass inputChannelEmpty¹ to remove it. + // + // Links: + // 1) https://core.telegram.org/constructor/inputChannelEmpty Channel InputChannelClass } @@ -171,6 +182,14 @@ func (u *AccountUpdatePersonalChannelRequest) GetChannelAsNotEmpty() (NotEmptyIn } // AccountUpdatePersonalChannel invokes method account.updatePersonalChannel#d94305e0 returning error if any. +// Associate (or remove) a personal channel »¹, that will be listed on our personal +// profile page »². +// Changing it will emit an updateUser¹ update. +// +// Links: +// 1. https://core.telegram.org/api/channel +// 2. https://core.telegram.org/api/profile#personal-channel +// 3. https://core.telegram.org/constructor/updateUser // // See https://core.telegram.org/method/account.updatePersonalChannel for reference. func (c *Client) AccountUpdatePersonalChannel(ctx context.Context, channel InputChannelClass) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_upload_ringtone_gen.go b/vendor/github.com/gotd/td/tg/tl_account_upload_ringtone_gen.go index 78f13e4e..a45b0488 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_upload_ringtone_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_upload_ringtone_gen.go @@ -231,6 +231,10 @@ func (u *AccountUploadRingtoneRequest) GetMimeType() (value string) { // Links: // 1. https://core.telegram.org/method/account.saveRingtone // +// Possible errors: +// +// 400 RINGTONE_MIME_INVALID: The MIME type for the ringtone is invalid. +// // See https://core.telegram.org/method/account.uploadRingtone for reference. func (c *Client) AccountUploadRingtone(ctx context.Context, request *AccountUploadRingtoneRequest) (DocumentClass, error) { var result DocumentBox diff --git a/vendor/github.com/gotd/td/tg/tl_account_upload_theme_gen.go b/vendor/github.com/gotd/td/tg/tl_account_upload_theme_gen.go index 9151ed79..101e6814 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_upload_theme_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_upload_theme_gen.go @@ -304,6 +304,7 @@ func (u *AccountUploadThemeRequest) GetMimeType() (value string) { // Possible errors: // // 400 THEME_FILE_INVALID: Invalid theme file provided. +// 400 THEME_MIME_INVALID: The theme's MIME type is invalid. // // See https://core.telegram.org/method/account.uploadTheme for reference. func (c *Client) AccountUploadTheme(ctx context.Context, request *AccountUploadThemeRequest) (DocumentClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_verify_email_gen.go b/vendor/github.com/gotd/td/tg/tl_account_verify_email_gen.go index db187fba..cc633734 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_verify_email_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_verify_email_gen.go @@ -204,7 +204,9 @@ func (v *AccountVerifyEmailRequest) GetVerification() (value EmailVerificationCl // Possible errors: // // 400 EMAIL_INVALID: The specified email is invalid. +// 400 EMAIL_NOT_ALLOWED: The specified email cannot be used to complete the operation. // 400 EMAIL_VERIFY_EXPIRED: The verification email has expired. +// 400 PHONE_NUMBER_INVALID: The phone number is invalid. // // See https://core.telegram.org/method/account.verifyEmail for reference. func (c *Client) AccountVerifyEmail(ctx context.Context, request *AccountVerifyEmailRequest) (AccountEmailVerifiedClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_account_wall_papers_gen.go b/vendor/github.com/gotd/td/tg/tl_account_wall_papers_gen.go index 743ce333..6aad68af 100644 --- a/vendor/github.com/gotd/td/tg/tl_account_wall_papers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_account_wall_papers_gen.go @@ -144,7 +144,7 @@ func (w *AccountWallPapersNotModified) DecodeBare(b *bin.Buffer) error { // // See https://core.telegram.org/constructor/account.wallPapers for reference. type AccountWallPapers struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_app_web_view_result_url_gen.go b/vendor/github.com/gotd/td/tg/tl_app_web_view_result_url_gen.go deleted file mode 100644 index e7be6cb6..00000000 --- a/vendor/github.com/gotd/td/tg/tl_app_web_view_result_url_gen.go +++ /dev/null @@ -1,165 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tg - -import ( - "context" - "errors" - "fmt" - "sort" - "strings" - - "go.uber.org/multierr" - - "github.com/gotd/td/bin" - "github.com/gotd/td/tdjson" - "github.com/gotd/td/tdp" - "github.com/gotd/td/tgerr" -) - -// No-op definition for keeping imports. -var ( - _ = bin.Buffer{} - _ = context.Background() - _ = fmt.Stringer(nil) - _ = strings.Builder{} - _ = errors.Is - _ = multierr.AppendInto - _ = sort.Ints - _ = tdp.Format - _ = tgerr.Error{} - _ = tdjson.Encoder{} -) - -// AppWebViewResultURL represents TL type `appWebViewResultUrl#3c1b4f0d`. -// Contains the link that must be used to open a direct link Mini App¹. -// -// Links: -// 1. https://core.telegram.org/api/bots/webapps#direct-link-mini-apps -// -// See https://core.telegram.org/constructor/appWebViewResultUrl for reference. -type AppWebViewResultURL struct { - // The URL to open - URL string -} - -// AppWebViewResultURLTypeID is TL type id of AppWebViewResultURL. -const AppWebViewResultURLTypeID = 0x3c1b4f0d - -// Ensuring interfaces in compile-time for AppWebViewResultURL. -var ( - _ bin.Encoder = &AppWebViewResultURL{} - _ bin.Decoder = &AppWebViewResultURL{} - _ bin.BareEncoder = &AppWebViewResultURL{} - _ bin.BareDecoder = &AppWebViewResultURL{} -) - -func (a *AppWebViewResultURL) Zero() bool { - if a == nil { - return true - } - if !(a.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AppWebViewResultURL) String() string { - if a == nil { - return "AppWebViewResultURL(nil)" - } - type Alias AppWebViewResultURL - return fmt.Sprintf("AppWebViewResultURL%+v", Alias(*a)) -} - -// FillFrom fills AppWebViewResultURL from given interface. -func (a *AppWebViewResultURL) FillFrom(from interface { - GetURL() (value string) -}) { - a.URL = from.GetURL() -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AppWebViewResultURL) TypeID() uint32 { - return AppWebViewResultURLTypeID -} - -// TypeName returns name of type in TL schema. -func (*AppWebViewResultURL) TypeName() string { - return "appWebViewResultUrl" -} - -// TypeInfo returns info about TL type. -func (a *AppWebViewResultURL) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "appWebViewResultUrl", - ID: AppWebViewResultURLTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AppWebViewResultURL) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode appWebViewResultUrl#3c1b4f0d as nil") - } - b.PutID(AppWebViewResultURLTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AppWebViewResultURL) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode appWebViewResultUrl#3c1b4f0d as nil") - } - b.PutString(a.URL) - return nil -} - -// Decode implements bin.Decoder. -func (a *AppWebViewResultURL) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode appWebViewResultUrl#3c1b4f0d to nil") - } - if err := b.ConsumeID(AppWebViewResultURLTypeID); err != nil { - return fmt.Errorf("unable to decode appWebViewResultUrl#3c1b4f0d: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AppWebViewResultURL) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode appWebViewResultUrl#3c1b4f0d to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode appWebViewResultUrl#3c1b4f0d: field url: %w", err) - } - a.URL = value - } - return nil -} - -// GetURL returns value of URL field. -func (a *AppWebViewResultURL) GetURL() (value string) { - if a == nil { - return - } - return a.URL -} diff --git a/vendor/github.com/gotd/td/tg/tl_attach_menu_bots_gen.go b/vendor/github.com/gotd/td/tg/tl_attach_menu_bots_gen.go index 033e2521..aab91290 100644 --- a/vendor/github.com/gotd/td/tg/tl_attach_menu_bots_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_attach_menu_bots_gen.go @@ -141,7 +141,7 @@ func (a *AttachMenuBotsNotModified) DecodeBare(b *bin.Buffer) error { // // See https://core.telegram.org/constructor/attachMenuBots for reference. type AttachMenuBots struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_auth_check_recovery_password_gen.go b/vendor/github.com/gotd/td/tg/tl_auth_check_recovery_password_gen.go index 402e768e..3f025006 100644 --- a/vendor/github.com/gotd/td/tg/tl_auth_check_recovery_password_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_auth_check_recovery_password_gen.go @@ -178,6 +178,7 @@ func (c *AuthCheckRecoveryPasswordRequest) GetCode() (value string) { // // Possible errors: // +// 400 CODE_EMPTY: The provided code is empty. // 400 PASSWORD_RECOVERY_EXPIRED: The recovery code has expired. // // See https://core.telegram.org/method/auth.checkRecoveryPassword for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_auth_report_missing_code_gen.go b/vendor/github.com/gotd/td/tg/tl_auth_report_missing_code_gen.go index 5f8adb3d..76d12d12 100644 --- a/vendor/github.com/gotd/td/tg/tl_auth_report_missing_code_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_auth_report_missing_code_gen.go @@ -32,14 +32,21 @@ var ( ) // AuthReportMissingCodeRequest represents TL type `auth.reportMissingCode#cb9deff6`. +// Official apps only, reports that the SMS authentication code wasn't delivered. // // See https://core.telegram.org/method/auth.reportMissingCode for reference. type AuthReportMissingCodeRequest struct { - // PhoneNumber field of AuthReportMissingCodeRequest. + // Phone number where we were supposed to receive the code PhoneNumber string - // PhoneCodeHash field of AuthReportMissingCodeRequest. + // The phone code hash obtained from auth.sendCode¹ + // + // Links: + // 1) https://core.telegram.org/method/auth.sendCode PhoneCodeHash string - // Mnc field of AuthReportMissingCodeRequest. + // MNC¹ of the current network operator. + // + // Links: + // 1) https://en.wikipedia.org/wiki/Mobile_country_code Mnc string } @@ -215,6 +222,11 @@ func (r *AuthReportMissingCodeRequest) GetMnc() (value string) { } // AuthReportMissingCode invokes method auth.reportMissingCode#cb9deff6 returning error if any. +// Official apps only, reports that the SMS authentication code wasn't delivered. +// +// Possible errors: +// +// 400 PHONE_NUMBER_INVALID: The phone number is invalid. // // See https://core.telegram.org/method/auth.reportMissingCode for reference. func (c *Client) AuthReportMissingCode(ctx context.Context, request *AuthReportMissingCodeRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_auth_request_firebase_sms_gen.go b/vendor/github.com/gotd/td/tg/tl_auth_request_firebase_sms_gen.go index d8ab02fb..62083d7f 100644 --- a/vendor/github.com/gotd/td/tg/tl_auth_request_firebase_sms_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_auth_request_firebase_sms_gen.go @@ -55,7 +55,10 @@ type AuthRequestFirebaseSMSRequest struct { // // Use SetSafetyNetToken and GetSafetyNetToken helpers. SafetyNetToken string - // PlayIntegrityToken field of AuthRequestFirebaseSMSRequest. + // On Android, an object obtained as described in the auth documentation »¹ + // + // Links: + // 1) https://core.telegram.org/api/auth // // Use SetPlayIntegrityToken and GetPlayIntegrityToken helpers. PlayIntegrityToken string @@ -364,6 +367,7 @@ func (r *AuthRequestFirebaseSMSRequest) GetIosPushSecret() (value string, ok boo // // Possible errors: // +// 400 PHONE_CODE_EMPTY: phone_code is missing. // 400 PHONE_NUMBER_INVALID: The phone number is invalid. // // See https://core.telegram.org/method/auth.requestFirebaseSms for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_auth_resend_code_gen.go b/vendor/github.com/gotd/td/tg/tl_auth_resend_code_gen.go index ceeb2619..6f63dd91 100644 --- a/vendor/github.com/gotd/td/tg/tl_auth_resend_code_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_auth_resend_code_gen.go @@ -40,7 +40,10 @@ var ( // // See https://core.telegram.org/method/auth.resendCode for reference. type AuthResendCodeRequest struct { - // Flags field of AuthResendCodeRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // The phone number PhoneNumber string @@ -49,7 +52,12 @@ type AuthResendCodeRequest struct { // Links: // 1) https://core.telegram.org/method/auth.sendCode PhoneCodeHash string - // Reason field of AuthResendCodeRequest. + // Official clients only, used if the device integrity verification failed, and no secret + // could be obtained to invoke auth.requestFirebaseSms¹: in this case, the device + // integrity verification failure reason must be passed here. + // + // Links: + // 1) https://core.telegram.org/method/auth.requestFirebaseSms // // Use SetReason and GetReason helpers. Reason string diff --git a/vendor/github.com/gotd/td/tg/tl_auth_send_code_gen.go b/vendor/github.com/gotd/td/tg/tl_auth_send_code_gen.go index 33bbf012..3c1a6ded 100644 --- a/vendor/github.com/gotd/td/tg/tl_auth_send_code_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_auth_send_code_gen.go @@ -263,6 +263,7 @@ func (s *AuthSendCodeRequest) GetSettings() (value CodeSettings) { // 406 PHONE_PASSWORD_FLOOD: You have tried logging in too many times. // 400 PHONE_PASSWORD_PROTECTED: This phone is password protected. // 400 SMS_CODE_CREATE_FAILED: An error occurred while creating the SMS code. +// 406 UPDATE_APP_TO_LOGIN: Please update to the latest version of MadelineProto to login. // // See https://core.telegram.org/method/auth.sendCode for reference. func (c *Client) AuthSendCode(ctx context.Context, request *AuthSendCodeRequest) (AuthSentCodeClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_auth_sent_code_type_gen.go b/vendor/github.com/gotd/td/tg/tl_auth_sent_code_type_gen.go index 3568c700..ad9b6fa1 100644 --- a/vendor/github.com/gotd/td/tg/tl_auth_sent_code_type_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_auth_sent_code_type_gen.go @@ -1473,7 +1473,7 @@ func (s *AuthSentCodeTypeFragmentSMS) GetLength() (value int) { return s.Length } -// AuthSentCodeTypeFirebaseSMS represents TL type `auth.sentCodeTypeFirebaseSms#13c90f17`. +// AuthSentCodeTypeFirebaseSMS represents TL type `auth.sentCodeTypeFirebaseSms#9fd736`. // An authentication code should be delivered via SMS after Firebase attestation, as // described in the auth documentation »¹. // @@ -1494,7 +1494,11 @@ type AuthSentCodeTypeFirebaseSMS struct { // // Use SetNonce and GetNonce helpers. Nonce []byte - // PlayIntegrityNonce field of AuthSentCodeTypeFirebaseSMS. + // Google Play Integrity project ID + // + // Use SetPlayIntegrityProjectID and GetPlayIntegrityProjectID helpers. + PlayIntegrityProjectID int64 + // Play Integrity API nonce // // Use SetPlayIntegrityNonce and GetPlayIntegrityNonce helpers. PlayIntegrityNonce []byte @@ -1517,7 +1521,7 @@ type AuthSentCodeTypeFirebaseSMS struct { } // AuthSentCodeTypeFirebaseSMSTypeID is TL type id of AuthSentCodeTypeFirebaseSMS. -const AuthSentCodeTypeFirebaseSMSTypeID = 0x13c90f17 +const AuthSentCodeTypeFirebaseSMSTypeID = 0x9fd736 // construct implements constructor of AuthSentCodeTypeClass. func (s AuthSentCodeTypeFirebaseSMS) construct() AuthSentCodeTypeClass { return &s } @@ -1542,6 +1546,9 @@ func (s *AuthSentCodeTypeFirebaseSMS) Zero() bool { if !(s.Nonce == nil) { return false } + if !(s.PlayIntegrityProjectID == 0) { + return false + } if !(s.PlayIntegrityNonce == nil) { return false } @@ -1570,6 +1577,7 @@ func (s *AuthSentCodeTypeFirebaseSMS) String() string { // FillFrom fills AuthSentCodeTypeFirebaseSMS from given interface. func (s *AuthSentCodeTypeFirebaseSMS) FillFrom(from interface { GetNonce() (value []byte, ok bool) + GetPlayIntegrityProjectID() (value int64, ok bool) GetPlayIntegrityNonce() (value []byte, ok bool) GetReceipt() (value string, ok bool) GetPushTimeout() (value int, ok bool) @@ -1579,6 +1587,10 @@ func (s *AuthSentCodeTypeFirebaseSMS) FillFrom(from interface { s.Nonce = val } + if val, ok := from.GetPlayIntegrityProjectID(); ok { + s.PlayIntegrityProjectID = val + } + if val, ok := from.GetPlayIntegrityNonce(); ok { s.PlayIntegrityNonce = val } @@ -1622,6 +1634,11 @@ func (s *AuthSentCodeTypeFirebaseSMS) TypeInfo() tdp.Type { SchemaName: "nonce", Null: !s.Flags.Has(0), }, + { + Name: "PlayIntegrityProjectID", + SchemaName: "play_integrity_project_id", + Null: !s.Flags.Has(2), + }, { Name: "PlayIntegrityNonce", SchemaName: "play_integrity_nonce", @@ -1650,6 +1667,9 @@ func (s *AuthSentCodeTypeFirebaseSMS) SetFlags() { if !(s.Nonce == nil) { s.Flags.Set(0) } + if !(s.PlayIntegrityProjectID == 0) { + s.Flags.Set(2) + } if !(s.PlayIntegrityNonce == nil) { s.Flags.Set(2) } @@ -1664,7 +1684,7 @@ func (s *AuthSentCodeTypeFirebaseSMS) SetFlags() { // Encode implements bin.Encoder. func (s *AuthSentCodeTypeFirebaseSMS) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode auth.sentCodeTypeFirebaseSms#13c90f17 as nil") + return fmt.Errorf("can't encode auth.sentCodeTypeFirebaseSms#9fd736 as nil") } b.PutID(AuthSentCodeTypeFirebaseSMSTypeID) return s.EncodeBare(b) @@ -1673,15 +1693,18 @@ func (s *AuthSentCodeTypeFirebaseSMS) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *AuthSentCodeTypeFirebaseSMS) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode auth.sentCodeTypeFirebaseSms#13c90f17 as nil") + return fmt.Errorf("can't encode auth.sentCodeTypeFirebaseSms#9fd736 as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode auth.sentCodeTypeFirebaseSms#13c90f17: field flags: %w", err) + return fmt.Errorf("unable to encode auth.sentCodeTypeFirebaseSms#9fd736: field flags: %w", err) } if s.Flags.Has(0) { b.PutBytes(s.Nonce) } + if s.Flags.Has(2) { + b.PutLong(s.PlayIntegrityProjectID) + } if s.Flags.Has(2) { b.PutBytes(s.PlayIntegrityNonce) } @@ -1698,10 +1721,10 @@ func (s *AuthSentCodeTypeFirebaseSMS) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *AuthSentCodeTypeFirebaseSMS) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode auth.sentCodeTypeFirebaseSms#13c90f17 to nil") + return fmt.Errorf("can't decode auth.sentCodeTypeFirebaseSms#9fd736 to nil") } if err := b.ConsumeID(AuthSentCodeTypeFirebaseSMSTypeID); err != nil { - return fmt.Errorf("unable to decode auth.sentCodeTypeFirebaseSms#13c90f17: %w", err) + return fmt.Errorf("unable to decode auth.sentCodeTypeFirebaseSms#9fd736: %w", err) } return s.DecodeBare(b) } @@ -1709,45 +1732,52 @@ func (s *AuthSentCodeTypeFirebaseSMS) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *AuthSentCodeTypeFirebaseSMS) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode auth.sentCodeTypeFirebaseSms#13c90f17 to nil") + return fmt.Errorf("can't decode auth.sentCodeTypeFirebaseSms#9fd736 to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode auth.sentCodeTypeFirebaseSms#13c90f17: field flags: %w", err) + return fmt.Errorf("unable to decode auth.sentCodeTypeFirebaseSms#9fd736: field flags: %w", err) } } if s.Flags.Has(0) { value, err := b.Bytes() if err != nil { - return fmt.Errorf("unable to decode auth.sentCodeTypeFirebaseSms#13c90f17: field nonce: %w", err) + return fmt.Errorf("unable to decode auth.sentCodeTypeFirebaseSms#9fd736: field nonce: %w", err) } s.Nonce = value } + if s.Flags.Has(2) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode auth.sentCodeTypeFirebaseSms#9fd736: field play_integrity_project_id: %w", err) + } + s.PlayIntegrityProjectID = value + } if s.Flags.Has(2) { value, err := b.Bytes() if err != nil { - return fmt.Errorf("unable to decode auth.sentCodeTypeFirebaseSms#13c90f17: field play_integrity_nonce: %w", err) + return fmt.Errorf("unable to decode auth.sentCodeTypeFirebaseSms#9fd736: field play_integrity_nonce: %w", err) } s.PlayIntegrityNonce = value } if s.Flags.Has(1) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode auth.sentCodeTypeFirebaseSms#13c90f17: field receipt: %w", err) + return fmt.Errorf("unable to decode auth.sentCodeTypeFirebaseSms#9fd736: field receipt: %w", err) } s.Receipt = value } if s.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode auth.sentCodeTypeFirebaseSms#13c90f17: field push_timeout: %w", err) + return fmt.Errorf("unable to decode auth.sentCodeTypeFirebaseSms#9fd736: field push_timeout: %w", err) } s.PushTimeout = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode auth.sentCodeTypeFirebaseSms#13c90f17: field length: %w", err) + return fmt.Errorf("unable to decode auth.sentCodeTypeFirebaseSms#9fd736: field length: %w", err) } s.Length = value } @@ -1772,6 +1802,24 @@ func (s *AuthSentCodeTypeFirebaseSMS) GetNonce() (value []byte, ok bool) { return s.Nonce, true } +// SetPlayIntegrityProjectID sets value of PlayIntegrityProjectID conditional field. +func (s *AuthSentCodeTypeFirebaseSMS) SetPlayIntegrityProjectID(value int64) { + s.Flags.Set(2) + s.PlayIntegrityProjectID = value +} + +// GetPlayIntegrityProjectID returns value of PlayIntegrityProjectID conditional field and +// boolean which is true if field was set. +func (s *AuthSentCodeTypeFirebaseSMS) GetPlayIntegrityProjectID() (value int64, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(2) { + return value, false + } + return s.PlayIntegrityProjectID, true +} + // SetPlayIntegrityNonce sets value of PlayIntegrityNonce conditional field. func (s *AuthSentCodeTypeFirebaseSMS) SetPlayIntegrityNonce(value []byte) { s.Flags.Set(2) @@ -1835,12 +1883,18 @@ func (s *AuthSentCodeTypeFirebaseSMS) GetLength() (value int) { } // AuthSentCodeTypeSMSWord represents TL type `auth.sentCodeTypeSmsWord#a416ac81`. +// The code was sent via SMS as a secret word, starting with the letter specified in +// beginning // // See https://core.telegram.org/constructor/auth.sentCodeTypeSmsWord for reference. type AuthSentCodeTypeSMSWord struct { - // Flags field of AuthSentCodeTypeSMSWord. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Beginning field of AuthSentCodeTypeSMSWord. + // If set, the secret word in the sent SMS (which may contain multiple words) starts with + // this letter. // // Use SetBeginning and GetBeginning helpers. Beginning string @@ -2008,12 +2062,17 @@ func (s *AuthSentCodeTypeSMSWord) GetBeginning() (value string, ok bool) { } // AuthSentCodeTypeSMSPhrase represents TL type `auth.sentCodeTypeSmsPhrase#b37794af`. +// The code was sent via SMS as a secret phrase starting with the word specified in +// beginning // // See https://core.telegram.org/constructor/auth.sentCodeTypeSmsPhrase for reference. type AuthSentCodeTypeSMSPhrase struct { - // Flags field of AuthSentCodeTypeSMSPhrase. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Beginning field of AuthSentCodeTypeSMSPhrase. + // If set, the secret phrase (and the SMS) starts with this word. // // Use SetBeginning and GetBeginning helpers. Beginning string @@ -2202,7 +2261,7 @@ const AuthSentCodeTypeClassName = "auth.SentCodeType" // case *tg.AuthSentCodeTypeEmailCode: // auth.sentCodeTypeEmailCode#f450f59b // case *tg.AuthSentCodeTypeSetUpEmailRequired: // auth.sentCodeTypeSetUpEmailRequired#a5491dea // case *tg.AuthSentCodeTypeFragmentSMS: // auth.sentCodeTypeFragmentSms#d9565c39 -// case *tg.AuthSentCodeTypeFirebaseSMS: // auth.sentCodeTypeFirebaseSms#13c90f17 +// case *tg.AuthSentCodeTypeFirebaseSMS: // auth.sentCodeTypeFirebaseSms#9fd736 // case *tg.AuthSentCodeTypeSMSWord: // auth.sentCodeTypeSmsWord#a416ac81 // case *tg.AuthSentCodeTypeSMSPhrase: // auth.sentCodeTypeSmsPhrase#b37794af // default: panic(v) @@ -2290,7 +2349,7 @@ func DecodeAuthSentCodeType(buf *bin.Buffer) (AuthSentCodeTypeClass, error) { } return &v, nil case AuthSentCodeTypeFirebaseSMSTypeID: - // Decoding auth.sentCodeTypeFirebaseSms#13c90f17. + // Decoding auth.sentCodeTypeFirebaseSms#9fd736. v := AuthSentCodeTypeFirebaseSMS{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode AuthSentCodeTypeClass: %w", err) diff --git a/vendor/github.com/gotd/td/tg/tl_auth_sign_in_gen.go b/vendor/github.com/gotd/td/tg/tl_auth_sign_in_gen.go index bc06adad..347af940 100644 --- a/vendor/github.com/gotd/td/tg/tl_auth_sign_in_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_auth_sign_in_gen.go @@ -325,6 +325,7 @@ func (s *AuthSignInRequest) GetEmailVerification() (value EmailVerificationClass // 406 PHONE_NUMBER_INVALID: The phone number is invalid. // 400 PHONE_NUMBER_UNOCCUPIED: The phone number is not yet being used. // 500 SIGN_IN_FAILED: Failure while signing in. +// 406 UPDATE_APP_TO_LOGIN: Please update to the latest version of MadelineProto to login. // // See https://core.telegram.org/method/auth.signIn for reference. func (c *Client) AuthSignIn(ctx context.Context, request *AuthSignInRequest) (AuthAuthorizationClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_auth_sign_up_gen.go b/vendor/github.com/gotd/td/tg/tl_auth_sign_up_gen.go index 963b89aa..1f8866d0 100644 --- a/vendor/github.com/gotd/td/tg/tl_auth_sign_up_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_auth_sign_up_gen.go @@ -36,9 +36,13 @@ var ( // // See https://core.telegram.org/method/auth.signUp for reference. type AuthSignUpRequest struct { - // Flags field of AuthSignUpRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // NoJoinedNotifications field of AuthSignUpRequest. + // If set, users on Telegram that have already added phone_number to their contacts will + // not receive signup notifications about this user. NoJoinedNotifications bool // Phone number in the international format PhoneNumber string diff --git a/vendor/github.com/gotd/td/tg/tl_available_effect_gen.go b/vendor/github.com/gotd/td/tg/tl_available_effect_gen.go index 6b20973d..a71b7f4c 100644 --- a/vendor/github.com/gotd/td/tg/tl_available_effect_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_available_effect_gen.go @@ -32,24 +32,54 @@ var ( ) // AvailableEffect represents TL type `availableEffect#93c3e27e`. +// Represents a message effect »¹. +// All long IDs except for id are document¹.ids from the containing messages +// availableEffects² constructor. +// See here »¹ for more info on how to use following fields. +// +// Links: +// 1. https://core.telegram.org/api/effects +// 2. https://core.telegram.org/constructor/document +// 3. https://core.telegram.org/constructor/messages.availableEffects +// 4. https://core.telegram.org/api/effects // // See https://core.telegram.org/constructor/availableEffect for reference. type AvailableEffect struct { - // Flags field of AvailableEffect. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // PremiumRequired field of AvailableEffect. + // Whether a Premium¹ subscription is required to use this effect. + // + // Links: + // 1) https://core.telegram.org/api/premium PremiumRequired bool - // ID field of AvailableEffect. + // Unique effect ID. ID int64 - // Emoticon field of AvailableEffect. + // Emoji corresponding to the effect, to be used as icon for the effect if static_icon_id + // is not set. Emoticon string - // StaticIconID field of AvailableEffect. + // ID of the document containing the static icon (WEBP) of the effect. // // Use SetStaticIconID and GetStaticIconID helpers. StaticIconID int64 - // EffectStickerID field of AvailableEffect. + // Contains the preview animation (TGS format »)¹, used for the effect selection menu. + // + // Links: + // 1) https://core.telegram.org/api/stickers#animated-stickers EffectStickerID int64 - // EffectAnimationID field of AvailableEffect. + // If set, contains the actual animated effect (TGS format »)¹. If not set, the + // animated effect must be set equal to the premium animated sticker effect² associated + // to the animated sticker specified in effect_sticker_id (always different from the + // preview animation, fetched thanks to the videoSize³ of type f as specified here + // »⁴). + // + // Links: + // 1) https://core.telegram.org/api/stickers#animated-stickers + // 2) https://core.telegram.org/api/stickers#premium-animated-sticker-effects + // 3) https://core.telegram.org/constructor/videoSize + // 4) https://core.telegram.org/api/stickers#premium-animated-sticker-effects // // Use SetEffectAnimationID and GetEffectAnimationID helpers. EffectAnimationID int64 diff --git a/vendor/github.com/gotd/td/tg/tl_birthday_gen.go b/vendor/github.com/gotd/td/tg/tl_birthday_gen.go index 9a41b8c1..0d38e73a 100644 --- a/vendor/github.com/gotd/td/tg/tl_birthday_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_birthday_gen.go @@ -32,16 +32,26 @@ var ( ) // Birthday represents TL type `birthday#6c8e1e06`. +// Birthday¹ information for a user. +// Also used to invite users to gift Telegram Premium subscriptions »¹ to other users +// with birthdays within a +1/-1 day time range, related to the current day. +// +// Links: +// 1. https://core.telegram.org/api/profile#birthday +// 2. https://core.telegram.org/api/premium#gifting-telegram-premium // // See https://core.telegram.org/constructor/birthday for reference. type Birthday struct { - // Flags field of Birthday. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Day field of Birthday. + // Birth day Day int - // Month field of Birthday. + // Birth month Month int - // Year field of Birthday. + // (Optional) birth year. // // Use SetYear and GetYear helpers. Year int diff --git a/vendor/github.com/gotd/td/tg/tl_boost_gen.go b/vendor/github.com/gotd/td/tg/tl_boost_gen.go index d7d873a1..acf6b675 100644 --- a/vendor/github.com/gotd/td/tg/tl_boost_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_boost_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// Boost represents TL type `boost#2a1c8c71`. +// Boost represents TL type `boost#4b3e14d6`. // Info about one or more boosts¹ applied by a specific user. // // Links: @@ -44,14 +44,14 @@ type Boost struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Whether this boost was applied because the channel directly gifted a subscription to - // the user¹. + // Whether this boost was applied because the channel/supergroup directly gifted a + // subscription to the user¹. // // Links: // 1) https://core.telegram.org/api/giveaways Gift bool // Whether this boost was applied because the user was chosen in a giveaway started by - // the channel¹. + // the channel/supergroup¹. // // Links: // 1) https://core.telegram.org/api/giveaways @@ -90,10 +90,14 @@ type Boost struct { // // Use SetMultiplier and GetMultiplier helpers. Multiplier int + // Stars field of Boost. + // + // Use SetStars and GetStars helpers. + Stars int64 } // BoostTypeID is TL type id of Boost. -const BoostTypeID = 0x2a1c8c71 +const BoostTypeID = 0x4b3e14d6 // Ensuring interfaces in compile-time for Boost. var ( @@ -140,6 +144,9 @@ func (b *Boost) Zero() bool { if !(b.Multiplier == 0) { return false } + if !(b.Stars == 0) { + return false + } return true } @@ -165,6 +172,7 @@ func (b *Boost) FillFrom(from interface { GetExpires() (value int) GetUsedGiftSlug() (value string, ok bool) GetMultiplier() (value int, ok bool) + GetStars() (value int64, ok bool) }) { b.Gift = from.GetGift() b.Giveaway = from.GetGiveaway() @@ -188,6 +196,10 @@ func (b *Boost) FillFrom(from interface { b.Multiplier = val } + if val, ok := from.GetStars(); ok { + b.Stars = val + } + } // TypeID returns type id in TL schema. @@ -260,6 +272,11 @@ func (b *Boost) TypeInfo() tdp.Type { SchemaName: "multiplier", Null: !b.Flags.Has(5), }, + { + Name: "Stars", + SchemaName: "stars", + Null: !b.Flags.Has(6), + }, } return typ } @@ -287,12 +304,15 @@ func (b *Boost) SetFlags() { if !(b.Multiplier == 0) { b.Flags.Set(5) } + if !(b.Stars == 0) { + b.Flags.Set(6) + } } // Encode implements bin.Encoder. func (b *Boost) Encode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode boost#2a1c8c71 as nil") + return fmt.Errorf("can't encode boost#4b3e14d6 as nil") } buf.PutID(BoostTypeID) return b.EncodeBare(buf) @@ -301,11 +321,11 @@ func (b *Boost) Encode(buf *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (b *Boost) EncodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode boost#2a1c8c71 as nil") + return fmt.Errorf("can't encode boost#4b3e14d6 as nil") } b.SetFlags() if err := b.Flags.Encode(buf); err != nil { - return fmt.Errorf("unable to encode boost#2a1c8c71: field flags: %w", err) + return fmt.Errorf("unable to encode boost#4b3e14d6: field flags: %w", err) } buf.PutString(b.ID) if b.Flags.Has(0) { @@ -322,16 +342,19 @@ func (b *Boost) EncodeBare(buf *bin.Buffer) error { if b.Flags.Has(5) { buf.PutInt(b.Multiplier) } + if b.Flags.Has(6) { + buf.PutLong(b.Stars) + } return nil } // Decode implements bin.Decoder. func (b *Boost) Decode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode boost#2a1c8c71 to nil") + return fmt.Errorf("can't decode boost#4b3e14d6 to nil") } if err := buf.ConsumeID(BoostTypeID); err != nil { - return fmt.Errorf("unable to decode boost#2a1c8c71: %w", err) + return fmt.Errorf("unable to decode boost#4b3e14d6: %w", err) } return b.DecodeBare(buf) } @@ -339,11 +362,11 @@ func (b *Boost) Decode(buf *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (b *Boost) DecodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode boost#2a1c8c71 to nil") + return fmt.Errorf("can't decode boost#4b3e14d6 to nil") } { if err := b.Flags.Decode(buf); err != nil { - return fmt.Errorf("unable to decode boost#2a1c8c71: field flags: %w", err) + return fmt.Errorf("unable to decode boost#4b3e14d6: field flags: %w", err) } } b.Gift = b.Flags.Has(1) @@ -352,52 +375,59 @@ func (b *Boost) DecodeBare(buf *bin.Buffer) error { { value, err := buf.String() if err != nil { - return fmt.Errorf("unable to decode boost#2a1c8c71: field id: %w", err) + return fmt.Errorf("unable to decode boost#4b3e14d6: field id: %w", err) } b.ID = value } if b.Flags.Has(0) { value, err := buf.Long() if err != nil { - return fmt.Errorf("unable to decode boost#2a1c8c71: field user_id: %w", err) + return fmt.Errorf("unable to decode boost#4b3e14d6: field user_id: %w", err) } b.UserID = value } if b.Flags.Has(2) { value, err := buf.Int() if err != nil { - return fmt.Errorf("unable to decode boost#2a1c8c71: field giveaway_msg_id: %w", err) + return fmt.Errorf("unable to decode boost#4b3e14d6: field giveaway_msg_id: %w", err) } b.GiveawayMsgID = value } { value, err := buf.Int() if err != nil { - return fmt.Errorf("unable to decode boost#2a1c8c71: field date: %w", err) + return fmt.Errorf("unable to decode boost#4b3e14d6: field date: %w", err) } b.Date = value } { value, err := buf.Int() if err != nil { - return fmt.Errorf("unable to decode boost#2a1c8c71: field expires: %w", err) + return fmt.Errorf("unable to decode boost#4b3e14d6: field expires: %w", err) } b.Expires = value } if b.Flags.Has(4) { value, err := buf.String() if err != nil { - return fmt.Errorf("unable to decode boost#2a1c8c71: field used_gift_slug: %w", err) + return fmt.Errorf("unable to decode boost#4b3e14d6: field used_gift_slug: %w", err) } b.UsedGiftSlug = value } if b.Flags.Has(5) { value, err := buf.Int() if err != nil { - return fmt.Errorf("unable to decode boost#2a1c8c71: field multiplier: %w", err) + return fmt.Errorf("unable to decode boost#4b3e14d6: field multiplier: %w", err) } b.Multiplier = value } + if b.Flags.Has(6) { + value, err := buf.Long() + if err != nil { + return fmt.Errorf("unable to decode boost#4b3e14d6: field stars: %w", err) + } + b.Stars = value + } return nil } @@ -553,3 +583,21 @@ func (b *Boost) GetMultiplier() (value int, ok bool) { } return b.Multiplier, true } + +// SetStars sets value of Stars conditional field. +func (b *Boost) SetStars(value int64) { + b.Flags.Set(6) + b.Stars = value +} + +// GetStars returns value of Stars conditional field and +// boolean which is true if field was set. +func (b *Boost) GetStars() (value int64, ok bool) { + if b == nil { + return + } + if !b.Flags.Has(6) { + return value, false + } + return b.Stars, true +} diff --git a/vendor/github.com/gotd/td/tg/tl_bot_business_connection_gen.go b/vendor/github.com/gotd/td/tg/tl_bot_business_connection_gen.go index 87710a3f..3c774ef1 100644 --- a/vendor/github.com/gotd/td/tg/tl_bot_business_connection_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_bot_business_connection_gen.go @@ -32,22 +32,39 @@ var ( ) // BotBusinessConnection represents TL type `botBusinessConnection#896433b4`. +// Contains info about a bot business connection¹. +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots // // See https://core.telegram.org/constructor/botBusinessConnection for reference. type BotBusinessConnection struct { - // Flags field of BotBusinessConnection. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // CanReply field of BotBusinessConnection. + // Whether the bot can reply on behalf of the user to messages it receives through the + // business connection CanReply bool - // Disabled field of BotBusinessConnection. + // Whether this business connection is currently disabled Disabled bool - // ConnectionID field of BotBusinessConnection. + // Business connection ID, used to identify messages coming from the connection and to + // reply to them as specified here »¹. + // + // Links: + // 1) https://core.telegram.org/api/business#connected-bots ConnectionID string - // UserID field of BotBusinessConnection. + // ID of the user that the bot is connected to via this connection. UserID int64 - // DCID field of BotBusinessConnection. + // ID of the datacenter where to send queries wrapped in a invokeWithBusinessConnection¹ + // as specified here »². + // + // Links: + // 1) https://core.telegram.org/method/invokeWithBusinessConnection + // 2) https://core.telegram.org/api/business#connected-bots DCID int - // Date field of BotBusinessConnection. + // When was the connection created. Date int } diff --git a/vendor/github.com/gotd/td/tg/tl_bot_info_gen.go b/vendor/github.com/gotd/td/tg/tl_bot_info_gen.go index bbccb9f7..6964aa3b 100644 --- a/vendor/github.com/gotd/td/tg/tl_bot_info_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_bot_info_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// BotInfo represents TL type `botInfo#8f300b57`. +// BotInfo represents TL type `botInfo#82437e74`. // Info about bots (available bot commands, etc) // // See https://core.telegram.org/constructor/botInfo for reference. @@ -41,6 +41,12 @@ type BotInfo struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields + // If set, the bot has some preview medias for the configured Main Mini App, see here + // »¹ for more info on Main Mini App preview medias. + // + // Links: + // 1) https://core.telegram.org/api/bots/webapps#main-mini-app-previews + HasPreviewMedias bool // ID of the bot // // Use SetUserID and GetUserID helpers. @@ -65,10 +71,14 @@ type BotInfo struct { // // Use SetMenuButton and GetMenuButton helpers. MenuButton BotMenuButtonClass + // PrivacyPolicyURL field of BotInfo. + // + // Use SetPrivacyPolicyURL and GetPrivacyPolicyURL helpers. + PrivacyPolicyURL string } // BotInfoTypeID is TL type id of BotInfo. -const BotInfoTypeID = 0x8f300b57 +const BotInfoTypeID = 0x82437e74 // Ensuring interfaces in compile-time for BotInfo. var ( @@ -85,6 +95,9 @@ func (b *BotInfo) Zero() bool { if !(b.Flags.Zero()) { return false } + if !(b.HasPreviewMedias == false) { + return false + } if !(b.UserID == 0) { return false } @@ -103,6 +116,9 @@ func (b *BotInfo) Zero() bool { if !(b.MenuButton == nil) { return false } + if !(b.PrivacyPolicyURL == "") { + return false + } return true } @@ -118,13 +134,16 @@ func (b *BotInfo) String() string { // FillFrom fills BotInfo from given interface. func (b *BotInfo) FillFrom(from interface { + GetHasPreviewMedias() (value bool) GetUserID() (value int64, ok bool) GetDescription() (value string, ok bool) GetDescriptionPhoto() (value PhotoClass, ok bool) GetDescriptionDocument() (value DocumentClass, ok bool) GetCommands() (value []BotCommand, ok bool) GetMenuButton() (value BotMenuButtonClass, ok bool) + GetPrivacyPolicyURL() (value string, ok bool) }) { + b.HasPreviewMedias = from.GetHasPreviewMedias() if val, ok := from.GetUserID(); ok { b.UserID = val } @@ -149,6 +168,10 @@ func (b *BotInfo) FillFrom(from interface { b.MenuButton = val } + if val, ok := from.GetPrivacyPolicyURL(); ok { + b.PrivacyPolicyURL = val + } + } // TypeID returns type id in TL schema. @@ -174,6 +197,11 @@ func (b *BotInfo) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "HasPreviewMedias", + SchemaName: "has_preview_medias", + Null: !b.Flags.Has(6), + }, { Name: "UserID", SchemaName: "user_id", @@ -204,12 +232,20 @@ func (b *BotInfo) TypeInfo() tdp.Type { SchemaName: "menu_button", Null: !b.Flags.Has(3), }, + { + Name: "PrivacyPolicyURL", + SchemaName: "privacy_policy_url", + Null: !b.Flags.Has(7), + }, } return typ } // SetFlags sets flags for non-zero fields. func (b *BotInfo) SetFlags() { + if !(b.HasPreviewMedias == false) { + b.Flags.Set(6) + } if !(b.UserID == 0) { b.Flags.Set(0) } @@ -228,12 +264,15 @@ func (b *BotInfo) SetFlags() { if !(b.MenuButton == nil) { b.Flags.Set(3) } + if !(b.PrivacyPolicyURL == "") { + b.Flags.Set(7) + } } // Encode implements bin.Encoder. func (b *BotInfo) Encode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode botInfo#8f300b57 as nil") + return fmt.Errorf("can't encode botInfo#82437e74 as nil") } buf.PutID(BotInfoTypeID) return b.EncodeBare(buf) @@ -242,11 +281,11 @@ func (b *BotInfo) Encode(buf *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (b *BotInfo) EncodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode botInfo#8f300b57 as nil") + return fmt.Errorf("can't encode botInfo#82437e74 as nil") } b.SetFlags() if err := b.Flags.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#8f300b57: field flags: %w", err) + return fmt.Errorf("unable to encode botInfo#82437e74: field flags: %w", err) } if b.Flags.Has(0) { buf.PutLong(b.UserID) @@ -256,46 +295,49 @@ func (b *BotInfo) EncodeBare(buf *bin.Buffer) error { } if b.Flags.Has(4) { if b.DescriptionPhoto == nil { - return fmt.Errorf("unable to encode botInfo#8f300b57: field description_photo is nil") + return fmt.Errorf("unable to encode botInfo#82437e74: field description_photo is nil") } if err := b.DescriptionPhoto.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#8f300b57: field description_photo: %w", err) + return fmt.Errorf("unable to encode botInfo#82437e74: field description_photo: %w", err) } } if b.Flags.Has(5) { if b.DescriptionDocument == nil { - return fmt.Errorf("unable to encode botInfo#8f300b57: field description_document is nil") + return fmt.Errorf("unable to encode botInfo#82437e74: field description_document is nil") } if err := b.DescriptionDocument.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#8f300b57: field description_document: %w", err) + return fmt.Errorf("unable to encode botInfo#82437e74: field description_document: %w", err) } } if b.Flags.Has(2) { buf.PutVectorHeader(len(b.Commands)) for idx, v := range b.Commands { if err := v.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#8f300b57: field commands element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode botInfo#82437e74: field commands element with index %d: %w", idx, err) } } } if b.Flags.Has(3) { if b.MenuButton == nil { - return fmt.Errorf("unable to encode botInfo#8f300b57: field menu_button is nil") + return fmt.Errorf("unable to encode botInfo#82437e74: field menu_button is nil") } if err := b.MenuButton.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#8f300b57: field menu_button: %w", err) + return fmt.Errorf("unable to encode botInfo#82437e74: field menu_button: %w", err) } } + if b.Flags.Has(7) { + buf.PutString(b.PrivacyPolicyURL) + } return nil } // Decode implements bin.Decoder. func (b *BotInfo) Decode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode botInfo#8f300b57 to nil") + return fmt.Errorf("can't decode botInfo#82437e74 to nil") } if err := buf.ConsumeID(BotInfoTypeID); err != nil { - return fmt.Errorf("unable to decode botInfo#8f300b57: %w", err) + return fmt.Errorf("unable to decode botInfo#82437e74: %w", err) } return b.DecodeBare(buf) } @@ -303,45 +345,46 @@ func (b *BotInfo) Decode(buf *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (b *BotInfo) DecodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode botInfo#8f300b57 to nil") + return fmt.Errorf("can't decode botInfo#82437e74 to nil") } { if err := b.Flags.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#8f300b57: field flags: %w", err) + return fmt.Errorf("unable to decode botInfo#82437e74: field flags: %w", err) } } + b.HasPreviewMedias = b.Flags.Has(6) if b.Flags.Has(0) { value, err := buf.Long() if err != nil { - return fmt.Errorf("unable to decode botInfo#8f300b57: field user_id: %w", err) + return fmt.Errorf("unable to decode botInfo#82437e74: field user_id: %w", err) } b.UserID = value } if b.Flags.Has(1) { value, err := buf.String() if err != nil { - return fmt.Errorf("unable to decode botInfo#8f300b57: field description: %w", err) + return fmt.Errorf("unable to decode botInfo#82437e74: field description: %w", err) } b.Description = value } if b.Flags.Has(4) { value, err := DecodePhoto(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#8f300b57: field description_photo: %w", err) + return fmt.Errorf("unable to decode botInfo#82437e74: field description_photo: %w", err) } b.DescriptionPhoto = value } if b.Flags.Has(5) { value, err := DecodeDocument(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#8f300b57: field description_document: %w", err) + return fmt.Errorf("unable to decode botInfo#82437e74: field description_document: %w", err) } b.DescriptionDocument = value } if b.Flags.Has(2) { headerLen, err := buf.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode botInfo#8f300b57: field commands: %w", err) + return fmt.Errorf("unable to decode botInfo#82437e74: field commands: %w", err) } if headerLen > 0 { @@ -350,7 +393,7 @@ func (b *BotInfo) DecodeBare(buf *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value BotCommand if err := value.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#8f300b57: field commands: %w", err) + return fmt.Errorf("unable to decode botInfo#82437e74: field commands: %w", err) } b.Commands = append(b.Commands, value) } @@ -358,13 +401,39 @@ func (b *BotInfo) DecodeBare(buf *bin.Buffer) error { if b.Flags.Has(3) { value, err := DecodeBotMenuButton(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#8f300b57: field menu_button: %w", err) + return fmt.Errorf("unable to decode botInfo#82437e74: field menu_button: %w", err) } b.MenuButton = value } + if b.Flags.Has(7) { + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode botInfo#82437e74: field privacy_policy_url: %w", err) + } + b.PrivacyPolicyURL = value + } return nil } +// SetHasPreviewMedias sets value of HasPreviewMedias conditional field. +func (b *BotInfo) SetHasPreviewMedias(value bool) { + if value { + b.Flags.Set(6) + b.HasPreviewMedias = true + } else { + b.Flags.Unset(6) + b.HasPreviewMedias = false + } +} + +// GetHasPreviewMedias returns value of HasPreviewMedias conditional field. +func (b *BotInfo) GetHasPreviewMedias() (value bool) { + if b == nil { + return + } + return b.Flags.Has(6) +} + // SetUserID sets value of UserID conditional field. func (b *BotInfo) SetUserID(value int64) { b.Flags.Set(0) @@ -473,6 +542,24 @@ func (b *BotInfo) GetMenuButton() (value BotMenuButtonClass, ok bool) { return b.MenuButton, true } +// SetPrivacyPolicyURL sets value of PrivacyPolicyURL conditional field. +func (b *BotInfo) SetPrivacyPolicyURL(value string) { + b.Flags.Set(7) + b.PrivacyPolicyURL = value +} + +// GetPrivacyPolicyURL returns value of PrivacyPolicyURL conditional field and +// boolean which is true if field was set. +func (b *BotInfo) GetPrivacyPolicyURL() (value string, ok bool) { + if b == nil { + return + } + if !b.Flags.Has(7) { + return value, false + } + return b.PrivacyPolicyURL, true +} + // GetDescriptionPhotoAsNotEmpty returns mapped value of DescriptionPhoto conditional field and // boolean which is true if field was set. func (b *BotInfo) GetDescriptionPhotoAsNotEmpty() (*Photo, bool) { diff --git a/vendor/github.com/gotd/td/tg/tl_bot_inline_message_gen.go b/vendor/github.com/gotd/td/tg/tl_bot_inline_message_gen.go index b781852e..2fefcaa0 100644 --- a/vendor/github.com/gotd/td/tg/tl_bot_inline_message_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_bot_inline_message_gen.go @@ -1740,10 +1740,11 @@ type BotInlineMessageMediaInvoice struct { // // Use SetPhoto and GetPhoto helpers. Photo WebDocumentClass - // Three-letter ISO 4217 currency¹ code + // Three-letter ISO 4217 currency¹ code, or XTR for Telegram Stars². // // Links: // 1) https://core.telegram.org/bots/payments#supported-currencies + // 2) https://core.telegram.org/api/stars Currency string // Total price in the smallest units of the currency (integer, not float/double). For // example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in diff --git a/vendor/github.com/gotd/td/tg/tl_bot_preview_media_gen.go b/vendor/github.com/gotd/td/tg/tl_bot_preview_media_gen.go new file mode 100644 index 00000000..3bcd09cf --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bot_preview_media_gen.go @@ -0,0 +1,197 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BotPreviewMedia represents TL type `botPreviewMedia#23e91ba3`. +// Represents a Main Mini App preview media, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// +// See https://core.telegram.org/constructor/botPreviewMedia for reference. +type BotPreviewMedia struct { + // When was this media last updated. + Date int + // The actual photo/video. + Media MessageMediaClass +} + +// BotPreviewMediaTypeID is TL type id of BotPreviewMedia. +const BotPreviewMediaTypeID = 0x23e91ba3 + +// Ensuring interfaces in compile-time for BotPreviewMedia. +var ( + _ bin.Encoder = &BotPreviewMedia{} + _ bin.Decoder = &BotPreviewMedia{} + _ bin.BareEncoder = &BotPreviewMedia{} + _ bin.BareDecoder = &BotPreviewMedia{} +) + +func (b *BotPreviewMedia) Zero() bool { + if b == nil { + return true + } + if !(b.Date == 0) { + return false + } + if !(b.Media == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BotPreviewMedia) String() string { + if b == nil { + return "BotPreviewMedia(nil)" + } + type Alias BotPreviewMedia + return fmt.Sprintf("BotPreviewMedia%+v", Alias(*b)) +} + +// FillFrom fills BotPreviewMedia from given interface. +func (b *BotPreviewMedia) FillFrom(from interface { + GetDate() (value int) + GetMedia() (value MessageMediaClass) +}) { + b.Date = from.GetDate() + b.Media = from.GetMedia() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotPreviewMedia) TypeID() uint32 { + return BotPreviewMediaTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotPreviewMedia) TypeName() string { + return "botPreviewMedia" +} + +// TypeInfo returns info about TL type. +func (b *BotPreviewMedia) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "botPreviewMedia", + ID: BotPreviewMediaTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Date", + SchemaName: "date", + }, + { + Name: "Media", + SchemaName: "media", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BotPreviewMedia) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botPreviewMedia#23e91ba3 as nil") + } + buf.PutID(BotPreviewMediaTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BotPreviewMedia) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botPreviewMedia#23e91ba3 as nil") + } + buf.PutInt(b.Date) + if b.Media == nil { + return fmt.Errorf("unable to encode botPreviewMedia#23e91ba3: field media is nil") + } + if err := b.Media.Encode(buf); err != nil { + return fmt.Errorf("unable to encode botPreviewMedia#23e91ba3: field media: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BotPreviewMedia) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botPreviewMedia#23e91ba3 to nil") + } + if err := buf.ConsumeID(BotPreviewMediaTypeID); err != nil { + return fmt.Errorf("unable to decode botPreviewMedia#23e91ba3: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BotPreviewMedia) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botPreviewMedia#23e91ba3 to nil") + } + { + value, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode botPreviewMedia#23e91ba3: field date: %w", err) + } + b.Date = value + } + { + value, err := DecodeMessageMedia(buf) + if err != nil { + return fmt.Errorf("unable to decode botPreviewMedia#23e91ba3: field media: %w", err) + } + b.Media = value + } + return nil +} + +// GetDate returns value of Date field. +func (b *BotPreviewMedia) GetDate() (value int) { + if b == nil { + return + } + return b.Date +} + +// GetMedia returns value of Media field. +func (b *BotPreviewMedia) GetMedia() (value MessageMediaClass) { + if b == nil { + return + } + return b.Media +} diff --git a/vendor/github.com/gotd/td/tg/tl_app_web_view_result_url_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_bot_preview_media_slices_gen.go similarity index 100% rename from vendor/github.com/gotd/td/tg/tl_app_web_view_result_url_slices_gen.go rename to vendor/github.com/gotd/td/tg/tl_bot_preview_media_slices_gen.go diff --git a/vendor/github.com/gotd/td/tg/tl_bot_preview_media_vector_gen.go b/vendor/github.com/gotd/td/tg/tl_bot_preview_media_vector_gen.go new file mode 100644 index 00000000..884d28cc --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bot_preview_media_vector_gen.go @@ -0,0 +1,172 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BotPreviewMediaVector is a box for Vector +type BotPreviewMediaVector struct { + // Elements of Vector + Elems []BotPreviewMedia +} + +// BotPreviewMediaVectorTypeID is TL type id of BotPreviewMediaVector. +const BotPreviewMediaVectorTypeID = bin.TypeVector + +// Ensuring interfaces in compile-time for BotPreviewMediaVector. +var ( + _ bin.Encoder = &BotPreviewMediaVector{} + _ bin.Decoder = &BotPreviewMediaVector{} + _ bin.BareEncoder = &BotPreviewMediaVector{} + _ bin.BareDecoder = &BotPreviewMediaVector{} +) + +func (vec *BotPreviewMediaVector) Zero() bool { + if vec == nil { + return true + } + if !(vec.Elems == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (vec *BotPreviewMediaVector) String() string { + if vec == nil { + return "BotPreviewMediaVector(nil)" + } + type Alias BotPreviewMediaVector + return fmt.Sprintf("BotPreviewMediaVector%+v", Alias(*vec)) +} + +// FillFrom fills BotPreviewMediaVector from given interface. +func (vec *BotPreviewMediaVector) FillFrom(from interface { + GetElems() (value []BotPreviewMedia) +}) { + vec.Elems = from.GetElems() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotPreviewMediaVector) TypeID() uint32 { + return BotPreviewMediaVectorTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotPreviewMediaVector) TypeName() string { + return "" +} + +// TypeInfo returns info about TL type. +func (vec *BotPreviewMediaVector) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "", + ID: BotPreviewMediaVectorTypeID, + } + if vec == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Elems", + SchemaName: "Elems", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (vec *BotPreviewMediaVector) Encode(b *bin.Buffer) error { + if vec == nil { + return fmt.Errorf("can't encode Vector as nil") + } + + return vec.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (vec *BotPreviewMediaVector) EncodeBare(b *bin.Buffer) error { + if vec == nil { + return fmt.Errorf("can't encode Vector as nil") + } + b.PutVectorHeader(len(vec.Elems)) + for idx, v := range vec.Elems { + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode Vector: field Elems element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (vec *BotPreviewMediaVector) Decode(b *bin.Buffer) error { + if vec == nil { + return fmt.Errorf("can't decode Vector to nil") + } + + return vec.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (vec *BotPreviewMediaVector) DecodeBare(b *bin.Buffer) error { + if vec == nil { + return fmt.Errorf("can't decode Vector to nil") + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode Vector: field Elems: %w", err) + } + + if headerLen > 0 { + vec.Elems = make([]BotPreviewMedia, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value BotPreviewMedia + if err := value.Decode(b); err != nil { + return fmt.Errorf("unable to decode Vector: field Elems: %w", err) + } + vec.Elems = append(vec.Elems, value) + } + } + return nil +} + +// GetElems returns value of Elems field. +func (vec *BotPreviewMediaVector) GetElems() (value []BotPreviewMedia) { + if vec == nil { + return + } + return vec.Elems +} diff --git a/vendor/github.com/gotd/td/tg/tl_simple_web_view_result_url_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_bot_preview_media_vector_slices_gen.go similarity index 100% rename from vendor/github.com/gotd/td/tg/tl_simple_web_view_result_url_slices_gen.go rename to vendor/github.com/gotd/td/tg/tl_bot_preview_media_vector_slices_gen.go diff --git a/vendor/github.com/gotd/td/tg/tl_bots_add_preview_media_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_add_preview_media_gen.go new file mode 100644 index 00000000..ee8e50c1 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_add_preview_media_gen.go @@ -0,0 +1,258 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BotsAddPreviewMediaRequest represents TL type `bots.addPreviewMedia#17aeb75a`. +// Add a main mini app preview, see here »¹ for more info. +// Only owners of bots with a configured Main Mini App can use this method, see see here +// »¹ for more info on how to check if you can invoke this method. +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// 2. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// +// See https://core.telegram.org/method/bots.addPreviewMedia for reference. +type BotsAddPreviewMediaRequest struct { + // The bot that owns the Main Mini App. + Bot InputUserClass + // ISO 639-1 language code, indicating the localization of the preview to add. + LangCode string + // The photo/video preview, uploaded using messages.uploadMedia¹. + // + // Links: + // 1) https://core.telegram.org/method/messages.uploadMedia + Media InputMediaClass +} + +// BotsAddPreviewMediaRequestTypeID is TL type id of BotsAddPreviewMediaRequest. +const BotsAddPreviewMediaRequestTypeID = 0x17aeb75a + +// Ensuring interfaces in compile-time for BotsAddPreviewMediaRequest. +var ( + _ bin.Encoder = &BotsAddPreviewMediaRequest{} + _ bin.Decoder = &BotsAddPreviewMediaRequest{} + _ bin.BareEncoder = &BotsAddPreviewMediaRequest{} + _ bin.BareDecoder = &BotsAddPreviewMediaRequest{} +) + +func (a *BotsAddPreviewMediaRequest) Zero() bool { + if a == nil { + return true + } + if !(a.Bot == nil) { + return false + } + if !(a.LangCode == "") { + return false + } + if !(a.Media == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (a *BotsAddPreviewMediaRequest) String() string { + if a == nil { + return "BotsAddPreviewMediaRequest(nil)" + } + type Alias BotsAddPreviewMediaRequest + return fmt.Sprintf("BotsAddPreviewMediaRequest%+v", Alias(*a)) +} + +// FillFrom fills BotsAddPreviewMediaRequest from given interface. +func (a *BotsAddPreviewMediaRequest) FillFrom(from interface { + GetBot() (value InputUserClass) + GetLangCode() (value string) + GetMedia() (value InputMediaClass) +}) { + a.Bot = from.GetBot() + a.LangCode = from.GetLangCode() + a.Media = from.GetMedia() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotsAddPreviewMediaRequest) TypeID() uint32 { + return BotsAddPreviewMediaRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotsAddPreviewMediaRequest) TypeName() string { + return "bots.addPreviewMedia" +} + +// TypeInfo returns info about TL type. +func (a *BotsAddPreviewMediaRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "bots.addPreviewMedia", + ID: BotsAddPreviewMediaRequestTypeID, + } + if a == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Bot", + SchemaName: "bot", + }, + { + Name: "LangCode", + SchemaName: "lang_code", + }, + { + Name: "Media", + SchemaName: "media", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (a *BotsAddPreviewMediaRequest) Encode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode bots.addPreviewMedia#17aeb75a as nil") + } + b.PutID(BotsAddPreviewMediaRequestTypeID) + return a.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (a *BotsAddPreviewMediaRequest) EncodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode bots.addPreviewMedia#17aeb75a as nil") + } + if a.Bot == nil { + return fmt.Errorf("unable to encode bots.addPreviewMedia#17aeb75a: field bot is nil") + } + if err := a.Bot.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.addPreviewMedia#17aeb75a: field bot: %w", err) + } + b.PutString(a.LangCode) + if a.Media == nil { + return fmt.Errorf("unable to encode bots.addPreviewMedia#17aeb75a: field media is nil") + } + if err := a.Media.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.addPreviewMedia#17aeb75a: field media: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (a *BotsAddPreviewMediaRequest) Decode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode bots.addPreviewMedia#17aeb75a to nil") + } + if err := b.ConsumeID(BotsAddPreviewMediaRequestTypeID); err != nil { + return fmt.Errorf("unable to decode bots.addPreviewMedia#17aeb75a: %w", err) + } + return a.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (a *BotsAddPreviewMediaRequest) DecodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode bots.addPreviewMedia#17aeb75a to nil") + } + { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode bots.addPreviewMedia#17aeb75a: field bot: %w", err) + } + a.Bot = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode bots.addPreviewMedia#17aeb75a: field lang_code: %w", err) + } + a.LangCode = value + } + { + value, err := DecodeInputMedia(b) + if err != nil { + return fmt.Errorf("unable to decode bots.addPreviewMedia#17aeb75a: field media: %w", err) + } + a.Media = value + } + return nil +} + +// GetBot returns value of Bot field. +func (a *BotsAddPreviewMediaRequest) GetBot() (value InputUserClass) { + if a == nil { + return + } + return a.Bot +} + +// GetLangCode returns value of LangCode field. +func (a *BotsAddPreviewMediaRequest) GetLangCode() (value string) { + if a == nil { + return + } + return a.LangCode +} + +// GetMedia returns value of Media field. +func (a *BotsAddPreviewMediaRequest) GetMedia() (value InputMediaClass) { + if a == nil { + return + } + return a.Media +} + +// BotsAddPreviewMedia invokes method bots.addPreviewMedia#17aeb75a returning error if any. +// Add a main mini app preview, see here »¹ for more info. +// Only owners of bots with a configured Main Mini App can use this method, see see here +// »¹ for more info on how to check if you can invoke this method. +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// 2. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// +// Possible errors: +// +// 400 BOT_INVALID: This is not a valid bot. +// +// See https://core.telegram.org/method/bots.addPreviewMedia for reference. +func (c *Client) BotsAddPreviewMedia(ctx context.Context, request *BotsAddPreviewMediaRequest) (*BotPreviewMedia, error) { + var result BotPreviewMedia + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_bots_add_preview_media_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_add_preview_media_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_add_preview_media_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_bots_answer_webhook_json_query_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_answer_webhook_json_query_gen.go index 4afe9bdb..08ea73b2 100644 --- a/vendor/github.com/gotd/td/tg/tl_bots_answer_webhook_json_query_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_bots_answer_webhook_json_query_gen.go @@ -196,6 +196,7 @@ func (a *BotsAnswerWebhookJSONQueryRequest) GetData() (value DataJSON) { // 400 DATA_JSON_INVALID: The provided JSON data is invalid. // 400 QUERY_ID_INVALID: The query ID is invalid. // 403 USER_BOT_INVALID: User accounts must provide the bot method parameter when calling this method. If there is no such method parameter, this method can only be invoked by bot accounts. +// 400 USER_BOT_REQUIRED: This method can only be called by a bot. // // See https://core.telegram.org/method/bots.answerWebhookJSONQuery for reference. // Can be used by bots. diff --git a/vendor/github.com/gotd/td/tg/tl_bots_delete_preview_media_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_delete_preview_media_gen.go new file mode 100644 index 00000000..e86c0791 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_delete_preview_media_gen.go @@ -0,0 +1,277 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BotsDeletePreviewMediaRequest represents TL type `bots.deletePreviewMedia#2d0135b3`. +// Delete a main mini app preview, see here »¹ for more info. +// Only owners of bots with a configured Main Mini App can use this method, see see here +// »¹ for more info on how to check if you can invoke this method. +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// 2. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// +// See https://core.telegram.org/method/bots.deletePreviewMedia for reference. +type BotsDeletePreviewMediaRequest struct { + // The bot that owns the Main Mini App. + Bot InputUserClass + // ISO 639-1 language code, indicating the localization of the preview to delete. + LangCode string + // The photo/video preview to delete, previously fetched as specified here »¹. + // + // Links: + // 1) https://core.telegram.org/api/bots/webapps#main-mini-app-previews + Media []InputMediaClass +} + +// BotsDeletePreviewMediaRequestTypeID is TL type id of BotsDeletePreviewMediaRequest. +const BotsDeletePreviewMediaRequestTypeID = 0x2d0135b3 + +// Ensuring interfaces in compile-time for BotsDeletePreviewMediaRequest. +var ( + _ bin.Encoder = &BotsDeletePreviewMediaRequest{} + _ bin.Decoder = &BotsDeletePreviewMediaRequest{} + _ bin.BareEncoder = &BotsDeletePreviewMediaRequest{} + _ bin.BareDecoder = &BotsDeletePreviewMediaRequest{} +) + +func (d *BotsDeletePreviewMediaRequest) Zero() bool { + if d == nil { + return true + } + if !(d.Bot == nil) { + return false + } + if !(d.LangCode == "") { + return false + } + if !(d.Media == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (d *BotsDeletePreviewMediaRequest) String() string { + if d == nil { + return "BotsDeletePreviewMediaRequest(nil)" + } + type Alias BotsDeletePreviewMediaRequest + return fmt.Sprintf("BotsDeletePreviewMediaRequest%+v", Alias(*d)) +} + +// FillFrom fills BotsDeletePreviewMediaRequest from given interface. +func (d *BotsDeletePreviewMediaRequest) FillFrom(from interface { + GetBot() (value InputUserClass) + GetLangCode() (value string) + GetMedia() (value []InputMediaClass) +}) { + d.Bot = from.GetBot() + d.LangCode = from.GetLangCode() + d.Media = from.GetMedia() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotsDeletePreviewMediaRequest) TypeID() uint32 { + return BotsDeletePreviewMediaRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotsDeletePreviewMediaRequest) TypeName() string { + return "bots.deletePreviewMedia" +} + +// TypeInfo returns info about TL type. +func (d *BotsDeletePreviewMediaRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "bots.deletePreviewMedia", + ID: BotsDeletePreviewMediaRequestTypeID, + } + if d == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Bot", + SchemaName: "bot", + }, + { + Name: "LangCode", + SchemaName: "lang_code", + }, + { + Name: "Media", + SchemaName: "media", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (d *BotsDeletePreviewMediaRequest) Encode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode bots.deletePreviewMedia#2d0135b3 as nil") + } + b.PutID(BotsDeletePreviewMediaRequestTypeID) + return d.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (d *BotsDeletePreviewMediaRequest) EncodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode bots.deletePreviewMedia#2d0135b3 as nil") + } + if d.Bot == nil { + return fmt.Errorf("unable to encode bots.deletePreviewMedia#2d0135b3: field bot is nil") + } + if err := d.Bot.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.deletePreviewMedia#2d0135b3: field bot: %w", err) + } + b.PutString(d.LangCode) + b.PutVectorHeader(len(d.Media)) + for idx, v := range d.Media { + if v == nil { + return fmt.Errorf("unable to encode bots.deletePreviewMedia#2d0135b3: field media element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.deletePreviewMedia#2d0135b3: field media element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (d *BotsDeletePreviewMediaRequest) Decode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode bots.deletePreviewMedia#2d0135b3 to nil") + } + if err := b.ConsumeID(BotsDeletePreviewMediaRequestTypeID); err != nil { + return fmt.Errorf("unable to decode bots.deletePreviewMedia#2d0135b3: %w", err) + } + return d.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (d *BotsDeletePreviewMediaRequest) DecodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode bots.deletePreviewMedia#2d0135b3 to nil") + } + { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode bots.deletePreviewMedia#2d0135b3: field bot: %w", err) + } + d.Bot = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode bots.deletePreviewMedia#2d0135b3: field lang_code: %w", err) + } + d.LangCode = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode bots.deletePreviewMedia#2d0135b3: field media: %w", err) + } + + if headerLen > 0 { + d.Media = make([]InputMediaClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeInputMedia(b) + if err != nil { + return fmt.Errorf("unable to decode bots.deletePreviewMedia#2d0135b3: field media: %w", err) + } + d.Media = append(d.Media, value) + } + } + return nil +} + +// GetBot returns value of Bot field. +func (d *BotsDeletePreviewMediaRequest) GetBot() (value InputUserClass) { + if d == nil { + return + } + return d.Bot +} + +// GetLangCode returns value of LangCode field. +func (d *BotsDeletePreviewMediaRequest) GetLangCode() (value string) { + if d == nil { + return + } + return d.LangCode +} + +// GetMedia returns value of Media field. +func (d *BotsDeletePreviewMediaRequest) GetMedia() (value []InputMediaClass) { + if d == nil { + return + } + return d.Media +} + +// MapMedia returns field Media wrapped in InputMediaClassArray helper. +func (d *BotsDeletePreviewMediaRequest) MapMedia() (value InputMediaClassArray) { + return InputMediaClassArray(d.Media) +} + +// BotsDeletePreviewMedia invokes method bots.deletePreviewMedia#2d0135b3 returning error if any. +// Delete a main mini app preview, see here »¹ for more info. +// Only owners of bots with a configured Main Mini App can use this method, see see here +// »¹ for more info on how to check if you can invoke this method. +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// 2. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// +// Possible errors: +// +// 400 BOT_INVALID: This is not a valid bot. +// +// See https://core.telegram.org/method/bots.deletePreviewMedia for reference. +func (c *Client) BotsDeletePreviewMedia(ctx context.Context, request *BotsDeletePreviewMediaRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_bots_delete_preview_media_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_delete_preview_media_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_delete_preview_media_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_bots_edit_preview_media_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_edit_preview_media_gen.go new file mode 100644 index 00000000..aa00c0d9 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_edit_preview_media_gen.go @@ -0,0 +1,293 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BotsEditPreviewMediaRequest represents TL type `bots.editPreviewMedia#8525606f`. +// Edit a main mini app preview, see here »¹ for more info. +// Only owners of bots with a configured Main Mini App can use this method, see see here +// »¹ for more info on how to check if you can invoke this method. +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// 2. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// +// See https://core.telegram.org/method/bots.editPreviewMedia for reference. +type BotsEditPreviewMediaRequest struct { + // The bot that owns the Main Mini App. + Bot InputUserClass + // ISO 639-1 language code, indicating the localization of the preview to edit. + LangCode string + // The photo/video preview to replace, previously fetched as specified here »¹. + // + // Links: + // 1) https://core.telegram.org/api/bots/webapps#main-mini-app-previews + Media InputMediaClass + // The new photo/video preview, uploaded using messages.uploadMedia¹. + // + // Links: + // 1) https://core.telegram.org/method/messages.uploadMedia + NewMedia InputMediaClass +} + +// BotsEditPreviewMediaRequestTypeID is TL type id of BotsEditPreviewMediaRequest. +const BotsEditPreviewMediaRequestTypeID = 0x8525606f + +// Ensuring interfaces in compile-time for BotsEditPreviewMediaRequest. +var ( + _ bin.Encoder = &BotsEditPreviewMediaRequest{} + _ bin.Decoder = &BotsEditPreviewMediaRequest{} + _ bin.BareEncoder = &BotsEditPreviewMediaRequest{} + _ bin.BareDecoder = &BotsEditPreviewMediaRequest{} +) + +func (e *BotsEditPreviewMediaRequest) Zero() bool { + if e == nil { + return true + } + if !(e.Bot == nil) { + return false + } + if !(e.LangCode == "") { + return false + } + if !(e.Media == nil) { + return false + } + if !(e.NewMedia == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (e *BotsEditPreviewMediaRequest) String() string { + if e == nil { + return "BotsEditPreviewMediaRequest(nil)" + } + type Alias BotsEditPreviewMediaRequest + return fmt.Sprintf("BotsEditPreviewMediaRequest%+v", Alias(*e)) +} + +// FillFrom fills BotsEditPreviewMediaRequest from given interface. +func (e *BotsEditPreviewMediaRequest) FillFrom(from interface { + GetBot() (value InputUserClass) + GetLangCode() (value string) + GetMedia() (value InputMediaClass) + GetNewMedia() (value InputMediaClass) +}) { + e.Bot = from.GetBot() + e.LangCode = from.GetLangCode() + e.Media = from.GetMedia() + e.NewMedia = from.GetNewMedia() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotsEditPreviewMediaRequest) TypeID() uint32 { + return BotsEditPreviewMediaRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotsEditPreviewMediaRequest) TypeName() string { + return "bots.editPreviewMedia" +} + +// TypeInfo returns info about TL type. +func (e *BotsEditPreviewMediaRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "bots.editPreviewMedia", + ID: BotsEditPreviewMediaRequestTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Bot", + SchemaName: "bot", + }, + { + Name: "LangCode", + SchemaName: "lang_code", + }, + { + Name: "Media", + SchemaName: "media", + }, + { + Name: "NewMedia", + SchemaName: "new_media", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (e *BotsEditPreviewMediaRequest) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode bots.editPreviewMedia#8525606f as nil") + } + b.PutID(BotsEditPreviewMediaRequestTypeID) + return e.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (e *BotsEditPreviewMediaRequest) EncodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode bots.editPreviewMedia#8525606f as nil") + } + if e.Bot == nil { + return fmt.Errorf("unable to encode bots.editPreviewMedia#8525606f: field bot is nil") + } + if err := e.Bot.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.editPreviewMedia#8525606f: field bot: %w", err) + } + b.PutString(e.LangCode) + if e.Media == nil { + return fmt.Errorf("unable to encode bots.editPreviewMedia#8525606f: field media is nil") + } + if err := e.Media.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.editPreviewMedia#8525606f: field media: %w", err) + } + if e.NewMedia == nil { + return fmt.Errorf("unable to encode bots.editPreviewMedia#8525606f: field new_media is nil") + } + if err := e.NewMedia.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.editPreviewMedia#8525606f: field new_media: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (e *BotsEditPreviewMediaRequest) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode bots.editPreviewMedia#8525606f to nil") + } + if err := b.ConsumeID(BotsEditPreviewMediaRequestTypeID); err != nil { + return fmt.Errorf("unable to decode bots.editPreviewMedia#8525606f: %w", err) + } + return e.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (e *BotsEditPreviewMediaRequest) DecodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode bots.editPreviewMedia#8525606f to nil") + } + { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode bots.editPreviewMedia#8525606f: field bot: %w", err) + } + e.Bot = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode bots.editPreviewMedia#8525606f: field lang_code: %w", err) + } + e.LangCode = value + } + { + value, err := DecodeInputMedia(b) + if err != nil { + return fmt.Errorf("unable to decode bots.editPreviewMedia#8525606f: field media: %w", err) + } + e.Media = value + } + { + value, err := DecodeInputMedia(b) + if err != nil { + return fmt.Errorf("unable to decode bots.editPreviewMedia#8525606f: field new_media: %w", err) + } + e.NewMedia = value + } + return nil +} + +// GetBot returns value of Bot field. +func (e *BotsEditPreviewMediaRequest) GetBot() (value InputUserClass) { + if e == nil { + return + } + return e.Bot +} + +// GetLangCode returns value of LangCode field. +func (e *BotsEditPreviewMediaRequest) GetLangCode() (value string) { + if e == nil { + return + } + return e.LangCode +} + +// GetMedia returns value of Media field. +func (e *BotsEditPreviewMediaRequest) GetMedia() (value InputMediaClass) { + if e == nil { + return + } + return e.Media +} + +// GetNewMedia returns value of NewMedia field. +func (e *BotsEditPreviewMediaRequest) GetNewMedia() (value InputMediaClass) { + if e == nil { + return + } + return e.NewMedia +} + +// BotsEditPreviewMedia invokes method bots.editPreviewMedia#8525606f returning error if any. +// Edit a main mini app preview, see here »¹ for more info. +// Only owners of bots with a configured Main Mini App can use this method, see see here +// »¹ for more info on how to check if you can invoke this method. +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// 2. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// +// Possible errors: +// +// 400 BOT_INVALID: This is not a valid bot. +// +// See https://core.telegram.org/method/bots.editPreviewMedia for reference. +func (c *Client) BotsEditPreviewMedia(ctx context.Context, request *BotsEditPreviewMediaRequest) (*BotPreviewMedia, error) { + var result BotPreviewMedia + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_bots_edit_preview_media_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_edit_preview_media_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_edit_preview_media_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_bots_get_bot_commands_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_get_bot_commands_gen.go index 499a10ed..c6064a61 100644 --- a/vendor/github.com/gotd/td/tg/tl_bots_get_bot_commands_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_bots_get_bot_commands_gen.go @@ -199,6 +199,7 @@ func (g *BotsGetBotCommandsRequest) GetLangCode() (value string) { // Possible errors: // // 400 USER_BOT_INVALID: User accounts must provide the bot method parameter when calling this method. If there is no such method parameter, this method can only be invoked by bot accounts. +// 400 USER_BOT_REQUIRED: This method can only be called by a bot. // // See https://core.telegram.org/method/bots.getBotCommands for reference. // Can be used by bots. diff --git a/vendor/github.com/gotd/td/tg/tl_bots_get_bot_info_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_get_bot_info_gen.go index 102cfe55..bf848d61 100644 --- a/vendor/github.com/gotd/td/tg/tl_bots_get_bot_info_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_bots_get_bot_info_gen.go @@ -243,6 +243,7 @@ func (g *BotsGetBotInfoRequest) GetLangCode() (value string) { // // Possible errors: // +// 400 BOT_INVALID: This is not a valid bot. // 400 LANG_CODE_INVALID: The specified language code is invalid. // 400 USER_BOT_INVALID: User accounts must provide the bot method parameter when calling this method. If there is no such method parameter, this method can only be invoked by bot accounts. // diff --git a/vendor/github.com/gotd/td/tg/tl_bots_get_popular_app_bots_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_get_popular_app_bots_gen.go new file mode 100644 index 00000000..c8edfe79 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_get_popular_app_bots_gen.go @@ -0,0 +1,217 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BotsGetPopularAppBotsRequest represents TL type `bots.getPopularAppBots#c2510192`. +// Fetch popular Main Mini Apps¹, to be used in the apps tab of global search »². +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-apps +// 2. https://core.telegram.org/api/search#apps-tab +// +// See https://core.telegram.org/method/bots.getPopularAppBots for reference. +type BotsGetPopularAppBotsRequest struct { + // Offset for pagination¹, initially an empty string, then re-use the next_offset + // returned by the previous query. + // + // Links: + // 1) https://core.telegram.org/api/offsets + Offset string + // Maximum number of results to return, see pagination¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets + Limit int +} + +// BotsGetPopularAppBotsRequestTypeID is TL type id of BotsGetPopularAppBotsRequest. +const BotsGetPopularAppBotsRequestTypeID = 0xc2510192 + +// Ensuring interfaces in compile-time for BotsGetPopularAppBotsRequest. +var ( + _ bin.Encoder = &BotsGetPopularAppBotsRequest{} + _ bin.Decoder = &BotsGetPopularAppBotsRequest{} + _ bin.BareEncoder = &BotsGetPopularAppBotsRequest{} + _ bin.BareDecoder = &BotsGetPopularAppBotsRequest{} +) + +func (g *BotsGetPopularAppBotsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Offset == "") { + return false + } + if !(g.Limit == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *BotsGetPopularAppBotsRequest) String() string { + if g == nil { + return "BotsGetPopularAppBotsRequest(nil)" + } + type Alias BotsGetPopularAppBotsRequest + return fmt.Sprintf("BotsGetPopularAppBotsRequest%+v", Alias(*g)) +} + +// FillFrom fills BotsGetPopularAppBotsRequest from given interface. +func (g *BotsGetPopularAppBotsRequest) FillFrom(from interface { + GetOffset() (value string) + GetLimit() (value int) +}) { + g.Offset = from.GetOffset() + g.Limit = from.GetLimit() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotsGetPopularAppBotsRequest) TypeID() uint32 { + return BotsGetPopularAppBotsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotsGetPopularAppBotsRequest) TypeName() string { + return "bots.getPopularAppBots" +} + +// TypeInfo returns info about TL type. +func (g *BotsGetPopularAppBotsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "bots.getPopularAppBots", + ID: BotsGetPopularAppBotsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Offset", + SchemaName: "offset", + }, + { + Name: "Limit", + SchemaName: "limit", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *BotsGetPopularAppBotsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode bots.getPopularAppBots#c2510192 as nil") + } + b.PutID(BotsGetPopularAppBotsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *BotsGetPopularAppBotsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode bots.getPopularAppBots#c2510192 as nil") + } + b.PutString(g.Offset) + b.PutInt(g.Limit) + return nil +} + +// Decode implements bin.Decoder. +func (g *BotsGetPopularAppBotsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode bots.getPopularAppBots#c2510192 to nil") + } + if err := b.ConsumeID(BotsGetPopularAppBotsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode bots.getPopularAppBots#c2510192: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *BotsGetPopularAppBotsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode bots.getPopularAppBots#c2510192 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode bots.getPopularAppBots#c2510192: field offset: %w", err) + } + g.Offset = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode bots.getPopularAppBots#c2510192: field limit: %w", err) + } + g.Limit = value + } + return nil +} + +// GetOffset returns value of Offset field. +func (g *BotsGetPopularAppBotsRequest) GetOffset() (value string) { + if g == nil { + return + } + return g.Offset +} + +// GetLimit returns value of Limit field. +func (g *BotsGetPopularAppBotsRequest) GetLimit() (value int) { + if g == nil { + return + } + return g.Limit +} + +// BotsGetPopularAppBots invokes method bots.getPopularAppBots#c2510192 returning error if any. +// Fetch popular Main Mini Apps¹, to be used in the apps tab of global search »². +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-apps +// 2. https://core.telegram.org/api/search#apps-tab +// +// See https://core.telegram.org/method/bots.getPopularAppBots for reference. +func (c *Client) BotsGetPopularAppBots(ctx context.Context, request *BotsGetPopularAppBotsRequest) (*BotsPopularAppBots, error) { + var result BotsPopularAppBots + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_bots_get_popular_app_bots_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_get_popular_app_bots_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_get_popular_app_bots_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_bots_get_preview_info_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_get_preview_info_gen.go new file mode 100644 index 00000000..0087c2e7 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_get_preview_info_gen.go @@ -0,0 +1,229 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BotsGetPreviewInfoRequest represents TL type `bots.getPreviewInfo#423ab3ad`. +// Bot owners only, fetch main mini app preview information, see here »¹ for more info. +// Note: technically non-owners may also invoke this method, but it will always behave +// exactly as bots.getPreviewMedias¹, returning only previews for the current language +// and an empty lang_codes array, regardless of the passed lang_code, so please only use +// bots.getPreviewMedias² if you're not the owner of the bot. +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// 2. https://core.telegram.org/method/bots.getPreviewMedias +// 3. https://core.telegram.org/method/bots.getPreviewMedias +// +// See https://core.telegram.org/method/bots.getPreviewInfo for reference. +type BotsGetPreviewInfoRequest struct { + // The bot that owns the Main Mini App. + Bot InputUserClass + // Fetch previews for the specified ISO 639-1 language code. + LangCode string +} + +// BotsGetPreviewInfoRequestTypeID is TL type id of BotsGetPreviewInfoRequest. +const BotsGetPreviewInfoRequestTypeID = 0x423ab3ad + +// Ensuring interfaces in compile-time for BotsGetPreviewInfoRequest. +var ( + _ bin.Encoder = &BotsGetPreviewInfoRequest{} + _ bin.Decoder = &BotsGetPreviewInfoRequest{} + _ bin.BareEncoder = &BotsGetPreviewInfoRequest{} + _ bin.BareDecoder = &BotsGetPreviewInfoRequest{} +) + +func (g *BotsGetPreviewInfoRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Bot == nil) { + return false + } + if !(g.LangCode == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *BotsGetPreviewInfoRequest) String() string { + if g == nil { + return "BotsGetPreviewInfoRequest(nil)" + } + type Alias BotsGetPreviewInfoRequest + return fmt.Sprintf("BotsGetPreviewInfoRequest%+v", Alias(*g)) +} + +// FillFrom fills BotsGetPreviewInfoRequest from given interface. +func (g *BotsGetPreviewInfoRequest) FillFrom(from interface { + GetBot() (value InputUserClass) + GetLangCode() (value string) +}) { + g.Bot = from.GetBot() + g.LangCode = from.GetLangCode() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotsGetPreviewInfoRequest) TypeID() uint32 { + return BotsGetPreviewInfoRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotsGetPreviewInfoRequest) TypeName() string { + return "bots.getPreviewInfo" +} + +// TypeInfo returns info about TL type. +func (g *BotsGetPreviewInfoRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "bots.getPreviewInfo", + ID: BotsGetPreviewInfoRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Bot", + SchemaName: "bot", + }, + { + Name: "LangCode", + SchemaName: "lang_code", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *BotsGetPreviewInfoRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode bots.getPreviewInfo#423ab3ad as nil") + } + b.PutID(BotsGetPreviewInfoRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *BotsGetPreviewInfoRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode bots.getPreviewInfo#423ab3ad as nil") + } + if g.Bot == nil { + return fmt.Errorf("unable to encode bots.getPreviewInfo#423ab3ad: field bot is nil") + } + if err := g.Bot.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.getPreviewInfo#423ab3ad: field bot: %w", err) + } + b.PutString(g.LangCode) + return nil +} + +// Decode implements bin.Decoder. +func (g *BotsGetPreviewInfoRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode bots.getPreviewInfo#423ab3ad to nil") + } + if err := b.ConsumeID(BotsGetPreviewInfoRequestTypeID); err != nil { + return fmt.Errorf("unable to decode bots.getPreviewInfo#423ab3ad: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *BotsGetPreviewInfoRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode bots.getPreviewInfo#423ab3ad to nil") + } + { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode bots.getPreviewInfo#423ab3ad: field bot: %w", err) + } + g.Bot = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode bots.getPreviewInfo#423ab3ad: field lang_code: %w", err) + } + g.LangCode = value + } + return nil +} + +// GetBot returns value of Bot field. +func (g *BotsGetPreviewInfoRequest) GetBot() (value InputUserClass) { + if g == nil { + return + } + return g.Bot +} + +// GetLangCode returns value of LangCode field. +func (g *BotsGetPreviewInfoRequest) GetLangCode() (value string) { + if g == nil { + return + } + return g.LangCode +} + +// BotsGetPreviewInfo invokes method bots.getPreviewInfo#423ab3ad returning error if any. +// Bot owners only, fetch main mini app preview information, see here »¹ for more info. +// Note: technically non-owners may also invoke this method, but it will always behave +// exactly as bots.getPreviewMedias¹, returning only previews for the current language +// and an empty lang_codes array, regardless of the passed lang_code, so please only use +// bots.getPreviewMedias² if you're not the owner of the bot. +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// 2. https://core.telegram.org/method/bots.getPreviewMedias +// 3. https://core.telegram.org/method/bots.getPreviewMedias +// +// Possible errors: +// +// 400 BOT_INVALID: This is not a valid bot. +// +// See https://core.telegram.org/method/bots.getPreviewInfo for reference. +func (c *Client) BotsGetPreviewInfo(ctx context.Context, request *BotsGetPreviewInfoRequest) (*BotsPreviewInfo, error) { + var result BotsPreviewInfo + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_bots_get_preview_info_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_get_preview_info_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_get_preview_info_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_bots_get_preview_medias_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_get_preview_medias_gen.go new file mode 100644 index 00000000..2db81f30 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_get_preview_medias_gen.go @@ -0,0 +1,193 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BotsGetPreviewMediasRequest represents TL type `bots.getPreviewMedias#a2a5594d`. +// Fetch main mini app previews, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// +// See https://core.telegram.org/method/bots.getPreviewMedias for reference. +type BotsGetPreviewMediasRequest struct { + // The bot that owns the Main Mini App. + Bot InputUserClass +} + +// BotsGetPreviewMediasRequestTypeID is TL type id of BotsGetPreviewMediasRequest. +const BotsGetPreviewMediasRequestTypeID = 0xa2a5594d + +// Ensuring interfaces in compile-time for BotsGetPreviewMediasRequest. +var ( + _ bin.Encoder = &BotsGetPreviewMediasRequest{} + _ bin.Decoder = &BotsGetPreviewMediasRequest{} + _ bin.BareEncoder = &BotsGetPreviewMediasRequest{} + _ bin.BareDecoder = &BotsGetPreviewMediasRequest{} +) + +func (g *BotsGetPreviewMediasRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Bot == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *BotsGetPreviewMediasRequest) String() string { + if g == nil { + return "BotsGetPreviewMediasRequest(nil)" + } + type Alias BotsGetPreviewMediasRequest + return fmt.Sprintf("BotsGetPreviewMediasRequest%+v", Alias(*g)) +} + +// FillFrom fills BotsGetPreviewMediasRequest from given interface. +func (g *BotsGetPreviewMediasRequest) FillFrom(from interface { + GetBot() (value InputUserClass) +}) { + g.Bot = from.GetBot() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotsGetPreviewMediasRequest) TypeID() uint32 { + return BotsGetPreviewMediasRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotsGetPreviewMediasRequest) TypeName() string { + return "bots.getPreviewMedias" +} + +// TypeInfo returns info about TL type. +func (g *BotsGetPreviewMediasRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "bots.getPreviewMedias", + ID: BotsGetPreviewMediasRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Bot", + SchemaName: "bot", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *BotsGetPreviewMediasRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode bots.getPreviewMedias#a2a5594d as nil") + } + b.PutID(BotsGetPreviewMediasRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *BotsGetPreviewMediasRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode bots.getPreviewMedias#a2a5594d as nil") + } + if g.Bot == nil { + return fmt.Errorf("unable to encode bots.getPreviewMedias#a2a5594d: field bot is nil") + } + if err := g.Bot.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.getPreviewMedias#a2a5594d: field bot: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (g *BotsGetPreviewMediasRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode bots.getPreviewMedias#a2a5594d to nil") + } + if err := b.ConsumeID(BotsGetPreviewMediasRequestTypeID); err != nil { + return fmt.Errorf("unable to decode bots.getPreviewMedias#a2a5594d: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *BotsGetPreviewMediasRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode bots.getPreviewMedias#a2a5594d to nil") + } + { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode bots.getPreviewMedias#a2a5594d: field bot: %w", err) + } + g.Bot = value + } + return nil +} + +// GetBot returns value of Bot field. +func (g *BotsGetPreviewMediasRequest) GetBot() (value InputUserClass) { + if g == nil { + return + } + return g.Bot +} + +// BotsGetPreviewMedias invokes method bots.getPreviewMedias#a2a5594d returning error if any. +// Fetch main mini app previews, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// +// Possible errors: +// +// 400 BOT_INVALID: This is not a valid bot. +// +// See https://core.telegram.org/method/bots.getPreviewMedias for reference. +func (c *Client) BotsGetPreviewMedias(ctx context.Context, bot InputUserClass) ([]BotPreviewMedia, error) { + var result BotPreviewMediaVector + + request := &BotsGetPreviewMediasRequest{ + Bot: bot, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return []BotPreviewMedia(result.Elems), nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_bots_get_preview_medias_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_get_preview_medias_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_get_preview_medias_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_bots_invoke_web_view_custom_method_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_invoke_web_view_custom_method_gen.go index a542b5d5..bf8d777a 100644 --- a/vendor/github.com/gotd/td/tg/tl_bots_invoke_web_view_custom_method_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_bots_invoke_web_view_custom_method_gen.go @@ -247,6 +247,7 @@ func (i *BotsInvokeWebViewCustomMethodRequest) GetParams() (value DataJSON) { // Possible errors: // // 400 BOT_INVALID: This is not a valid bot. +// 400 DATA_JSON_INVALID: The provided JSON data is invalid. // // See https://core.telegram.org/method/bots.invokeWebViewCustomMethod for reference. func (c *Client) BotsInvokeWebViewCustomMethod(ctx context.Context, request *BotsInvokeWebViewCustomMethodRequest) (*DataJSON, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_bots_popular_app_bots_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_popular_app_bots_gen.go new file mode 100644 index 00000000..2b321886 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_popular_app_bots_gen.go @@ -0,0 +1,264 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BotsPopularAppBots represents TL type `bots.popularAppBots#1991b13b`. +// Popular Main Mini Apps¹, to be used in the apps tab of global search »². +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-apps +// 2. https://core.telegram.org/api/search#apps-tab +// +// See https://core.telegram.org/constructor/bots.popularAppBots for reference. +type BotsPopularAppBots struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // Offset for pagination¹. + // + // Links: + // 1) https://core.telegram.org/api/offsets + // + // Use SetNextOffset and GetNextOffset helpers. + NextOffset string + // The bots associated to each Main Mini App, see here »¹ for more info. + // + // Links: + // 1) https://core.telegram.org/api/bots/webapps#main-mini-apps + Users []UserClass +} + +// BotsPopularAppBotsTypeID is TL type id of BotsPopularAppBots. +const BotsPopularAppBotsTypeID = 0x1991b13b + +// Ensuring interfaces in compile-time for BotsPopularAppBots. +var ( + _ bin.Encoder = &BotsPopularAppBots{} + _ bin.Decoder = &BotsPopularAppBots{} + _ bin.BareEncoder = &BotsPopularAppBots{} + _ bin.BareDecoder = &BotsPopularAppBots{} +) + +func (p *BotsPopularAppBots) Zero() bool { + if p == nil { + return true + } + if !(p.Flags.Zero()) { + return false + } + if !(p.NextOffset == "") { + return false + } + if !(p.Users == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *BotsPopularAppBots) String() string { + if p == nil { + return "BotsPopularAppBots(nil)" + } + type Alias BotsPopularAppBots + return fmt.Sprintf("BotsPopularAppBots%+v", Alias(*p)) +} + +// FillFrom fills BotsPopularAppBots from given interface. +func (p *BotsPopularAppBots) FillFrom(from interface { + GetNextOffset() (value string, ok bool) + GetUsers() (value []UserClass) +}) { + if val, ok := from.GetNextOffset(); ok { + p.NextOffset = val + } + + p.Users = from.GetUsers() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotsPopularAppBots) TypeID() uint32 { + return BotsPopularAppBotsTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotsPopularAppBots) TypeName() string { + return "bots.popularAppBots" +} + +// TypeInfo returns info about TL type. +func (p *BotsPopularAppBots) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "bots.popularAppBots", + ID: BotsPopularAppBotsTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "NextOffset", + SchemaName: "next_offset", + Null: !p.Flags.Has(0), + }, + { + Name: "Users", + SchemaName: "users", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (p *BotsPopularAppBots) SetFlags() { + if !(p.NextOffset == "") { + p.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (p *BotsPopularAppBots) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode bots.popularAppBots#1991b13b as nil") + } + b.PutID(BotsPopularAppBotsTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *BotsPopularAppBots) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode bots.popularAppBots#1991b13b as nil") + } + p.SetFlags() + if err := p.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.popularAppBots#1991b13b: field flags: %w", err) + } + if p.Flags.Has(0) { + b.PutString(p.NextOffset) + } + b.PutVectorHeader(len(p.Users)) + for idx, v := range p.Users { + if v == nil { + return fmt.Errorf("unable to encode bots.popularAppBots#1991b13b: field users element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.popularAppBots#1991b13b: field users element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (p *BotsPopularAppBots) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode bots.popularAppBots#1991b13b to nil") + } + if err := b.ConsumeID(BotsPopularAppBotsTypeID); err != nil { + return fmt.Errorf("unable to decode bots.popularAppBots#1991b13b: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *BotsPopularAppBots) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode bots.popularAppBots#1991b13b to nil") + } + { + if err := p.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode bots.popularAppBots#1991b13b: field flags: %w", err) + } + } + if p.Flags.Has(0) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode bots.popularAppBots#1991b13b: field next_offset: %w", err) + } + p.NextOffset = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode bots.popularAppBots#1991b13b: field users: %w", err) + } + + if headerLen > 0 { + p.Users = make([]UserClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeUser(b) + if err != nil { + return fmt.Errorf("unable to decode bots.popularAppBots#1991b13b: field users: %w", err) + } + p.Users = append(p.Users, value) + } + } + return nil +} + +// SetNextOffset sets value of NextOffset conditional field. +func (p *BotsPopularAppBots) SetNextOffset(value string) { + p.Flags.Set(0) + p.NextOffset = value +} + +// GetNextOffset returns value of NextOffset conditional field and +// boolean which is true if field was set. +func (p *BotsPopularAppBots) GetNextOffset() (value string, ok bool) { + if p == nil { + return + } + if !p.Flags.Has(0) { + return value, false + } + return p.NextOffset, true +} + +// GetUsers returns value of Users field. +func (p *BotsPopularAppBots) GetUsers() (value []UserClass) { + if p == nil { + return + } + return p.Users +} + +// MapUsers returns field Users wrapped in UserClassArray helper. +func (p *BotsPopularAppBots) MapUsers() (value UserClassArray) { + return UserClassArray(p.Users) +} diff --git a/vendor/github.com/gotd/td/tg/tl_bots_popular_app_bots_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_popular_app_bots_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_popular_app_bots_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_bots_preview_info_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_preview_info_gen.go new file mode 100644 index 00000000..8a2e382f --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_preview_info_gen.go @@ -0,0 +1,227 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BotsPreviewInfo represents TL type `bots.previewInfo#ca71d64`. +// Contains info about Main Mini App previews, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// +// See https://core.telegram.org/constructor/bots.previewInfo for reference. +type BotsPreviewInfo struct { + // All preview medias for the language code passed to bots.getPreviewInfo¹. + // + // Links: + // 1) https://core.telegram.org/method/bots.getPreviewInfo + Media []BotPreviewMedia + // All available language codes for which preview medias were uploaded (regardless of the + // language code passed to bots.getPreviewInfo¹). + // + // Links: + // 1) https://core.telegram.org/method/bots.getPreviewInfo + LangCodes []string +} + +// BotsPreviewInfoTypeID is TL type id of BotsPreviewInfo. +const BotsPreviewInfoTypeID = 0xca71d64 + +// Ensuring interfaces in compile-time for BotsPreviewInfo. +var ( + _ bin.Encoder = &BotsPreviewInfo{} + _ bin.Decoder = &BotsPreviewInfo{} + _ bin.BareEncoder = &BotsPreviewInfo{} + _ bin.BareDecoder = &BotsPreviewInfo{} +) + +func (p *BotsPreviewInfo) Zero() bool { + if p == nil { + return true + } + if !(p.Media == nil) { + return false + } + if !(p.LangCodes == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *BotsPreviewInfo) String() string { + if p == nil { + return "BotsPreviewInfo(nil)" + } + type Alias BotsPreviewInfo + return fmt.Sprintf("BotsPreviewInfo%+v", Alias(*p)) +} + +// FillFrom fills BotsPreviewInfo from given interface. +func (p *BotsPreviewInfo) FillFrom(from interface { + GetMedia() (value []BotPreviewMedia) + GetLangCodes() (value []string) +}) { + p.Media = from.GetMedia() + p.LangCodes = from.GetLangCodes() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotsPreviewInfo) TypeID() uint32 { + return BotsPreviewInfoTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotsPreviewInfo) TypeName() string { + return "bots.previewInfo" +} + +// TypeInfo returns info about TL type. +func (p *BotsPreviewInfo) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "bots.previewInfo", + ID: BotsPreviewInfoTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Media", + SchemaName: "media", + }, + { + Name: "LangCodes", + SchemaName: "lang_codes", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *BotsPreviewInfo) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode bots.previewInfo#ca71d64 as nil") + } + b.PutID(BotsPreviewInfoTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *BotsPreviewInfo) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode bots.previewInfo#ca71d64 as nil") + } + b.PutVectorHeader(len(p.Media)) + for idx, v := range p.Media { + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.previewInfo#ca71d64: field media element with index %d: %w", idx, err) + } + } + b.PutVectorHeader(len(p.LangCodes)) + for _, v := range p.LangCodes { + b.PutString(v) + } + return nil +} + +// Decode implements bin.Decoder. +func (p *BotsPreviewInfo) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode bots.previewInfo#ca71d64 to nil") + } + if err := b.ConsumeID(BotsPreviewInfoTypeID); err != nil { + return fmt.Errorf("unable to decode bots.previewInfo#ca71d64: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *BotsPreviewInfo) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode bots.previewInfo#ca71d64 to nil") + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode bots.previewInfo#ca71d64: field media: %w", err) + } + + if headerLen > 0 { + p.Media = make([]BotPreviewMedia, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value BotPreviewMedia + if err := value.Decode(b); err != nil { + return fmt.Errorf("unable to decode bots.previewInfo#ca71d64: field media: %w", err) + } + p.Media = append(p.Media, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode bots.previewInfo#ca71d64: field lang_codes: %w", err) + } + + if headerLen > 0 { + p.LangCodes = make([]string, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode bots.previewInfo#ca71d64: field lang_codes: %w", err) + } + p.LangCodes = append(p.LangCodes, value) + } + } + return nil +} + +// GetMedia returns value of Media field. +func (p *BotsPreviewInfo) GetMedia() (value []BotPreviewMedia) { + if p == nil { + return + } + return p.Media +} + +// GetLangCodes returns value of LangCodes field. +func (p *BotsPreviewInfo) GetLangCodes() (value []string) { + if p == nil { + return + } + return p.LangCodes +} diff --git a/vendor/github.com/gotd/td/tg/tl_bots_preview_info_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_preview_info_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_preview_info_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_bots_reorder_preview_medias_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_reorder_preview_medias_gen.go new file mode 100644 index 00000000..149f00b1 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_reorder_preview_medias_gen.go @@ -0,0 +1,274 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BotsReorderPreviewMediasRequest represents TL type `bots.reorderPreviewMedias#b627f3aa`. +// Reorder a main mini app previews, see here »¹ for more info. +// Only owners of bots with a configured Main Mini App can use this method, see see here +// »¹ for more info on how to check if you can invoke this method. +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// 2. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// +// See https://core.telegram.org/method/bots.reorderPreviewMedias for reference. +type BotsReorderPreviewMediasRequest struct { + // The bot that owns the Main Mini App. + Bot InputUserClass + // ISO 639-1 language code, indicating the localization of the previews to reorder. + LangCode string + // New order of the previews. + Order []InputMediaClass +} + +// BotsReorderPreviewMediasRequestTypeID is TL type id of BotsReorderPreviewMediasRequest. +const BotsReorderPreviewMediasRequestTypeID = 0xb627f3aa + +// Ensuring interfaces in compile-time for BotsReorderPreviewMediasRequest. +var ( + _ bin.Encoder = &BotsReorderPreviewMediasRequest{} + _ bin.Decoder = &BotsReorderPreviewMediasRequest{} + _ bin.BareEncoder = &BotsReorderPreviewMediasRequest{} + _ bin.BareDecoder = &BotsReorderPreviewMediasRequest{} +) + +func (r *BotsReorderPreviewMediasRequest) Zero() bool { + if r == nil { + return true + } + if !(r.Bot == nil) { + return false + } + if !(r.LangCode == "") { + return false + } + if !(r.Order == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (r *BotsReorderPreviewMediasRequest) String() string { + if r == nil { + return "BotsReorderPreviewMediasRequest(nil)" + } + type Alias BotsReorderPreviewMediasRequest + return fmt.Sprintf("BotsReorderPreviewMediasRequest%+v", Alias(*r)) +} + +// FillFrom fills BotsReorderPreviewMediasRequest from given interface. +func (r *BotsReorderPreviewMediasRequest) FillFrom(from interface { + GetBot() (value InputUserClass) + GetLangCode() (value string) + GetOrder() (value []InputMediaClass) +}) { + r.Bot = from.GetBot() + r.LangCode = from.GetLangCode() + r.Order = from.GetOrder() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotsReorderPreviewMediasRequest) TypeID() uint32 { + return BotsReorderPreviewMediasRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotsReorderPreviewMediasRequest) TypeName() string { + return "bots.reorderPreviewMedias" +} + +// TypeInfo returns info about TL type. +func (r *BotsReorderPreviewMediasRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "bots.reorderPreviewMedias", + ID: BotsReorderPreviewMediasRequestTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Bot", + SchemaName: "bot", + }, + { + Name: "LangCode", + SchemaName: "lang_code", + }, + { + Name: "Order", + SchemaName: "order", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (r *BotsReorderPreviewMediasRequest) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode bots.reorderPreviewMedias#b627f3aa as nil") + } + b.PutID(BotsReorderPreviewMediasRequestTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *BotsReorderPreviewMediasRequest) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode bots.reorderPreviewMedias#b627f3aa as nil") + } + if r.Bot == nil { + return fmt.Errorf("unable to encode bots.reorderPreviewMedias#b627f3aa: field bot is nil") + } + if err := r.Bot.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.reorderPreviewMedias#b627f3aa: field bot: %w", err) + } + b.PutString(r.LangCode) + b.PutVectorHeader(len(r.Order)) + for idx, v := range r.Order { + if v == nil { + return fmt.Errorf("unable to encode bots.reorderPreviewMedias#b627f3aa: field order element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.reorderPreviewMedias#b627f3aa: field order element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (r *BotsReorderPreviewMediasRequest) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode bots.reorderPreviewMedias#b627f3aa to nil") + } + if err := b.ConsumeID(BotsReorderPreviewMediasRequestTypeID); err != nil { + return fmt.Errorf("unable to decode bots.reorderPreviewMedias#b627f3aa: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *BotsReorderPreviewMediasRequest) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode bots.reorderPreviewMedias#b627f3aa to nil") + } + { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode bots.reorderPreviewMedias#b627f3aa: field bot: %w", err) + } + r.Bot = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode bots.reorderPreviewMedias#b627f3aa: field lang_code: %w", err) + } + r.LangCode = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode bots.reorderPreviewMedias#b627f3aa: field order: %w", err) + } + + if headerLen > 0 { + r.Order = make([]InputMediaClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeInputMedia(b) + if err != nil { + return fmt.Errorf("unable to decode bots.reorderPreviewMedias#b627f3aa: field order: %w", err) + } + r.Order = append(r.Order, value) + } + } + return nil +} + +// GetBot returns value of Bot field. +func (r *BotsReorderPreviewMediasRequest) GetBot() (value InputUserClass) { + if r == nil { + return + } + return r.Bot +} + +// GetLangCode returns value of LangCode field. +func (r *BotsReorderPreviewMediasRequest) GetLangCode() (value string) { + if r == nil { + return + } + return r.LangCode +} + +// GetOrder returns value of Order field. +func (r *BotsReorderPreviewMediasRequest) GetOrder() (value []InputMediaClass) { + if r == nil { + return + } + return r.Order +} + +// MapOrder returns field Order wrapped in InputMediaClassArray helper. +func (r *BotsReorderPreviewMediasRequest) MapOrder() (value InputMediaClassArray) { + return InputMediaClassArray(r.Order) +} + +// BotsReorderPreviewMedias invokes method bots.reorderPreviewMedias#b627f3aa returning error if any. +// Reorder a main mini app previews, see here »¹ for more info. +// Only owners of bots with a configured Main Mini App can use this method, see see here +// »¹ for more info on how to check if you can invoke this method. +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// 2. https://core.telegram.org/api/bots/webapps#main-mini-app-previews +// +// Possible errors: +// +// 400 BOT_INVALID: This is not a valid bot. +// +// See https://core.telegram.org/method/bots.reorderPreviewMedias for reference. +func (c *Client) BotsReorderPreviewMedias(ctx context.Context, request *BotsReorderPreviewMediasRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_bots_reorder_preview_medias_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_reorder_preview_medias_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_bots_reorder_preview_medias_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_bots_reorder_usernames_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_reorder_usernames_gen.go index 073eeae4..43b76ff0 100644 --- a/vendor/github.com/gotd/td/tg/tl_bots_reorder_usernames_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_bots_reorder_usernames_gen.go @@ -212,9 +212,9 @@ func (r *BotsReorderUsernamesRequest) GetOrder() (value []string) { // Possible errors: // // 400 BOT_INVALID: This is not a valid bot. +// 400 USERNAME_NOT_MODIFIED: The username was not modified. // // See https://core.telegram.org/method/bots.reorderUsernames for reference. -// Can be used by bots. func (c *Client) BotsReorderUsernames(ctx context.Context, request *BotsReorderUsernamesRequest) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_bots_reset_bot_commands_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_reset_bot_commands_gen.go index 2b1db27d..07cec2fe 100644 --- a/vendor/github.com/gotd/td/tg/tl_bots_reset_bot_commands_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_bots_reset_bot_commands_gen.go @@ -199,6 +199,7 @@ func (r *BotsResetBotCommandsRequest) GetLangCode() (value string) { // Possible errors: // // 400 LANG_CODE_INVALID: The specified language code is invalid. +// 400 USER_BOT_REQUIRED: This method can only be called by a bot. // // See https://core.telegram.org/method/bots.resetBotCommands for reference. // Can be used by bots. diff --git a/vendor/github.com/gotd/td/tg/tl_bots_send_custom_request_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_send_custom_request_gen.go index 1eba2e2a..55c78d04 100644 --- a/vendor/github.com/gotd/td/tg/tl_bots_send_custom_request_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_bots_send_custom_request_gen.go @@ -196,6 +196,7 @@ func (s *BotsSendCustomRequestRequest) GetParams() (value DataJSON) { // 400 DATA_JSON_INVALID: The provided JSON data is invalid. // 400 METHOD_INVALID: The specified method is invalid. // 403 USER_BOT_INVALID: User accounts must provide the bot method parameter when calling this method. If there is no such method parameter, this method can only be invoked by bot accounts. +// 400 USER_BOT_REQUIRED: This method can only be called by a bot. // // See https://core.telegram.org/method/bots.sendCustomRequest for reference. // Can be used by bots. diff --git a/vendor/github.com/gotd/td/tg/tl_bots_set_bot_broadcast_default_admin_rights_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_set_bot_broadcast_default_admin_rights_gen.go index 88ca3340..1dcf7a35 100644 --- a/vendor/github.com/gotd/td/tg/tl_bots_set_bot_broadcast_default_admin_rights_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_bots_set_bot_broadcast_default_admin_rights_gen.go @@ -177,6 +177,7 @@ func (s *BotsSetBotBroadcastDefaultAdminRightsRequest) GetAdminRights() (value C // Possible errors: // // 400 RIGHTS_NOT_MODIFIED: The new admin rights are equal to the old rights, no change was made. +// 400 USER_BOT_REQUIRED: This method can only be called by a bot. // // See https://core.telegram.org/method/bots.setBotBroadcastDefaultAdminRights for reference. // Can be used by bots. diff --git a/vendor/github.com/gotd/td/tg/tl_bots_set_bot_menu_button_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_set_bot_menu_button_gen.go index f376c1b4..283e0348 100644 --- a/vendor/github.com/gotd/td/tg/tl_bots_set_bot_menu_button_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_bots_set_bot_menu_button_gen.go @@ -211,6 +211,7 @@ func (s *BotsSetBotMenuButtonRequest) GetButton() (value BotMenuButtonClass) { // // 400 BUTTON_TEXT_INVALID: The specified button text is invalid. // 400 BUTTON_URL_INVALID: Button URL invalid. +// 400 USER_BOT_REQUIRED: This method can only be called by a bot. // // See https://core.telegram.org/method/bots.setBotMenuButton for reference. // Can be used by bots. diff --git a/vendor/github.com/gotd/td/tg/tl_bots_toggle_username_gen.go b/vendor/github.com/gotd/td/tg/tl_bots_toggle_username_gen.go index d9d62f7f..569bae3d 100644 --- a/vendor/github.com/gotd/td/tg/tl_bots_toggle_username_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_bots_toggle_username_gen.go @@ -232,9 +232,9 @@ func (t *BotsToggleUsernameRequest) GetActive() (value bool) { // Possible errors: // // 400 BOT_INVALID: This is not a valid bot. +// 400 USERNAME_NOT_MODIFIED: The username was not modified. // // See https://core.telegram.org/method/bots.toggleUsername for reference. -// Can be used by bots. func (c *Client) BotsToggleUsername(ctx context.Context, request *BotsToggleUsernameRequest) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_broadcast_revenue_balances_gen.go b/vendor/github.com/gotd/td/tg/tl_broadcast_revenue_balances_gen.go index 4ee8c6b8..eb1dc11d 100644 --- a/vendor/github.com/gotd/td/tg/tl_broadcast_revenue_balances_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_broadcast_revenue_balances_gen.go @@ -31,20 +31,32 @@ var ( _ = tdjson.Encoder{} ) -// BroadcastRevenueBalances represents TL type `broadcastRevenueBalances#8438f1c6`. +// BroadcastRevenueBalances represents TL type `broadcastRevenueBalances#c3ff71e7`. +// Describes channel ad revenue balances »¹. +// Note that all balances are in the smallest unit of the chosen cryptocurrency +// (currently nanotons for TONs, so to obtain a value in USD divide the chosen amount by +// 10^9, and then divide by usd_rate). +// +// Links: +// 1. https://core.telegram.org/api/revenue // // See https://core.telegram.org/constructor/broadcastRevenueBalances for reference. type BroadcastRevenueBalances struct { - // CurrentBalance field of BroadcastRevenueBalances. + // Flags field of BroadcastRevenueBalances. + Flags bin.Fields + // WithdrawalEnabled field of BroadcastRevenueBalances. + WithdrawalEnabled bool + // Amount of not-yet-withdrawn cryptocurrency. CurrentBalance int64 - // AvailableBalance field of BroadcastRevenueBalances. + // Amount of withdrawable cryptocurrency, out of the currently available balance + // (available_balance <= current_balance). AvailableBalance int64 - // OverallRevenue field of BroadcastRevenueBalances. + // Total amount of earned cryptocurrency. OverallRevenue int64 } // BroadcastRevenueBalancesTypeID is TL type id of BroadcastRevenueBalances. -const BroadcastRevenueBalancesTypeID = 0x8438f1c6 +const BroadcastRevenueBalancesTypeID = 0xc3ff71e7 // Ensuring interfaces in compile-time for BroadcastRevenueBalances. var ( @@ -58,6 +70,12 @@ func (b *BroadcastRevenueBalances) Zero() bool { if b == nil { return true } + if !(b.Flags.Zero()) { + return false + } + if !(b.WithdrawalEnabled == false) { + return false + } if !(b.CurrentBalance == 0) { return false } @@ -82,10 +100,12 @@ func (b *BroadcastRevenueBalances) String() string { // FillFrom fills BroadcastRevenueBalances from given interface. func (b *BroadcastRevenueBalances) FillFrom(from interface { + GetWithdrawalEnabled() (value bool) GetCurrentBalance() (value int64) GetAvailableBalance() (value int64) GetOverallRevenue() (value int64) }) { + b.WithdrawalEnabled = from.GetWithdrawalEnabled() b.CurrentBalance = from.GetCurrentBalance() b.AvailableBalance = from.GetAvailableBalance() b.OverallRevenue = from.GetOverallRevenue() @@ -114,6 +134,11 @@ func (b *BroadcastRevenueBalances) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "WithdrawalEnabled", + SchemaName: "withdrawal_enabled", + Null: !b.Flags.Has(0), + }, { Name: "CurrentBalance", SchemaName: "current_balance", @@ -130,10 +155,17 @@ func (b *BroadcastRevenueBalances) TypeInfo() tdp.Type { return typ } +// SetFlags sets flags for non-zero fields. +func (b *BroadcastRevenueBalances) SetFlags() { + if !(b.WithdrawalEnabled == false) { + b.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (b *BroadcastRevenueBalances) Encode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode broadcastRevenueBalances#8438f1c6 as nil") + return fmt.Errorf("can't encode broadcastRevenueBalances#c3ff71e7 as nil") } buf.PutID(BroadcastRevenueBalancesTypeID) return b.EncodeBare(buf) @@ -142,7 +174,11 @@ func (b *BroadcastRevenueBalances) Encode(buf *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (b *BroadcastRevenueBalances) EncodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode broadcastRevenueBalances#8438f1c6 as nil") + return fmt.Errorf("can't encode broadcastRevenueBalances#c3ff71e7 as nil") + } + b.SetFlags() + if err := b.Flags.Encode(buf); err != nil { + return fmt.Errorf("unable to encode broadcastRevenueBalances#c3ff71e7: field flags: %w", err) } buf.PutLong(b.CurrentBalance) buf.PutLong(b.AvailableBalance) @@ -153,10 +189,10 @@ func (b *BroadcastRevenueBalances) EncodeBare(buf *bin.Buffer) error { // Decode implements bin.Decoder. func (b *BroadcastRevenueBalances) Decode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode broadcastRevenueBalances#8438f1c6 to nil") + return fmt.Errorf("can't decode broadcastRevenueBalances#c3ff71e7 to nil") } if err := buf.ConsumeID(BroadcastRevenueBalancesTypeID); err != nil { - return fmt.Errorf("unable to decode broadcastRevenueBalances#8438f1c6: %w", err) + return fmt.Errorf("unable to decode broadcastRevenueBalances#c3ff71e7: %w", err) } return b.DecodeBare(buf) } @@ -164,32 +200,57 @@ func (b *BroadcastRevenueBalances) Decode(buf *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (b *BroadcastRevenueBalances) DecodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode broadcastRevenueBalances#8438f1c6 to nil") + return fmt.Errorf("can't decode broadcastRevenueBalances#c3ff71e7 to nil") } + { + if err := b.Flags.Decode(buf); err != nil { + return fmt.Errorf("unable to decode broadcastRevenueBalances#c3ff71e7: field flags: %w", err) + } + } + b.WithdrawalEnabled = b.Flags.Has(0) { value, err := buf.Long() if err != nil { - return fmt.Errorf("unable to decode broadcastRevenueBalances#8438f1c6: field current_balance: %w", err) + return fmt.Errorf("unable to decode broadcastRevenueBalances#c3ff71e7: field current_balance: %w", err) } b.CurrentBalance = value } { value, err := buf.Long() if err != nil { - return fmt.Errorf("unable to decode broadcastRevenueBalances#8438f1c6: field available_balance: %w", err) + return fmt.Errorf("unable to decode broadcastRevenueBalances#c3ff71e7: field available_balance: %w", err) } b.AvailableBalance = value } { value, err := buf.Long() if err != nil { - return fmt.Errorf("unable to decode broadcastRevenueBalances#8438f1c6: field overall_revenue: %w", err) + return fmt.Errorf("unable to decode broadcastRevenueBalances#c3ff71e7: field overall_revenue: %w", err) } b.OverallRevenue = value } return nil } +// SetWithdrawalEnabled sets value of WithdrawalEnabled conditional field. +func (b *BroadcastRevenueBalances) SetWithdrawalEnabled(value bool) { + if value { + b.Flags.Set(0) + b.WithdrawalEnabled = true + } else { + b.Flags.Unset(0) + b.WithdrawalEnabled = false + } +} + +// GetWithdrawalEnabled returns value of WithdrawalEnabled conditional field. +func (b *BroadcastRevenueBalances) GetWithdrawalEnabled() (value bool) { + if b == nil { + return + } + return b.Flags.Has(0) +} + // GetCurrentBalance returns value of CurrentBalance field. func (b *BroadcastRevenueBalances) GetCurrentBalance() (value int64) { if b == nil { diff --git a/vendor/github.com/gotd/td/tg/tl_broadcast_revenue_transaction_gen.go b/vendor/github.com/gotd/td/tg/tl_broadcast_revenue_transaction_gen.go index 002ebfa0..5e5e054f 100644 --- a/vendor/github.com/gotd/td/tg/tl_broadcast_revenue_transaction_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_broadcast_revenue_transaction_gen.go @@ -32,14 +32,19 @@ var ( ) // BroadcastRevenueTransactionProceeds represents TL type `broadcastRevenueTransactionProceeds#557e2cc4`. +// Describes earnings from sponsored messages in a channel in some time frame, see here +// »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/revenue // // See https://core.telegram.org/constructor/broadcastRevenueTransactionProceeds for reference. type BroadcastRevenueTransactionProceeds struct { - // Amount field of BroadcastRevenueTransactionProceeds. + // Amount in the smallest unit of the cryptocurrency. Amount int64 - // FromDate field of BroadcastRevenueTransactionProceeds. + // Start unixtime for the timeframe. FromDate int - // ToDate field of BroadcastRevenueTransactionProceeds. + // End unixtime for the timeframe. ToDate int } @@ -220,26 +225,36 @@ func (b *BroadcastRevenueTransactionProceeds) GetToDate() (value int) { } // BroadcastRevenueTransactionWithdrawal represents TL type `broadcastRevenueTransactionWithdrawal#5a590978`. +// Describes a withdrawal of ad earnings »¹ +// +// Links: +// 1. https://core.telegram.org/api/revenue#withdrawing-revenue // // See https://core.telegram.org/constructor/broadcastRevenueTransactionWithdrawal for reference. type BroadcastRevenueTransactionWithdrawal struct { - // Flags field of BroadcastRevenueTransactionWithdrawal. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Pending field of BroadcastRevenueTransactionWithdrawal. + // Whether the withdrawal is currently pending Pending bool - // Failed field of BroadcastRevenueTransactionWithdrawal. + // Whether the withdrawal has failed Failed bool - // Amount field of BroadcastRevenueTransactionWithdrawal. + // Amount withdrawn Amount int64 - // Date field of BroadcastRevenueTransactionWithdrawal. + // Withdrawal date Date int - // Provider field of BroadcastRevenueTransactionWithdrawal. + // Payment provider name Provider string - // TransactionDate field of BroadcastRevenueTransactionWithdrawal. + // If neither pending nor failed are set, the transaction was completed successfully, and + // this field will contain the point in time (Unix timestamp) when the withdrawal was + // completed successfully. // // Use SetTransactionDate and GetTransactionDate helpers. TransactionDate int - // TransactionURL field of BroadcastRevenueTransactionWithdrawal. + // If neither pending nor failed are set, the transaction was completed successfully, and + // this field will contain a URL where the withdrawal transaction can be viewed. // // Use SetTransactionURL and GetTransactionURL helpers. TransactionURL string @@ -594,14 +609,18 @@ func (b *BroadcastRevenueTransactionWithdrawal) GetTransactionURL() (value strin } // BroadcastRevenueTransactionRefund represents TL type `broadcastRevenueTransactionRefund#42d30d2e`. +// Describes a refund for failed withdrawal of ad earnings »¹ +// +// Links: +// 1. https://core.telegram.org/api/revenue#withdrawing-revenue // // See https://core.telegram.org/constructor/broadcastRevenueTransactionRefund for reference. type BroadcastRevenueTransactionRefund struct { - // Amount field of BroadcastRevenueTransactionRefund. + // Amount refunded. Amount int64 - // Date field of BroadcastRevenueTransactionRefund. + // Date of refund. Date int - // Provider field of BroadcastRevenueTransactionRefund. + // Payment provider name. Provider string } @@ -818,7 +837,7 @@ type BroadcastRevenueTransactionClass interface { // Zero returns true if current object has a zero value. Zero() bool - // Amount field of BroadcastRevenueTransactionProceeds. + // Amount in the smallest unit of the cryptocurrency. GetAmount() (value int64) } diff --git a/vendor/github.com/gotd/td/tg/tl_business_away_message_gen.go b/vendor/github.com/gotd/td/tg/tl_business_away_message_gen.go index 236faffd..183b5c77 100644 --- a/vendor/github.com/gotd/td/tg/tl_business_away_message_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_business_away_message_gen.go @@ -32,18 +32,31 @@ var ( ) // BusinessAwayMessage represents TL type `businessAwayMessage#ef156a5c`. +// Describes a Telegram Business away message¹, automatically sent to users writing to +// us when we're offline, during closing hours, while we're on vacation, or in some other +// custom time period when we cannot immediately answer to the user. +// +// Links: +// 1. https://core.telegram.org/api/business#away-messages // // See https://core.telegram.org/constructor/businessAwayMessage for reference. type BusinessAwayMessage struct { - // Flags field of BusinessAwayMessage. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // OfflineOnly field of BusinessAwayMessage. + // If set, the messages will not be sent if the account was online in the last 10 minutes. OfflineOnly bool - // ShortcutID field of BusinessAwayMessage. + // ID of a quick reply shorcut, containing the away messages to send, see here » for + // more info¹. + // + // Links: + // 1) https://core.telegram.org/api/business#quick-reply-shortcuts ShortcutID int - // Schedule field of BusinessAwayMessage. + // Specifies when should the away messages be sent. Schedule BusinessAwayMessageScheduleClass - // Recipients field of BusinessAwayMessage. + // Allowed recipients for the away messages. Recipients BusinessRecipients } diff --git a/vendor/github.com/gotd/td/tg/tl_business_away_message_schedule_gen.go b/vendor/github.com/gotd/td/tg/tl_business_away_message_schedule_gen.go index 836a884e..ae514171 100644 --- a/vendor/github.com/gotd/td/tg/tl_business_away_message_schedule_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_business_away_message_schedule_gen.go @@ -32,6 +32,10 @@ var ( ) // BusinessAwayMessageScheduleAlways represents TL type `businessAwayMessageScheduleAlways#c9b9e2b9`. +// Always send Telegram Business away messages¹ to users writing to us in private. +// +// Links: +// 1. https://core.telegram.org/api/business#away-messages // // See https://core.telegram.org/constructor/businessAwayMessageScheduleAlways for reference. type BusinessAwayMessageScheduleAlways struct { @@ -133,6 +137,12 @@ func (b *BusinessAwayMessageScheduleAlways) DecodeBare(buf *bin.Buffer) error { } // BusinessAwayMessageScheduleOutsideWorkHours represents TL type `businessAwayMessageScheduleOutsideWorkHours#c3f2f501`. +// Send Telegram Business away messages¹ to users writing to us in private outside of +// the configured Telegram Business working hours². +// +// Links: +// 1. https://core.telegram.org/api/business#away-messages +// 2. https://core.telegram.org/api/business#opening-hours // // See https://core.telegram.org/constructor/businessAwayMessageScheduleOutsideWorkHours for reference. type BusinessAwayMessageScheduleOutsideWorkHours struct { @@ -236,12 +246,17 @@ func (b *BusinessAwayMessageScheduleOutsideWorkHours) DecodeBare(buf *bin.Buffer } // BusinessAwayMessageScheduleCustom represents TL type `businessAwayMessageScheduleCustom#cc4d9ecc`. +// Send Telegram Business away messages¹ to users writing to us in private in the +// specified time span. +// +// Links: +// 1. https://core.telegram.org/api/business#away-messages // // See https://core.telegram.org/constructor/businessAwayMessageScheduleCustom for reference. type BusinessAwayMessageScheduleCustom struct { - // StartDate field of BusinessAwayMessageScheduleCustom. + // Start date (UNIX timestamp). StartDate int - // EndDate field of BusinessAwayMessageScheduleCustom. + // End date (UNIX timestamp). EndDate int } diff --git a/vendor/github.com/gotd/td/tg/tl_business_bot_recipients_gen.go b/vendor/github.com/gotd/td/tg/tl_business_bot_recipients_gen.go index 315ff02e..e4fa8917 100644 --- a/vendor/github.com/gotd/td/tg/tl_business_bot_recipients_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_business_bot_recipients_gen.go @@ -32,26 +32,37 @@ var ( ) // BusinessBotRecipients represents TL type `businessBotRecipients#b88cf373`. +// Specifies the private chats that a connected business bot »¹ may receive messages +// and interact with. +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots // // See https://core.telegram.org/constructor/businessBotRecipients for reference. type BusinessBotRecipients struct { - // Flags field of BusinessBotRecipients. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // ExistingChats field of BusinessBotRecipients. + // Selects all existing private chats. ExistingChats bool - // NewChats field of BusinessBotRecipients. + // Selects all new private chats. NewChats bool - // Contacts field of BusinessBotRecipients. + // Selects all private chats with contacts. Contacts bool - // NonContacts field of BusinessBotRecipients. + // Selects all private chats with non-contacts. NonContacts bool - // ExcludeSelected field of BusinessBotRecipients. + // If set, then all private chats except the ones selected by existing_chats, new_chats, + // contacts, non_contacts and users are chosen. Note that if this flag is set, any values + // passed in exclude_users will be merged and moved into users by the server, thus + // exclude_users will always be empty. ExcludeSelected bool - // Users field of BusinessBotRecipients. + // Explicitly selected private chats. // // Use SetUsers and GetUsers helpers. Users []int64 - // ExcludeUsers field of BusinessBotRecipients. + // Identifiers of private chats that are always excluded. // // Use SetExcludeUsers and GetExcludeUsers helpers. ExcludeUsers []int64 diff --git a/vendor/github.com/gotd/td/tg/tl_business_chat_link_gen.go b/vendor/github.com/gotd/td/tg/tl_business_chat_link_gen.go index 3ea17e29..07b60cb9 100644 --- a/vendor/github.com/gotd/td/tg/tl_business_chat_link_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_business_chat_link_gen.go @@ -32,24 +32,38 @@ var ( ) // BusinessChatLink represents TL type `businessChatLink#b4ae666f`. +// Contains info about a business chat deep link »¹ created by the current account. +// +// Links: +// 1. https://core.telegram.org/api/business#business-chat-links // // See https://core.telegram.org/constructor/businessChatLink for reference. type BusinessChatLink struct { - // Flags field of BusinessChatLink. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Link field of BusinessChatLink. + // Business chat deep link¹. + // + // Links: + // 1) https://core.telegram.org/api/links#business-chat-links Link string - // Message field of BusinessChatLink. + // Message to pre-fill in the message input field. Message string - // Entities field of BusinessChatLink. + // Message entities for styled text¹ + // + // Links: + // 1) https://core.telegram.org/api/entities // // Use SetEntities and GetEntities helpers. Entities []MessageEntityClass - // Title field of BusinessChatLink. + // Human-readable name of the link, to simplify management in the UI (only visible to the + // creator of the link). // // Use SetTitle and GetTitle helpers. Title string - // Views field of BusinessChatLink. + // Number of times the link was resolved (clicked/scanned/etc...). Views int } diff --git a/vendor/github.com/gotd/td/tg/tl_business_greeting_message_gen.go b/vendor/github.com/gotd/td/tg/tl_business_greeting_message_gen.go index a8e29ed3..aa161b5a 100644 --- a/vendor/github.com/gotd/td/tg/tl_business_greeting_message_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_business_greeting_message_gen.go @@ -32,14 +32,24 @@ var ( ) // BusinessGreetingMessage represents TL type `businessGreetingMessage#e519abab`. +// Describes a Telegram Business greeting¹, automatically sent to new users writing to +// us in private for the first time, or after a certain inactivity period. +// +// Links: +// 1. https://core.telegram.org/api/business#greeting-messages // // See https://core.telegram.org/constructor/businessGreetingMessage for reference. type BusinessGreetingMessage struct { - // ShortcutID field of BusinessGreetingMessage. + // ID of a quick reply shorcut, containing the greeting messages to send, see here » for + // more info¹. + // + // Links: + // 1) https://core.telegram.org/api/business#quick-reply-shortcuts ShortcutID int - // Recipients field of BusinessGreetingMessage. + // Allowed recipients for the greeting messages. Recipients BusinessRecipients - // NoActivityDays field of BusinessGreetingMessage. + // The number of days after which a private chat will be considered as inactive; + // currently, must be one of 7, 14, 21, or 28. NoActivityDays int } diff --git a/vendor/github.com/gotd/td/tg/tl_business_intro_gen.go b/vendor/github.com/gotd/td/tg/tl_business_intro_gen.go index 328bd233..fbf31da9 100644 --- a/vendor/github.com/gotd/td/tg/tl_business_intro_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_business_intro_gen.go @@ -32,16 +32,32 @@ var ( ) // BusinessIntro represents TL type `businessIntro#5a0a066d`. +// Telegram Business introduction »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#business-introduction // // See https://core.telegram.org/constructor/businessIntro for reference. type BusinessIntro struct { - // Flags field of BusinessIntro. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Title field of BusinessIntro. + // Title of the introduction message (max intro_title_length_limit »¹ UTF-8 characters). + // + // Links: + // 1) https://core.telegram.org/api/config#intro-title-length-limit Title string - // Description field of BusinessIntro. + // Profile introduction (max intro_description_length_limit »¹ UTF-8 characters). + // + // Links: + // 1) https://core.telegram.org/api/config#intro-description-length-limit Description string - // Sticker field of BusinessIntro. + // Optional introduction sticker¹. + // + // Links: + // 1) https://core.telegram.org/api/stickers // // Use SetSticker and GetSticker helpers. Sticker DocumentClass diff --git a/vendor/github.com/gotd/td/tg/tl_business_location_gen.go b/vendor/github.com/gotd/td/tg/tl_business_location_gen.go index 2ca1f726..fc039f7a 100644 --- a/vendor/github.com/gotd/td/tg/tl_business_location_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_business_location_gen.go @@ -32,16 +32,23 @@ var ( ) // BusinessLocation represents TL type `businessLocation#ac5c1af7`. +// Represents the location of a Telegram Business »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#location // // See https://core.telegram.org/constructor/businessLocation for reference. type BusinessLocation struct { - // Flags field of BusinessLocation. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // GeoPoint field of BusinessLocation. + // Geographical coordinates (optional). // // Use SetGeoPoint and GetGeoPoint helpers. GeoPoint GeoPointClass - // Address field of BusinessLocation. + // Textual description of the address (mandatory). Address string } diff --git a/vendor/github.com/gotd/td/tg/tl_business_recipients_gen.go b/vendor/github.com/gotd/td/tg/tl_business_recipients_gen.go index 5dd11d45..b213f513 100644 --- a/vendor/github.com/gotd/td/tg/tl_business_recipients_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_business_recipients_gen.go @@ -32,22 +32,35 @@ var ( ) // BusinessRecipients represents TL type `businessRecipients#21108ff7`. +// Specifies the chats that can receive Telegram Business away »¹ and greeting »² +// messages. +// If exclude_selected is set, specifies all chats that cannot receive Telegram Business +// away »¹ and greeting »² messages. +// +// Links: +// 1. https://core.telegram.org/api/business#away-messages +// 2. https://core.telegram.org/api/business#greeting-messages +// 3. https://core.telegram.org/api/business#away-messages +// 4. https://core.telegram.org/api/business#greeting-messages // // See https://core.telegram.org/constructor/businessRecipients for reference. type BusinessRecipients struct { - // Flags field of BusinessRecipients. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // ExistingChats field of BusinessRecipients. + // All existing private chats. ExistingChats bool - // NewChats field of BusinessRecipients. + // All new private chats. NewChats bool - // Contacts field of BusinessRecipients. + // All private chats with contacts. Contacts bool - // NonContacts field of BusinessRecipients. + // All private chats with non-contacts. NonContacts bool - // ExcludeSelected field of BusinessRecipients. + // If set, inverts the selection. ExcludeSelected bool - // Users field of BusinessRecipients. + // Only private chats with the specified users. // // Use SetUsers and GetUsers helpers. Users []int64 diff --git a/vendor/github.com/gotd/td/tg/tl_business_weekly_open_gen.go b/vendor/github.com/gotd/td/tg/tl_business_weekly_open_gen.go index adfd24a8..a7269043 100644 --- a/vendor/github.com/gotd/td/tg/tl_business_weekly_open_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_business_weekly_open_gen.go @@ -32,12 +32,24 @@ var ( ) // BusinessWeeklyOpen represents TL type `businessWeeklyOpen#120b1ab9`. +// A time interval, indicating the opening hours of a business. +// Note that opening hours specified by the user must be appropriately validated and +// transformed before uploading them to the server, as specified here »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#opening-hours // // See https://core.telegram.org/constructor/businessWeeklyOpen for reference. type BusinessWeeklyOpen struct { - // StartMinute field of BusinessWeeklyOpen. + // Start minute in minutes of the week, 0 to 7*24*60 inclusively. StartMinute int - // EndMinute field of BusinessWeeklyOpen. + // End minute in minutes of the week, 1 to 8*24*60 inclusively (8 and not 7 because this + // allows to specify intervals that, for example, start on Sunday 21:00 and end on Monday + // 04:00 (6*24*60+21*60 to 7*24*60+4*60) without passing an invalid end_minute < + // start_minute). See here »¹ for more info. + // + // Links: + // 1) https://core.telegram.org/api/business#opening-hours EndMinute int } diff --git a/vendor/github.com/gotd/td/tg/tl_business_work_hours_gen.go b/vendor/github.com/gotd/td/tg/tl_business_work_hours_gen.go index 4cb1698f..b994094e 100644 --- a/vendor/github.com/gotd/td/tg/tl_business_work_hours_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_business_work_hours_gen.go @@ -32,16 +32,43 @@ var ( ) // BusinessWorkHours represents TL type `businessWorkHours#8c92b098`. +// Specifies a set of Telegram Business opening hours¹. +// +// Links: +// 1. https://core.telegram.org/api/business#opening-hours // // See https://core.telegram.org/constructor/businessWorkHours for reference. type BusinessWorkHours struct { - // Flags field of BusinessWorkHours. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // OpenNow field of BusinessWorkHours. + // Ignored if set while invoking account.updateBusinessWorkHours¹, only returned by the + // server in userFull².business_work_hours, indicating whether the business is currently + // open according to the current time and the values in weekly_open and timezone. + // + // Links: + // 1) https://core.telegram.org/method/account.updateBusinessWorkHours + // 2) https://core.telegram.org/constructor/userFull OpenNow bool - // TimezoneID field of BusinessWorkHours. + // An ID of one of the timezones returned by help.getTimezonesList¹. The timezone ID + // is contained timezone².id, a human-readable, localized name of the timezone is + // available in timezone³.name and the timezone⁴.utc_offset field contains the UTC + // offset in seconds, which may be displayed in hh:mm format by the client together with + // the human-readable name (i.e. $name UTC -01:00). + // + // Links: + // 1) https://core.telegram.org/method/help.getTimezonesList + // 2) https://core.telegram.org/constructor/timezone + // 3) https://core.telegram.org/constructor/timezone + // 4) https://core.telegram.org/constructor/timezone TimezoneID string - // WeeklyOpen field of BusinessWorkHours. + // A list of time intervals (max 28) represented by businessWeeklyOpen »¹, indicating + // the opening hours of their business. + // + // Links: + // 1) https://core.telegram.org/constructor/businessWeeklyOpen WeeklyOpen []BusinessWeeklyOpen } diff --git a/vendor/github.com/gotd/td/tg/tl_channel_admin_log_event_action_gen.go b/vendor/github.com/gotd/td/tg/tl_channel_admin_log_event_action_gen.go index 50167bd4..3ee56e7a 100644 --- a/vendor/github.com/gotd/td/tg/tl_channel_admin_log_event_action_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channel_admin_log_event_action_gen.go @@ -7396,12 +7396,16 @@ func (c *ChannelAdminLogEventActionChangeEmojiStatus) GetNewValue() (value Emoji } // ChannelAdminLogEventActionChangeEmojiStickerSet represents TL type `channelAdminLogEventActionChangeEmojiStickerSet#46d840ab`. +// The supergroup's custom emoji stickerset¹ was changed. +// +// Links: +// 1. https://core.telegram.org/api/boost#setting-a-custom-emoji-stickerset-for-supergroups // // See https://core.telegram.org/constructor/channelAdminLogEventActionChangeEmojiStickerSet for reference. type ChannelAdminLogEventActionChangeEmojiStickerSet struct { - // PrevStickerset field of ChannelAdminLogEventActionChangeEmojiStickerSet. + // Old value PrevStickerset InputStickerSetClass - // NewStickerset field of ChannelAdminLogEventActionChangeEmojiStickerSet. + // New value NewStickerset InputStickerSetClass } @@ -7568,6 +7572,315 @@ func (c *ChannelAdminLogEventActionChangeEmojiStickerSet) GetNewStickerset() (va return c.NewStickerset } +// ChannelAdminLogEventActionToggleSignatureProfiles represents TL type `channelAdminLogEventActionToggleSignatureProfiles#60a79c79`. +// +// See https://core.telegram.org/constructor/channelAdminLogEventActionToggleSignatureProfiles for reference. +type ChannelAdminLogEventActionToggleSignatureProfiles struct { + // NewValue field of ChannelAdminLogEventActionToggleSignatureProfiles. + NewValue bool +} + +// ChannelAdminLogEventActionToggleSignatureProfilesTypeID is TL type id of ChannelAdminLogEventActionToggleSignatureProfiles. +const ChannelAdminLogEventActionToggleSignatureProfilesTypeID = 0x60a79c79 + +// construct implements constructor of ChannelAdminLogEventActionClass. +func (c ChannelAdminLogEventActionToggleSignatureProfiles) construct() ChannelAdminLogEventActionClass { + return &c +} + +// Ensuring interfaces in compile-time for ChannelAdminLogEventActionToggleSignatureProfiles. +var ( + _ bin.Encoder = &ChannelAdminLogEventActionToggleSignatureProfiles{} + _ bin.Decoder = &ChannelAdminLogEventActionToggleSignatureProfiles{} + _ bin.BareEncoder = &ChannelAdminLogEventActionToggleSignatureProfiles{} + _ bin.BareDecoder = &ChannelAdminLogEventActionToggleSignatureProfiles{} + + _ ChannelAdminLogEventActionClass = &ChannelAdminLogEventActionToggleSignatureProfiles{} +) + +func (c *ChannelAdminLogEventActionToggleSignatureProfiles) Zero() bool { + if c == nil { + return true + } + if !(c.NewValue == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChannelAdminLogEventActionToggleSignatureProfiles) String() string { + if c == nil { + return "ChannelAdminLogEventActionToggleSignatureProfiles(nil)" + } + type Alias ChannelAdminLogEventActionToggleSignatureProfiles + return fmt.Sprintf("ChannelAdminLogEventActionToggleSignatureProfiles%+v", Alias(*c)) +} + +// FillFrom fills ChannelAdminLogEventActionToggleSignatureProfiles from given interface. +func (c *ChannelAdminLogEventActionToggleSignatureProfiles) FillFrom(from interface { + GetNewValue() (value bool) +}) { + c.NewValue = from.GetNewValue() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChannelAdminLogEventActionToggleSignatureProfiles) TypeID() uint32 { + return ChannelAdminLogEventActionToggleSignatureProfilesTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChannelAdminLogEventActionToggleSignatureProfiles) TypeName() string { + return "channelAdminLogEventActionToggleSignatureProfiles" +} + +// TypeInfo returns info about TL type. +func (c *ChannelAdminLogEventActionToggleSignatureProfiles) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "channelAdminLogEventActionToggleSignatureProfiles", + ID: ChannelAdminLogEventActionToggleSignatureProfilesTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "NewValue", + SchemaName: "new_value", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChannelAdminLogEventActionToggleSignatureProfiles) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode channelAdminLogEventActionToggleSignatureProfiles#60a79c79 as nil") + } + b.PutID(ChannelAdminLogEventActionToggleSignatureProfilesTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChannelAdminLogEventActionToggleSignatureProfiles) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode channelAdminLogEventActionToggleSignatureProfiles#60a79c79 as nil") + } + b.PutBool(c.NewValue) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChannelAdminLogEventActionToggleSignatureProfiles) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode channelAdminLogEventActionToggleSignatureProfiles#60a79c79 to nil") + } + if err := b.ConsumeID(ChannelAdminLogEventActionToggleSignatureProfilesTypeID); err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionToggleSignatureProfiles#60a79c79: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChannelAdminLogEventActionToggleSignatureProfiles) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode channelAdminLogEventActionToggleSignatureProfiles#60a79c79 to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionToggleSignatureProfiles#60a79c79: field new_value: %w", err) + } + c.NewValue = value + } + return nil +} + +// GetNewValue returns value of NewValue field. +func (c *ChannelAdminLogEventActionToggleSignatureProfiles) GetNewValue() (value bool) { + if c == nil { + return + } + return c.NewValue +} + +// ChannelAdminLogEventActionParticipantSubExtend represents TL type `channelAdminLogEventActionParticipantSubExtend#64642db3`. +// +// See https://core.telegram.org/constructor/channelAdminLogEventActionParticipantSubExtend for reference. +type ChannelAdminLogEventActionParticipantSubExtend struct { + // PrevParticipant field of ChannelAdminLogEventActionParticipantSubExtend. + PrevParticipant ChannelParticipantClass + // NewParticipant field of ChannelAdminLogEventActionParticipantSubExtend. + NewParticipant ChannelParticipantClass +} + +// ChannelAdminLogEventActionParticipantSubExtendTypeID is TL type id of ChannelAdminLogEventActionParticipantSubExtend. +const ChannelAdminLogEventActionParticipantSubExtendTypeID = 0x64642db3 + +// construct implements constructor of ChannelAdminLogEventActionClass. +func (c ChannelAdminLogEventActionParticipantSubExtend) construct() ChannelAdminLogEventActionClass { + return &c +} + +// Ensuring interfaces in compile-time for ChannelAdminLogEventActionParticipantSubExtend. +var ( + _ bin.Encoder = &ChannelAdminLogEventActionParticipantSubExtend{} + _ bin.Decoder = &ChannelAdminLogEventActionParticipantSubExtend{} + _ bin.BareEncoder = &ChannelAdminLogEventActionParticipantSubExtend{} + _ bin.BareDecoder = &ChannelAdminLogEventActionParticipantSubExtend{} + + _ ChannelAdminLogEventActionClass = &ChannelAdminLogEventActionParticipantSubExtend{} +) + +func (c *ChannelAdminLogEventActionParticipantSubExtend) Zero() bool { + if c == nil { + return true + } + if !(c.PrevParticipant == nil) { + return false + } + if !(c.NewParticipant == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChannelAdminLogEventActionParticipantSubExtend) String() string { + if c == nil { + return "ChannelAdminLogEventActionParticipantSubExtend(nil)" + } + type Alias ChannelAdminLogEventActionParticipantSubExtend + return fmt.Sprintf("ChannelAdminLogEventActionParticipantSubExtend%+v", Alias(*c)) +} + +// FillFrom fills ChannelAdminLogEventActionParticipantSubExtend from given interface. +func (c *ChannelAdminLogEventActionParticipantSubExtend) FillFrom(from interface { + GetPrevParticipant() (value ChannelParticipantClass) + GetNewParticipant() (value ChannelParticipantClass) +}) { + c.PrevParticipant = from.GetPrevParticipant() + c.NewParticipant = from.GetNewParticipant() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChannelAdminLogEventActionParticipantSubExtend) TypeID() uint32 { + return ChannelAdminLogEventActionParticipantSubExtendTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChannelAdminLogEventActionParticipantSubExtend) TypeName() string { + return "channelAdminLogEventActionParticipantSubExtend" +} + +// TypeInfo returns info about TL type. +func (c *ChannelAdminLogEventActionParticipantSubExtend) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "channelAdminLogEventActionParticipantSubExtend", + ID: ChannelAdminLogEventActionParticipantSubExtendTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "PrevParticipant", + SchemaName: "prev_participant", + }, + { + Name: "NewParticipant", + SchemaName: "new_participant", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChannelAdminLogEventActionParticipantSubExtend) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode channelAdminLogEventActionParticipantSubExtend#64642db3 as nil") + } + b.PutID(ChannelAdminLogEventActionParticipantSubExtendTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChannelAdminLogEventActionParticipantSubExtend) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode channelAdminLogEventActionParticipantSubExtend#64642db3 as nil") + } + if c.PrevParticipant == nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionParticipantSubExtend#64642db3: field prev_participant is nil") + } + if err := c.PrevParticipant.Encode(b); err != nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionParticipantSubExtend#64642db3: field prev_participant: %w", err) + } + if c.NewParticipant == nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionParticipantSubExtend#64642db3: field new_participant is nil") + } + if err := c.NewParticipant.Encode(b); err != nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionParticipantSubExtend#64642db3: field new_participant: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (c *ChannelAdminLogEventActionParticipantSubExtend) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode channelAdminLogEventActionParticipantSubExtend#64642db3 to nil") + } + if err := b.ConsumeID(ChannelAdminLogEventActionParticipantSubExtendTypeID); err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionParticipantSubExtend#64642db3: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChannelAdminLogEventActionParticipantSubExtend) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode channelAdminLogEventActionParticipantSubExtend#64642db3 to nil") + } + { + value, err := DecodeChannelParticipant(b) + if err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionParticipantSubExtend#64642db3: field prev_participant: %w", err) + } + c.PrevParticipant = value + } + { + value, err := DecodeChannelParticipant(b) + if err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionParticipantSubExtend#64642db3: field new_participant: %w", err) + } + c.NewParticipant = value + } + return nil +} + +// GetPrevParticipant returns value of PrevParticipant field. +func (c *ChannelAdminLogEventActionParticipantSubExtend) GetPrevParticipant() (value ChannelParticipantClass) { + if c == nil { + return + } + return c.PrevParticipant +} + +// GetNewParticipant returns value of NewParticipant field. +func (c *ChannelAdminLogEventActionParticipantSubExtend) GetNewParticipant() (value ChannelParticipantClass) { + if c == nil { + return + } + return c.NewParticipant +} + // ChannelAdminLogEventActionClassName is schema name of ChannelAdminLogEventActionClass. const ChannelAdminLogEventActionClassName = "ChannelAdminLogEventAction" @@ -7630,6 +7943,8 @@ const ChannelAdminLogEventActionClassName = "ChannelAdminLogEventAction" // case *tg.ChannelAdminLogEventActionChangeWallpaper: // channelAdminLogEventActionChangeWallpaper#31bb5d52 // case *tg.ChannelAdminLogEventActionChangeEmojiStatus: // channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 // case *tg.ChannelAdminLogEventActionChangeEmojiStickerSet: // channelAdminLogEventActionChangeEmojiStickerSet#46d840ab +// case *tg.ChannelAdminLogEventActionToggleSignatureProfiles: // channelAdminLogEventActionToggleSignatureProfiles#60a79c79 +// case *tg.ChannelAdminLogEventActionParticipantSubExtend: // channelAdminLogEventActionParticipantSubExtend#64642db3 // default: panic(v) // } type ChannelAdminLogEventActionClass interface { @@ -7994,6 +8309,20 @@ func DecodeChannelAdminLogEventAction(buf *bin.Buffer) (ChannelAdminLogEventActi return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", err) } return &v, nil + case ChannelAdminLogEventActionToggleSignatureProfilesTypeID: + // Decoding channelAdminLogEventActionToggleSignatureProfiles#60a79c79. + v := ChannelAdminLogEventActionToggleSignatureProfiles{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", err) + } + return &v, nil + case ChannelAdminLogEventActionParticipantSubExtendTypeID: + // Decoding channelAdminLogEventActionParticipantSubExtend#64642db3. + v := ChannelAdminLogEventActionParticipantSubExtend{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", bin.NewUnexpectedID(id)) } diff --git a/vendor/github.com/gotd/td/tg/tl_channel_admin_log_event_action_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_channel_admin_log_event_action_slices_gen.go index fa1a7d16..eb08c335 100644 --- a/vendor/github.com/gotd/td/tg/tl_channel_admin_log_event_action_slices_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channel_admin_log_event_action_slices_gen.go @@ -714,6 +714,32 @@ func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionChange return to } +// AsChannelAdminLogEventActionToggleSignatureProfiles returns copy with only ChannelAdminLogEventActionToggleSignatureProfiles constructors. +func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionToggleSignatureProfiles() (to ChannelAdminLogEventActionToggleSignatureProfilesArray) { + for _, elem := range s { + value, ok := elem.(*ChannelAdminLogEventActionToggleSignatureProfiles) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsChannelAdminLogEventActionParticipantSubExtend returns copy with only ChannelAdminLogEventActionParticipantSubExtend constructors. +func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionParticipantSubExtend() (to ChannelAdminLogEventActionParticipantSubExtendArray) { + for _, elem := range s { + value, ok := elem.(*ChannelAdminLogEventActionParticipantSubExtend) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // ChannelAdminLogEventActionChangeTitleArray is adapter for slice of ChannelAdminLogEventActionChangeTitle. type ChannelAdminLogEventActionChangeTitleArray []ChannelAdminLogEventActionChangeTitle @@ -4485,3 +4511,167 @@ func (s *ChannelAdminLogEventActionChangeEmojiStickerSetArray) Pop() (v ChannelA return v, true } + +// ChannelAdminLogEventActionToggleSignatureProfilesArray is adapter for slice of ChannelAdminLogEventActionToggleSignatureProfiles. +type ChannelAdminLogEventActionToggleSignatureProfilesArray []ChannelAdminLogEventActionToggleSignatureProfiles + +// Sort sorts slice of ChannelAdminLogEventActionToggleSignatureProfiles. +func (s ChannelAdminLogEventActionToggleSignatureProfilesArray) Sort(less func(a, b ChannelAdminLogEventActionToggleSignatureProfiles) bool) ChannelAdminLogEventActionToggleSignatureProfilesArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of ChannelAdminLogEventActionToggleSignatureProfiles. +func (s ChannelAdminLogEventActionToggleSignatureProfilesArray) SortStable(less func(a, b ChannelAdminLogEventActionToggleSignatureProfiles) bool) ChannelAdminLogEventActionToggleSignatureProfilesArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of ChannelAdminLogEventActionToggleSignatureProfiles. +func (s ChannelAdminLogEventActionToggleSignatureProfilesArray) Retain(keep func(x ChannelAdminLogEventActionToggleSignatureProfiles) bool) ChannelAdminLogEventActionToggleSignatureProfilesArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s ChannelAdminLogEventActionToggleSignatureProfilesArray) First() (v ChannelAdminLogEventActionToggleSignatureProfiles, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s ChannelAdminLogEventActionToggleSignatureProfilesArray) Last() (v ChannelAdminLogEventActionToggleSignatureProfiles, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *ChannelAdminLogEventActionToggleSignatureProfilesArray) PopFirst() (v ChannelAdminLogEventActionToggleSignatureProfiles, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero ChannelAdminLogEventActionToggleSignatureProfiles + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *ChannelAdminLogEventActionToggleSignatureProfilesArray) Pop() (v ChannelAdminLogEventActionToggleSignatureProfiles, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// ChannelAdminLogEventActionParticipantSubExtendArray is adapter for slice of ChannelAdminLogEventActionParticipantSubExtend. +type ChannelAdminLogEventActionParticipantSubExtendArray []ChannelAdminLogEventActionParticipantSubExtend + +// Sort sorts slice of ChannelAdminLogEventActionParticipantSubExtend. +func (s ChannelAdminLogEventActionParticipantSubExtendArray) Sort(less func(a, b ChannelAdminLogEventActionParticipantSubExtend) bool) ChannelAdminLogEventActionParticipantSubExtendArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of ChannelAdminLogEventActionParticipantSubExtend. +func (s ChannelAdminLogEventActionParticipantSubExtendArray) SortStable(less func(a, b ChannelAdminLogEventActionParticipantSubExtend) bool) ChannelAdminLogEventActionParticipantSubExtendArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of ChannelAdminLogEventActionParticipantSubExtend. +func (s ChannelAdminLogEventActionParticipantSubExtendArray) Retain(keep func(x ChannelAdminLogEventActionParticipantSubExtend) bool) ChannelAdminLogEventActionParticipantSubExtendArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s ChannelAdminLogEventActionParticipantSubExtendArray) First() (v ChannelAdminLogEventActionParticipantSubExtend, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s ChannelAdminLogEventActionParticipantSubExtendArray) Last() (v ChannelAdminLogEventActionParticipantSubExtend, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *ChannelAdminLogEventActionParticipantSubExtendArray) PopFirst() (v ChannelAdminLogEventActionParticipantSubExtend, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero ChannelAdminLogEventActionParticipantSubExtend + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *ChannelAdminLogEventActionParticipantSubExtendArray) Pop() (v ChannelAdminLogEventActionParticipantSubExtend, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/vendor/github.com/gotd/td/tg/tl_channel_admin_log_events_filter_gen.go b/vendor/github.com/gotd/td/tg/tl_channel_admin_log_events_filter_gen.go index ef53ad64..5c05201d 100644 --- a/vendor/github.com/gotd/td/tg/tl_channel_admin_log_events_filter_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channel_admin_log_events_filter_gen.go @@ -139,6 +139,8 @@ type ChannelAdminLogEventsFilter struct { // Links: // 1) https://core.telegram.org/api/forum Forums bool + // SubExtend field of ChannelAdminLogEventsFilter. + SubExtend bool } // ChannelAdminLogEventsFilterTypeID is TL type id of ChannelAdminLogEventsFilter. @@ -213,6 +215,9 @@ func (c *ChannelAdminLogEventsFilter) Zero() bool { if !(c.Forums == false) { return false } + if !(c.SubExtend == false) { + return false + } return true } @@ -246,6 +251,7 @@ func (c *ChannelAdminLogEventsFilter) FillFrom(from interface { GetInvites() (value bool) GetSend() (value bool) GetForums() (value bool) + GetSubExtend() (value bool) }) { c.Join = from.GetJoin() c.Leave = from.GetLeave() @@ -265,6 +271,7 @@ func (c *ChannelAdminLogEventsFilter) FillFrom(from interface { c.Invites = from.GetInvites() c.Send = from.GetSend() c.Forums = from.GetForums() + c.SubExtend = from.GetSubExtend() } // TypeID returns type id in TL schema. @@ -380,6 +387,11 @@ func (c *ChannelAdminLogEventsFilter) TypeInfo() tdp.Type { SchemaName: "forums", Null: !c.Flags.Has(17), }, + { + Name: "SubExtend", + SchemaName: "sub_extend", + Null: !c.Flags.Has(18), + }, } return typ } @@ -440,6 +452,9 @@ func (c *ChannelAdminLogEventsFilter) SetFlags() { if !(c.Forums == false) { c.Flags.Set(17) } + if !(c.SubExtend == false) { + c.Flags.Set(18) + } } // Encode implements bin.Encoder. @@ -502,6 +517,7 @@ func (c *ChannelAdminLogEventsFilter) DecodeBare(b *bin.Buffer) error { c.Invites = c.Flags.Has(15) c.Send = c.Flags.Has(16) c.Forums = c.Flags.Has(17) + c.SubExtend = c.Flags.Has(18) return nil } @@ -846,3 +862,22 @@ func (c *ChannelAdminLogEventsFilter) GetForums() (value bool) { } return c.Flags.Has(17) } + +// SetSubExtend sets value of SubExtend conditional field. +func (c *ChannelAdminLogEventsFilter) SetSubExtend(value bool) { + if value { + c.Flags.Set(18) + c.SubExtend = true + } else { + c.Flags.Unset(18) + c.SubExtend = false + } +} + +// GetSubExtend returns value of SubExtend conditional field. +func (c *ChannelAdminLogEventsFilter) GetSubExtend() (value bool) { + if c == nil { + return + } + return c.Flags.Has(18) +} diff --git a/vendor/github.com/gotd/td/tg/tl_channel_participant_gen.go b/vendor/github.com/gotd/td/tg/tl_channel_participant_gen.go index f96659e0..269faa3a 100644 --- a/vendor/github.com/gotd/td/tg/tl_channel_participant_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channel_participant_gen.go @@ -31,19 +31,25 @@ var ( _ = tdjson.Encoder{} ) -// ChannelParticipant represents TL type `channelParticipant#c00c07c0`. +// ChannelParticipant represents TL type `channelParticipant#cb397619`. // Channel/supergroup participant // // See https://core.telegram.org/constructor/channelParticipant for reference. type ChannelParticipant struct { + // Flags field of ChannelParticipant. + Flags bin.Fields // Participant user ID UserID int64 // Date joined Date int + // SubscriptionUntilDate field of ChannelParticipant. + // + // Use SetSubscriptionUntilDate and GetSubscriptionUntilDate helpers. + SubscriptionUntilDate int } // ChannelParticipantTypeID is TL type id of ChannelParticipant. -const ChannelParticipantTypeID = 0xc00c07c0 +const ChannelParticipantTypeID = 0xcb397619 // construct implements constructor of ChannelParticipantClass. func (c ChannelParticipant) construct() ChannelParticipantClass { return &c } @@ -62,12 +68,18 @@ func (c *ChannelParticipant) Zero() bool { if c == nil { return true } + if !(c.Flags.Zero()) { + return false + } if !(c.UserID == 0) { return false } if !(c.Date == 0) { return false } + if !(c.SubscriptionUntilDate == 0) { + return false + } return true } @@ -85,9 +97,14 @@ func (c *ChannelParticipant) String() string { func (c *ChannelParticipant) FillFrom(from interface { GetUserID() (value int64) GetDate() (value int) + GetSubscriptionUntilDate() (value int, ok bool) }) { c.UserID = from.GetUserID() c.Date = from.GetDate() + if val, ok := from.GetSubscriptionUntilDate(); ok { + c.SubscriptionUntilDate = val + } + } // TypeID returns type id in TL schema. @@ -121,14 +138,26 @@ func (c *ChannelParticipant) TypeInfo() tdp.Type { Name: "Date", SchemaName: "date", }, + { + Name: "SubscriptionUntilDate", + SchemaName: "subscription_until_date", + Null: !c.Flags.Has(0), + }, } return typ } +// SetFlags sets flags for non-zero fields. +func (c *ChannelParticipant) SetFlags() { + if !(c.SubscriptionUntilDate == 0) { + c.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (c *ChannelParticipant) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelParticipant#c00c07c0 as nil") + return fmt.Errorf("can't encode channelParticipant#cb397619 as nil") } b.PutID(ChannelParticipantTypeID) return c.EncodeBare(b) @@ -137,20 +166,27 @@ func (c *ChannelParticipant) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChannelParticipant) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelParticipant#c00c07c0 as nil") + return fmt.Errorf("can't encode channelParticipant#cb397619 as nil") + } + c.SetFlags() + if err := c.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode channelParticipant#cb397619: field flags: %w", err) } b.PutLong(c.UserID) b.PutInt(c.Date) + if c.Flags.Has(0) { + b.PutInt(c.SubscriptionUntilDate) + } return nil } // Decode implements bin.Decoder. func (c *ChannelParticipant) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channelParticipant#c00c07c0 to nil") + return fmt.Errorf("can't decode channelParticipant#cb397619 to nil") } if err := b.ConsumeID(ChannelParticipantTypeID); err != nil { - return fmt.Errorf("unable to decode channelParticipant#c00c07c0: %w", err) + return fmt.Errorf("unable to decode channelParticipant#cb397619: %w", err) } return c.DecodeBare(b) } @@ -158,22 +194,34 @@ func (c *ChannelParticipant) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChannelParticipant) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channelParticipant#c00c07c0 to nil") + return fmt.Errorf("can't decode channelParticipant#cb397619 to nil") + } + { + if err := c.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode channelParticipant#cb397619: field flags: %w", err) + } } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channelParticipant#c00c07c0: field user_id: %w", err) + return fmt.Errorf("unable to decode channelParticipant#cb397619: field user_id: %w", err) } c.UserID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelParticipant#c00c07c0: field date: %w", err) + return fmt.Errorf("unable to decode channelParticipant#cb397619: field date: %w", err) } c.Date = value } + if c.Flags.Has(0) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode channelParticipant#cb397619: field subscription_until_date: %w", err) + } + c.SubscriptionUntilDate = value + } return nil } @@ -193,7 +241,25 @@ func (c *ChannelParticipant) GetDate() (value int) { return c.Date } -// ChannelParticipantSelf represents TL type `channelParticipantSelf#35a8bfa7`. +// SetSubscriptionUntilDate sets value of SubscriptionUntilDate conditional field. +func (c *ChannelParticipant) SetSubscriptionUntilDate(value int) { + c.Flags.Set(0) + c.SubscriptionUntilDate = value +} + +// GetSubscriptionUntilDate returns value of SubscriptionUntilDate conditional field and +// boolean which is true if field was set. +func (c *ChannelParticipant) GetSubscriptionUntilDate() (value int, ok bool) { + if c == nil { + return + } + if !c.Flags.Has(0) { + return value, false + } + return c.SubscriptionUntilDate, true +} + +// ChannelParticipantSelf represents TL type `channelParticipantSelf#4f607bef`. // Myself // // See https://core.telegram.org/constructor/channelParticipantSelf for reference. @@ -211,10 +277,14 @@ type ChannelParticipantSelf struct { InviterID int64 // When did I join the channel/supergroup Date int + // SubscriptionUntilDate field of ChannelParticipantSelf. + // + // Use SetSubscriptionUntilDate and GetSubscriptionUntilDate helpers. + SubscriptionUntilDate int } // ChannelParticipantSelfTypeID is TL type id of ChannelParticipantSelf. -const ChannelParticipantSelfTypeID = 0x35a8bfa7 +const ChannelParticipantSelfTypeID = 0x4f607bef // construct implements constructor of ChannelParticipantClass. func (c ChannelParticipantSelf) construct() ChannelParticipantClass { return &c } @@ -248,6 +318,9 @@ func (c *ChannelParticipantSelf) Zero() bool { if !(c.Date == 0) { return false } + if !(c.SubscriptionUntilDate == 0) { + return false + } return true } @@ -267,11 +340,16 @@ func (c *ChannelParticipantSelf) FillFrom(from interface { GetUserID() (value int64) GetInviterID() (value int64) GetDate() (value int) + GetSubscriptionUntilDate() (value int, ok bool) }) { c.ViaRequest = from.GetViaRequest() c.UserID = from.GetUserID() c.InviterID = from.GetInviterID() c.Date = from.GetDate() + if val, ok := from.GetSubscriptionUntilDate(); ok { + c.SubscriptionUntilDate = val + } + } // TypeID returns type id in TL schema. @@ -314,6 +392,11 @@ func (c *ChannelParticipantSelf) TypeInfo() tdp.Type { Name: "Date", SchemaName: "date", }, + { + Name: "SubscriptionUntilDate", + SchemaName: "subscription_until_date", + Null: !c.Flags.Has(1), + }, } return typ } @@ -323,12 +406,15 @@ func (c *ChannelParticipantSelf) SetFlags() { if !(c.ViaRequest == false) { c.Flags.Set(0) } + if !(c.SubscriptionUntilDate == 0) { + c.Flags.Set(1) + } } // Encode implements bin.Encoder. func (c *ChannelParticipantSelf) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelParticipantSelf#35a8bfa7 as nil") + return fmt.Errorf("can't encode channelParticipantSelf#4f607bef as nil") } b.PutID(ChannelParticipantSelfTypeID) return c.EncodeBare(b) @@ -337,25 +423,28 @@ func (c *ChannelParticipantSelf) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChannelParticipantSelf) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelParticipantSelf#35a8bfa7 as nil") + return fmt.Errorf("can't encode channelParticipantSelf#4f607bef as nil") } c.SetFlags() if err := c.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelParticipantSelf#35a8bfa7: field flags: %w", err) + return fmt.Errorf("unable to encode channelParticipantSelf#4f607bef: field flags: %w", err) } b.PutLong(c.UserID) b.PutLong(c.InviterID) b.PutInt(c.Date) + if c.Flags.Has(1) { + b.PutInt(c.SubscriptionUntilDate) + } return nil } // Decode implements bin.Decoder. func (c *ChannelParticipantSelf) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channelParticipantSelf#35a8bfa7 to nil") + return fmt.Errorf("can't decode channelParticipantSelf#4f607bef to nil") } if err := b.ConsumeID(ChannelParticipantSelfTypeID); err != nil { - return fmt.Errorf("unable to decode channelParticipantSelf#35a8bfa7: %w", err) + return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: %w", err) } return c.DecodeBare(b) } @@ -363,35 +452,42 @@ func (c *ChannelParticipantSelf) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChannelParticipantSelf) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channelParticipantSelf#35a8bfa7 to nil") + return fmt.Errorf("can't decode channelParticipantSelf#4f607bef to nil") } { if err := c.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelParticipantSelf#35a8bfa7: field flags: %w", err) + return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: field flags: %w", err) } } c.ViaRequest = c.Flags.Has(0) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channelParticipantSelf#35a8bfa7: field user_id: %w", err) + return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: field user_id: %w", err) } c.UserID = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channelParticipantSelf#35a8bfa7: field inviter_id: %w", err) + return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: field inviter_id: %w", err) } c.InviterID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelParticipantSelf#35a8bfa7: field date: %w", err) + return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: field date: %w", err) } c.Date = value } + if c.Flags.Has(1) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: field subscription_until_date: %w", err) + } + c.SubscriptionUntilDate = value + } return nil } @@ -438,6 +534,24 @@ func (c *ChannelParticipantSelf) GetDate() (value int) { return c.Date } +// SetSubscriptionUntilDate sets value of SubscriptionUntilDate conditional field. +func (c *ChannelParticipantSelf) SetSubscriptionUntilDate(value int) { + c.Flags.Set(1) + c.SubscriptionUntilDate = value +} + +// GetSubscriptionUntilDate returns value of SubscriptionUntilDate conditional field and +// boolean which is true if field was set. +func (c *ChannelParticipantSelf) GetSubscriptionUntilDate() (value int, ok bool) { + if c == nil { + return + } + if !c.Flags.Has(1) { + return value, false + } + return c.SubscriptionUntilDate, true +} + // ChannelParticipantCreator represents TL type `channelParticipantCreator#2fe601d3`. // Channel/supergroup creator // @@ -1510,8 +1624,8 @@ const ChannelParticipantClassName = "ChannelParticipant" // panic(err) // } // switch v := g.(type) { -// case *tg.ChannelParticipant: // channelParticipant#c00c07c0 -// case *tg.ChannelParticipantSelf: // channelParticipantSelf#35a8bfa7 +// case *tg.ChannelParticipant: // channelParticipant#cb397619 +// case *tg.ChannelParticipantSelf: // channelParticipantSelf#4f607bef // case *tg.ChannelParticipantCreator: // channelParticipantCreator#2fe601d3 // case *tg.ChannelParticipantAdmin: // channelParticipantAdmin#34c3bb53 // case *tg.ChannelParticipantBanned: // channelParticipantBanned#6df8014e @@ -1545,14 +1659,14 @@ func DecodeChannelParticipant(buf *bin.Buffer) (ChannelParticipantClass, error) } switch id { case ChannelParticipantTypeID: - // Decoding channelParticipant#c00c07c0. + // Decoding channelParticipant#cb397619. v := ChannelParticipant{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChannelParticipantClass: %w", err) } return &v, nil case ChannelParticipantSelfTypeID: - // Decoding channelParticipantSelf#35a8bfa7. + // Decoding channelParticipantSelf#4f607bef. v := ChannelParticipantSelf{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChannelParticipantClass: %w", err) diff --git a/vendor/github.com/gotd/td/tg/tl_channels_deactivate_all_usernames_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_deactivate_all_usernames_gen.go index 738cdd03..4553296e 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_deactivate_all_usernames_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_deactivate_all_usernames_gen.go @@ -174,8 +174,11 @@ func (d *ChannelsDeactivateAllUsernamesRequest) GetChannelAsNotEmpty() (NotEmpty // ChannelsDeactivateAllUsernames invokes method channels.deactivateAllUsernames#a245dd3 returning error if any. // Disable all purchased usernames of a supergroup or channel // +// Possible errors: +// +// 400 CHANNEL_INVALID: The provided channel is invalid. +// // See https://core.telegram.org/method/channels.deactivateAllUsernames for reference. -// Can be used by bots. func (c *Client) ChannelsDeactivateAllUsernames(ctx context.Context, channel InputChannelClass) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_channels_edit_admin_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_edit_admin_gen.go index 803d76ef..23d957cd 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_edit_admin_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_edit_admin_gen.go @@ -289,7 +289,7 @@ func (e *ChannelsEditAdminRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, // 400 USERS_TOO_MUCH: The maximum number of users has been exceeded (to create a chat, for example). // 400 USER_BLOCKED: User blocked. // 403 USER_CHANNELS_TOO_MUCH: One of the users you tried to add is already in too many channels/supergroups. -// 400 USER_CREATOR: You can't leave this channel, because you're its creator. +// 400 USER_CREATOR: For channels.editAdmin: you've tried to edit the admin rights of the owner, but you're not the owner; for channels.leaveChannel: you can't leave this channel, because you're its creator. // 400 USER_ID_INVALID: The provided user ID is invalid. // 403 USER_NOT_MUTUAL_CONTACT: The provided user is not a mutual contact. // 403 USER_PRIVACY_RESTRICTED: The user's privacy settings do not allow you to do this. diff --git a/vendor/github.com/gotd/td/tg/tl_channels_edit_creator_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_edit_creator_gen.go index 4477f397..ad7c1897 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_edit_creator_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_edit_creator_gen.go @@ -254,7 +254,7 @@ func (e *ChannelsEditCreatorRequest) GetPasswordAsNotEmpty() (*InputCheckPasswor // 400 CHAT_NOT_MODIFIED: No changes were made to chat information because the new information you passed is identical to the current information. // 403 CHAT_WRITE_FORBIDDEN: You can't write in this chat. // 400 PASSWORD_HASH_INVALID: The provided password hash is invalid. -// 400 PASSWORD_MISSING: You must enable 2FA in order to transfer ownership of a channel. +// 400 PASSWORD_MISSING: You must enable 2FA before executing this operation. // 400 PASSWORD_TOO_FRESH_%d: The password was modified less than 24 hours ago, try again in %d seconds. // 400 SESSION_TOO_FRESH_%d: This session was created less than 24 hours ago, try again in %d seconds. // 400 SRP_ID_INVALID: Invalid SRP ID provided. diff --git a/vendor/github.com/gotd/td/tg/tl_channels_edit_location_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_edit_location_gen.go index cff623ba..948ac63b 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_edit_location_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_edit_location_gen.go @@ -249,6 +249,7 @@ func (e *ChannelsEditLocationRequest) GetGeoPointAsNotEmpty() (*InputGeoPoint, b // // Possible errors: // +// 400 CHANNEL_INVALID: The provided channel is invalid. // 400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. // 400 CHAT_NOT_MODIFIED: No changes were made to chat information because the new information you passed is identical to the current information. // 400 MEGAGROUP_GEO_REQUIRED: This method can only be invoked on a geogroup. diff --git a/vendor/github.com/gotd/td/tg/tl_channels_get_admined_public_channels_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_get_admined_public_channels_gen.go index 9c95b18f..e82e7321 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_get_admined_public_channels_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_get_admined_public_channels_gen.go @@ -62,7 +62,12 @@ type ChannelsGetAdminedPublicChannelsRequest struct { // 3) https://core.telegram.org/method/channels.checkUsername // 4) https://core.telegram.org/method/channels.updateUsername CheckLimit bool - // ForPersonal field of ChannelsGetAdminedPublicChannelsRequest. + // Set this flag to only fetch the full list of channels that may be passed to account + // updatePersonalChannel¹ to display them on our profile page². + // + // Links: + // 1) https://core.telegram.org/method/account.updatePersonalChannel + // 2) https://core.telegram.org/api/profile#personal-channel ForPersonal bool } diff --git a/vendor/github.com/gotd/td/tg/tl_channels_get_channel_recommendations_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_get_channel_recommendations_gen.go index df7338f3..c0986d5b 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_get_channel_recommendations_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_get_channel_recommendations_gen.go @@ -37,9 +37,13 @@ var ( // // See https://core.telegram.org/method/channels.getChannelRecommendations for reference. type ChannelsGetChannelRecommendationsRequest struct { - // Flags field of ChannelsGetChannelRecommendationsRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // The method will return channels related to the passed channel. + // The method will return channels related to the passed channel. If not set, the method + // will returns channels related to channels the user has joined. // // Use SetChannel and GetChannel helpers. Channel InputChannelClass @@ -222,6 +226,7 @@ func (g *ChannelsGetChannelRecommendationsRequest) GetChannelAsNotEmpty() (NotEm // Possible errors: // // 400 CHANNEL_INVALID: The provided channel is invalid. +// 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. // // See https://core.telegram.org/method/channels.getChannelRecommendations for reference. func (c *Client) ChannelsGetChannelRecommendations(ctx context.Context, request *ChannelsGetChannelRecommendationsRequest) (MessagesChatsClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_channels_get_forum_topics_by_id_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_get_forum_topics_by_id_gen.go index f2cafad0..e066da5a 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_get_forum_topics_by_id_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_get_forum_topics_by_id_gen.go @@ -221,7 +221,6 @@ func (g *ChannelsGetForumTopicsByIDRequest) GetChannelAsNotEmpty() (NotEmptyInpu // 400 TOPICS_EMPTY: You specified no topic IDs. // // See https://core.telegram.org/method/channels.getForumTopicsByID for reference. -// Can be used by bots. func (c *Client) ChannelsGetForumTopicsByID(ctx context.Context, request *ChannelsGetForumTopicsByIDRequest) (*MessagesForumTopics, error) { var result MessagesForumTopics diff --git a/vendor/github.com/gotd/td/tg/tl_channels_get_send_as_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_get_send_as_gen.go index 3798b5f3..f19eaf97 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_get_send_as_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_get_send_as_gen.go @@ -171,6 +171,7 @@ func (g *ChannelsGetSendAsRequest) GetPeer() (value InputPeerClass) { // // Possible errors: // +// 400 CHANNEL_INVALID: The provided channel is invalid. // 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. // 400 CHAT_ID_INVALID: The provided chat id is invalid. // 400 PEER_ID_INVALID: The provided peer id is invalid. diff --git a/vendor/github.com/gotd/td/tg/tl_channels_invite_to_channel_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_invite_to_channel_gen.go index 14bdf7f3..17b3702e 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_invite_to_channel_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_invite_to_channel_gen.go @@ -33,13 +33,6 @@ var ( // ChannelsInviteToChannelRequest represents TL type `channels.inviteToChannel#c9e33d54`. // Invite users to a channel/supergroup -// May also return 0-N updates of type updateGroupInvitePrivacyForbidden¹: it indicates -// we couldn't add a user to a chat because of their privacy settings; if required, an -// invite link² can be shared with the user, instead. -// -// Links: -// 1. https://core.telegram.org/constructor/updateGroupInvitePrivacyForbidden -// 2. https://core.telegram.org/api/invites // // See https://core.telegram.org/method/channels.inviteToChannel for reference. type ChannelsInviteToChannelRequest struct { @@ -230,13 +223,6 @@ func (i *ChannelsInviteToChannelRequest) MapUsers() (value InputUserClassArray) // ChannelsInviteToChannel invokes method channels.inviteToChannel#c9e33d54 returning error if any. // Invite users to a channel/supergroup -// May also return 0-N updates of type updateGroupInvitePrivacyForbidden¹: it indicates -// we couldn't add a user to a chat because of their privacy settings; if required, an -// invite link² can be shared with the user, instead. -// -// Links: -// 1. https://core.telegram.org/constructor/updateGroupInvitePrivacyForbidden -// 2. https://core.telegram.org/api/invites // // Possible errors: // diff --git a/vendor/github.com/gotd/td/tg/tl_channels_leave_channel_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_leave_channel_gen.go index 84097cc8..ccd05df1 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_leave_channel_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_leave_channel_gen.go @@ -191,7 +191,7 @@ func (l *ChannelsLeaveChannelRequest) GetChannelAsNotEmpty() (NotEmptyInputChann // 400 CHAT_INVALID: Invalid chat. // 400 MSG_ID_INVALID: Invalid message ID provided. // 400 USER_BANNED_IN_CHANNEL: You're banned from sending messages in supergroups/channels. -// 400 USER_CREATOR: You can't leave this channel, because you're its creator. +// 400 USER_CREATOR: For channels.editAdmin: you've tried to edit the admin rights of the owner, but you're not the owner; for channels.leaveChannel: you can't leave this channel, because you're its creator. // 400 USER_NOT_PARTICIPANT: You're not a member of this supergroup/channel. // // See https://core.telegram.org/method/channels.leaveChannel for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_channels_reorder_pinned_forum_topics_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_reorder_pinned_forum_topics_gen.go index 211cb5da..830c5ec9 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_reorder_pinned_forum_topics_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_reorder_pinned_forum_topics_gen.go @@ -278,8 +278,11 @@ func (r *ChannelsReorderPinnedForumTopicsRequest) GetChannelAsNotEmpty() (NotEmp // ChannelsReorderPinnedForumTopics invokes method channels.reorderPinnedForumTopics#2950a18f returning error if any. // Reorder pinned forum topics // +// Possible errors: +// +// 400 CHANNEL_INVALID: The provided channel is invalid. +// // See https://core.telegram.org/method/channels.reorderPinnedForumTopics for reference. -// Can be used by bots. func (c *Client) ChannelsReorderPinnedForumTopics(ctx context.Context, request *ChannelsReorderPinnedForumTopicsRequest) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_channels_reorder_usernames_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_reorder_usernames_gen.go index afd040fd..473823df 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_reorder_usernames_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_reorder_usernames_gen.go @@ -217,9 +217,9 @@ func (r *ChannelsReorderUsernamesRequest) GetChannelAsNotEmpty() (NotEmptyInputC // Possible errors: // // 400 CHANNEL_INVALID: The provided channel is invalid. +// 400 CHAT_NOT_MODIFIED: No changes were made to chat information because the new information you passed is identical to the current information. // // See https://core.telegram.org/method/channels.reorderUsernames for reference. -// Can be used by bots. func (c *Client) ChannelsReorderUsernames(ctx context.Context, request *ChannelsReorderUsernamesRequest) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_channels_report_anti_spam_false_positive_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_report_anti_spam_false_positive_gen.go index 69ad73b2..e0f593e4 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_report_anti_spam_false_positive_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_report_anti_spam_false_positive_gen.go @@ -212,8 +212,11 @@ func (r *ChannelsReportAntiSpamFalsePositiveRequest) GetChannelAsNotEmpty() (Not // Links: // 1. https://core.telegram.org/api/antispam // +// Possible errors: +// +// 400 CHANNEL_INVALID: The provided channel is invalid. +// // See https://core.telegram.org/method/channels.reportAntiSpamFalsePositive for reference. -// Can be used by bots. func (c *Client) ChannelsReportAntiSpamFalsePositive(ctx context.Context, request *ChannelsReportAntiSpamFalsePositiveRequest) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_channels_report_sponsored_message_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_report_sponsored_message_gen.go index 3645d615..1c963738 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_report_sponsored_message_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_report_sponsored_message_gen.go @@ -32,14 +32,23 @@ var ( ) // ChannelsReportSponsoredMessageRequest represents TL type `channels.reportSponsoredMessage#af8ff6b9`. +// Report a sponsored message »¹, see here »² for more info on the full flow. +// +// Links: +// 1. https://core.telegram.org/api/sponsored-messages +// 2. https://core.telegram.org/api/sponsored-messages#reporting-sponsored-messages // // See https://core.telegram.org/method/channels.reportSponsoredMessage for reference. type ChannelsReportSponsoredMessageRequest struct { - // Channel field of ChannelsReportSponsoredMessageRequest. + // The channel where the sponsored message can be seen. Channel InputChannelClass - // RandomID field of ChannelsReportSponsoredMessageRequest. + // ID of the sponsored message. RandomID []byte - // Option field of ChannelsReportSponsoredMessageRequest. + // Chosen report option, initially an empty string, see here »¹ for more info on the + // full flow. + // + // Links: + // 1) https://core.telegram.org/api/sponsored-messages#reporting-sponsored-messages Option []byte } @@ -225,6 +234,17 @@ func (r *ChannelsReportSponsoredMessageRequest) GetChannelAsNotEmpty() (NotEmpty } // ChannelsReportSponsoredMessage invokes method channels.reportSponsoredMessage#af8ff6b9 returning error if any. +// Report a sponsored message »¹, see here »² for more info on the full flow. +// +// Links: +// 1. https://core.telegram.org/api/sponsored-messages +// 2. https://core.telegram.org/api/sponsored-messages#reporting-sponsored-messages +// +// Possible errors: +// +// 400 AD_EXPIRED: The ad has expired (too old or not found). +// 400 CHANNEL_INVALID: The provided channel is invalid. +// 400 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. // // See https://core.telegram.org/method/channels.reportSponsoredMessage for reference. func (c *Client) ChannelsReportSponsoredMessage(ctx context.Context, request *ChannelsReportSponsoredMessageRequest) (ChannelsSponsoredMessageReportResultClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_channels_restrict_sponsored_messages_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_restrict_sponsored_messages_gen.go index 9a4aa75c..de9aac5b 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_restrict_sponsored_messages_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_restrict_sponsored_messages_gen.go @@ -32,12 +32,19 @@ var ( ) // ChannelsRestrictSponsoredMessagesRequest represents TL type `channels.restrictSponsoredMessages#9ae91519`. +// Disable ads on the specified channel, for all users. +// Available only after reaching at least the boost level »¹ specified in the +// channel_restrict_sponsored_level_min »² config parameter. +// +// Links: +// 1. https://core.telegram.org/api/boost +// 2. https://core.telegram.org/api/config#channel-restrict-sponsored-level-min // // See https://core.telegram.org/method/channels.restrictSponsoredMessages for reference. type ChannelsRestrictSponsoredMessagesRequest struct { - // Channel field of ChannelsRestrictSponsoredMessagesRequest. + // The channel. Channel InputChannelClass - // Restricted field of ChannelsRestrictSponsoredMessagesRequest. + // Whether to disable or re-enable ads. Restricted bool } @@ -198,6 +205,17 @@ func (r *ChannelsRestrictSponsoredMessagesRequest) GetChannelAsNotEmpty() (NotEm } // ChannelsRestrictSponsoredMessages invokes method channels.restrictSponsoredMessages#9ae91519 returning error if any. +// Disable ads on the specified channel, for all users. +// Available only after reaching at least the boost level »¹ specified in the +// channel_restrict_sponsored_level_min »² config parameter. +// +// Links: +// 1. https://core.telegram.org/api/boost +// 2. https://core.telegram.org/api/config#channel-restrict-sponsored-level-min +// +// Possible errors: +// +// 400 CHANNEL_INVALID: The provided channel is invalid. // // See https://core.telegram.org/method/channels.restrictSponsoredMessages for reference. func (c *Client) ChannelsRestrictSponsoredMessages(ctx context.Context, request *ChannelsRestrictSponsoredMessagesRequest) (UpdatesClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_channels_search_posts_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_search_posts_gen.go index 48b77700..ad31130c 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_search_posts_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_search_posts_gen.go @@ -32,18 +32,35 @@ var ( ) // ChannelsSearchPostsRequest represents TL type `channels.searchPosts#d19f987b`. +// Globally search for posts from public channels »¹ (including those we aren't a +// member of) containing a specific hashtag. +// +// Links: +// 1. https://core.telegram.org/api/channel // // See https://core.telegram.org/method/channels.searchPosts for reference. type ChannelsSearchPostsRequest struct { - // Hashtag field of ChannelsSearchPostsRequest. + // The hashtag to search, without the # character. Hashtag string - // OffsetRate field of ChannelsSearchPostsRequest. + // Initially 0, then set to the next_rate parameter of messages.messagesSlice¹ + // + // Links: + // 1) https://core.telegram.org/constructor/messages.messagesSlice OffsetRate int - // OffsetPeer field of ChannelsSearchPostsRequest. + // Offsets for pagination, for more info click here¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets OffsetPeer InputPeerClass - // OffsetID field of ChannelsSearchPostsRequest. + // Offsets for pagination, for more info click here¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets OffsetID int - // Limit field of ChannelsSearchPostsRequest. + // Maximum number of results to return, see pagination¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets Limit int } @@ -274,6 +291,11 @@ func (s *ChannelsSearchPostsRequest) GetLimit() (value int) { } // ChannelsSearchPosts invokes method channels.searchPosts#d19f987b returning error if any. +// Globally search for posts from public channels »¹ (including those we aren't a +// member of) containing a specific hashtag. +// +// Links: +// 1. https://core.telegram.org/api/channel // // See https://core.telegram.org/method/channels.searchPosts for reference. func (c *Client) ChannelsSearchPosts(ctx context.Context, request *ChannelsSearchPostsRequest) (MessagesMessagesClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_channels_set_boosts_to_unblock_restrictions_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_set_boosts_to_unblock_restrictions_gen.go index fe7aa1ed..cfc28b7b 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_set_boosts_to_unblock_restrictions_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_set_boosts_to_unblock_restrictions_gen.go @@ -32,12 +32,22 @@ var ( ) // ChannelsSetBoostsToUnblockRestrictionsRequest represents TL type `channels.setBoostsToUnblockRestrictions#ad399cee`. +// Admins with ban_users admin rights »¹ may allow users that apply a certain number of +// booosts »² to the group to bypass slow mode »³ and other »⁴ supergroup +// restrictions, see here »⁵ for more info. +// +// Links: +// 1. https://core.telegram.org/constructor/chatAdminRights +// 2. https://core.telegram.org/api/boost +// 3. https://core.telegram.org/method/channels.toggleSlowMode +// 4. https://core.telegram.org/api/rights#default-rights +// 5. https://core.telegram.org/api/boost#bypass-slowmode-and-chat-restrictions // // See https://core.telegram.org/method/channels.setBoostsToUnblockRestrictions for reference. type ChannelsSetBoostsToUnblockRestrictionsRequest struct { - // Channel field of ChannelsSetBoostsToUnblockRestrictionsRequest. + // The supergroup. Channel InputChannelClass - // Boosts field of ChannelsSetBoostsToUnblockRestrictionsRequest. + // The number of required boosts (1-8, 0 to disable). Boosts int } @@ -198,6 +208,20 @@ func (s *ChannelsSetBoostsToUnblockRestrictionsRequest) GetChannelAsNotEmpty() ( } // ChannelsSetBoostsToUnblockRestrictions invokes method channels.setBoostsToUnblockRestrictions#ad399cee returning error if any. +// Admins with ban_users admin rights »¹ may allow users that apply a certain number of +// booosts »² to the group to bypass slow mode »³ and other »⁴ supergroup +// restrictions, see here »⁵ for more info. +// +// Links: +// 1. https://core.telegram.org/constructor/chatAdminRights +// 2. https://core.telegram.org/api/boost +// 3. https://core.telegram.org/method/channels.toggleSlowMode +// 4. https://core.telegram.org/api/rights#default-rights +// 5. https://core.telegram.org/api/boost#bypass-slowmode-and-chat-restrictions +// +// Possible errors: +// +// 400 CHANNEL_INVALID: The provided channel is invalid. // // See https://core.telegram.org/method/channels.setBoostsToUnblockRestrictions for reference. func (c *Client) ChannelsSetBoostsToUnblockRestrictions(ctx context.Context, request *ChannelsSetBoostsToUnblockRestrictionsRequest) (UpdatesClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_channels_set_emoji_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_set_emoji_stickers_gen.go index f2364ef8..ac6f019b 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_set_emoji_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_set_emoji_stickers_gen.go @@ -32,12 +32,20 @@ var ( ) // ChannelsSetEmojiStickersRequest represents TL type `channels.setEmojiStickers#3cd930b7`. +// Set a custom emoji stickerset¹ for supergroups. Only usable after reaching at least +// the boost level »² specified in the group_emoji_stickers_level_min »³ config +// parameter. +// +// Links: +// 1. https://core.telegram.org/api/custom-emoji +// 2. https://core.telegram.org/api/boost +// 3. https://core.telegram.org/api/config#group-emoji-stickers-level-min // // See https://core.telegram.org/method/channels.setEmojiStickers for reference. type ChannelsSetEmojiStickersRequest struct { - // Channel field of ChannelsSetEmojiStickersRequest. + // The supergroup Channel InputChannelClass - // Stickerset field of ChannelsSetEmojiStickersRequest. + // The custom emoji stickerset to associate to the supergroup Stickerset InputStickerSetClass } @@ -203,6 +211,18 @@ func (s *ChannelsSetEmojiStickersRequest) GetChannelAsNotEmpty() (NotEmptyInputC } // ChannelsSetEmojiStickers invokes method channels.setEmojiStickers#3cd930b7 returning error if any. +// Set a custom emoji stickerset¹ for supergroups. Only usable after reaching at least +// the boost level »² specified in the group_emoji_stickers_level_min »³ config +// parameter. +// +// Links: +// 1. https://core.telegram.org/api/custom-emoji +// 2. https://core.telegram.org/api/boost +// 3. https://core.telegram.org/api/config#group-emoji-stickers-level-min +// +// Possible errors: +// +// 400 CHANNEL_INVALID: The provided channel is invalid. // // See https://core.telegram.org/method/channels.setEmojiStickers for reference. func (c *Client) ChannelsSetEmojiStickers(ctx context.Context, request *ChannelsSetEmojiStickersRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_channels_sponsored_message_report_result_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_sponsored_message_report_result_gen.go index e0f3d56d..74ffa142 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_sponsored_message_report_result_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_sponsored_message_report_result_gen.go @@ -32,12 +32,18 @@ var ( ) // ChannelsSponsoredMessageReportResultChooseOption represents TL type `channels.sponsoredMessageReportResultChooseOption#846f9e42`. +// The user must choose a report option from the localized options available in options, +// and after selection, channels.reportSponsoredMessage¹ must be invoked again, passing +// the option's option field to the option param of the method. +// +// Links: +// 1. https://core.telegram.org/method/channels.reportSponsoredMessage // // See https://core.telegram.org/constructor/channels.sponsoredMessageReportResultChooseOption for reference. type ChannelsSponsoredMessageReportResultChooseOption struct { - // Title field of ChannelsSponsoredMessageReportResultChooseOption. + // Title of the option selection popup. Title string - // Options field of ChannelsSponsoredMessageReportResultChooseOption. + // Localized list of options. Options []SponsoredMessageReportOption } @@ -210,6 +216,7 @@ func (s *ChannelsSponsoredMessageReportResultChooseOption) GetOptions() (value [ } // ChannelsSponsoredMessageReportResultAdsHidden represents TL type `channels.sponsoredMessageReportResultAdsHidden#3e3bcf2f`. +// Sponsored messages were hidden for the user in all chats. // // See https://core.telegram.org/constructor/channels.sponsoredMessageReportResultAdsHidden for reference. type ChannelsSponsoredMessageReportResultAdsHidden struct { @@ -313,6 +320,7 @@ func (s *ChannelsSponsoredMessageReportResultAdsHidden) DecodeBare(b *bin.Buffer } // ChannelsSponsoredMessageReportResultReported represents TL type `channels.sponsoredMessageReportResultReported#ad798849`. +// The sponsored message was reported successfully. // // See https://core.telegram.org/constructor/channels.sponsoredMessageReportResultReported for reference. type ChannelsSponsoredMessageReportResultReported struct { diff --git a/vendor/github.com/gotd/td/tg/tl_channels_toggle_anti_spam_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_toggle_anti_spam_gen.go index e7cadde8..c6434d08 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_toggle_anti_spam_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_toggle_anti_spam_gen.go @@ -214,10 +214,10 @@ func (t *ChannelsToggleAntiSpamRequest) GetChannelAsNotEmpty() (NotEmptyInputCha // // Possible errors: // +// 400 CHANNEL_INVALID: The provided channel is invalid. // 400 CHAT_NOT_MODIFIED: No changes were made to chat information because the new information you passed is identical to the current information. // // See https://core.telegram.org/method/channels.toggleAntiSpam for reference. -// Can be used by bots. func (c *Client) ChannelsToggleAntiSpam(ctx context.Context, request *ChannelsToggleAntiSpamRequest) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_channels_toggle_forum_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_toggle_forum_gen.go index 496319a5..612bc14c 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_toggle_forum_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_toggle_forum_gen.go @@ -209,11 +209,11 @@ func (t *ChannelsToggleForumRequest) GetChannelAsNotEmpty() (NotEmptyInputChanne // // Possible errors: // +// 400 CHANNEL_INVALID: The provided channel is invalid. // 400 CHAT_DISCUSSION_UNALLOWED: You can't enable forum topics in a discussion group linked to a channel. // 400 CHAT_NOT_MODIFIED: No changes were made to chat information because the new information you passed is identical to the current information. // // See https://core.telegram.org/method/channels.toggleForum for reference. -// Can be used by bots. func (c *Client) ChannelsToggleForum(ctx context.Context, request *ChannelsToggleForumRequest) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_channels_toggle_participants_hidden_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_toggle_participants_hidden_gen.go index f85d1a98..9175bf61 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_toggle_participants_hidden_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_toggle_participants_hidden_gen.go @@ -215,12 +215,12 @@ func (t *ChannelsToggleParticipantsHiddenRequest) GetChannelAsNotEmpty() (NotEmp // // Possible errors: // +// 400 CHANNEL_INVALID: The provided channel is invalid. // 400 CHAT_ID_INVALID: The provided chat id is invalid. // 400 CHAT_NOT_MODIFIED: No changes were made to chat information because the new information you passed is identical to the current information. // 400 PARTICIPANTS_TOO_FEW: Not enough participants. // // See https://core.telegram.org/method/channels.toggleParticipantsHidden for reference. -// Can be used by bots. func (c *Client) ChannelsToggleParticipantsHidden(ctx context.Context, request *ChannelsToggleParticipantsHiddenRequest) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_channels_toggle_signatures_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_toggle_signatures_gen.go index 5679f2ac..382f3fb9 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_toggle_signatures_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_toggle_signatures_gen.go @@ -31,19 +31,23 @@ var ( _ = tdjson.Encoder{} ) -// ChannelsToggleSignaturesRequest represents TL type `channels.toggleSignatures#1f69b606`. +// ChannelsToggleSignaturesRequest represents TL type `channels.toggleSignatures#418d549c`. // Enable/disable message signatures in channels // // See https://core.telegram.org/method/channels.toggleSignatures for reference. type ChannelsToggleSignaturesRequest struct { + // Flags field of ChannelsToggleSignaturesRequest. + Flags bin.Fields + // SignaturesEnabled field of ChannelsToggleSignaturesRequest. + SignaturesEnabled bool + // ProfilesEnabled field of ChannelsToggleSignaturesRequest. + ProfilesEnabled bool // Channel Channel InputChannelClass - // Value - Enabled bool } // ChannelsToggleSignaturesRequestTypeID is TL type id of ChannelsToggleSignaturesRequest. -const ChannelsToggleSignaturesRequestTypeID = 0x1f69b606 +const ChannelsToggleSignaturesRequestTypeID = 0x418d549c // Ensuring interfaces in compile-time for ChannelsToggleSignaturesRequest. var ( @@ -57,10 +61,16 @@ func (t *ChannelsToggleSignaturesRequest) Zero() bool { if t == nil { return true } - if !(t.Channel == nil) { + if !(t.Flags.Zero()) { return false } - if !(t.Enabled == false) { + if !(t.SignaturesEnabled == false) { + return false + } + if !(t.ProfilesEnabled == false) { + return false + } + if !(t.Channel == nil) { return false } @@ -78,11 +88,13 @@ func (t *ChannelsToggleSignaturesRequest) String() string { // FillFrom fills ChannelsToggleSignaturesRequest from given interface. func (t *ChannelsToggleSignaturesRequest) FillFrom(from interface { + GetSignaturesEnabled() (value bool) + GetProfilesEnabled() (value bool) GetChannel() (value InputChannelClass) - GetEnabled() (value bool) }) { + t.SignaturesEnabled = from.GetSignaturesEnabled() + t.ProfilesEnabled = from.GetProfilesEnabled() t.Channel = from.GetChannel() - t.Enabled = from.GetEnabled() } // TypeID returns type id in TL schema. @@ -109,21 +121,37 @@ func (t *ChannelsToggleSignaturesRequest) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "Channel", - SchemaName: "channel", + Name: "SignaturesEnabled", + SchemaName: "signatures_enabled", + Null: !t.Flags.Has(0), }, { - Name: "Enabled", - SchemaName: "enabled", + Name: "ProfilesEnabled", + SchemaName: "profiles_enabled", + Null: !t.Flags.Has(1), + }, + { + Name: "Channel", + SchemaName: "channel", }, } return typ } +// SetFlags sets flags for non-zero fields. +func (t *ChannelsToggleSignaturesRequest) SetFlags() { + if !(t.SignaturesEnabled == false) { + t.Flags.Set(0) + } + if !(t.ProfilesEnabled == false) { + t.Flags.Set(1) + } +} + // Encode implements bin.Encoder. func (t *ChannelsToggleSignaturesRequest) Encode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode channels.toggleSignatures#1f69b606 as nil") + return fmt.Errorf("can't encode channels.toggleSignatures#418d549c as nil") } b.PutID(ChannelsToggleSignaturesRequestTypeID) return t.EncodeBare(b) @@ -132,25 +160,28 @@ func (t *ChannelsToggleSignaturesRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (t *ChannelsToggleSignaturesRequest) EncodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode channels.toggleSignatures#1f69b606 as nil") + return fmt.Errorf("can't encode channels.toggleSignatures#418d549c as nil") + } + t.SetFlags() + if err := t.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode channels.toggleSignatures#418d549c: field flags: %w", err) } if t.Channel == nil { - return fmt.Errorf("unable to encode channels.toggleSignatures#1f69b606: field channel is nil") + return fmt.Errorf("unable to encode channels.toggleSignatures#418d549c: field channel is nil") } if err := t.Channel.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.toggleSignatures#1f69b606: field channel: %w", err) + return fmt.Errorf("unable to encode channels.toggleSignatures#418d549c: field channel: %w", err) } - b.PutBool(t.Enabled) return nil } // Decode implements bin.Decoder. func (t *ChannelsToggleSignaturesRequest) Decode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode channels.toggleSignatures#1f69b606 to nil") + return fmt.Errorf("can't decode channels.toggleSignatures#418d549c to nil") } if err := b.ConsumeID(ChannelsToggleSignaturesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode channels.toggleSignatures#1f69b606: %w", err) + return fmt.Errorf("unable to decode channels.toggleSignatures#418d549c: %w", err) } return t.DecodeBare(b) } @@ -158,25 +189,63 @@ func (t *ChannelsToggleSignaturesRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (t *ChannelsToggleSignaturesRequest) DecodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode channels.toggleSignatures#1f69b606 to nil") + return fmt.Errorf("can't decode channels.toggleSignatures#418d549c to nil") } + { + if err := t.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode channels.toggleSignatures#418d549c: field flags: %w", err) + } + } + t.SignaturesEnabled = t.Flags.Has(0) + t.ProfilesEnabled = t.Flags.Has(1) { value, err := DecodeInputChannel(b) if err != nil { - return fmt.Errorf("unable to decode channels.toggleSignatures#1f69b606: field channel: %w", err) + return fmt.Errorf("unable to decode channels.toggleSignatures#418d549c: field channel: %w", err) } t.Channel = value } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode channels.toggleSignatures#1f69b606: field enabled: %w", err) - } - t.Enabled = value - } return nil } +// SetSignaturesEnabled sets value of SignaturesEnabled conditional field. +func (t *ChannelsToggleSignaturesRequest) SetSignaturesEnabled(value bool) { + if value { + t.Flags.Set(0) + t.SignaturesEnabled = true + } else { + t.Flags.Unset(0) + t.SignaturesEnabled = false + } +} + +// GetSignaturesEnabled returns value of SignaturesEnabled conditional field. +func (t *ChannelsToggleSignaturesRequest) GetSignaturesEnabled() (value bool) { + if t == nil { + return + } + return t.Flags.Has(0) +} + +// SetProfilesEnabled sets value of ProfilesEnabled conditional field. +func (t *ChannelsToggleSignaturesRequest) SetProfilesEnabled(value bool) { + if value { + t.Flags.Set(1) + t.ProfilesEnabled = true + } else { + t.Flags.Unset(1) + t.ProfilesEnabled = false + } +} + +// GetProfilesEnabled returns value of ProfilesEnabled conditional field. +func (t *ChannelsToggleSignaturesRequest) GetProfilesEnabled() (value bool) { + if t == nil { + return + } + return t.Flags.Has(1) +} + // GetChannel returns value of Channel field. func (t *ChannelsToggleSignaturesRequest) GetChannel() (value InputChannelClass) { if t == nil { @@ -185,20 +254,12 @@ func (t *ChannelsToggleSignaturesRequest) GetChannel() (value InputChannelClass) return t.Channel } -// GetEnabled returns value of Enabled field. -func (t *ChannelsToggleSignaturesRequest) GetEnabled() (value bool) { - if t == nil { - return - } - return t.Enabled -} - // GetChannelAsNotEmpty returns mapped value of Channel field. func (t *ChannelsToggleSignaturesRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) { return t.Channel.AsNotEmpty() } -// ChannelsToggleSignatures invokes method channels.toggleSignatures#1f69b606 returning error if any. +// ChannelsToggleSignatures invokes method channels.toggleSignatures#418d549c returning error if any. // Enable/disable message signatures in channels // // Possible errors: diff --git a/vendor/github.com/gotd/td/tg/tl_channels_toggle_username_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_toggle_username_gen.go index 11fe8115..b43bb39d 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_toggle_username_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_toggle_username_gen.go @@ -243,13 +243,15 @@ func (t *ChannelsToggleUsernameRequest) GetChannelAsNotEmpty() (NotEmptyInputCha // // Possible errors: // +// 400 CHANNEL_INVALID: The provided channel is invalid. // 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. // 400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. +// 400 CHAT_NOT_MODIFIED: No changes were made to chat information because the new information you passed is identical to the current information. // 400 USERNAMES_ACTIVE_TOO_MUCH: The maximum number of active usernames was reached. // 400 USERNAME_INVALID: The provided username is not valid. +// 400 USERNAME_NOT_MODIFIED: The username was not modified. // // See https://core.telegram.org/method/channels.toggleUsername for reference. -// Can be used by bots. func (c *Client) ChannelsToggleUsername(ctx context.Context, request *ChannelsToggleUsernameRequest) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_channels_update_color_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_update_color_gen.go index e1c15ebd..09419437 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_update_color_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_update_color_gen.go @@ -45,7 +45,12 @@ type ChannelsUpdateColorRequest struct { // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // Whether to change the accent color emoji pattern of the profile page; otherwise, the - // accent color and emoji pattern of messages will be changed. + // accent color and emoji pattern of messages will be changed. Channels can change both + // message and profile palettes; supergroups can only change the profile palette, of + // course after reaching the appropriate boost level¹. + // + // Links: + // 1) https://core.telegram.org/api/colors ForProfile bool // Channel whose accent color should be changed. Channel InputChannelClass diff --git a/vendor/github.com/gotd/td/tg/tl_channels_update_emoji_status_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_update_emoji_status_gen.go index 68e6d7ce..ea08c46d 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_update_emoji_status_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_update_emoji_status_gen.go @@ -32,17 +32,19 @@ var ( ) // ChannelsUpdateEmojiStatusRequest represents TL type `channels.updateEmojiStatus#f0d3e6a8`. -// Set an emoji status¹ for a channel. +// Set an emoji status¹ for a channel or supergroup. // // Links: // 1. https://core.telegram.org/api/emoji-status // // See https://core.telegram.org/method/channels.updateEmojiStatus for reference. type ChannelsUpdateEmojiStatusRequest struct { - // The channel, must have at least channel_emoji_status_level_min boosts¹. + // The channel/supergroup, must have at least + // channel_emoji_status_level_min¹/group_emoji_status_level_min² boosts. // // Links: // 1) https://core.telegram.org/api/config#channel-emoji-status-level-min + // 2) https://core.telegram.org/api/config#group-emoji-status-level-min Channel InputChannelClass // Emoji status¹ to set // @@ -218,7 +220,7 @@ func (u *ChannelsUpdateEmojiStatusRequest) GetEmojiStatusAsNotEmpty() (NotEmptyE } // ChannelsUpdateEmojiStatus invokes method channels.updateEmojiStatus#f0d3e6a8 returning error if any. -// Set an emoji status¹ for a channel. +// Set an emoji status¹ for a channel or supergroup. // // Links: // 1. https://core.telegram.org/api/emoji-status diff --git a/vendor/github.com/gotd/td/tg/tl_channels_update_pinned_forum_topic_gen.go b/vendor/github.com/gotd/td/tg/tl_channels_update_pinned_forum_topic_gen.go index d34294b6..910b0588 100644 --- a/vendor/github.com/gotd/td/tg/tl_channels_update_pinned_forum_topic_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_channels_update_pinned_forum_topic_gen.go @@ -239,10 +239,10 @@ func (u *ChannelsUpdatePinnedForumTopicRequest) GetChannelAsNotEmpty() (NotEmpty // // Possible errors: // +// 400 CHANNEL_INVALID: The provided channel is invalid. // 400 TOPIC_ID_INVALID: The specified topic ID is invalid. // // See https://core.telegram.org/method/channels.updatePinnedForumTopic for reference. -// Can be used by bots. func (c *Client) ChannelsUpdatePinnedForumTopic(ctx context.Context, request *ChannelsUpdatePinnedForumTopicRequest) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_chat_full_gen.go b/vendor/github.com/gotd/td/tg/tl_chat_full_gen.go index bbb29a4e..310cd377 100644 --- a/vendor/github.com/gotd/td/tg/tl_chat_full_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_chat_full_gen.go @@ -33,9 +33,13 @@ var ( // ChatFull represents TL type `chatFull#2633421b`. // Full info about a basic group¹. +// When updating the local peer database »¹, all fields from the newly received +// constructor take priority over the old constructor cached locally (including by +// removing fields that aren't set in the new constructor). // // Links: // 1. https://core.telegram.org/api/channel#basic-groups +// 2. https://core.telegram.org/api/peers // // See https://core.telegram.org/constructor/chatFull for reference. type ChatFull struct { @@ -128,7 +132,11 @@ type ChatFull struct { // // Use SetAvailableReactions and GetAvailableReactions helpers. AvailableReactions ChatReactionsClass - // ReactionsLimit field of ChatFull. + // This flag may be used to impose a custom limit of unique reactions (i.e. a + // customizable version of appConfig.reactions_uniq_max¹). + // + // Links: + // 1) https://core.telegram.org/api/config#reactions-uniq-max // // Use SetReactionsLimit and GetReactionsLimit helpers. ReactionsLimit int @@ -1077,11 +1085,15 @@ func (c *ChatFull) GetReactionsLimit() (value int, ok bool) { // ChannelFull represents TL type `channelFull#bbab348d`. // Full info about a channel¹, supergroup² or gigagroup³. +// When updating the local peer database »¹, all fields from the newly received +// constructor take priority over the old constructor cached locally (including by +// removing fields that aren't set in the new constructor). // // Links: // 1. https://core.telegram.org/api/channel#channels // 2. https://core.telegram.org/api/channel#supergroups // 3. https://core.telegram.org/api/channel#gigagroups +// 4. https://core.telegram.org/api/peers // // See https://core.telegram.org/constructor/channelFull for reference. type ChannelFull struct { @@ -1150,10 +1162,29 @@ type ChannelFull struct { // 1) https://core.telegram.org/api/forum // 2) https://core.telegram.org/method/channels.toggleViewForumAsMessages ViewForumAsMessages bool - // RestrictedSponsored field of ChannelFull. + // Whether ads on this channel were disabled as specified here »¹ (this flag is only + // visible to the owner of the channel). + // + // Links: + // 1) https://core.telegram.org/api/boost#disable-ads-on-the-channel RestrictedSponsored bool - // CanViewRevenue field of ChannelFull. + // If set, this user can view ad revenue statistics »¹ for this channel. + // + // Links: + // 1) https://core.telegram.org/api/revenue#revenue-statistics CanViewRevenue bool + // Whether the current user can send or forward paid media »¹ to this channel. + // + // Links: + // 1) https://core.telegram.org/api/paid-media + PaidMediaAllowed bool + // If set, this user can view Telegram Star revenue statistics »¹ for this channel. + // + // Links: + // 1) https://core.telegram.org/api/stars#revenue-statistics + CanViewStarsRevenue bool + // PaidReactionsAvailable field of ChannelFull. + PaidReactionsAvailable bool // ID of the channel ID int64 // Info about the channel @@ -1236,7 +1267,8 @@ type ChannelFull struct { // // Use SetFolderID and GetFolderID helpers. FolderID int - // ID of the linked discussion chat¹ for channels + // ID of the linked discussion chat¹ for channels (and vice versa, the ID of the linked + // channel for discussion chats). // // Links: // 1) https://core.telegram.org/api/discussion @@ -1316,7 +1348,11 @@ type ChannelFull struct { // // Use SetAvailableReactions and GetAvailableReactions helpers. AvailableReactions ChatReactionsClass - // ReactionsLimit field of ChannelFull. + // This flag may be used to impose a custom limit of unique reactions (i.e. a + // customizable version of appConfig.reactions_uniq_max¹). + // + // Links: + // 1) https://core.telegram.org/api/config#reactions-uniq-max // // Use SetReactionsLimit and GetReactionsLimit helpers. ReactionsLimit int @@ -1334,15 +1370,30 @@ type ChannelFull struct { // // Use SetWallpaper and GetWallpaper helpers. Wallpaper WallPaperClass - // BoostsApplied field of ChannelFull. + // The number of boosts¹ the current user has applied to the current supergroup. + // + // Links: + // 1) https://core.telegram.org/api/boost // // Use SetBoostsApplied and GetBoostsApplied helpers. BoostsApplied int - // BoostsUnrestrict field of ChannelFull. + // The number of boosts¹ this supergroup requires to bypass slowmode and other + // restrictions, see here »² for more info. + // + // Links: + // 1) https://core.telegram.org/api/boost + // 2) https://core.telegram.org/api/boost#bypass-slowmode-and-chat-restrictions // // Use SetBoostsUnrestrict and GetBoostsUnrestrict helpers. BoostsUnrestrict int - // Emojiset field of ChannelFull. + // Custom emoji stickerset¹ associated to the current supergroup, set using channels + // setEmojiStickers² after reaching the appropriate boost level, see here »³ for more + // info. + // + // Links: + // 1) https://core.telegram.org/api/custom-emoji + // 2) https://core.telegram.org/method/channels.setEmojiStickers + // 3) https://core.telegram.org/api/boost#setting-a-custom-emoji-stickerset-for-supergroups // // Use SetEmojiset and GetEmojiset helpers. Emojiset StickerSet @@ -1422,6 +1473,15 @@ func (c *ChannelFull) Zero() bool { if !(c.CanViewRevenue == false) { return false } + if !(c.PaidMediaAllowed == false) { + return false + } + if !(c.CanViewStarsRevenue == false) { + return false + } + if !(c.PaidReactionsAvailable == false) { + return false + } if !(c.ID == 0) { return false } @@ -1576,6 +1636,9 @@ func (c *ChannelFull) FillFrom(from interface { GetViewForumAsMessages() (value bool) GetRestrictedSponsored() (value bool) GetCanViewRevenue() (value bool) + GetPaidMediaAllowed() (value bool) + GetCanViewStarsRevenue() (value bool) + GetPaidReactionsAvailable() (value bool) GetID() (value int64) GetAbout() (value string) GetParticipantsCount() (value int, ok bool) @@ -1634,6 +1697,9 @@ func (c *ChannelFull) FillFrom(from interface { c.ViewForumAsMessages = from.GetViewForumAsMessages() c.RestrictedSponsored = from.GetRestrictedSponsored() c.CanViewRevenue = from.GetCanViewRevenue() + c.PaidMediaAllowed = from.GetPaidMediaAllowed() + c.CanViewStarsRevenue = from.GetCanViewStarsRevenue() + c.PaidReactionsAvailable = from.GetPaidReactionsAvailable() c.ID = from.GetID() c.About = from.GetAbout() if val, ok := from.GetParticipantsCount(); ok { @@ -1876,6 +1942,21 @@ func (c *ChannelFull) TypeInfo() tdp.Type { SchemaName: "can_view_revenue", Null: !c.Flags2.Has(12), }, + { + Name: "PaidMediaAllowed", + SchemaName: "paid_media_allowed", + Null: !c.Flags2.Has(14), + }, + { + Name: "CanViewStarsRevenue", + SchemaName: "can_view_stars_revenue", + Null: !c.Flags2.Has(15), + }, + { + Name: "PaidReactionsAvailable", + SchemaName: "paid_reactions_available", + Null: !c.Flags2.Has(16), + }, { Name: "ID", SchemaName: "id", @@ -2126,6 +2207,15 @@ func (c *ChannelFull) SetFlags() { if !(c.CanViewRevenue == false) { c.Flags2.Set(12) } + if !(c.PaidMediaAllowed == false) { + c.Flags2.Set(14) + } + if !(c.CanViewStarsRevenue == false) { + c.Flags2.Set(15) + } + if !(c.PaidReactionsAvailable == false) { + c.Flags2.Set(16) + } if !(c.ParticipantsCount == 0) { c.Flags.Set(0) } @@ -2451,6 +2541,9 @@ func (c *ChannelFull) DecodeBare(b *bin.Buffer) error { c.ViewForumAsMessages = c.Flags2.Has(6) c.RestrictedSponsored = c.Flags2.Has(11) c.CanViewRevenue = c.Flags2.Has(12) + c.PaidMediaAllowed = c.Flags2.Has(14) + c.CanViewStarsRevenue = c.Flags2.Has(15) + c.PaidReactionsAvailable = c.Flags2.Has(16) { value, err := b.Long() if err != nil { @@ -3065,6 +3158,63 @@ func (c *ChannelFull) GetCanViewRevenue() (value bool) { return c.Flags2.Has(12) } +// SetPaidMediaAllowed sets value of PaidMediaAllowed conditional field. +func (c *ChannelFull) SetPaidMediaAllowed(value bool) { + if value { + c.Flags2.Set(14) + c.PaidMediaAllowed = true + } else { + c.Flags2.Unset(14) + c.PaidMediaAllowed = false + } +} + +// GetPaidMediaAllowed returns value of PaidMediaAllowed conditional field. +func (c *ChannelFull) GetPaidMediaAllowed() (value bool) { + if c == nil { + return + } + return c.Flags2.Has(14) +} + +// SetCanViewStarsRevenue sets value of CanViewStarsRevenue conditional field. +func (c *ChannelFull) SetCanViewStarsRevenue(value bool) { + if value { + c.Flags2.Set(15) + c.CanViewStarsRevenue = true + } else { + c.Flags2.Unset(15) + c.CanViewStarsRevenue = false + } +} + +// GetCanViewStarsRevenue returns value of CanViewStarsRevenue conditional field. +func (c *ChannelFull) GetCanViewStarsRevenue() (value bool) { + if c == nil { + return + } + return c.Flags2.Has(15) +} + +// SetPaidReactionsAvailable sets value of PaidReactionsAvailable conditional field. +func (c *ChannelFull) SetPaidReactionsAvailable(value bool) { + if value { + c.Flags2.Set(16) + c.PaidReactionsAvailable = true + } else { + c.Flags2.Unset(16) + c.PaidReactionsAvailable = false + } +} + +// GetPaidReactionsAvailable returns value of PaidReactionsAvailable conditional field. +func (c *ChannelFull) GetPaidReactionsAvailable() (value bool) { + if c == nil { + return + } + return c.Flags2.Has(16) +} + // GetID returns value of ID field. func (c *ChannelFull) GetID() (value int64) { if c == nil { @@ -3818,7 +3968,11 @@ type ChatFullClass interface { // 1) https://core.telegram.org/api/reactions GetAvailableReactions() (value ChatReactionsClass, ok bool) - // ReactionsLimit field of ChatFull. + // This flag may be used to impose a custom limit of unique reactions (i.e. a + // customizable version of appConfig.reactions_uniq_max¹). + // + // Links: + // 1) https://core.telegram.org/api/config#reactions-uniq-max GetReactionsLimit() (value int, ok bool) } diff --git a/vendor/github.com/gotd/td/tg/tl_chat_gen.go b/vendor/github.com/gotd/td/tg/tl_chat_gen.go index cbe4b3a4..ec936d56 100644 --- a/vendor/github.com/gotd/td/tg/tl_chat_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_chat_gen.go @@ -167,7 +167,17 @@ func (c *ChatEmpty) GetID() (value int64) { } // Chat represents TL type `chat#41cbf256`. -// Info about a group +// Info about a group. +// When updating the local peer database¹, all fields from the newly received +// constructor take priority over the old constructor cached locally (including by +// removing fields that aren't set in the new constructor). +// See here »¹ for an implementation of the logic to use when updating the local user +// peer database². +// +// Links: +// 1. https://core.telegram.org/api/peers +// 2. https://github.com/tdlib/td/blob/a24af0992245f838f2b4b418a0a2d5fa9caa27b5/td/telegram/ChatManager.cpp#L5152 +// 3. https://core.telegram.org/api/peers // // See https://core.telegram.org/constructor/chat for reference. type Chat struct { @@ -194,7 +204,10 @@ type Chat struct { // Links: // 1) https://telegram.org/blog/protected-content-delete-by-date-and-more Noforwards bool - // ID of the group + // ID of the group, see here »¹ for more info + // + // Links: + // 1) https://core.telegram.org/api/peers#peer-id ID int64 // Title Title string @@ -999,8 +1012,20 @@ func (c *ChatForbidden) GetTitle() (value string) { return c.Title } -// Channel represents TL type `channel#aadfc8f`. +// Channel represents TL type `channel#fe4478bd`. // Channel/supergroup info +// When updating the local peer database¹, all fields from the newly received +// constructor take priority over the old constructor cached locally (including by +// removing fields that aren't set in the new constructor). +// The only exception to the above rule is when the min flag is set, in which case only +// the following fields must be applied over any locally stored version: +// See here »¹ for an implementation of the logic to use when updating the local user +// peer database². +// +// Links: +// 1. https://core.telegram.org/api/peers +// 2. https://github.com/tdlib/td/blob/a24af0992245f838f2b4b418a0a2d5fa9caa27b5/td/telegram/ChatManager.cpp#L8329 +// 3. https://core.telegram.org/api/peers // // See https://core.telegram.org/constructor/channel for reference. type Channel struct { @@ -1017,9 +1042,14 @@ type Channel struct { Broadcast bool // Is this channel verified by telegram? Verified bool - // Is this a supergroup? + // Is this a supergroup? Changes to this flag should invalidate the local channelFull¹ + // cache for this channel/supergroup ID, see here »² for more info. + // + // Links: + // 1) https://core.telegram.org/constructor/channelFull + // 2) https://core.telegram.org/api/peers#full-info-database Megagroup bool - // Whether viewing/writing in this channel for a reason (see restriction_reason + // Whether viewing/writing in this channel for a reason (see restriction_reason) Restricted bool // Whether signatures are enabled (channels) Signatures bool @@ -1028,28 +1058,54 @@ type Channel struct { // Links: // 1) https://core.telegram.org/api/min Min bool - // This channel/supergroup is probably a scam + // This channel/supergroup is probably a scam Changes to this flag should invalidate the + // local channelFull¹ cache for this channel/supergroup ID, see here »² for more info. + // + // Links: + // 1) https://core.telegram.org/constructor/channelFull + // 2) https://core.telegram.org/api/peers#full-info-database Scam bool - // Whether this channel has a private join link + // Whether this channel has a linked discussion group »¹ (or this supergroup is a + // channel's discussion group). The actual ID of the linked channel/supergroup is + // contained in channelFull².linked_chat_id. Changes to this flag should invalidate the + // local channelFull³ cache for this channel/supergroup ID, see here »⁴ for more info. + // + // Links: + // 1) https://core.telegram.org/api/discussion + // 2) https://core.telegram.org/constructor/channelFull + // 3) https://core.telegram.org/constructor/channelFull + // 4) https://core.telegram.org/api/peers#full-info-database HasLink bool // Whether this chanel has a geoposition HasGeo bool - // Whether slow mode is enabled for groups to prevent flood in chat + // Whether slow mode is enabled for groups to prevent flood in chat. Changes to this flag + // should invalidate the local channelFull¹ cache for this channel/supergroup ID, see + // here »² for more info. + // + // Links: + // 1) https://core.telegram.org/constructor/channelFull + // 2) https://core.telegram.org/api/peers#full-info-database SlowmodeEnabled bool // Whether a group call or livestream is currently active CallActive bool // Whether there's anyone in the group call or livestream CallNotEmpty bool // If set, this supergroup/channel¹ was reported by many users as a fake or scam: be - // careful when interacting with it. + // careful when interacting with it. Changes to this flag should invalidate the local + // channelFull² cache for this channel/supergroup ID, see here »³ for more info. // // Links: // 1) https://core.telegram.org/api/channel + // 2) https://core.telegram.org/constructor/channelFull + // 3) https://core.telegram.org/api/peers#full-info-database Fake bool - // Whether this supergroup¹ is a gigagroup + // Whether this supergroup¹ is a gigagroupChanges to this flag should invalidate the + // local channelFull² cache for this channel/supergroup ID, see here »³ for more info. // // Links: // 1) https://core.telegram.org/api/channel + // 2) https://core.telegram.org/constructor/channelFull + // 3) https://core.telegram.org/api/peers#full-info-database Gigagroup bool // Whether this channel or group is protected¹, thus does not allow forwarding messages // from it @@ -1058,23 +1114,33 @@ type Channel struct { // 1) https://telegram.org/blog/protected-content-delete-by-date-and-more Noforwards bool // Whether a user needs to join the supergroup before they can send messages: can be - // false only for discussion groups »¹, toggle using channels.toggleJoinToSend² + // false only for discussion groups »¹, toggle using channels.toggleJoinToSend²Changes + // to this flag should invalidate the local channelFull³ cache for this + // channel/supergroup ID, see here »⁴ for more info. // // Links: // 1) https://core.telegram.org/api/discussion // 2) https://core.telegram.org/method/channels.toggleJoinToSend + // 3) https://core.telegram.org/constructor/channelFull + // 4) https://core.telegram.org/api/peers#full-info-database JoinToSend bool // Whether a user's join request will have to be approved by administrators¹, toggle - // using channels.toggleJoinToSend² + // using channels.toggleJoinToSend²Changes to this flag should invalidate the local + // channelFull³ cache for this channel/supergroup ID, see here »⁴ for more info. // // Links: // 1) https://core.telegram.org/api/invites#join-requests // 2) https://core.telegram.org/method/channels.toggleJoinRequest + // 3) https://core.telegram.org/constructor/channelFull + // 4) https://core.telegram.org/api/peers#full-info-database JoinRequest bool - // Whether this supergroup is a forum¹ + // Whether this supergroup is a forum¹. Changes to this flag should invalidate the local + // channelFull² cache for this channel/supergroup ID, see here »³ for more info. // // Links: // 1) https://core.telegram.org/api/forum + // 2) https://core.telegram.org/constructor/channelFull + // 3) https://core.telegram.org/api/peers#full-info-database Forum bool // Flags, see TL conditional fields¹ // @@ -1095,15 +1161,23 @@ type Channel struct { StoriesHiddenMin bool // No stories from the channel are visible. StoriesUnavailable bool - // ID of the channel + // SignatureProfiles field of Channel. + SignatureProfiles bool + // ID of the channel, see here »¹ for more info + // + // Links: + // 1) https://core.telegram.org/api/peers#peer-id ID int64 - // Access hash + // Access hash, see here »¹ for more info + // + // Links: + // 1) https://core.telegram.org/api/peers#access-hash // // Use SetAccessHash and GetAccessHash helpers. AccessHash int64 // Title Title string - // Username + // Main active username. // // Use SetUsername and GetUsername helpers. Username string @@ -1112,7 +1186,13 @@ type Channel struct { // Date when the user joined the supergroup/channel, or if the user isn't a member, its // creation date Date int - // Contains the reason why access to this channel must be restricted. + // Contains the reason why access to this channel must be restricted. Changes to this + // flag should invalidate the local channelFull¹ cache for this channel/supergroup ID, + // see here »² for more info. + // + // Links: + // 1) https://core.telegram.org/constructor/channelFull + // 2) https://core.telegram.org/api/peers#full-info-database // // Use SetRestrictionReason and GetRestrictionReason helpers. RestrictionReason []RestrictionReason @@ -1173,17 +1253,24 @@ type Channel struct { // // Use SetEmojiStatus and GetEmojiStatus helpers. EmojiStatus EmojiStatusClass - // Boost level¹ + // Boost level¹. Changes to this flag should invalidate the local channelFull² cache + // for this channel/supergroup ID, see here »³ for more info. // // Links: // 1) https://core.telegram.org/api/boost + // 2) https://core.telegram.org/constructor/channelFull + // 3) https://core.telegram.org/api/peers#full-info-database // // Use SetLevel and GetLevel helpers. Level int + // SubscriptionUntilDate field of Channel. + // + // Use SetSubscriptionUntilDate and GetSubscriptionUntilDate helpers. + SubscriptionUntilDate int } // ChannelTypeID is TL type id of Channel. -const ChannelTypeID = 0xaadfc8f +const ChannelTypeID = 0xfe4478bd // construct implements constructor of ChatClass. func (c Channel) construct() ChatClass { return &c } @@ -1277,6 +1364,9 @@ func (c *Channel) Zero() bool { if !(c.StoriesUnavailable == false) { return false } + if !(c.SignatureProfiles == false) { + return false + } if !(c.ID == 0) { return false } @@ -1328,6 +1418,9 @@ func (c *Channel) Zero() bool { if !(c.Level == 0) { return false } + if !(c.SubscriptionUntilDate == 0) { + return false + } return true } @@ -1366,6 +1459,7 @@ func (c *Channel) FillFrom(from interface { GetStoriesHidden() (value bool) GetStoriesHiddenMin() (value bool) GetStoriesUnavailable() (value bool) + GetSignatureProfiles() (value bool) GetID() (value int64) GetAccessHash() (value int64, ok bool) GetTitle() (value string) @@ -1383,6 +1477,7 @@ func (c *Channel) FillFrom(from interface { GetProfileColor() (value PeerColor, ok bool) GetEmojiStatus() (value EmojiStatusClass, ok bool) GetLevel() (value int, ok bool) + GetSubscriptionUntilDate() (value int, ok bool) }) { c.Creator = from.GetCreator() c.Left = from.GetLeft() @@ -1407,6 +1502,7 @@ func (c *Channel) FillFrom(from interface { c.StoriesHidden = from.GetStoriesHidden() c.StoriesHiddenMin = from.GetStoriesHiddenMin() c.StoriesUnavailable = from.GetStoriesUnavailable() + c.SignatureProfiles = from.GetSignatureProfiles() c.ID = from.GetID() if val, ok := from.GetAccessHash(); ok { c.AccessHash = val @@ -1463,6 +1559,10 @@ func (c *Channel) FillFrom(from interface { c.Level = val } + if val, ok := from.GetSubscriptionUntilDate(); ok { + c.SubscriptionUntilDate = val + } + } // TypeID returns type id in TL schema. @@ -1603,6 +1703,11 @@ func (c *Channel) TypeInfo() tdp.Type { SchemaName: "stories_unavailable", Null: !c.Flags2.Has(3), }, + { + Name: "SignatureProfiles", + SchemaName: "signature_profiles", + Null: !c.Flags2.Has(12), + }, { Name: "ID", SchemaName: "id", @@ -1684,6 +1789,11 @@ func (c *Channel) TypeInfo() tdp.Type { SchemaName: "level", Null: !c.Flags2.Has(10), }, + { + Name: "SubscriptionUntilDate", + SchemaName: "subscription_until_date", + Null: !c.Flags2.Has(11), + }, } return typ } @@ -1759,6 +1869,9 @@ func (c *Channel) SetFlags() { if !(c.StoriesUnavailable == false) { c.Flags2.Set(3) } + if !(c.SignatureProfiles == false) { + c.Flags2.Set(12) + } if !(c.AccessHash == 0) { c.Flags.Set(13) } @@ -1798,12 +1911,15 @@ func (c *Channel) SetFlags() { if !(c.Level == 0) { c.Flags2.Set(10) } + if !(c.SubscriptionUntilDate == 0) { + c.Flags2.Set(11) + } } // Encode implements bin.Encoder. func (c *Channel) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channel#aadfc8f as nil") + return fmt.Errorf("can't encode channel#fe4478bd as nil") } b.PutID(ChannelTypeID) return c.EncodeBare(b) @@ -1812,14 +1928,14 @@ func (c *Channel) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *Channel) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channel#aadfc8f as nil") + return fmt.Errorf("can't encode channel#fe4478bd as nil") } c.SetFlags() if err := c.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#aadfc8f: field flags: %w", err) + return fmt.Errorf("unable to encode channel#fe4478bd: field flags: %w", err) } if err := c.Flags2.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#aadfc8f: field flags2: %w", err) + return fmt.Errorf("unable to encode channel#fe4478bd: field flags2: %w", err) } b.PutLong(c.ID) if c.Flags.Has(13) { @@ -1830,33 +1946,33 @@ func (c *Channel) EncodeBare(b *bin.Buffer) error { b.PutString(c.Username) } if c.Photo == nil { - return fmt.Errorf("unable to encode channel#aadfc8f: field photo is nil") + return fmt.Errorf("unable to encode channel#fe4478bd: field photo is nil") } if err := c.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#aadfc8f: field photo: %w", err) + return fmt.Errorf("unable to encode channel#fe4478bd: field photo: %w", err) } b.PutInt(c.Date) if c.Flags.Has(9) { b.PutVectorHeader(len(c.RestrictionReason)) for idx, v := range c.RestrictionReason { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#aadfc8f: field restriction_reason element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode channel#fe4478bd: field restriction_reason element with index %d: %w", idx, err) } } } if c.Flags.Has(14) { if err := c.AdminRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#aadfc8f: field admin_rights: %w", err) + return fmt.Errorf("unable to encode channel#fe4478bd: field admin_rights: %w", err) } } if c.Flags.Has(15) { if err := c.BannedRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#aadfc8f: field banned_rights: %w", err) + return fmt.Errorf("unable to encode channel#fe4478bd: field banned_rights: %w", err) } } if c.Flags.Has(18) { if err := c.DefaultBannedRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#aadfc8f: field default_banned_rights: %w", err) + return fmt.Errorf("unable to encode channel#fe4478bd: field default_banned_rights: %w", err) } } if c.Flags.Has(17) { @@ -1866,7 +1982,7 @@ func (c *Channel) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(c.Usernames)) for idx, v := range c.Usernames { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#aadfc8f: field usernames element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode channel#fe4478bd: field usernames element with index %d: %w", idx, err) } } } @@ -1875,35 +1991,38 @@ func (c *Channel) EncodeBare(b *bin.Buffer) error { } if c.Flags2.Has(7) { if err := c.Color.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#aadfc8f: field color: %w", err) + return fmt.Errorf("unable to encode channel#fe4478bd: field color: %w", err) } } if c.Flags2.Has(8) { if err := c.ProfileColor.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#aadfc8f: field profile_color: %w", err) + return fmt.Errorf("unable to encode channel#fe4478bd: field profile_color: %w", err) } } if c.Flags2.Has(9) { if c.EmojiStatus == nil { - return fmt.Errorf("unable to encode channel#aadfc8f: field emoji_status is nil") + return fmt.Errorf("unable to encode channel#fe4478bd: field emoji_status is nil") } if err := c.EmojiStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#aadfc8f: field emoji_status: %w", err) + return fmt.Errorf("unable to encode channel#fe4478bd: field emoji_status: %w", err) } } if c.Flags2.Has(10) { b.PutInt(c.Level) } + if c.Flags2.Has(11) { + b.PutInt(c.SubscriptionUntilDate) + } return nil } // Decode implements bin.Decoder. func (c *Channel) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channel#aadfc8f to nil") + return fmt.Errorf("can't decode channel#fe4478bd to nil") } if err := b.ConsumeID(ChannelTypeID); err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: %w", err) } return c.DecodeBare(b) } @@ -1911,11 +2030,11 @@ func (c *Channel) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *Channel) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channel#aadfc8f to nil") + return fmt.Errorf("can't decode channel#fe4478bd to nil") } { if err := c.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field flags: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field flags: %w", err) } } c.Creator = c.Flags.Has(0) @@ -1940,58 +2059,59 @@ func (c *Channel) DecodeBare(b *bin.Buffer) error { c.Forum = c.Flags.Has(30) { if err := c.Flags2.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field flags2: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field flags2: %w", err) } } c.StoriesHidden = c.Flags2.Has(1) c.StoriesHiddenMin = c.Flags2.Has(2) c.StoriesUnavailable = c.Flags2.Has(3) + c.SignatureProfiles = c.Flags2.Has(12) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field id: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field id: %w", err) } c.ID = value } if c.Flags.Has(13) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field access_hash: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field access_hash: %w", err) } c.AccessHash = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field title: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field title: %w", err) } c.Title = value } if c.Flags.Has(6) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field username: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field username: %w", err) } c.Username = value } { value, err := DecodeChatPhoto(b) if err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field photo: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field photo: %w", err) } c.Photo = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field date: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field date: %w", err) } c.Date = value } if c.Flags.Has(9) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field restriction_reason: %w", err) } if headerLen > 0 { @@ -2000,37 +2120,37 @@ func (c *Channel) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value RestrictionReason if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field restriction_reason: %w", err) } c.RestrictionReason = append(c.RestrictionReason, value) } } if c.Flags.Has(14) { if err := c.AdminRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field admin_rights: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field admin_rights: %w", err) } } if c.Flags.Has(15) { if err := c.BannedRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field banned_rights: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field banned_rights: %w", err) } } if c.Flags.Has(18) { if err := c.DefaultBannedRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field default_banned_rights: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field default_banned_rights: %w", err) } } if c.Flags.Has(17) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field participants_count: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field participants_count: %w", err) } c.ParticipantsCount = value } if c.Flags2.Has(0) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field usernames: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field usernames: %w", err) } if headerLen > 0 { @@ -2039,7 +2159,7 @@ func (c *Channel) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value Username if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field usernames: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field usernames: %w", err) } c.Usernames = append(c.Usernames, value) } @@ -2047,34 +2167,41 @@ func (c *Channel) DecodeBare(b *bin.Buffer) error { if c.Flags2.Has(4) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field stories_max_id: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field stories_max_id: %w", err) } c.StoriesMaxID = value } if c.Flags2.Has(7) { if err := c.Color.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field color: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field color: %w", err) } } if c.Flags2.Has(8) { if err := c.ProfileColor.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field profile_color: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field profile_color: %w", err) } } if c.Flags2.Has(9) { value, err := DecodeEmojiStatus(b) if err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field emoji_status: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field emoji_status: %w", err) } c.EmojiStatus = value } if c.Flags2.Has(10) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channel#aadfc8f: field level: %w", err) + return fmt.Errorf("unable to decode channel#fe4478bd: field level: %w", err) } c.Level = value } + if c.Flags2.Has(11) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode channel#fe4478bd: field subscription_until_date: %w", err) + } + c.SubscriptionUntilDate = value + } return nil } @@ -2515,6 +2642,25 @@ func (c *Channel) GetStoriesUnavailable() (value bool) { return c.Flags2.Has(3) } +// SetSignatureProfiles sets value of SignatureProfiles conditional field. +func (c *Channel) SetSignatureProfiles(value bool) { + if value { + c.Flags2.Set(12) + c.SignatureProfiles = true + } else { + c.Flags2.Unset(12) + c.SignatureProfiles = false + } +} + +// GetSignatureProfiles returns value of SignatureProfiles conditional field. +func (c *Channel) GetSignatureProfiles() (value bool) { + if c == nil { + return + } + return c.Flags2.Has(12) +} + // GetID returns value of ID field. func (c *Channel) GetID() (value int64) { if c == nil { @@ -2781,6 +2927,24 @@ func (c *Channel) GetLevel() (value int, ok bool) { return c.Level, true } +// SetSubscriptionUntilDate sets value of SubscriptionUntilDate conditional field. +func (c *Channel) SetSubscriptionUntilDate(value int) { + c.Flags2.Set(11) + c.SubscriptionUntilDate = value +} + +// GetSubscriptionUntilDate returns value of SubscriptionUntilDate conditional field and +// boolean which is true if field was set. +func (c *Channel) GetSubscriptionUntilDate() (value int, ok bool) { + if c == nil { + return + } + if !c.Flags2.Has(11) { + return value, false + } + return c.SubscriptionUntilDate, true +} + // ChannelForbidden represents TL type `channelForbidden#17d493d5`. // Indicates a channel/supergroup we can't access because we were banned, or for some // other reason. @@ -3127,7 +3291,7 @@ const ChatClassName = "Chat" // case *tg.ChatEmpty: // chatEmpty#29562865 // case *tg.Chat: // chat#41cbf256 // case *tg.ChatForbidden: // chatForbidden#6592a1a7 -// case *tg.Channel: // channel#aadfc8f +// case *tg.Channel: // channel#fe4478bd // case *tg.ChannelForbidden: // channelForbidden#17d493d5 // default: panic(v) // } @@ -3209,7 +3373,10 @@ type NotEmptyChat interface { // Zero returns true if current object has a zero value. Zero() bool - // ID of the group + // ID of the group, see here »¹ for more info + // + // Links: + // 1) https://core.telegram.org/api/peers#peer-id GetID() (value int64) // Title @@ -3336,7 +3503,10 @@ type FullChat interface { // 1) https://telegram.org/blog/protected-content-delete-by-date-and-more GetNoforwards() (value bool) - // ID of the group + // ID of the group, see here »¹ for more info + // + // Links: + // 1) https://core.telegram.org/api/peers#peer-id GetID() (value int64) // Title @@ -3420,7 +3590,7 @@ func DecodeChat(buf *bin.Buffer) (ChatClass, error) { } return &v, nil case ChannelTypeID: - // Decoding channel#aadfc8f. + // Decoding channel#fe4478bd. v := Channel{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatClass: %w", err) diff --git a/vendor/github.com/gotd/td/tg/tl_chat_invite_gen.go b/vendor/github.com/gotd/td/tg/tl_chat_invite_gen.go index d0b4082e..20ce24d9 100644 --- a/vendor/github.com/gotd/td/tg/tl_chat_invite_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_chat_invite_gen.go @@ -171,7 +171,7 @@ func (c *ChatInviteAlready) GetChat() (value ChatClass) { return c.Chat } -// ChatInvite represents TL type `chatInvite#cde0ec40`. +// ChatInvite represents TL type `chatInvite#fe65389d`. // Chat invite info // // See https://core.telegram.org/constructor/chatInvite for reference. @@ -214,6 +214,8 @@ type ChatInvite struct { // If set, this chat was reported by many users as a fake or scam: be careful when // interacting with it. Fake bool + // CanRefulfillSubscription field of ChatInvite. + CanRefulfillSubscription bool // Chat/supergroup/channel title Title string // Description of the group of channel @@ -233,10 +235,18 @@ type ChatInvite struct { // Links: // 1) https://core.telegram.org/api/colors Color int + // SubscriptionPricing field of ChatInvite. + // + // Use SetSubscriptionPricing and GetSubscriptionPricing helpers. + SubscriptionPricing StarsSubscriptionPricing + // SubscriptionFormID field of ChatInvite. + // + // Use SetSubscriptionFormID and GetSubscriptionFormID helpers. + SubscriptionFormID int64 } // ChatInviteTypeID is TL type id of ChatInvite. -const ChatInviteTypeID = 0xcde0ec40 +const ChatInviteTypeID = 0xfe65389d // construct implements constructor of ChatInviteClass. func (c ChatInvite) construct() ChatInviteClass { return &c } @@ -282,6 +292,9 @@ func (c *ChatInvite) Zero() bool { if !(c.Fake == false) { return false } + if !(c.CanRefulfillSubscription == false) { + return false + } if !(c.Title == "") { return false } @@ -300,6 +313,12 @@ func (c *ChatInvite) Zero() bool { if !(c.Color == 0) { return false } + if !(c.SubscriptionPricing.Zero()) { + return false + } + if !(c.SubscriptionFormID == 0) { + return false + } return true } @@ -323,12 +342,15 @@ func (c *ChatInvite) FillFrom(from interface { GetVerified() (value bool) GetScam() (value bool) GetFake() (value bool) + GetCanRefulfillSubscription() (value bool) GetTitle() (value string) GetAbout() (value string, ok bool) GetPhoto() (value PhotoClass) GetParticipantsCount() (value int) GetParticipants() (value []UserClass, ok bool) GetColor() (value int) + GetSubscriptionPricing() (value StarsSubscriptionPricing, ok bool) + GetSubscriptionFormID() (value int64, ok bool) }) { c.Channel = from.GetChannel() c.Broadcast = from.GetBroadcast() @@ -338,6 +360,7 @@ func (c *ChatInvite) FillFrom(from interface { c.Verified = from.GetVerified() c.Scam = from.GetScam() c.Fake = from.GetFake() + c.CanRefulfillSubscription = from.GetCanRefulfillSubscription() c.Title = from.GetTitle() if val, ok := from.GetAbout(); ok { c.About = val @@ -350,6 +373,14 @@ func (c *ChatInvite) FillFrom(from interface { } c.Color = from.GetColor() + if val, ok := from.GetSubscriptionPricing(); ok { + c.SubscriptionPricing = val + } + + if val, ok := from.GetSubscriptionFormID(); ok { + c.SubscriptionFormID = val + } + } // TypeID returns type id in TL schema. @@ -415,6 +446,11 @@ func (c *ChatInvite) TypeInfo() tdp.Type { SchemaName: "fake", Null: !c.Flags.Has(9), }, + { + Name: "CanRefulfillSubscription", + SchemaName: "can_refulfill_subscription", + Null: !c.Flags.Has(11), + }, { Name: "Title", SchemaName: "title", @@ -441,6 +477,16 @@ func (c *ChatInvite) TypeInfo() tdp.Type { Name: "Color", SchemaName: "color", }, + { + Name: "SubscriptionPricing", + SchemaName: "subscription_pricing", + Null: !c.Flags.Has(10), + }, + { + Name: "SubscriptionFormID", + SchemaName: "subscription_form_id", + Null: !c.Flags.Has(12), + }, } return typ } @@ -471,18 +517,27 @@ func (c *ChatInvite) SetFlags() { if !(c.Fake == false) { c.Flags.Set(9) } + if !(c.CanRefulfillSubscription == false) { + c.Flags.Set(11) + } if !(c.About == "") { c.Flags.Set(5) } if !(c.Participants == nil) { c.Flags.Set(4) } + if !(c.SubscriptionPricing.Zero()) { + c.Flags.Set(10) + } + if !(c.SubscriptionFormID == 0) { + c.Flags.Set(12) + } } // Encode implements bin.Encoder. func (c *ChatInvite) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatInvite#cde0ec40 as nil") + return fmt.Errorf("can't encode chatInvite#fe65389d as nil") } b.PutID(ChatInviteTypeID) return c.EncodeBare(b) @@ -491,45 +546,53 @@ func (c *ChatInvite) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatInvite) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatInvite#cde0ec40 as nil") + return fmt.Errorf("can't encode chatInvite#fe65389d as nil") } c.SetFlags() if err := c.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatInvite#cde0ec40: field flags: %w", err) + return fmt.Errorf("unable to encode chatInvite#fe65389d: field flags: %w", err) } b.PutString(c.Title) if c.Flags.Has(5) { b.PutString(c.About) } if c.Photo == nil { - return fmt.Errorf("unable to encode chatInvite#cde0ec40: field photo is nil") + return fmt.Errorf("unable to encode chatInvite#fe65389d: field photo is nil") } if err := c.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatInvite#cde0ec40: field photo: %w", err) + return fmt.Errorf("unable to encode chatInvite#fe65389d: field photo: %w", err) } b.PutInt(c.ParticipantsCount) if c.Flags.Has(4) { b.PutVectorHeader(len(c.Participants)) for idx, v := range c.Participants { if v == nil { - return fmt.Errorf("unable to encode chatInvite#cde0ec40: field participants element with index %d is nil", idx) + return fmt.Errorf("unable to encode chatInvite#fe65389d: field participants element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatInvite#cde0ec40: field participants element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode chatInvite#fe65389d: field participants element with index %d: %w", idx, err) } } } b.PutInt(c.Color) + if c.Flags.Has(10) { + if err := c.SubscriptionPricing.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatInvite#fe65389d: field subscription_pricing: %w", err) + } + } + if c.Flags.Has(12) { + b.PutLong(c.SubscriptionFormID) + } return nil } // Decode implements bin.Decoder. func (c *ChatInvite) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatInvite#cde0ec40 to nil") + return fmt.Errorf("can't decode chatInvite#fe65389d to nil") } if err := b.ConsumeID(ChatInviteTypeID); err != nil { - return fmt.Errorf("unable to decode chatInvite#cde0ec40: %w", err) + return fmt.Errorf("unable to decode chatInvite#fe65389d: %w", err) } return c.DecodeBare(b) } @@ -537,11 +600,11 @@ func (c *ChatInvite) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatInvite) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatInvite#cde0ec40 to nil") + return fmt.Errorf("can't decode chatInvite#fe65389d to nil") } { if err := c.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatInvite#cde0ec40: field flags: %w", err) + return fmt.Errorf("unable to decode chatInvite#fe65389d: field flags: %w", err) } } c.Channel = c.Flags.Has(0) @@ -552,38 +615,39 @@ func (c *ChatInvite) DecodeBare(b *bin.Buffer) error { c.Verified = c.Flags.Has(7) c.Scam = c.Flags.Has(8) c.Fake = c.Flags.Has(9) + c.CanRefulfillSubscription = c.Flags.Has(11) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatInvite#cde0ec40: field title: %w", err) + return fmt.Errorf("unable to decode chatInvite#fe65389d: field title: %w", err) } c.Title = value } if c.Flags.Has(5) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatInvite#cde0ec40: field about: %w", err) + return fmt.Errorf("unable to decode chatInvite#fe65389d: field about: %w", err) } c.About = value } { value, err := DecodePhoto(b) if err != nil { - return fmt.Errorf("unable to decode chatInvite#cde0ec40: field photo: %w", err) + return fmt.Errorf("unable to decode chatInvite#fe65389d: field photo: %w", err) } c.Photo = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatInvite#cde0ec40: field participants_count: %w", err) + return fmt.Errorf("unable to decode chatInvite#fe65389d: field participants_count: %w", err) } c.ParticipantsCount = value } if c.Flags.Has(4) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode chatInvite#cde0ec40: field participants: %w", err) + return fmt.Errorf("unable to decode chatInvite#fe65389d: field participants: %w", err) } if headerLen > 0 { @@ -592,7 +656,7 @@ func (c *ChatInvite) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeUser(b) if err != nil { - return fmt.Errorf("unable to decode chatInvite#cde0ec40: field participants: %w", err) + return fmt.Errorf("unable to decode chatInvite#fe65389d: field participants: %w", err) } c.Participants = append(c.Participants, value) } @@ -600,10 +664,22 @@ func (c *ChatInvite) DecodeBare(b *bin.Buffer) error { { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatInvite#cde0ec40: field color: %w", err) + return fmt.Errorf("unable to decode chatInvite#fe65389d: field color: %w", err) } c.Color = value } + if c.Flags.Has(10) { + if err := c.SubscriptionPricing.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatInvite#fe65389d: field subscription_pricing: %w", err) + } + } + if c.Flags.Has(12) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode chatInvite#fe65389d: field subscription_form_id: %w", err) + } + c.SubscriptionFormID = value + } return nil } @@ -759,6 +835,25 @@ func (c *ChatInvite) GetFake() (value bool) { return c.Flags.Has(9) } +// SetCanRefulfillSubscription sets value of CanRefulfillSubscription conditional field. +func (c *ChatInvite) SetCanRefulfillSubscription(value bool) { + if value { + c.Flags.Set(11) + c.CanRefulfillSubscription = true + } else { + c.Flags.Unset(11) + c.CanRefulfillSubscription = false + } +} + +// GetCanRefulfillSubscription returns value of CanRefulfillSubscription conditional field. +func (c *ChatInvite) GetCanRefulfillSubscription() (value bool) { + if c == nil { + return + } + return c.Flags.Has(11) +} + // GetTitle returns value of Title field. func (c *ChatInvite) GetTitle() (value string) { if c == nil { @@ -827,6 +922,42 @@ func (c *ChatInvite) GetColor() (value int) { return c.Color } +// SetSubscriptionPricing sets value of SubscriptionPricing conditional field. +func (c *ChatInvite) SetSubscriptionPricing(value StarsSubscriptionPricing) { + c.Flags.Set(10) + c.SubscriptionPricing = value +} + +// GetSubscriptionPricing returns value of SubscriptionPricing conditional field and +// boolean which is true if field was set. +func (c *ChatInvite) GetSubscriptionPricing() (value StarsSubscriptionPricing, ok bool) { + if c == nil { + return + } + if !c.Flags.Has(10) { + return value, false + } + return c.SubscriptionPricing, true +} + +// SetSubscriptionFormID sets value of SubscriptionFormID conditional field. +func (c *ChatInvite) SetSubscriptionFormID(value int64) { + c.Flags.Set(12) + c.SubscriptionFormID = value +} + +// GetSubscriptionFormID returns value of SubscriptionFormID conditional field and +// boolean which is true if field was set. +func (c *ChatInvite) GetSubscriptionFormID() (value int64, ok bool) { + if c == nil { + return + } + if !c.Flags.Has(12) { + return value, false + } + return c.SubscriptionFormID, true +} + // MapParticipants returns field Participants wrapped in UserClassArray helper. func (c *ChatInvite) MapParticipants() (value UserClassArray, ok bool) { if !c.Flags.Has(4) { @@ -1018,7 +1149,7 @@ const ChatInviteClassName = "ChatInvite" // } // switch v := g.(type) { // case *tg.ChatInviteAlready: // chatInviteAlready#5a686d7c -// case *tg.ChatInvite: // chatInvite#cde0ec40 +// case *tg.ChatInvite: // chatInvite#fe65389d // case *tg.ChatInvitePeek: // chatInvitePeek#61695cb0 // default: panic(v) // } @@ -1056,7 +1187,7 @@ func DecodeChatInvite(buf *bin.Buffer) (ChatInviteClass, error) { } return &v, nil case ChatInviteTypeID: - // Decoding chatInvite#cde0ec40. + // Decoding chatInvite#fe65389d. v := ChatInvite{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatInviteClass: %w", err) diff --git a/vendor/github.com/gotd/td/tg/tl_chatlists_check_chatlist_invite_gen.go b/vendor/github.com/gotd/td/tg/tl_chatlists_check_chatlist_invite_gen.go index c614784f..889876b9 100644 --- a/vendor/github.com/gotd/td/tg/tl_chatlists_check_chatlist_invite_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_chatlists_check_chatlist_invite_gen.go @@ -179,7 +179,6 @@ func (c *ChatlistsCheckChatlistInviteRequest) GetSlug() (value string) { // 400 INVITE_SLUG_EXPIRED: The specified chat folder link has expired. // // See https://core.telegram.org/method/chatlists.checkChatlistInvite for reference. -// Can be used by bots. func (c *Client) ChatlistsCheckChatlistInvite(ctx context.Context, slug string) (ChatlistsChatlistInviteClass, error) { var result ChatlistsChatlistInviteBox diff --git a/vendor/github.com/gotd/td/tg/tl_chatlists_delete_exported_invite_gen.go b/vendor/github.com/gotd/td/tg/tl_chatlists_delete_exported_invite_gen.go index 3b135a46..a68238b9 100644 --- a/vendor/github.com/gotd/td/tg/tl_chatlists_delete_exported_invite_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_chatlists_delete_exported_invite_gen.go @@ -206,7 +206,6 @@ func (d *ChatlistsDeleteExportedInviteRequest) GetSlug() (value string) { // 400 FILTER_NOT_SUPPORTED: The specified filter cannot be used in this context. // // See https://core.telegram.org/method/chatlists.deleteExportedInvite for reference. -// Can be used by bots. func (c *Client) ChatlistsDeleteExportedInvite(ctx context.Context, request *ChatlistsDeleteExportedInviteRequest) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_chatlists_edit_exported_invite_gen.go b/vendor/github.com/gotd/td/tg/tl_chatlists_edit_exported_invite_gen.go index cb8b9fe2..27e47068 100644 --- a/vendor/github.com/gotd/td/tg/tl_chatlists_edit_exported_invite_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_chatlists_edit_exported_invite_gen.go @@ -345,11 +345,14 @@ func (e *ChatlistsEditExportedInviteRequest) MapPeers() (value InputPeerClassArr // // Possible errors: // +// 400 CHANNEL_INVALID: The provided channel is invalid. // 400 FILTER_ID_INVALID: The specified filter ID is invalid. // 400 FILTER_NOT_SUPPORTED: The specified filter cannot be used in this context. +// 400 INVITE_SLUG_EMPTY: The specified invite slug is empty. +// 400 INVITE_SLUG_EXPIRED: The specified chat folder link has expired. +// 400 PEERS_LIST_EMPTY: The specified list of peers is empty. // // See https://core.telegram.org/method/chatlists.editExportedInvite for reference. -// Can be used by bots. func (c *Client) ChatlistsEditExportedInvite(ctx context.Context, request *ChatlistsEditExportedInviteRequest) (*ExportedChatlistInvite, error) { var result ExportedChatlistInvite diff --git a/vendor/github.com/gotd/td/tg/tl_chatlists_export_chatlist_invite_gen.go b/vendor/github.com/gotd/td/tg/tl_chatlists_export_chatlist_invite_gen.go index 021d277a..050e3aa1 100644 --- a/vendor/github.com/gotd/td/tg/tl_chatlists_export_chatlist_invite_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_chatlists_export_chatlist_invite_gen.go @@ -257,7 +257,7 @@ func (e *ChatlistsExportChatlistInviteRequest) MapPeers() (value InputPeerClassA // // 400 FILTER_ID_INVALID: The specified filter ID is invalid. // 400 FILTER_NOT_SUPPORTED: The specified filter cannot be used in this context. -// 400 INVITES_TOO_MUCH: The maximum number of per-folder invites specified by the chatlist_invites_limit_default/chatlist_invites_limit_premium client configuration parameters » was reached. +// 400 INVITES_TOO_MUCH: The maximum number of per-folder invites specified by the chatlist_invites_limit_default/chatlist_invites_limit_premium client configuration parameters » was reached. // 400 PEERS_LIST_EMPTY: The specified list of peers is empty. // // See https://core.telegram.org/method/chatlists.exportChatlistInvite for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_chatlists_get_chatlist_updates_gen.go b/vendor/github.com/gotd/td/tg/tl_chatlists_get_chatlist_updates_gen.go index f07491a2..beb89c4b 100644 --- a/vendor/github.com/gotd/td/tg/tl_chatlists_get_chatlist_updates_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_chatlists_get_chatlist_updates_gen.go @@ -183,7 +183,6 @@ func (g *ChatlistsGetChatlistUpdatesRequest) GetChatlist() (value InputChatlistD // 400 INPUT_CHATLIST_INVALID: The specified folder is invalid. // // See https://core.telegram.org/method/chatlists.getChatlistUpdates for reference. -// Can be used by bots. func (c *Client) ChatlistsGetChatlistUpdates(ctx context.Context, chatlist InputChatlistDialogFilter) (*ChatlistsChatlistUpdates, error) { var result ChatlistsChatlistUpdates diff --git a/vendor/github.com/gotd/td/tg/tl_chatlists_get_exported_invites_gen.go b/vendor/github.com/gotd/td/tg/tl_chatlists_get_exported_invites_gen.go index 919185f1..e72a60e1 100644 --- a/vendor/github.com/gotd/td/tg/tl_chatlists_get_exported_invites_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_chatlists_get_exported_invites_gen.go @@ -170,8 +170,11 @@ func (g *ChatlistsGetExportedInvitesRequest) GetChatlist() (value InputChatlistD // Links: // 1. https://core.telegram.org/api/links#chat-folder-links // +// Possible errors: +// +// 400 FILTER_ID_INVALID: The specified filter ID is invalid. +// // See https://core.telegram.org/method/chatlists.getExportedInvites for reference. -// Can be used by bots. func (c *Client) ChatlistsGetExportedInvites(ctx context.Context, chatlist InputChatlistDialogFilter) (*ChatlistsExportedInvites, error) { var result ChatlistsExportedInvites diff --git a/vendor/github.com/gotd/td/tg/tl_chatlists_get_leave_chatlist_suggestions_gen.go b/vendor/github.com/gotd/td/tg/tl_chatlists_get_leave_chatlist_suggestions_gen.go index 3fe01593..55524bcc 100644 --- a/vendor/github.com/gotd/td/tg/tl_chatlists_get_leave_chatlist_suggestions_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_chatlists_get_leave_chatlist_suggestions_gen.go @@ -180,7 +180,6 @@ func (g *ChatlistsGetLeaveChatlistSuggestionsRequest) GetChatlist() (value Input // 400 FILTER_NOT_SUPPORTED: The specified filter cannot be used in this context. // // See https://core.telegram.org/method/chatlists.getLeaveChatlistSuggestions for reference. -// Can be used by bots. func (c *Client) ChatlistsGetLeaveChatlistSuggestions(ctx context.Context, chatlist InputChatlistDialogFilter) ([]PeerClass, error) { var result PeerClassVector diff --git a/vendor/github.com/gotd/td/tg/tl_chatlists_hide_chatlist_updates_gen.go b/vendor/github.com/gotd/td/tg/tl_chatlists_hide_chatlist_updates_gen.go index 96caa47d..cdef5a91 100644 --- a/vendor/github.com/gotd/td/tg/tl_chatlists_hide_chatlist_updates_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_chatlists_hide_chatlist_updates_gen.go @@ -176,7 +176,6 @@ func (h *ChatlistsHideChatlistUpdatesRequest) GetChatlist() (value InputChatlist // 400 FILTER_NOT_SUPPORTED: The specified filter cannot be used in this context. // // See https://core.telegram.org/method/chatlists.hideChatlistUpdates for reference. -// Can be used by bots. func (c *Client) ChatlistsHideChatlistUpdates(ctx context.Context, chatlist InputChatlistDialogFilter) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_chatlists_join_chatlist_invite_gen.go b/vendor/github.com/gotd/td/tg/tl_chatlists_join_chatlist_invite_gen.go index 2e44aa2d..53bd3911 100644 --- a/vendor/github.com/gotd/td/tg/tl_chatlists_join_chatlist_invite_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_chatlists_join_chatlist_invite_gen.go @@ -235,7 +235,6 @@ func (j *ChatlistsJoinChatlistInviteRequest) MapPeers() (value InputPeerClassArr // 400 INVITE_SLUG_EXPIRED: The specified chat folder link has expired. // // See https://core.telegram.org/method/chatlists.joinChatlistInvite for reference. -// Can be used by bots. func (c *Client) ChatlistsJoinChatlistInvite(ctx context.Context, request *ChatlistsJoinChatlistInviteRequest) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_chatlists_join_chatlist_updates_gen.go b/vendor/github.com/gotd/td/tg/tl_chatlists_join_chatlist_updates_gen.go index 2d94dcc5..9725968c 100644 --- a/vendor/github.com/gotd/td/tg/tl_chatlists_join_chatlist_updates_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_chatlists_join_chatlist_updates_gen.go @@ -231,7 +231,6 @@ func (j *ChatlistsJoinChatlistUpdatesRequest) MapPeers() (value InputPeerClassAr // 400 FILTER_INCLUDE_EMPTY: The include_peers vector of the filter is empty. // // See https://core.telegram.org/method/chatlists.joinChatlistUpdates for reference. -// Can be used by bots. func (c *Client) ChatlistsJoinChatlistUpdates(ctx context.Context, request *ChatlistsJoinChatlistUpdatesRequest) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_chatlists_leave_chatlist_gen.go b/vendor/github.com/gotd/td/tg/tl_chatlists_leave_chatlist_gen.go index 0c214b60..4ffa2e41 100644 --- a/vendor/github.com/gotd/td/tg/tl_chatlists_leave_chatlist_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_chatlists_leave_chatlist_gen.go @@ -220,8 +220,11 @@ func (l *ChatlistsLeaveChatlistRequest) MapPeers() (value InputPeerClassArray) { // Links: // 1. https://core.telegram.org/api/links#chat-folder-links // +// Possible errors: +// +// 400 FILTER_ID_INVALID: The specified filter ID is invalid. +// // See https://core.telegram.org/method/chatlists.leaveChatlist for reference. -// Can be used by bots. func (c *Client) ChatlistsLeaveChatlist(ctx context.Context, request *ChatlistsLeaveChatlistRequest) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_code_settings_gen.go b/vendor/github.com/gotd/td/tg/tl_code_settings_gen.go index eccf4eb7..e3f9c52b 100644 --- a/vendor/github.com/gotd/td/tg/tl_code_settings_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_code_settings_gen.go @@ -68,7 +68,8 @@ type CodeSettings struct { AllowMissedCall bool // Whether Firebase auth is supported AllowFirebase bool - // UnknownNumber field of CodeSettings. + // Set this flag if there is a SIM card in the current device, but it is not possible to + // check whether the specified phone number matches the SIM's phone number. UnknownNumber bool // Previously stored future auth tokens, see the documentation for more info »¹ // diff --git a/vendor/github.com/gotd/td/tg/tl_connected_bot_gen.go b/vendor/github.com/gotd/td/tg/tl_connected_bot_gen.go index 95132561..b502d2fc 100644 --- a/vendor/github.com/gotd/td/tg/tl_connected_bot_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_connected_bot_gen.go @@ -32,16 +32,27 @@ var ( ) // ConnectedBot represents TL type `connectedBot#bd068601`. +// Contains info about a connected business bot »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots // // See https://core.telegram.org/constructor/connectedBot for reference. type ConnectedBot struct { - // Flags field of ConnectedBot. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // CanReply field of ConnectedBot. + // Whether the the bot can reply to messages it receives through the connection CanReply bool - // BotID field of ConnectedBot. + // ID of the connected bot BotID int64 - // Recipients field of ConnectedBot. + // Specifies the private chats that a connected business bot »¹ may receive messages + // and interact with. + // + // Links: + // 1) https://core.telegram.org/api/business#connected-bots Recipients BusinessBotRecipients } diff --git a/vendor/github.com/gotd/td/tg/tl_contact_birthday_gen.go b/vendor/github.com/gotd/td/tg/tl_contact_birthday_gen.go index a9c40807..bce3961a 100644 --- a/vendor/github.com/gotd/td/tg/tl_contact_birthday_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_contact_birthday_gen.go @@ -32,12 +32,13 @@ var ( ) // ContactBirthday represents TL type `contactBirthday#1d998733`. +// Birthday information of a contact. // // See https://core.telegram.org/constructor/contactBirthday for reference. type ContactBirthday struct { - // ContactID field of ContactBirthday. + // User ID. ContactID int64 - // Birthday field of ContactBirthday. + // Birthday information. Birthday Birthday } diff --git a/vendor/github.com/gotd/td/tg/tl_contacts_contact_birthdays_gen.go b/vendor/github.com/gotd/td/tg/tl_contacts_contact_birthdays_gen.go index 90f5b852..88ea8a4d 100644 --- a/vendor/github.com/gotd/td/tg/tl_contacts_contact_birthdays_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_contacts_contact_birthdays_gen.go @@ -32,12 +32,13 @@ var ( ) // ContactsContactBirthdays represents TL type `contacts.contactBirthdays#114ff30d`. +// Birthday information of our contacts. // // See https://core.telegram.org/constructor/contacts.contactBirthdays for reference. type ContactsContactBirthdays struct { - // Contacts field of ContactsContactBirthdays. + // Birthday info Contacts []ContactBirthday - // Users field of ContactsContactBirthdays. + // User information Users []UserClass } diff --git a/vendor/github.com/gotd/td/tg/tl_contacts_export_contact_token_gen.go b/vendor/github.com/gotd/td/tg/tl_contacts_export_contact_token_gen.go index 65729afc..60b51a27 100644 --- a/vendor/github.com/gotd/td/tg/tl_contacts_export_contact_token_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_contacts_export_contact_token_gen.go @@ -138,7 +138,6 @@ func (e *ContactsExportContactTokenRequest) DecodeBare(b *bin.Buffer) error { // 1. https://core.telegram.org/api/links#temporary-profile-links // // See https://core.telegram.org/method/contacts.exportContactToken for reference. -// Can be used by bots. func (c *Client) ContactsExportContactToken(ctx context.Context) (*ExportedContactToken, error) { var result ExportedContactToken diff --git a/vendor/github.com/gotd/td/tg/tl_contacts_get_birthdays_gen.go b/vendor/github.com/gotd/td/tg/tl_contacts_get_birthdays_gen.go index 9eb7b369..e97c35ca 100644 --- a/vendor/github.com/gotd/td/tg/tl_contacts_get_birthdays_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_contacts_get_birthdays_gen.go @@ -32,6 +32,15 @@ var ( ) // ContactsGetBirthdaysRequest represents TL type `contacts.getBirthdays#daeda864`. +// Fetch all users with birthdays that fall within +1/-1 days, relative to the current +// day: this method should be invoked by clients every 6-8 hours, and if the result is +// non-empty, it should be used to appropriately update locally cached birthday +// information in user¹.birthday. +// See here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/constructor/user +// 2. https://core.telegram.org/api/profile#birthday // // See https://core.telegram.org/method/contacts.getBirthdays for reference. type ContactsGetBirthdaysRequest struct { @@ -128,6 +137,15 @@ func (g *ContactsGetBirthdaysRequest) DecodeBare(b *bin.Buffer) error { } // ContactsGetBirthdays invokes method contacts.getBirthdays#daeda864 returning error if any. +// Fetch all users with birthdays that fall within +1/-1 days, relative to the current +// day: this method should be invoked by clients every 6-8 hours, and if the result is +// non-empty, it should be used to appropriately update locally cached birthday +// information in user¹.birthday. +// See here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/constructor/user +// 2. https://core.telegram.org/api/profile#birthday // // See https://core.telegram.org/method/contacts.getBirthdays for reference. func (c *Client) ContactsGetBirthdays(ctx context.Context) (*ContactsContactBirthdays, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_contacts_get_contact_ids_gen.go b/vendor/github.com/gotd/td/tg/tl_contacts_get_contact_ids_gen.go index 30b12dfb..d595991b 100644 --- a/vendor/github.com/gotd/td/tg/tl_contacts_get_contact_ids_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_contacts_get_contact_ids_gen.go @@ -38,7 +38,7 @@ var ( // // See https://core.telegram.org/method/contacts.getContactIDs for reference. type ContactsGetContactIDsRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_contacts_get_contacts_gen.go b/vendor/github.com/gotd/td/tg/tl_contacts_get_contacts_gen.go index bfd3c98d..358d2910 100644 --- a/vendor/github.com/gotd/td/tg/tl_contacts_get_contacts_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_contacts_get_contacts_gen.go @@ -36,13 +36,17 @@ var ( // // See https://core.telegram.org/method/contacts.getContacts for reference. type ContactsGetContactsRequest struct { - // If there already is a full contact list on the client, a hash¹ of a the list of - // contact IDs in ascending order may be passed in this parameter. If the contact set was - // not changed, (contacts.contactsNotModified)² will be returned. + // Hash used for caching, for more info click here¹.Note that the hash is computed using + // the usual algorithm², passing to the algorithm first the previously returned contacts + // contacts³.saved_count field, then max 100000 sorted user IDs from the contact list, + // including the ID of the currently logged in user if it is saved as a contact. Example: + // tdlib implementation⁴. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation - // 2) https://core.telegram.org/constructor/contacts.contactsNotModified + // 2) https://core.telegram.org/api/offsets#hash-generation + // 3) https://core.telegram.org/constructor/contacts.contacts + // 4) https://github.com/tdlib/td/blob/63c7d0301825b78c30dc7307f1f1466be049eb79/td/telegram/UserManager.cpp#L5754 Hash int64 } diff --git a/vendor/github.com/gotd/td/tg/tl_contacts_get_located_gen.go b/vendor/github.com/gotd/td/tg/tl_contacts_get_located_gen.go index a0ae3014..bc6d5ab1 100644 --- a/vendor/github.com/gotd/td/tg/tl_contacts_get_located_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_contacts_get_located_gen.go @@ -291,6 +291,7 @@ func (g *ContactsGetLocatedRequest) GetGeoPointAsNotEmpty() (*InputGeoPoint, boo // // Possible errors: // +// 406 BUSINESS_ADDRESS_ACTIVE: The user is currently advertising a Business Location, the location may only be changed (or removed) using account.updateBusinessLocation ». . // 400 GEO_POINT_INVALID: Invalid geoposition provided. // 406 USERPIC_PRIVACY_REQUIRED: You need to disable privacy settings for your profile picture in order to make your geolocation public. // 406 USERPIC_UPLOAD_REQUIRED: You must have a profile picture to publish your geolocation. diff --git a/vendor/github.com/gotd/td/tg/tl_contacts_get_saved_gen.go b/vendor/github.com/gotd/td/tg/tl_contacts_get_saved_gen.go index a419a516..cbe5cb3a 100644 --- a/vendor/github.com/gotd/td/tg/tl_contacts_get_saved_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_contacts_get_saved_gen.go @@ -139,6 +139,7 @@ func (g *ContactsGetSavedRequest) DecodeBare(b *bin.Buffer) error { // // Possible errors: // +// 400 TAKEOUT_INVALID: The specified takeout ID is invalid. // 403 TAKEOUT_REQUIRED: A takeout¹ session needs to be initialized first, see here » for more info². // // See https://core.telegram.org/method/contacts.getSaved for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_contacts_get_top_peers_gen.go b/vendor/github.com/gotd/td/tg/tl_contacts_get_top_peers_gen.go index 36476403..60810764 100644 --- a/vendor/github.com/gotd/td/tg/tl_contacts_get_top_peers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_contacts_get_top_peers_gen.go @@ -57,6 +57,11 @@ type ContactsGetTopPeersRequest struct { Groups bool // Most frequently visited channels Channels bool + // Most frequently used Main Mini Bot Apps¹. + // + // Links: + // 1) https://core.telegram.org/api/bots/webapps#main-mini-apps + BotsApp bool // Offset for pagination¹ // // Links: @@ -67,7 +72,7 @@ type ContactsGetTopPeersRequest struct { // Links: // 1) https://core.telegram.org/api/offsets Limit int - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation @@ -116,6 +121,9 @@ func (g *ContactsGetTopPeersRequest) Zero() bool { if !(g.Channels == false) { return false } + if !(g.BotsApp == false) { + return false + } if !(g.Offset == 0) { return false } @@ -148,6 +156,7 @@ func (g *ContactsGetTopPeersRequest) FillFrom(from interface { GetForwardChats() (value bool) GetGroups() (value bool) GetChannels() (value bool) + GetBotsApp() (value bool) GetOffset() (value int) GetLimit() (value int) GetHash() (value int64) @@ -160,6 +169,7 @@ func (g *ContactsGetTopPeersRequest) FillFrom(from interface { g.ForwardChats = from.GetForwardChats() g.Groups = from.GetGroups() g.Channels = from.GetChannels() + g.BotsApp = from.GetBotsApp() g.Offset = from.GetOffset() g.Limit = from.GetLimit() g.Hash = from.GetHash() @@ -228,6 +238,11 @@ func (g *ContactsGetTopPeersRequest) TypeInfo() tdp.Type { SchemaName: "channels", Null: !g.Flags.Has(15), }, + { + Name: "BotsApp", + SchemaName: "bots_app", + Null: !g.Flags.Has(16), + }, { Name: "Offset", SchemaName: "offset", @@ -270,6 +285,9 @@ func (g *ContactsGetTopPeersRequest) SetFlags() { if !(g.Channels == false) { g.Flags.Set(15) } + if !(g.BotsApp == false) { + g.Flags.Set(16) + } } // Encode implements bin.Encoder. @@ -325,6 +343,7 @@ func (g *ContactsGetTopPeersRequest) DecodeBare(b *bin.Buffer) error { g.ForwardChats = g.Flags.Has(5) g.Groups = g.Flags.Has(10) g.Channels = g.Flags.Has(15) + g.BotsApp = g.Flags.Has(16) { value, err := b.Int() if err != nil { @@ -501,6 +520,25 @@ func (g *ContactsGetTopPeersRequest) GetChannels() (value bool) { return g.Flags.Has(15) } +// SetBotsApp sets value of BotsApp conditional field. +func (g *ContactsGetTopPeersRequest) SetBotsApp(value bool) { + if value { + g.Flags.Set(16) + g.BotsApp = true + } else { + g.Flags.Unset(16) + g.BotsApp = false + } +} + +// GetBotsApp returns value of BotsApp conditional field. +func (g *ContactsGetTopPeersRequest) GetBotsApp() (value bool) { + if g == nil { + return + } + return g.Flags.Has(16) +} + // GetOffset returns value of Offset field. func (g *ContactsGetTopPeersRequest) GetOffset() (value int) { if g == nil { diff --git a/vendor/github.com/gotd/td/tg/tl_contacts_import_contact_token_gen.go b/vendor/github.com/gotd/td/tg/tl_contacts_import_contact_token_gen.go index 8652cf7d..6f1e4593 100644 --- a/vendor/github.com/gotd/td/tg/tl_contacts_import_contact_token_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_contacts_import_contact_token_gen.go @@ -178,7 +178,6 @@ func (i *ContactsImportContactTokenRequest) GetToken() (value string) { // 400 IMPORT_TOKEN_INVALID: The specified token is invalid. // // See https://core.telegram.org/method/contacts.importContactToken for reference. -// Can be used by bots. func (c *Client) ContactsImportContactToken(ctx context.Context, token string) (UserClass, error) { var result UserBox diff --git a/vendor/github.com/gotd/td/tg/tl_dialog_filter_gen.go b/vendor/github.com/gotd/td/tg/tl_dialog_filter_gen.go index 9e8703c0..d2dee88e 100644 --- a/vendor/github.com/gotd/td/tg/tl_dialog_filter_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_dialog_filter_gen.go @@ -89,7 +89,7 @@ type DialogFilter struct { // Links: // 1) https://core.telegram.org/api/folders ID int - // Folder¹ name + // Folder¹ name (max 12 UTF-8 chars) // // Links: // 1) https://core.telegram.org/api/folders @@ -98,7 +98,10 @@ type DialogFilter struct { // // Use SetEmoticon and GetEmoticon helpers. Emoticon string - // Color field of DialogFilter. + // A color ID for the folder tag associated to this folder, see here »¹ for more info. + // + // Links: + // 1) https://core.telegram.org/api/folders#folder-tags // // Use SetColor and GetColor helpers. Color int @@ -905,13 +908,16 @@ type DialogFilterChatlist struct { HasMyInvites bool // ID of the folder ID int - // Name of the folder + // Name of the folder (max 12 UTF-8 chars) Title string // Emoji to use as icon for the folder. // // Use SetEmoticon and GetEmoticon helpers. Emoticon string - // Color field of DialogFilterChatlist. + // A color ID for the folder tag associated to this folder, see here »¹ for more info. + // + // Links: + // 1) https://core.telegram.org/api/folders#folder-tags // // Use SetColor and GetColor helpers. Color int diff --git a/vendor/github.com/gotd/td/tg/tl_document_attribute_gen.go b/vendor/github.com/gotd/td/tg/tl_document_attribute_gen.go index 7b213cad..d6183ac2 100644 --- a/vendor/github.com/gotd/td/tg/tl_document_attribute_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_document_attribute_gen.go @@ -566,7 +566,7 @@ func (d *DocumentAttributeSticker) GetMaskCoords() (value MaskCoords, ok bool) { return d.MaskCoords, true } -// DocumentAttributeVideo represents TL type `documentAttributeVideo#d38ff1c2`. +// DocumentAttributeVideo represents TL type `documentAttributeVideo#17399fad`. // Defines a video // // See https://core.telegram.org/constructor/documentAttributeVideo for reference. @@ -596,10 +596,15 @@ type DocumentAttributeVideo struct { // // Use SetPreloadPrefixSize and GetPreloadPrefixSize helpers. PreloadPrefixSize int + // Floating point UNIX timestamp in seconds, indicating the frame of the video that + // should be used as static preview and thumbnail. + // + // Use SetVideoStartTs and GetVideoStartTs helpers. + VideoStartTs float64 } // DocumentAttributeVideoTypeID is TL type id of DocumentAttributeVideo. -const DocumentAttributeVideoTypeID = 0xd38ff1c2 +const DocumentAttributeVideoTypeID = 0x17399fad // construct implements constructor of DocumentAttributeClass. func (d DocumentAttributeVideo) construct() DocumentAttributeClass { return &d } @@ -642,6 +647,9 @@ func (d *DocumentAttributeVideo) Zero() bool { if !(d.PreloadPrefixSize == 0) { return false } + if !(d.VideoStartTs == 0) { + return false + } return true } @@ -664,6 +672,7 @@ func (d *DocumentAttributeVideo) FillFrom(from interface { GetW() (value int) GetH() (value int) GetPreloadPrefixSize() (value int, ok bool) + GetVideoStartTs() (value float64, ok bool) }) { d.RoundMessage = from.GetRoundMessage() d.SupportsStreaming = from.GetSupportsStreaming() @@ -675,6 +684,10 @@ func (d *DocumentAttributeVideo) FillFrom(from interface { d.PreloadPrefixSize = val } + if val, ok := from.GetVideoStartTs(); ok { + d.VideoStartTs = val + } + } // TypeID returns type id in TL schema. @@ -732,6 +745,11 @@ func (d *DocumentAttributeVideo) TypeInfo() tdp.Type { SchemaName: "preload_prefix_size", Null: !d.Flags.Has(2), }, + { + Name: "VideoStartTs", + SchemaName: "video_start_ts", + Null: !d.Flags.Has(4), + }, } return typ } @@ -750,12 +768,15 @@ func (d *DocumentAttributeVideo) SetFlags() { if !(d.PreloadPrefixSize == 0) { d.Flags.Set(2) } + if !(d.VideoStartTs == 0) { + d.Flags.Set(4) + } } // Encode implements bin.Encoder. func (d *DocumentAttributeVideo) Encode(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't encode documentAttributeVideo#d38ff1c2 as nil") + return fmt.Errorf("can't encode documentAttributeVideo#17399fad as nil") } b.PutID(DocumentAttributeVideoTypeID) return d.EncodeBare(b) @@ -764,11 +785,11 @@ func (d *DocumentAttributeVideo) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (d *DocumentAttributeVideo) EncodeBare(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't encode documentAttributeVideo#d38ff1c2 as nil") + return fmt.Errorf("can't encode documentAttributeVideo#17399fad as nil") } d.SetFlags() if err := d.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode documentAttributeVideo#d38ff1c2: field flags: %w", err) + return fmt.Errorf("unable to encode documentAttributeVideo#17399fad: field flags: %w", err) } b.PutDouble(d.Duration) b.PutInt(d.W) @@ -776,16 +797,19 @@ func (d *DocumentAttributeVideo) EncodeBare(b *bin.Buffer) error { if d.Flags.Has(2) { b.PutInt(d.PreloadPrefixSize) } + if d.Flags.Has(4) { + b.PutDouble(d.VideoStartTs) + } return nil } // Decode implements bin.Decoder. func (d *DocumentAttributeVideo) Decode(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't decode documentAttributeVideo#d38ff1c2 to nil") + return fmt.Errorf("can't decode documentAttributeVideo#17399fad to nil") } if err := b.ConsumeID(DocumentAttributeVideoTypeID); err != nil { - return fmt.Errorf("unable to decode documentAttributeVideo#d38ff1c2: %w", err) + return fmt.Errorf("unable to decode documentAttributeVideo#17399fad: %w", err) } return d.DecodeBare(b) } @@ -793,11 +817,11 @@ func (d *DocumentAttributeVideo) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (d *DocumentAttributeVideo) DecodeBare(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't decode documentAttributeVideo#d38ff1c2 to nil") + return fmt.Errorf("can't decode documentAttributeVideo#17399fad to nil") } { if err := d.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode documentAttributeVideo#d38ff1c2: field flags: %w", err) + return fmt.Errorf("unable to decode documentAttributeVideo#17399fad: field flags: %w", err) } } d.RoundMessage = d.Flags.Has(0) @@ -806,31 +830,38 @@ func (d *DocumentAttributeVideo) DecodeBare(b *bin.Buffer) error { { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode documentAttributeVideo#d38ff1c2: field duration: %w", err) + return fmt.Errorf("unable to decode documentAttributeVideo#17399fad: field duration: %w", err) } d.Duration = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode documentAttributeVideo#d38ff1c2: field w: %w", err) + return fmt.Errorf("unable to decode documentAttributeVideo#17399fad: field w: %w", err) } d.W = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode documentAttributeVideo#d38ff1c2: field h: %w", err) + return fmt.Errorf("unable to decode documentAttributeVideo#17399fad: field h: %w", err) } d.H = value } if d.Flags.Has(2) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode documentAttributeVideo#d38ff1c2: field preload_prefix_size: %w", err) + return fmt.Errorf("unable to decode documentAttributeVideo#17399fad: field preload_prefix_size: %w", err) } d.PreloadPrefixSize = value } + if d.Flags.Has(4) { + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode documentAttributeVideo#17399fad: field video_start_ts: %w", err) + } + d.VideoStartTs = value + } return nil } @@ -933,6 +964,24 @@ func (d *DocumentAttributeVideo) GetPreloadPrefixSize() (value int, ok bool) { return d.PreloadPrefixSize, true } +// SetVideoStartTs sets value of VideoStartTs conditional field. +func (d *DocumentAttributeVideo) SetVideoStartTs(value float64) { + d.Flags.Set(4) + d.VideoStartTs = value +} + +// GetVideoStartTs returns value of VideoStartTs conditional field and +// boolean which is true if field was set. +func (d *DocumentAttributeVideo) GetVideoStartTs() (value float64, ok bool) { + if d == nil { + return + } + if !d.Flags.Has(4) { + return value, false + } + return d.VideoStartTs, true +} + // DocumentAttributeAudio represents TL type `documentAttributeAudio#9852f9c6`. // Represents an audio file // @@ -1786,7 +1835,7 @@ const DocumentAttributeClassName = "DocumentAttribute" // case *tg.DocumentAttributeImageSize: // documentAttributeImageSize#6c37c15c // case *tg.DocumentAttributeAnimated: // documentAttributeAnimated#11b58939 // case *tg.DocumentAttributeSticker: // documentAttributeSticker#6319d612 -// case *tg.DocumentAttributeVideo: // documentAttributeVideo#d38ff1c2 +// case *tg.DocumentAttributeVideo: // documentAttributeVideo#17399fad // case *tg.DocumentAttributeAudio: // documentAttributeAudio#9852f9c6 // case *tg.DocumentAttributeFilename: // documentAttributeFilename#15590068 // case *tg.DocumentAttributeHasStickers: // documentAttributeHasStickers#9801d2f7 @@ -1841,7 +1890,7 @@ func DecodeDocumentAttribute(buf *bin.Buffer) (DocumentAttributeClass, error) { } return &v, nil case DocumentAttributeVideoTypeID: - // Decoding documentAttributeVideo#d38ff1c2. + // Decoding documentAttributeVideo#17399fad. v := DocumentAttributeVideo{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode DocumentAttributeClass: %w", err) diff --git a/vendor/github.com/gotd/td/tg/tl_draft_message_gen.go b/vendor/github.com/gotd/td/tg/tl_draft_message_gen.go index 471f5440..a6524693 100644 --- a/vendor/github.com/gotd/td/tg/tl_draft_message_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_draft_message_gen.go @@ -208,7 +208,7 @@ func (d *DraftMessageEmpty) GetDate() (value int, ok bool) { return d.Date, true } -// DraftMessage represents TL type `draftMessage#3fccf7ef`. +// DraftMessage represents TL type `draftMessage#2d65321f`. // Represents a message draft¹. // // Links: @@ -246,10 +246,17 @@ type DraftMessage struct { Media InputMediaClass // Date of last update of the draft. Date int + // A message effect that should be played as specified here »¹. + // + // Links: + // 1) https://core.telegram.org/api/effects + // + // Use SetEffect and GetEffect helpers. + Effect int64 } // DraftMessageTypeID is TL type id of DraftMessage. -const DraftMessageTypeID = 0x3fccf7ef +const DraftMessageTypeID = 0x2d65321f // construct implements constructor of DraftMessageClass. func (d DraftMessage) construct() DraftMessageClass { return &d } @@ -292,6 +299,9 @@ func (d *DraftMessage) Zero() bool { if !(d.Date == 0) { return false } + if !(d.Effect == 0) { + return false + } return true } @@ -314,6 +324,7 @@ func (d *DraftMessage) FillFrom(from interface { GetEntities() (value []MessageEntityClass, ok bool) GetMedia() (value InputMediaClass, ok bool) GetDate() (value int) + GetEffect() (value int64, ok bool) }) { d.NoWebpage = from.GetNoWebpage() d.InvertMedia = from.GetInvertMedia() @@ -331,6 +342,10 @@ func (d *DraftMessage) FillFrom(from interface { } d.Date = from.GetDate() + if val, ok := from.GetEffect(); ok { + d.Effect = val + } + } // TypeID returns type id in TL schema. @@ -389,6 +404,11 @@ func (d *DraftMessage) TypeInfo() tdp.Type { Name: "Date", SchemaName: "date", }, + { + Name: "Effect", + SchemaName: "effect", + Null: !d.Flags.Has(7), + }, } return typ } @@ -410,12 +430,15 @@ func (d *DraftMessage) SetFlags() { if !(d.Media == nil) { d.Flags.Set(5) } + if !(d.Effect == 0) { + d.Flags.Set(7) + } } // Encode implements bin.Encoder. func (d *DraftMessage) Encode(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't encode draftMessage#3fccf7ef as nil") + return fmt.Errorf("can't encode draftMessage#2d65321f as nil") } b.PutID(DraftMessageTypeID) return d.EncodeBare(b) @@ -424,18 +447,18 @@ func (d *DraftMessage) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (d *DraftMessage) EncodeBare(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't encode draftMessage#3fccf7ef as nil") + return fmt.Errorf("can't encode draftMessage#2d65321f as nil") } d.SetFlags() if err := d.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode draftMessage#3fccf7ef: field flags: %w", err) + return fmt.Errorf("unable to encode draftMessage#2d65321f: field flags: %w", err) } if d.Flags.Has(4) { if d.ReplyTo == nil { - return fmt.Errorf("unable to encode draftMessage#3fccf7ef: field reply_to is nil") + return fmt.Errorf("unable to encode draftMessage#2d65321f: field reply_to is nil") } if err := d.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode draftMessage#3fccf7ef: field reply_to: %w", err) + return fmt.Errorf("unable to encode draftMessage#2d65321f: field reply_to: %w", err) } } b.PutString(d.Message) @@ -443,32 +466,35 @@ func (d *DraftMessage) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(d.Entities)) for idx, v := range d.Entities { if v == nil { - return fmt.Errorf("unable to encode draftMessage#3fccf7ef: field entities element with index %d is nil", idx) + return fmt.Errorf("unable to encode draftMessage#2d65321f: field entities element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode draftMessage#3fccf7ef: field entities element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode draftMessage#2d65321f: field entities element with index %d: %w", idx, err) } } } if d.Flags.Has(5) { if d.Media == nil { - return fmt.Errorf("unable to encode draftMessage#3fccf7ef: field media is nil") + return fmt.Errorf("unable to encode draftMessage#2d65321f: field media is nil") } if err := d.Media.Encode(b); err != nil { - return fmt.Errorf("unable to encode draftMessage#3fccf7ef: field media: %w", err) + return fmt.Errorf("unable to encode draftMessage#2d65321f: field media: %w", err) } } b.PutInt(d.Date) + if d.Flags.Has(7) { + b.PutLong(d.Effect) + } return nil } // Decode implements bin.Decoder. func (d *DraftMessage) Decode(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't decode draftMessage#3fccf7ef to nil") + return fmt.Errorf("can't decode draftMessage#2d65321f to nil") } if err := b.ConsumeID(DraftMessageTypeID); err != nil { - return fmt.Errorf("unable to decode draftMessage#3fccf7ef: %w", err) + return fmt.Errorf("unable to decode draftMessage#2d65321f: %w", err) } return d.DecodeBare(b) } @@ -476,11 +502,11 @@ func (d *DraftMessage) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (d *DraftMessage) DecodeBare(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't decode draftMessage#3fccf7ef to nil") + return fmt.Errorf("can't decode draftMessage#2d65321f to nil") } { if err := d.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode draftMessage#3fccf7ef: field flags: %w", err) + return fmt.Errorf("unable to decode draftMessage#2d65321f: field flags: %w", err) } } d.NoWebpage = d.Flags.Has(1) @@ -488,21 +514,21 @@ func (d *DraftMessage) DecodeBare(b *bin.Buffer) error { if d.Flags.Has(4) { value, err := DecodeInputReplyTo(b) if err != nil { - return fmt.Errorf("unable to decode draftMessage#3fccf7ef: field reply_to: %w", err) + return fmt.Errorf("unable to decode draftMessage#2d65321f: field reply_to: %w", err) } d.ReplyTo = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode draftMessage#3fccf7ef: field message: %w", err) + return fmt.Errorf("unable to decode draftMessage#2d65321f: field message: %w", err) } d.Message = value } if d.Flags.Has(3) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode draftMessage#3fccf7ef: field entities: %w", err) + return fmt.Errorf("unable to decode draftMessage#2d65321f: field entities: %w", err) } if headerLen > 0 { @@ -511,7 +537,7 @@ func (d *DraftMessage) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMessageEntity(b) if err != nil { - return fmt.Errorf("unable to decode draftMessage#3fccf7ef: field entities: %w", err) + return fmt.Errorf("unable to decode draftMessage#2d65321f: field entities: %w", err) } d.Entities = append(d.Entities, value) } @@ -519,17 +545,24 @@ func (d *DraftMessage) DecodeBare(b *bin.Buffer) error { if d.Flags.Has(5) { value, err := DecodeInputMedia(b) if err != nil { - return fmt.Errorf("unable to decode draftMessage#3fccf7ef: field media: %w", err) + return fmt.Errorf("unable to decode draftMessage#2d65321f: field media: %w", err) } d.Media = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode draftMessage#3fccf7ef: field date: %w", err) + return fmt.Errorf("unable to decode draftMessage#2d65321f: field date: %w", err) } d.Date = value } + if d.Flags.Has(7) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode draftMessage#2d65321f: field effect: %w", err) + } + d.Effect = value + } return nil } @@ -641,6 +674,24 @@ func (d *DraftMessage) GetDate() (value int) { return d.Date } +// SetEffect sets value of Effect conditional field. +func (d *DraftMessage) SetEffect(value int64) { + d.Flags.Set(7) + d.Effect = value +} + +// GetEffect returns value of Effect conditional field and +// boolean which is true if field was set. +func (d *DraftMessage) GetEffect() (value int64, ok bool) { + if d == nil { + return + } + if !d.Flags.Has(7) { + return value, false + } + return d.Effect, true +} + // MapEntities returns field Entities wrapped in MessageEntityClassArray helper. func (d *DraftMessage) MapEntities() (value MessageEntityClassArray, ok bool) { if !d.Flags.Has(3) { @@ -664,7 +715,7 @@ const DraftMessageClassName = "DraftMessage" // } // switch v := g.(type) { // case *tg.DraftMessageEmpty: // draftMessageEmpty#1b0c841a -// case *tg.DraftMessage: // draftMessage#3fccf7ef +// case *tg.DraftMessage: // draftMessage#2d65321f // default: panic(v) // } type DraftMessageClass interface { @@ -714,7 +765,7 @@ func DecodeDraftMessage(buf *bin.Buffer) (DraftMessageClass, error) { } return &v, nil case DraftMessageTypeID: - // Decoding draftMessage#3fccf7ef. + // Decoding draftMessage#2d65321f. v := DraftMessage{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode DraftMessageClass: %w", err) diff --git a/vendor/github.com/gotd/td/tg/tl_emoji_group_gen.go b/vendor/github.com/gotd/td/tg/tl_emoji_group_gen.go index a47ac8b2..94c43e2e 100644 --- a/vendor/github.com/gotd/td/tg/tl_emoji_group_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_emoji_group_gen.go @@ -35,7 +35,7 @@ var ( // Represents an emoji category¹. // // Links: -// 1. https://core.telegram.org/api/custom-emoji#emoji-categories +// 1. https://core.telegram.org/api/emoji-categories // // See https://core.telegram.org/constructor/emojiGroup for reference. type EmojiGroup struct { @@ -237,14 +237,20 @@ func (e *EmojiGroup) GetEmoticons() (value []string) { } // EmojiGroupGreeting represents TL type `emojiGroupGreeting#80d26cc7`. +// Represents an emoji category¹, that should be moved to the top of the list when +// choosing a sticker for a business introduction² +// +// Links: +// 1. https://core.telegram.org/api/emoji-categories +// 2. https://core.telegram.org/api/business#business-introduction // // See https://core.telegram.org/constructor/emojiGroupGreeting for reference. type EmojiGroupGreeting struct { - // Title field of EmojiGroupGreeting. + // Category name, i.e. "Animals", "Flags", "Faces" and so on... Title string - // IconEmojiID field of EmojiGroupGreeting. + // A single custom emoji used as preview for the category. IconEmojiID int64 - // Emoticons field of EmojiGroupGreeting. + // A list of UTF-8 emojis, matching the category. Emoticons []string } @@ -438,12 +444,23 @@ func (e *EmojiGroupGreeting) GetEmoticons() (value []string) { } // EmojiGroupPremium represents TL type `emojiGroupPremium#93bcf34`. +// An emoji category¹, used to select all Premium²-only stickers (i.e. those with a +// Premium effect »³)/Premium⁴-only custom emojis⁵ (i.e. those where the +// documentAttributeCustomEmoji⁶.free flag is not set) +// +// Links: +// 1. https://core.telegram.org/api/emoji-categories +// 2. https://core.telegram.org/api/premium +// 3. https://core.telegram.org/api/stickers#premium-animated-sticker-effects +// 4. https://core.telegram.org/api/premium +// 5. https://core.telegram.org/api/custom-emoji +// 6. https://core.telegram.org/constructor/documentAttributeCustomEmoji // // See https://core.telegram.org/constructor/emojiGroupPremium for reference. type EmojiGroupPremium struct { - // Title field of EmojiGroupPremium. + // Category name, i.e. "Animals", "Flags", "Faces" and so on... Title string - // IconEmojiID field of EmojiGroupPremium. + // A single custom emoji used as preview for the category. IconEmojiID int64 } diff --git a/vendor/github.com/gotd/td/tg/tl_emoji_list_gen.go b/vendor/github.com/gotd/td/tg/tl_emoji_list_gen.go index 933616d1..58310b08 100644 --- a/vendor/github.com/gotd/td/tg/tl_emoji_list_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_emoji_list_gen.go @@ -144,7 +144,7 @@ func (e *EmojiListNotModified) DecodeBare(b *bin.Buffer) error { // // See https://core.telegram.org/constructor/emojiList for reference. type EmojiList struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_errors_gen.go b/vendor/github.com/gotd/td/tg/tl_errors_gen.go index e9bb2cae..a3b97233 100644 --- a/vendor/github.com/gotd/td/tg/tl_errors_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_errors_gen.go @@ -43,6 +43,7 @@ const ( ErrAdminRankEmojiNotAllowed = "ADMIN_RANK_EMOJI_NOT_ALLOWED" ErrAdminRankInvalid = "ADMIN_RANK_INVALID" ErrAdminRightsEmpty = "ADMIN_RIGHTS_EMPTY" + ErrAdExpired = "AD_EXPIRED" ErrAlbumPhotosTooMany = "ALBUM_PHOTOS_TOO_MANY" ErrAnonymousReactionsDisabled = "ANONYMOUS_REACTIONS_DISABLED" ErrAPIIDInvalid = "API_ID_INVALID" @@ -58,22 +59,28 @@ const ( ErrAuthTokenInvalid = "AUTH_TOKEN_INVALID" ErrAuthTokenInvalidx = "AUTH_TOKEN_INVALIDX" ErrAutoarchiveNotAvailable = "AUTOARCHIVE_NOT_AVAILABLE" + ErrBalanceTooLow = "BALANCE_TOO_LOW" ErrBankCardNumberInvalid = "BANK_CARD_NUMBER_INVALID" ErrBannedRightsInvalid = "BANNED_RIGHTS_INVALID" + ErrBirthdayInvalid = "BIRTHDAY_INVALID" ErrBoostsEmpty = "BOOSTS_EMPTY" ErrBoostsRequired = "BOOSTS_REQUIRED" ErrBoostPeerInvalid = "BOOST_PEER_INVALID" ErrBotsTooMuch = "BOTS_TOO_MUCH" + ErrBotAlreadyDisabled = "BOT_ALREADY_DISABLED" + ErrBotAppBotInvalid = "BOT_APP_BOT_INVALID" ErrBotAppInvalid = "BOT_APP_INVALID" ErrBotAppShortnameInvalid = "BOT_APP_SHORTNAME_INVALID" + ErrBotBusinessMissing = "BOT_BUSINESS_MISSING" ErrBotChannelsNa = "BOT_CHANNELS_NA" ErrBotCommandDescriptionInvalid = "BOT_COMMAND_DESCRIPTION_INVALID" ErrBotCommandInvalid = "BOT_COMMAND_INVALID" ErrBotDomainInvalid = "BOT_DOMAIN_INVALID" + ErrBotGamesDisabled = "BOT_GAMES_DISABLED" ErrBotGroupsBlocked = "BOT_GROUPS_BLOCKED" ErrBotInlineDisabled = "BOT_INLINE_DISABLED" ErrBotInvalid = "BOT_INVALID" - ErrBotMissing = "BOT_MISSING" + ErrBotNotConnectedYet = "BOT_NOT_CONNECTED_YET" ErrBotOnesideNotAvail = "BOT_ONESIDE_NOT_AVAIL" ErrBotPaymentsDisabled = "BOT_PAYMENTS_DISABLED" ErrBotResponseTimeout = "BOT_RESPONSE_TIMEOUT" @@ -83,7 +90,13 @@ const ( ErrBroadcastIDInvalid = "BROADCAST_ID_INVALID" ErrBroadcastPublicVotersForbidden = "BROADCAST_PUBLIC_VOTERS_FORBIDDEN" ErrBroadcastRequired = "BROADCAST_REQUIRED" + ErrBusinessAddressActive = "BUSINESS_ADDRESS_ACTIVE" + ErrBusinessPeerInvalid = "BUSINESS_PEER_INVALID" + ErrBusinessRecipientsEmpty = "BUSINESS_RECIPIENTS_EMPTY" + ErrBusinessWorkHoursEmpty = "BUSINESS_WORK_HOURS_EMPTY" + ErrBusinessWorkHoursPeriodInvalid = "BUSINESS_WORK_HOURS_PERIOD_INVALID" ErrButtonDataInvalid = "BUTTON_DATA_INVALID" + ErrButtonPosInvalid = "BUTTON_POS_INVALID" ErrButtonTextInvalid = "BUTTON_TEXT_INVALID" ErrButtonTypeInvalid = "BUTTON_TYPE_INVALID" ErrButtonURLInvalid = "BUTTON_URL_INVALID" @@ -108,9 +121,14 @@ const ( ErrChannelPublicGroupNa = "CHANNEL_PUBLIC_GROUP_NA" ErrChannelTooBig = "CHANNEL_TOO_BIG" ErrChannelTooLarge = "CHANNEL_TOO_LARGE" + ErrChargeAlreadyRefunded = "CHARGE_ALREADY_REFUNDED" + ErrChatlinksTooMuch = "CHATLINKS_TOO_MUCH" + ErrChatlinkSlugEmpty = "CHATLINK_SLUG_EMPTY" + ErrChatlinkSlugExpired = "CHATLINK_SLUG_EXPIRED" ErrChatlistExcludeInvalid = "CHATLIST_EXCLUDE_INVALID" ErrChatAboutNotModified = "CHAT_ABOUT_NOT_MODIFIED" ErrChatAboutTooLong = "CHAT_ABOUT_TOO_LONG" + ErrChatActionForbidden = "CHAT_ACTION_FORBIDDEN" ErrChatAdminInviteRequired = "CHAT_ADMIN_INVITE_REQUIRED" ErrChatAdminRequired = "CHAT_ADMIN_REQUIRED" ErrChatDiscussionUnallowed = "CHAT_DISCUSSION_UNALLOWED" @@ -135,6 +153,7 @@ const ( ErrChatSendPhotosForbidden = "CHAT_SEND_PHOTOS_FORBIDDEN" ErrChatSendPlainForbidden = "CHAT_SEND_PLAIN_FORBIDDEN" ErrChatSendPollForbidden = "CHAT_SEND_POLL_FORBIDDEN" + ErrChatSendRoundvideosForbidden = "CHAT_SEND_ROUNDVIDEOS_FORBIDDEN" ErrChatSendStickersForbidden = "CHAT_SEND_STICKERS_FORBIDDEN" ErrChatSendVideosForbidden = "CHAT_SEND_VIDEOS_FORBIDDEN" ErrChatSendVoicesForbidden = "CHAT_SEND_VOICES_FORBIDDEN" @@ -144,9 +163,12 @@ const ( ErrCodeEmpty = "CODE_EMPTY" ErrCodeHashInvalid = "CODE_HASH_INVALID" ErrCodeInvalid = "CODE_INVALID" + ErrCollectibleInvalid = "COLLECTIBLE_INVALID" + ErrCollectibleNotFound = "COLLECTIBLE_NOT_FOUND" ErrColorInvalid = "COLOR_INVALID" ErrConnectionAPIIDInvalid = "CONNECTION_API_ID_INVALID" ErrConnectionAppVersionEmpty = "CONNECTION_APP_VERSION_EMPTY" + ErrConnectionIDInvalid = "CONNECTION_ID_INVALID" ErrConnectionLayerInvalid = "CONNECTION_LAYER_INVALID" ErrContactAddMissing = "CONTACT_ADD_MISSING" ErrContactIDInvalid = "CONTACT_ID_INVALID" @@ -166,6 +188,7 @@ const ( ErrEditBotInviteForbidden = "EDIT_BOT_INVITE_FORBIDDEN" ErrEmailHashExpired = "EMAIL_HASH_EXPIRED" ErrEmailInvalid = "EMAIL_INVALID" + ErrEmailNotAllowed = "EMAIL_NOT_ALLOWED" ErrEmailNotSetup = "EMAIL_NOT_SETUP" ErrEmailUnconfirmed = "EMAIL_UNCONFIRMED" ErrEmailVerifyExpired = "EMAIL_VERIFY_EXPIRED" @@ -197,7 +220,6 @@ const ( ErrFilePartSizeChanged = "FILE_PART_SIZE_CHANGED" ErrFilePartSizeInvalid = "FILE_PART_SIZE_INVALID" ErrFilePartTooBig = "FILE_PART_TOO_BIG" - ErrFileReference = "FILE_REFERENCE" ErrFileReferenceEmpty = "FILE_REFERENCE_EMPTY" ErrFileReferenceExpired = "FILE_REFERENCE_EXPIRED" ErrFileReferenceInvalid = "FILE_REFERENCE_INVALID" @@ -208,7 +230,9 @@ const ( ErrFilterNotSupported = "FILTER_NOT_SUPPORTED" ErrFilterTitleEmpty = "FILTER_TITLE_EMPTY" ErrFirstnameInvalid = "FIRSTNAME_INVALID" + ErrFloodPremiumWait = "FLOOD_PREMIUM_WAIT" ErrFolderIDInvalid = "FOLDER_ID_INVALID" + ErrFormExpired = "FORM_EXPIRED" ErrForumEnabled = "FORUM_ENABLED" ErrFreshChangeAdminsForbidden = "FRESH_CHANGE_ADMINS_FORBIDDEN" ErrFreshChangePhoneForbidden = "FRESH_CHANGE_PHONE_FORBIDDEN" @@ -233,16 +257,19 @@ const ( ErrGroupcallNotModified = "GROUPCALL_NOT_MODIFIED" ErrGroupcallSsrcDuplicateMuch = "GROUPCALL_SSRC_DUPLICATE_MUCH" ErrGroupedMediaInvalid = "GROUPED_MEDIA_INVALID" + ErrHashtagInvalid = "HASHTAG_INVALID" ErrHashInvalid = "HASH_INVALID" ErrHideRequesterMissing = "HIDE_REQUESTER_MISSING" ErrImageProcessFailed = "IMAGE_PROCESS_FAILED" ErrImportFileInvalid = "IMPORT_FILE_INVALID" + ErrImportFormatDateInvalid = "IMPORT_FORMAT_DATE_INVALID" ErrImportFormatUnrecognized = "IMPORT_FORMAT_UNRECOGNIZED" ErrImportIDInvalid = "IMPORT_ID_INVALID" ErrImportTokenInvalid = "IMPORT_TOKEN_INVALID" ErrInlineBotRequired = "INLINE_BOT_REQUIRED" ErrInlineResultExpired = "INLINE_RESULT_EXPIRED" ErrInputChatlistInvalid = "INPUT_CHATLIST_INVALID" + ErrInputFileInvalid = "INPUT_FILE_INVALID" ErrInputFilterInvalid = "INPUT_FILTER_INVALID" ErrInputTextEmpty = "INPUT_TEXT_EMPTY" ErrInputTextTooLong = "INPUT_TEXT_TOO_LONG" @@ -258,6 +285,7 @@ const ( ErrInviteSlugExpired = "INVITE_SLUG_EXPIRED" ErrInvoicePayloadInvalid = "INVOICE_PAYLOAD_INVALID" ErrJoinAsPeerInvalid = "JOIN_AS_PEER_INVALID" + ErrLanguageInvalid = "LANGUAGE_INVALID" ErrLangCodeInvalid = "LANG_CODE_INVALID" ErrLangCodeNotSupported = "LANG_CODE_NOT_SUPPORTED" ErrLangPackInvalid = "LANG_PACK_INVALID" @@ -290,8 +318,10 @@ const ( ErrMessageIDsEmpty = "MESSAGE_IDS_EMPTY" ErrMessageIDInvalid = "MESSAGE_ID_INVALID" ErrMessageNotModified = "MESSAGE_NOT_MODIFIED" + ErrMessageNotReadYet = "MESSAGE_NOT_READ_YET" ErrMessagePollClosed = "MESSAGE_POLL_CLOSED" ErrMessageTooLong = "MESSAGE_TOO_LONG" + ErrMessageTooOld = "MESSAGE_TOO_OLD" ErrMethodInvalid = "METHOD_INVALID" ErrMinDateInvalid = "MIN_DATE_INVALID" ErrMsgIDInvalid = "MSG_ID_INVALID" @@ -302,6 +332,8 @@ const ( ErrNewSettingsEmpty = "NEW_SETTINGS_EMPTY" ErrNewSettingsInvalid = "NEW_SETTINGS_INVALID" ErrNextOffsetInvalid = "NEXT_OFFSET_INVALID" + ErrNotEligible = "NOT_ELIGIBLE" + ErrNotJoined = "NOT_JOINED" ErrOffsetInvalid = "OFFSET_INVALID" ErrOffsetPeerIDInvalid = "OFFSET_PEER_ID_INVALID" ErrOptionsTooMuch = "OPTIONS_TOO_MUCH" @@ -364,6 +396,7 @@ const ( ErrPollQuestionInvalid = "POLL_QUESTION_INVALID" ErrPollVoteRequired = "POLL_VOTE_REQUIRED" ErrPremiumAccountRequired = "PREMIUM_ACCOUNT_REQUIRED" + ErrPremiumCurrentlyUnavailable = "PREMIUM_CURRENTLY_UNAVAILABLE" ErrPremiumSubActiveUntil = "PREMIUM_SUB_ACTIVE_UNTIL" ErrPreviousChatImportActiveWaitMin = "PREVIOUS_CHAT_IMPORT_ACTIVE_WAIT_MIN" ErrPrivacyKeyInvalid = "PRIVACY_KEY_INVALID" @@ -375,11 +408,14 @@ const ( ErrQueryIDEmpty = "QUERY_ID_EMPTY" ErrQueryIDInvalid = "QUERY_ID_INVALID" ErrQueryTooShort = "QUERY_TOO_SHORT" + ErrQuickRepliesTooMuch = "QUICK_REPLIES_TOO_MUCH" ErrQuizAnswerMissing = "QUIZ_ANSWER_MISSING" ErrQuizCorrectAnswersEmpty = "QUIZ_CORRECT_ANSWERS_EMPTY" ErrQuizCorrectAnswersTooMuch = "QUIZ_CORRECT_ANSWERS_TOO_MUCH" ErrQuizCorrectAnswerInvalid = "QUIZ_CORRECT_ANSWER_INVALID" ErrQuizMultipleInvalid = "QUIZ_MULTIPLE_INVALID" + ErrQuoteTextInvalid = "QUOTE_TEXT_INVALID" + ErrRaiseHandForbidden = "RAISE_HAND_FORBIDDEN" ErrRandomIDDuplicate = "RANDOM_ID_DUPLICATE" ErrRandomIDEmpty = "RANDOM_ID_EMPTY" ErrRandomIDInvalid = "RANDOM_ID_INVALID" @@ -388,12 +424,16 @@ const ( ErrReactionsTooMany = "REACTIONS_TOO_MANY" ErrReactionEmpty = "REACTION_EMPTY" ErrReactionInvalid = "REACTION_INVALID" + ErrReceiptEmpty = "RECEIPT_EMPTY" ErrReplyMarkupBuyEmpty = "REPLY_MARKUP_BUY_EMPTY" + ErrReplyMarkupGameEmpty = "REPLY_MARKUP_GAME_EMPTY" ErrReplyMarkupInvalid = "REPLY_MARKUP_INVALID" ErrReplyMarkupTooLong = "REPLY_MARKUP_TOO_LONG" + ErrReplyMessagesTooMuch = "REPLY_MESSAGES_TOO_MUCH" ErrReplyMessageIDInvalid = "REPLY_MESSAGE_ID_INVALID" ErrReplyToInvalid = "REPLY_TO_INVALID" ErrReplyToUserInvalid = "REPLY_TO_USER_INVALID" + ErrRequestTokenInvalid = "REQUEST_TOKEN_INVALID" ErrResetRequestMissing = "RESET_REQUEST_MISSING" ErrResultsTooMuch = "RESULTS_TOO_MUCH" ErrResultIDDuplicate = "RESULT_ID_DUPLICATE" @@ -403,6 +443,8 @@ const ( ErrRevoteNotAllowed = "REVOTE_NOT_ALLOWED" ErrRightsNotModified = "RIGHTS_NOT_MODIFIED" ErrRightForbidden = "RIGHT_FORBIDDEN" + ErrRingtoneInvalid = "RINGTONE_INVALID" + ErrRingtoneMimeInvalid = "RINGTONE_MIME_INVALID" ErrRsaDecryptFailed = "RSA_DECRYPT_FAILED" ErrScheduleBotNotAllowed = "SCHEDULE_BOT_NOT_ALLOWED" ErrScheduleDateInvalid = "SCHEDULE_DATE_INVALID" @@ -413,6 +455,7 @@ const ( ErrSearchQueryEmpty = "SEARCH_QUERY_EMPTY" ErrSearchWithLinkNotSupported = "SEARCH_WITH_LINK_NOT_SUPPORTED" ErrSecondsInvalid = "SECONDS_INVALID" + ErrSecureSecretRequired = "SECURE_SECRET_REQUIRED" ErrSendAsPeerInvalid = "SEND_AS_PEER_INVALID" ErrSendCodeUnavailable = "SEND_CODE_UNAVAILABLE" ErrSendMediaInvalid = "SEND_MEDIA_INVALID" @@ -422,6 +465,7 @@ const ( ErrSessionTooFresh = "SESSION_TOO_FRESH" ErrSettingsInvalid = "SETTINGS_INVALID" ErrSHA256HashInvalid = "SHA256_HASH_INVALID" + ErrShortcutInvalid = "SHORTCUT_INVALID" ErrShortNameInvalid = "SHORT_NAME_INVALID" ErrShortNameOccupied = "SHORT_NAME_OCCUPIED" ErrSignInFailed = "SIGN_IN_FAILED" @@ -429,6 +473,7 @@ const ( ErrSlowmodeMultiMsgsDisabled = "SLOWMODE_MULTI_MSGS_DISABLED" ErrSlowmodeWait = "SLOWMODE_WAIT" ErrSlugInvalid = "SLUG_INVALID" + ErrSmsjobIDInvalid = "SMSJOB_ID_INVALID" ErrSMSCodeCreateFailed = "SMS_CODE_CREATE_FAILED" ErrSRPIDInvalid = "SRP_ID_INVALID" ErrSRPPasswordChanged = "SRP_PASSWORD_CHANGED" @@ -465,6 +510,7 @@ const ( ErrStorySendFloodMonthly = "STORY_SEND_FLOOD_MONTHLY" ErrStorySendFloodWeekly = "STORY_SEND_FLOOD_WEEKLY" ErrSwitchPmTextEmpty = "SWITCH_PM_TEXT_EMPTY" + ErrSwitchWebviewURLInvalid = "SWITCH_WEBVIEW_URL_INVALID" ErrTakeoutInitDelay = "TAKEOUT_INIT_DELAY" ErrTakeoutInvalid = "TAKEOUT_INVALID" ErrTakeoutRequired = "TAKEOUT_REQUIRED" @@ -476,6 +522,7 @@ const ( ErrThemeInvalid = "THEME_INVALID" ErrThemeMimeInvalid = "THEME_MIME_INVALID" ErrThemeTitleInvalid = "THEME_TITLE_INVALID" + ErrTimezoneInvalid = "TIMEZONE_INVALID" ErrTitleInvalid = "TITLE_INVALID" ErrTmpPasswordDisabled = "TMP_PASSWORD_DISABLED" ErrTokenEmpty = "TOKEN_EMPTY" @@ -491,12 +538,14 @@ const ( ErrTopicTitleEmpty = "TOPIC_TITLE_EMPTY" ErrToLangInvalid = "TO_LANG_INVALID" ErrTranscriptionFailed = "TRANSCRIPTION_FAILED" + ErrTranslateReqQuotaExceeded = "TRANSLATE_REQ_QUOTA_EXCEEDED" ErrTTLDaysInvalid = "TTL_DAYS_INVALID" ErrTTLMediaInvalid = "TTL_MEDIA_INVALID" ErrTTLPeriodInvalid = "TTL_PERIOD_INVALID" ErrTypesEmpty = "TYPES_EMPTY" ErrTimeout = "Timeout" ErrUntilDateInvalid = "UNTIL_DATE_INVALID" + ErrUpdateAppToLogin = "UPDATE_APP_TO_LOGIN" ErrURLInvalid = "URL_INVALID" ErrUsageLimitInvalid = "USAGE_LIMIT_INVALID" ErrUsernamesActiveTooMuch = "USERNAMES_ACTIVE_TOO_MUCH" @@ -534,6 +583,8 @@ const ( ErrVenueIDInvalid = "VENUE_ID_INVALID" ErrVideoContentTypeInvalid = "VIDEO_CONTENT_TYPE_INVALID" ErrVideoFileInvalid = "VIDEO_FILE_INVALID" + ErrVideoPauseForbidden = "VIDEO_PAUSE_FORBIDDEN" + ErrVideoStopForbidden = "VIDEO_STOP_FORBIDDEN" ErrVideoTitleEmpty = "VIDEO_TITLE_EMPTY" ErrVoiceMessagesForbidden = "VOICE_MESSAGES_FORBIDDEN" ErrWallpaperFileInvalid = "WALLPAPER_FILE_INVALID" @@ -552,6 +603,7 @@ const ( ErrWebpushAuthInvalid = "WEBPUSH_AUTH_INVALID" ErrWebpushKeyInvalid = "WEBPUSH_KEY_INVALID" ErrWebpushTokenInvalid = "WEBPUSH_TOKEN_INVALID" + ErrYourPrivacyRestricted = "YOUR_PRIVACY_RESTRICTED" ErrYouBlockedUser = "YOU_BLOCKED_USER" ) @@ -605,6 +657,11 @@ func IsAdminRightsEmpty(err error) bool { return tgerr.Is(err, ErrAdminRightsEmpty) } +// IsAdExpired reports whether err is AD_EXPIRED. +func IsAdExpired(err error) bool { + return tgerr.Is(err, ErrAdExpired) +} + // IsAlbumPhotosTooMany reports whether err is ALBUM_PHOTOS_TOO_MANY. func IsAlbumPhotosTooMany(err error) bool { return tgerr.Is(err, ErrAlbumPhotosTooMany) @@ -680,6 +737,11 @@ func IsAutoarchiveNotAvailable(err error) bool { return tgerr.Is(err, ErrAutoarchiveNotAvailable) } +// IsBalanceTooLow reports whether err is BALANCE_TOO_LOW. +func IsBalanceTooLow(err error) bool { + return tgerr.Is(err, ErrBalanceTooLow) +} + // IsBankCardNumberInvalid reports whether err is BANK_CARD_NUMBER_INVALID. func IsBankCardNumberInvalid(err error) bool { return tgerr.Is(err, ErrBankCardNumberInvalid) @@ -690,6 +752,11 @@ func IsBannedRightsInvalid(err error) bool { return tgerr.Is(err, ErrBannedRightsInvalid) } +// IsBirthdayInvalid reports whether err is BIRTHDAY_INVALID. +func IsBirthdayInvalid(err error) bool { + return tgerr.Is(err, ErrBirthdayInvalid) +} + // IsBoostsEmpty reports whether err is BOOSTS_EMPTY. func IsBoostsEmpty(err error) bool { return tgerr.Is(err, ErrBoostsEmpty) @@ -710,6 +777,16 @@ func IsBotsTooMuch(err error) bool { return tgerr.Is(err, ErrBotsTooMuch) } +// IsBotAlreadyDisabled reports whether err is BOT_ALREADY_DISABLED. +func IsBotAlreadyDisabled(err error) bool { + return tgerr.Is(err, ErrBotAlreadyDisabled) +} + +// IsBotAppBotInvalid reports whether err is BOT_APP_BOT_INVALID. +func IsBotAppBotInvalid(err error) bool { + return tgerr.Is(err, ErrBotAppBotInvalid) +} + // IsBotAppInvalid reports whether err is BOT_APP_INVALID. func IsBotAppInvalid(err error) bool { return tgerr.Is(err, ErrBotAppInvalid) @@ -720,6 +797,11 @@ func IsBotAppShortnameInvalid(err error) bool { return tgerr.Is(err, ErrBotAppShortnameInvalid) } +// IsBotBusinessMissing reports whether err is BOT_BUSINESS_MISSING. +func IsBotBusinessMissing(err error) bool { + return tgerr.Is(err, ErrBotBusinessMissing) +} + // IsBotChannelsNa reports whether err is BOT_CHANNELS_NA. func IsBotChannelsNa(err error) bool { return tgerr.Is(err, ErrBotChannelsNa) @@ -740,6 +822,11 @@ func IsBotDomainInvalid(err error) bool { return tgerr.Is(err, ErrBotDomainInvalid) } +// IsBotGamesDisabled reports whether err is BOT_GAMES_DISABLED. +func IsBotGamesDisabled(err error) bool { + return tgerr.Is(err, ErrBotGamesDisabled) +} + // IsBotGroupsBlocked reports whether err is BOT_GROUPS_BLOCKED. func IsBotGroupsBlocked(err error) bool { return tgerr.Is(err, ErrBotGroupsBlocked) @@ -755,9 +842,9 @@ func IsBotInvalid(err error) bool { return tgerr.Is(err, ErrBotInvalid) } -// IsBotMissing reports whether err is BOT_MISSING. -func IsBotMissing(err error) bool { - return tgerr.Is(err, ErrBotMissing) +// IsBotNotConnectedYet reports whether err is BOT_NOT_CONNECTED_YET. +func IsBotNotConnectedYet(err error) bool { + return tgerr.Is(err, ErrBotNotConnectedYet) } // IsBotOnesideNotAvail reports whether err is BOT_ONESIDE_NOT_AVAIL. @@ -805,11 +892,41 @@ func IsBroadcastRequired(err error) bool { return tgerr.Is(err, ErrBroadcastRequired) } +// IsBusinessAddressActive reports whether err is BUSINESS_ADDRESS_ACTIVE. +func IsBusinessAddressActive(err error) bool { + return tgerr.Is(err, ErrBusinessAddressActive) +} + +// IsBusinessPeerInvalid reports whether err is BUSINESS_PEER_INVALID. +func IsBusinessPeerInvalid(err error) bool { + return tgerr.Is(err, ErrBusinessPeerInvalid) +} + +// IsBusinessRecipientsEmpty reports whether err is BUSINESS_RECIPIENTS_EMPTY. +func IsBusinessRecipientsEmpty(err error) bool { + return tgerr.Is(err, ErrBusinessRecipientsEmpty) +} + +// IsBusinessWorkHoursEmpty reports whether err is BUSINESS_WORK_HOURS_EMPTY. +func IsBusinessWorkHoursEmpty(err error) bool { + return tgerr.Is(err, ErrBusinessWorkHoursEmpty) +} + +// IsBusinessWorkHoursPeriodInvalid reports whether err is BUSINESS_WORK_HOURS_PERIOD_INVALID. +func IsBusinessWorkHoursPeriodInvalid(err error) bool { + return tgerr.Is(err, ErrBusinessWorkHoursPeriodInvalid) +} + // IsButtonDataInvalid reports whether err is BUTTON_DATA_INVALID. func IsButtonDataInvalid(err error) bool { return tgerr.Is(err, ErrButtonDataInvalid) } +// IsButtonPosInvalid reports whether err is BUTTON_POS_INVALID. +func IsButtonPosInvalid(err error) bool { + return tgerr.Is(err, ErrButtonPosInvalid) +} + // IsButtonTextInvalid reports whether err is BUTTON_TEXT_INVALID. func IsButtonTextInvalid(err error) bool { return tgerr.Is(err, ErrButtonTextInvalid) @@ -930,6 +1047,26 @@ func IsChannelTooLarge(err error) bool { return tgerr.Is(err, ErrChannelTooLarge) } +// IsChargeAlreadyRefunded reports whether err is CHARGE_ALREADY_REFUNDED. +func IsChargeAlreadyRefunded(err error) bool { + return tgerr.Is(err, ErrChargeAlreadyRefunded) +} + +// IsChatlinksTooMuch reports whether err is CHATLINKS_TOO_MUCH. +func IsChatlinksTooMuch(err error) bool { + return tgerr.Is(err, ErrChatlinksTooMuch) +} + +// IsChatlinkSlugEmpty reports whether err is CHATLINK_SLUG_EMPTY. +func IsChatlinkSlugEmpty(err error) bool { + return tgerr.Is(err, ErrChatlinkSlugEmpty) +} + +// IsChatlinkSlugExpired reports whether err is CHATLINK_SLUG_EXPIRED. +func IsChatlinkSlugExpired(err error) bool { + return tgerr.Is(err, ErrChatlinkSlugExpired) +} + // IsChatlistExcludeInvalid reports whether err is CHATLIST_EXCLUDE_INVALID. func IsChatlistExcludeInvalid(err error) bool { return tgerr.Is(err, ErrChatlistExcludeInvalid) @@ -945,6 +1082,11 @@ func IsChatAboutTooLong(err error) bool { return tgerr.Is(err, ErrChatAboutTooLong) } +// IsChatActionForbidden reports whether err is CHAT_ACTION_FORBIDDEN. +func IsChatActionForbidden(err error) bool { + return tgerr.Is(err, ErrChatActionForbidden) +} + // IsChatAdminInviteRequired reports whether err is CHAT_ADMIN_INVITE_REQUIRED. func IsChatAdminInviteRequired(err error) bool { return tgerr.Is(err, ErrChatAdminInviteRequired) @@ -1065,6 +1207,11 @@ func IsChatSendPollForbidden(err error) bool { return tgerr.Is(err, ErrChatSendPollForbidden) } +// IsChatSendRoundvideosForbidden reports whether err is CHAT_SEND_ROUNDVIDEOS_FORBIDDEN. +func IsChatSendRoundvideosForbidden(err error) bool { + return tgerr.Is(err, ErrChatSendRoundvideosForbidden) +} + // IsChatSendStickersForbidden reports whether err is CHAT_SEND_STICKERS_FORBIDDEN. func IsChatSendStickersForbidden(err error) bool { return tgerr.Is(err, ErrChatSendStickersForbidden) @@ -1110,6 +1257,16 @@ func IsCodeInvalid(err error) bool { return tgerr.Is(err, ErrCodeInvalid) } +// IsCollectibleInvalid reports whether err is COLLECTIBLE_INVALID. +func IsCollectibleInvalid(err error) bool { + return tgerr.Is(err, ErrCollectibleInvalid) +} + +// IsCollectibleNotFound reports whether err is COLLECTIBLE_NOT_FOUND. +func IsCollectibleNotFound(err error) bool { + return tgerr.Is(err, ErrCollectibleNotFound) +} + // IsColorInvalid reports whether err is COLOR_INVALID. func IsColorInvalid(err error) bool { return tgerr.Is(err, ErrColorInvalid) @@ -1125,6 +1282,11 @@ func IsConnectionAppVersionEmpty(err error) bool { return tgerr.Is(err, ErrConnectionAppVersionEmpty) } +// IsConnectionIDInvalid reports whether err is CONNECTION_ID_INVALID. +func IsConnectionIDInvalid(err error) bool { + return tgerr.Is(err, ErrConnectionIDInvalid) +} + // IsConnectionLayerInvalid reports whether err is CONNECTION_LAYER_INVALID. func IsConnectionLayerInvalid(err error) bool { return tgerr.Is(err, ErrConnectionLayerInvalid) @@ -1220,6 +1382,11 @@ func IsEmailInvalid(err error) bool { return tgerr.Is(err, ErrEmailInvalid) } +// IsEmailNotAllowed reports whether err is EMAIL_NOT_ALLOWED. +func IsEmailNotAllowed(err error) bool { + return tgerr.Is(err, ErrEmailNotAllowed) +} + // IsEmailNotSetup reports whether err is EMAIL_NOT_SETUP. func IsEmailNotSetup(err error) bool { return tgerr.Is(err, ErrEmailNotSetup) @@ -1375,11 +1542,6 @@ func IsFilePartTooBig(err error) bool { return tgerr.Is(err, ErrFilePartTooBig) } -// IsFileReference reports whether err is FILE_REFERENCE. -func IsFileReference(err error) bool { - return tgerr.Is(err, ErrFileReference) -} - // IsFileReferenceEmpty reports whether err is FILE_REFERENCE_EMPTY. func IsFileReferenceEmpty(err error) bool { return tgerr.Is(err, ErrFileReferenceEmpty) @@ -1430,11 +1592,21 @@ func IsFirstnameInvalid(err error) bool { return tgerr.Is(err, ErrFirstnameInvalid) } +// IsFloodPremiumWait reports whether err is FLOOD_PREMIUM_WAIT. +func IsFloodPremiumWait(err error) bool { + return tgerr.Is(err, ErrFloodPremiumWait) +} + // IsFolderIDInvalid reports whether err is FOLDER_ID_INVALID. func IsFolderIDInvalid(err error) bool { return tgerr.Is(err, ErrFolderIDInvalid) } +// IsFormExpired reports whether err is FORM_EXPIRED. +func IsFormExpired(err error) bool { + return tgerr.Is(err, ErrFormExpired) +} + // IsForumEnabled reports whether err is FORUM_ENABLED. func IsForumEnabled(err error) bool { return tgerr.Is(err, ErrForumEnabled) @@ -1555,6 +1727,11 @@ func IsGroupedMediaInvalid(err error) bool { return tgerr.Is(err, ErrGroupedMediaInvalid) } +// IsHashtagInvalid reports whether err is HASHTAG_INVALID. +func IsHashtagInvalid(err error) bool { + return tgerr.Is(err, ErrHashtagInvalid) +} + // IsHashInvalid reports whether err is HASH_INVALID. func IsHashInvalid(err error) bool { return tgerr.Is(err, ErrHashInvalid) @@ -1575,6 +1752,11 @@ func IsImportFileInvalid(err error) bool { return tgerr.Is(err, ErrImportFileInvalid) } +// IsImportFormatDateInvalid reports whether err is IMPORT_FORMAT_DATE_INVALID. +func IsImportFormatDateInvalid(err error) bool { + return tgerr.Is(err, ErrImportFormatDateInvalid) +} + // IsImportFormatUnrecognized reports whether err is IMPORT_FORMAT_UNRECOGNIZED. func IsImportFormatUnrecognized(err error) bool { return tgerr.Is(err, ErrImportFormatUnrecognized) @@ -1605,6 +1787,11 @@ func IsInputChatlistInvalid(err error) bool { return tgerr.Is(err, ErrInputChatlistInvalid) } +// IsInputFileInvalid reports whether err is INPUT_FILE_INVALID. +func IsInputFileInvalid(err error) bool { + return tgerr.Is(err, ErrInputFileInvalid) +} + // IsInputFilterInvalid reports whether err is INPUT_FILTER_INVALID. func IsInputFilterInvalid(err error) bool { return tgerr.Is(err, ErrInputFilterInvalid) @@ -1680,6 +1867,11 @@ func IsJoinAsPeerInvalid(err error) bool { return tgerr.Is(err, ErrJoinAsPeerInvalid) } +// IsLanguageInvalid reports whether err is LANGUAGE_INVALID. +func IsLanguageInvalid(err error) bool { + return tgerr.Is(err, ErrLanguageInvalid) +} + // IsLangCodeInvalid reports whether err is LANG_CODE_INVALID. func IsLangCodeInvalid(err error) bool { return tgerr.Is(err, ErrLangCodeInvalid) @@ -1840,6 +2032,11 @@ func IsMessageNotModified(err error) bool { return tgerr.Is(err, ErrMessageNotModified) } +// IsMessageNotReadYet reports whether err is MESSAGE_NOT_READ_YET. +func IsMessageNotReadYet(err error) bool { + return tgerr.Is(err, ErrMessageNotReadYet) +} + // IsMessagePollClosed reports whether err is MESSAGE_POLL_CLOSED. func IsMessagePollClosed(err error) bool { return tgerr.Is(err, ErrMessagePollClosed) @@ -1850,6 +2047,11 @@ func IsMessageTooLong(err error) bool { return tgerr.Is(err, ErrMessageTooLong) } +// IsMessageTooOld reports whether err is MESSAGE_TOO_OLD. +func IsMessageTooOld(err error) bool { + return tgerr.Is(err, ErrMessageTooOld) +} + // IsMethodInvalid reports whether err is METHOD_INVALID. func IsMethodInvalid(err error) bool { return tgerr.Is(err, ErrMethodInvalid) @@ -1900,6 +2102,16 @@ func IsNextOffsetInvalid(err error) bool { return tgerr.Is(err, ErrNextOffsetInvalid) } +// IsNotEligible reports whether err is NOT_ELIGIBLE. +func IsNotEligible(err error) bool { + return tgerr.Is(err, ErrNotEligible) +} + +// IsNotJoined reports whether err is NOT_JOINED. +func IsNotJoined(err error) bool { + return tgerr.Is(err, ErrNotJoined) +} + // IsOffsetInvalid reports whether err is OFFSET_INVALID. func IsOffsetInvalid(err error) bool { return tgerr.Is(err, ErrOffsetInvalid) @@ -2210,6 +2422,11 @@ func IsPremiumAccountRequired(err error) bool { return tgerr.Is(err, ErrPremiumAccountRequired) } +// IsPremiumCurrentlyUnavailable reports whether err is PREMIUM_CURRENTLY_UNAVAILABLE. +func IsPremiumCurrentlyUnavailable(err error) bool { + return tgerr.Is(err, ErrPremiumCurrentlyUnavailable) +} + // IsPremiumSubActiveUntil reports whether err is PREMIUM_SUB_ACTIVE_UNTIL. func IsPremiumSubActiveUntil(err error) bool { return tgerr.Is(err, ErrPremiumSubActiveUntil) @@ -2265,6 +2482,11 @@ func IsQueryTooShort(err error) bool { return tgerr.Is(err, ErrQueryTooShort) } +// IsQuickRepliesTooMuch reports whether err is QUICK_REPLIES_TOO_MUCH. +func IsQuickRepliesTooMuch(err error) bool { + return tgerr.Is(err, ErrQuickRepliesTooMuch) +} + // IsQuizAnswerMissing reports whether err is QUIZ_ANSWER_MISSING. func IsQuizAnswerMissing(err error) bool { return tgerr.Is(err, ErrQuizAnswerMissing) @@ -2290,6 +2512,16 @@ func IsQuizMultipleInvalid(err error) bool { return tgerr.Is(err, ErrQuizMultipleInvalid) } +// IsQuoteTextInvalid reports whether err is QUOTE_TEXT_INVALID. +func IsQuoteTextInvalid(err error) bool { + return tgerr.Is(err, ErrQuoteTextInvalid) +} + +// IsRaiseHandForbidden reports whether err is RAISE_HAND_FORBIDDEN. +func IsRaiseHandForbidden(err error) bool { + return tgerr.Is(err, ErrRaiseHandForbidden) +} + // IsRandomIDDuplicate reports whether err is RANDOM_ID_DUPLICATE. func IsRandomIDDuplicate(err error) bool { return tgerr.Is(err, ErrRandomIDDuplicate) @@ -2330,11 +2562,21 @@ func IsReactionInvalid(err error) bool { return tgerr.Is(err, ErrReactionInvalid) } +// IsReceiptEmpty reports whether err is RECEIPT_EMPTY. +func IsReceiptEmpty(err error) bool { + return tgerr.Is(err, ErrReceiptEmpty) +} + // IsReplyMarkupBuyEmpty reports whether err is REPLY_MARKUP_BUY_EMPTY. func IsReplyMarkupBuyEmpty(err error) bool { return tgerr.Is(err, ErrReplyMarkupBuyEmpty) } +// IsReplyMarkupGameEmpty reports whether err is REPLY_MARKUP_GAME_EMPTY. +func IsReplyMarkupGameEmpty(err error) bool { + return tgerr.Is(err, ErrReplyMarkupGameEmpty) +} + // IsReplyMarkupInvalid reports whether err is REPLY_MARKUP_INVALID. func IsReplyMarkupInvalid(err error) bool { return tgerr.Is(err, ErrReplyMarkupInvalid) @@ -2345,6 +2587,11 @@ func IsReplyMarkupTooLong(err error) bool { return tgerr.Is(err, ErrReplyMarkupTooLong) } +// IsReplyMessagesTooMuch reports whether err is REPLY_MESSAGES_TOO_MUCH. +func IsReplyMessagesTooMuch(err error) bool { + return tgerr.Is(err, ErrReplyMessagesTooMuch) +} + // IsReplyMessageIDInvalid reports whether err is REPLY_MESSAGE_ID_INVALID. func IsReplyMessageIDInvalid(err error) bool { return tgerr.Is(err, ErrReplyMessageIDInvalid) @@ -2360,6 +2607,11 @@ func IsReplyToUserInvalid(err error) bool { return tgerr.Is(err, ErrReplyToUserInvalid) } +// IsRequestTokenInvalid reports whether err is REQUEST_TOKEN_INVALID. +func IsRequestTokenInvalid(err error) bool { + return tgerr.Is(err, ErrRequestTokenInvalid) +} + // IsResetRequestMissing reports whether err is RESET_REQUEST_MISSING. func IsResetRequestMissing(err error) bool { return tgerr.Is(err, ErrResetRequestMissing) @@ -2405,6 +2657,16 @@ func IsRightForbidden(err error) bool { return tgerr.Is(err, ErrRightForbidden) } +// IsRingtoneInvalid reports whether err is RINGTONE_INVALID. +func IsRingtoneInvalid(err error) bool { + return tgerr.Is(err, ErrRingtoneInvalid) +} + +// IsRingtoneMimeInvalid reports whether err is RINGTONE_MIME_INVALID. +func IsRingtoneMimeInvalid(err error) bool { + return tgerr.Is(err, ErrRingtoneMimeInvalid) +} + // IsRsaDecryptFailed reports whether err is RSA_DECRYPT_FAILED. func IsRsaDecryptFailed(err error) bool { return tgerr.Is(err, ErrRsaDecryptFailed) @@ -2455,6 +2717,11 @@ func IsSecondsInvalid(err error) bool { return tgerr.Is(err, ErrSecondsInvalid) } +// IsSecureSecretRequired reports whether err is SECURE_SECRET_REQUIRED. +func IsSecureSecretRequired(err error) bool { + return tgerr.Is(err, ErrSecureSecretRequired) +} + // IsSendAsPeerInvalid reports whether err is SEND_AS_PEER_INVALID. func IsSendAsPeerInvalid(err error) bool { return tgerr.Is(err, ErrSendAsPeerInvalid) @@ -2500,6 +2767,11 @@ func IsSHA256HashInvalid(err error) bool { return tgerr.Is(err, ErrSHA256HashInvalid) } +// IsShortcutInvalid reports whether err is SHORTCUT_INVALID. +func IsShortcutInvalid(err error) bool { + return tgerr.Is(err, ErrShortcutInvalid) +} + // IsShortNameInvalid reports whether err is SHORT_NAME_INVALID. func IsShortNameInvalid(err error) bool { return tgerr.Is(err, ErrShortNameInvalid) @@ -2535,6 +2807,11 @@ func IsSlugInvalid(err error) bool { return tgerr.Is(err, ErrSlugInvalid) } +// IsSmsjobIDInvalid reports whether err is SMSJOB_ID_INVALID. +func IsSmsjobIDInvalid(err error) bool { + return tgerr.Is(err, ErrSmsjobIDInvalid) +} + // IsSMSCodeCreateFailed reports whether err is SMS_CODE_CREATE_FAILED. func IsSMSCodeCreateFailed(err error) bool { return tgerr.Is(err, ErrSMSCodeCreateFailed) @@ -2715,6 +2992,11 @@ func IsSwitchPmTextEmpty(err error) bool { return tgerr.Is(err, ErrSwitchPmTextEmpty) } +// IsSwitchWebviewURLInvalid reports whether err is SWITCH_WEBVIEW_URL_INVALID. +func IsSwitchWebviewURLInvalid(err error) bool { + return tgerr.Is(err, ErrSwitchWebviewURLInvalid) +} + // IsTakeoutInitDelay reports whether err is TAKEOUT_INIT_DELAY. func IsTakeoutInitDelay(err error) bool { return tgerr.Is(err, ErrTakeoutInitDelay) @@ -2770,6 +3052,11 @@ func IsThemeTitleInvalid(err error) bool { return tgerr.Is(err, ErrThemeTitleInvalid) } +// IsTimezoneInvalid reports whether err is TIMEZONE_INVALID. +func IsTimezoneInvalid(err error) bool { + return tgerr.Is(err, ErrTimezoneInvalid) +} + // IsTitleInvalid reports whether err is TITLE_INVALID. func IsTitleInvalid(err error) bool { return tgerr.Is(err, ErrTitleInvalid) @@ -2845,6 +3132,11 @@ func IsTranscriptionFailed(err error) bool { return tgerr.Is(err, ErrTranscriptionFailed) } +// IsTranslateReqQuotaExceeded reports whether err is TRANSLATE_REQ_QUOTA_EXCEEDED. +func IsTranslateReqQuotaExceeded(err error) bool { + return tgerr.Is(err, ErrTranslateReqQuotaExceeded) +} + // IsTTLDaysInvalid reports whether err is TTL_DAYS_INVALID. func IsTTLDaysInvalid(err error) bool { return tgerr.Is(err, ErrTTLDaysInvalid) @@ -2875,6 +3167,11 @@ func IsUntilDateInvalid(err error) bool { return tgerr.Is(err, ErrUntilDateInvalid) } +// IsUpdateAppToLogin reports whether err is UPDATE_APP_TO_LOGIN. +func IsUpdateAppToLogin(err error) bool { + return tgerr.Is(err, ErrUpdateAppToLogin) +} + // IsURLInvalid reports whether err is URL_INVALID. func IsURLInvalid(err error) bool { return tgerr.Is(err, ErrURLInvalid) @@ -3060,6 +3357,16 @@ func IsVideoFileInvalid(err error) bool { return tgerr.Is(err, ErrVideoFileInvalid) } +// IsVideoPauseForbidden reports whether err is VIDEO_PAUSE_FORBIDDEN. +func IsVideoPauseForbidden(err error) bool { + return tgerr.Is(err, ErrVideoPauseForbidden) +} + +// IsVideoStopForbidden reports whether err is VIDEO_STOP_FORBIDDEN. +func IsVideoStopForbidden(err error) bool { + return tgerr.Is(err, ErrVideoStopForbidden) +} + // IsVideoTitleEmpty reports whether err is VIDEO_TITLE_EMPTY. func IsVideoTitleEmpty(err error) bool { return tgerr.Is(err, ErrVideoTitleEmpty) @@ -3150,6 +3457,11 @@ func IsWebpushTokenInvalid(err error) bool { return tgerr.Is(err, ErrWebpushTokenInvalid) } +// IsYourPrivacyRestricted reports whether err is YOUR_PRIVACY_RESTRICTED. +func IsYourPrivacyRestricted(err error) bool { + return tgerr.Is(err, ErrYourPrivacyRestricted) +} + // IsYouBlockedUser reports whether err is YOU_BLOCKED_USER. func IsYouBlockedUser(err error) bool { return tgerr.Is(err, ErrYouBlockedUser) diff --git a/vendor/github.com/gotd/td/tg/tl_exported_chat_invite_gen.go b/vendor/github.com/gotd/td/tg/tl_exported_chat_invite_gen.go index 3a91e738..b159eaa6 100644 --- a/vendor/github.com/gotd/td/tg/tl_exported_chat_invite_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_exported_chat_invite_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// ChatInviteExported represents TL type `chatInviteExported#ab4a819`. +// ChatInviteExported represents TL type `chatInviteExported#a22cbd96`. // Exported chat invite // // See https://core.telegram.org/constructor/chatInviteExported for reference. @@ -74,14 +74,22 @@ type ChatInviteExported struct { // // Use SetRequested and GetRequested helpers. Requested int + // SubscriptionExpired field of ChatInviteExported. + // + // Use SetSubscriptionExpired and GetSubscriptionExpired helpers. + SubscriptionExpired int // Custom description for the invite link, visible only to admins // // Use SetTitle and GetTitle helpers. Title string + // SubscriptionPricing field of ChatInviteExported. + // + // Use SetSubscriptionPricing and GetSubscriptionPricing helpers. + SubscriptionPricing StarsSubscriptionPricing } // ChatInviteExportedTypeID is TL type id of ChatInviteExported. -const ChatInviteExportedTypeID = 0xab4a819 +const ChatInviteExportedTypeID = 0xa22cbd96 // construct implements constructor of ExportedChatInviteClass. func (c ChatInviteExported) construct() ExportedChatInviteClass { return &c } @@ -136,9 +144,15 @@ func (c *ChatInviteExported) Zero() bool { if !(c.Requested == 0) { return false } + if !(c.SubscriptionExpired == 0) { + return false + } if !(c.Title == "") { return false } + if !(c.SubscriptionPricing.Zero()) { + return false + } return true } @@ -165,7 +179,9 @@ func (c *ChatInviteExported) FillFrom(from interface { GetUsageLimit() (value int, ok bool) GetUsage() (value int, ok bool) GetRequested() (value int, ok bool) + GetSubscriptionExpired() (value int, ok bool) GetTitle() (value string, ok bool) + GetSubscriptionPricing() (value StarsSubscriptionPricing, ok bool) }) { c.Revoked = from.GetRevoked() c.Permanent = from.GetPermanent() @@ -193,10 +209,18 @@ func (c *ChatInviteExported) FillFrom(from interface { c.Requested = val } + if val, ok := from.GetSubscriptionExpired(); ok { + c.SubscriptionExpired = val + } + if val, ok := from.GetTitle(); ok { c.Title = val } + if val, ok := from.GetSubscriptionPricing(); ok { + c.SubscriptionPricing = val + } + } // TypeID returns type id in TL schema. @@ -274,11 +298,21 @@ func (c *ChatInviteExported) TypeInfo() tdp.Type { SchemaName: "requested", Null: !c.Flags.Has(7), }, + { + Name: "SubscriptionExpired", + SchemaName: "subscription_expired", + Null: !c.Flags.Has(10), + }, { Name: "Title", SchemaName: "title", Null: !c.Flags.Has(8), }, + { + Name: "SubscriptionPricing", + SchemaName: "subscription_pricing", + Null: !c.Flags.Has(9), + }, } return typ } @@ -309,15 +343,21 @@ func (c *ChatInviteExported) SetFlags() { if !(c.Requested == 0) { c.Flags.Set(7) } + if !(c.SubscriptionExpired == 0) { + c.Flags.Set(10) + } if !(c.Title == "") { c.Flags.Set(8) } + if !(c.SubscriptionPricing.Zero()) { + c.Flags.Set(9) + } } // Encode implements bin.Encoder. func (c *ChatInviteExported) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatInviteExported#ab4a819 as nil") + return fmt.Errorf("can't encode chatInviteExported#a22cbd96 as nil") } b.PutID(ChatInviteExportedTypeID) return c.EncodeBare(b) @@ -326,11 +366,11 @@ func (c *ChatInviteExported) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatInviteExported) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatInviteExported#ab4a819 as nil") + return fmt.Errorf("can't encode chatInviteExported#a22cbd96 as nil") } c.SetFlags() if err := c.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatInviteExported#ab4a819: field flags: %w", err) + return fmt.Errorf("unable to encode chatInviteExported#a22cbd96: field flags: %w", err) } b.PutString(c.Link) b.PutLong(c.AdminID) @@ -350,19 +390,27 @@ func (c *ChatInviteExported) EncodeBare(b *bin.Buffer) error { if c.Flags.Has(7) { b.PutInt(c.Requested) } + if c.Flags.Has(10) { + b.PutInt(c.SubscriptionExpired) + } if c.Flags.Has(8) { b.PutString(c.Title) } + if c.Flags.Has(9) { + if err := c.SubscriptionPricing.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatInviteExported#a22cbd96: field subscription_pricing: %w", err) + } + } return nil } // Decode implements bin.Decoder. func (c *ChatInviteExported) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatInviteExported#ab4a819 to nil") + return fmt.Errorf("can't decode chatInviteExported#a22cbd96 to nil") } if err := b.ConsumeID(ChatInviteExportedTypeID); err != nil { - return fmt.Errorf("unable to decode chatInviteExported#ab4a819: %w", err) + return fmt.Errorf("unable to decode chatInviteExported#a22cbd96: %w", err) } return c.DecodeBare(b) } @@ -370,11 +418,11 @@ func (c *ChatInviteExported) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatInviteExported) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatInviteExported#ab4a819 to nil") + return fmt.Errorf("can't decode chatInviteExported#a22cbd96 to nil") } { if err := c.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatInviteExported#ab4a819: field flags: %w", err) + return fmt.Errorf("unable to decode chatInviteExported#a22cbd96: field flags: %w", err) } } c.Revoked = c.Flags.Has(0) @@ -383,66 +431,78 @@ func (c *ChatInviteExported) DecodeBare(b *bin.Buffer) error { { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatInviteExported#ab4a819: field link: %w", err) + return fmt.Errorf("unable to decode chatInviteExported#a22cbd96: field link: %w", err) } c.Link = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatInviteExported#ab4a819: field admin_id: %w", err) + return fmt.Errorf("unable to decode chatInviteExported#a22cbd96: field admin_id: %w", err) } c.AdminID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatInviteExported#ab4a819: field date: %w", err) + return fmt.Errorf("unable to decode chatInviteExported#a22cbd96: field date: %w", err) } c.Date = value } if c.Flags.Has(4) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatInviteExported#ab4a819: field start_date: %w", err) + return fmt.Errorf("unable to decode chatInviteExported#a22cbd96: field start_date: %w", err) } c.StartDate = value } if c.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatInviteExported#ab4a819: field expire_date: %w", err) + return fmt.Errorf("unable to decode chatInviteExported#a22cbd96: field expire_date: %w", err) } c.ExpireDate = value } if c.Flags.Has(2) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatInviteExported#ab4a819: field usage_limit: %w", err) + return fmt.Errorf("unable to decode chatInviteExported#a22cbd96: field usage_limit: %w", err) } c.UsageLimit = value } if c.Flags.Has(3) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatInviteExported#ab4a819: field usage: %w", err) + return fmt.Errorf("unable to decode chatInviteExported#a22cbd96: field usage: %w", err) } c.Usage = value } if c.Flags.Has(7) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatInviteExported#ab4a819: field requested: %w", err) + return fmt.Errorf("unable to decode chatInviteExported#a22cbd96: field requested: %w", err) } c.Requested = value } + if c.Flags.Has(10) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode chatInviteExported#a22cbd96: field subscription_expired: %w", err) + } + c.SubscriptionExpired = value + } if c.Flags.Has(8) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatInviteExported#ab4a819: field title: %w", err) + return fmt.Errorf("unable to decode chatInviteExported#a22cbd96: field title: %w", err) } c.Title = value } + if c.Flags.Has(9) { + if err := c.SubscriptionPricing.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatInviteExported#a22cbd96: field subscription_pricing: %w", err) + } + } return nil } @@ -617,6 +677,24 @@ func (c *ChatInviteExported) GetRequested() (value int, ok bool) { return c.Requested, true } +// SetSubscriptionExpired sets value of SubscriptionExpired conditional field. +func (c *ChatInviteExported) SetSubscriptionExpired(value int) { + c.Flags.Set(10) + c.SubscriptionExpired = value +} + +// GetSubscriptionExpired returns value of SubscriptionExpired conditional field and +// boolean which is true if field was set. +func (c *ChatInviteExported) GetSubscriptionExpired() (value int, ok bool) { + if c == nil { + return + } + if !c.Flags.Has(10) { + return value, false + } + return c.SubscriptionExpired, true +} + // SetTitle sets value of Title conditional field. func (c *ChatInviteExported) SetTitle(value string) { c.Flags.Set(8) @@ -635,6 +713,24 @@ func (c *ChatInviteExported) GetTitle() (value string, ok bool) { return c.Title, true } +// SetSubscriptionPricing sets value of SubscriptionPricing conditional field. +func (c *ChatInviteExported) SetSubscriptionPricing(value StarsSubscriptionPricing) { + c.Flags.Set(9) + c.SubscriptionPricing = value +} + +// GetSubscriptionPricing returns value of SubscriptionPricing conditional field and +// boolean which is true if field was set. +func (c *ChatInviteExported) GetSubscriptionPricing() (value StarsSubscriptionPricing, ok bool) { + if c == nil { + return + } + if !c.Flags.Has(9) { + return value, false + } + return c.SubscriptionPricing, true +} + // ChatInvitePublicJoinRequests represents TL type `chatInvitePublicJoinRequests#ed107ab7`. // Used in updates and in the channel log to indicate when a user is requesting to join // or has joined a discussion group¹ @@ -755,7 +851,7 @@ const ExportedChatInviteClassName = "ExportedChatInvite" // panic(err) // } // switch v := g.(type) { -// case *tg.ChatInviteExported: // chatInviteExported#ab4a819 +// case *tg.ChatInviteExported: // chatInviteExported#a22cbd96 // case *tg.ChatInvitePublicJoinRequests: // chatInvitePublicJoinRequests#ed107ab7 // default: panic(v) // } @@ -786,7 +882,7 @@ func DecodeExportedChatInvite(buf *bin.Buffer) (ExportedChatInviteClass, error) } switch id { case ChatInviteExportedTypeID: - // Decoding chatInviteExported#ab4a819. + // Decoding chatInviteExported#a22cbd96. v := ChatInviteExported{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ExportedChatInviteClass: %w", err) diff --git a/vendor/github.com/gotd/td/tg/tl_fact_check_gen.go b/vendor/github.com/gotd/td/tg/tl_fact_check_gen.go index 1e257d57..697143e7 100644 --- a/vendor/github.com/gotd/td/tg/tl_fact_check_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_fact_check_gen.go @@ -32,22 +32,39 @@ var ( ) // FactCheck represents TL type `factCheck#b89bfccf`. +// Represents a fact-check »¹ created by an independent fact-checker. +// +// Links: +// 1. https://core.telegram.org/api/factcheck // // See https://core.telegram.org/constructor/factCheck for reference. type FactCheck struct { - // Flags field of FactCheck. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // NeedCheck field of FactCheck. + // If set, the country/text fields will not be set, and the fact check must be fetched + // manually by the client (if it isn't already cached with the key specified in hash) + // using bundled messages.getFactCheck¹ requests, when the message with the factcheck + // scrolls into view. + // + // Links: + // 1) https://core.telegram.org/method/messages.getFactCheck NeedCheck bool - // Country field of FactCheck. + // A two-letter ISO 3166-1 alpha-2 country code of the country for which the fact-check + // should be shown. // // Use SetCountry and GetCountry helpers. Country string - // Text field of FactCheck. + // The fact-check. // // Use SetText and GetText helpers. Text TextWithEntities - // Hash field of FactCheck. + // Hash used for caching, for more info click here¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets#hash-generation Hash int64 } diff --git a/vendor/github.com/gotd/td/tg/tl_found_story_gen.go b/vendor/github.com/gotd/td/tg/tl_found_story_gen.go new file mode 100644 index 00000000..351e9b9b --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_found_story_gen.go @@ -0,0 +1,202 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// FoundStory represents TL type `foundStory#e87acbc0`. +// A story found using global story search »¹. +// +// Links: +// 1. https://core.telegram.org/api/stories#searching-stories +// +// See https://core.telegram.org/constructor/foundStory for reference. +type FoundStory struct { + // The peer that posted the story. + Peer PeerClass + // The story. + Story StoryItemClass +} + +// FoundStoryTypeID is TL type id of FoundStory. +const FoundStoryTypeID = 0xe87acbc0 + +// Ensuring interfaces in compile-time for FoundStory. +var ( + _ bin.Encoder = &FoundStory{} + _ bin.Decoder = &FoundStory{} + _ bin.BareEncoder = &FoundStory{} + _ bin.BareDecoder = &FoundStory{} +) + +func (f *FoundStory) Zero() bool { + if f == nil { + return true + } + if !(f.Peer == nil) { + return false + } + if !(f.Story == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (f *FoundStory) String() string { + if f == nil { + return "FoundStory(nil)" + } + type Alias FoundStory + return fmt.Sprintf("FoundStory%+v", Alias(*f)) +} + +// FillFrom fills FoundStory from given interface. +func (f *FoundStory) FillFrom(from interface { + GetPeer() (value PeerClass) + GetStory() (value StoryItemClass) +}) { + f.Peer = from.GetPeer() + f.Story = from.GetStory() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*FoundStory) TypeID() uint32 { + return FoundStoryTypeID +} + +// TypeName returns name of type in TL schema. +func (*FoundStory) TypeName() string { + return "foundStory" +} + +// TypeInfo returns info about TL type. +func (f *FoundStory) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "foundStory", + ID: FoundStoryTypeID, + } + if f == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "Story", + SchemaName: "story", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (f *FoundStory) Encode(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't encode foundStory#e87acbc0 as nil") + } + b.PutID(FoundStoryTypeID) + return f.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (f *FoundStory) EncodeBare(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't encode foundStory#e87acbc0 as nil") + } + if f.Peer == nil { + return fmt.Errorf("unable to encode foundStory#e87acbc0: field peer is nil") + } + if err := f.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode foundStory#e87acbc0: field peer: %w", err) + } + if f.Story == nil { + return fmt.Errorf("unable to encode foundStory#e87acbc0: field story is nil") + } + if err := f.Story.Encode(b); err != nil { + return fmt.Errorf("unable to encode foundStory#e87acbc0: field story: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (f *FoundStory) Decode(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't decode foundStory#e87acbc0 to nil") + } + if err := b.ConsumeID(FoundStoryTypeID); err != nil { + return fmt.Errorf("unable to decode foundStory#e87acbc0: %w", err) + } + return f.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (f *FoundStory) DecodeBare(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't decode foundStory#e87acbc0 to nil") + } + { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode foundStory#e87acbc0: field peer: %w", err) + } + f.Peer = value + } + { + value, err := DecodeStoryItem(b) + if err != nil { + return fmt.Errorf("unable to decode foundStory#e87acbc0: field story: %w", err) + } + f.Story = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (f *FoundStory) GetPeer() (value PeerClass) { + if f == nil { + return + } + return f.Peer +} + +// GetStory returns value of Story field. +func (f *FoundStory) GetStory() (value StoryItemClass) { + if f == nil { + return + } + return f.Story +} diff --git a/vendor/github.com/gotd/td/tg/tl_found_story_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_found_story_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_found_story_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_fragment_collectible_info_gen.go b/vendor/github.com/gotd/td/tg/tl_fragment_collectible_info_gen.go index f522b41d..d6096889 100644 --- a/vendor/github.com/gotd/td/tg/tl_fragment_collectible_info_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_fragment_collectible_info_gen.go @@ -32,20 +32,36 @@ var ( ) // FragmentCollectibleInfo represents TL type `fragment.collectibleInfo#6ebdff91`. +// Info about a fragment collectible¹. +// +// Links: +// 1. https://core.telegram.org/api/fragment // // See https://core.telegram.org/constructor/fragment.collectibleInfo for reference. type FragmentCollectibleInfo struct { - // PurchaseDate field of FragmentCollectibleInfo. + // Purchase date (unixtime) PurchaseDate int - // Currency field of FragmentCollectibleInfo. + // Three-letter ISO 4217 currency¹ code for amount + // + // Links: + // 1) https://core.telegram.org/bots/payments#supported-currencies Currency string - // Amount field of FragmentCollectibleInfo. + // Total price in the smallest units of the currency (integer, not float/double). For + // example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in + // currencies.json¹, it shows the number of digits past the decimal point for each + // currency (2 for the majority of currencies). + // + // Links: + // 1) https://core.telegram.org/bots/payments/currencies.json Amount int64 - // CryptoCurrency field of FragmentCollectibleInfo. + // Cryptocurrency name. CryptoCurrency string - // CryptoAmount field of FragmentCollectibleInfo. + // Price, in the smallest units of the cryptocurrency. CryptoAmount int64 - // URL field of FragmentCollectibleInfo. + // Fragment¹ URL with more info about the collectible + // + // Links: + // 1) https://fragment.com URL string } diff --git a/vendor/github.com/gotd/td/tg/tl_fragment_get_collectible_info_gen.go b/vendor/github.com/gotd/td/tg/tl_fragment_get_collectible_info_gen.go index c63bfc4d..09501ee5 100644 --- a/vendor/github.com/gotd/td/tg/tl_fragment_get_collectible_info_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_fragment_get_collectible_info_gen.go @@ -32,10 +32,15 @@ var ( ) // FragmentGetCollectibleInfoRequest represents TL type `fragment.getCollectibleInfo#be1e85ba`. +// Fetch information about a fragment collectible, see here »¹ for more info on the +// full flow. +// +// Links: +// 1. https://core.telegram.org/api/fragment#fetching-info-about-fragment-collectibles // // See https://core.telegram.org/method/fragment.getCollectibleInfo for reference. type FragmentGetCollectibleInfoRequest struct { - // Collectible field of FragmentGetCollectibleInfoRequest. + // Collectible to fetch info about. Collectible InputCollectibleClass } @@ -166,6 +171,16 @@ func (g *FragmentGetCollectibleInfoRequest) GetCollectible() (value InputCollect } // FragmentGetCollectibleInfo invokes method fragment.getCollectibleInfo#be1e85ba returning error if any. +// Fetch information about a fragment collectible, see here »¹ for more info on the +// full flow. +// +// Links: +// 1. https://core.telegram.org/api/fragment#fetching-info-about-fragment-collectibles +// +// Possible errors: +// +// 400 COLLECTIBLE_INVALID: The specified collectible is invalid. +// 400 COLLECTIBLE_NOT_FOUND: The specified collectible could not be found. // // See https://core.telegram.org/method/fragment.getCollectibleInfo for reference. func (c *Client) FragmentGetCollectibleInfo(ctx context.Context, collectible InputCollectibleClass) (*FragmentCollectibleInfo, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_geo_point_address_gen.go b/vendor/github.com/gotd/td/tg/tl_geo_point_address_gen.go new file mode 100644 index 00000000..0864b030 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_geo_point_address_gen.go @@ -0,0 +1,330 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// GeoPointAddress represents TL type `geoPointAddress#de4c5d93`. +// Address optionally associated to a geoPoint¹. +// +// Links: +// 1. https://core.telegram.org/constructor/geoPoint +// +// See https://core.telegram.org/constructor/geoPointAddress for reference. +type GeoPointAddress struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // Two-letter ISO 3166-1 alpha-2 country code + CountryISO2 string + // State + // + // Use SetState and GetState helpers. + State string + // City + // + // Use SetCity and GetCity helpers. + City string + // Street + // + // Use SetStreet and GetStreet helpers. + Street string +} + +// GeoPointAddressTypeID is TL type id of GeoPointAddress. +const GeoPointAddressTypeID = 0xde4c5d93 + +// Ensuring interfaces in compile-time for GeoPointAddress. +var ( + _ bin.Encoder = &GeoPointAddress{} + _ bin.Decoder = &GeoPointAddress{} + _ bin.BareEncoder = &GeoPointAddress{} + _ bin.BareDecoder = &GeoPointAddress{} +) + +func (g *GeoPointAddress) Zero() bool { + if g == nil { + return true + } + if !(g.Flags.Zero()) { + return false + } + if !(g.CountryISO2 == "") { + return false + } + if !(g.State == "") { + return false + } + if !(g.City == "") { + return false + } + if !(g.Street == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GeoPointAddress) String() string { + if g == nil { + return "GeoPointAddress(nil)" + } + type Alias GeoPointAddress + return fmt.Sprintf("GeoPointAddress%+v", Alias(*g)) +} + +// FillFrom fills GeoPointAddress from given interface. +func (g *GeoPointAddress) FillFrom(from interface { + GetCountryISO2() (value string) + GetState() (value string, ok bool) + GetCity() (value string, ok bool) + GetStreet() (value string, ok bool) +}) { + g.CountryISO2 = from.GetCountryISO2() + if val, ok := from.GetState(); ok { + g.State = val + } + + if val, ok := from.GetCity(); ok { + g.City = val + } + + if val, ok := from.GetStreet(); ok { + g.Street = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GeoPointAddress) TypeID() uint32 { + return GeoPointAddressTypeID +} + +// TypeName returns name of type in TL schema. +func (*GeoPointAddress) TypeName() string { + return "geoPointAddress" +} + +// TypeInfo returns info about TL type. +func (g *GeoPointAddress) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "geoPointAddress", + ID: GeoPointAddressTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "CountryISO2", + SchemaName: "country_iso2", + }, + { + Name: "State", + SchemaName: "state", + Null: !g.Flags.Has(0), + }, + { + Name: "City", + SchemaName: "city", + Null: !g.Flags.Has(1), + }, + { + Name: "Street", + SchemaName: "street", + Null: !g.Flags.Has(2), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (g *GeoPointAddress) SetFlags() { + if !(g.State == "") { + g.Flags.Set(0) + } + if !(g.City == "") { + g.Flags.Set(1) + } + if !(g.Street == "") { + g.Flags.Set(2) + } +} + +// Encode implements bin.Encoder. +func (g *GeoPointAddress) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode geoPointAddress#de4c5d93 as nil") + } + b.PutID(GeoPointAddressTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GeoPointAddress) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode geoPointAddress#de4c5d93 as nil") + } + g.SetFlags() + if err := g.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode geoPointAddress#de4c5d93: field flags: %w", err) + } + b.PutString(g.CountryISO2) + if g.Flags.Has(0) { + b.PutString(g.State) + } + if g.Flags.Has(1) { + b.PutString(g.City) + } + if g.Flags.Has(2) { + b.PutString(g.Street) + } + return nil +} + +// Decode implements bin.Decoder. +func (g *GeoPointAddress) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode geoPointAddress#de4c5d93 to nil") + } + if err := b.ConsumeID(GeoPointAddressTypeID); err != nil { + return fmt.Errorf("unable to decode geoPointAddress#de4c5d93: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GeoPointAddress) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode geoPointAddress#de4c5d93 to nil") + } + { + if err := g.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode geoPointAddress#de4c5d93: field flags: %w", err) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode geoPointAddress#de4c5d93: field country_iso2: %w", err) + } + g.CountryISO2 = value + } + if g.Flags.Has(0) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode geoPointAddress#de4c5d93: field state: %w", err) + } + g.State = value + } + if g.Flags.Has(1) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode geoPointAddress#de4c5d93: field city: %w", err) + } + g.City = value + } + if g.Flags.Has(2) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode geoPointAddress#de4c5d93: field street: %w", err) + } + g.Street = value + } + return nil +} + +// GetCountryISO2 returns value of CountryISO2 field. +func (g *GeoPointAddress) GetCountryISO2() (value string) { + if g == nil { + return + } + return g.CountryISO2 +} + +// SetState sets value of State conditional field. +func (g *GeoPointAddress) SetState(value string) { + g.Flags.Set(0) + g.State = value +} + +// GetState returns value of State conditional field and +// boolean which is true if field was set. +func (g *GeoPointAddress) GetState() (value string, ok bool) { + if g == nil { + return + } + if !g.Flags.Has(0) { + return value, false + } + return g.State, true +} + +// SetCity sets value of City conditional field. +func (g *GeoPointAddress) SetCity(value string) { + g.Flags.Set(1) + g.City = value +} + +// GetCity returns value of City conditional field and +// boolean which is true if field was set. +func (g *GeoPointAddress) GetCity() (value string, ok bool) { + if g == nil { + return + } + if !g.Flags.Has(1) { + return value, false + } + return g.City, true +} + +// SetStreet sets value of Street conditional field. +func (g *GeoPointAddress) SetStreet(value string) { + g.Flags.Set(2) + g.Street = value +} + +// GetStreet returns value of Street conditional field and +// boolean which is true if field was set. +func (g *GeoPointAddress) GetStreet() (value string, ok bool) { + if g == nil { + return + } + if !g.Flags.Has(2) { + return value, false + } + return g.Street, true +} diff --git a/vendor/github.com/gotd/td/tg/tl_geo_point_address_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_geo_point_address_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_geo_point_address_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_global_privacy_settings_gen.go b/vendor/github.com/gotd/td/tg/tl_global_privacy_settings_gen.go index 1dade26c..02af6be3 100644 --- a/vendor/github.com/gotd/td/tg/tl_global_privacy_settings_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_global_privacy_settings_gen.go @@ -53,9 +53,38 @@ type GlobalPrivacySettings struct { // Links: // 1) https://core.telegram.org/api/folders KeepArchivedFolders bool - // HideReadMarks field of GlobalPrivacySettings. + // If this flag is set, the inputPrivacyKeyStatusTimestamp¹ key will also apply to the + // ability to use messages.getOutboxReadDate² on messages sent to us. Meaning, users + // that cannot see our exact last online date due to the current value of the + // inputPrivacyKeyStatusTimestamp³ key will receive a 403 USER_PRIVACY_RESTRICTED error + // when invoking messages.getOutboxReadDate⁴ to fetch the exact read date of a message + // they sent to us. The userFull⁵.read_dates_private flag will be set for users that + // have this flag enabled. + // + // Links: + // 1) https://core.telegram.org/constructor/inputPrivacyKeyStatusTimestamp + // 2) https://core.telegram.org/method/messages.getOutboxReadDate + // 3) https://core.telegram.org/constructor/inputPrivacyKeyStatusTimestamp + // 4) https://core.telegram.org/method/messages.getOutboxReadDate + // 5) https://core.telegram.org/constructor/userFull HideReadMarks bool - // NewNoncontactPeersRequirePremium field of GlobalPrivacySettings. + // If set, only users that have a premium account, are in our contact list, or already + // have a private chat with us can write to us; a 403 PRIVACY_PREMIUM_REQUIRED error will + // be emitted otherwise. The userFull¹.contact_require_premium flag will be set for + // users that have this flag enabled. To check whether we can write to a user with this + // flag enabled, if we haven't yet cached all the required information (for example we + // don't have the userFull² or history of all users while displaying the chat list in + // the sharing UI) the users.getIsPremiumRequiredToContact³ method may be invoked, + // passing the list of users currently visible in the UI, returning a list of booleans + // that directly specify whether we can or cannot write to each user. Premium⁴ users + // only, non-Premium users will receive a PREMIUM_ACCOUNT_REQUIRED error when trying to + // enable this flag. + // + // Links: + // 1) https://core.telegram.org/constructor/userFull + // 2) https://core.telegram.org/constructor/userFull + // 3) https://core.telegram.org/method/users.getIsPremiumRequiredToContact + // 4) https://core.telegram.org/api/premium NewNoncontactPeersRequirePremium bool } diff --git a/vendor/github.com/gotd/td/tg/tl_handlers_gen.go b/vendor/github.com/gotd/td/tg/tl_handlers_gen.go index 6413678f..4579f781 100644 --- a/vendor/github.com/gotd/td/tg/tl_handlers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_handlers_gen.go @@ -1475,3 +1475,43 @@ func (u UpdateDispatcher) OnStarsBalance(handler StarsBalanceHandler) { return handler(ctx, e, update.(*UpdateStarsBalance)) } } + +// BusinessBotCallbackQueryHandler is a BusinessBotCallbackQuery event handler. +type BusinessBotCallbackQueryHandler func(ctx context.Context, e Entities, update *UpdateBusinessBotCallbackQuery) error + +// OnBusinessBotCallbackQuery sets BusinessBotCallbackQuery handler. +func (u UpdateDispatcher) OnBusinessBotCallbackQuery(handler BusinessBotCallbackQueryHandler) { + u.handlers[UpdateBusinessBotCallbackQueryTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdateBusinessBotCallbackQuery)) + } +} + +// StarsRevenueStatusHandler is a StarsRevenueStatus event handler. +type StarsRevenueStatusHandler func(ctx context.Context, e Entities, update *UpdateStarsRevenueStatus) error + +// OnStarsRevenueStatus sets StarsRevenueStatus handler. +func (u UpdateDispatcher) OnStarsRevenueStatus(handler StarsRevenueStatusHandler) { + u.handlers[UpdateStarsRevenueStatusTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdateStarsRevenueStatus)) + } +} + +// BotPurchasedPaidMediaHandler is a BotPurchasedPaidMedia event handler. +type BotPurchasedPaidMediaHandler func(ctx context.Context, e Entities, update *UpdateBotPurchasedPaidMedia) error + +// OnBotPurchasedPaidMedia sets BotPurchasedPaidMedia handler. +func (u UpdateDispatcher) OnBotPurchasedPaidMedia(handler BotPurchasedPaidMediaHandler) { + u.handlers[UpdateBotPurchasedPaidMediaTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdateBotPurchasedPaidMedia)) + } +} + +// PaidReactionPrivacyHandler is a PaidReactionPrivacy event handler. +type PaidReactionPrivacyHandler func(ctx context.Context, e Entities, update *UpdatePaidReactionPrivacy) error + +// OnPaidReactionPrivacy sets PaidReactionPrivacy handler. +func (u UpdateDispatcher) OnPaidReactionPrivacy(handler PaidReactionPrivacyHandler) { + u.handlers[UpdatePaidReactionPrivacyTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdatePaidReactionPrivacy)) + } +} diff --git a/vendor/github.com/gotd/td/tg/tl_help_app_config_gen.go b/vendor/github.com/gotd/td/tg/tl_help_app_config_gen.go index 3e5c188a..9aa61020 100644 --- a/vendor/github.com/gotd/td/tg/tl_help_app_config_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_help_app_config_gen.go @@ -141,7 +141,7 @@ func (a *HelpAppConfigNotModified) DecodeBare(b *bin.Buffer) error { // // See https://core.telegram.org/constructor/help.appConfig for reference. type HelpAppConfig struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_help_countries_list_gen.go b/vendor/github.com/gotd/td/tg/tl_help_countries_list_gen.go index ec5fe912..77d3d827 100644 --- a/vendor/github.com/gotd/td/tg/tl_help_countries_list_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_help_countries_list_gen.go @@ -140,7 +140,7 @@ func (c *HelpCountriesListNotModified) DecodeBare(b *bin.Buffer) error { type HelpCountriesList struct { // Name, ISO code, localized name and phone codes/patterns of all available countries Countries []HelpCountry - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_help_edit_user_info_gen.go b/vendor/github.com/gotd/td/tg/tl_help_edit_user_info_gen.go index 008c9d03..78b36b03 100644 --- a/vendor/github.com/gotd/td/tg/tl_help_edit_user_info_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_help_edit_user_info_gen.go @@ -251,7 +251,7 @@ func (e *HelpEditUserInfoRequest) MapEntities() (value MessageEntityClassArray) // // Possible errors: // -// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. +// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. // 403 USER_INVALID: Invalid user provided. // // See https://core.telegram.org/method/help.editUserInfo for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_help_get_app_config_gen.go b/vendor/github.com/gotd/td/tg/tl_help_get_app_config_gen.go index d1b7abfb..4ae7ab45 100644 --- a/vendor/github.com/gotd/td/tg/tl_help_get_app_config_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_help_get_app_config_gen.go @@ -39,7 +39,7 @@ var ( // // See https://core.telegram.org/method/help.getAppConfig for reference. type HelpGetAppConfigRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_help_get_countries_list_gen.go b/vendor/github.com/gotd/td/tg/tl_help_get_countries_list_gen.go index d04f2fb2..129922f9 100644 --- a/vendor/github.com/gotd/td/tg/tl_help_get_countries_list_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_help_get_countries_list_gen.go @@ -38,7 +38,7 @@ var ( type HelpGetCountriesListRequest struct { // Language code of the current user LangCode string - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_help_get_passport_config_gen.go b/vendor/github.com/gotd/td/tg/tl_help_get_passport_config_gen.go index bfaada54..10f0e0cb 100644 --- a/vendor/github.com/gotd/td/tg/tl_help_get_passport_config_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_help_get_passport_config_gen.go @@ -39,7 +39,7 @@ var ( // // See https://core.telegram.org/method/help.getPassportConfig for reference. type HelpGetPassportConfigRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_help_get_peer_colors_gen.go b/vendor/github.com/gotd/td/tg/tl_help_get_peer_colors_gen.go index d7138309..1350d50c 100644 --- a/vendor/github.com/gotd/td/tg/tl_help_get_peer_colors_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_help_get_peer_colors_gen.go @@ -39,7 +39,7 @@ var ( // // See https://core.telegram.org/method/help.getPeerColors for reference. type HelpGetPeerColorsRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_help_get_peer_profile_colors_gen.go b/vendor/github.com/gotd/td/tg/tl_help_get_peer_profile_colors_gen.go index 13ea44dc..a8f27b3b 100644 --- a/vendor/github.com/gotd/td/tg/tl_help_get_peer_profile_colors_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_help_get_peer_profile_colors_gen.go @@ -39,7 +39,7 @@ var ( // // See https://core.telegram.org/method/help.getPeerProfileColors for reference. type HelpGetPeerProfileColorsRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_help_get_timezones_list_gen.go b/vendor/github.com/gotd/td/tg/tl_help_get_timezones_list_gen.go index e132ecdc..180cb107 100644 --- a/vendor/github.com/gotd/td/tg/tl_help_get_timezones_list_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_help_get_timezones_list_gen.go @@ -32,10 +32,18 @@ var ( ) // HelpGetTimezonesListRequest represents TL type `help.getTimezonesList#49b30240`. +// Returns timezone information that may be used elsewhere in the API, such as to set +// Telegram Business opening hours »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#opening-hours // // See https://core.telegram.org/method/help.getTimezonesList for reference. type HelpGetTimezonesListRequest struct { - // Hash field of HelpGetTimezonesListRequest. + // Hash used for caching, for more info click here¹. + // + // Links: + // 1) https://core.telegram.org/api/offsets#hash-generation Hash int } @@ -161,6 +169,11 @@ func (g *HelpGetTimezonesListRequest) GetHash() (value int) { } // HelpGetTimezonesList invokes method help.getTimezonesList#49b30240 returning error if any. +// Returns timezone information that may be used elsewhere in the API, such as to set +// Telegram Business opening hours »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#opening-hours // // See https://core.telegram.org/method/help.getTimezonesList for reference. func (c *Client) HelpGetTimezonesList(ctx context.Context, hash int) (HelpTimezonesListClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_help_passport_config_gen.go b/vendor/github.com/gotd/td/tg/tl_help_passport_config_gen.go index a521106f..c6a8f4da 100644 --- a/vendor/github.com/gotd/td/tg/tl_help_passport_config_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_help_passport_config_gen.go @@ -141,7 +141,7 @@ func (p *HelpPassportConfigNotModified) DecodeBare(b *bin.Buffer) error { // // See https://core.telegram.org/constructor/help.passportConfig for reference. type HelpPassportConfig struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_help_peer_color_option_gen.go b/vendor/github.com/gotd/td/tg/tl_help_peer_color_option_gen.go index bb588925..6e940c17 100644 --- a/vendor/github.com/gotd/td/tg/tl_help_peer_color_option_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_help_peer_color_option_gen.go @@ -51,7 +51,11 @@ type HelpPeerColorOption struct { ColorID int // Light mode palette. Will be empty for IDs 0 to 6 inclusive, in which case a palette // containing a single color from the following colors should be used: red, orange, - // violet, green, cyan, blue, pink for indexes 0 to 6. + // violet, green, cyan, blue, pink for indexes 0 to 6 (i.e. the same colors used for + // randomized fallback message accent colors¹). + // + // Links: + // 1) https://core.telegram.org/api/colors // // Use SetColors and GetColors helpers. Colors HelpPeerColorSetClass @@ -68,7 +72,11 @@ type HelpPeerColorOption struct { // // Use SetChannelMinLevel and GetChannelMinLevel helpers. ChannelMinLevel int - // GroupMinLevel field of HelpPeerColorOption. + // Supergroups can use this palette only after reaching at least the boost level¹ + // specified in this field. + // + // Links: + // 1) https://core.telegram.org/api/boost // // Use SetGroupMinLevel and GetGroupMinLevel helpers. GroupMinLevel int diff --git a/vendor/github.com/gotd/td/tg/tl_help_peer_colors_gen.go b/vendor/github.com/gotd/td/tg/tl_help_peer_colors_gen.go index 9946c7a1..b8412083 100644 --- a/vendor/github.com/gotd/td/tg/tl_help_peer_colors_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_help_peer_colors_gen.go @@ -141,7 +141,7 @@ func (p *HelpPeerColorsNotModified) DecodeBare(b *bin.Buffer) error { // // See https://core.telegram.org/constructor/help.peerColors for reference. type HelpPeerColors struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_help_set_bot_updates_status_gen.go b/vendor/github.com/gotd/td/tg/tl_help_set_bot_updates_status_gen.go index 003282a0..815ea3c2 100644 --- a/vendor/github.com/gotd/td/tg/tl_help_set_bot_updates_status_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_help_set_bot_updates_status_gen.go @@ -193,6 +193,10 @@ func (s *HelpSetBotUpdatesStatusRequest) GetMessage() (value string) { // Informs the server about the number of pending bot updates if they haven't been // processed for a long time; for bots only // +// Possible errors: +// +// 400 USER_BOT_REQUIRED: This method can only be called by a bot. +// // See https://core.telegram.org/method/help.setBotUpdatesStatus for reference. // Can be used by bots. func (c *Client) HelpSetBotUpdatesStatus(ctx context.Context, request *HelpSetBotUpdatesStatusRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_help_timezones_list_gen.go b/vendor/github.com/gotd/td/tg/tl_help_timezones_list_gen.go index 0ccc7deb..39bf7e42 100644 --- a/vendor/github.com/gotd/td/tg/tl_help_timezones_list_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_help_timezones_list_gen.go @@ -32,6 +32,7 @@ var ( ) // HelpTimezonesListNotModified represents TL type `help.timezonesListNotModified#970708cc`. +// The timezone list has not changed. // // See https://core.telegram.org/constructor/help.timezonesListNotModified for reference. type HelpTimezonesListNotModified struct { @@ -133,12 +134,20 @@ func (t *HelpTimezonesListNotModified) DecodeBare(b *bin.Buffer) error { } // HelpTimezonesList represents TL type `help.timezonesList#7b74ed71`. +// Timezone information that may be used elsewhere in the API, such as to set Telegram +// Business opening hours »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#opening-hours // // See https://core.telegram.org/constructor/help.timezonesList for reference. type HelpTimezonesList struct { - // Timezones field of HelpTimezonesList. + // Timezones Timezones []Timezone - // Hash field of HelpTimezonesList. + // Hash used for caching, for more info click here¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets#hash-generation Hash int } diff --git a/vendor/github.com/gotd/td/tg/tl_init_connection_gen.go b/vendor/github.com/gotd/td/tg/tl_init_connection_gen.go index e0030496..ccd6d3c6 100644 --- a/vendor/github.com/gotd/td/tg/tl_init_connection_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_init_connection_gen.go @@ -54,16 +54,20 @@ type InitConnectionRequest struct { AppVersion string // Code for the language used on the device's OS, ISO 639-1 standard SystemLangCode string - // Language pack to use + // Platform identifier (i.e. android, tdesktop, etc). LangPack string - // Code for the language used on the client, ISO 639-1 standard + // Either an ISO 639-1 language code or a language pack name obtained from a language + // pack link¹. + // + // Links: + // 1) https://core.telegram.org/api/links#language-pack-links LangCode string // Info about an MTProto proxy // // Use SetProxy and GetProxy helpers. Proxy InputClientProxy // Additional initConnection parameters. For now, only the tz_offset field is supported, - // for specifying timezone offset in seconds. + // for specifying the timezone offset in seconds. // // Use SetParams and GetParams helpers. Params JSONValueClass diff --git a/vendor/github.com/gotd/td/tg/tl_input_business_away_message_gen.go b/vendor/github.com/gotd/td/tg/tl_input_business_away_message_gen.go index 19a40644..2fd7c97b 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_business_away_message_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_business_away_message_gen.go @@ -32,18 +32,31 @@ var ( ) // InputBusinessAwayMessage represents TL type `inputBusinessAwayMessage#832175e0`. +// Describes a Telegram Business away message¹, automatically sent to users writing to +// us when we're offline, during closing hours, while we're on vacation, or in some other +// custom time period when we cannot immediately answer to the user. +// +// Links: +// 1. https://core.telegram.org/api/business#away-messages // // See https://core.telegram.org/constructor/inputBusinessAwayMessage for reference. type InputBusinessAwayMessage struct { - // Flags field of InputBusinessAwayMessage. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // OfflineOnly field of InputBusinessAwayMessage. + // If set, the messages will not be sent if the account was online in the last 10 minutes. OfflineOnly bool - // ShortcutID field of InputBusinessAwayMessage. + // ID of a quick reply shorcut, containing the away messages to send, see here » for + // more info¹. + // + // Links: + // 1) https://core.telegram.org/api/business#quick-reply-shortcuts ShortcutID int - // Schedule field of InputBusinessAwayMessage. + // Specifies when should the away messages be sent. Schedule BusinessAwayMessageScheduleClass - // Recipients field of InputBusinessAwayMessage. + // Allowed recipients for the away messages. Recipients InputBusinessRecipients } diff --git a/vendor/github.com/gotd/td/tg/tl_input_business_bot_recipients_gen.go b/vendor/github.com/gotd/td/tg/tl_input_business_bot_recipients_gen.go index 99e11763..1c13f696 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_business_bot_recipients_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_business_bot_recipients_gen.go @@ -32,26 +32,35 @@ var ( ) // InputBusinessBotRecipients represents TL type `inputBusinessBotRecipients#c4e5921e`. +// Specifies the private chats that a connected business bot »¹ may interact with. +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots // // See https://core.telegram.org/constructor/inputBusinessBotRecipients for reference. type InputBusinessBotRecipients struct { - // Flags field of InputBusinessBotRecipients. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // ExistingChats field of InputBusinessBotRecipients. + // Selects all existing private chats. ExistingChats bool - // NewChats field of InputBusinessBotRecipients. + // Selects all new private chats. NewChats bool - // Contacts field of InputBusinessBotRecipients. + // Selects all private chats with contacts. Contacts bool - // NonContacts field of InputBusinessBotRecipients. + // Selects all private chats with non-contacts. NonContacts bool - // ExcludeSelected field of InputBusinessBotRecipients. + // If set, then all private chats except the ones selected by existing_chats, new_chats, + // contacts, non_contacts and users are chosen. Note that if this flag is set, any values + // passed in exclude_users will be merged and moved into users by the server. ExcludeSelected bool - // Users field of InputBusinessBotRecipients. + // Explicitly selected private chats. // // Use SetUsers and GetUsers helpers. Users []InputUserClass - // ExcludeUsers field of InputBusinessBotRecipients. + // Identifiers of private chats that are always excluded. // // Use SetExcludeUsers and GetExcludeUsers helpers. ExcludeUsers []InputUserClass diff --git a/vendor/github.com/gotd/td/tg/tl_input_business_chat_link_gen.go b/vendor/github.com/gotd/td/tg/tl_input_business_chat_link_gen.go index 7b504f6d..c36c7fc9 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_business_chat_link_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_business_chat_link_gen.go @@ -32,18 +32,30 @@ var ( ) // InputBusinessChatLink represents TL type `inputBusinessChatLink#11679fa7`. +// Contains info about a business chat deep link »¹ to be created by the current +// account. +// +// Links: +// 1. https://core.telegram.org/api/business#business-chat-links // // See https://core.telegram.org/constructor/inputBusinessChatLink for reference. type InputBusinessChatLink struct { - // Flags field of InputBusinessChatLink. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Message field of InputBusinessChatLink. + // Message to pre-fill in the message input field. Message string - // Entities field of InputBusinessChatLink. + // Message entities for styled text¹ + // + // Links: + // 1) https://core.telegram.org/api/entities // // Use SetEntities and GetEntities helpers. Entities []MessageEntityClass - // Title field of InputBusinessChatLink. + // Human-readable name of the link, to simplify management in the UI (only visible to the + // creator of the link). // // Use SetTitle and GetTitle helpers. Title string diff --git a/vendor/github.com/gotd/td/tg/tl_input_business_greeting_message_gen.go b/vendor/github.com/gotd/td/tg/tl_input_business_greeting_message_gen.go index 3ffbfd41..7c383c5f 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_business_greeting_message_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_business_greeting_message_gen.go @@ -32,14 +32,24 @@ var ( ) // InputBusinessGreetingMessage represents TL type `inputBusinessGreetingMessage#194cb3b`. +// Describes a Telegram Business greeting¹, automatically sent to new users writing to +// us in private for the first time, or after a certain inactivity period. +// +// Links: +// 1. https://core.telegram.org/api/business#greeting-messages // // See https://core.telegram.org/constructor/inputBusinessGreetingMessage for reference. type InputBusinessGreetingMessage struct { - // ShortcutID field of InputBusinessGreetingMessage. + // ID of a quick reply shorcut, containing the greeting messages to send, see here » for + // more info¹. + // + // Links: + // 1) https://core.telegram.org/api/business#quick-reply-shortcuts ShortcutID int - // Recipients field of InputBusinessGreetingMessage. + // Allowed recipients for the greeting messages. Recipients InputBusinessRecipients - // NoActivityDays field of InputBusinessGreetingMessage. + // The number of days after which a private chat will be considered as inactive; + // currently, must be one of 7, 14, 21, or 28. NoActivityDays int } diff --git a/vendor/github.com/gotd/td/tg/tl_input_business_intro_gen.go b/vendor/github.com/gotd/td/tg/tl_input_business_intro_gen.go index 2da7045b..1846b944 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_business_intro_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_business_intro_gen.go @@ -32,16 +32,26 @@ var ( ) // InputBusinessIntro represents TL type `inputBusinessIntro#9c469cd`. +// Telegram Business introduction »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#business-introduction // // See https://core.telegram.org/constructor/inputBusinessIntro for reference. type InputBusinessIntro struct { - // Flags field of InputBusinessIntro. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Title field of InputBusinessIntro. + // Title of the introduction message Title string - // Description field of InputBusinessIntro. + // Profile introduction Description string - // Sticker field of InputBusinessIntro. + // Optional introduction sticker¹. + // + // Links: + // 1) https://core.telegram.org/api/stickers // // Use SetSticker and GetSticker helpers. Sticker InputDocumentClass diff --git a/vendor/github.com/gotd/td/tg/tl_input_business_recipients_gen.go b/vendor/github.com/gotd/td/tg/tl_input_business_recipients_gen.go index d45849c6..94fff2d2 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_business_recipients_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_business_recipients_gen.go @@ -32,22 +32,35 @@ var ( ) // InputBusinessRecipients represents TL type `inputBusinessRecipients#6f8b32aa`. +// Specifies the chats that can receive Telegram Business away »¹ and greeting »² +// messages. +// If exclude_selected is set, specifies all chats that cannot receive Telegram Business +// away »¹ and greeting »² messages. +// +// Links: +// 1. https://core.telegram.org/api/business#away-messages +// 2. https://core.telegram.org/api/business#greeting-messages +// 3. https://core.telegram.org/api/business#away-messages +// 4. https://core.telegram.org/api/business#greeting-messages // // See https://core.telegram.org/constructor/inputBusinessRecipients for reference. type InputBusinessRecipients struct { - // Flags field of InputBusinessRecipients. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // ExistingChats field of InputBusinessRecipients. + // All existing private chats. ExistingChats bool - // NewChats field of InputBusinessRecipients. + // All new private chats. NewChats bool - // Contacts field of InputBusinessRecipients. + // All private chats with contacts. Contacts bool - // NonContacts field of InputBusinessRecipients. + // All private chats with non-contacts. NonContacts bool - // ExcludeSelected field of InputBusinessRecipients. + // If set, inverts the selection. ExcludeSelected bool - // Users field of InputBusinessRecipients. + // Only private chats with the specified users. // // Use SetUsers and GetUsers helpers. Users []InputUserClass diff --git a/vendor/github.com/gotd/td/tg/tl_input_collectible_gen.go b/vendor/github.com/gotd/td/tg/tl_input_collectible_gen.go index 938c369f..6849ee20 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_collectible_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_collectible_gen.go @@ -32,10 +32,14 @@ var ( ) // InputCollectibleUsername represents TL type `inputCollectibleUsername#e39460a9`. +// Represents a username fragment collectible¹ +// +// Links: +// 1. https://core.telegram.org/api/fragment // // See https://core.telegram.org/constructor/inputCollectibleUsername for reference. type InputCollectibleUsername struct { - // Username field of InputCollectibleUsername. + // Username Username string } @@ -166,10 +170,14 @@ func (i *InputCollectibleUsername) GetUsername() (value string) { } // InputCollectiblePhone represents TL type `inputCollectiblePhone#a2e214a4`. +// Represents a phone number fragment collectible¹ +// +// Links: +// 1. https://core.telegram.org/api/fragment // // See https://core.telegram.org/constructor/inputCollectiblePhone for reference. type InputCollectiblePhone struct { - // Phone field of InputCollectiblePhone. + // Phone number Phone string } diff --git a/vendor/github.com/gotd/td/tg/tl_input_file_gen.go b/vendor/github.com/gotd/td/tg/tl_input_file_gen.go index ce4c99d6..e11e81e5 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_file_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_file_gen.go @@ -447,6 +447,150 @@ func (i *InputFileBig) GetName() (value string) { return i.Name } +// InputFileStoryDocument represents TL type `inputFileStoryDocument#62dc8b48`. +// Used to edit the thumbnail/static preview of a story, see here »¹ for more info on +// the full flow. +// +// Links: +// 1. https://core.telegram.org/api/stories#editing-stories +// +// See https://core.telegram.org/constructor/inputFileStoryDocument for reference. +type InputFileStoryDocument struct { + // The old story video. + ID InputDocumentClass +} + +// InputFileStoryDocumentTypeID is TL type id of InputFileStoryDocument. +const InputFileStoryDocumentTypeID = 0x62dc8b48 + +// construct implements constructor of InputFileClass. +func (i InputFileStoryDocument) construct() InputFileClass { return &i } + +// Ensuring interfaces in compile-time for InputFileStoryDocument. +var ( + _ bin.Encoder = &InputFileStoryDocument{} + _ bin.Decoder = &InputFileStoryDocument{} + _ bin.BareEncoder = &InputFileStoryDocument{} + _ bin.BareDecoder = &InputFileStoryDocument{} + + _ InputFileClass = &InputFileStoryDocument{} +) + +func (i *InputFileStoryDocument) Zero() bool { + if i == nil { + return true + } + if !(i.ID == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputFileStoryDocument) String() string { + if i == nil { + return "InputFileStoryDocument(nil)" + } + type Alias InputFileStoryDocument + return fmt.Sprintf("InputFileStoryDocument%+v", Alias(*i)) +} + +// FillFrom fills InputFileStoryDocument from given interface. +func (i *InputFileStoryDocument) FillFrom(from interface { + GetID() (value InputDocumentClass) +}) { + i.ID = from.GetID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputFileStoryDocument) TypeID() uint32 { + return InputFileStoryDocumentTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputFileStoryDocument) TypeName() string { + return "inputFileStoryDocument" +} + +// TypeInfo returns info about TL type. +func (i *InputFileStoryDocument) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputFileStoryDocument", + ID: InputFileStoryDocumentTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ID", + SchemaName: "id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InputFileStoryDocument) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputFileStoryDocument#62dc8b48 as nil") + } + b.PutID(InputFileStoryDocumentTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputFileStoryDocument) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputFileStoryDocument#62dc8b48 as nil") + } + if i.ID == nil { + return fmt.Errorf("unable to encode inputFileStoryDocument#62dc8b48: field id is nil") + } + if err := i.ID.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputFileStoryDocument#62dc8b48: field id: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (i *InputFileStoryDocument) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputFileStoryDocument#62dc8b48 to nil") + } + if err := b.ConsumeID(InputFileStoryDocumentTypeID); err != nil { + return fmt.Errorf("unable to decode inputFileStoryDocument#62dc8b48: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputFileStoryDocument) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputFileStoryDocument#62dc8b48 to nil") + } + { + value, err := DecodeInputDocument(b) + if err != nil { + return fmt.Errorf("unable to decode inputFileStoryDocument#62dc8b48: field id: %w", err) + } + i.ID = value + } + return nil +} + +// GetID returns value of ID field. +func (i *InputFileStoryDocument) GetID() (value InputDocumentClass) { + if i == nil { + return + } + return i.ID +} + // InputFileClassName is schema name of InputFileClass. const InputFileClassName = "InputFile" @@ -463,6 +607,7 @@ const InputFileClassName = "InputFile" // switch v := g.(type) { // case *tg.InputFile: // inputFile#f52ff27f // case *tg.InputFileBig: // inputFileBig#fa4f0bb5 +// case *tg.InputFileStoryDocument: // inputFileStoryDocument#62dc8b48 // default: panic(v) // } type InputFileClass interface { @@ -482,15 +627,6 @@ type InputFileClass interface { String() string // Zero returns true if current object has a zero value. Zero() bool - - // Random file identifier created by the client - GetID() (value int64) - - // Number of parts saved - GetParts() (value int) - - // Full name of the file - GetName() (value string) } // DecodeInputFile implements binary de-serialization for InputFileClass. @@ -514,6 +650,13 @@ func DecodeInputFile(buf *bin.Buffer) (InputFileClass, error) { return nil, fmt.Errorf("unable to decode InputFileClass: %w", err) } return &v, nil + case InputFileStoryDocumentTypeID: + // Decoding inputFileStoryDocument#62dc8b48. + v := InputFileStoryDocument{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputFileClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode InputFileClass: %w", bin.NewUnexpectedID(id)) } diff --git a/vendor/github.com/gotd/td/tg/tl_input_file_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_input_file_slices_gen.go index ef023a65..de7c92c9 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_file_slices_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_file_slices_gen.go @@ -116,38 +116,6 @@ func (s *InputFileClassArray) Pop() (v InputFileClass, ok bool) { return v, true } -// SortByID sorts slice of InputFileClass by ID. -func (s InputFileClassArray) SortByID() InputFileClassArray { - return s.Sort(func(a, b InputFileClass) bool { - return a.GetID() < b.GetID() - }) -} - -// SortStableByID sorts slice of InputFileClass by ID. -func (s InputFileClassArray) SortStableByID() InputFileClassArray { - return s.SortStable(func(a, b InputFileClass) bool { - return a.GetID() < b.GetID() - }) -} - -// FillInputFileMap fills only InputFile constructors to given map. -func (s InputFileClassArray) FillInputFileMap(to map[int64]*InputFile) { - for _, elem := range s { - value, ok := elem.(*InputFile) - if !ok { - continue - } - to[value.GetID()] = value - } -} - -// InputFileToMap collects only InputFile constructors to map. -func (s InputFileClassArray) InputFileToMap() map[int64]*InputFile { - r := make(map[int64]*InputFile, len(s)) - s.FillInputFileMap(r) - return r -} - // AsInputFile returns copy with only InputFile constructors. func (s InputFileClassArray) AsInputFile() (to InputFileArray) { for _, elem := range s { @@ -161,28 +129,23 @@ func (s InputFileClassArray) AsInputFile() (to InputFileArray) { return to } -// FillInputFileBigMap fills only InputFileBig constructors to given map. -func (s InputFileClassArray) FillInputFileBigMap(to map[int64]*InputFileBig) { +// AsInputFileBig returns copy with only InputFileBig constructors. +func (s InputFileClassArray) AsInputFileBig() (to InputFileBigArray) { for _, elem := range s { value, ok := elem.(*InputFileBig) if !ok { continue } - to[value.GetID()] = value + to = append(to, *value) } + + return to } -// InputFileBigToMap collects only InputFileBig constructors to map. -func (s InputFileClassArray) InputFileBigToMap() map[int64]*InputFileBig { - r := make(map[int64]*InputFileBig, len(s)) - s.FillInputFileBigMap(r) - return r -} - -// AsInputFileBig returns copy with only InputFileBig constructors. -func (s InputFileClassArray) AsInputFileBig() (to InputFileBigArray) { +// AsInputFileStoryDocument returns copy with only InputFileStoryDocument constructors. +func (s InputFileClassArray) AsInputFileStoryDocument() (to InputFileStoryDocumentArray) { for _, elem := range s { - value, ok := elem.(*InputFileBig) + value, ok := elem.(*InputFileStoryDocument) if !ok { continue } @@ -411,3 +374,85 @@ func (s InputFileBigArray) ToMap() map[int64]InputFileBig { s.FillMap(r) return r } + +// InputFileStoryDocumentArray is adapter for slice of InputFileStoryDocument. +type InputFileStoryDocumentArray []InputFileStoryDocument + +// Sort sorts slice of InputFileStoryDocument. +func (s InputFileStoryDocumentArray) Sort(less func(a, b InputFileStoryDocument) bool) InputFileStoryDocumentArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of InputFileStoryDocument. +func (s InputFileStoryDocumentArray) SortStable(less func(a, b InputFileStoryDocument) bool) InputFileStoryDocumentArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of InputFileStoryDocument. +func (s InputFileStoryDocumentArray) Retain(keep func(x InputFileStoryDocument) bool) InputFileStoryDocumentArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s InputFileStoryDocumentArray) First() (v InputFileStoryDocument, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s InputFileStoryDocumentArray) Last() (v InputFileStoryDocument, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *InputFileStoryDocumentArray) PopFirst() (v InputFileStoryDocument, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero InputFileStoryDocument + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *InputFileStoryDocumentArray) Pop() (v InputFileStoryDocument, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/vendor/github.com/gotd/td/tg/tl_input_invoice_gen.go b/vendor/github.com/gotd/td/tg/tl_input_invoice_gen.go index bc0a8564..db48d094 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_invoice_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_invoice_gen.go @@ -32,14 +32,15 @@ var ( ) // InputInvoiceMessage represents TL type `inputInvoiceMessage#c5b56859`. -// An invoice contained in a messageMediaInvoice¹ message. +// An invoice contained in a messageMediaInvoice¹ message or paid media »². // // Links: // 1. https://core.telegram.org/constructor/messageMediaInvoice +// 2. https://core.telegram.org/api/paid-media // // See https://core.telegram.org/constructor/inputInvoiceMessage for reference. type InputInvoiceMessage struct { - // Chat where the invoice was sent + // Chat where the invoice/paid media was sent Peer InputPeerClass // Message ID MsgID int @@ -342,8 +343,8 @@ func (i *InputInvoiceSlug) GetSlug() (value string) { } // InputInvoicePremiumGiftCode represents TL type `inputInvoicePremiumGiftCode#98986c0d`. -// Used if the user wishes to start a channel giveaway¹ or send some giftcodes² to -// members of a channel, in exchange for boosts³. +// Used if the user wishes to start a channel/supergroup giveaway¹ or send some +// giftcodes² to members of a channel/supergroup, in exchange for boosts³. // // Links: // 1. https://core.telegram.org/api/giveaways @@ -526,16 +527,25 @@ func (i *InputInvoicePremiumGiftCode) GetOption() (value PremiumGiftCodeOption) return i.Option } -// InputInvoiceStars represents TL type `inputInvoiceStars#1da33ad8`. +// InputInvoiceStars represents TL type `inputInvoiceStars#65f00ce3`. +// Used to top up the Telegram Stars¹ balance of the current account or someone else's +// account. +// +// Links: +// 1. https://core.telegram.org/api/stars // // See https://core.telegram.org/constructor/inputInvoiceStars for reference. type InputInvoiceStars struct { - // Option field of InputInvoiceStars. - Option StarsTopupOption + // Either an inputStorePaymentStarsTopup¹ or an inputStorePaymentStarsGift². + // + // Links: + // 1) https://core.telegram.org/constructor/inputStorePaymentStarsTopup + // 2) https://core.telegram.org/constructor/inputStorePaymentStarsGift + Purpose InputStorePaymentPurposeClass } // InputInvoiceStarsTypeID is TL type id of InputInvoiceStars. -const InputInvoiceStarsTypeID = 0x1da33ad8 +const InputInvoiceStarsTypeID = 0x65f00ce3 // construct implements constructor of InputInvoiceClass. func (i InputInvoiceStars) construct() InputInvoiceClass { return &i } @@ -554,7 +564,7 @@ func (i *InputInvoiceStars) Zero() bool { if i == nil { return true } - if !(i.Option.Zero()) { + if !(i.Purpose == nil) { return false } @@ -572,9 +582,9 @@ func (i *InputInvoiceStars) String() string { // FillFrom fills InputInvoiceStars from given interface. func (i *InputInvoiceStars) FillFrom(from interface { - GetOption() (value StarsTopupOption) + GetPurpose() (value InputStorePaymentPurposeClass) }) { - i.Option = from.GetOption() + i.Purpose = from.GetPurpose() } // TypeID returns type id in TL schema. @@ -601,8 +611,8 @@ func (i *InputInvoiceStars) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "Option", - SchemaName: "option", + Name: "Purpose", + SchemaName: "purpose", }, } return typ @@ -611,7 +621,7 @@ func (i *InputInvoiceStars) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (i *InputInvoiceStars) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputInvoiceStars#1da33ad8 as nil") + return fmt.Errorf("can't encode inputInvoiceStars#65f00ce3 as nil") } b.PutID(InputInvoiceStarsTypeID) return i.EncodeBare(b) @@ -620,10 +630,13 @@ func (i *InputInvoiceStars) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *InputInvoiceStars) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputInvoiceStars#1da33ad8 as nil") + return fmt.Errorf("can't encode inputInvoiceStars#65f00ce3 as nil") } - if err := i.Option.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInvoiceStars#1da33ad8: field option: %w", err) + if i.Purpose == nil { + return fmt.Errorf("unable to encode inputInvoiceStars#65f00ce3: field purpose is nil") + } + if err := i.Purpose.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputInvoiceStars#65f00ce3: field purpose: %w", err) } return nil } @@ -631,10 +644,10 @@ func (i *InputInvoiceStars) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (i *InputInvoiceStars) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputInvoiceStars#1da33ad8 to nil") + return fmt.Errorf("can't decode inputInvoiceStars#65f00ce3 to nil") } if err := b.ConsumeID(InputInvoiceStarsTypeID); err != nil { - return fmt.Errorf("unable to decode inputInvoiceStars#1da33ad8: %w", err) + return fmt.Errorf("unable to decode inputInvoiceStars#65f00ce3: %w", err) } return i.DecodeBare(b) } @@ -642,22 +655,158 @@ func (i *InputInvoiceStars) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *InputInvoiceStars) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputInvoiceStars#1da33ad8 to nil") + return fmt.Errorf("can't decode inputInvoiceStars#65f00ce3 to nil") } { - if err := i.Option.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputInvoiceStars#1da33ad8: field option: %w", err) + value, err := DecodeInputStorePaymentPurpose(b) + if err != nil { + return fmt.Errorf("unable to decode inputInvoiceStars#65f00ce3: field purpose: %w", err) } + i.Purpose = value } return nil } -// GetOption returns value of Option field. -func (i *InputInvoiceStars) GetOption() (value StarsTopupOption) { +// GetPurpose returns value of Purpose field. +func (i *InputInvoiceStars) GetPurpose() (value InputStorePaymentPurposeClass) { if i == nil { return } - return i.Option + return i.Purpose +} + +// InputInvoiceChatInviteSubscription represents TL type `inputInvoiceChatInviteSubscription#34e793f1`. +// +// See https://core.telegram.org/constructor/inputInvoiceChatInviteSubscription for reference. +type InputInvoiceChatInviteSubscription struct { + // Hash field of InputInvoiceChatInviteSubscription. + Hash string +} + +// InputInvoiceChatInviteSubscriptionTypeID is TL type id of InputInvoiceChatInviteSubscription. +const InputInvoiceChatInviteSubscriptionTypeID = 0x34e793f1 + +// construct implements constructor of InputInvoiceClass. +func (i InputInvoiceChatInviteSubscription) construct() InputInvoiceClass { return &i } + +// Ensuring interfaces in compile-time for InputInvoiceChatInviteSubscription. +var ( + _ bin.Encoder = &InputInvoiceChatInviteSubscription{} + _ bin.Decoder = &InputInvoiceChatInviteSubscription{} + _ bin.BareEncoder = &InputInvoiceChatInviteSubscription{} + _ bin.BareDecoder = &InputInvoiceChatInviteSubscription{} + + _ InputInvoiceClass = &InputInvoiceChatInviteSubscription{} +) + +func (i *InputInvoiceChatInviteSubscription) Zero() bool { + if i == nil { + return true + } + if !(i.Hash == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputInvoiceChatInviteSubscription) String() string { + if i == nil { + return "InputInvoiceChatInviteSubscription(nil)" + } + type Alias InputInvoiceChatInviteSubscription + return fmt.Sprintf("InputInvoiceChatInviteSubscription%+v", Alias(*i)) +} + +// FillFrom fills InputInvoiceChatInviteSubscription from given interface. +func (i *InputInvoiceChatInviteSubscription) FillFrom(from interface { + GetHash() (value string) +}) { + i.Hash = from.GetHash() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputInvoiceChatInviteSubscription) TypeID() uint32 { + return InputInvoiceChatInviteSubscriptionTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputInvoiceChatInviteSubscription) TypeName() string { + return "inputInvoiceChatInviteSubscription" +} + +// TypeInfo returns info about TL type. +func (i *InputInvoiceChatInviteSubscription) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputInvoiceChatInviteSubscription", + ID: InputInvoiceChatInviteSubscriptionTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Hash", + SchemaName: "hash", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InputInvoiceChatInviteSubscription) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputInvoiceChatInviteSubscription#34e793f1 as nil") + } + b.PutID(InputInvoiceChatInviteSubscriptionTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputInvoiceChatInviteSubscription) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputInvoiceChatInviteSubscription#34e793f1 as nil") + } + b.PutString(i.Hash) + return nil +} + +// Decode implements bin.Decoder. +func (i *InputInvoiceChatInviteSubscription) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputInvoiceChatInviteSubscription#34e793f1 to nil") + } + if err := b.ConsumeID(InputInvoiceChatInviteSubscriptionTypeID); err != nil { + return fmt.Errorf("unable to decode inputInvoiceChatInviteSubscription#34e793f1: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputInvoiceChatInviteSubscription) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputInvoiceChatInviteSubscription#34e793f1 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputInvoiceChatInviteSubscription#34e793f1: field hash: %w", err) + } + i.Hash = value + } + return nil +} + +// GetHash returns value of Hash field. +func (i *InputInvoiceChatInviteSubscription) GetHash() (value string) { + if i == nil { + return + } + return i.Hash } // InputInvoiceClassName is schema name of InputInvoiceClass. @@ -677,7 +826,8 @@ const InputInvoiceClassName = "InputInvoice" // case *tg.InputInvoiceMessage: // inputInvoiceMessage#c5b56859 // case *tg.InputInvoiceSlug: // inputInvoiceSlug#c326caef // case *tg.InputInvoicePremiumGiftCode: // inputInvoicePremiumGiftCode#98986c0d -// case *tg.InputInvoiceStars: // inputInvoiceStars#1da33ad8 +// case *tg.InputInvoiceStars: // inputInvoiceStars#65f00ce3 +// case *tg.InputInvoiceChatInviteSubscription: // inputInvoiceChatInviteSubscription#34e793f1 // default: panic(v) // } type InputInvoiceClass interface { @@ -728,12 +878,19 @@ func DecodeInputInvoice(buf *bin.Buffer) (InputInvoiceClass, error) { } return &v, nil case InputInvoiceStarsTypeID: - // Decoding inputInvoiceStars#1da33ad8. + // Decoding inputInvoiceStars#65f00ce3. v := InputInvoiceStars{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err) } return &v, nil + case InputInvoiceChatInviteSubscriptionTypeID: + // Decoding inputInvoiceChatInviteSubscription#34e793f1. + v := InputInvoiceChatInviteSubscription{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", bin.NewUnexpectedID(id)) } diff --git a/vendor/github.com/gotd/td/tg/tl_input_invoice_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_input_invoice_slices_gen.go index e433e11b..cce3cea6 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_invoice_slices_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_invoice_slices_gen.go @@ -168,6 +168,19 @@ func (s InputInvoiceClassArray) AsInputInvoiceStars() (to InputInvoiceStarsArray return to } +// AsInputInvoiceChatInviteSubscription returns copy with only InputInvoiceChatInviteSubscription constructors. +func (s InputInvoiceClassArray) AsInputInvoiceChatInviteSubscription() (to InputInvoiceChatInviteSubscriptionArray) { + for _, elem := range s { + value, ok := elem.(*InputInvoiceChatInviteSubscription) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // InputInvoiceMessageArray is adapter for slice of InputInvoiceMessage. type InputInvoiceMessageArray []InputInvoiceMessage @@ -495,3 +508,85 @@ func (s *InputInvoiceStarsArray) Pop() (v InputInvoiceStars, ok bool) { return v, true } + +// InputInvoiceChatInviteSubscriptionArray is adapter for slice of InputInvoiceChatInviteSubscription. +type InputInvoiceChatInviteSubscriptionArray []InputInvoiceChatInviteSubscription + +// Sort sorts slice of InputInvoiceChatInviteSubscription. +func (s InputInvoiceChatInviteSubscriptionArray) Sort(less func(a, b InputInvoiceChatInviteSubscription) bool) InputInvoiceChatInviteSubscriptionArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of InputInvoiceChatInviteSubscription. +func (s InputInvoiceChatInviteSubscriptionArray) SortStable(less func(a, b InputInvoiceChatInviteSubscription) bool) InputInvoiceChatInviteSubscriptionArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of InputInvoiceChatInviteSubscription. +func (s InputInvoiceChatInviteSubscriptionArray) Retain(keep func(x InputInvoiceChatInviteSubscription) bool) InputInvoiceChatInviteSubscriptionArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s InputInvoiceChatInviteSubscriptionArray) First() (v InputInvoiceChatInviteSubscription, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s InputInvoiceChatInviteSubscriptionArray) Last() (v InputInvoiceChatInviteSubscription, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *InputInvoiceChatInviteSubscriptionArray) PopFirst() (v InputInvoiceChatInviteSubscription, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero InputInvoiceChatInviteSubscription + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *InputInvoiceChatInviteSubscriptionArray) Pop() (v InputInvoiceChatInviteSubscription, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/vendor/github.com/gotd/td/tg/tl_input_media_gen.go b/vendor/github.com/gotd/td/tg/tl_input_media_gen.go index 3b4271e0..2ace6f96 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_media_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_media_gen.go @@ -2812,7 +2812,7 @@ type InputMediaInvoice struct { // // Use SetStartParam and GetStartParam helpers. StartParam string - // Extended media + // Deprecated // // Use SetExtendedMedia and GetExtendedMedia helpers. ExtendedMedia InputMediaClass @@ -4503,6 +4503,263 @@ func (i *InputMediaWebPage) GetURL() (value string) { return i.URL } +// InputMediaPaidMedia represents TL type `inputMediaPaidMedia#c4103386`. +// Paid media, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/paid-media +// +// See https://core.telegram.org/constructor/inputMediaPaidMedia for reference. +type InputMediaPaidMedia struct { + // Flags field of InputMediaPaidMedia. + Flags bin.Fields + // The price of the media in Telegram Stars¹. + // + // Links: + // 1) https://core.telegram.org/api/stars + StarsAmount int64 + // Photos or videos. + ExtendedMedia []InputMediaClass + // Payload field of InputMediaPaidMedia. + // + // Use SetPayload and GetPayload helpers. + Payload string +} + +// InputMediaPaidMediaTypeID is TL type id of InputMediaPaidMedia. +const InputMediaPaidMediaTypeID = 0xc4103386 + +// construct implements constructor of InputMediaClass. +func (i InputMediaPaidMedia) construct() InputMediaClass { return &i } + +// Ensuring interfaces in compile-time for InputMediaPaidMedia. +var ( + _ bin.Encoder = &InputMediaPaidMedia{} + _ bin.Decoder = &InputMediaPaidMedia{} + _ bin.BareEncoder = &InputMediaPaidMedia{} + _ bin.BareDecoder = &InputMediaPaidMedia{} + + _ InputMediaClass = &InputMediaPaidMedia{} +) + +func (i *InputMediaPaidMedia) Zero() bool { + if i == nil { + return true + } + if !(i.Flags.Zero()) { + return false + } + if !(i.StarsAmount == 0) { + return false + } + if !(i.ExtendedMedia == nil) { + return false + } + if !(i.Payload == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputMediaPaidMedia) String() string { + if i == nil { + return "InputMediaPaidMedia(nil)" + } + type Alias InputMediaPaidMedia + return fmt.Sprintf("InputMediaPaidMedia%+v", Alias(*i)) +} + +// FillFrom fills InputMediaPaidMedia from given interface. +func (i *InputMediaPaidMedia) FillFrom(from interface { + GetStarsAmount() (value int64) + GetExtendedMedia() (value []InputMediaClass) + GetPayload() (value string, ok bool) +}) { + i.StarsAmount = from.GetStarsAmount() + i.ExtendedMedia = from.GetExtendedMedia() + if val, ok := from.GetPayload(); ok { + i.Payload = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputMediaPaidMedia) TypeID() uint32 { + return InputMediaPaidMediaTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputMediaPaidMedia) TypeName() string { + return "inputMediaPaidMedia" +} + +// TypeInfo returns info about TL type. +func (i *InputMediaPaidMedia) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputMediaPaidMedia", + ID: InputMediaPaidMediaTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "StarsAmount", + SchemaName: "stars_amount", + }, + { + Name: "ExtendedMedia", + SchemaName: "extended_media", + }, + { + Name: "Payload", + SchemaName: "payload", + Null: !i.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (i *InputMediaPaidMedia) SetFlags() { + if !(i.Payload == "") { + i.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (i *InputMediaPaidMedia) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputMediaPaidMedia#c4103386 as nil") + } + b.PutID(InputMediaPaidMediaTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputMediaPaidMedia) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputMediaPaidMedia#c4103386 as nil") + } + i.SetFlags() + if err := i.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputMediaPaidMedia#c4103386: field flags: %w", err) + } + b.PutLong(i.StarsAmount) + b.PutVectorHeader(len(i.ExtendedMedia)) + for idx, v := range i.ExtendedMedia { + if v == nil { + return fmt.Errorf("unable to encode inputMediaPaidMedia#c4103386: field extended_media element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputMediaPaidMedia#c4103386: field extended_media element with index %d: %w", idx, err) + } + } + if i.Flags.Has(0) { + b.PutString(i.Payload) + } + return nil +} + +// Decode implements bin.Decoder. +func (i *InputMediaPaidMedia) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputMediaPaidMedia#c4103386 to nil") + } + if err := b.ConsumeID(InputMediaPaidMediaTypeID); err != nil { + return fmt.Errorf("unable to decode inputMediaPaidMedia#c4103386: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputMediaPaidMedia) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputMediaPaidMedia#c4103386 to nil") + } + { + if err := i.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputMediaPaidMedia#c4103386: field flags: %w", err) + } + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode inputMediaPaidMedia#c4103386: field stars_amount: %w", err) + } + i.StarsAmount = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode inputMediaPaidMedia#c4103386: field extended_media: %w", err) + } + + if headerLen > 0 { + i.ExtendedMedia = make([]InputMediaClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeInputMedia(b) + if err != nil { + return fmt.Errorf("unable to decode inputMediaPaidMedia#c4103386: field extended_media: %w", err) + } + i.ExtendedMedia = append(i.ExtendedMedia, value) + } + } + if i.Flags.Has(0) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputMediaPaidMedia#c4103386: field payload: %w", err) + } + i.Payload = value + } + return nil +} + +// GetStarsAmount returns value of StarsAmount field. +func (i *InputMediaPaidMedia) GetStarsAmount() (value int64) { + if i == nil { + return + } + return i.StarsAmount +} + +// GetExtendedMedia returns value of ExtendedMedia field. +func (i *InputMediaPaidMedia) GetExtendedMedia() (value []InputMediaClass) { + if i == nil { + return + } + return i.ExtendedMedia +} + +// SetPayload sets value of Payload conditional field. +func (i *InputMediaPaidMedia) SetPayload(value string) { + i.Flags.Set(0) + i.Payload = value +} + +// GetPayload returns value of Payload conditional field and +// boolean which is true if field was set. +func (i *InputMediaPaidMedia) GetPayload() (value string, ok bool) { + if i == nil { + return + } + if !i.Flags.Has(0) { + return value, false + } + return i.Payload, true +} + +// MapExtendedMedia returns field ExtendedMedia wrapped in InputMediaClassArray helper. +func (i *InputMediaPaidMedia) MapExtendedMedia() (value InputMediaClassArray) { + return InputMediaClassArray(i.ExtendedMedia) +} + // InputMediaClassName is schema name of InputMediaClass. const InputMediaClassName = "InputMedia" @@ -4534,6 +4791,7 @@ const InputMediaClassName = "InputMedia" // case *tg.InputMediaDice: // inputMediaDice#e66fbf7b // case *tg.InputMediaStory: // inputMediaStory#89fdd778 // case *tg.InputMediaWebPage: // inputMediaWebPage#c21b8849 +// case *tg.InputMediaPaidMedia: // inputMediaPaidMedia#c4103386 // default: panic(v) // } type InputMediaClass interface { @@ -4681,6 +4939,13 @@ func DecodeInputMedia(buf *bin.Buffer) (InputMediaClass, error) { return nil, fmt.Errorf("unable to decode InputMediaClass: %w", err) } return &v, nil + case InputMediaPaidMediaTypeID: + // Decoding inputMediaPaidMedia#c4103386. + v := InputMediaPaidMedia{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputMediaClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode InputMediaClass: %w", bin.NewUnexpectedID(id)) } diff --git a/vendor/github.com/gotd/td/tg/tl_input_media_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_input_media_slices_gen.go index 4eaa15e2..add9a83a 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_media_slices_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_media_slices_gen.go @@ -324,6 +324,19 @@ func (s InputMediaClassArray) AsInputMediaWebPage() (to InputMediaWebPageArray) return to } +// AsInputMediaPaidMedia returns copy with only InputMediaPaidMedia constructors. +func (s InputMediaClassArray) AsInputMediaPaidMedia() (to InputMediaPaidMediaArray) { + for _, elem := range s { + value, ok := elem.(*InputMediaPaidMedia) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // InputMediaUploadedPhotoArray is adapter for slice of InputMediaUploadedPhoto. type InputMediaUploadedPhotoArray []InputMediaUploadedPhoto @@ -1663,3 +1676,85 @@ func (s *InputMediaWebPageArray) Pop() (v InputMediaWebPage, ok bool) { return v, true } + +// InputMediaPaidMediaArray is adapter for slice of InputMediaPaidMedia. +type InputMediaPaidMediaArray []InputMediaPaidMedia + +// Sort sorts slice of InputMediaPaidMedia. +func (s InputMediaPaidMediaArray) Sort(less func(a, b InputMediaPaidMedia) bool) InputMediaPaidMediaArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of InputMediaPaidMedia. +func (s InputMediaPaidMediaArray) SortStable(less func(a, b InputMediaPaidMedia) bool) InputMediaPaidMediaArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of InputMediaPaidMedia. +func (s InputMediaPaidMediaArray) Retain(keep func(x InputMediaPaidMedia) bool) InputMediaPaidMediaArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s InputMediaPaidMediaArray) First() (v InputMediaPaidMedia, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s InputMediaPaidMediaArray) Last() (v InputMediaPaidMedia, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *InputMediaPaidMediaArray) PopFirst() (v InputMediaPaidMedia, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero InputMediaPaidMedia + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *InputMediaPaidMediaArray) Pop() (v InputMediaPaidMedia, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/vendor/github.com/gotd/td/tg/tl_input_privacy_key_gen.go b/vendor/github.com/gotd/td/tg/tl_input_privacy_key_gen.go index d82f66b6..9c88ee8d 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_privacy_key_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_privacy_key_gen.go @@ -32,7 +32,20 @@ var ( ) // InputPrivacyKeyStatusTimestamp represents TL type `inputPrivacyKeyStatusTimestamp#4f96cb18`. -// Whether people will be able to see your exact last online timestamp +// Whether people will be able to see our exact last online timestamp. +// Note that if we decide to hide our exact last online timestamp to someone (i.e., users +// A, B, C, or all users) and we do not have a Premium¹ subscription, we won't be able +// to see the exact last online timestamp of those users (A, B, C, or all users), even if +// those users do share it with us. +// If those users do share their exact online status with us, but we can't see it due to +// the reason mentioned above, the by_me flag of userStatusRecently¹, +// userStatusLastWeek², userStatusLastMonth³ will be set. +// +// Links: +// 1. https://core.telegram.org/api/premium +// 2. https://core.telegram.org/constructor/userStatusRecently +// 3. https://core.telegram.org/constructor/userStatusLastWeek +// 4. https://core.telegram.org/constructor/userStatusLastMonth // // See https://core.telegram.org/constructor/inputPrivacyKeyStatusTimestamp for reference. type InputPrivacyKeyStatusTimestamp struct { @@ -851,7 +864,10 @@ func (i *InputPrivacyKeyAddedByPhone) DecodeBare(b *bin.Buffer) error { } // InputPrivacyKeyVoiceMessages represents TL type `inputPrivacyKeyVoiceMessages#aee69d68`. -// Whether people can send you voice messages +// Whether people can send you voice messages or round videos (Premium¹ users only). +// +// Links: +// 1. https://core.telegram.org/api/premium // // See https://core.telegram.org/constructor/inputPrivacyKeyVoiceMessages for reference. type InputPrivacyKeyVoiceMessages struct { @@ -1055,6 +1071,7 @@ func (i *InputPrivacyKeyAbout) DecodeBare(b *bin.Buffer) error { } // InputPrivacyKeyBirthday represents TL type `inputPrivacyKeyBirthday#d65a11cc`. +// Whether the user can see our birthday. // // See https://core.telegram.org/constructor/inputPrivacyKeyBirthday for reference. type InputPrivacyKeyBirthday struct { diff --git a/vendor/github.com/gotd/td/tg/tl_input_privacy_rule_gen.go b/vendor/github.com/gotd/td/tg/tl_input_privacy_rule_gen.go index 05b78baa..a63d7fb2 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_privacy_rule_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_privacy_rule_gen.go @@ -1157,6 +1157,12 @@ func (i *InputPrivacyValueAllowCloseFriends) DecodeBare(b *bin.Buffer) error { } // InputPrivacyValueAllowPremium represents TL type `inputPrivacyValueAllowPremium#77cdc9f1`. +// Allow only users with a Premium subscription »¹, currently only usable for +// inputPrivacyKeyChatInvite². +// +// Links: +// 1. https://core.telegram.org/api/premium +// 2. https://core.telegram.org/constructor/inputPrivacyKeyChatInvite // // See https://core.telegram.org/constructor/inputPrivacyValueAllowPremium for reference. type InputPrivacyValueAllowPremium struct { diff --git a/vendor/github.com/gotd/td/tg/tl_input_quick_reply_shortcut_gen.go b/vendor/github.com/gotd/td/tg/tl_input_quick_reply_shortcut_gen.go index 9b5ca13d..cc0eccd0 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_quick_reply_shortcut_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_quick_reply_shortcut_gen.go @@ -32,10 +32,14 @@ var ( ) // InputQuickReplyShortcut represents TL type `inputQuickReplyShortcut#24596d41`. +// Selects a quick reply shortcut¹ by name. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts // // See https://core.telegram.org/constructor/inputQuickReplyShortcut for reference. type InputQuickReplyShortcut struct { - // Shortcut field of InputQuickReplyShortcut. + // Shortcut name. Shortcut string } @@ -166,10 +170,14 @@ func (i *InputQuickReplyShortcut) GetShortcut() (value string) { } // InputQuickReplyShortcutID represents TL type `inputQuickReplyShortcutId#1190cf1`. +// Selects a quick reply shortcut¹ by its numeric ID. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts // // See https://core.telegram.org/constructor/inputQuickReplyShortcutId for reference. type InputQuickReplyShortcutID struct { - // ShortcutID field of InputQuickReplyShortcutID. + // Shortcut ID. ShortcutID int } diff --git a/vendor/github.com/gotd/td/tg/tl_input_reply_to_gen.go b/vendor/github.com/gotd/td/tg/tl_input_reply_to_gen.go index 7b93ba4e..31c15a42 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_reply_to_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_reply_to_gen.go @@ -478,7 +478,7 @@ func (i *InputReplyToMessage) MapQuoteEntities() (value MessageEntityClassArray, // // See https://core.telegram.org/constructor/inputReplyToStory for reference. type InputReplyToStory struct { - // Peer field of InputReplyToStory. + // Sender of the story Peer InputPeerClass // ID of the story to reply to. StoryID int diff --git a/vendor/github.com/gotd/td/tg/tl_input_stars_transaction_gen.go b/vendor/github.com/gotd/td/tg/tl_input_stars_transaction_gen.go new file mode 100644 index 00000000..bfc2c941 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_input_stars_transaction_gen.go @@ -0,0 +1,221 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// InputStarsTransaction represents TL type `inputStarsTransaction#206ae6d1`. +// Used to fetch info about a Telegram Star transaction »¹. +// +// Links: +// 1. https://core.telegram.org/api/stars#balance-and-transaction-history +// +// See https://core.telegram.org/constructor/inputStarsTransaction for reference. +type InputStarsTransaction struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // If set, fetches info about the refund transaction for this transaction. + Refund bool + // Transaction ID. + ID string +} + +// InputStarsTransactionTypeID is TL type id of InputStarsTransaction. +const InputStarsTransactionTypeID = 0x206ae6d1 + +// Ensuring interfaces in compile-time for InputStarsTransaction. +var ( + _ bin.Encoder = &InputStarsTransaction{} + _ bin.Decoder = &InputStarsTransaction{} + _ bin.BareEncoder = &InputStarsTransaction{} + _ bin.BareDecoder = &InputStarsTransaction{} +) + +func (i *InputStarsTransaction) Zero() bool { + if i == nil { + return true + } + if !(i.Flags.Zero()) { + return false + } + if !(i.Refund == false) { + return false + } + if !(i.ID == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputStarsTransaction) String() string { + if i == nil { + return "InputStarsTransaction(nil)" + } + type Alias InputStarsTransaction + return fmt.Sprintf("InputStarsTransaction%+v", Alias(*i)) +} + +// FillFrom fills InputStarsTransaction from given interface. +func (i *InputStarsTransaction) FillFrom(from interface { + GetRefund() (value bool) + GetID() (value string) +}) { + i.Refund = from.GetRefund() + i.ID = from.GetID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputStarsTransaction) TypeID() uint32 { + return InputStarsTransactionTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputStarsTransaction) TypeName() string { + return "inputStarsTransaction" +} + +// TypeInfo returns info about TL type. +func (i *InputStarsTransaction) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputStarsTransaction", + ID: InputStarsTransactionTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Refund", + SchemaName: "refund", + Null: !i.Flags.Has(0), + }, + { + Name: "ID", + SchemaName: "id", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (i *InputStarsTransaction) SetFlags() { + if !(i.Refund == false) { + i.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (i *InputStarsTransaction) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputStarsTransaction#206ae6d1 as nil") + } + b.PutID(InputStarsTransactionTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputStarsTransaction) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputStarsTransaction#206ae6d1 as nil") + } + i.SetFlags() + if err := i.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputStarsTransaction#206ae6d1: field flags: %w", err) + } + b.PutString(i.ID) + return nil +} + +// Decode implements bin.Decoder. +func (i *InputStarsTransaction) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputStarsTransaction#206ae6d1 to nil") + } + if err := b.ConsumeID(InputStarsTransactionTypeID); err != nil { + return fmt.Errorf("unable to decode inputStarsTransaction#206ae6d1: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputStarsTransaction) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputStarsTransaction#206ae6d1 to nil") + } + { + if err := i.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputStarsTransaction#206ae6d1: field flags: %w", err) + } + } + i.Refund = i.Flags.Has(0) + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputStarsTransaction#206ae6d1: field id: %w", err) + } + i.ID = value + } + return nil +} + +// SetRefund sets value of Refund conditional field. +func (i *InputStarsTransaction) SetRefund(value bool) { + if value { + i.Flags.Set(0) + i.Refund = true + } else { + i.Flags.Unset(0) + i.Refund = false + } +} + +// GetRefund returns value of Refund conditional field. +func (i *InputStarsTransaction) GetRefund() (value bool) { + if i == nil { + return + } + return i.Flags.Has(0) +} + +// GetID returns value of ID field. +func (i *InputStarsTransaction) GetID() (value string) { + if i == nil { + return + } + return i.ID +} diff --git a/vendor/github.com/gotd/td/tg/tl_input_stars_transaction_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_input_stars_transaction_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_input_stars_transaction_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_input_store_payment_purpose_gen.go b/vendor/github.com/gotd/td/tg/tl_input_store_payment_purpose_gen.go index f698ea37..32377904 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_store_payment_purpose_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_store_payment_purpose_gen.go @@ -436,7 +436,8 @@ func (i *InputStorePaymentGiftPremium) GetAmount() (value int64) { // InputStorePaymentPremiumGiftCode represents TL type `inputStorePaymentPremiumGiftCode#a3805f3f`. // Used to gift Telegram Premium¹ subscriptions only to some specific subscribers of a -// channel or to some of our contacts, see here »² for more info on giveaways and gifts. +// channel/supergroup or to some of our contacts, see here »² for more info on +// giveaways and gifts. // // Links: // 1. https://core.telegram.org/api/premium @@ -454,10 +455,10 @@ type InputStorePaymentPremiumGiftCode struct { // Links: // 1) https://core.telegram.org/api/premium Users []InputUserClass - // If set, the gifts will be sent on behalf of a channel we are an admin of, which will - // also assign some boosts¹ to it. Otherwise, the gift will be sent directly from the - // currently logged in users, and we will gain some extra boost slots². See here »³ - // for more info on giveaways and gifts. + // If set, the gifts will be sent on behalf of a channel/supergroup we are an admin of, + // which will also assign some boosts¹ to it. Otherwise, the gift will be sent directly + // from the currently logged in user, and we will gain some extra boost slots². See here + // »³ for more info on giveaways and gifts. // // Links: // 1) https://core.telegram.org/api/boost @@ -768,8 +769,8 @@ type InputStorePaymentPremiumGiveaway struct { // Links: // 1) https://core.telegram.org/constructor/messageMediaGiveawayResults WinnersAreVisible bool - // The channel starting the giveaway, that the user must join to participate, that will - // receive the giveaway boosts¹; see here »² for more info on giveaways. + // The channel/supergroup starting the giveaway, that the user must join to participate, + // that will receive the giveaway boosts¹; see here »² for more info on giveaways. // // Links: // 1) https://core.telegram.org/api/boost @@ -1301,43 +1302,51 @@ func (i *InputStorePaymentPremiumGiveaway) MapAdditionalPeers() (value InputPeer return InputPeerClassArray(i.AdditionalPeers), true } -// InputStorePaymentStars represents TL type `inputStorePaymentStars#4f0ee8df`. +// InputStorePaymentStarsTopup represents TL type `inputStorePaymentStarsTopup#dddd0f56`. +// Used to top up the Telegram Stars balance¹ of the current account. // -// See https://core.telegram.org/constructor/inputStorePaymentStars for reference. -type InputStorePaymentStars struct { - // Flags field of InputStorePaymentStars. - Flags bin.Fields - // Stars field of InputStorePaymentStars. +// Links: +// 1. https://core.telegram.org/api/stars +// +// See https://core.telegram.org/constructor/inputStorePaymentStarsTopup for reference. +type InputStorePaymentStarsTopup struct { + // Amount of stars to topup Stars int64 - // Currency field of InputStorePaymentStars. + // Three-letter ISO 4217 currency¹ code + // + // Links: + // 1) https://core.telegram.org/bots/payments#supported-currencies Currency string - // Amount field of InputStorePaymentStars. + // Total price in the smallest units of the currency (integer, not float/double). For + // example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in + // currencies.json¹, it shows the number of digits past the decimal point for each + // currency (2 for the majority of currencies). + // + // Links: + // 1) https://core.telegram.org/bots/payments/currencies.json Amount int64 } -// InputStorePaymentStarsTypeID is TL type id of InputStorePaymentStars. -const InputStorePaymentStarsTypeID = 0x4f0ee8df +// InputStorePaymentStarsTopupTypeID is TL type id of InputStorePaymentStarsTopup. +const InputStorePaymentStarsTopupTypeID = 0xdddd0f56 // construct implements constructor of InputStorePaymentPurposeClass. -func (i InputStorePaymentStars) construct() InputStorePaymentPurposeClass { return &i } +func (i InputStorePaymentStarsTopup) construct() InputStorePaymentPurposeClass { return &i } -// Ensuring interfaces in compile-time for InputStorePaymentStars. +// Ensuring interfaces in compile-time for InputStorePaymentStarsTopup. var ( - _ bin.Encoder = &InputStorePaymentStars{} - _ bin.Decoder = &InputStorePaymentStars{} - _ bin.BareEncoder = &InputStorePaymentStars{} - _ bin.BareDecoder = &InputStorePaymentStars{} + _ bin.Encoder = &InputStorePaymentStarsTopup{} + _ bin.Decoder = &InputStorePaymentStarsTopup{} + _ bin.BareEncoder = &InputStorePaymentStarsTopup{} + _ bin.BareDecoder = &InputStorePaymentStarsTopup{} - _ InputStorePaymentPurposeClass = &InputStorePaymentStars{} + _ InputStorePaymentPurposeClass = &InputStorePaymentStarsTopup{} ) -func (i *InputStorePaymentStars) Zero() bool { +func (i *InputStorePaymentStarsTopup) Zero() bool { if i == nil { return true } - if !(i.Flags.Zero()) { - return false - } if !(i.Stars == 0) { return false } @@ -1352,16 +1361,16 @@ func (i *InputStorePaymentStars) Zero() bool { } // String implements fmt.Stringer. -func (i *InputStorePaymentStars) String() string { +func (i *InputStorePaymentStarsTopup) String() string { if i == nil { - return "InputStorePaymentStars(nil)" + return "InputStorePaymentStarsTopup(nil)" } - type Alias InputStorePaymentStars - return fmt.Sprintf("InputStorePaymentStars%+v", Alias(*i)) + type Alias InputStorePaymentStarsTopup + return fmt.Sprintf("InputStorePaymentStarsTopup%+v", Alias(*i)) } -// FillFrom fills InputStorePaymentStars from given interface. -func (i *InputStorePaymentStars) FillFrom(from interface { +// FillFrom fills InputStorePaymentStarsTopup from given interface. +func (i *InputStorePaymentStarsTopup) FillFrom(from interface { GetStars() (value int64) GetCurrency() (value string) GetAmount() (value int64) @@ -1374,20 +1383,20 @@ func (i *InputStorePaymentStars) FillFrom(from interface { // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputStorePaymentStars) TypeID() uint32 { - return InputStorePaymentStarsTypeID +func (*InputStorePaymentStarsTopup) TypeID() uint32 { + return InputStorePaymentStarsTopupTypeID } // TypeName returns name of type in TL schema. -func (*InputStorePaymentStars) TypeName() string { - return "inputStorePaymentStars" +func (*InputStorePaymentStarsTopup) TypeName() string { + return "inputStorePaymentStarsTopup" } // TypeInfo returns info about TL type. -func (i *InputStorePaymentStars) TypeInfo() tdp.Type { +func (i *InputStorePaymentStarsTopup) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "inputStorePaymentStars", - ID: InputStorePaymentStarsTypeID, + Name: "inputStorePaymentStarsTopup", + ID: InputStorePaymentStarsTopupTypeID, } if i == nil { typ.Null = true @@ -1410,27 +1419,19 @@ func (i *InputStorePaymentStars) TypeInfo() tdp.Type { return typ } -// SetFlags sets flags for non-zero fields. -func (i *InputStorePaymentStars) SetFlags() { -} - // Encode implements bin.Encoder. -func (i *InputStorePaymentStars) Encode(b *bin.Buffer) error { +func (i *InputStorePaymentStarsTopup) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputStorePaymentStars#4f0ee8df as nil") + return fmt.Errorf("can't encode inputStorePaymentStarsTopup#dddd0f56 as nil") } - b.PutID(InputStorePaymentStarsTypeID) + b.PutID(InputStorePaymentStarsTopupTypeID) return i.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (i *InputStorePaymentStars) EncodeBare(b *bin.Buffer) error { +func (i *InputStorePaymentStarsTopup) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputStorePaymentStars#4f0ee8df as nil") - } - i.SetFlags() - if err := i.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStorePaymentStars#4f0ee8df: field flags: %w", err) + return fmt.Errorf("can't encode inputStorePaymentStarsTopup#dddd0f56 as nil") } b.PutLong(i.Stars) b.PutString(i.Currency) @@ -1439,44 +1440,39 @@ func (i *InputStorePaymentStars) EncodeBare(b *bin.Buffer) error { } // Decode implements bin.Decoder. -func (i *InputStorePaymentStars) Decode(b *bin.Buffer) error { +func (i *InputStorePaymentStarsTopup) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputStorePaymentStars#4f0ee8df to nil") + return fmt.Errorf("can't decode inputStorePaymentStarsTopup#dddd0f56 to nil") } - if err := b.ConsumeID(InputStorePaymentStarsTypeID); err != nil { - return fmt.Errorf("unable to decode inputStorePaymentStars#4f0ee8df: %w", err) + if err := b.ConsumeID(InputStorePaymentStarsTopupTypeID); err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsTopup#dddd0f56: %w", err) } return i.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (i *InputStorePaymentStars) DecodeBare(b *bin.Buffer) error { +func (i *InputStorePaymentStarsTopup) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputStorePaymentStars#4f0ee8df to nil") - } - { - if err := i.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputStorePaymentStars#4f0ee8df: field flags: %w", err) - } + return fmt.Errorf("can't decode inputStorePaymentStarsTopup#dddd0f56 to nil") } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentStars#4f0ee8df: field stars: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentStarsTopup#dddd0f56: field stars: %w", err) } i.Stars = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentStars#4f0ee8df: field currency: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentStarsTopup#dddd0f56: field currency: %w", err) } i.Currency = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentStars#4f0ee8df: field amount: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentStarsTopup#dddd0f56: field amount: %w", err) } i.Amount = value } @@ -1484,7 +1480,7 @@ func (i *InputStorePaymentStars) DecodeBare(b *bin.Buffer) error { } // GetStars returns value of Stars field. -func (i *InputStorePaymentStars) GetStars() (value int64) { +func (i *InputStorePaymentStarsTopup) GetStars() (value int64) { if i == nil { return } @@ -1492,7 +1488,7 @@ func (i *InputStorePaymentStars) GetStars() (value int64) { } // GetCurrency returns value of Currency field. -func (i *InputStorePaymentStars) GetCurrency() (value string) { +func (i *InputStorePaymentStarsTopup) GetCurrency() (value string) { if i == nil { return } @@ -1500,13 +1496,818 @@ func (i *InputStorePaymentStars) GetCurrency() (value string) { } // GetAmount returns value of Amount field. -func (i *InputStorePaymentStars) GetAmount() (value int64) { +func (i *InputStorePaymentStarsTopup) GetAmount() (value int64) { if i == nil { return } return i.Amount } +// InputStorePaymentStarsGift represents TL type `inputStorePaymentStarsGift#1d741ef7`. +// Used to gift Telegram Stars¹ to a friend. +// +// Links: +// 1. https://core.telegram.org/api/stars +// +// See https://core.telegram.org/constructor/inputStorePaymentStarsGift for reference. +type InputStorePaymentStarsGift struct { + // The user to which the stars should be gifted. + UserID InputUserClass + // Amount of stars to gift + Stars int64 + // Three-letter ISO 4217 currency¹ code + // + // Links: + // 1) https://core.telegram.org/bots/payments#supported-currencies + Currency string + // Total price in the smallest units of the currency (integer, not float/double). For + // example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in + // currencies.json¹, it shows the number of digits past the decimal point for each + // currency (2 for the majority of currencies). + // + // Links: + // 1) https://core.telegram.org/bots/payments/currencies.json + Amount int64 +} + +// InputStorePaymentStarsGiftTypeID is TL type id of InputStorePaymentStarsGift. +const InputStorePaymentStarsGiftTypeID = 0x1d741ef7 + +// construct implements constructor of InputStorePaymentPurposeClass. +func (i InputStorePaymentStarsGift) construct() InputStorePaymentPurposeClass { return &i } + +// Ensuring interfaces in compile-time for InputStorePaymentStarsGift. +var ( + _ bin.Encoder = &InputStorePaymentStarsGift{} + _ bin.Decoder = &InputStorePaymentStarsGift{} + _ bin.BareEncoder = &InputStorePaymentStarsGift{} + _ bin.BareDecoder = &InputStorePaymentStarsGift{} + + _ InputStorePaymentPurposeClass = &InputStorePaymentStarsGift{} +) + +func (i *InputStorePaymentStarsGift) Zero() bool { + if i == nil { + return true + } + if !(i.UserID == nil) { + return false + } + if !(i.Stars == 0) { + return false + } + if !(i.Currency == "") { + return false + } + if !(i.Amount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputStorePaymentStarsGift) String() string { + if i == nil { + return "InputStorePaymentStarsGift(nil)" + } + type Alias InputStorePaymentStarsGift + return fmt.Sprintf("InputStorePaymentStarsGift%+v", Alias(*i)) +} + +// FillFrom fills InputStorePaymentStarsGift from given interface. +func (i *InputStorePaymentStarsGift) FillFrom(from interface { + GetUserID() (value InputUserClass) + GetStars() (value int64) + GetCurrency() (value string) + GetAmount() (value int64) +}) { + i.UserID = from.GetUserID() + i.Stars = from.GetStars() + i.Currency = from.GetCurrency() + i.Amount = from.GetAmount() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputStorePaymentStarsGift) TypeID() uint32 { + return InputStorePaymentStarsGiftTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputStorePaymentStarsGift) TypeName() string { + return "inputStorePaymentStarsGift" +} + +// TypeInfo returns info about TL type. +func (i *InputStorePaymentStarsGift) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputStorePaymentStarsGift", + ID: InputStorePaymentStarsGiftTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "Stars", + SchemaName: "stars", + }, + { + Name: "Currency", + SchemaName: "currency", + }, + { + Name: "Amount", + SchemaName: "amount", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InputStorePaymentStarsGift) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputStorePaymentStarsGift#1d741ef7 as nil") + } + b.PutID(InputStorePaymentStarsGiftTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputStorePaymentStarsGift) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputStorePaymentStarsGift#1d741ef7 as nil") + } + if i.UserID == nil { + return fmt.Errorf("unable to encode inputStorePaymentStarsGift#1d741ef7: field user_id is nil") + } + if err := i.UserID.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputStorePaymentStarsGift#1d741ef7: field user_id: %w", err) + } + b.PutLong(i.Stars) + b.PutString(i.Currency) + b.PutLong(i.Amount) + return nil +} + +// Decode implements bin.Decoder. +func (i *InputStorePaymentStarsGift) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputStorePaymentStarsGift#1d741ef7 to nil") + } + if err := b.ConsumeID(InputStorePaymentStarsGiftTypeID); err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGift#1d741ef7: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputStorePaymentStarsGift) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputStorePaymentStarsGift#1d741ef7 to nil") + } + { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGift#1d741ef7: field user_id: %w", err) + } + i.UserID = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGift#1d741ef7: field stars: %w", err) + } + i.Stars = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGift#1d741ef7: field currency: %w", err) + } + i.Currency = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGift#1d741ef7: field amount: %w", err) + } + i.Amount = value + } + return nil +} + +// GetUserID returns value of UserID field. +func (i *InputStorePaymentStarsGift) GetUserID() (value InputUserClass) { + if i == nil { + return + } + return i.UserID +} + +// GetStars returns value of Stars field. +func (i *InputStorePaymentStarsGift) GetStars() (value int64) { + if i == nil { + return + } + return i.Stars +} + +// GetCurrency returns value of Currency field. +func (i *InputStorePaymentStarsGift) GetCurrency() (value string) { + if i == nil { + return + } + return i.Currency +} + +// GetAmount returns value of Amount field. +func (i *InputStorePaymentStarsGift) GetAmount() (value int64) { + if i == nil { + return + } + return i.Amount +} + +// InputStorePaymentStarsGiveaway represents TL type `inputStorePaymentStarsGiveaway#751f08fa`. +// +// See https://core.telegram.org/constructor/inputStorePaymentStarsGiveaway for reference. +type InputStorePaymentStarsGiveaway struct { + // Flags field of InputStorePaymentStarsGiveaway. + Flags bin.Fields + // OnlyNewSubscribers field of InputStorePaymentStarsGiveaway. + OnlyNewSubscribers bool + // WinnersAreVisible field of InputStorePaymentStarsGiveaway. + WinnersAreVisible bool + // Stars field of InputStorePaymentStarsGiveaway. + Stars int64 + // BoostPeer field of InputStorePaymentStarsGiveaway. + BoostPeer InputPeerClass + // AdditionalPeers field of InputStorePaymentStarsGiveaway. + // + // Use SetAdditionalPeers and GetAdditionalPeers helpers. + AdditionalPeers []InputPeerClass + // CountriesISO2 field of InputStorePaymentStarsGiveaway. + // + // Use SetCountriesISO2 and GetCountriesISO2 helpers. + CountriesISO2 []string + // PrizeDescription field of InputStorePaymentStarsGiveaway. + // + // Use SetPrizeDescription and GetPrizeDescription helpers. + PrizeDescription string + // RandomID field of InputStorePaymentStarsGiveaway. + RandomID int64 + // UntilDate field of InputStorePaymentStarsGiveaway. + UntilDate int + // Currency field of InputStorePaymentStarsGiveaway. + Currency string + // Amount field of InputStorePaymentStarsGiveaway. + Amount int64 + // Users field of InputStorePaymentStarsGiveaway. + Users int +} + +// InputStorePaymentStarsGiveawayTypeID is TL type id of InputStorePaymentStarsGiveaway. +const InputStorePaymentStarsGiveawayTypeID = 0x751f08fa + +// construct implements constructor of InputStorePaymentPurposeClass. +func (i InputStorePaymentStarsGiveaway) construct() InputStorePaymentPurposeClass { return &i } + +// Ensuring interfaces in compile-time for InputStorePaymentStarsGiveaway. +var ( + _ bin.Encoder = &InputStorePaymentStarsGiveaway{} + _ bin.Decoder = &InputStorePaymentStarsGiveaway{} + _ bin.BareEncoder = &InputStorePaymentStarsGiveaway{} + _ bin.BareDecoder = &InputStorePaymentStarsGiveaway{} + + _ InputStorePaymentPurposeClass = &InputStorePaymentStarsGiveaway{} +) + +func (i *InputStorePaymentStarsGiveaway) Zero() bool { + if i == nil { + return true + } + if !(i.Flags.Zero()) { + return false + } + if !(i.OnlyNewSubscribers == false) { + return false + } + if !(i.WinnersAreVisible == false) { + return false + } + if !(i.Stars == 0) { + return false + } + if !(i.BoostPeer == nil) { + return false + } + if !(i.AdditionalPeers == nil) { + return false + } + if !(i.CountriesISO2 == nil) { + return false + } + if !(i.PrizeDescription == "") { + return false + } + if !(i.RandomID == 0) { + return false + } + if !(i.UntilDate == 0) { + return false + } + if !(i.Currency == "") { + return false + } + if !(i.Amount == 0) { + return false + } + if !(i.Users == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputStorePaymentStarsGiveaway) String() string { + if i == nil { + return "InputStorePaymentStarsGiveaway(nil)" + } + type Alias InputStorePaymentStarsGiveaway + return fmt.Sprintf("InputStorePaymentStarsGiveaway%+v", Alias(*i)) +} + +// FillFrom fills InputStorePaymentStarsGiveaway from given interface. +func (i *InputStorePaymentStarsGiveaway) FillFrom(from interface { + GetOnlyNewSubscribers() (value bool) + GetWinnersAreVisible() (value bool) + GetStars() (value int64) + GetBoostPeer() (value InputPeerClass) + GetAdditionalPeers() (value []InputPeerClass, ok bool) + GetCountriesISO2() (value []string, ok bool) + GetPrizeDescription() (value string, ok bool) + GetRandomID() (value int64) + GetUntilDate() (value int) + GetCurrency() (value string) + GetAmount() (value int64) + GetUsers() (value int) +}) { + i.OnlyNewSubscribers = from.GetOnlyNewSubscribers() + i.WinnersAreVisible = from.GetWinnersAreVisible() + i.Stars = from.GetStars() + i.BoostPeer = from.GetBoostPeer() + if val, ok := from.GetAdditionalPeers(); ok { + i.AdditionalPeers = val + } + + if val, ok := from.GetCountriesISO2(); ok { + i.CountriesISO2 = val + } + + if val, ok := from.GetPrizeDescription(); ok { + i.PrizeDescription = val + } + + i.RandomID = from.GetRandomID() + i.UntilDate = from.GetUntilDate() + i.Currency = from.GetCurrency() + i.Amount = from.GetAmount() + i.Users = from.GetUsers() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputStorePaymentStarsGiveaway) TypeID() uint32 { + return InputStorePaymentStarsGiveawayTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputStorePaymentStarsGiveaway) TypeName() string { + return "inputStorePaymentStarsGiveaway" +} + +// TypeInfo returns info about TL type. +func (i *InputStorePaymentStarsGiveaway) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputStorePaymentStarsGiveaway", + ID: InputStorePaymentStarsGiveawayTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "OnlyNewSubscribers", + SchemaName: "only_new_subscribers", + Null: !i.Flags.Has(0), + }, + { + Name: "WinnersAreVisible", + SchemaName: "winners_are_visible", + Null: !i.Flags.Has(3), + }, + { + Name: "Stars", + SchemaName: "stars", + }, + { + Name: "BoostPeer", + SchemaName: "boost_peer", + }, + { + Name: "AdditionalPeers", + SchemaName: "additional_peers", + Null: !i.Flags.Has(1), + }, + { + Name: "CountriesISO2", + SchemaName: "countries_iso2", + Null: !i.Flags.Has(2), + }, + { + Name: "PrizeDescription", + SchemaName: "prize_description", + Null: !i.Flags.Has(4), + }, + { + Name: "RandomID", + SchemaName: "random_id", + }, + { + Name: "UntilDate", + SchemaName: "until_date", + }, + { + Name: "Currency", + SchemaName: "currency", + }, + { + Name: "Amount", + SchemaName: "amount", + }, + { + Name: "Users", + SchemaName: "users", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (i *InputStorePaymentStarsGiveaway) SetFlags() { + if !(i.OnlyNewSubscribers == false) { + i.Flags.Set(0) + } + if !(i.WinnersAreVisible == false) { + i.Flags.Set(3) + } + if !(i.AdditionalPeers == nil) { + i.Flags.Set(1) + } + if !(i.CountriesISO2 == nil) { + i.Flags.Set(2) + } + if !(i.PrizeDescription == "") { + i.Flags.Set(4) + } +} + +// Encode implements bin.Encoder. +func (i *InputStorePaymentStarsGiveaway) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputStorePaymentStarsGiveaway#751f08fa as nil") + } + b.PutID(InputStorePaymentStarsGiveawayTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputStorePaymentStarsGiveaway) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputStorePaymentStarsGiveaway#751f08fa as nil") + } + i.SetFlags() + if err := i.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputStorePaymentStarsGiveaway#751f08fa: field flags: %w", err) + } + b.PutLong(i.Stars) + if i.BoostPeer == nil { + return fmt.Errorf("unable to encode inputStorePaymentStarsGiveaway#751f08fa: field boost_peer is nil") + } + if err := i.BoostPeer.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputStorePaymentStarsGiveaway#751f08fa: field boost_peer: %w", err) + } + if i.Flags.Has(1) { + b.PutVectorHeader(len(i.AdditionalPeers)) + for idx, v := range i.AdditionalPeers { + if v == nil { + return fmt.Errorf("unable to encode inputStorePaymentStarsGiveaway#751f08fa: field additional_peers element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputStorePaymentStarsGiveaway#751f08fa: field additional_peers element with index %d: %w", idx, err) + } + } + } + if i.Flags.Has(2) { + b.PutVectorHeader(len(i.CountriesISO2)) + for _, v := range i.CountriesISO2 { + b.PutString(v) + } + } + if i.Flags.Has(4) { + b.PutString(i.PrizeDescription) + } + b.PutLong(i.RandomID) + b.PutInt(i.UntilDate) + b.PutString(i.Currency) + b.PutLong(i.Amount) + b.PutInt(i.Users) + return nil +} + +// Decode implements bin.Decoder. +func (i *InputStorePaymentStarsGiveaway) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputStorePaymentStarsGiveaway#751f08fa to nil") + } + if err := b.ConsumeID(InputStorePaymentStarsGiveawayTypeID); err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGiveaway#751f08fa: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputStorePaymentStarsGiveaway) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputStorePaymentStarsGiveaway#751f08fa to nil") + } + { + if err := i.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGiveaway#751f08fa: field flags: %w", err) + } + } + i.OnlyNewSubscribers = i.Flags.Has(0) + i.WinnersAreVisible = i.Flags.Has(3) + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGiveaway#751f08fa: field stars: %w", err) + } + i.Stars = value + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGiveaway#751f08fa: field boost_peer: %w", err) + } + i.BoostPeer = value + } + if i.Flags.Has(1) { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGiveaway#751f08fa: field additional_peers: %w", err) + } + + if headerLen > 0 { + i.AdditionalPeers = make([]InputPeerClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGiveaway#751f08fa: field additional_peers: %w", err) + } + i.AdditionalPeers = append(i.AdditionalPeers, value) + } + } + if i.Flags.Has(2) { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGiveaway#751f08fa: field countries_iso2: %w", err) + } + + if headerLen > 0 { + i.CountriesISO2 = make([]string, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGiveaway#751f08fa: field countries_iso2: %w", err) + } + i.CountriesISO2 = append(i.CountriesISO2, value) + } + } + if i.Flags.Has(4) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGiveaway#751f08fa: field prize_description: %w", err) + } + i.PrizeDescription = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGiveaway#751f08fa: field random_id: %w", err) + } + i.RandomID = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGiveaway#751f08fa: field until_date: %w", err) + } + i.UntilDate = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGiveaway#751f08fa: field currency: %w", err) + } + i.Currency = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGiveaway#751f08fa: field amount: %w", err) + } + i.Amount = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode inputStorePaymentStarsGiveaway#751f08fa: field users: %w", err) + } + i.Users = value + } + return nil +} + +// SetOnlyNewSubscribers sets value of OnlyNewSubscribers conditional field. +func (i *InputStorePaymentStarsGiveaway) SetOnlyNewSubscribers(value bool) { + if value { + i.Flags.Set(0) + i.OnlyNewSubscribers = true + } else { + i.Flags.Unset(0) + i.OnlyNewSubscribers = false + } +} + +// GetOnlyNewSubscribers returns value of OnlyNewSubscribers conditional field. +func (i *InputStorePaymentStarsGiveaway) GetOnlyNewSubscribers() (value bool) { + if i == nil { + return + } + return i.Flags.Has(0) +} + +// SetWinnersAreVisible sets value of WinnersAreVisible conditional field. +func (i *InputStorePaymentStarsGiveaway) SetWinnersAreVisible(value bool) { + if value { + i.Flags.Set(3) + i.WinnersAreVisible = true + } else { + i.Flags.Unset(3) + i.WinnersAreVisible = false + } +} + +// GetWinnersAreVisible returns value of WinnersAreVisible conditional field. +func (i *InputStorePaymentStarsGiveaway) GetWinnersAreVisible() (value bool) { + if i == nil { + return + } + return i.Flags.Has(3) +} + +// GetStars returns value of Stars field. +func (i *InputStorePaymentStarsGiveaway) GetStars() (value int64) { + if i == nil { + return + } + return i.Stars +} + +// GetBoostPeer returns value of BoostPeer field. +func (i *InputStorePaymentStarsGiveaway) GetBoostPeer() (value InputPeerClass) { + if i == nil { + return + } + return i.BoostPeer +} + +// SetAdditionalPeers sets value of AdditionalPeers conditional field. +func (i *InputStorePaymentStarsGiveaway) SetAdditionalPeers(value []InputPeerClass) { + i.Flags.Set(1) + i.AdditionalPeers = value +} + +// GetAdditionalPeers returns value of AdditionalPeers conditional field and +// boolean which is true if field was set. +func (i *InputStorePaymentStarsGiveaway) GetAdditionalPeers() (value []InputPeerClass, ok bool) { + if i == nil { + return + } + if !i.Flags.Has(1) { + return value, false + } + return i.AdditionalPeers, true +} + +// SetCountriesISO2 sets value of CountriesISO2 conditional field. +func (i *InputStorePaymentStarsGiveaway) SetCountriesISO2(value []string) { + i.Flags.Set(2) + i.CountriesISO2 = value +} + +// GetCountriesISO2 returns value of CountriesISO2 conditional field and +// boolean which is true if field was set. +func (i *InputStorePaymentStarsGiveaway) GetCountriesISO2() (value []string, ok bool) { + if i == nil { + return + } + if !i.Flags.Has(2) { + return value, false + } + return i.CountriesISO2, true +} + +// SetPrizeDescription sets value of PrizeDescription conditional field. +func (i *InputStorePaymentStarsGiveaway) SetPrizeDescription(value string) { + i.Flags.Set(4) + i.PrizeDescription = value +} + +// GetPrizeDescription returns value of PrizeDescription conditional field and +// boolean which is true if field was set. +func (i *InputStorePaymentStarsGiveaway) GetPrizeDescription() (value string, ok bool) { + if i == nil { + return + } + if !i.Flags.Has(4) { + return value, false + } + return i.PrizeDescription, true +} + +// GetRandomID returns value of RandomID field. +func (i *InputStorePaymentStarsGiveaway) GetRandomID() (value int64) { + if i == nil { + return + } + return i.RandomID +} + +// GetUntilDate returns value of UntilDate field. +func (i *InputStorePaymentStarsGiveaway) GetUntilDate() (value int) { + if i == nil { + return + } + return i.UntilDate +} + +// GetCurrency returns value of Currency field. +func (i *InputStorePaymentStarsGiveaway) GetCurrency() (value string) { + if i == nil { + return + } + return i.Currency +} + +// GetAmount returns value of Amount field. +func (i *InputStorePaymentStarsGiveaway) GetAmount() (value int64) { + if i == nil { + return + } + return i.Amount +} + +// GetUsers returns value of Users field. +func (i *InputStorePaymentStarsGiveaway) GetUsers() (value int) { + if i == nil { + return + } + return i.Users +} + +// MapAdditionalPeers returns field AdditionalPeers wrapped in InputPeerClassArray helper. +func (i *InputStorePaymentStarsGiveaway) MapAdditionalPeers() (value InputPeerClassArray, ok bool) { + if !i.Flags.Has(1) { + return value, false + } + return InputPeerClassArray(i.AdditionalPeers), true +} + // InputStorePaymentPurposeClassName is schema name of InputStorePaymentPurposeClass. const InputStorePaymentPurposeClassName = "InputStorePaymentPurpose" @@ -1525,7 +2326,9 @@ const InputStorePaymentPurposeClassName = "InputStorePaymentPurpose" // case *tg.InputStorePaymentGiftPremium: // inputStorePaymentGiftPremium#616f7fe8 // case *tg.InputStorePaymentPremiumGiftCode: // inputStorePaymentPremiumGiftCode#a3805f3f // case *tg.InputStorePaymentPremiumGiveaway: // inputStorePaymentPremiumGiveaway#160544ca -// case *tg.InputStorePaymentStars: // inputStorePaymentStars#4f0ee8df +// case *tg.InputStorePaymentStarsTopup: // inputStorePaymentStarsTopup#dddd0f56 +// case *tg.InputStorePaymentStarsGift: // inputStorePaymentStarsGift#1d741ef7 +// case *tg.InputStorePaymentStarsGiveaway: // inputStorePaymentStarsGiveaway#751f08fa // default: panic(v) // } type InputStorePaymentPurposeClass interface { @@ -1582,9 +2385,23 @@ func DecodeInputStorePaymentPurpose(buf *bin.Buffer) (InputStorePaymentPurposeCl return nil, fmt.Errorf("unable to decode InputStorePaymentPurposeClass: %w", err) } return &v, nil - case InputStorePaymentStarsTypeID: - // Decoding inputStorePaymentStars#4f0ee8df. - v := InputStorePaymentStars{} + case InputStorePaymentStarsTopupTypeID: + // Decoding inputStorePaymentStarsTopup#dddd0f56. + v := InputStorePaymentStarsTopup{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputStorePaymentPurposeClass: %w", err) + } + return &v, nil + case InputStorePaymentStarsGiftTypeID: + // Decoding inputStorePaymentStarsGift#1d741ef7. + v := InputStorePaymentStarsGift{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputStorePaymentPurposeClass: %w", err) + } + return &v, nil + case InputStorePaymentStarsGiveawayTypeID: + // Decoding inputStorePaymentStarsGiveaway#751f08fa. + v := InputStorePaymentStarsGiveaway{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode InputStorePaymentPurposeClass: %w", err) } diff --git a/vendor/github.com/gotd/td/tg/tl_input_store_payment_purpose_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_input_store_payment_purpose_slices_gen.go index ce16f778..9cdfebe7 100644 --- a/vendor/github.com/gotd/td/tg/tl_input_store_payment_purpose_slices_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_input_store_payment_purpose_slices_gen.go @@ -168,10 +168,36 @@ func (s InputStorePaymentPurposeClassArray) AsInputStorePaymentPremiumGiveaway() return to } -// AsInputStorePaymentStars returns copy with only InputStorePaymentStars constructors. -func (s InputStorePaymentPurposeClassArray) AsInputStorePaymentStars() (to InputStorePaymentStarsArray) { +// AsInputStorePaymentStarsTopup returns copy with only InputStorePaymentStarsTopup constructors. +func (s InputStorePaymentPurposeClassArray) AsInputStorePaymentStarsTopup() (to InputStorePaymentStarsTopupArray) { for _, elem := range s { - value, ok := elem.(*InputStorePaymentStars) + value, ok := elem.(*InputStorePaymentStarsTopup) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsInputStorePaymentStarsGift returns copy with only InputStorePaymentStarsGift constructors. +func (s InputStorePaymentPurposeClassArray) AsInputStorePaymentStarsGift() (to InputStorePaymentStarsGiftArray) { + for _, elem := range s { + value, ok := elem.(*InputStorePaymentStarsGift) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsInputStorePaymentStarsGiveaway returns copy with only InputStorePaymentStarsGiveaway constructors. +func (s InputStorePaymentPurposeClassArray) AsInputStorePaymentStarsGiveaway() (to InputStorePaymentStarsGiveawayArray) { + for _, elem := range s { + value, ok := elem.(*InputStorePaymentStarsGiveaway) if !ok { continue } @@ -509,27 +535,27 @@ func (s *InputStorePaymentPremiumGiveawayArray) Pop() (v InputStorePaymentPremiu return v, true } -// InputStorePaymentStarsArray is adapter for slice of InputStorePaymentStars. -type InputStorePaymentStarsArray []InputStorePaymentStars +// InputStorePaymentStarsTopupArray is adapter for slice of InputStorePaymentStarsTopup. +type InputStorePaymentStarsTopupArray []InputStorePaymentStarsTopup -// Sort sorts slice of InputStorePaymentStars. -func (s InputStorePaymentStarsArray) Sort(less func(a, b InputStorePaymentStars) bool) InputStorePaymentStarsArray { +// Sort sorts slice of InputStorePaymentStarsTopup. +func (s InputStorePaymentStarsTopupArray) Sort(less func(a, b InputStorePaymentStarsTopup) bool) InputStorePaymentStarsTopupArray { sort.Slice(s, func(i, j int) bool { return less(s[i], s[j]) }) return s } -// SortStable sorts slice of InputStorePaymentStars. -func (s InputStorePaymentStarsArray) SortStable(less func(a, b InputStorePaymentStars) bool) InputStorePaymentStarsArray { +// SortStable sorts slice of InputStorePaymentStarsTopup. +func (s InputStorePaymentStarsTopupArray) SortStable(less func(a, b InputStorePaymentStarsTopup) bool) InputStorePaymentStarsTopupArray { sort.SliceStable(s, func(i, j int) bool { return less(s[i], s[j]) }) return s } -// Retain filters in-place slice of InputStorePaymentStars. -func (s InputStorePaymentStarsArray) Retain(keep func(x InputStorePaymentStars) bool) InputStorePaymentStarsArray { +// Retain filters in-place slice of InputStorePaymentStarsTopup. +func (s InputStorePaymentStarsTopupArray) Retain(keep func(x InputStorePaymentStarsTopup) bool) InputStorePaymentStarsTopupArray { n := 0 for _, x := range s { if keep(x) { @@ -543,7 +569,7 @@ func (s InputStorePaymentStarsArray) Retain(keep func(x InputStorePaymentStars) } // First returns first element of slice (if exists). -func (s InputStorePaymentStarsArray) First() (v InputStorePaymentStars, ok bool) { +func (s InputStorePaymentStarsTopupArray) First() (v InputStorePaymentStarsTopup, ok bool) { if len(s) < 1 { return } @@ -551,7 +577,7 @@ func (s InputStorePaymentStarsArray) First() (v InputStorePaymentStars, ok bool) } // Last returns last element of slice (if exists). -func (s InputStorePaymentStarsArray) Last() (v InputStorePaymentStars, ok bool) { +func (s InputStorePaymentStarsTopupArray) Last() (v InputStorePaymentStarsTopup, ok bool) { if len(s) < 1 { return } @@ -559,7 +585,7 @@ func (s InputStorePaymentStarsArray) Last() (v InputStorePaymentStars, ok bool) } // PopFirst returns first element of slice (if exists) and deletes it. -func (s *InputStorePaymentStarsArray) PopFirst() (v InputStorePaymentStars, ok bool) { +func (s *InputStorePaymentStarsTopupArray) PopFirst() (v InputStorePaymentStarsTopup, ok bool) { if s == nil || len(*s) < 1 { return } @@ -569,7 +595,7 @@ func (s *InputStorePaymentStarsArray) PopFirst() (v InputStorePaymentStars, ok b // Delete by index from SliceTricks. copy(a[0:], a[1:]) - var zero InputStorePaymentStars + var zero InputStorePaymentStarsTopup a[len(a)-1] = zero a = a[:len(a)-1] *s = a @@ -578,7 +604,171 @@ func (s *InputStorePaymentStarsArray) PopFirst() (v InputStorePaymentStars, ok b } // Pop returns last element of slice (if exists) and deletes it. -func (s *InputStorePaymentStarsArray) Pop() (v InputStorePaymentStars, ok bool) { +func (s *InputStorePaymentStarsTopupArray) Pop() (v InputStorePaymentStarsTopup, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// InputStorePaymentStarsGiftArray is adapter for slice of InputStorePaymentStarsGift. +type InputStorePaymentStarsGiftArray []InputStorePaymentStarsGift + +// Sort sorts slice of InputStorePaymentStarsGift. +func (s InputStorePaymentStarsGiftArray) Sort(less func(a, b InputStorePaymentStarsGift) bool) InputStorePaymentStarsGiftArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of InputStorePaymentStarsGift. +func (s InputStorePaymentStarsGiftArray) SortStable(less func(a, b InputStorePaymentStarsGift) bool) InputStorePaymentStarsGiftArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of InputStorePaymentStarsGift. +func (s InputStorePaymentStarsGiftArray) Retain(keep func(x InputStorePaymentStarsGift) bool) InputStorePaymentStarsGiftArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s InputStorePaymentStarsGiftArray) First() (v InputStorePaymentStarsGift, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s InputStorePaymentStarsGiftArray) Last() (v InputStorePaymentStarsGift, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *InputStorePaymentStarsGiftArray) PopFirst() (v InputStorePaymentStarsGift, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero InputStorePaymentStarsGift + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *InputStorePaymentStarsGiftArray) Pop() (v InputStorePaymentStarsGift, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// InputStorePaymentStarsGiveawayArray is adapter for slice of InputStorePaymentStarsGiveaway. +type InputStorePaymentStarsGiveawayArray []InputStorePaymentStarsGiveaway + +// Sort sorts slice of InputStorePaymentStarsGiveaway. +func (s InputStorePaymentStarsGiveawayArray) Sort(less func(a, b InputStorePaymentStarsGiveaway) bool) InputStorePaymentStarsGiveawayArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of InputStorePaymentStarsGiveaway. +func (s InputStorePaymentStarsGiveawayArray) SortStable(less func(a, b InputStorePaymentStarsGiveaway) bool) InputStorePaymentStarsGiveawayArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of InputStorePaymentStarsGiveaway. +func (s InputStorePaymentStarsGiveawayArray) Retain(keep func(x InputStorePaymentStarsGiveaway) bool) InputStorePaymentStarsGiveawayArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s InputStorePaymentStarsGiveawayArray) First() (v InputStorePaymentStarsGiveaway, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s InputStorePaymentStarsGiveawayArray) Last() (v InputStorePaymentStarsGiveaway, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *InputStorePaymentStarsGiveawayArray) PopFirst() (v InputStorePaymentStarsGiveaway, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero InputStorePaymentStarsGiveaway + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *InputStorePaymentStarsGiveawayArray) Pop() (v InputStorePaymentStarsGiveaway, ok bool) { if s == nil || len(*s) < 1 { return } diff --git a/vendor/github.com/gotd/td/tg/tl_invoice_gen.go b/vendor/github.com/gotd/td/tg/tl_invoice_gen.go index dde26487..99967e9c 100644 --- a/vendor/github.com/gotd/td/tg/tl_invoice_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_invoice_gen.go @@ -59,10 +59,11 @@ type Invoice struct { EmailToProvider bool // Whether this is a recurring payment Recurring bool - // Three-letter ISO 4217 currency¹ code + // Three-letter ISO 4217 currency¹ code, or XTR for Telegram Stars². // // Links: // 1) https://core.telegram.org/bots/payments#supported-currencies + // 2) https://core.telegram.org/api/stars Currency string // Price breakdown, a list of components (e.g. product price, tax, discount, delivery // cost, delivery tax, bonus, etc.) diff --git a/vendor/github.com/gotd/td/tg/tl_invoke_with_apns_secret_gen.go b/vendor/github.com/gotd/td/tg/tl_invoke_with_apns_secret_gen.go index 81df1017..c84a93bd 100644 --- a/vendor/github.com/gotd/td/tg/tl_invoke_with_apns_secret_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_invoke_with_apns_secret_gen.go @@ -32,14 +32,15 @@ var ( ) // InvokeWithApnsSecretRequest represents TL type `invokeWithApnsSecret#dae54f8`. +// Official clients only, invoke with Apple push verification. // // See https://core.telegram.org/constructor/invokeWithApnsSecret for reference. type InvokeWithApnsSecretRequest struct { - // Nonce field of InvokeWithApnsSecretRequest. + // Nonce. Nonce string - // Secret field of InvokeWithApnsSecretRequest. + // Secret. Secret string - // Query field of InvokeWithApnsSecretRequest. + // Query. Query bin.Object } diff --git a/vendor/github.com/gotd/td/tg/tl_invoke_with_business_connection_gen.go b/vendor/github.com/gotd/td/tg/tl_invoke_with_business_connection_gen.go index 6741f456..c85475d7 100644 --- a/vendor/github.com/gotd/td/tg/tl_invoke_with_business_connection_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_invoke_with_business_connection_gen.go @@ -32,12 +32,21 @@ var ( ) // InvokeWithBusinessConnectionRequest represents TL type `invokeWithBusinessConnection#dd289f8e`. +// Invoke a method using a Telegram Business Bot connection, see here » for more info, +// including a list of the methods that can be wrapped in this constructor¹. +// Make sure to always send queries wrapped in a invokeWithBusinessConnection to the +// datacenter ID, specified in the dc_id field of the botBusinessConnection¹ that is +// being used. +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots +// 2. https://core.telegram.org/constructor/botBusinessConnection // // See https://core.telegram.org/constructor/invokeWithBusinessConnection for reference. type InvokeWithBusinessConnectionRequest struct { - // ConnectionID field of InvokeWithBusinessConnectionRequest. + // Business connection ID. ConnectionID string - // Query field of InvokeWithBusinessConnectionRequest. + // The actual query. Query bin.Object } diff --git a/vendor/github.com/gotd/td/tg/tl_invoke_with_google_play_integrity_gen.go b/vendor/github.com/gotd/td/tg/tl_invoke_with_google_play_integrity_gen.go index b2a28b27..2fe76d87 100644 --- a/vendor/github.com/gotd/td/tg/tl_invoke_with_google_play_integrity_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_invoke_with_google_play_integrity_gen.go @@ -32,14 +32,15 @@ var ( ) // InvokeWithGooglePlayIntegrityRequest represents TL type `invokeWithGooglePlayIntegrity#1df92984`. +// Official clients only, invoke with Google Play Integrity token. // // See https://core.telegram.org/constructor/invokeWithGooglePlayIntegrity for reference. type InvokeWithGooglePlayIntegrityRequest struct { - // Nonce field of InvokeWithGooglePlayIntegrityRequest. + // Nonce. Nonce string - // Token field of InvokeWithGooglePlayIntegrityRequest. + // Token. Token string - // Query field of InvokeWithGooglePlayIntegrityRequest. + // Query. Query bin.Object } diff --git a/vendor/github.com/gotd/td/tg/tl_keyboard_button_gen.go b/vendor/github.com/gotd/td/tg/tl_keyboard_button_gen.go index 2634aef4..1e57a4c1 100644 --- a/vendor/github.com/gotd/td/tg/tl_keyboard_button_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_keyboard_button_gen.go @@ -2898,7 +2898,7 @@ type KeyboardButtonRequestPeer struct { // option for the user to create and immediately use one or more (up to max_quantity) // peers of the specified type, if needed. PeerType RequestPeerTypeClass - // Maximum number of peers that can be chosne. + // Maximum number of peers that can be chosen. MaxQuantity int } @@ -3109,24 +3109,38 @@ func (k *KeyboardButtonRequestPeer) GetMaxQuantity() (value int) { } // InputKeyboardButtonRequestPeer represents TL type `inputKeyboardButtonRequestPeer#c9662d05`. +// Prompts the user to select and share one or more peers with the bot using messages +// sendBotRequestedPeer¹. +// +// Links: +// 1. https://core.telegram.org/method/messages.sendBotRequestedPeer // // See https://core.telegram.org/constructor/inputKeyboardButtonRequestPeer for reference. type InputKeyboardButtonRequestPeer struct { - // Flags field of InputKeyboardButtonRequestPeer. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // NameRequested field of InputKeyboardButtonRequestPeer. + // Set this flag to request the peer's name. NameRequested bool - // UsernameRequested field of InputKeyboardButtonRequestPeer. + // Set this flag to request the peer's @username (if any). UsernameRequested bool - // PhotoRequested field of InputKeyboardButtonRequestPeer. + // Set this flag to request the peer's photo (if any). PhotoRequested bool - // Text field of InputKeyboardButtonRequestPeer. + // Button text Text string - // ButtonID field of InputKeyboardButtonRequestPeer. + // Button ID, to be passed to messages.sendBotRequestedPeer¹. + // + // Links: + // 1) https://core.telegram.org/method/messages.sendBotRequestedPeer ButtonID int - // PeerType field of InputKeyboardButtonRequestPeer. + // Filtering criteria to use for the peer selection list shown to the user. The list + // should display all existing peers of the specified type, and should also offer an + // option for the user to create and immediately use one or more (up to max_quantity) + // peers of the specified type, if needed. PeerType RequestPeerTypeClass - // MaxQuantity field of InputKeyboardButtonRequestPeer. + // Maximum number of peers that can be chosen. MaxQuantity int } diff --git a/vendor/github.com/gotd/td/tg/tl_langpack_get_difference_gen.go b/vendor/github.com/gotd/td/tg/tl_langpack_get_difference_gen.go index 2c30bb2c..150820fb 100644 --- a/vendor/github.com/gotd/td/tg/tl_langpack_get_difference_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_langpack_get_difference_gen.go @@ -36,9 +36,13 @@ var ( // // See https://core.telegram.org/method/langpack.getDifference for reference. type LangpackGetDifferenceRequest struct { - // Language pack + // Platform identifier (i.e. android, tdesktop, etc). LangPack string - // Language code + // Either an ISO 639-1 language code or a language pack name obtained from a language + // pack link¹. + // + // Links: + // 1) https://core.telegram.org/api/links#language-pack-links LangCode string // Previous localization pack version FromVersion int diff --git a/vendor/github.com/gotd/td/tg/tl_langpack_get_lang_pack_gen.go b/vendor/github.com/gotd/td/tg/tl_langpack_get_lang_pack_gen.go index fcdd249f..cf19a996 100644 --- a/vendor/github.com/gotd/td/tg/tl_langpack_get_lang_pack_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_langpack_get_lang_pack_gen.go @@ -36,12 +36,13 @@ var ( // // See https://core.telegram.org/method/langpack.getLangPack for reference. type LangpackGetLangPackRequest struct { - // Language pack name, usually obtained from a language pack link¹ + // Platform identifier (i.e. android, tdesktop, etc). + LangPack string + // Either an ISO 639-1 language code or a language pack name obtained from a language + // pack link¹. // // Links: // 1) https://core.telegram.org/api/links#language-pack-links - LangPack string - // Language code LangCode string } @@ -196,6 +197,7 @@ func (g *LangpackGetLangPackRequest) GetLangCode() (value string) { // // Possible errors: // +// 400 LANGUAGE_INVALID: The specified lang_code is invalid. // 400 LANG_CODE_NOT_SUPPORTED: The specified language code is not supported. // 400 LANG_PACK_INVALID: The provided language pack is invalid. // diff --git a/vendor/github.com/gotd/td/tg/tl_langpack_get_language_gen.go b/vendor/github.com/gotd/td/tg/tl_langpack_get_language_gen.go index 688389cd..e6ba2dd2 100644 --- a/vendor/github.com/gotd/td/tg/tl_langpack_get_language_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_langpack_get_language_gen.go @@ -36,12 +36,13 @@ var ( // // See https://core.telegram.org/method/langpack.getLanguage for reference. type LangpackGetLanguageRequest struct { - // Language pack name, usually obtained from a language pack link¹ + // Platform identifier (i.e. android, tdesktop, etc). + LangPack string + // Either an ISO 639-1 language code or a language pack name obtained from a language + // pack link¹. // // Links: // 1) https://core.telegram.org/api/links#language-pack-links - LangPack string - // Language code LangCode string } diff --git a/vendor/github.com/gotd/td/tg/tl_langpack_get_languages_gen.go b/vendor/github.com/gotd/td/tg/tl_langpack_get_languages_gen.go index 6bee6bca..3bd01f18 100644 --- a/vendor/github.com/gotd/td/tg/tl_langpack_get_languages_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_langpack_get_languages_gen.go @@ -36,7 +36,7 @@ var ( // // See https://core.telegram.org/method/langpack.getLanguages for reference. type LangpackGetLanguagesRequest struct { - // Language pack + // Platform identifier (i.e. android, tdesktop, etc). LangPack string } diff --git a/vendor/github.com/gotd/td/tg/tl_langpack_get_strings_gen.go b/vendor/github.com/gotd/td/tg/tl_langpack_get_strings_gen.go index 99096b7b..a0bea3b8 100644 --- a/vendor/github.com/gotd/td/tg/tl_langpack_get_strings_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_langpack_get_strings_gen.go @@ -36,12 +36,13 @@ var ( // // See https://core.telegram.org/method/langpack.getStrings for reference. type LangpackGetStringsRequest struct { - // Language pack name, usually obtained from a language pack link¹ + // Platform identifier (i.e. android, tdesktop, etc). + LangPack string + // Either an ISO 639-1 language code or a language pack name obtained from a language + // pack link¹. // // Links: // 1) https://core.telegram.org/api/links#language-pack-links - LangPack string - // Language code LangCode string // Strings to get Keys []string diff --git a/vendor/github.com/gotd/td/tg/tl_media_area_coordinates_gen.go b/vendor/github.com/gotd/td/tg/tl_media_area_coordinates_gen.go index 91269e1f..a3ba8b64 100644 --- a/vendor/github.com/gotd/td/tg/tl_media_area_coordinates_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_media_area_coordinates_gen.go @@ -31,11 +31,16 @@ var ( _ = tdjson.Encoder{} ) -// MediaAreaCoordinates represents TL type `mediaAreaCoordinates#3d1ea4e`. +// MediaAreaCoordinates represents TL type `mediaAreaCoordinates#cfc9e002`. // Coordinates and size of a clicable rectangular area on top of a story. // // See https://core.telegram.org/constructor/mediaAreaCoordinates for reference. type MediaAreaCoordinates struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields // The abscissa of the rectangle's center, as a percentage of the media width (0-100). X float64 // The ordinate of the rectangle's center, as a percentage of the media height (0-100). @@ -46,10 +51,14 @@ type MediaAreaCoordinates struct { H float64 // Clockwise rotation angle of the rectangle, in degrees (0-360). Rotation float64 + // The radius of the rectangle corner rounding, as a percentage of the media width. + // + // Use SetRadius and GetRadius helpers. + Radius float64 } // MediaAreaCoordinatesTypeID is TL type id of MediaAreaCoordinates. -const MediaAreaCoordinatesTypeID = 0x3d1ea4e +const MediaAreaCoordinatesTypeID = 0xcfc9e002 // Ensuring interfaces in compile-time for MediaAreaCoordinates. var ( @@ -63,6 +72,9 @@ func (m *MediaAreaCoordinates) Zero() bool { if m == nil { return true } + if !(m.Flags.Zero()) { + return false + } if !(m.X == 0) { return false } @@ -78,6 +90,9 @@ func (m *MediaAreaCoordinates) Zero() bool { if !(m.Rotation == 0) { return false } + if !(m.Radius == 0) { + return false + } return true } @@ -98,12 +113,17 @@ func (m *MediaAreaCoordinates) FillFrom(from interface { GetW() (value float64) GetH() (value float64) GetRotation() (value float64) + GetRadius() (value float64, ok bool) }) { m.X = from.GetX() m.Y = from.GetY() m.W = from.GetW() m.H = from.GetH() m.Rotation = from.GetRotation() + if val, ok := from.GetRadius(); ok { + m.Radius = val + } + } // TypeID returns type id in TL schema. @@ -149,14 +169,26 @@ func (m *MediaAreaCoordinates) TypeInfo() tdp.Type { Name: "Rotation", SchemaName: "rotation", }, + { + Name: "Radius", + SchemaName: "radius", + Null: !m.Flags.Has(0), + }, } return typ } +// SetFlags sets flags for non-zero fields. +func (m *MediaAreaCoordinates) SetFlags() { + if !(m.Radius == 0) { + m.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (m *MediaAreaCoordinates) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode mediaAreaCoordinates#3d1ea4e as nil") + return fmt.Errorf("can't encode mediaAreaCoordinates#cfc9e002 as nil") } b.PutID(MediaAreaCoordinatesTypeID) return m.EncodeBare(b) @@ -165,23 +197,30 @@ func (m *MediaAreaCoordinates) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MediaAreaCoordinates) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode mediaAreaCoordinates#3d1ea4e as nil") + return fmt.Errorf("can't encode mediaAreaCoordinates#cfc9e002 as nil") + } + m.SetFlags() + if err := m.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode mediaAreaCoordinates#cfc9e002: field flags: %w", err) } b.PutDouble(m.X) b.PutDouble(m.Y) b.PutDouble(m.W) b.PutDouble(m.H) b.PutDouble(m.Rotation) + if m.Flags.Has(0) { + b.PutDouble(m.Radius) + } return nil } // Decode implements bin.Decoder. func (m *MediaAreaCoordinates) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode mediaAreaCoordinates#3d1ea4e to nil") + return fmt.Errorf("can't decode mediaAreaCoordinates#cfc9e002 to nil") } if err := b.ConsumeID(MediaAreaCoordinatesTypeID); err != nil { - return fmt.Errorf("unable to decode mediaAreaCoordinates#3d1ea4e: %w", err) + return fmt.Errorf("unable to decode mediaAreaCoordinates#cfc9e002: %w", err) } return m.DecodeBare(b) } @@ -189,43 +228,55 @@ func (m *MediaAreaCoordinates) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MediaAreaCoordinates) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode mediaAreaCoordinates#3d1ea4e to nil") + return fmt.Errorf("can't decode mediaAreaCoordinates#cfc9e002 to nil") + } + { + if err := m.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode mediaAreaCoordinates#cfc9e002: field flags: %w", err) + } } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode mediaAreaCoordinates#3d1ea4e: field x: %w", err) + return fmt.Errorf("unable to decode mediaAreaCoordinates#cfc9e002: field x: %w", err) } m.X = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode mediaAreaCoordinates#3d1ea4e: field y: %w", err) + return fmt.Errorf("unable to decode mediaAreaCoordinates#cfc9e002: field y: %w", err) } m.Y = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode mediaAreaCoordinates#3d1ea4e: field w: %w", err) + return fmt.Errorf("unable to decode mediaAreaCoordinates#cfc9e002: field w: %w", err) } m.W = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode mediaAreaCoordinates#3d1ea4e: field h: %w", err) + return fmt.Errorf("unable to decode mediaAreaCoordinates#cfc9e002: field h: %w", err) } m.H = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode mediaAreaCoordinates#3d1ea4e: field rotation: %w", err) + return fmt.Errorf("unable to decode mediaAreaCoordinates#cfc9e002: field rotation: %w", err) } m.Rotation = value } + if m.Flags.Has(0) { + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode mediaAreaCoordinates#cfc9e002: field radius: %w", err) + } + m.Radius = value + } return nil } @@ -268,3 +319,21 @@ func (m *MediaAreaCoordinates) GetRotation() (value float64) { } return m.Rotation } + +// SetRadius sets value of Radius conditional field. +func (m *MediaAreaCoordinates) SetRadius(value float64) { + m.Flags.Set(0) + m.Radius = value +} + +// GetRadius returns value of Radius conditional field and +// boolean which is true if field was set. +func (m *MediaAreaCoordinates) GetRadius() (value float64, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(0) { + return value, false + } + return m.Radius, true +} diff --git a/vendor/github.com/gotd/td/tg/tl_media_area_gen.go b/vendor/github.com/gotd/td/tg/tl_media_area_gen.go index 78b718e1..d77d399e 100644 --- a/vendor/github.com/gotd/td/tg/tl_media_area_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_media_area_gen.go @@ -538,7 +538,7 @@ func (i *InputMediaAreaVenue) GetResultID() (value string) { return i.ResultID } -// MediaAreaGeoPoint represents TL type `mediaAreaGeoPoint#df8b3b22`. +// MediaAreaGeoPoint represents TL type `mediaAreaGeoPoint#cad5452d`. // Represents a geolocation tag attached to a story¹. // // Links: @@ -546,15 +546,24 @@ func (i *InputMediaAreaVenue) GetResultID() (value string) { // // See https://core.telegram.org/constructor/mediaAreaGeoPoint for reference. type MediaAreaGeoPoint struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields // The size and position of the media area corresponding to the location sticker on top // of the story media. Coordinates MediaAreaCoordinates // Coordinates of the geolocation tag. Geo GeoPointClass + // Optional textual representation of the address. + // + // Use SetAddress and GetAddress helpers. + Address GeoPointAddress } // MediaAreaGeoPointTypeID is TL type id of MediaAreaGeoPoint. -const MediaAreaGeoPointTypeID = 0xdf8b3b22 +const MediaAreaGeoPointTypeID = 0xcad5452d // construct implements constructor of MediaAreaClass. func (m MediaAreaGeoPoint) construct() MediaAreaClass { return &m } @@ -573,12 +582,18 @@ func (m *MediaAreaGeoPoint) Zero() bool { if m == nil { return true } + if !(m.Flags.Zero()) { + return false + } if !(m.Coordinates.Zero()) { return false } if !(m.Geo == nil) { return false } + if !(m.Address.Zero()) { + return false + } return true } @@ -596,9 +611,14 @@ func (m *MediaAreaGeoPoint) String() string { func (m *MediaAreaGeoPoint) FillFrom(from interface { GetCoordinates() (value MediaAreaCoordinates) GetGeo() (value GeoPointClass) + GetAddress() (value GeoPointAddress, ok bool) }) { m.Coordinates = from.GetCoordinates() m.Geo = from.GetGeo() + if val, ok := from.GetAddress(); ok { + m.Address = val + } + } // TypeID returns type id in TL schema. @@ -632,14 +652,26 @@ func (m *MediaAreaGeoPoint) TypeInfo() tdp.Type { Name: "Geo", SchemaName: "geo", }, + { + Name: "Address", + SchemaName: "address", + Null: !m.Flags.Has(0), + }, } return typ } +// SetFlags sets flags for non-zero fields. +func (m *MediaAreaGeoPoint) SetFlags() { + if !(m.Address.Zero()) { + m.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (m *MediaAreaGeoPoint) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode mediaAreaGeoPoint#df8b3b22 as nil") + return fmt.Errorf("can't encode mediaAreaGeoPoint#cad5452d as nil") } b.PutID(MediaAreaGeoPointTypeID) return m.EncodeBare(b) @@ -648,16 +680,25 @@ func (m *MediaAreaGeoPoint) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MediaAreaGeoPoint) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode mediaAreaGeoPoint#df8b3b22 as nil") + return fmt.Errorf("can't encode mediaAreaGeoPoint#cad5452d as nil") + } + m.SetFlags() + if err := m.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode mediaAreaGeoPoint#cad5452d: field flags: %w", err) } if err := m.Coordinates.Encode(b); err != nil { - return fmt.Errorf("unable to encode mediaAreaGeoPoint#df8b3b22: field coordinates: %w", err) + return fmt.Errorf("unable to encode mediaAreaGeoPoint#cad5452d: field coordinates: %w", err) } if m.Geo == nil { - return fmt.Errorf("unable to encode mediaAreaGeoPoint#df8b3b22: field geo is nil") + return fmt.Errorf("unable to encode mediaAreaGeoPoint#cad5452d: field geo is nil") } if err := m.Geo.Encode(b); err != nil { - return fmt.Errorf("unable to encode mediaAreaGeoPoint#df8b3b22: field geo: %w", err) + return fmt.Errorf("unable to encode mediaAreaGeoPoint#cad5452d: field geo: %w", err) + } + if m.Flags.Has(0) { + if err := m.Address.Encode(b); err != nil { + return fmt.Errorf("unable to encode mediaAreaGeoPoint#cad5452d: field address: %w", err) + } } return nil } @@ -665,10 +706,10 @@ func (m *MediaAreaGeoPoint) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MediaAreaGeoPoint) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode mediaAreaGeoPoint#df8b3b22 to nil") + return fmt.Errorf("can't decode mediaAreaGeoPoint#cad5452d to nil") } if err := b.ConsumeID(MediaAreaGeoPointTypeID); err != nil { - return fmt.Errorf("unable to decode mediaAreaGeoPoint#df8b3b22: %w", err) + return fmt.Errorf("unable to decode mediaAreaGeoPoint#cad5452d: %w", err) } return m.DecodeBare(b) } @@ -676,20 +717,30 @@ func (m *MediaAreaGeoPoint) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MediaAreaGeoPoint) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode mediaAreaGeoPoint#df8b3b22 to nil") + return fmt.Errorf("can't decode mediaAreaGeoPoint#cad5452d to nil") + } + { + if err := m.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode mediaAreaGeoPoint#cad5452d: field flags: %w", err) + } } { if err := m.Coordinates.Decode(b); err != nil { - return fmt.Errorf("unable to decode mediaAreaGeoPoint#df8b3b22: field coordinates: %w", err) + return fmt.Errorf("unable to decode mediaAreaGeoPoint#cad5452d: field coordinates: %w", err) } } { value, err := DecodeGeoPoint(b) if err != nil { - return fmt.Errorf("unable to decode mediaAreaGeoPoint#df8b3b22: field geo: %w", err) + return fmt.Errorf("unable to decode mediaAreaGeoPoint#cad5452d: field geo: %w", err) } m.Geo = value } + if m.Flags.Has(0) { + if err := m.Address.Decode(b); err != nil { + return fmt.Errorf("unable to decode mediaAreaGeoPoint#cad5452d: field address: %w", err) + } + } return nil } @@ -709,6 +760,24 @@ func (m *MediaAreaGeoPoint) GetGeo() (value GeoPointClass) { return m.Geo } +// SetAddress sets value of Address conditional field. +func (m *MediaAreaGeoPoint) SetAddress(value GeoPointAddress) { + m.Flags.Set(0) + m.Address = value +} + +// GetAddress returns value of Address conditional field and +// boolean which is true if field was set. +func (m *MediaAreaGeoPoint) GetAddress() (value GeoPointAddress, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(0) { + return value, false + } + return m.Address, true +} + // MediaAreaSuggestedReaction represents TL type `mediaAreaSuggestedReaction#14455871`. // Represents a reaction bubble. // @@ -1355,6 +1424,395 @@ func (i *InputMediaAreaChannelPost) GetMsgID() (value int) { return i.MsgID } +// MediaAreaURL represents TL type `mediaAreaUrl#37381085`. +// Represents a URL media area¹. +// +// Links: +// 1. https://core.telegram.org/api/stories#urls +// +// See https://core.telegram.org/constructor/mediaAreaUrl for reference. +type MediaAreaURL struct { + // The size and location of the media area corresponding to the URL button on top of the + // story media. + Coordinates MediaAreaCoordinates + // URL to open when clicked. + URL string +} + +// MediaAreaURLTypeID is TL type id of MediaAreaURL. +const MediaAreaURLTypeID = 0x37381085 + +// construct implements constructor of MediaAreaClass. +func (m MediaAreaURL) construct() MediaAreaClass { return &m } + +// Ensuring interfaces in compile-time for MediaAreaURL. +var ( + _ bin.Encoder = &MediaAreaURL{} + _ bin.Decoder = &MediaAreaURL{} + _ bin.BareEncoder = &MediaAreaURL{} + _ bin.BareDecoder = &MediaAreaURL{} + + _ MediaAreaClass = &MediaAreaURL{} +) + +func (m *MediaAreaURL) Zero() bool { + if m == nil { + return true + } + if !(m.Coordinates.Zero()) { + return false + } + if !(m.URL == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MediaAreaURL) String() string { + if m == nil { + return "MediaAreaURL(nil)" + } + type Alias MediaAreaURL + return fmt.Sprintf("MediaAreaURL%+v", Alias(*m)) +} + +// FillFrom fills MediaAreaURL from given interface. +func (m *MediaAreaURL) FillFrom(from interface { + GetCoordinates() (value MediaAreaCoordinates) + GetURL() (value string) +}) { + m.Coordinates = from.GetCoordinates() + m.URL = from.GetURL() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MediaAreaURL) TypeID() uint32 { + return MediaAreaURLTypeID +} + +// TypeName returns name of type in TL schema. +func (*MediaAreaURL) TypeName() string { + return "mediaAreaUrl" +} + +// TypeInfo returns info about TL type. +func (m *MediaAreaURL) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "mediaAreaUrl", + ID: MediaAreaURLTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Coordinates", + SchemaName: "coordinates", + }, + { + Name: "URL", + SchemaName: "url", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MediaAreaURL) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode mediaAreaUrl#37381085 as nil") + } + b.PutID(MediaAreaURLTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MediaAreaURL) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode mediaAreaUrl#37381085 as nil") + } + if err := m.Coordinates.Encode(b); err != nil { + return fmt.Errorf("unable to encode mediaAreaUrl#37381085: field coordinates: %w", err) + } + b.PutString(m.URL) + return nil +} + +// Decode implements bin.Decoder. +func (m *MediaAreaURL) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode mediaAreaUrl#37381085 to nil") + } + if err := b.ConsumeID(MediaAreaURLTypeID); err != nil { + return fmt.Errorf("unable to decode mediaAreaUrl#37381085: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MediaAreaURL) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode mediaAreaUrl#37381085 to nil") + } + { + if err := m.Coordinates.Decode(b); err != nil { + return fmt.Errorf("unable to decode mediaAreaUrl#37381085: field coordinates: %w", err) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode mediaAreaUrl#37381085: field url: %w", err) + } + m.URL = value + } + return nil +} + +// GetCoordinates returns value of Coordinates field. +func (m *MediaAreaURL) GetCoordinates() (value MediaAreaCoordinates) { + if m == nil { + return + } + return m.Coordinates +} + +// GetURL returns value of URL field. +func (m *MediaAreaURL) GetURL() (value string) { + if m == nil { + return + } + return m.URL +} + +// MediaAreaWeather represents TL type `mediaAreaWeather#49a6549c`. +// Represents a weather widget »¹. +// +// Links: +// 1. https://core.telegram.org/api/stories#weather +// +// See https://core.telegram.org/constructor/mediaAreaWeather for reference. +type MediaAreaWeather struct { + // The size and location of the media area corresponding to the widget on top of the + // story media. + Coordinates MediaAreaCoordinates + // Weather emoji, should be rendered as an animated emoji¹. + // + // Links: + // 1) https://core.telegram.org/api/animated-emojis + Emoji string + // Temperature in degrees Celsius. + TemperatureC float64 + // ARGB background color. + Color int +} + +// MediaAreaWeatherTypeID is TL type id of MediaAreaWeather. +const MediaAreaWeatherTypeID = 0x49a6549c + +// construct implements constructor of MediaAreaClass. +func (m MediaAreaWeather) construct() MediaAreaClass { return &m } + +// Ensuring interfaces in compile-time for MediaAreaWeather. +var ( + _ bin.Encoder = &MediaAreaWeather{} + _ bin.Decoder = &MediaAreaWeather{} + _ bin.BareEncoder = &MediaAreaWeather{} + _ bin.BareDecoder = &MediaAreaWeather{} + + _ MediaAreaClass = &MediaAreaWeather{} +) + +func (m *MediaAreaWeather) Zero() bool { + if m == nil { + return true + } + if !(m.Coordinates.Zero()) { + return false + } + if !(m.Emoji == "") { + return false + } + if !(m.TemperatureC == 0) { + return false + } + if !(m.Color == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MediaAreaWeather) String() string { + if m == nil { + return "MediaAreaWeather(nil)" + } + type Alias MediaAreaWeather + return fmt.Sprintf("MediaAreaWeather%+v", Alias(*m)) +} + +// FillFrom fills MediaAreaWeather from given interface. +func (m *MediaAreaWeather) FillFrom(from interface { + GetCoordinates() (value MediaAreaCoordinates) + GetEmoji() (value string) + GetTemperatureC() (value float64) + GetColor() (value int) +}) { + m.Coordinates = from.GetCoordinates() + m.Emoji = from.GetEmoji() + m.TemperatureC = from.GetTemperatureC() + m.Color = from.GetColor() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MediaAreaWeather) TypeID() uint32 { + return MediaAreaWeatherTypeID +} + +// TypeName returns name of type in TL schema. +func (*MediaAreaWeather) TypeName() string { + return "mediaAreaWeather" +} + +// TypeInfo returns info about TL type. +func (m *MediaAreaWeather) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "mediaAreaWeather", + ID: MediaAreaWeatherTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Coordinates", + SchemaName: "coordinates", + }, + { + Name: "Emoji", + SchemaName: "emoji", + }, + { + Name: "TemperatureC", + SchemaName: "temperature_c", + }, + { + Name: "Color", + SchemaName: "color", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MediaAreaWeather) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode mediaAreaWeather#49a6549c as nil") + } + b.PutID(MediaAreaWeatherTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MediaAreaWeather) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode mediaAreaWeather#49a6549c as nil") + } + if err := m.Coordinates.Encode(b); err != nil { + return fmt.Errorf("unable to encode mediaAreaWeather#49a6549c: field coordinates: %w", err) + } + b.PutString(m.Emoji) + b.PutDouble(m.TemperatureC) + b.PutInt(m.Color) + return nil +} + +// Decode implements bin.Decoder. +func (m *MediaAreaWeather) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode mediaAreaWeather#49a6549c to nil") + } + if err := b.ConsumeID(MediaAreaWeatherTypeID); err != nil { + return fmt.Errorf("unable to decode mediaAreaWeather#49a6549c: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MediaAreaWeather) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode mediaAreaWeather#49a6549c to nil") + } + { + if err := m.Coordinates.Decode(b); err != nil { + return fmt.Errorf("unable to decode mediaAreaWeather#49a6549c: field coordinates: %w", err) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode mediaAreaWeather#49a6549c: field emoji: %w", err) + } + m.Emoji = value + } + { + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode mediaAreaWeather#49a6549c: field temperature_c: %w", err) + } + m.TemperatureC = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode mediaAreaWeather#49a6549c: field color: %w", err) + } + m.Color = value + } + return nil +} + +// GetCoordinates returns value of Coordinates field. +func (m *MediaAreaWeather) GetCoordinates() (value MediaAreaCoordinates) { + if m == nil { + return + } + return m.Coordinates +} + +// GetEmoji returns value of Emoji field. +func (m *MediaAreaWeather) GetEmoji() (value string) { + if m == nil { + return + } + return m.Emoji +} + +// GetTemperatureC returns value of TemperatureC field. +func (m *MediaAreaWeather) GetTemperatureC() (value float64) { + if m == nil { + return + } + return m.TemperatureC +} + +// GetColor returns value of Color field. +func (m *MediaAreaWeather) GetColor() (value int) { + if m == nil { + return + } + return m.Color +} + // MediaAreaClassName is schema name of MediaAreaClass. const MediaAreaClassName = "MediaArea" @@ -1371,10 +1829,12 @@ const MediaAreaClassName = "MediaArea" // switch v := g.(type) { // case *tg.MediaAreaVenue: // mediaAreaVenue#be82db9c // case *tg.InputMediaAreaVenue: // inputMediaAreaVenue#b282217f -// case *tg.MediaAreaGeoPoint: // mediaAreaGeoPoint#df8b3b22 +// case *tg.MediaAreaGeoPoint: // mediaAreaGeoPoint#cad5452d // case *tg.MediaAreaSuggestedReaction: // mediaAreaSuggestedReaction#14455871 // case *tg.MediaAreaChannelPost: // mediaAreaChannelPost#770416af // case *tg.InputMediaAreaChannelPost: // inputMediaAreaChannelPost#2271f2bf +// case *tg.MediaAreaURL: // mediaAreaUrl#37381085 +// case *tg.MediaAreaWeather: // mediaAreaWeather#49a6549c // default: panic(v) // } type MediaAreaClass interface { @@ -1422,7 +1882,7 @@ func DecodeMediaArea(buf *bin.Buffer) (MediaAreaClass, error) { } return &v, nil case MediaAreaGeoPointTypeID: - // Decoding mediaAreaGeoPoint#df8b3b22. + // Decoding mediaAreaGeoPoint#cad5452d. v := MediaAreaGeoPoint{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", err) @@ -1449,6 +1909,20 @@ func DecodeMediaArea(buf *bin.Buffer) (MediaAreaClass, error) { return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", err) } return &v, nil + case MediaAreaURLTypeID: + // Decoding mediaAreaUrl#37381085. + v := MediaAreaURL{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", err) + } + return &v, nil + case MediaAreaWeatherTypeID: + // Decoding mediaAreaWeather#49a6549c. + v := MediaAreaWeather{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", bin.NewUnexpectedID(id)) } diff --git a/vendor/github.com/gotd/td/tg/tl_media_area_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_media_area_slices_gen.go index 082b0cbe..13dfa06f 100644 --- a/vendor/github.com/gotd/td/tg/tl_media_area_slices_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_media_area_slices_gen.go @@ -194,6 +194,32 @@ func (s MediaAreaClassArray) AsInputMediaAreaChannelPost() (to InputMediaAreaCha return to } +// AsMediaAreaURL returns copy with only MediaAreaURL constructors. +func (s MediaAreaClassArray) AsMediaAreaURL() (to MediaAreaURLArray) { + for _, elem := range s { + value, ok := elem.(*MediaAreaURL) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsMediaAreaWeather returns copy with only MediaAreaWeather constructors. +func (s MediaAreaClassArray) AsMediaAreaWeather() (to MediaAreaWeatherArray) { + for _, elem := range s { + value, ok := elem.(*MediaAreaWeather) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // MediaAreaVenueArray is adapter for slice of MediaAreaVenue. type MediaAreaVenueArray []MediaAreaVenue @@ -685,3 +711,167 @@ func (s *InputMediaAreaChannelPostArray) Pop() (v InputMediaAreaChannelPost, ok return v, true } + +// MediaAreaURLArray is adapter for slice of MediaAreaURL. +type MediaAreaURLArray []MediaAreaURL + +// Sort sorts slice of MediaAreaURL. +func (s MediaAreaURLArray) Sort(less func(a, b MediaAreaURL) bool) MediaAreaURLArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MediaAreaURL. +func (s MediaAreaURLArray) SortStable(less func(a, b MediaAreaURL) bool) MediaAreaURLArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MediaAreaURL. +func (s MediaAreaURLArray) Retain(keep func(x MediaAreaURL) bool) MediaAreaURLArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s MediaAreaURLArray) First() (v MediaAreaURL, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MediaAreaURLArray) Last() (v MediaAreaURL, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *MediaAreaURLArray) PopFirst() (v MediaAreaURL, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero MediaAreaURL + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *MediaAreaURLArray) Pop() (v MediaAreaURL, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// MediaAreaWeatherArray is adapter for slice of MediaAreaWeather. +type MediaAreaWeatherArray []MediaAreaWeather + +// Sort sorts slice of MediaAreaWeather. +func (s MediaAreaWeatherArray) Sort(less func(a, b MediaAreaWeather) bool) MediaAreaWeatherArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MediaAreaWeather. +func (s MediaAreaWeatherArray) SortStable(less func(a, b MediaAreaWeather) bool) MediaAreaWeatherArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MediaAreaWeather. +func (s MediaAreaWeatherArray) Retain(keep func(x MediaAreaWeather) bool) MediaAreaWeatherArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s MediaAreaWeatherArray) First() (v MediaAreaWeather, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MediaAreaWeatherArray) Last() (v MediaAreaWeather, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *MediaAreaWeatherArray) PopFirst() (v MediaAreaWeather, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero MediaAreaWeather + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *MediaAreaWeatherArray) Pop() (v MediaAreaWeather, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/vendor/github.com/gotd/td/tg/tl_message_action_gen.go b/vendor/github.com/gotd/td/tg/tl_message_action_gen.go index 9824cc69..e19caf45 100644 --- a/vendor/github.com/gotd/td/tg/tl_message_action_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_message_action_gen.go @@ -1921,10 +1921,11 @@ type MessageActionPaymentSentMe struct { RecurringInit bool // Whether this payment is part of a recurring payment RecurringUsed bool - // Three-letter ISO 4217 currency¹ code + // Three-letter ISO 4217 currency¹ code, or XTR for Telegram Stars². // // Links: // 1) https://core.telegram.org/bots/payments#supported-currencies + // 2) https://core.telegram.org/api/stars Currency string // Price of the product in the smallest units of the currency (integer, not float/double) // For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in @@ -2333,10 +2334,11 @@ type MessageActionPaymentSent struct { RecurringInit bool // Whether this payment is part of a recurring payment RecurringUsed bool - // Three-letter ISO 4217 currency¹ code + // Three-letter ISO 4217 currency¹ code, or XTR for Telegram Stars². // // Links: // 1) https://core.telegram.org/bots/payments#supported-currencies + // 2) https://core.telegram.org/api/stars Currency string // Price of the product in the smallest units of the currency (integer, not float/double) // For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in @@ -6453,8 +6455,8 @@ func (m *MessageActionSuggestProfilePhoto) GetPhoto() (value PhotoClass) { } // MessageActionRequestedPeer represents TL type `messageActionRequestedPeer#31518e9b`. -// Contains info about one or more peers that the user shared with the bot after clicking -// on a keyboardButtonRequestPeer¹ button. +// Contains info about one or more peers that the we (the user) shared with the bot after +// clicking on a keyboardButtonRequestPeer¹ button (service message sent by the user). // // Links: // 1. https://core.telegram.org/constructor/keyboardButtonRequestPeer @@ -6906,8 +6908,8 @@ type MessageActionGiftCode struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // If set, this gift code was received from a giveaway »¹ started by a channel we're - // subscribed to. + // If set, this gift code was received from a giveaway »¹ started by a + // channel/supergroup we're subscribed to. // // Links: // 1) https://core.telegram.org/api/giveaways @@ -6917,9 +6919,9 @@ type MessageActionGiftCode struct { // Links: // 1) https://core.telegram.org/api/links#premium-giftcode-links Unclaimed bool - // Identifier of the channel that created the gift code either directly or through a - // giveaway¹: if we import this giftcode link, we will also automatically boost² this - // channel. + // Identifier of the channel/supergroup that created the gift code either directly or + // through a giveaway¹: if we import this giftcode link, we will also automatically + // boost² this channel/supergroup. // // Links: // 1) https://core.telegram.org/api/giveaways @@ -7423,7 +7425,7 @@ func (m *MessageActionGiftCode) GetCryptoAmount() (value int64, ok bool) { return m.CryptoAmount, true } -// MessageActionGiveawayLaunch represents TL type `messageActionGiveawayLaunch#332ba9ed`. +// MessageActionGiveawayLaunch represents TL type `messageActionGiveawayLaunch#a80f51e4`. // A giveaway¹ was started. // // Links: @@ -7431,10 +7433,16 @@ func (m *MessageActionGiftCode) GetCryptoAmount() (value int64, ok bool) { // // See https://core.telegram.org/constructor/messageActionGiveawayLaunch for reference. type MessageActionGiveawayLaunch struct { + // Flags field of MessageActionGiveawayLaunch. + Flags bin.Fields + // Stars field of MessageActionGiveawayLaunch. + // + // Use SetStars and GetStars helpers. + Stars int64 } // MessageActionGiveawayLaunchTypeID is TL type id of MessageActionGiveawayLaunch. -const MessageActionGiveawayLaunchTypeID = 0x332ba9ed +const MessageActionGiveawayLaunchTypeID = 0xa80f51e4 // construct implements constructor of MessageActionClass. func (m MessageActionGiveawayLaunch) construct() MessageActionClass { return &m } @@ -7453,6 +7461,12 @@ func (m *MessageActionGiveawayLaunch) Zero() bool { if m == nil { return true } + if !(m.Flags.Zero()) { + return false + } + if !(m.Stars == 0) { + return false + } return true } @@ -7466,6 +7480,16 @@ func (m *MessageActionGiveawayLaunch) String() string { return fmt.Sprintf("MessageActionGiveawayLaunch%+v", Alias(*m)) } +// FillFrom fills MessageActionGiveawayLaunch from given interface. +func (m *MessageActionGiveawayLaunch) FillFrom(from interface { + GetStars() (value int64, ok bool) +}) { + if val, ok := from.GetStars(); ok { + m.Stars = val + } + +} + // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. @@ -7488,14 +7512,27 @@ func (m *MessageActionGiveawayLaunch) TypeInfo() tdp.Type { typ.Null = true return typ } - typ.Fields = []tdp.Field{} + typ.Fields = []tdp.Field{ + { + Name: "Stars", + SchemaName: "stars", + Null: !m.Flags.Has(0), + }, + } return typ } +// SetFlags sets flags for non-zero fields. +func (m *MessageActionGiveawayLaunch) SetFlags() { + if !(m.Stars == 0) { + m.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (m *MessageActionGiveawayLaunch) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionGiveawayLaunch#332ba9ed as nil") + return fmt.Errorf("can't encode messageActionGiveawayLaunch#a80f51e4 as nil") } b.PutID(MessageActionGiveawayLaunchTypeID) return m.EncodeBare(b) @@ -7504,7 +7541,14 @@ func (m *MessageActionGiveawayLaunch) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageActionGiveawayLaunch) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionGiveawayLaunch#332ba9ed as nil") + return fmt.Errorf("can't encode messageActionGiveawayLaunch#a80f51e4 as nil") + } + m.SetFlags() + if err := m.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionGiveawayLaunch#a80f51e4: field flags: %w", err) + } + if m.Flags.Has(0) { + b.PutLong(m.Stars) } return nil } @@ -7512,10 +7556,10 @@ func (m *MessageActionGiveawayLaunch) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MessageActionGiveawayLaunch) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionGiveawayLaunch#332ba9ed to nil") + return fmt.Errorf("can't decode messageActionGiveawayLaunch#a80f51e4 to nil") } if err := b.ConsumeID(MessageActionGiveawayLaunchTypeID); err != nil { - return fmt.Errorf("unable to decode messageActionGiveawayLaunch#332ba9ed: %w", err) + return fmt.Errorf("unable to decode messageActionGiveawayLaunch#a80f51e4: %w", err) } return m.DecodeBare(b) } @@ -7523,12 +7567,42 @@ func (m *MessageActionGiveawayLaunch) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageActionGiveawayLaunch) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionGiveawayLaunch#332ba9ed to nil") + return fmt.Errorf("can't decode messageActionGiveawayLaunch#a80f51e4 to nil") + } + { + if err := m.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageActionGiveawayLaunch#a80f51e4: field flags: %w", err) + } + } + if m.Flags.Has(0) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageActionGiveawayLaunch#a80f51e4: field stars: %w", err) + } + m.Stars = value } return nil } -// MessageActionGiveawayResults represents TL type `messageActionGiveawayResults#2a9fadc5`. +// SetStars sets value of Stars conditional field. +func (m *MessageActionGiveawayLaunch) SetStars(value int64) { + m.Flags.Set(0) + m.Stars = value +} + +// GetStars returns value of Stars conditional field and +// boolean which is true if field was set. +func (m *MessageActionGiveawayLaunch) GetStars() (value int64, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(0) { + return value, false + } + return m.Stars, true +} + +// MessageActionGiveawayResults represents TL type `messageActionGiveawayResults#87e2f155`. // A giveaway¹ has ended. // // Links: @@ -7536,6 +7610,10 @@ func (m *MessageActionGiveawayLaunch) DecodeBare(b *bin.Buffer) error { // // See https://core.telegram.org/constructor/messageActionGiveawayResults for reference. type MessageActionGiveawayResults struct { + // Flags field of MessageActionGiveawayResults. + Flags bin.Fields + // Stars field of MessageActionGiveawayResults. + Stars bool // Number of winners in the giveaway WinnersCount int // Number of undistributed prizes @@ -7543,7 +7621,7 @@ type MessageActionGiveawayResults struct { } // MessageActionGiveawayResultsTypeID is TL type id of MessageActionGiveawayResults. -const MessageActionGiveawayResultsTypeID = 0x2a9fadc5 +const MessageActionGiveawayResultsTypeID = 0x87e2f155 // construct implements constructor of MessageActionClass. func (m MessageActionGiveawayResults) construct() MessageActionClass { return &m } @@ -7562,6 +7640,12 @@ func (m *MessageActionGiveawayResults) Zero() bool { if m == nil { return true } + if !(m.Flags.Zero()) { + return false + } + if !(m.Stars == false) { + return false + } if !(m.WinnersCount == 0) { return false } @@ -7583,9 +7667,11 @@ func (m *MessageActionGiveawayResults) String() string { // FillFrom fills MessageActionGiveawayResults from given interface. func (m *MessageActionGiveawayResults) FillFrom(from interface { + GetStars() (value bool) GetWinnersCount() (value int) GetUnclaimedCount() (value int) }) { + m.Stars = from.GetStars() m.WinnersCount = from.GetWinnersCount() m.UnclaimedCount = from.GetUnclaimedCount() } @@ -7613,6 +7699,11 @@ func (m *MessageActionGiveawayResults) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Stars", + SchemaName: "stars", + Null: !m.Flags.Has(0), + }, { Name: "WinnersCount", SchemaName: "winners_count", @@ -7625,10 +7716,17 @@ func (m *MessageActionGiveawayResults) TypeInfo() tdp.Type { return typ } +// SetFlags sets flags for non-zero fields. +func (m *MessageActionGiveawayResults) SetFlags() { + if !(m.Stars == false) { + m.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (m *MessageActionGiveawayResults) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionGiveawayResults#2a9fadc5 as nil") + return fmt.Errorf("can't encode messageActionGiveawayResults#87e2f155 as nil") } b.PutID(MessageActionGiveawayResultsTypeID) return m.EncodeBare(b) @@ -7637,7 +7735,11 @@ func (m *MessageActionGiveawayResults) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageActionGiveawayResults) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionGiveawayResults#2a9fadc5 as nil") + return fmt.Errorf("can't encode messageActionGiveawayResults#87e2f155 as nil") + } + m.SetFlags() + if err := m.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionGiveawayResults#87e2f155: field flags: %w", err) } b.PutInt(m.WinnersCount) b.PutInt(m.UnclaimedCount) @@ -7647,10 +7749,10 @@ func (m *MessageActionGiveawayResults) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MessageActionGiveawayResults) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionGiveawayResults#2a9fadc5 to nil") + return fmt.Errorf("can't decode messageActionGiveawayResults#87e2f155 to nil") } if err := b.ConsumeID(MessageActionGiveawayResultsTypeID); err != nil { - return fmt.Errorf("unable to decode messageActionGiveawayResults#2a9fadc5: %w", err) + return fmt.Errorf("unable to decode messageActionGiveawayResults#87e2f155: %w", err) } return m.DecodeBare(b) } @@ -7658,25 +7760,50 @@ func (m *MessageActionGiveawayResults) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageActionGiveawayResults) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionGiveawayResults#2a9fadc5 to nil") + return fmt.Errorf("can't decode messageActionGiveawayResults#87e2f155 to nil") } + { + if err := m.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageActionGiveawayResults#87e2f155: field flags: %w", err) + } + } + m.Stars = m.Flags.Has(0) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageActionGiveawayResults#2a9fadc5: field winners_count: %w", err) + return fmt.Errorf("unable to decode messageActionGiveawayResults#87e2f155: field winners_count: %w", err) } m.WinnersCount = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageActionGiveawayResults#2a9fadc5: field unclaimed_count: %w", err) + return fmt.Errorf("unable to decode messageActionGiveawayResults#87e2f155: field unclaimed_count: %w", err) } m.UnclaimedCount = value } return nil } +// SetStars sets value of Stars conditional field. +func (m *MessageActionGiveawayResults) SetStars(value bool) { + if value { + m.Flags.Set(0) + m.Stars = true + } else { + m.Flags.Unset(0) + m.Stars = false + } +} + +// GetStars returns value of Stars conditional field. +func (m *MessageActionGiveawayResults) GetStars() (value bool) { + if m == nil { + return + } + return m.Flags.Has(0) +} + // GetWinnersCount returns value of WinnersCount field. func (m *MessageActionGiveawayResults) GetWinnersCount() (value int) { if m == nil { @@ -7694,10 +7821,17 @@ func (m *MessageActionGiveawayResults) GetUnclaimedCount() (value int) { } // MessageActionBoostApply represents TL type `messageActionBoostApply#cc02aa6d`. +// Some boosts »¹ were applied to the channel or supergroup. +// +// Links: +// 1. https://core.telegram.org/api/boost // // See https://core.telegram.org/constructor/messageActionBoostApply for reference. type MessageActionBoostApply struct { - // Boosts field of MessageActionBoostApply. + // Number of applied boosts¹. + // + // Links: + // 1) https://core.telegram.org/api/boost Boosts int } @@ -7828,12 +7962,21 @@ func (m *MessageActionBoostApply) GetBoosts() (value int) { } // MessageActionRequestedPeerSentMe represents TL type `messageActionRequestedPeerSentMe#93b31848`. +// Contains info about one or more peers that the a user shared with the me (the bot) +// after clicking on a keyboardButtonRequestPeer¹ button (service message received by +// the bot). +// +// Links: +// 1. https://core.telegram.org/constructor/keyboardButtonRequestPeer // // See https://core.telegram.org/constructor/messageActionRequestedPeerSentMe for reference. type MessageActionRequestedPeerSentMe struct { - // ButtonID field of MessageActionRequestedPeerSentMe. + // button_id contained in the keyboardButtonRequestPeer¹ + // + // Links: + // 1) https://core.telegram.org/constructor/keyboardButtonRequestPeer ButtonID int - // Peers field of MessageActionRequestedPeerSentMe. + // Info about the shared peers. Peers []RequestedPeerClass } @@ -8011,6 +8154,942 @@ func (m *MessageActionRequestedPeerSentMe) MapPeers() (value RequestedPeerClassA return RequestedPeerClassArray(m.Peers) } +// MessageActionPaymentRefunded represents TL type `messageActionPaymentRefunded#41b3e202`. +// Describes a payment refund (service message received by both users and bots). +// +// See https://core.telegram.org/constructor/messageActionPaymentRefunded for reference. +type MessageActionPaymentRefunded struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // Identifier of the peer that returned the funds. + Peer PeerClass + // Currency, XTR for Telegram Stars. + Currency string + // Total price in the smallest units of the currency (integer, not float/double). For + // example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in + // currencies.json¹, it shows the number of digits past the decimal point for each + // currency (2 for the majority of currencies). + // + // Links: + // 1) https://core.telegram.org/bots/payments/currencies.json + TotalAmount int64 + // Bot specified invoice payload (only received by bots). + // + // Use SetPayload and GetPayload helpers. + Payload []byte + // Provider payment identifier + Charge PaymentCharge +} + +// MessageActionPaymentRefundedTypeID is TL type id of MessageActionPaymentRefunded. +const MessageActionPaymentRefundedTypeID = 0x41b3e202 + +// construct implements constructor of MessageActionClass. +func (m MessageActionPaymentRefunded) construct() MessageActionClass { return &m } + +// Ensuring interfaces in compile-time for MessageActionPaymentRefunded. +var ( + _ bin.Encoder = &MessageActionPaymentRefunded{} + _ bin.Decoder = &MessageActionPaymentRefunded{} + _ bin.BareEncoder = &MessageActionPaymentRefunded{} + _ bin.BareDecoder = &MessageActionPaymentRefunded{} + + _ MessageActionClass = &MessageActionPaymentRefunded{} +) + +func (m *MessageActionPaymentRefunded) Zero() bool { + if m == nil { + return true + } + if !(m.Flags.Zero()) { + return false + } + if !(m.Peer == nil) { + return false + } + if !(m.Currency == "") { + return false + } + if !(m.TotalAmount == 0) { + return false + } + if !(m.Payload == nil) { + return false + } + if !(m.Charge.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageActionPaymentRefunded) String() string { + if m == nil { + return "MessageActionPaymentRefunded(nil)" + } + type Alias MessageActionPaymentRefunded + return fmt.Sprintf("MessageActionPaymentRefunded%+v", Alias(*m)) +} + +// FillFrom fills MessageActionPaymentRefunded from given interface. +func (m *MessageActionPaymentRefunded) FillFrom(from interface { + GetPeer() (value PeerClass) + GetCurrency() (value string) + GetTotalAmount() (value int64) + GetPayload() (value []byte, ok bool) + GetCharge() (value PaymentCharge) +}) { + m.Peer = from.GetPeer() + m.Currency = from.GetCurrency() + m.TotalAmount = from.GetTotalAmount() + if val, ok := from.GetPayload(); ok { + m.Payload = val + } + + m.Charge = from.GetCharge() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageActionPaymentRefunded) TypeID() uint32 { + return MessageActionPaymentRefundedTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageActionPaymentRefunded) TypeName() string { + return "messageActionPaymentRefunded" +} + +// TypeInfo returns info about TL type. +func (m *MessageActionPaymentRefunded) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageActionPaymentRefunded", + ID: MessageActionPaymentRefundedTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "Currency", + SchemaName: "currency", + }, + { + Name: "TotalAmount", + SchemaName: "total_amount", + }, + { + Name: "Payload", + SchemaName: "payload", + Null: !m.Flags.Has(0), + }, + { + Name: "Charge", + SchemaName: "charge", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (m *MessageActionPaymentRefunded) SetFlags() { + if !(m.Payload == nil) { + m.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (m *MessageActionPaymentRefunded) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionPaymentRefunded#41b3e202 as nil") + } + b.PutID(MessageActionPaymentRefundedTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageActionPaymentRefunded) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionPaymentRefunded#41b3e202 as nil") + } + m.SetFlags() + if err := m.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionPaymentRefunded#41b3e202: field flags: %w", err) + } + if m.Peer == nil { + return fmt.Errorf("unable to encode messageActionPaymentRefunded#41b3e202: field peer is nil") + } + if err := m.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionPaymentRefunded#41b3e202: field peer: %w", err) + } + b.PutString(m.Currency) + b.PutLong(m.TotalAmount) + if m.Flags.Has(0) { + b.PutBytes(m.Payload) + } + if err := m.Charge.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionPaymentRefunded#41b3e202: field charge: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageActionPaymentRefunded) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionPaymentRefunded#41b3e202 to nil") + } + if err := b.ConsumeID(MessageActionPaymentRefundedTypeID); err != nil { + return fmt.Errorf("unable to decode messageActionPaymentRefunded#41b3e202: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageActionPaymentRefunded) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionPaymentRefunded#41b3e202 to nil") + } + { + if err := m.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageActionPaymentRefunded#41b3e202: field flags: %w", err) + } + } + { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode messageActionPaymentRefunded#41b3e202: field peer: %w", err) + } + m.Peer = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageActionPaymentRefunded#41b3e202: field currency: %w", err) + } + m.Currency = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageActionPaymentRefunded#41b3e202: field total_amount: %w", err) + } + m.TotalAmount = value + } + if m.Flags.Has(0) { + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode messageActionPaymentRefunded#41b3e202: field payload: %w", err) + } + m.Payload = value + } + { + if err := m.Charge.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageActionPaymentRefunded#41b3e202: field charge: %w", err) + } + } + return nil +} + +// GetPeer returns value of Peer field. +func (m *MessageActionPaymentRefunded) GetPeer() (value PeerClass) { + if m == nil { + return + } + return m.Peer +} + +// GetCurrency returns value of Currency field. +func (m *MessageActionPaymentRefunded) GetCurrency() (value string) { + if m == nil { + return + } + return m.Currency +} + +// GetTotalAmount returns value of TotalAmount field. +func (m *MessageActionPaymentRefunded) GetTotalAmount() (value int64) { + if m == nil { + return + } + return m.TotalAmount +} + +// SetPayload sets value of Payload conditional field. +func (m *MessageActionPaymentRefunded) SetPayload(value []byte) { + m.Flags.Set(0) + m.Payload = value +} + +// GetPayload returns value of Payload conditional field and +// boolean which is true if field was set. +func (m *MessageActionPaymentRefunded) GetPayload() (value []byte, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(0) { + return value, false + } + return m.Payload, true +} + +// GetCharge returns value of Charge field. +func (m *MessageActionPaymentRefunded) GetCharge() (value PaymentCharge) { + if m == nil { + return + } + return m.Charge +} + +// MessageActionGiftStars represents TL type `messageActionGiftStars#45d5b021`. +// You gifted or were gifted some Telegram Stars¹. +// +// Links: +// 1. https://core.telegram.org/api/stars +// +// See https://core.telegram.org/constructor/messageActionGiftStars for reference. +type MessageActionGiftStars struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // Three-letter ISO 4217 currency¹ code + // + // Links: + // 1) https://core.telegram.org/bots/payments#supported-currencies + Currency string + // Price of the gift in the smallest units of the currency (integer, not float/double). + // For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in + // currencies.json¹, it shows the number of digits past the decimal point for each + // currency (2 for the majority of currencies). + // + // Links: + // 1) https://core.telegram.org/bots/payments/currencies.json + Amount int64 + // Amount of gifted stars + Stars int64 + // If the gift was bought using a cryptocurrency, the cryptocurrency name. + // + // Use SetCryptoCurrency and GetCryptoCurrency helpers. + CryptoCurrency string + // If the gift was bought using a cryptocurrency, price of the gift in the smallest units + // of a cryptocurrency. + // + // Use SetCryptoAmount and GetCryptoAmount helpers. + CryptoAmount int64 + // Identifier of the transaction, only visible to the receiver of the gift. + // + // Use SetTransactionID and GetTransactionID helpers. + TransactionID string +} + +// MessageActionGiftStarsTypeID is TL type id of MessageActionGiftStars. +const MessageActionGiftStarsTypeID = 0x45d5b021 + +// construct implements constructor of MessageActionClass. +func (m MessageActionGiftStars) construct() MessageActionClass { return &m } + +// Ensuring interfaces in compile-time for MessageActionGiftStars. +var ( + _ bin.Encoder = &MessageActionGiftStars{} + _ bin.Decoder = &MessageActionGiftStars{} + _ bin.BareEncoder = &MessageActionGiftStars{} + _ bin.BareDecoder = &MessageActionGiftStars{} + + _ MessageActionClass = &MessageActionGiftStars{} +) + +func (m *MessageActionGiftStars) Zero() bool { + if m == nil { + return true + } + if !(m.Flags.Zero()) { + return false + } + if !(m.Currency == "") { + return false + } + if !(m.Amount == 0) { + return false + } + if !(m.Stars == 0) { + return false + } + if !(m.CryptoCurrency == "") { + return false + } + if !(m.CryptoAmount == 0) { + return false + } + if !(m.TransactionID == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageActionGiftStars) String() string { + if m == nil { + return "MessageActionGiftStars(nil)" + } + type Alias MessageActionGiftStars + return fmt.Sprintf("MessageActionGiftStars%+v", Alias(*m)) +} + +// FillFrom fills MessageActionGiftStars from given interface. +func (m *MessageActionGiftStars) FillFrom(from interface { + GetCurrency() (value string) + GetAmount() (value int64) + GetStars() (value int64) + GetCryptoCurrency() (value string, ok bool) + GetCryptoAmount() (value int64, ok bool) + GetTransactionID() (value string, ok bool) +}) { + m.Currency = from.GetCurrency() + m.Amount = from.GetAmount() + m.Stars = from.GetStars() + if val, ok := from.GetCryptoCurrency(); ok { + m.CryptoCurrency = val + } + + if val, ok := from.GetCryptoAmount(); ok { + m.CryptoAmount = val + } + + if val, ok := from.GetTransactionID(); ok { + m.TransactionID = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageActionGiftStars) TypeID() uint32 { + return MessageActionGiftStarsTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageActionGiftStars) TypeName() string { + return "messageActionGiftStars" +} + +// TypeInfo returns info about TL type. +func (m *MessageActionGiftStars) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageActionGiftStars", + ID: MessageActionGiftStarsTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Currency", + SchemaName: "currency", + }, + { + Name: "Amount", + SchemaName: "amount", + }, + { + Name: "Stars", + SchemaName: "stars", + }, + { + Name: "CryptoCurrency", + SchemaName: "crypto_currency", + Null: !m.Flags.Has(0), + }, + { + Name: "CryptoAmount", + SchemaName: "crypto_amount", + Null: !m.Flags.Has(0), + }, + { + Name: "TransactionID", + SchemaName: "transaction_id", + Null: !m.Flags.Has(1), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (m *MessageActionGiftStars) SetFlags() { + if !(m.CryptoCurrency == "") { + m.Flags.Set(0) + } + if !(m.CryptoAmount == 0) { + m.Flags.Set(0) + } + if !(m.TransactionID == "") { + m.Flags.Set(1) + } +} + +// Encode implements bin.Encoder. +func (m *MessageActionGiftStars) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionGiftStars#45d5b021 as nil") + } + b.PutID(MessageActionGiftStarsTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageActionGiftStars) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionGiftStars#45d5b021 as nil") + } + m.SetFlags() + if err := m.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionGiftStars#45d5b021: field flags: %w", err) + } + b.PutString(m.Currency) + b.PutLong(m.Amount) + b.PutLong(m.Stars) + if m.Flags.Has(0) { + b.PutString(m.CryptoCurrency) + } + if m.Flags.Has(0) { + b.PutLong(m.CryptoAmount) + } + if m.Flags.Has(1) { + b.PutString(m.TransactionID) + } + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageActionGiftStars) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionGiftStars#45d5b021 to nil") + } + if err := b.ConsumeID(MessageActionGiftStarsTypeID); err != nil { + return fmt.Errorf("unable to decode messageActionGiftStars#45d5b021: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageActionGiftStars) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionGiftStars#45d5b021 to nil") + } + { + if err := m.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageActionGiftStars#45d5b021: field flags: %w", err) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageActionGiftStars#45d5b021: field currency: %w", err) + } + m.Currency = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageActionGiftStars#45d5b021: field amount: %w", err) + } + m.Amount = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageActionGiftStars#45d5b021: field stars: %w", err) + } + m.Stars = value + } + if m.Flags.Has(0) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageActionGiftStars#45d5b021: field crypto_currency: %w", err) + } + m.CryptoCurrency = value + } + if m.Flags.Has(0) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageActionGiftStars#45d5b021: field crypto_amount: %w", err) + } + m.CryptoAmount = value + } + if m.Flags.Has(1) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageActionGiftStars#45d5b021: field transaction_id: %w", err) + } + m.TransactionID = value + } + return nil +} + +// GetCurrency returns value of Currency field. +func (m *MessageActionGiftStars) GetCurrency() (value string) { + if m == nil { + return + } + return m.Currency +} + +// GetAmount returns value of Amount field. +func (m *MessageActionGiftStars) GetAmount() (value int64) { + if m == nil { + return + } + return m.Amount +} + +// GetStars returns value of Stars field. +func (m *MessageActionGiftStars) GetStars() (value int64) { + if m == nil { + return + } + return m.Stars +} + +// SetCryptoCurrency sets value of CryptoCurrency conditional field. +func (m *MessageActionGiftStars) SetCryptoCurrency(value string) { + m.Flags.Set(0) + m.CryptoCurrency = value +} + +// GetCryptoCurrency returns value of CryptoCurrency conditional field and +// boolean which is true if field was set. +func (m *MessageActionGiftStars) GetCryptoCurrency() (value string, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(0) { + return value, false + } + return m.CryptoCurrency, true +} + +// SetCryptoAmount sets value of CryptoAmount conditional field. +func (m *MessageActionGiftStars) SetCryptoAmount(value int64) { + m.Flags.Set(0) + m.CryptoAmount = value +} + +// GetCryptoAmount returns value of CryptoAmount conditional field and +// boolean which is true if field was set. +func (m *MessageActionGiftStars) GetCryptoAmount() (value int64, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(0) { + return value, false + } + return m.CryptoAmount, true +} + +// SetTransactionID sets value of TransactionID conditional field. +func (m *MessageActionGiftStars) SetTransactionID(value string) { + m.Flags.Set(1) + m.TransactionID = value +} + +// GetTransactionID returns value of TransactionID conditional field and +// boolean which is true if field was set. +func (m *MessageActionGiftStars) GetTransactionID() (value string, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(1) { + return value, false + } + return m.TransactionID, true +} + +// MessageActionPrizeStars represents TL type `messageActionPrizeStars#b00c47a2`. +// +// See https://core.telegram.org/constructor/messageActionPrizeStars for reference. +type MessageActionPrizeStars struct { + // Flags field of MessageActionPrizeStars. + Flags bin.Fields + // Unclaimed field of MessageActionPrizeStars. + Unclaimed bool + // Stars field of MessageActionPrizeStars. + Stars int64 + // TransactionID field of MessageActionPrizeStars. + TransactionID string + // BoostPeer field of MessageActionPrizeStars. + BoostPeer PeerClass + // GiveawayMsgID field of MessageActionPrizeStars. + GiveawayMsgID int +} + +// MessageActionPrizeStarsTypeID is TL type id of MessageActionPrizeStars. +const MessageActionPrizeStarsTypeID = 0xb00c47a2 + +// construct implements constructor of MessageActionClass. +func (m MessageActionPrizeStars) construct() MessageActionClass { return &m } + +// Ensuring interfaces in compile-time for MessageActionPrizeStars. +var ( + _ bin.Encoder = &MessageActionPrizeStars{} + _ bin.Decoder = &MessageActionPrizeStars{} + _ bin.BareEncoder = &MessageActionPrizeStars{} + _ bin.BareDecoder = &MessageActionPrizeStars{} + + _ MessageActionClass = &MessageActionPrizeStars{} +) + +func (m *MessageActionPrizeStars) Zero() bool { + if m == nil { + return true + } + if !(m.Flags.Zero()) { + return false + } + if !(m.Unclaimed == false) { + return false + } + if !(m.Stars == 0) { + return false + } + if !(m.TransactionID == "") { + return false + } + if !(m.BoostPeer == nil) { + return false + } + if !(m.GiveawayMsgID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageActionPrizeStars) String() string { + if m == nil { + return "MessageActionPrizeStars(nil)" + } + type Alias MessageActionPrizeStars + return fmt.Sprintf("MessageActionPrizeStars%+v", Alias(*m)) +} + +// FillFrom fills MessageActionPrizeStars from given interface. +func (m *MessageActionPrizeStars) FillFrom(from interface { + GetUnclaimed() (value bool) + GetStars() (value int64) + GetTransactionID() (value string) + GetBoostPeer() (value PeerClass) + GetGiveawayMsgID() (value int) +}) { + m.Unclaimed = from.GetUnclaimed() + m.Stars = from.GetStars() + m.TransactionID = from.GetTransactionID() + m.BoostPeer = from.GetBoostPeer() + m.GiveawayMsgID = from.GetGiveawayMsgID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageActionPrizeStars) TypeID() uint32 { + return MessageActionPrizeStarsTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageActionPrizeStars) TypeName() string { + return "messageActionPrizeStars" +} + +// TypeInfo returns info about TL type. +func (m *MessageActionPrizeStars) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageActionPrizeStars", + ID: MessageActionPrizeStarsTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Unclaimed", + SchemaName: "unclaimed", + Null: !m.Flags.Has(0), + }, + { + Name: "Stars", + SchemaName: "stars", + }, + { + Name: "TransactionID", + SchemaName: "transaction_id", + }, + { + Name: "BoostPeer", + SchemaName: "boost_peer", + }, + { + Name: "GiveawayMsgID", + SchemaName: "giveaway_msg_id", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (m *MessageActionPrizeStars) SetFlags() { + if !(m.Unclaimed == false) { + m.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (m *MessageActionPrizeStars) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionPrizeStars#b00c47a2 as nil") + } + b.PutID(MessageActionPrizeStarsTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageActionPrizeStars) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionPrizeStars#b00c47a2 as nil") + } + m.SetFlags() + if err := m.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionPrizeStars#b00c47a2: field flags: %w", err) + } + b.PutLong(m.Stars) + b.PutString(m.TransactionID) + if m.BoostPeer == nil { + return fmt.Errorf("unable to encode messageActionPrizeStars#b00c47a2: field boost_peer is nil") + } + if err := m.BoostPeer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionPrizeStars#b00c47a2: field boost_peer: %w", err) + } + b.PutInt(m.GiveawayMsgID) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageActionPrizeStars) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionPrizeStars#b00c47a2 to nil") + } + if err := b.ConsumeID(MessageActionPrizeStarsTypeID); err != nil { + return fmt.Errorf("unable to decode messageActionPrizeStars#b00c47a2: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageActionPrizeStars) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionPrizeStars#b00c47a2 to nil") + } + { + if err := m.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageActionPrizeStars#b00c47a2: field flags: %w", err) + } + } + m.Unclaimed = m.Flags.Has(0) + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageActionPrizeStars#b00c47a2: field stars: %w", err) + } + m.Stars = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageActionPrizeStars#b00c47a2: field transaction_id: %w", err) + } + m.TransactionID = value + } + { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode messageActionPrizeStars#b00c47a2: field boost_peer: %w", err) + } + m.BoostPeer = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageActionPrizeStars#b00c47a2: field giveaway_msg_id: %w", err) + } + m.GiveawayMsgID = value + } + return nil +} + +// SetUnclaimed sets value of Unclaimed conditional field. +func (m *MessageActionPrizeStars) SetUnclaimed(value bool) { + if value { + m.Flags.Set(0) + m.Unclaimed = true + } else { + m.Flags.Unset(0) + m.Unclaimed = false + } +} + +// GetUnclaimed returns value of Unclaimed conditional field. +func (m *MessageActionPrizeStars) GetUnclaimed() (value bool) { + if m == nil { + return + } + return m.Flags.Has(0) +} + +// GetStars returns value of Stars field. +func (m *MessageActionPrizeStars) GetStars() (value int64) { + if m == nil { + return + } + return m.Stars +} + +// GetTransactionID returns value of TransactionID field. +func (m *MessageActionPrizeStars) GetTransactionID() (value string) { + if m == nil { + return + } + return m.TransactionID +} + +// GetBoostPeer returns value of BoostPeer field. +func (m *MessageActionPrizeStars) GetBoostPeer() (value PeerClass) { + if m == nil { + return + } + return m.BoostPeer +} + +// GetGiveawayMsgID returns value of GiveawayMsgID field. +func (m *MessageActionPrizeStars) GetGiveawayMsgID() (value int) { + if m == nil { + return + } + return m.GiveawayMsgID +} + // MessageActionClassName is schema name of MessageActionClass. const MessageActionClassName = "MessageAction" @@ -8064,10 +9143,13 @@ const MessageActionClassName = "MessageAction" // case *tg.MessageActionRequestedPeer: // messageActionRequestedPeer#31518e9b // case *tg.MessageActionSetChatWallPaper: // messageActionSetChatWallPaper#5060a3f4 // case *tg.MessageActionGiftCode: // messageActionGiftCode#678c2e09 -// case *tg.MessageActionGiveawayLaunch: // messageActionGiveawayLaunch#332ba9ed -// case *tg.MessageActionGiveawayResults: // messageActionGiveawayResults#2a9fadc5 +// case *tg.MessageActionGiveawayLaunch: // messageActionGiveawayLaunch#a80f51e4 +// case *tg.MessageActionGiveawayResults: // messageActionGiveawayResults#87e2f155 // case *tg.MessageActionBoostApply: // messageActionBoostApply#cc02aa6d // case *tg.MessageActionRequestedPeerSentMe: // messageActionRequestedPeerSentMe#93b31848 +// case *tg.MessageActionPaymentRefunded: // messageActionPaymentRefunded#41b3e202 +// case *tg.MessageActionGiftStars: // messageActionGiftStars#45d5b021 +// case *tg.MessageActionPrizeStars: // messageActionPrizeStars#b00c47a2 // default: panic(v) // } type MessageActionClass interface { @@ -8370,14 +9452,14 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) { } return &v, nil case MessageActionGiveawayLaunchTypeID: - // Decoding messageActionGiveawayLaunch#332ba9ed. + // Decoding messageActionGiveawayLaunch#a80f51e4. v := MessageActionGiveawayLaunch{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) } return &v, nil case MessageActionGiveawayResultsTypeID: - // Decoding messageActionGiveawayResults#2a9fadc5. + // Decoding messageActionGiveawayResults#87e2f155. v := MessageActionGiveawayResults{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) @@ -8397,6 +9479,27 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) } return &v, nil + case MessageActionPaymentRefundedTypeID: + // Decoding messageActionPaymentRefunded#41b3e202. + v := MessageActionPaymentRefunded{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) + } + return &v, nil + case MessageActionGiftStarsTypeID: + // Decoding messageActionGiftStars#45d5b021. + v := MessageActionGiftStars{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) + } + return &v, nil + case MessageActionPrizeStarsTypeID: + // Decoding messageActionPrizeStars#b00c47a2. + v := MessageActionPrizeStars{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode MessageActionClass: %w", bin.NewUnexpectedID(id)) } diff --git a/vendor/github.com/gotd/td/tg/tl_message_action_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_message_action_slices_gen.go index 0085aa7b..c2c4a815 100644 --- a/vendor/github.com/gotd/td/tg/tl_message_action_slices_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_message_action_slices_gen.go @@ -532,6 +532,19 @@ func (s MessageActionClassArray) AsMessageActionGiftCode() (to MessageActionGift return to } +// AsMessageActionGiveawayLaunch returns copy with only MessageActionGiveawayLaunch constructors. +func (s MessageActionClassArray) AsMessageActionGiveawayLaunch() (to MessageActionGiveawayLaunchArray) { + for _, elem := range s { + value, ok := elem.(*MessageActionGiveawayLaunch) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // AsMessageActionGiveawayResults returns copy with only MessageActionGiveawayResults constructors. func (s MessageActionClassArray) AsMessageActionGiveawayResults() (to MessageActionGiveawayResultsArray) { for _, elem := range s { @@ -571,6 +584,45 @@ func (s MessageActionClassArray) AsMessageActionRequestedPeerSentMe() (to Messag return to } +// AsMessageActionPaymentRefunded returns copy with only MessageActionPaymentRefunded constructors. +func (s MessageActionClassArray) AsMessageActionPaymentRefunded() (to MessageActionPaymentRefundedArray) { + for _, elem := range s { + value, ok := elem.(*MessageActionPaymentRefunded) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsMessageActionGiftStars returns copy with only MessageActionGiftStars constructors. +func (s MessageActionClassArray) AsMessageActionGiftStars() (to MessageActionGiftStarsArray) { + for _, elem := range s { + value, ok := elem.(*MessageActionGiftStars) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsMessageActionPrizeStars returns copy with only MessageActionPrizeStars constructors. +func (s MessageActionClassArray) AsMessageActionPrizeStars() (to MessageActionPrizeStarsArray) { + for _, elem := range s { + value, ok := elem.(*MessageActionPrizeStars) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // MessageActionChatCreateArray is adapter for slice of MessageActionChatCreate. type MessageActionChatCreateArray []MessageActionChatCreate @@ -3195,6 +3247,88 @@ func (s *MessageActionGiftCodeArray) Pop() (v MessageActionGiftCode, ok bool) { return v, true } +// MessageActionGiveawayLaunchArray is adapter for slice of MessageActionGiveawayLaunch. +type MessageActionGiveawayLaunchArray []MessageActionGiveawayLaunch + +// Sort sorts slice of MessageActionGiveawayLaunch. +func (s MessageActionGiveawayLaunchArray) Sort(less func(a, b MessageActionGiveawayLaunch) bool) MessageActionGiveawayLaunchArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessageActionGiveawayLaunch. +func (s MessageActionGiveawayLaunchArray) SortStable(less func(a, b MessageActionGiveawayLaunch) bool) MessageActionGiveawayLaunchArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessageActionGiveawayLaunch. +func (s MessageActionGiveawayLaunchArray) Retain(keep func(x MessageActionGiveawayLaunch) bool) MessageActionGiveawayLaunchArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s MessageActionGiveawayLaunchArray) First() (v MessageActionGiveawayLaunch, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessageActionGiveawayLaunchArray) Last() (v MessageActionGiveawayLaunch, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *MessageActionGiveawayLaunchArray) PopFirst() (v MessageActionGiveawayLaunch, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero MessageActionGiveawayLaunch + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *MessageActionGiveawayLaunchArray) Pop() (v MessageActionGiveawayLaunch, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + // MessageActionGiveawayResultsArray is adapter for slice of MessageActionGiveawayResults. type MessageActionGiveawayResultsArray []MessageActionGiveawayResults @@ -3440,3 +3574,249 @@ func (s *MessageActionRequestedPeerSentMeArray) Pop() (v MessageActionRequestedP return v, true } + +// MessageActionPaymentRefundedArray is adapter for slice of MessageActionPaymentRefunded. +type MessageActionPaymentRefundedArray []MessageActionPaymentRefunded + +// Sort sorts slice of MessageActionPaymentRefunded. +func (s MessageActionPaymentRefundedArray) Sort(less func(a, b MessageActionPaymentRefunded) bool) MessageActionPaymentRefundedArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessageActionPaymentRefunded. +func (s MessageActionPaymentRefundedArray) SortStable(less func(a, b MessageActionPaymentRefunded) bool) MessageActionPaymentRefundedArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessageActionPaymentRefunded. +func (s MessageActionPaymentRefundedArray) Retain(keep func(x MessageActionPaymentRefunded) bool) MessageActionPaymentRefundedArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s MessageActionPaymentRefundedArray) First() (v MessageActionPaymentRefunded, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessageActionPaymentRefundedArray) Last() (v MessageActionPaymentRefunded, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *MessageActionPaymentRefundedArray) PopFirst() (v MessageActionPaymentRefunded, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero MessageActionPaymentRefunded + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *MessageActionPaymentRefundedArray) Pop() (v MessageActionPaymentRefunded, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// MessageActionGiftStarsArray is adapter for slice of MessageActionGiftStars. +type MessageActionGiftStarsArray []MessageActionGiftStars + +// Sort sorts slice of MessageActionGiftStars. +func (s MessageActionGiftStarsArray) Sort(less func(a, b MessageActionGiftStars) bool) MessageActionGiftStarsArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessageActionGiftStars. +func (s MessageActionGiftStarsArray) SortStable(less func(a, b MessageActionGiftStars) bool) MessageActionGiftStarsArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessageActionGiftStars. +func (s MessageActionGiftStarsArray) Retain(keep func(x MessageActionGiftStars) bool) MessageActionGiftStarsArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s MessageActionGiftStarsArray) First() (v MessageActionGiftStars, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessageActionGiftStarsArray) Last() (v MessageActionGiftStars, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *MessageActionGiftStarsArray) PopFirst() (v MessageActionGiftStars, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero MessageActionGiftStars + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *MessageActionGiftStarsArray) Pop() (v MessageActionGiftStars, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// MessageActionPrizeStarsArray is adapter for slice of MessageActionPrizeStars. +type MessageActionPrizeStarsArray []MessageActionPrizeStars + +// Sort sorts slice of MessageActionPrizeStars. +func (s MessageActionPrizeStarsArray) Sort(less func(a, b MessageActionPrizeStars) bool) MessageActionPrizeStarsArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessageActionPrizeStars. +func (s MessageActionPrizeStarsArray) SortStable(less func(a, b MessageActionPrizeStars) bool) MessageActionPrizeStarsArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessageActionPrizeStars. +func (s MessageActionPrizeStarsArray) Retain(keep func(x MessageActionPrizeStars) bool) MessageActionPrizeStarsArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s MessageActionPrizeStarsArray) First() (v MessageActionPrizeStars, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessageActionPrizeStarsArray) Last() (v MessageActionPrizeStars, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *MessageActionPrizeStarsArray) PopFirst() (v MessageActionPrizeStars, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero MessageActionPrizeStars + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *MessageActionPrizeStarsArray) Pop() (v MessageActionPrizeStars, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/vendor/github.com/gotd/td/tg/tl_message_entity_gen.go b/vendor/github.com/gotd/td/tg/tl_message_entity_gen.go index 34211b4f..254c18d6 100644 --- a/vendor/github.com/gotd/td/tg/tl_message_entity_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_message_entity_gen.go @@ -3582,9 +3582,12 @@ func (m *MessageEntityCustomEmoji) GetDocumentID() (value int64) { // // See https://core.telegram.org/constructor/messageEntityBlockquote for reference. type MessageEntityBlockquote struct { - // Flags field of MessageEntityBlockquote. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Collapsed field of MessageEntityBlockquote. + // Whether the quote is collapsed by default. Collapsed bool // Offset of message entity within message (in UTF-16 code units¹) // diff --git a/vendor/github.com/gotd/td/tg/tl_message_extended_media_gen.go b/vendor/github.com/gotd/td/tg/tl_message_extended_media_gen.go index 7711947d..130300fa 100644 --- a/vendor/github.com/gotd/td/tg/tl_message_extended_media_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_message_extended_media_gen.go @@ -32,7 +32,10 @@ var ( ) // MessageExtendedMediaPreview represents TL type `messageExtendedMediaPreview#ad628cc8`. -// Extended media preview +// Paid media preview for not yet purchased paid media, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/paid-media // // See https://core.telegram.org/constructor/messageExtendedMediaPreview for reference. type MessageExtendedMediaPreview struct { @@ -49,11 +52,14 @@ type MessageExtendedMediaPreview struct { // // Use SetH and GetH helpers. H int - // Thumbnail + // Extremely low resolution thumbnail¹. + // + // Links: + // 1) https://core.telegram.org/api/files#stripped-thumbnails // // Use SetThumb and GetThumb helpers. Thumb PhotoSizeClass - // Video duration + // Video duration for videos. // // Use SetVideoDuration and GetVideoDuration helpers. VideoDuration int @@ -358,11 +364,14 @@ func (m *MessageExtendedMediaPreview) GetVideoDuration() (value int, ok bool) { } // MessageExtendedMedia represents TL type `messageExtendedMedia#ee479c64`. -// Extended media +// Already purchased paid media, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/paid-media // // See https://core.telegram.org/constructor/messageExtendedMedia for reference. type MessageExtendedMedia struct { - // Media + // The media we purchased. Media MessageMediaClass } diff --git a/vendor/github.com/gotd/td/tg/tl_message_gen.go b/vendor/github.com/gotd/td/tg/tl_message_gen.go index 245782e2..a89e6f0c 100644 --- a/vendor/github.com/gotd/td/tg/tl_message_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_message_gen.go @@ -288,9 +288,13 @@ type Message struct { // If set, any eventual webpage preview will be shown on top of the message instead of at // the bottom. InvertMedia bool - // Flags2 field of Message. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags2 bin.Fields - // Offline field of Message. + // If set, the message was sent because of a scheduled action by the message sender, for + // example, as away, or a greeting service message. Offline bool // ID of the message ID int @@ -298,7 +302,19 @@ type Message struct { // // Use SetFromID and GetFromID helpers. FromID PeerClass - // FromBoostsApplied field of Message. + // Supergroups only, contains the number of boosts¹ this user has given the current + // supergroup, and should be shown in the UI in the header of the message. Only present + // for incoming messages from non-anonymous supergroup members that have boosted the + // supergroup. Note that this counter should be locally overridden for non-anonymous + // outgoing messages, according to the current value of channelFull².boosts_applied, to + // ensure the value is correct even for messages sent by the current user before a + // supergroup was boosted (or after a boost has expired or the number of boosts has + // changed); do not update this value for incoming messages from other users, even if + // their boosts have changed. + // + // Links: + // 1) https://core.telegram.org/api/boost + // 2) https://core.telegram.org/constructor/channelFull // // Use SetFromBoostsApplied and GetFromBoostsApplied helpers. FromBoostsApplied int @@ -321,7 +337,11 @@ type Message struct { // // Use SetViaBotID and GetViaBotID helpers. ViaBotID int64 - // ViaBusinessBotID field of Message. + // Whether the message was sent by the business bot¹ specified in via_bot_id on behalf + // of the user. + // + // Links: + // 1) https://core.telegram.org/api/business#connected-bots // // Use SetViaBusinessBotID and GetViaBusinessBotID helpers. ViaBusinessBotID int64 @@ -393,15 +413,25 @@ type Message struct { // // Use SetTTLPeriod and GetTTLPeriod helpers. TTLPeriod int - // QuickReplyShortcutID field of Message. + // If set, this message is a quick reply shortcut message »¹ (note that quick reply + // shortcut messages sent to a private chat will not have this field set). + // + // Links: + // 1) https://core.telegram.org/api/business#quick-reply-shortcuts // // Use SetQuickReplyShortcutID and GetQuickReplyShortcutID helpers. QuickReplyShortcutID int - // Effect field of Message. + // A message effect that should be played as specified here »¹. + // + // Links: + // 1) https://core.telegram.org/api/effects // // Use SetEffect and GetEffect helpers. Effect int64 - // Factcheck field of Message. + // Represents a fact-check »¹. + // + // Links: + // 1) https://core.telegram.org/api/factcheck // // Use SetFactcheck and GetFactcheck helpers. Factcheck FactCheck diff --git a/vendor/github.com/gotd/td/tg/tl_message_media_gen.go b/vendor/github.com/gotd/td/tg/tl_message_media_gen.go index e08698cf..e408a3bf 100644 --- a/vendor/github.com/gotd/td/tg/tl_message_media_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_message_media_gen.go @@ -2095,10 +2095,11 @@ type MessageMediaInvoice struct { // // Use SetReceiptMsgID and GetReceiptMsgID helpers. ReceiptMsgID int - // Three-letter ISO 4217 currency¹ code + // Three-letter ISO 4217 currency¹ code, or XTR for Telegram Stars². // // Links: // 1) https://core.telegram.org/bots/payments#supported-currencies + // 2) https://core.telegram.org/api/stars Currency string // Total price in the smallest units of the currency (integer, not float/double). For // example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in @@ -2110,7 +2111,7 @@ type MessageMediaInvoice struct { TotalAmount int64 // Unique bot deep-linking parameter that can be used to generate this invoice StartParam string - // Extended media + // Deprecated // // Use SetExtendedMedia and GetExtendedMedia helpers. ExtendedMedia MessageExtendedMediaClass @@ -3475,7 +3476,7 @@ func (m *MessageMediaStory) GetStory() (value StoryItemClass, ok bool) { return m.Story, true } -// MessageMediaGiveaway represents TL type `messageMediaGiveaway#daad85b0`. +// MessageMediaGiveaway represents TL type `messageMediaGiveaway#aa073beb`. // Contains info about a giveaway, see here »¹ for more info. // // Links: @@ -3519,13 +3520,19 @@ type MessageMediaGiveaway struct { // // Links: // 1) https://core.telegram.org/api/premium + // + // Use SetMonths and GetMonths helpers. Months int + // Stars field of MessageMediaGiveaway. + // + // Use SetStars and GetStars helpers. + Stars int64 // The end date of the giveaway. UntilDate int } // MessageMediaGiveawayTypeID is TL type id of MessageMediaGiveaway. -const MessageMediaGiveawayTypeID = 0xdaad85b0 +const MessageMediaGiveawayTypeID = 0xaa073beb // construct implements constructor of MessageMediaClass. func (m MessageMediaGiveaway) construct() MessageMediaClass { return &m } @@ -3568,6 +3575,9 @@ func (m *MessageMediaGiveaway) Zero() bool { if !(m.Months == 0) { return false } + if !(m.Stars == 0) { + return false + } if !(m.UntilDate == 0) { return false } @@ -3592,7 +3602,8 @@ func (m *MessageMediaGiveaway) FillFrom(from interface { GetCountriesISO2() (value []string, ok bool) GetPrizeDescription() (value string, ok bool) GetQuantity() (value int) - GetMonths() (value int) + GetMonths() (value int, ok bool) + GetStars() (value int64, ok bool) GetUntilDate() (value int) }) { m.OnlyNewSubscribers = from.GetOnlyNewSubscribers() @@ -3607,7 +3618,14 @@ func (m *MessageMediaGiveaway) FillFrom(from interface { } m.Quantity = from.GetQuantity() - m.Months = from.GetMonths() + if val, ok := from.GetMonths(); ok { + m.Months = val + } + + if val, ok := from.GetStars(); ok { + m.Stars = val + } + m.UntilDate = from.GetUntilDate() } @@ -3665,6 +3683,12 @@ func (m *MessageMediaGiveaway) TypeInfo() tdp.Type { { Name: "Months", SchemaName: "months", + Null: !m.Flags.Has(4), + }, + { + Name: "Stars", + SchemaName: "stars", + Null: !m.Flags.Has(5), }, { Name: "UntilDate", @@ -3688,12 +3712,18 @@ func (m *MessageMediaGiveaway) SetFlags() { if !(m.PrizeDescription == "") { m.Flags.Set(3) } + if !(m.Months == 0) { + m.Flags.Set(4) + } + if !(m.Stars == 0) { + m.Flags.Set(5) + } } // Encode implements bin.Encoder. func (m *MessageMediaGiveaway) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageMediaGiveaway#daad85b0 as nil") + return fmt.Errorf("can't encode messageMediaGiveaway#aa073beb as nil") } b.PutID(MessageMediaGiveawayTypeID) return m.EncodeBare(b) @@ -3702,11 +3732,11 @@ func (m *MessageMediaGiveaway) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageMediaGiveaway) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageMediaGiveaway#daad85b0 as nil") + return fmt.Errorf("can't encode messageMediaGiveaway#aa073beb as nil") } m.SetFlags() if err := m.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageMediaGiveaway#daad85b0: field flags: %w", err) + return fmt.Errorf("unable to encode messageMediaGiveaway#aa073beb: field flags: %w", err) } b.PutVectorHeader(len(m.Channels)) for _, v := range m.Channels { @@ -3722,7 +3752,12 @@ func (m *MessageMediaGiveaway) EncodeBare(b *bin.Buffer) error { b.PutString(m.PrizeDescription) } b.PutInt(m.Quantity) - b.PutInt(m.Months) + if m.Flags.Has(4) { + b.PutInt(m.Months) + } + if m.Flags.Has(5) { + b.PutLong(m.Stars) + } b.PutInt(m.UntilDate) return nil } @@ -3730,10 +3765,10 @@ func (m *MessageMediaGiveaway) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MessageMediaGiveaway) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageMediaGiveaway#daad85b0 to nil") + return fmt.Errorf("can't decode messageMediaGiveaway#aa073beb to nil") } if err := b.ConsumeID(MessageMediaGiveawayTypeID); err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#aa073beb: %w", err) } return m.DecodeBare(b) } @@ -3741,11 +3776,11 @@ func (m *MessageMediaGiveaway) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageMediaGiveaway) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageMediaGiveaway#daad85b0 to nil") + return fmt.Errorf("can't decode messageMediaGiveaway#aa073beb to nil") } { if err := m.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field flags: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#aa073beb: field flags: %w", err) } } m.OnlyNewSubscribers = m.Flags.Has(0) @@ -3753,7 +3788,7 @@ func (m *MessageMediaGiveaway) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field channels: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#aa073beb: field channels: %w", err) } if headerLen > 0 { @@ -3762,7 +3797,7 @@ func (m *MessageMediaGiveaway) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field channels: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#aa073beb: field channels: %w", err) } m.Channels = append(m.Channels, value) } @@ -3770,7 +3805,7 @@ func (m *MessageMediaGiveaway) DecodeBare(b *bin.Buffer) error { if m.Flags.Has(1) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field countries_iso2: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#aa073beb: field countries_iso2: %w", err) } if headerLen > 0 { @@ -3779,7 +3814,7 @@ func (m *MessageMediaGiveaway) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field countries_iso2: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#aa073beb: field countries_iso2: %w", err) } m.CountriesISO2 = append(m.CountriesISO2, value) } @@ -3787,28 +3822,35 @@ func (m *MessageMediaGiveaway) DecodeBare(b *bin.Buffer) error { if m.Flags.Has(3) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field prize_description: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#aa073beb: field prize_description: %w", err) } m.PrizeDescription = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field quantity: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#aa073beb: field quantity: %w", err) } m.Quantity = value } - { + if m.Flags.Has(4) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field months: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#aa073beb: field months: %w", err) } m.Months = value } + if m.Flags.Has(5) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageMediaGiveaway#aa073beb: field stars: %w", err) + } + m.Stars = value + } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field until_date: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#aa073beb: field until_date: %w", err) } m.UntilDate = value } @@ -3905,12 +3947,40 @@ func (m *MessageMediaGiveaway) GetQuantity() (value int) { return m.Quantity } -// GetMonths returns value of Months field. -func (m *MessageMediaGiveaway) GetMonths() (value int) { +// SetMonths sets value of Months conditional field. +func (m *MessageMediaGiveaway) SetMonths(value int) { + m.Flags.Set(4) + m.Months = value +} + +// GetMonths returns value of Months conditional field and +// boolean which is true if field was set. +func (m *MessageMediaGiveaway) GetMonths() (value int, ok bool) { if m == nil { return } - return m.Months + if !m.Flags.Has(4) { + return value, false + } + return m.Months, true +} + +// SetStars sets value of Stars conditional field. +func (m *MessageMediaGiveaway) SetStars(value int64) { + m.Flags.Set(5) + m.Stars = value +} + +// GetStars returns value of Stars conditional field and +// boolean which is true if field was set. +func (m *MessageMediaGiveaway) GetStars() (value int64, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(5) { + return value, false + } + return m.Stars, true } // GetUntilDate returns value of UntilDate field. @@ -3921,7 +3991,7 @@ func (m *MessageMediaGiveaway) GetUntilDate() (value int) { return m.UntilDate } -// MessageMediaGiveawayResults represents TL type `messageMediaGiveawayResults#c6991068`. +// MessageMediaGiveawayResults represents TL type `messageMediaGiveawayResults#ceaa3ea1`. // A giveaway¹ with public winners has finished, this constructor contains info about // the winners. // @@ -3940,8 +4010,8 @@ type MessageMediaGiveawayResults struct { OnlyNewSubscribers bool // If set, the giveaway was canceled and was fully refunded. Refunded bool - // ID of the channel that was automatically boosted¹ by the winners of the giveaway for - // duration of the Premium subscription. + // ID of the channel/supergroup that was automatically boosted¹ by the winners of the + // giveaway for duration of the Premium subscription. // // Links: // 1) https://core.telegram.org/api/boost @@ -3962,7 +4032,13 @@ type MessageMediaGiveawayResults struct { // // Links: // 1) https://core.telegram.org/api/premium + // + // Use SetMonths and GetMonths helpers. Months int + // Stars field of MessageMediaGiveawayResults. + // + // Use SetStars and GetStars helpers. + Stars int64 // Can contain a textual description of additional giveaway prizes. // // Use SetPrizeDescription and GetPrizeDescription helpers. @@ -3973,7 +4049,7 @@ type MessageMediaGiveawayResults struct { } // MessageMediaGiveawayResultsTypeID is TL type id of MessageMediaGiveawayResults. -const MessageMediaGiveawayResultsTypeID = 0xc6991068 +const MessageMediaGiveawayResultsTypeID = 0xceaa3ea1 // construct implements constructor of MessageMediaClass. func (m MessageMediaGiveawayResults) construct() MessageMediaClass { return &m } @@ -4022,6 +4098,9 @@ func (m *MessageMediaGiveawayResults) Zero() bool { if !(m.Months == 0) { return false } + if !(m.Stars == 0) { + return false + } if !(m.PrizeDescription == "") { return false } @@ -4051,7 +4130,8 @@ func (m *MessageMediaGiveawayResults) FillFrom(from interface { GetWinnersCount() (value int) GetUnclaimedCount() (value int) GetWinners() (value []int64) - GetMonths() (value int) + GetMonths() (value int, ok bool) + GetStars() (value int64, ok bool) GetPrizeDescription() (value string, ok bool) GetUntilDate() (value int) }) { @@ -4066,7 +4146,14 @@ func (m *MessageMediaGiveawayResults) FillFrom(from interface { m.WinnersCount = from.GetWinnersCount() m.UnclaimedCount = from.GetUnclaimedCount() m.Winners = from.GetWinners() - m.Months = from.GetMonths() + if val, ok := from.GetMonths(); ok { + m.Months = val + } + + if val, ok := from.GetStars(); ok { + m.Stars = val + } + if val, ok := from.GetPrizeDescription(); ok { m.PrizeDescription = val } @@ -4135,6 +4222,12 @@ func (m *MessageMediaGiveawayResults) TypeInfo() tdp.Type { { Name: "Months", SchemaName: "months", + Null: !m.Flags.Has(4), + }, + { + Name: "Stars", + SchemaName: "stars", + Null: !m.Flags.Has(5), }, { Name: "PrizeDescription", @@ -4160,6 +4253,12 @@ func (m *MessageMediaGiveawayResults) SetFlags() { if !(m.AdditionalPeersCount == 0) { m.Flags.Set(3) } + if !(m.Months == 0) { + m.Flags.Set(4) + } + if !(m.Stars == 0) { + m.Flags.Set(5) + } if !(m.PrizeDescription == "") { m.Flags.Set(1) } @@ -4168,7 +4267,7 @@ func (m *MessageMediaGiveawayResults) SetFlags() { // Encode implements bin.Encoder. func (m *MessageMediaGiveawayResults) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageMediaGiveawayResults#c6991068 as nil") + return fmt.Errorf("can't encode messageMediaGiveawayResults#ceaa3ea1 as nil") } b.PutID(MessageMediaGiveawayResultsTypeID) return m.EncodeBare(b) @@ -4177,11 +4276,11 @@ func (m *MessageMediaGiveawayResults) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageMediaGiveawayResults) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageMediaGiveawayResults#c6991068 as nil") + return fmt.Errorf("can't encode messageMediaGiveawayResults#ceaa3ea1 as nil") } m.SetFlags() if err := m.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageMediaGiveawayResults#c6991068: field flags: %w", err) + return fmt.Errorf("unable to encode messageMediaGiveawayResults#ceaa3ea1: field flags: %w", err) } b.PutLong(m.ChannelID) if m.Flags.Has(3) { @@ -4194,7 +4293,12 @@ func (m *MessageMediaGiveawayResults) EncodeBare(b *bin.Buffer) error { for _, v := range m.Winners { b.PutLong(v) } - b.PutInt(m.Months) + if m.Flags.Has(4) { + b.PutInt(m.Months) + } + if m.Flags.Has(5) { + b.PutLong(m.Stars) + } if m.Flags.Has(1) { b.PutString(m.PrizeDescription) } @@ -4205,10 +4309,10 @@ func (m *MessageMediaGiveawayResults) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MessageMediaGiveawayResults) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageMediaGiveawayResults#c6991068 to nil") + return fmt.Errorf("can't decode messageMediaGiveawayResults#ceaa3ea1 to nil") } if err := b.ConsumeID(MessageMediaGiveawayResultsTypeID); err != nil { - return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveawayResults#ceaa3ea1: %w", err) } return m.DecodeBare(b) } @@ -4216,11 +4320,11 @@ func (m *MessageMediaGiveawayResults) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageMediaGiveawayResults) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageMediaGiveawayResults#c6991068 to nil") + return fmt.Errorf("can't decode messageMediaGiveawayResults#ceaa3ea1 to nil") } { if err := m.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field flags: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveawayResults#ceaa3ea1: field flags: %w", err) } } m.OnlyNewSubscribers = m.Flags.Has(0) @@ -4228,42 +4332,42 @@ func (m *MessageMediaGiveawayResults) DecodeBare(b *bin.Buffer) error { { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field channel_id: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveawayResults#ceaa3ea1: field channel_id: %w", err) } m.ChannelID = value } if m.Flags.Has(3) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field additional_peers_count: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveawayResults#ceaa3ea1: field additional_peers_count: %w", err) } m.AdditionalPeersCount = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field launch_msg_id: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveawayResults#ceaa3ea1: field launch_msg_id: %w", err) } m.LaunchMsgID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field winners_count: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveawayResults#ceaa3ea1: field winners_count: %w", err) } m.WinnersCount = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field unclaimed_count: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveawayResults#ceaa3ea1: field unclaimed_count: %w", err) } m.UnclaimedCount = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field winners: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveawayResults#ceaa3ea1: field winners: %w", err) } if headerLen > 0 { @@ -4272,29 +4376,36 @@ func (m *MessageMediaGiveawayResults) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field winners: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveawayResults#ceaa3ea1: field winners: %w", err) } m.Winners = append(m.Winners, value) } } - { + if m.Flags.Has(4) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field months: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveawayResults#ceaa3ea1: field months: %w", err) } m.Months = value } + if m.Flags.Has(5) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageMediaGiveawayResults#ceaa3ea1: field stars: %w", err) + } + m.Stars = value + } if m.Flags.Has(1) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field prize_description: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveawayResults#ceaa3ea1: field prize_description: %w", err) } m.PrizeDescription = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field until_date: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveawayResults#ceaa3ea1: field until_date: %w", err) } m.UntilDate = value } @@ -4397,12 +4508,40 @@ func (m *MessageMediaGiveawayResults) GetWinners() (value []int64) { return m.Winners } -// GetMonths returns value of Months field. -func (m *MessageMediaGiveawayResults) GetMonths() (value int) { +// SetMonths sets value of Months conditional field. +func (m *MessageMediaGiveawayResults) SetMonths(value int) { + m.Flags.Set(4) + m.Months = value +} + +// GetMonths returns value of Months conditional field and +// boolean which is true if field was set. +func (m *MessageMediaGiveawayResults) GetMonths() (value int, ok bool) { if m == nil { return } - return m.Months + if !m.Flags.Has(4) { + return value, false + } + return m.Months, true +} + +// SetStars sets value of Stars conditional field. +func (m *MessageMediaGiveawayResults) SetStars(value int64) { + m.Flags.Set(5) + m.Stars = value +} + +// GetStars returns value of Stars conditional field and +// boolean which is true if field was set. +func (m *MessageMediaGiveawayResults) GetStars() (value int64, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(5) { + return value, false + } + return m.Stars, true } // SetPrizeDescription sets value of PrizeDescription conditional field. @@ -4431,6 +4570,201 @@ func (m *MessageMediaGiveawayResults) GetUntilDate() (value int) { return m.UntilDate } +// MessageMediaPaidMedia represents TL type `messageMediaPaidMedia#a8852491`. +// Paid media, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/paid-media +// +// See https://core.telegram.org/constructor/messageMediaPaidMedia for reference. +type MessageMediaPaidMedia struct { + // The price of the media in Telegram Stars¹. + // + // Links: + // 1) https://core.telegram.org/api/stars + StarsAmount int64 + // Either the paid-for media, or super low resolution media previews if the media wasn't + // purchased yet, see here »¹ for more info. + // + // Links: + // 1) https://core.telegram.org/api/paid-media#viewing-paid-media + ExtendedMedia []MessageExtendedMediaClass +} + +// MessageMediaPaidMediaTypeID is TL type id of MessageMediaPaidMedia. +const MessageMediaPaidMediaTypeID = 0xa8852491 + +// construct implements constructor of MessageMediaClass. +func (m MessageMediaPaidMedia) construct() MessageMediaClass { return &m } + +// Ensuring interfaces in compile-time for MessageMediaPaidMedia. +var ( + _ bin.Encoder = &MessageMediaPaidMedia{} + _ bin.Decoder = &MessageMediaPaidMedia{} + _ bin.BareEncoder = &MessageMediaPaidMedia{} + _ bin.BareDecoder = &MessageMediaPaidMedia{} + + _ MessageMediaClass = &MessageMediaPaidMedia{} +) + +func (m *MessageMediaPaidMedia) Zero() bool { + if m == nil { + return true + } + if !(m.StarsAmount == 0) { + return false + } + if !(m.ExtendedMedia == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageMediaPaidMedia) String() string { + if m == nil { + return "MessageMediaPaidMedia(nil)" + } + type Alias MessageMediaPaidMedia + return fmt.Sprintf("MessageMediaPaidMedia%+v", Alias(*m)) +} + +// FillFrom fills MessageMediaPaidMedia from given interface. +func (m *MessageMediaPaidMedia) FillFrom(from interface { + GetStarsAmount() (value int64) + GetExtendedMedia() (value []MessageExtendedMediaClass) +}) { + m.StarsAmount = from.GetStarsAmount() + m.ExtendedMedia = from.GetExtendedMedia() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageMediaPaidMedia) TypeID() uint32 { + return MessageMediaPaidMediaTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageMediaPaidMedia) TypeName() string { + return "messageMediaPaidMedia" +} + +// TypeInfo returns info about TL type. +func (m *MessageMediaPaidMedia) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageMediaPaidMedia", + ID: MessageMediaPaidMediaTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "StarsAmount", + SchemaName: "stars_amount", + }, + { + Name: "ExtendedMedia", + SchemaName: "extended_media", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessageMediaPaidMedia) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageMediaPaidMedia#a8852491 as nil") + } + b.PutID(MessageMediaPaidMediaTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageMediaPaidMedia) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageMediaPaidMedia#a8852491 as nil") + } + b.PutLong(m.StarsAmount) + b.PutVectorHeader(len(m.ExtendedMedia)) + for idx, v := range m.ExtendedMedia { + if v == nil { + return fmt.Errorf("unable to encode messageMediaPaidMedia#a8852491: field extended_media element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageMediaPaidMedia#a8852491: field extended_media element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageMediaPaidMedia) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageMediaPaidMedia#a8852491 to nil") + } + if err := b.ConsumeID(MessageMediaPaidMediaTypeID); err != nil { + return fmt.Errorf("unable to decode messageMediaPaidMedia#a8852491: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageMediaPaidMedia) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageMediaPaidMedia#a8852491 to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageMediaPaidMedia#a8852491: field stars_amount: %w", err) + } + m.StarsAmount = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode messageMediaPaidMedia#a8852491: field extended_media: %w", err) + } + + if headerLen > 0 { + m.ExtendedMedia = make([]MessageExtendedMediaClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeMessageExtendedMedia(b) + if err != nil { + return fmt.Errorf("unable to decode messageMediaPaidMedia#a8852491: field extended_media: %w", err) + } + m.ExtendedMedia = append(m.ExtendedMedia, value) + } + } + return nil +} + +// GetStarsAmount returns value of StarsAmount field. +func (m *MessageMediaPaidMedia) GetStarsAmount() (value int64) { + if m == nil { + return + } + return m.StarsAmount +} + +// GetExtendedMedia returns value of ExtendedMedia field. +func (m *MessageMediaPaidMedia) GetExtendedMedia() (value []MessageExtendedMediaClass) { + if m == nil { + return + } + return m.ExtendedMedia +} + +// MapExtendedMedia returns field ExtendedMedia wrapped in MessageExtendedMediaClassArray helper. +func (m *MessageMediaPaidMedia) MapExtendedMedia() (value MessageExtendedMediaClassArray) { + return MessageExtendedMediaClassArray(m.ExtendedMedia) +} + // MessageMediaClassName is schema name of MessageMediaClass. const MessageMediaClassName = "MessageMedia" @@ -4459,8 +4793,9 @@ const MessageMediaClassName = "MessageMedia" // case *tg.MessageMediaPoll: // messageMediaPoll#4bd6e798 // case *tg.MessageMediaDice: // messageMediaDice#3f7ee58b // case *tg.MessageMediaStory: // messageMediaStory#68cb6283 -// case *tg.MessageMediaGiveaway: // messageMediaGiveaway#daad85b0 -// case *tg.MessageMediaGiveawayResults: // messageMediaGiveawayResults#c6991068 +// case *tg.MessageMediaGiveaway: // messageMediaGiveaway#aa073beb +// case *tg.MessageMediaGiveawayResults: // messageMediaGiveawayResults#ceaa3ea1 +// case *tg.MessageMediaPaidMedia: // messageMediaPaidMedia#a8852491 // default: panic(v) // } type MessageMediaClass interface { @@ -4588,19 +4923,26 @@ func DecodeMessageMedia(buf *bin.Buffer) (MessageMediaClass, error) { } return &v, nil case MessageMediaGiveawayTypeID: - // Decoding messageMediaGiveaway#daad85b0. + // Decoding messageMediaGiveaway#aa073beb. v := MessageMediaGiveaway{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", err) } return &v, nil case MessageMediaGiveawayResultsTypeID: - // Decoding messageMediaGiveawayResults#c6991068. + // Decoding messageMediaGiveawayResults#ceaa3ea1. v := MessageMediaGiveawayResults{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", err) } return &v, nil + case MessageMediaPaidMediaTypeID: + // Decoding messageMediaPaidMedia#a8852491. + v := MessageMediaPaidMedia{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", bin.NewUnexpectedID(id)) } diff --git a/vendor/github.com/gotd/td/tg/tl_message_media_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_message_media_slices_gen.go index 04f8ec7f..06627f62 100644 --- a/vendor/github.com/gotd/td/tg/tl_message_media_slices_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_message_media_slices_gen.go @@ -298,6 +298,19 @@ func (s MessageMediaClassArray) AsMessageMediaGiveawayResults() (to MessageMedia return to } +// AsMessageMediaPaidMedia returns copy with only MessageMediaPaidMedia constructors. +func (s MessageMediaClassArray) AsMessageMediaPaidMedia() (to MessageMediaPaidMediaArray) { + for _, elem := range s { + value, ok := elem.(*MessageMediaPaidMedia) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // MessageMediaPhotoArray is adapter for slice of MessageMediaPhoto. type MessageMediaPhotoArray []MessageMediaPhoto @@ -1473,3 +1486,85 @@ func (s *MessageMediaGiveawayResultsArray) Pop() (v MessageMediaGiveawayResults, return v, true } + +// MessageMediaPaidMediaArray is adapter for slice of MessageMediaPaidMedia. +type MessageMediaPaidMediaArray []MessageMediaPaidMedia + +// Sort sorts slice of MessageMediaPaidMedia. +func (s MessageMediaPaidMediaArray) Sort(less func(a, b MessageMediaPaidMedia) bool) MessageMediaPaidMediaArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessageMediaPaidMedia. +func (s MessageMediaPaidMediaArray) SortStable(less func(a, b MessageMediaPaidMedia) bool) MessageMediaPaidMediaArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessageMediaPaidMedia. +func (s MessageMediaPaidMediaArray) Retain(keep func(x MessageMediaPaidMedia) bool) MessageMediaPaidMediaArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s MessageMediaPaidMediaArray) First() (v MessageMediaPaidMedia, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessageMediaPaidMediaArray) Last() (v MessageMediaPaidMedia, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *MessageMediaPaidMediaArray) PopFirst() (v MessageMediaPaidMedia, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero MessageMediaPaidMedia + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *MessageMediaPaidMediaArray) Pop() (v MessageMediaPaidMedia, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/vendor/github.com/gotd/td/tg/tl_message_reactions_gen.go b/vendor/github.com/gotd/td/tg/tl_message_reactions_gen.go index 0721d445..b92b745a 100644 --- a/vendor/github.com/gotd/td/tg/tl_message_reactions_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_message_reactions_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessageReactions represents TL type `messageReactions#4f2b9479`. +// MessageReactions represents TL type `messageReactions#a339f0b`. // Message reactions »¹ // // Links: @@ -59,7 +59,11 @@ type MessageReactions struct { // Links: // 1) https://core.telegram.org/method/messages.getMessageReactionsList CanSeeList bool - // ReactionsAsTags field of MessageReactions. + // If set or if there are no reactions, all present and future reactions should be + // treated as message tags, see here » for more info¹. + // + // Links: + // 1) https://core.telegram.org/api/saved-messages#tags ReactionsAsTags bool // Reactions Results []ReactionCount @@ -67,10 +71,14 @@ type MessageReactions struct { // // Use SetRecentReactions and GetRecentReactions helpers. RecentReactions []MessagePeerReaction + // TopReactors field of MessageReactions. + // + // Use SetTopReactors and GetTopReactors helpers. + TopReactors []MessageReactor } // MessageReactionsTypeID is TL type id of MessageReactions. -const MessageReactionsTypeID = 0x4f2b9479 +const MessageReactionsTypeID = 0xa339f0b // Ensuring interfaces in compile-time for MessageReactions. var ( @@ -102,6 +110,9 @@ func (m *MessageReactions) Zero() bool { if !(m.RecentReactions == nil) { return false } + if !(m.TopReactors == nil) { + return false + } return true } @@ -122,6 +133,7 @@ func (m *MessageReactions) FillFrom(from interface { GetReactionsAsTags() (value bool) GetResults() (value []ReactionCount) GetRecentReactions() (value []MessagePeerReaction, ok bool) + GetTopReactors() (value []MessageReactor, ok bool) }) { m.Min = from.GetMin() m.CanSeeList = from.GetCanSeeList() @@ -131,6 +143,10 @@ func (m *MessageReactions) FillFrom(from interface { m.RecentReactions = val } + if val, ok := from.GetTopReactors(); ok { + m.TopReactors = val + } + } // TypeID returns type id in TL schema. @@ -180,6 +196,11 @@ func (m *MessageReactions) TypeInfo() tdp.Type { SchemaName: "recent_reactions", Null: !m.Flags.Has(1), }, + { + Name: "TopReactors", + SchemaName: "top_reactors", + Null: !m.Flags.Has(4), + }, } return typ } @@ -198,12 +219,15 @@ func (m *MessageReactions) SetFlags() { if !(m.RecentReactions == nil) { m.Flags.Set(1) } + if !(m.TopReactors == nil) { + m.Flags.Set(4) + } } // Encode implements bin.Encoder. func (m *MessageReactions) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageReactions#4f2b9479 as nil") + return fmt.Errorf("can't encode messageReactions#a339f0b as nil") } b.PutID(MessageReactionsTypeID) return m.EncodeBare(b) @@ -212,23 +236,31 @@ func (m *MessageReactions) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageReactions) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageReactions#4f2b9479 as nil") + return fmt.Errorf("can't encode messageReactions#a339f0b as nil") } m.SetFlags() if err := m.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageReactions#4f2b9479: field flags: %w", err) + return fmt.Errorf("unable to encode messageReactions#a339f0b: field flags: %w", err) } b.PutVectorHeader(len(m.Results)) for idx, v := range m.Results { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageReactions#4f2b9479: field results element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode messageReactions#a339f0b: field results element with index %d: %w", idx, err) } } if m.Flags.Has(1) { b.PutVectorHeader(len(m.RecentReactions)) for idx, v := range m.RecentReactions { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageReactions#4f2b9479: field recent_reactions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode messageReactions#a339f0b: field recent_reactions element with index %d: %w", idx, err) + } + } + } + if m.Flags.Has(4) { + b.PutVectorHeader(len(m.TopReactors)) + for idx, v := range m.TopReactors { + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageReactions#a339f0b: field top_reactors element with index %d: %w", idx, err) } } } @@ -238,10 +270,10 @@ func (m *MessageReactions) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MessageReactions) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageReactions#4f2b9479 to nil") + return fmt.Errorf("can't decode messageReactions#a339f0b to nil") } if err := b.ConsumeID(MessageReactionsTypeID); err != nil { - return fmt.Errorf("unable to decode messageReactions#4f2b9479: %w", err) + return fmt.Errorf("unable to decode messageReactions#a339f0b: %w", err) } return m.DecodeBare(b) } @@ -249,11 +281,11 @@ func (m *MessageReactions) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageReactions) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageReactions#4f2b9479 to nil") + return fmt.Errorf("can't decode messageReactions#a339f0b to nil") } { if err := m.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageReactions#4f2b9479: field flags: %w", err) + return fmt.Errorf("unable to decode messageReactions#a339f0b: field flags: %w", err) } } m.Min = m.Flags.Has(0) @@ -262,7 +294,7 @@ func (m *MessageReactions) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messageReactions#4f2b9479: field results: %w", err) + return fmt.Errorf("unable to decode messageReactions#a339f0b: field results: %w", err) } if headerLen > 0 { @@ -271,7 +303,7 @@ func (m *MessageReactions) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value ReactionCount if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageReactions#4f2b9479: field results: %w", err) + return fmt.Errorf("unable to decode messageReactions#a339f0b: field results: %w", err) } m.Results = append(m.Results, value) } @@ -279,7 +311,7 @@ func (m *MessageReactions) DecodeBare(b *bin.Buffer) error { if m.Flags.Has(1) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messageReactions#4f2b9479: field recent_reactions: %w", err) + return fmt.Errorf("unable to decode messageReactions#a339f0b: field recent_reactions: %w", err) } if headerLen > 0 { @@ -288,11 +320,28 @@ func (m *MessageReactions) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value MessagePeerReaction if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageReactions#4f2b9479: field recent_reactions: %w", err) + return fmt.Errorf("unable to decode messageReactions#a339f0b: field recent_reactions: %w", err) } m.RecentReactions = append(m.RecentReactions, value) } } + if m.Flags.Has(4) { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode messageReactions#a339f0b: field top_reactors: %w", err) + } + + if headerLen > 0 { + m.TopReactors = make([]MessageReactor, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value MessageReactor + if err := value.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageReactions#a339f0b: field top_reactors: %w", err) + } + m.TopReactors = append(m.TopReactors, value) + } + } return nil } @@ -378,3 +427,21 @@ func (m *MessageReactions) GetRecentReactions() (value []MessagePeerReaction, ok } return m.RecentReactions, true } + +// SetTopReactors sets value of TopReactors conditional field. +func (m *MessageReactions) SetTopReactors(value []MessageReactor) { + m.Flags.Set(4) + m.TopReactors = value +} + +// GetTopReactors returns value of TopReactors conditional field and +// boolean which is true if field was set. +func (m *MessageReactions) GetTopReactors() (value []MessageReactor, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(4) { + return value, false + } + return m.TopReactors, true +} diff --git a/vendor/github.com/gotd/td/tg/tl_message_reactor_gen.go b/vendor/github.com/gotd/td/tg/tl_message_reactor_gen.go new file mode 100644 index 00000000..67c33a1e --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_message_reactor_gen.go @@ -0,0 +1,337 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessageReactor represents TL type `messageReactor#4ba3a95a`. +// +// See https://core.telegram.org/constructor/messageReactor for reference. +type MessageReactor struct { + // Flags field of MessageReactor. + Flags bin.Fields + // Top field of MessageReactor. + Top bool + // My field of MessageReactor. + My bool + // Anonymous field of MessageReactor. + Anonymous bool + // PeerID field of MessageReactor. + // + // Use SetPeerID and GetPeerID helpers. + PeerID PeerClass + // Count field of MessageReactor. + Count int +} + +// MessageReactorTypeID is TL type id of MessageReactor. +const MessageReactorTypeID = 0x4ba3a95a + +// Ensuring interfaces in compile-time for MessageReactor. +var ( + _ bin.Encoder = &MessageReactor{} + _ bin.Decoder = &MessageReactor{} + _ bin.BareEncoder = &MessageReactor{} + _ bin.BareDecoder = &MessageReactor{} +) + +func (m *MessageReactor) Zero() bool { + if m == nil { + return true + } + if !(m.Flags.Zero()) { + return false + } + if !(m.Top == false) { + return false + } + if !(m.My == false) { + return false + } + if !(m.Anonymous == false) { + return false + } + if !(m.PeerID == nil) { + return false + } + if !(m.Count == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageReactor) String() string { + if m == nil { + return "MessageReactor(nil)" + } + type Alias MessageReactor + return fmt.Sprintf("MessageReactor%+v", Alias(*m)) +} + +// FillFrom fills MessageReactor from given interface. +func (m *MessageReactor) FillFrom(from interface { + GetTop() (value bool) + GetMy() (value bool) + GetAnonymous() (value bool) + GetPeerID() (value PeerClass, ok bool) + GetCount() (value int) +}) { + m.Top = from.GetTop() + m.My = from.GetMy() + m.Anonymous = from.GetAnonymous() + if val, ok := from.GetPeerID(); ok { + m.PeerID = val + } + + m.Count = from.GetCount() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageReactor) TypeID() uint32 { + return MessageReactorTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageReactor) TypeName() string { + return "messageReactor" +} + +// TypeInfo returns info about TL type. +func (m *MessageReactor) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageReactor", + ID: MessageReactorTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Top", + SchemaName: "top", + Null: !m.Flags.Has(0), + }, + { + Name: "My", + SchemaName: "my", + Null: !m.Flags.Has(1), + }, + { + Name: "Anonymous", + SchemaName: "anonymous", + Null: !m.Flags.Has(2), + }, + { + Name: "PeerID", + SchemaName: "peer_id", + Null: !m.Flags.Has(3), + }, + { + Name: "Count", + SchemaName: "count", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (m *MessageReactor) SetFlags() { + if !(m.Top == false) { + m.Flags.Set(0) + } + if !(m.My == false) { + m.Flags.Set(1) + } + if !(m.Anonymous == false) { + m.Flags.Set(2) + } + if !(m.PeerID == nil) { + m.Flags.Set(3) + } +} + +// Encode implements bin.Encoder. +func (m *MessageReactor) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageReactor#4ba3a95a as nil") + } + b.PutID(MessageReactorTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageReactor) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageReactor#4ba3a95a as nil") + } + m.SetFlags() + if err := m.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageReactor#4ba3a95a: field flags: %w", err) + } + if m.Flags.Has(3) { + if m.PeerID == nil { + return fmt.Errorf("unable to encode messageReactor#4ba3a95a: field peer_id is nil") + } + if err := m.PeerID.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageReactor#4ba3a95a: field peer_id: %w", err) + } + } + b.PutInt(m.Count) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageReactor) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageReactor#4ba3a95a to nil") + } + if err := b.ConsumeID(MessageReactorTypeID); err != nil { + return fmt.Errorf("unable to decode messageReactor#4ba3a95a: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageReactor) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageReactor#4ba3a95a to nil") + } + { + if err := m.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageReactor#4ba3a95a: field flags: %w", err) + } + } + m.Top = m.Flags.Has(0) + m.My = m.Flags.Has(1) + m.Anonymous = m.Flags.Has(2) + if m.Flags.Has(3) { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode messageReactor#4ba3a95a: field peer_id: %w", err) + } + m.PeerID = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageReactor#4ba3a95a: field count: %w", err) + } + m.Count = value + } + return nil +} + +// SetTop sets value of Top conditional field. +func (m *MessageReactor) SetTop(value bool) { + if value { + m.Flags.Set(0) + m.Top = true + } else { + m.Flags.Unset(0) + m.Top = false + } +} + +// GetTop returns value of Top conditional field. +func (m *MessageReactor) GetTop() (value bool) { + if m == nil { + return + } + return m.Flags.Has(0) +} + +// SetMy sets value of My conditional field. +func (m *MessageReactor) SetMy(value bool) { + if value { + m.Flags.Set(1) + m.My = true + } else { + m.Flags.Unset(1) + m.My = false + } +} + +// GetMy returns value of My conditional field. +func (m *MessageReactor) GetMy() (value bool) { + if m == nil { + return + } + return m.Flags.Has(1) +} + +// SetAnonymous sets value of Anonymous conditional field. +func (m *MessageReactor) SetAnonymous(value bool) { + if value { + m.Flags.Set(2) + m.Anonymous = true + } else { + m.Flags.Unset(2) + m.Anonymous = false + } +} + +// GetAnonymous returns value of Anonymous conditional field. +func (m *MessageReactor) GetAnonymous() (value bool) { + if m == nil { + return + } + return m.Flags.Has(2) +} + +// SetPeerID sets value of PeerID conditional field. +func (m *MessageReactor) SetPeerID(value PeerClass) { + m.Flags.Set(3) + m.PeerID = value +} + +// GetPeerID returns value of PeerID conditional field and +// boolean which is true if field was set. +func (m *MessageReactor) GetPeerID() (value PeerClass, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(3) { + return value, false + } + return m.PeerID, true +} + +// GetCount returns value of Count field. +func (m *MessageReactor) GetCount() (value int) { + if m == nil { + return + } + return m.Count +} diff --git a/vendor/github.com/gotd/td/tg/tl_message_reactor_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_message_reactor_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_message_reactor_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_message_reply_header_gen.go b/vendor/github.com/gotd/td/tg/tl_message_reply_header_gen.go index a8dc2c1c..b24a14de 100644 --- a/vendor/github.com/gotd/td/tg/tl_message_reply_header_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_message_reply_header_gen.go @@ -714,7 +714,7 @@ func (m *MessageReplyHeader) MapQuoteEntities() (value MessageEntityClassArray, // // See https://core.telegram.org/constructor/messageReplyStoryHeader for reference. type MessageReplyStoryHeader struct { - // Peer field of MessageReplyStoryHeader. + // Sender of the story. Peer PeerClass // Story ID StoryID int diff --git a/vendor/github.com/gotd/td/tg/tl_messages_add_chat_user_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_add_chat_user_gen.go index 1fc6c913..17621329 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_add_chat_user_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_add_chat_user_gen.go @@ -33,13 +33,6 @@ var ( // MessagesAddChatUserRequest represents TL type `messages.addChatUser#cbc6d107`. // Adds a user to a chat and sends a service message on it. -// May also return 0-N updates of type updateGroupInvitePrivacyForbidden¹: it indicates -// we couldn't add a user to a chat because of their privacy settings; if required, an -// invite link² can be shared with the user, instead. -// -// Links: -// 1. https://core.telegram.org/constructor/updateGroupInvitePrivacyForbidden -// 2. https://core.telegram.org/api/invites // // See https://core.telegram.org/method/messages.addChatUser for reference. type MessagesAddChatUserRequest struct { @@ -229,13 +222,6 @@ func (a *MessagesAddChatUserRequest) GetFwdLimit() (value int) { // MessagesAddChatUser invokes method messages.addChatUser#cbc6d107 returning error if any. // Adds a user to a chat and sends a service message on it. -// May also return 0-N updates of type updateGroupInvitePrivacyForbidden¹: it indicates -// we couldn't add a user to a chat because of their privacy settings; if required, an -// invite link² can be shared with the user, instead. -// -// Links: -// 1. https://core.telegram.org/constructor/updateGroupInvitePrivacyForbidden -// 2. https://core.telegram.org/api/invites // // Possible errors: // diff --git a/vendor/github.com/gotd/td/tg/tl_messages_all_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_all_stickers_gen.go index 185f22f7..91fcfd1a 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_all_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_all_stickers_gen.go @@ -138,7 +138,7 @@ func (a *MessagesAllStickersNotModified) DecodeBare(b *bin.Buffer) error { // // See https://core.telegram.org/constructor/messages.allStickers for reference. type MessagesAllStickers struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_available_effects_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_available_effects_gen.go index fe60da7e..7e6a18c3 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_available_effects_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_available_effects_gen.go @@ -32,6 +32,10 @@ var ( ) // MessagesAvailableEffectsNotModified represents TL type `messages.availableEffectsNotModified#d1ed9a5b`. +// The full list of usable animated message effects »¹ hasn't changed. +// +// Links: +// 1. https://core.telegram.org/api/effects // // See https://core.telegram.org/constructor/messages.availableEffectsNotModified for reference. type MessagesAvailableEffectsNotModified struct { @@ -133,14 +137,21 @@ func (a *MessagesAvailableEffectsNotModified) DecodeBare(b *bin.Buffer) error { } // MessagesAvailableEffects represents TL type `messages.availableEffects#bddb616e`. +// The full list of usable animated message effects »¹. +// +// Links: +// 1. https://core.telegram.org/api/effects // // See https://core.telegram.org/constructor/messages.availableEffects for reference. type MessagesAvailableEffects struct { - // Hash field of MessagesAvailableEffects. + // Hash used for caching, for more info click here¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets#hash-generation Hash int - // Effects field of MessagesAvailableEffects. + // Message effects Effects []AvailableEffect - // Documents field of MessagesAvailableEffects. + // Documents specified in the effects constructors. Documents []DocumentClass } diff --git a/vendor/github.com/gotd/td/tg/tl_messages_available_reactions_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_available_reactions_gen.go index 45e77ac7..a051140b 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_available_reactions_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_available_reactions_gen.go @@ -141,7 +141,7 @@ func (a *MessagesAvailableReactionsNotModified) DecodeBare(b *bin.Buffer) error // // See https://core.telegram.org/constructor/messages.availableReactions for reference. type MessagesAvailableReactions struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_check_quick_reply_shortcut_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_check_quick_reply_shortcut_gen.go index 418a87e2..85a41f8e 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_check_quick_reply_shortcut_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_check_quick_reply_shortcut_gen.go @@ -32,10 +32,16 @@ var ( ) // MessagesCheckQuickReplyShortcutRequest represents TL type `messages.checkQuickReplyShortcut#f1d0fbd3`. +// Before offering the user the choice to add a message to a quick reply shortcut¹, to +// make sure that none of the limits specified here »² were reached. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts +// 2. https://core.telegram.org/api/business#quick-reply-shortcuts // // See https://core.telegram.org/method/messages.checkQuickReplyShortcut for reference. type MessagesCheckQuickReplyShortcutRequest struct { - // Shortcut field of MessagesCheckQuickReplyShortcutRequest. + // Shorcut name (not ID!). Shortcut string } @@ -161,6 +167,16 @@ func (c *MessagesCheckQuickReplyShortcutRequest) GetShortcut() (value string) { } // MessagesCheckQuickReplyShortcut invokes method messages.checkQuickReplyShortcut#f1d0fbd3 returning error if any. +// Before offering the user the choice to add a message to a quick reply shortcut¹, to +// make sure that none of the limits specified here »² were reached. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts +// 2. https://core.telegram.org/api/business#quick-reply-shortcuts +// +// Possible errors: +// +// 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. // // See https://core.telegram.org/method/messages.checkQuickReplyShortcut for reference. func (c *Client) MessagesCheckQuickReplyShortcut(ctx context.Context, shortcut string) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_create_chat_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_create_chat_gen.go index 5649081d..0082c6d5 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_create_chat_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_create_chat_gen.go @@ -33,13 +33,6 @@ var ( // MessagesCreateChatRequest represents TL type `messages.createChat#92ceddd4`. // Creates a new chat. -// May also return 0-N updates of type updateGroupInvitePrivacyForbidden¹: it indicates -// we couldn't add a user to a chat because of their privacy settings; if required, an -// invite link² can be shared with the user, instead. -// -// Links: -// 1. https://core.telegram.org/constructor/updateGroupInvitePrivacyForbidden -// 2. https://core.telegram.org/api/invites // // See https://core.telegram.org/method/messages.createChat for reference. type MessagesCreateChatRequest struct { @@ -294,13 +287,6 @@ func (c *MessagesCreateChatRequest) MapUsers() (value InputUserClassArray) { // MessagesCreateChat invokes method messages.createChat#92ceddd4 returning error if any. // Creates a new chat. -// May also return 0-N updates of type updateGroupInvitePrivacyForbidden¹: it indicates -// we couldn't add a user to a chat because of their privacy settings; if required, an -// invite link² can be shared with the user, instead. -// -// Links: -// 1. https://core.telegram.org/constructor/updateGroupInvitePrivacyForbidden -// 2. https://core.telegram.org/api/invites // // Possible errors: // diff --git a/vendor/github.com/gotd/td/tg/tl_messages_delete_fact_check_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_delete_fact_check_gen.go index 00a5f21a..acc73f08 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_delete_fact_check_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_delete_fact_check_gen.go @@ -32,12 +32,19 @@ var ( ) // MessagesDeleteFactCheckRequest represents TL type `messages.deleteFactCheck#d1da940c`. +// Delete a fact-check¹ from a message. +// Can only be used by independent fact-checkers as specified by the appConfig +// can_edit_factcheck¹ configuration flag. +// +// Links: +// 1. https://core.telegram.org/api/factcheck +// 2. https://core.telegram.org/api/config#can-edit-factcheck // // See https://core.telegram.org/method/messages.deleteFactCheck for reference. type MessagesDeleteFactCheckRequest struct { - // Peer field of MessagesDeleteFactCheckRequest. + // Peer where the message was sent. Peer InputPeerClass - // MsgID field of MessagesDeleteFactCheckRequest. + // Message ID MsgID int } @@ -193,6 +200,18 @@ func (d *MessagesDeleteFactCheckRequest) GetMsgID() (value int) { } // MessagesDeleteFactCheck invokes method messages.deleteFactCheck#d1da940c returning error if any. +// Delete a fact-check¹ from a message. +// Can only be used by independent fact-checkers as specified by the appConfig +// can_edit_factcheck¹ configuration flag. +// +// Links: +// 1. https://core.telegram.org/api/factcheck +// 2. https://core.telegram.org/api/config#can-edit-factcheck +// +// Possible errors: +// +// 403 CHAT_ACTION_FORBIDDEN: You cannot execute this action. +// 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/messages.deleteFactCheck for reference. func (c *Client) MessagesDeleteFactCheck(ctx context.Context, request *MessagesDeleteFactCheckRequest) (UpdatesClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_delete_quick_reply_messages_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_delete_quick_reply_messages_gen.go index fac012ee..312feed2 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_delete_quick_reply_messages_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_delete_quick_reply_messages_gen.go @@ -32,12 +32,21 @@ var ( ) // MessagesDeleteQuickReplyMessagesRequest represents TL type `messages.deleteQuickReplyMessages#e105e910`. +// Delete one or more messages from a quick reply shortcut¹. This will also emit an +// updateDeleteQuickReplyMessages² update. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts +// 2. https://core.telegram.org/constructor/updateDeleteQuickReplyMessages // // See https://core.telegram.org/method/messages.deleteQuickReplyMessages for reference. type MessagesDeleteQuickReplyMessagesRequest struct { - // ShortcutID field of MessagesDeleteQuickReplyMessagesRequest. + // Shortcut ID¹. + // + // Links: + // 1) https://core.telegram.org/api/business#quick-reply-shortcuts ShortcutID int - // ID field of MessagesDeleteQuickReplyMessagesRequest. + // IDs of shortcut messages to delete. ID []int } @@ -201,6 +210,16 @@ func (d *MessagesDeleteQuickReplyMessagesRequest) GetID() (value []int) { } // MessagesDeleteQuickReplyMessages invokes method messages.deleteQuickReplyMessages#e105e910 returning error if any. +// Delete one or more messages from a quick reply shortcut¹. This will also emit an +// updateDeleteQuickReplyMessages² update. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts +// 2. https://core.telegram.org/constructor/updateDeleteQuickReplyMessages +// +// Possible errors: +// +// 400 SHORTCUT_INVALID: The specified shortcut is invalid. // // See https://core.telegram.org/method/messages.deleteQuickReplyMessages for reference. func (c *Client) MessagesDeleteQuickReplyMessages(ctx context.Context, request *MessagesDeleteQuickReplyMessagesRequest) (UpdatesClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_delete_quick_reply_shortcut_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_delete_quick_reply_shortcut_gen.go index e10f471a..f1ecc8f2 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_delete_quick_reply_shortcut_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_delete_quick_reply_shortcut_gen.go @@ -32,10 +32,22 @@ var ( ) // MessagesDeleteQuickReplyShortcutRequest represents TL type `messages.deleteQuickReplyShortcut#3cc04740`. +// Completely delete a quick reply shortcut¹. +// This will also emit an updateDeleteQuickReply² update to other logged-in sessions +// (and no updateDeleteQuickReplyMessages³ updates, even if all the messages in the +// shortcuts are also deleted by this method). +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts +// 2. https://core.telegram.org/constructor/updateDeleteQuickReply +// 3. https://core.telegram.org/constructor/updateDeleteQuickReplyMessages // // See https://core.telegram.org/method/messages.deleteQuickReplyShortcut for reference. type MessagesDeleteQuickReplyShortcutRequest struct { - // ShortcutID field of MessagesDeleteQuickReplyShortcutRequest. + // Shortcut ID¹ + // + // Links: + // 1) https://core.telegram.org/api/business#quick-reply-shortcuts ShortcutID int } @@ -161,6 +173,19 @@ func (d *MessagesDeleteQuickReplyShortcutRequest) GetShortcutID() (value int) { } // MessagesDeleteQuickReplyShortcut invokes method messages.deleteQuickReplyShortcut#3cc04740 returning error if any. +// Completely delete a quick reply shortcut¹. +// This will also emit an updateDeleteQuickReply² update to other logged-in sessions +// (and no updateDeleteQuickReplyMessages³ updates, even if all the messages in the +// shortcuts are also deleted by this method). +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts +// 2. https://core.telegram.org/constructor/updateDeleteQuickReply +// 3. https://core.telegram.org/constructor/updateDeleteQuickReplyMessages +// +// Possible errors: +// +// 400 SHORTCUT_INVALID: The specified shortcut is invalid. // // See https://core.telegram.org/method/messages.deleteQuickReplyShortcut for reference. func (c *Client) MessagesDeleteQuickReplyShortcut(ctx context.Context, shortcutid int) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_delete_scheduled_messages_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_delete_scheduled_messages_gen.go index b68396ce..94f2f05e 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_delete_scheduled_messages_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_delete_scheduled_messages_gen.go @@ -211,6 +211,7 @@ func (d *MessagesDeleteScheduledMessagesRequest) GetID() (value []int) { // // Possible errors: // +// 403 MESSAGE_DELETE_FORBIDDEN: You can't delete one of the messages you tried to delete, most likely because it is a service message. // 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/messages.deleteScheduledMessages for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_dialog_filters_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_dialog_filters_gen.go index 18a445e0..68b9c813 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_dialog_filters_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_dialog_filters_gen.go @@ -32,14 +32,24 @@ var ( ) // MessagesDialogFilters represents TL type `messages.dialogFilters#2ad93719`. +// Folder and folder tags¹ information +// +// Links: +// 1. https://core.telegram.org/api/folders // // See https://core.telegram.org/constructor/messages.dialogFilters for reference. type MessagesDialogFilters struct { - // Flags field of MessagesDialogFilters. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // TagsEnabled field of MessagesDialogFilters. + // Whether folder tags¹ are enabled. + // + // Links: + // 1) https://core.telegram.org/api/folders#folder-tags TagsEnabled bool - // Filters field of MessagesDialogFilters. + // Folders. Filters []DialogFilterClass } diff --git a/vendor/github.com/gotd/td/tg/tl_messages_edit_chat_title_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_edit_chat_title_gen.go index f313cc99..24de037b 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_edit_chat_title_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_edit_chat_title_gen.go @@ -193,6 +193,7 @@ func (e *MessagesEditChatTitleRequest) GetTitle() (value string) { // // Possible errors: // +// 400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. // 400 CHAT_ID_INVALID: The provided chat id is invalid. // 400 CHAT_NOT_MODIFIED: No changes were made to chat information because the new information you passed is identical to the current information. // 400 CHAT_TITLE_EMPTY: No chat title provided. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_edit_fact_check_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_edit_fact_check_gen.go index 521e8705..b5fcabb6 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_edit_fact_check_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_edit_fact_check_gen.go @@ -32,14 +32,24 @@ var ( ) // MessagesEditFactCheckRequest represents TL type `messages.editFactCheck#589ee75`. +// Edit/create a fact-check¹ on a message. +// Can only be used by independent fact-checkers as specified by the appConfig +// can_edit_factcheck¹ configuration flag. +// +// Links: +// 1. https://core.telegram.org/api/factcheck +// 2. https://core.telegram.org/api/config#can-edit-factcheck // // See https://core.telegram.org/method/messages.editFactCheck for reference. type MessagesEditFactCheckRequest struct { - // Peer field of MessagesEditFactCheckRequest. + // Peer where the message was sent Peer InputPeerClass - // MsgID field of MessagesEditFactCheckRequest. + // Message ID MsgID int - // Text field of MessagesEditFactCheckRequest. + // Fact-check (maximum UTF-8 length specified in appConfig.factcheck_length_limit¹). + // + // Links: + // 1) https://core.telegram.org/api/config#factcheck-length-limit Text TextWithEntities } @@ -220,6 +230,18 @@ func (e *MessagesEditFactCheckRequest) GetText() (value TextWithEntities) { } // MessagesEditFactCheck invokes method messages.editFactCheck#589ee75 returning error if any. +// Edit/create a fact-check¹ on a message. +// Can only be used by independent fact-checkers as specified by the appConfig +// can_edit_factcheck¹ configuration flag. +// +// Links: +// 1. https://core.telegram.org/api/factcheck +// 2. https://core.telegram.org/api/config#can-edit-factcheck +// +// Possible errors: +// +// 403 CHAT_ACTION_FORBIDDEN: You cannot execute this action. +// 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/messages.editFactCheck for reference. func (c *Client) MessagesEditFactCheck(ctx context.Context, request *MessagesEditFactCheckRequest) (UpdatesClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_edit_inline_bot_message_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_edit_inline_bot_message_gen.go index 56023411..b0b65c4a 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_edit_inline_bot_message_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_edit_inline_bot_message_gen.go @@ -495,7 +495,7 @@ func (e *MessagesEditInlineBotMessageRequest) MapEntities() (value MessageEntity // Possible errors: // // 400 BUTTON_DATA_INVALID: The data of one or more of the buttons you provided is invalid. -// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. +// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. // 400 MESSAGE_ID_INVALID: The provided message id is invalid. // 400 MESSAGE_NOT_MODIFIED: The provided message data is identical to the previous message data, the message wasn't modified. // diff --git a/vendor/github.com/gotd/td/tg/tl_messages_edit_message_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_edit_message_gen.go index c5eb4940..c15a6cba 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_edit_message_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_edit_message_gen.go @@ -76,7 +76,10 @@ type MessagesEditMessageRequest struct { // // Use SetScheduleDate and GetScheduleDate helpers. ScheduleDate int - // QuickReplyShortcutID field of MessagesEditMessageRequest. + // If specified, edits a quick reply shortcut message, instead »¹. + // + // Links: + // 1) https://core.telegram.org/api/business#quick-reply-shortcuts // // Use SetQuickReplyShortcutID and GetQuickReplyShortcutID helpers. QuickReplyShortcutID int @@ -633,7 +636,7 @@ func (e *MessagesEditMessageRequest) MapEntities() (value MessageEntityClassArra // 403 CHAT_WRITE_FORBIDDEN: You can't write in this chat. // 400 DOCUMENT_INVALID: The specified document is invalid. // 400 ENTITIES_TOO_LONG: You provided too many styled message entities. -// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. +// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. // 400 FILE_PARTS_INVALID: The number of file parts is invalid. // 400 IMAGE_PROCESS_FAILED: Failure while processing image. // 403 INLINE_BOT_REQUIRED: Only the inline bot can edit message. @@ -658,6 +661,7 @@ func (e *MessagesEditMessageRequest) MapEntities() (value MessageEntityClassArra // 400 REPLY_MARKUP_TOO_LONG: The specified reply_markup is too long. // 400 SCHEDULE_DATE_INVALID: Invalid schedule date provided. // 400 USER_BANNED_IN_CHANNEL: You're banned from sending messages in supergroups/channels. +// 400 WEBPAGE_NOT_FOUND: A preview for the specified webpage url could not be generated. // // See https://core.telegram.org/method/messages.editMessage for reference. // Can be used by bots. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_edit_quick_reply_shortcut_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_edit_quick_reply_shortcut_gen.go index 686734ee..b22ea1ea 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_edit_quick_reply_shortcut_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_edit_quick_reply_shortcut_gen.go @@ -32,12 +32,21 @@ var ( ) // MessagesEditQuickReplyShortcutRequest represents TL type `messages.editQuickReplyShortcut#5c003cef`. +// Rename a quick reply shortcut¹. +// This will emit an updateQuickReplies² update to other logged-in sessions. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts +// 2. https://core.telegram.org/constructor/updateQuickReplies // // See https://core.telegram.org/method/messages.editQuickReplyShortcut for reference. type MessagesEditQuickReplyShortcutRequest struct { - // ShortcutID field of MessagesEditQuickReplyShortcutRequest. + // Shortcut ID¹. + // + // Links: + // 1) https://core.telegram.org/api/business#quick-reply-shortcuts ShortcutID int - // Shortcut field of MessagesEditQuickReplyShortcutRequest. + // New shortcut name. Shortcut string } @@ -188,6 +197,17 @@ func (e *MessagesEditQuickReplyShortcutRequest) GetShortcut() (value string) { } // MessagesEditQuickReplyShortcut invokes method messages.editQuickReplyShortcut#5c003cef returning error if any. +// Rename a quick reply shortcut¹. +// This will emit an updateQuickReplies² update to other logged-in sessions. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts +// 2. https://core.telegram.org/constructor/updateQuickReplies +// +// Possible errors: +// +// 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. +// 400 SHORTCUT_INVALID: The specified shortcut is invalid. // // See https://core.telegram.org/method/messages.editQuickReplyShortcut for reference. func (c *Client) MessagesEditQuickReplyShortcut(ctx context.Context, request *MessagesEditQuickReplyShortcutRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_emoji_groups_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_emoji_groups_gen.go index e82dd896..e4ab9930 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_emoji_groups_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_emoji_groups_gen.go @@ -35,7 +35,7 @@ var ( // The list of emoji categories¹ hasn't changed. // // Links: -// 1. https://core.telegram.org/api/custom-emoji#emoji-categories +// 1. https://core.telegram.org/api/emoji-categories // // See https://core.telegram.org/constructor/messages.emojiGroupsNotModified for reference. type MessagesEmojiGroupsNotModified struct { @@ -140,11 +140,11 @@ func (e *MessagesEmojiGroupsNotModified) DecodeBare(b *bin.Buffer) error { // Represents a list of emoji categories¹. // // Links: -// 1. https://core.telegram.org/api/custom-emoji#emoji-categories +// 1. https://core.telegram.org/api/emoji-categories // // See https://core.telegram.org/constructor/messages.emojiGroups for reference. type MessagesEmojiGroups struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation @@ -152,7 +152,7 @@ type MessagesEmojiGroups struct { // A list of emoji categories¹. // // Links: - // 1) https://core.telegram.org/api/custom-emoji#emoji-categories + // 1) https://core.telegram.org/api/emoji-categories Groups []EmojiGroupClass } diff --git a/vendor/github.com/gotd/td/tg/tl_messages_export_chat_invite_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_export_chat_invite_gen.go index 1aa0dd0d..7a8fb6e5 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_export_chat_invite_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_export_chat_invite_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesExportChatInviteRequest represents TL type `messages.exportChatInvite#a02ce5d5`. +// MessagesExportChatInviteRequest represents TL type `messages.exportChatInvite#a455de90`. // Export an invite link for a chat // // See https://core.telegram.org/method/messages.exportChatInvite for reference. @@ -62,10 +62,14 @@ type MessagesExportChatInviteRequest struct { // // Use SetTitle and GetTitle helpers. Title string + // SubscriptionPricing field of MessagesExportChatInviteRequest. + // + // Use SetSubscriptionPricing and GetSubscriptionPricing helpers. + SubscriptionPricing StarsSubscriptionPricing } // MessagesExportChatInviteRequestTypeID is TL type id of MessagesExportChatInviteRequest. -const MessagesExportChatInviteRequestTypeID = 0xa02ce5d5 +const MessagesExportChatInviteRequestTypeID = 0xa455de90 // Ensuring interfaces in compile-time for MessagesExportChatInviteRequest. var ( @@ -100,6 +104,9 @@ func (e *MessagesExportChatInviteRequest) Zero() bool { if !(e.Title == "") { return false } + if !(e.SubscriptionPricing.Zero()) { + return false + } return true } @@ -121,6 +128,7 @@ func (e *MessagesExportChatInviteRequest) FillFrom(from interface { GetExpireDate() (value int, ok bool) GetUsageLimit() (value int, ok bool) GetTitle() (value string, ok bool) + GetSubscriptionPricing() (value StarsSubscriptionPricing, ok bool) }) { e.LegacyRevokePermanent = from.GetLegacyRevokePermanent() e.RequestNeeded = from.GetRequestNeeded() @@ -137,6 +145,10 @@ func (e *MessagesExportChatInviteRequest) FillFrom(from interface { e.Title = val } + if val, ok := from.GetSubscriptionPricing(); ok { + e.SubscriptionPricing = val + } + } // TypeID returns type id in TL schema. @@ -191,6 +203,11 @@ func (e *MessagesExportChatInviteRequest) TypeInfo() tdp.Type { SchemaName: "title", Null: !e.Flags.Has(4), }, + { + Name: "SubscriptionPricing", + SchemaName: "subscription_pricing", + Null: !e.Flags.Has(5), + }, } return typ } @@ -212,12 +229,15 @@ func (e *MessagesExportChatInviteRequest) SetFlags() { if !(e.Title == "") { e.Flags.Set(4) } + if !(e.SubscriptionPricing.Zero()) { + e.Flags.Set(5) + } } // Encode implements bin.Encoder. func (e *MessagesExportChatInviteRequest) Encode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode messages.exportChatInvite#a02ce5d5 as nil") + return fmt.Errorf("can't encode messages.exportChatInvite#a455de90 as nil") } b.PutID(MessagesExportChatInviteRequestTypeID) return e.EncodeBare(b) @@ -226,17 +246,17 @@ func (e *MessagesExportChatInviteRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (e *MessagesExportChatInviteRequest) EncodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode messages.exportChatInvite#a02ce5d5 as nil") + return fmt.Errorf("can't encode messages.exportChatInvite#a455de90 as nil") } e.SetFlags() if err := e.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.exportChatInvite#a02ce5d5: field flags: %w", err) + return fmt.Errorf("unable to encode messages.exportChatInvite#a455de90: field flags: %w", err) } if e.Peer == nil { - return fmt.Errorf("unable to encode messages.exportChatInvite#a02ce5d5: field peer is nil") + return fmt.Errorf("unable to encode messages.exportChatInvite#a455de90: field peer is nil") } if err := e.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.exportChatInvite#a02ce5d5: field peer: %w", err) + return fmt.Errorf("unable to encode messages.exportChatInvite#a455de90: field peer: %w", err) } if e.Flags.Has(0) { b.PutInt(e.ExpireDate) @@ -247,16 +267,21 @@ func (e *MessagesExportChatInviteRequest) EncodeBare(b *bin.Buffer) error { if e.Flags.Has(4) { b.PutString(e.Title) } + if e.Flags.Has(5) { + if err := e.SubscriptionPricing.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.exportChatInvite#a455de90: field subscription_pricing: %w", err) + } + } return nil } // Decode implements bin.Decoder. func (e *MessagesExportChatInviteRequest) Decode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode messages.exportChatInvite#a02ce5d5 to nil") + return fmt.Errorf("can't decode messages.exportChatInvite#a455de90 to nil") } if err := b.ConsumeID(MessagesExportChatInviteRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.exportChatInvite#a02ce5d5: %w", err) + return fmt.Errorf("unable to decode messages.exportChatInvite#a455de90: %w", err) } return e.DecodeBare(b) } @@ -264,11 +289,11 @@ func (e *MessagesExportChatInviteRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (e *MessagesExportChatInviteRequest) DecodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode messages.exportChatInvite#a02ce5d5 to nil") + return fmt.Errorf("can't decode messages.exportChatInvite#a455de90 to nil") } { if err := e.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.exportChatInvite#a02ce5d5: field flags: %w", err) + return fmt.Errorf("unable to decode messages.exportChatInvite#a455de90: field flags: %w", err) } } e.LegacyRevokePermanent = e.Flags.Has(2) @@ -276,31 +301,36 @@ func (e *MessagesExportChatInviteRequest) DecodeBare(b *bin.Buffer) error { { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.exportChatInvite#a02ce5d5: field peer: %w", err) + return fmt.Errorf("unable to decode messages.exportChatInvite#a455de90: field peer: %w", err) } e.Peer = value } if e.Flags.Has(0) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.exportChatInvite#a02ce5d5: field expire_date: %w", err) + return fmt.Errorf("unable to decode messages.exportChatInvite#a455de90: field expire_date: %w", err) } e.ExpireDate = value } if e.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.exportChatInvite#a02ce5d5: field usage_limit: %w", err) + return fmt.Errorf("unable to decode messages.exportChatInvite#a455de90: field usage_limit: %w", err) } e.UsageLimit = value } if e.Flags.Has(4) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messages.exportChatInvite#a02ce5d5: field title: %w", err) + return fmt.Errorf("unable to decode messages.exportChatInvite#a455de90: field title: %w", err) } e.Title = value } + if e.Flags.Has(5) { + if err := e.SubscriptionPricing.Decode(b); err != nil { + return fmt.Errorf("unable to decode messages.exportChatInvite#a455de90: field subscription_pricing: %w", err) + } + } return nil } @@ -404,7 +434,25 @@ func (e *MessagesExportChatInviteRequest) GetTitle() (value string, ok bool) { return e.Title, true } -// MessagesExportChatInvite invokes method messages.exportChatInvite#a02ce5d5 returning error if any. +// SetSubscriptionPricing sets value of SubscriptionPricing conditional field. +func (e *MessagesExportChatInviteRequest) SetSubscriptionPricing(value StarsSubscriptionPricing) { + e.Flags.Set(5) + e.SubscriptionPricing = value +} + +// GetSubscriptionPricing returns value of SubscriptionPricing conditional field and +// boolean which is true if field was set. +func (e *MessagesExportChatInviteRequest) GetSubscriptionPricing() (value StarsSubscriptionPricing, ok bool) { + if e == nil { + return + } + if !e.Flags.Has(5) { + return value, false + } + return e.SubscriptionPricing, true +} + +// MessagesExportChatInvite invokes method messages.exportChatInvite#a455de90 returning error if any. // Export an invite link for a chat // // Possible errors: diff --git a/vendor/github.com/gotd/td/tg/tl_messages_faved_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_faved_stickers_gen.go index 6808512b..23077945 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_faved_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_faved_stickers_gen.go @@ -138,7 +138,7 @@ func (f *MessagesFavedStickersNotModified) DecodeBare(b *bin.Buffer) error { // // See https://core.telegram.org/constructor/messages.favedStickers for reference. type MessagesFavedStickers struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_featured_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_featured_stickers_gen.go index b1b173f7..ed46b013 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_featured_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_featured_stickers_gen.go @@ -178,7 +178,7 @@ type MessagesFeaturedStickers struct { Flags bin.Fields // Whether this is a premium stickerset Premium bool - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_forward_messages_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_forward_messages_gen.go index 0f2fbb7f..f5da4fcd 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_forward_messages_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_forward_messages_gen.go @@ -81,7 +81,10 @@ type MessagesForwardMessagesRequest struct { // // Use SetSendAs and GetSendAs helpers. SendAs InputPeerClass - // QuickReplyShortcut field of MessagesForwardMessagesRequest. + // Add the messages to the specified quick reply shortcut »¹, instead. + // + // Links: + // 1) https://core.telegram.org/api/business#quick-reply-shortcuts // // Use SetQuickReplyShortcut and GetQuickReplyShortcut helpers. QuickReplyShortcut InputQuickReplyShortcutClass @@ -729,7 +732,7 @@ func (f *MessagesForwardMessagesRequest) GetQuickReplyShortcut() (value InputQui // 406 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. // 403 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. // 406 CHAT_FORWARDS_RESTRICTED: You can't forward messages from a protected chat. -// 403 CHAT_GUEST_SEND_FORBIDDEN: You join the discussion group before commenting, see here » for more info. +// 403 CHAT_GUEST_SEND_FORBIDDEN: You join the discussion group before commenting, see here » for more info. // 400 CHAT_ID_INVALID: The provided chat id is invalid. // 400 CHAT_RESTRICTED: You can't send messages in this chat, you were restricted. // 403 CHAT_SEND_AUDIOS_FORBIDDEN: You can't send audio messages in this chat. @@ -750,11 +753,15 @@ func (f *MessagesForwardMessagesRequest) GetQuickReplyShortcut() (value InputQui // 400 MESSAGE_IDS_EMPTY: No message ids were provided. // 400 MESSAGE_ID_INVALID: The provided message id is invalid. // 400 MSG_ID_INVALID: Invalid message ID provided. -// 406 PAYMENT_UNSUPPORTED: A detailed description of the error will be received separately as described here ». +// 406 PAYMENT_UNSUPPORTED: A detailed description of the error will be received separately as described here ». // 400 PEER_ID_INVALID: The provided peer id is invalid. +// 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. +// 406 PRIVACY_PREMIUM_REQUIRED: You need a Telegram Premium subscription to send a message to this user. +// 400 QUICK_REPLIES_TOO_MUCH: A maximum of appConfig.quick_replies_limit shortcuts may be created, the limit was reached. // 400 QUIZ_ANSWER_MISSING: You can forward a quiz while hiding the original author only after choosing an option in the quiz. // 500 RANDOM_ID_DUPLICATE: You provided a random ID that was already used. // 400 RANDOM_ID_INVALID: A provided random ID is invalid. +// 400 REPLY_MESSAGES_TOO_MUCH: Each shortcut can contain a maximum of appConfig.quick_reply_messages_limit messages, the limit was reached. // 400 SCHEDULE_BOT_NOT_ALLOWED: Bots cannot schedule messages. // 400 SCHEDULE_DATE_TOO_LATE: You can't schedule a message this far in the future. // 400 SCHEDULE_TOO_MUCH: There are too many scheduled messages. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_found_sticker_sets_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_found_sticker_sets_gen.go index 7cec3474..01adbcb9 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_found_sticker_sets_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_found_sticker_sets_gen.go @@ -138,7 +138,7 @@ func (f *MessagesFoundStickerSetsNotModified) DecodeBare(b *bin.Buffer) error { // // See https://core.telegram.org/constructor/messages.foundStickerSets for reference. type MessagesFoundStickerSets struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_all_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_all_stickers_gen.go index a2a79a3b..ecf215eb 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_all_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_all_stickers_gen.go @@ -36,7 +36,7 @@ var ( // // See https://core.telegram.org/method/messages.getAllStickers for reference. type MessagesGetAllStickersRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_attach_menu_bots_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_attach_menu_bots_gen.go index ca2b3616..d5aed886 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_attach_menu_bots_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_attach_menu_bots_gen.go @@ -39,7 +39,7 @@ var ( // // See https://core.telegram.org/method/messages.getAttachMenuBots for reference. type MessagesGetAttachMenuBotsRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_attached_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_attached_stickers_gen.go index f7c97f11..57c20a04 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_attached_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_attached_stickers_gen.go @@ -169,6 +169,10 @@ func (g *MessagesGetAttachedStickersRequest) GetMedia() (value InputStickeredMed // MessagesGetAttachedStickers invokes method messages.getAttachedStickers#cc5b67cc returning error if any. // Get stickers attached to a photo or video // +// Possible errors: +// +// 400 MEDIA_EMPTY: The provided media object is invalid. +// // See https://core.telegram.org/method/messages.getAttachedStickers for reference. func (c *Client) MessagesGetAttachedStickers(ctx context.Context, media InputStickeredMediaClass) ([]StickerSetCoveredClass, error) { var result StickerSetCoveredClassVector diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_available_effects_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_available_effects_gen.go index ba4704f4..b68adf0f 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_available_effects_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_available_effects_gen.go @@ -32,10 +32,17 @@ var ( ) // MessagesGetAvailableEffectsRequest represents TL type `messages.getAvailableEffects#dea20a39`. +// Fetch the full list of usable animated message effects »¹. +// +// Links: +// 1. https://core.telegram.org/api/effects // // See https://core.telegram.org/method/messages.getAvailableEffects for reference. type MessagesGetAvailableEffectsRequest struct { - // Hash field of MessagesGetAvailableEffectsRequest. + // Hash used for caching, for more info click here¹. + // + // Links: + // 1) https://core.telegram.org/api/offsets#hash-generation Hash int } @@ -161,6 +168,10 @@ func (g *MessagesGetAvailableEffectsRequest) GetHash() (value int) { } // MessagesGetAvailableEffects invokes method messages.getAvailableEffects#dea20a39 returning error if any. +// Fetch the full list of usable animated message effects »¹. +// +// Links: +// 1. https://core.telegram.org/api/effects // // See https://core.telegram.org/method/messages.getAvailableEffects for reference. func (c *Client) MessagesGetAvailableEffects(ctx context.Context, hash int) (MessagesAvailableEffectsClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_available_reactions_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_available_reactions_gen.go index 13b9b427..ce48d1b5 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_available_reactions_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_available_reactions_gen.go @@ -39,7 +39,7 @@ var ( // // See https://core.telegram.org/method/messages.getAvailableReactions for reference. type MessagesGetAvailableReactionsRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_bot_app_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_bot_app_gen.go index 03fab633..28d3599e 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_bot_app_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_bot_app_gen.go @@ -44,7 +44,7 @@ type MessagesGetBotAppRequest struct { // Links: // 1) https://core.telegram.org/api/links#direct-mini-app-links App InputBotAppClass - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation @@ -210,7 +210,9 @@ func (g *MessagesGetBotAppRequest) GetHash() (value int64) { // // Possible errors: // +// 400 BOT_APP_BOT_INVALID: The bot_id passed in the inputBotAppShortName constructor is invalid. // 400 BOT_APP_INVALID: The specified bot app is invalid. +// 400 BOT_APP_SHORTNAME_INVALID: The specified bot app short name is invalid. // // See https://core.telegram.org/method/messages.getBotApp for reference. func (c *Client) MessagesGetBotApp(ctx context.Context, request *MessagesGetBotAppRequest) (*MessagesBotApp, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_bot_callback_answer_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_bot_callback_answer_gen.go index 24379dad..59bed791 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_bot_callback_answer_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_bot_callback_answer_gen.go @@ -374,6 +374,7 @@ func (g *MessagesGetBotCallbackAnswerRequest) GetPasswordAsNotEmpty() (*InputChe // 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. // 400 DATA_INVALID: Encrypted data invalid. // 400 MESSAGE_ID_INVALID: The provided message id is invalid. +// 400 PASSWORD_MISSING: You must enable 2FA before executing this operation. // 400 PEER_ID_INVALID: The provided peer id is invalid. // -503 Timeout: Timeout while fetching data. // diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_chat_invite_importers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_chat_invite_importers_gen.go index 299243b7..38cbe6f9 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_chat_invite_importers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_chat_invite_importers_gen.go @@ -46,6 +46,8 @@ type MessagesGetChatInviteImportersRequest struct { // Links: // 1) https://core.telegram.org/api/invites#join-requests Requested bool + // SubscriptionExpired field of MessagesGetChatInviteImportersRequest. + SubscriptionExpired bool // Chat Peer InputPeerClass // Invite link @@ -98,6 +100,9 @@ func (g *MessagesGetChatInviteImportersRequest) Zero() bool { if !(g.Requested == false) { return false } + if !(g.SubscriptionExpired == false) { + return false + } if !(g.Peer == nil) { return false } @@ -132,6 +137,7 @@ func (g *MessagesGetChatInviteImportersRequest) String() string { // FillFrom fills MessagesGetChatInviteImportersRequest from given interface. func (g *MessagesGetChatInviteImportersRequest) FillFrom(from interface { GetRequested() (value bool) + GetSubscriptionExpired() (value bool) GetPeer() (value InputPeerClass) GetLink() (value string, ok bool) GetQ() (value string, ok bool) @@ -140,6 +146,7 @@ func (g *MessagesGetChatInviteImportersRequest) FillFrom(from interface { GetLimit() (value int) }) { g.Requested = from.GetRequested() + g.SubscriptionExpired = from.GetSubscriptionExpired() g.Peer = from.GetPeer() if val, ok := from.GetLink(); ok { g.Link = val @@ -182,6 +189,11 @@ func (g *MessagesGetChatInviteImportersRequest) TypeInfo() tdp.Type { SchemaName: "requested", Null: !g.Flags.Has(0), }, + { + Name: "SubscriptionExpired", + SchemaName: "subscription_expired", + Null: !g.Flags.Has(3), + }, { Name: "Peer", SchemaName: "peer", @@ -217,6 +229,9 @@ func (g *MessagesGetChatInviteImportersRequest) SetFlags() { if !(g.Requested == false) { g.Flags.Set(0) } + if !(g.SubscriptionExpired == false) { + g.Flags.Set(3) + } if !(g.Link == "") { g.Flags.Set(1) } @@ -288,6 +303,7 @@ func (g *MessagesGetChatInviteImportersRequest) DecodeBare(b *bin.Buffer) error } } g.Requested = g.Flags.Has(0) + g.SubscriptionExpired = g.Flags.Has(3) { value, err := DecodeInputPeer(b) if err != nil { @@ -352,6 +368,25 @@ func (g *MessagesGetChatInviteImportersRequest) GetRequested() (value bool) { return g.Flags.Has(0) } +// SetSubscriptionExpired sets value of SubscriptionExpired conditional field. +func (g *MessagesGetChatInviteImportersRequest) SetSubscriptionExpired(value bool) { + if value { + g.Flags.Set(3) + g.SubscriptionExpired = true + } else { + g.Flags.Unset(3) + g.SubscriptionExpired = false + } +} + +// GetSubscriptionExpired returns value of SubscriptionExpired conditional field. +func (g *MessagesGetChatInviteImportersRequest) GetSubscriptionExpired() (value bool) { + if g == nil { + return + } + return g.Flags.Has(3) +} + // GetPeer returns value of Peer field. func (g *MessagesGetChatInviteImportersRequest) GetPeer() (value InputPeerClass) { if g == nil { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_default_history_ttl_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_default_history_ttl_gen.go index d9e10c2f..5548a022 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_default_history_ttl_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_default_history_ttl_gen.go @@ -132,7 +132,6 @@ func (g *MessagesGetDefaultHistoryTTLRequest) DecodeBare(b *bin.Buffer) error { // Gets the default value of the Time-To-Live setting, applied to all new chats. // // See https://core.telegram.org/method/messages.getDefaultHistoryTTL for reference. -// Can be used by bots. func (c *Client) MessagesGetDefaultHistoryTTL(ctx context.Context) (*DefaultHistoryTTL, error) { var result DefaultHistoryTTL diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_default_tag_reactions_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_default_tag_reactions_gen.go index 0ef68a35..e70feb34 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_default_tag_reactions_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_default_tag_reactions_gen.go @@ -32,10 +32,17 @@ var ( ) // MessagesGetDefaultTagReactionsRequest represents TL type `messages.getDefaultTagReactions#bdf93428`. +// Fetch a default recommended list of saved message tag reactions¹. +// +// Links: +// 1. https://core.telegram.org/api/saved-messages#tags // // See https://core.telegram.org/method/messages.getDefaultTagReactions for reference. type MessagesGetDefaultTagReactionsRequest struct { - // Hash field of MessagesGetDefaultTagReactionsRequest. + // Hash used for caching, for more info click here¹. + // + // Links: + // 1) https://core.telegram.org/api/offsets#hash-generation Hash int64 } @@ -161,6 +168,10 @@ func (g *MessagesGetDefaultTagReactionsRequest) GetHash() (value int64) { } // MessagesGetDefaultTagReactions invokes method messages.getDefaultTagReactions#bdf93428 returning error if any. +// Fetch a default recommended list of saved message tag reactions¹. +// +// Links: +// 1. https://core.telegram.org/api/saved-messages#tags // // See https://core.telegram.org/method/messages.getDefaultTagReactions for reference. func (c *Client) MessagesGetDefaultTagReactions(ctx context.Context, hash int64) (MessagesReactionsClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_dialogs_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_dialogs_gen.go index 74816d7a..8f7b9445 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_dialogs_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_dialogs_gen.go @@ -68,7 +68,7 @@ type MessagesGetDialogsRequest struct { OffsetPeer InputPeerClass // Number of list elements to be returned Limit int - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_groups_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_groups_gen.go index 48760d22..ad1cf2a7 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_groups_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_groups_gen.go @@ -32,15 +32,14 @@ var ( ) // MessagesGetEmojiGroupsRequest represents TL type `messages.getEmojiGroups#7488ce5b`. -// Represents a list of emoji categories¹, to be used when selecting custom emojis². +// Represents a list of emoji categories¹. // // Links: -// 1. https://core.telegram.org/api/custom-emoji#emoji-categories -// 2. https://core.telegram.org/api/custom-emoji +// 1. https://core.telegram.org/api/emoji-categories // // See https://core.telegram.org/method/messages.getEmojiGroups for reference. type MessagesGetEmojiGroupsRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation @@ -169,14 +168,12 @@ func (g *MessagesGetEmojiGroupsRequest) GetHash() (value int) { } // MessagesGetEmojiGroups invokes method messages.getEmojiGroups#7488ce5b returning error if any. -// Represents a list of emoji categories¹, to be used when selecting custom emojis². +// Represents a list of emoji categories¹. // // Links: -// 1. https://core.telegram.org/api/custom-emoji#emoji-categories -// 2. https://core.telegram.org/api/custom-emoji +// 1. https://core.telegram.org/api/emoji-categories // // See https://core.telegram.org/method/messages.getEmojiGroups for reference. -// Can be used by bots. func (c *Client) MessagesGetEmojiGroups(ctx context.Context, hash int) (MessagesEmojiGroupsClass, error) { var result MessagesEmojiGroupsBox diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_profile_photo_groups_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_profile_photo_groups_gen.go index 09d380e8..0d8b152f 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_profile_photo_groups_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_profile_photo_groups_gen.go @@ -36,12 +36,12 @@ var ( // set as profile picture². // // Links: -// 1. https://core.telegram.org/api/custom-emoji#emoji-categories +// 1. https://core.telegram.org/api/emoji-categories // 2. https://core.telegram.org/api/files#sticker-profile-pictures // // See https://core.telegram.org/method/messages.getEmojiProfilePhotoGroups for reference. type MessagesGetEmojiProfilePhotoGroupsRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation @@ -174,11 +174,10 @@ func (g *MessagesGetEmojiProfilePhotoGroupsRequest) GetHash() (value int) { // set as profile picture². // // Links: -// 1. https://core.telegram.org/api/custom-emoji#emoji-categories +// 1. https://core.telegram.org/api/emoji-categories // 2. https://core.telegram.org/api/files#sticker-profile-pictures // // See https://core.telegram.org/method/messages.getEmojiProfilePhotoGroups for reference. -// Can be used by bots. func (c *Client) MessagesGetEmojiProfilePhotoGroups(ctx context.Context, hash int) (MessagesEmojiGroupsClass, error) { var result MessagesEmojiGroupsBox diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_status_groups_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_status_groups_gen.go index d281320e..da8b9b7d 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_status_groups_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_status_groups_gen.go @@ -36,12 +36,12 @@ var ( // set as custom emoji status². // // Links: -// 1. https://core.telegram.org/api/custom-emoji#emoji-categories +// 1. https://core.telegram.org/api/emoji-categories // 2. https://core.telegram.org/api // // See https://core.telegram.org/method/messages.getEmojiStatusGroups for reference. type MessagesGetEmojiStatusGroupsRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation @@ -174,11 +174,10 @@ func (g *MessagesGetEmojiStatusGroupsRequest) GetHash() (value int) { // set as custom emoji status². // // Links: -// 1. https://core.telegram.org/api/custom-emoji#emoji-categories +// 1. https://core.telegram.org/api/emoji-categories // 2. https://core.telegram.org/api // // See https://core.telegram.org/method/messages.getEmojiStatusGroups for reference. -// Can be used by bots. func (c *Client) MessagesGetEmojiStatusGroups(ctx context.Context, hash int) (MessagesEmojiGroupsClass, error) { var result MessagesEmojiGroupsBox diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_sticker_groups_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_sticker_groups_gen.go index e71b9662..053acbef 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_sticker_groups_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_sticker_groups_gen.go @@ -32,10 +32,17 @@ var ( ) // MessagesGetEmojiStickerGroupsRequest represents TL type `messages.getEmojiStickerGroups#1dd840f5`. +// Represents a list of emoji categories¹, to be used when choosing a sticker. +// +// Links: +// 1. https://core.telegram.org/api/emoji-categories // // See https://core.telegram.org/method/messages.getEmojiStickerGroups for reference. type MessagesGetEmojiStickerGroupsRequest struct { - // Hash field of MessagesGetEmojiStickerGroupsRequest. + // Hash used for caching, for more info click here¹. + // + // Links: + // 1) https://core.telegram.org/api/offsets#hash-generation Hash int } @@ -161,6 +168,10 @@ func (g *MessagesGetEmojiStickerGroupsRequest) GetHash() (value int) { } // MessagesGetEmojiStickerGroups invokes method messages.getEmojiStickerGroups#1dd840f5 returning error if any. +// Represents a list of emoji categories¹, to be used when choosing a sticker. +// +// Links: +// 1. https://core.telegram.org/api/emoji-categories // // See https://core.telegram.org/method/messages.getEmojiStickerGroups for reference. func (c *Client) MessagesGetEmojiStickerGroups(ctx context.Context, hash int) (MessagesEmojiGroupsClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_stickers_gen.go index 6492c498..be8fc918 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_emoji_stickers_gen.go @@ -39,7 +39,7 @@ var ( // // See https://core.telegram.org/method/messages.getEmojiStickers for reference. type MessagesGetEmojiStickersRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_extended_media_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_extended_media_gen.go index 67dae580..4e7f686a 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_extended_media_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_extended_media_gen.go @@ -32,13 +32,20 @@ var ( ) // MessagesGetExtendedMediaRequest represents TL type `messages.getExtendedMedia#84f80814`. -// Get information about extended media +// Fetch updated information about paid media, see here »¹ for the full flow. +// This method will return an array of updateMessageExtendedMedia¹ updates, only for +// messages containing already bought paid media. +// No information will be returned for messages containing not yet bought paid media. +// +// Links: +// 1. https://core.telegram.org/api/paid-media +// 2. https://core.telegram.org/constructor/updateMessageExtendedMedia // // See https://core.telegram.org/method/messages.getExtendedMedia for reference. type MessagesGetExtendedMediaRequest struct { - // Peer + // Peer with visible paid media messages. Peer InputPeerClass - // Message IDs + // IDs of currently visible messages containing paid media. ID []int } @@ -207,7 +214,14 @@ func (g *MessagesGetExtendedMediaRequest) GetID() (value []int) { } // MessagesGetExtendedMedia invokes method messages.getExtendedMedia#84f80814 returning error if any. -// Get information about extended media +// Fetch updated information about paid media, see here »¹ for the full flow. +// This method will return an array of updateMessageExtendedMedia¹ updates, only for +// messages containing already bought paid media. +// No information will be returned for messages containing not yet bought paid media. +// +// Links: +// 1. https://core.telegram.org/api/paid-media +// 2. https://core.telegram.org/constructor/updateMessageExtendedMedia // // See https://core.telegram.org/method/messages.getExtendedMedia for reference. func (c *Client) MessagesGetExtendedMedia(ctx context.Context, request *MessagesGetExtendedMediaRequest) (UpdatesClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_fact_check_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_fact_check_gen.go index 5daeded4..48bc2a9b 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_fact_check_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_fact_check_gen.go @@ -32,12 +32,19 @@ var ( ) // MessagesGetFactCheckRequest represents TL type `messages.getFactCheck#b9cdc5ee`. +// Fetch one or more factchecks, see here »¹ for the full flow. +// +// Links: +// 1. https://core.telegram.org/api/factcheck // // See https://core.telegram.org/method/messages.getFactCheck for reference. type MessagesGetFactCheckRequest struct { - // Peer field of MessagesGetFactCheckRequest. + // Peer where the messages were sent. Peer InputPeerClass - // MsgID field of MessagesGetFactCheckRequest. + // Messages that have associated factCheck¹ constructors with the need_check flag set. + // + // Links: + // 1) https://core.telegram.org/constructor/factCheck MsgID []int } @@ -206,6 +213,14 @@ func (g *MessagesGetFactCheckRequest) GetMsgID() (value []int) { } // MessagesGetFactCheck invokes method messages.getFactCheck#b9cdc5ee returning error if any. +// Fetch one or more factchecks, see here »¹ for the full flow. +// +// Links: +// 1. https://core.telegram.org/api/factcheck +// +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/messages.getFactCheck for reference. func (c *Client) MessagesGetFactCheck(ctx context.Context, request *MessagesGetFactCheckRequest) ([]FactCheck, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_faved_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_faved_stickers_gen.go index fac247c8..bdd98b4c 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_faved_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_faved_stickers_gen.go @@ -36,7 +36,7 @@ var ( // // See https://core.telegram.org/method/messages.getFavedStickers for reference. type MessagesGetFavedStickersRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_featured_emoji_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_featured_emoji_stickers_gen.go index 4f039938..c5eb676f 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_featured_emoji_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_featured_emoji_stickers_gen.go @@ -36,7 +36,7 @@ var ( // // See https://core.telegram.org/method/messages.getFeaturedEmojiStickers for reference. type MessagesGetFeaturedEmojiStickersRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_featured_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_featured_stickers_gen.go index 9050916e..53fc535c 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_featured_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_featured_stickers_gen.go @@ -36,7 +36,7 @@ var ( // // See https://core.telegram.org/method/messages.getFeaturedStickers for reference. type MessagesGetFeaturedStickersRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_mask_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_mask_stickers_gen.go index 77c16017..0b5aa7ea 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_mask_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_mask_stickers_gen.go @@ -36,7 +36,7 @@ var ( // // See https://core.telegram.org/method/messages.getMaskStickers for reference. type MessagesGetMaskStickersRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_message_read_participants_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_message_read_participants_gen.go index c98d9901..bd053af2 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_message_read_participants_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_message_read_participants_gen.go @@ -214,7 +214,7 @@ func (g *MessagesGetMessageReadParticipantsRequest) GetMsgID() (value int) { // // Possible errors: // -// 400 CHAT_TOO_BIG: This method is not available for groups with more than chat_read_mark_size_threshold members, see client configuration ». +// 400 CHAT_TOO_BIG: This method is not available for groups with more than chat_read_mark_size_threshold members, see client configuration ». // 400 MSG_ID_INVALID: Invalid message ID provided. // 400 MSG_TOO_OLD: chat_read_mark_expire_period seconds have passed since the message was sent, read receipts were deleted. // 400 PEER_ID_INVALID: The provided peer id is invalid. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_messages_reactions_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_messages_reactions_gen.go index 593d34ce..bd11c247 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_messages_reactions_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_messages_reactions_gen.go @@ -217,6 +217,7 @@ func (g *MessagesGetMessagesReactionsRequest) GetID() (value []int) { // // Possible errors: // +// 400 CHANNEL_INVALID: The provided channel is invalid. // 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. // // See https://core.telegram.org/method/messages.getMessagesReactions for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_my_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_my_stickers_gen.go index e7086a5b..30945467 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_my_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_my_stickers_gen.go @@ -32,12 +32,22 @@ var ( ) // MessagesGetMyStickersRequest represents TL type `messages.getMyStickers#d0b5e1fc`. +// Fetch all stickersets »¹ owned by the current user. +// +// Links: +// 1. https://core.telegram.org/api/stickers // // See https://core.telegram.org/method/messages.getMyStickers for reference. type MessagesGetMyStickersRequest struct { - // OffsetID field of MessagesGetMyStickersRequest. + // Offsets for pagination, for more info click here¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets OffsetID int64 - // Limit field of MessagesGetMyStickersRequest. + // Maximum number of results to return, see pagination¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets Limit int } @@ -188,6 +198,10 @@ func (g *MessagesGetMyStickersRequest) GetLimit() (value int) { } // MessagesGetMyStickers invokes method messages.getMyStickers#d0b5e1fc returning error if any. +// Fetch all stickersets »¹ owned by the current user. +// +// Links: +// 1. https://core.telegram.org/api/stickers // // See https://core.telegram.org/method/messages.getMyStickers for reference. func (c *Client) MessagesGetMyStickers(ctx context.Context, request *MessagesGetMyStickersRequest) (*MessagesMyStickers, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_old_featured_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_old_featured_stickers_gen.go index 2321a083..bd7970f5 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_old_featured_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_old_featured_stickers_gen.go @@ -43,7 +43,7 @@ type MessagesGetOldFeaturedStickersRequest struct { // Links: // 1) https://core.telegram.org/api/offsets Limit int - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_outbox_read_date_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_outbox_read_date_gen.go index 7e5941b9..31cdea95 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_outbox_read_date_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_outbox_read_date_gen.go @@ -32,12 +32,30 @@ var ( ) // MessagesGetOutboxReadDateRequest represents TL type `messages.getOutboxReadDate#8c4bfe5d`. +// Get the exact read date of one of our messages, sent to a private chat with another +// user. +// Can be only done for private outgoing messages not older than appConfig +// pm_read_date_expire_period »¹. +// If the peer's userFull¹.read_dates_private flag is set, we will not be able to fetch +// the exact read date of messages we send to them, and a USER_PRIVACY_RESTRICTED RPC +// error will be emitted. +// The exact read date of messages might still be unavailable for other reasons, see here +// »² for more info. +// To set userFull³.read_dates_private for ourselves invoke account +// setGlobalPrivacySettings⁴, setting the settings.hide_read_marks flag. +// +// Links: +// 1. https://core.telegram.org/api/config#pm-read-date-expire-period +// 2. https://core.telegram.org/constructor/userFull +// 3. https://core.telegram.org/constructor/globalPrivacySettings +// 4. https://core.telegram.org/constructor/userFull +// 5. https://core.telegram.org/method/account.setGlobalPrivacySettings // // See https://core.telegram.org/method/messages.getOutboxReadDate for reference. type MessagesGetOutboxReadDateRequest struct { - // Peer field of MessagesGetOutboxReadDateRequest. + // The user to whom we sent the message. Peer InputPeerClass - // MsgID field of MessagesGetOutboxReadDateRequest. + // The message ID. MsgID int } @@ -193,6 +211,33 @@ func (g *MessagesGetOutboxReadDateRequest) GetMsgID() (value int) { } // MessagesGetOutboxReadDate invokes method messages.getOutboxReadDate#8c4bfe5d returning error if any. +// Get the exact read date of one of our messages, sent to a private chat with another +// user. +// Can be only done for private outgoing messages not older than appConfig +// pm_read_date_expire_period »¹. +// If the peer's userFull¹.read_dates_private flag is set, we will not be able to fetch +// the exact read date of messages we send to them, and a USER_PRIVACY_RESTRICTED RPC +// error will be emitted. +// The exact read date of messages might still be unavailable for other reasons, see here +// »² for more info. +// To set userFull³.read_dates_private for ourselves invoke account +// setGlobalPrivacySettings⁴, setting the settings.hide_read_marks flag. +// +// Links: +// 1. https://core.telegram.org/api/config#pm-read-date-expire-period +// 2. https://core.telegram.org/constructor/userFull +// 3. https://core.telegram.org/constructor/globalPrivacySettings +// 4. https://core.telegram.org/constructor/userFull +// 5. https://core.telegram.org/method/account.setGlobalPrivacySettings +// +// Possible errors: +// +// 400 MESSAGE_ID_INVALID: The provided message id is invalid. +// 400 MESSAGE_NOT_READ_YET: The specified message wasn't read yet. +// 400 MESSAGE_TOO_OLD: The message is too old, the requested information is not available. +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// 403 USER_PRIVACY_RESTRICTED: The user's privacy settings do not allow you to do this. +// 403 YOUR_PRIVACY_RESTRICTED: You cannot fetch the read date of this message because you have disallowed other users to do so for your messages; to fix, allow other users to see your exact last online date OR purchase a Telegram Premium subscription. // // See https://core.telegram.org/method/messages.getOutboxReadDate for reference. func (c *Client) MessagesGetOutboxReadDate(ctx context.Context, request *MessagesGetOutboxReadDateRequest) (*OutboxReadDate, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_paid_reaction_privacy_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_paid_reaction_privacy_gen.go new file mode 100644 index 00000000..9cec4b8a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_paid_reaction_privacy_gen.go @@ -0,0 +1,141 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesGetPaidReactionPrivacyRequest represents TL type `messages.getPaidReactionPrivacy#472455aa`. +// +// See https://core.telegram.org/method/messages.getPaidReactionPrivacy for reference. +type MessagesGetPaidReactionPrivacyRequest struct { +} + +// MessagesGetPaidReactionPrivacyRequestTypeID is TL type id of MessagesGetPaidReactionPrivacyRequest. +const MessagesGetPaidReactionPrivacyRequestTypeID = 0x472455aa + +// Ensuring interfaces in compile-time for MessagesGetPaidReactionPrivacyRequest. +var ( + _ bin.Encoder = &MessagesGetPaidReactionPrivacyRequest{} + _ bin.Decoder = &MessagesGetPaidReactionPrivacyRequest{} + _ bin.BareEncoder = &MessagesGetPaidReactionPrivacyRequest{} + _ bin.BareDecoder = &MessagesGetPaidReactionPrivacyRequest{} +) + +func (g *MessagesGetPaidReactionPrivacyRequest) Zero() bool { + if g == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (g *MessagesGetPaidReactionPrivacyRequest) String() string { + if g == nil { + return "MessagesGetPaidReactionPrivacyRequest(nil)" + } + type Alias MessagesGetPaidReactionPrivacyRequest + return fmt.Sprintf("MessagesGetPaidReactionPrivacyRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesGetPaidReactionPrivacyRequest) TypeID() uint32 { + return MessagesGetPaidReactionPrivacyRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesGetPaidReactionPrivacyRequest) TypeName() string { + return "messages.getPaidReactionPrivacy" +} + +// TypeInfo returns info about TL type. +func (g *MessagesGetPaidReactionPrivacyRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.getPaidReactionPrivacy", + ID: MessagesGetPaidReactionPrivacyRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (g *MessagesGetPaidReactionPrivacyRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode messages.getPaidReactionPrivacy#472455aa as nil") + } + b.PutID(MessagesGetPaidReactionPrivacyRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *MessagesGetPaidReactionPrivacyRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode messages.getPaidReactionPrivacy#472455aa as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (g *MessagesGetPaidReactionPrivacyRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode messages.getPaidReactionPrivacy#472455aa to nil") + } + if err := b.ConsumeID(MessagesGetPaidReactionPrivacyRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.getPaidReactionPrivacy#472455aa: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *MessagesGetPaidReactionPrivacyRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode messages.getPaidReactionPrivacy#472455aa to nil") + } + return nil +} + +// MessagesGetPaidReactionPrivacy invokes method messages.getPaidReactionPrivacy#472455aa returning error if any. +// +// See https://core.telegram.org/method/messages.getPaidReactionPrivacy for reference. +func (c *Client) MessagesGetPaidReactionPrivacy(ctx context.Context) (UpdatesClass, error) { + var result UpdatesBox + + request := &MessagesGetPaidReactionPrivacyRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.Updates, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_paid_reaction_privacy_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_paid_reaction_privacy_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_paid_reaction_privacy_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_quick_replies_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_quick_replies_gen.go index f130682c..f1d88313 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_quick_replies_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_quick_replies_gen.go @@ -32,10 +32,18 @@ var ( ) // MessagesGetQuickRepliesRequest represents TL type `messages.getQuickReplies#d483f2a8`. +// Fetch basic info about all existing quick reply shortcuts¹. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts // // See https://core.telegram.org/method/messages.getQuickReplies for reference. type MessagesGetQuickRepliesRequest struct { - // Hash field of MessagesGetQuickRepliesRequest. + // Hash for pagination, generated as specified here »¹ (not the usual algorithm used + // for hash generation.) + // + // Links: + // 1) https://core.telegram.org/api/business#quick-reply-shortcuts Hash int64 } @@ -161,6 +169,10 @@ func (g *MessagesGetQuickRepliesRequest) GetHash() (value int64) { } // MessagesGetQuickReplies invokes method messages.getQuickReplies#d483f2a8 returning error if any. +// Fetch basic info about all existing quick reply shortcuts¹. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts // // See https://core.telegram.org/method/messages.getQuickReplies for reference. func (c *Client) MessagesGetQuickReplies(ctx context.Context, hash int64) (MessagesQuickRepliesClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_quick_reply_messages_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_quick_reply_messages_gen.go index bcd2fbba..560d3e98 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_quick_reply_messages_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_quick_reply_messages_gen.go @@ -32,18 +32,28 @@ var ( ) // MessagesGetQuickReplyMessagesRequest represents TL type `messages.getQuickReplyMessages#94a495c3`. +// Fetch (a subset or all) messages in a quick reply shortcut »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts // // See https://core.telegram.org/method/messages.getQuickReplyMessages for reference. type MessagesGetQuickReplyMessagesRequest struct { - // Flags field of MessagesGetQuickReplyMessagesRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // ShortcutID field of MessagesGetQuickReplyMessagesRequest. + // Quick reply shortcut ID. ShortcutID int - // ID field of MessagesGetQuickReplyMessagesRequest. + // IDs of the messages to fetch, if empty fetches all of them. // // Use SetID and GetID helpers. ID []int - // Hash field of MessagesGetQuickReplyMessagesRequest. + // Hash used for caching, for more info click here¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets#hash-generation Hash int64 } @@ -267,6 +277,14 @@ func (g *MessagesGetQuickReplyMessagesRequest) GetHash() (value int64) { } // MessagesGetQuickReplyMessages invokes method messages.getQuickReplyMessages#94a495c3 returning error if any. +// Fetch (a subset or all) messages in a quick reply shortcut »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts +// +// Possible errors: +// +// 400 SHORTCUT_INVALID: The specified shortcut is invalid. // // See https://core.telegram.org/method/messages.getQuickReplyMessages for reference. func (c *Client) MessagesGetQuickReplyMessages(ctx context.Context, request *MessagesGetQuickReplyMessagesRequest) (MessagesMessagesClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_recent_locations_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_recent_locations_gen.go index 4e2f2dcf..07d8d857 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_recent_locations_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_recent_locations_gen.go @@ -43,7 +43,7 @@ type MessagesGetRecentLocationsRequest struct { // Links: // 1) https://core.telegram.org/api/offsets Limit int - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_recent_reactions_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_recent_reactions_gen.go index dc32dd22..4d6eeab1 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_recent_reactions_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_recent_reactions_gen.go @@ -44,7 +44,7 @@ type MessagesGetRecentReactionsRequest struct { // Links: // 1) https://core.telegram.org/api/offsets Limit int - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_recent_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_recent_stickers_gen.go index 4a5119c2..a90dfbf6 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_recent_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_recent_stickers_gen.go @@ -43,7 +43,7 @@ type MessagesGetRecentStickersRequest struct { Flags bin.Fields // Get stickers recently attached to photo or video files Attached bool - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_replies_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_replies_gen.go index 8961d8a6..314b2d67 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_replies_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_replies_gen.go @@ -66,7 +66,7 @@ type MessagesGetRepliesRequest struct { // If a positive value was transferred, the method will return only messages with ID // bigger than min_id MinID int - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_saved_dialogs_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_saved_dialogs_gen.go index 75d89a99..2a213e3a 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_saved_dialogs_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_saved_dialogs_gen.go @@ -64,7 +64,7 @@ type MessagesGetSavedDialogsRequest struct { OffsetPeer InputPeerClass // Number of list elements to be returned Limit int - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_saved_gifs_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_saved_gifs_gen.go index d381bd56..40dd8c2f 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_saved_gifs_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_saved_gifs_gen.go @@ -32,11 +32,11 @@ var ( ) // MessagesGetSavedGifsRequest represents TL type `messages.getSavedGifs#5cf09635`. -// Get saved GIFs +// Get saved GIFs. // // See https://core.telegram.org/method/messages.getSavedGifs for reference. type MessagesGetSavedGifsRequest struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation @@ -165,7 +165,7 @@ func (g *MessagesGetSavedGifsRequest) GetHash() (value int64) { } // MessagesGetSavedGifs invokes method messages.getSavedGifs#5cf09635 returning error if any. -// Get saved GIFs +// Get saved GIFs. // // See https://core.telegram.org/method/messages.getSavedGifs for reference. func (c *Client) MessagesGetSavedGifs(ctx context.Context, hash int64) (MessagesSavedGifsClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_saved_reaction_tags_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_saved_reaction_tags_gen.go index 3151f987..d1fd2614 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_saved_reaction_tags_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_saved_reaction_tags_gen.go @@ -32,16 +32,29 @@ var ( ) // MessagesGetSavedReactionTagsRequest represents TL type `messages.getSavedReactionTags#3637e05b`. +// Fetch the full list of saved message tags¹ created by the user. +// +// Links: +// 1. https://core.telegram.org/api/saved-messages#tags // // See https://core.telegram.org/method/messages.getSavedReactionTags for reference. type MessagesGetSavedReactionTagsRequest struct { - // Flags field of MessagesGetSavedReactionTagsRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Peer field of MessagesGetSavedReactionTagsRequest. + // If set, returns tags only used in the specified saved message dialog¹. + // + // Links: + // 1) https://core.telegram.org/api/saved-messages#saved-message-dialogs // // Use SetPeer and GetPeer helpers. Peer InputPeerClass - // Hash field of MessagesGetSavedReactionTagsRequest. + // Hash used for caching, for more info click here¹. + // + // Links: + // 1) https://core.telegram.org/api/offsets#hash-generation Hash int64 } @@ -232,6 +245,10 @@ func (g *MessagesGetSavedReactionTagsRequest) GetHash() (value int64) { } // MessagesGetSavedReactionTags invokes method messages.getSavedReactionTags#3637e05b returning error if any. +// Fetch the full list of saved message tags¹ created by the user. +// +// Links: +// 1. https://core.telegram.org/api/saved-messages#tags // // See https://core.telegram.org/method/messages.getSavedReactionTags for reference. func (c *Client) MessagesGetSavedReactionTags(ctx context.Context, request *MessagesGetSavedReactionTagsRequest) (MessagesSavedReactionTagsClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_scheduled_history_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_scheduled_history_gen.go index 8d99e8f8..d76ab404 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_scheduled_history_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_scheduled_history_gen.go @@ -38,7 +38,9 @@ var ( type MessagesGetScheduledHistoryRequest struct { // Peer Peer InputPeerClass - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. To generate the hash, populate the + // ids array with the id, date and edit_date (in this order) of the previously returned + // messages (in order, i.e. ids = [id1, date1, edit_date1, id2, date2, edit_date2, ...]). // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_search_results_calendar_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_search_results_calendar_gen.go index 6a7cd49f..6358cf1d 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_search_results_calendar_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_search_results_calendar_gen.go @@ -352,6 +352,7 @@ func (g *MessagesGetSearchResultsCalendarRequest) GetOffsetDate() (value int) { // Possible errors: // // 400 FILTER_NOT_SUPPORTED: The specified filter cannot be used in this context. +// 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/messages.getSearchResultsCalendar for reference. func (c *Client) MessagesGetSearchResultsCalendar(ctx context.Context, request *MessagesGetSearchResultsCalendarRequest) (*MessagesSearchResultsCalendar, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_search_results_positions_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_search_results_positions_gen.go index b7cc17ea..cec6ec60 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_search_results_positions_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_search_results_positions_gen.go @@ -349,6 +349,10 @@ func (g *MessagesGetSearchResultsPositionsRequest) GetLimit() (value int) { // Returns the results in reverse chronological order (i.e., in order of decreasing // message_id). // +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// // See https://core.telegram.org/method/messages.getSearchResultsPositions for reference. func (c *Client) MessagesGetSearchResultsPositions(ctx context.Context, request *MessagesGetSearchResultsPositionsRequest) (*MessagesSearchResultsPositions, error) { var result MessagesSearchResultsPositions diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_sticker_set_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_sticker_set_gen.go index 52b5fb06..0da828b4 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_sticker_set_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_sticker_set_gen.go @@ -38,7 +38,7 @@ var ( type MessagesGetStickerSetRequest struct { // Stickerset Stickerset InputStickerSetClass - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_stickers_gen.go index 709009b3..63cc5f2d 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_stickers_gen.go @@ -38,7 +38,7 @@ var ( type MessagesGetStickersRequest struct { // The emoji Emoticon string - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_top_reactions_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_top_reactions_gen.go index 36c69065..378e2e02 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_top_reactions_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_top_reactions_gen.go @@ -44,7 +44,7 @@ type MessagesGetTopReactionsRequest struct { // Links: // 1) https://core.telegram.org/api/offsets Limit int - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_unread_reactions_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_unread_reactions_gen.go index 80caf418..f6202c06 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_unread_reactions_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_unread_reactions_gen.go @@ -385,6 +385,10 @@ func (g *MessagesGetUnreadReactionsRequest) GetMinID() (value int) { // MessagesGetUnreadReactions invokes method messages.getUnreadReactions#3223495b returning error if any. // Get unread reactions to messages you sent // +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// // See https://core.telegram.org/method/messages.getUnreadReactions for reference. func (c *Client) MessagesGetUnreadReactions(ctx context.Context, request *MessagesGetUnreadReactionsRequest) (MessagesMessagesClass, error) { var result MessagesMessagesBox diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_web_page_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_web_page_gen.go index fe59f1a1..cae47b92 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_web_page_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_web_page_gen.go @@ -41,10 +41,15 @@ var ( type MessagesGetWebPageRequest struct { // URL of IV page to fetch URL string - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. Note: the usual hash generation + // algorithm cannot be used in this case, please re-use the webPage².hash field returned + // by a previous call to the method, or pass 0 if this is the first call or if the + // previous call did not return a webPage³. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation + // 2) https://core.telegram.org/constructor/webPage + // 3) https://core.telegram.org/constructor/webPage Hash int } diff --git a/vendor/github.com/gotd/td/tg/tl_messages_get_web_page_preview_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_get_web_page_preview_gen.go index dc9d8e14..aac95694 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_get_web_page_preview_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_get_web_page_preview_gen.go @@ -264,7 +264,7 @@ func (g *MessagesGetWebPagePreviewRequest) MapEntities() (value MessageEntityCla // // Possible errors: // -// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. +// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. // 400 MESSAGE_EMPTY: The provided message is empty. // // See https://core.telegram.org/method/messages.getWebPagePreview for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_hide_peer_settings_bar_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_hide_peer_settings_bar_gen.go index 3ee9f73d..390946b4 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_hide_peer_settings_bar_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_hide_peer_settings_bar_gen.go @@ -181,6 +181,10 @@ func (h *MessagesHidePeerSettingsBarRequest) GetPeer() (value InputPeerClass) { // 1. https://core.telegram.org/api/action-bar // 2. https://core.telegram.org/api/action-bar // +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// // See https://core.telegram.org/method/messages.hidePeerSettingsBar for reference. func (c *Client) MessagesHidePeerSettingsBar(ctx context.Context, peer InputPeerClass) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_messages_init_history_import_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_init_history_import_gen.go index 8855ac45..a9fddad8 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_init_history_import_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_init_history_import_gen.go @@ -245,8 +245,11 @@ func (i *MessagesInitHistoryImportRequest) GetMediaCount() (value int) { // // Possible errors: // +// 400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. // 400 IMPORT_FILE_INVALID: The specified chat export file is invalid. +// 400 IMPORT_FORMAT_DATE_INVALID: The date specified in the import file is invalid. // 400 IMPORT_FORMAT_UNRECOGNIZED: The specified chat export file was exported from an unsupported chat app. +// 400 PEER_ID_INVALID: The provided peer id is invalid. // 406 PREVIOUS_CHAT_IMPORT_ACTIVE_WAIT_%dMIN: Import for this chat is already in progress, wait %d minutes before starting a new one. // // See https://core.telegram.org/method/messages.initHistoryImport for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_invited_users_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_invited_users_gen.go index 2d7e34cf..9f079084 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_invited_users_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_invited_users_gen.go @@ -32,12 +32,18 @@ var ( ) // MessagesInvitedUsers represents TL type `messages.invitedUsers#7f5defa6`. +// Contains info about successfully or unsuccessfully invited »¹ users. +// +// Links: +// 1. https://core.telegram.org/api/invites#direct-invites // // See https://core.telegram.org/constructor/messages.invitedUsers for reference. type MessagesInvitedUsers struct { - // Updates field of MessagesInvitedUsers. + // List of updates about successfully invited users (and eventually info about the + // created group) Updates UpdatesClass - // MissingInvitees field of MessagesInvitedUsers. + // A list of users that could not be invited, along with the reason why they couldn't be + // invited. MissingInvitees []MissingInvitee } diff --git a/vendor/github.com/gotd/td/tg/tl_messages_my_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_my_stickers_gen.go index b41655d1..adf0e9cf 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_my_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_my_stickers_gen.go @@ -32,12 +32,16 @@ var ( ) // MessagesMyStickers represents TL type `messages.myStickers#faff629d`. +// The list of stickersets owned by the current account »¹. +// +// Links: +// 1. https://core.telegram.org/api/stickers // // See https://core.telegram.org/constructor/messages.myStickers for reference. type MessagesMyStickers struct { - // Count field of MessagesMyStickers. + // Total number of owned stickersets. Count int - // Sets field of MessagesMyStickers. + // Stickersets Sets []StickerSetCoveredClass } diff --git a/vendor/github.com/gotd/td/tg/tl_messages_prolong_web_view_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_prolong_web_view_gen.go index 5a9ee792..e7e42129 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_prolong_web_view_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_prolong_web_view_gen.go @@ -408,6 +408,10 @@ func (p *MessagesProlongWebViewRequest) GetSendAs() (value InputPeerClass, ok bo // Indicate to the server (from the user side) that the user is still using a web app. // If the method returns a QUERY_ID_INVALID error, the webview must be closed. // +// Possible errors: +// +// 400 BOT_INVALID: This is not a valid bot. +// // See https://core.telegram.org/method/messages.prolongWebView for reference. func (c *Client) MessagesProlongWebView(ctx context.Context, request *MessagesProlongWebViewRequest) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_messages_quick_replies_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_quick_replies_gen.go index 6557c1ac..a6f6dad0 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_quick_replies_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_quick_replies_gen.go @@ -32,16 +32,20 @@ var ( ) // MessagesQuickReplies represents TL type `messages.quickReplies#c68d6695`. +// Info about quick reply shortcuts »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts // // See https://core.telegram.org/constructor/messages.quickReplies for reference. type MessagesQuickReplies struct { - // QuickReplies field of MessagesQuickReplies. + // Quick reply shortcuts. QuickReplies []QuickReply - // Messages field of MessagesQuickReplies. + // Messages mentioned in quick_replies. Messages []MessageClass - // Chats field of MessagesQuickReplies. + // Mentioned chats Chats []ChatClass - // Users field of MessagesQuickReplies. + // Mentioned users Users []UserClass } @@ -331,6 +335,10 @@ func (q *MessagesQuickReplies) MapUsers() (value UserClassArray) { } // MessagesQuickRepliesNotModified represents TL type `messages.quickRepliesNotModified#5f91eb5b`. +// Info about quick reply shortcuts »¹ hasn't changed. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts // // See https://core.telegram.org/constructor/messages.quickRepliesNotModified for reference. type MessagesQuickRepliesNotModified struct { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_reactions_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_reactions_gen.go index 92a27284..cb3fcb25 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_reactions_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_reactions_gen.go @@ -144,7 +144,7 @@ func (r *MessagesReactionsNotModified) DecodeBare(b *bin.Buffer) error { // // See https://core.telegram.org/constructor/messages.reactions for reference. type MessagesReactions struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_read_encrypted_history_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_read_encrypted_history_gen.go index b8faf048..c9081880 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_read_encrypted_history_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_read_encrypted_history_gen.go @@ -193,6 +193,7 @@ func (r *MessagesReadEncryptedHistoryRequest) GetMaxDate() (value int) { // // Possible errors: // +// 400 CHAT_ID_INVALID: The provided chat id is invalid. // 400 MAX_DATE_INVALID: The specified maximum date is invalid. // 400 MSG_WAIT_FAILED: A waiting call returned an error. // diff --git a/vendor/github.com/gotd/td/tg/tl_messages_recent_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_recent_stickers_gen.go index c8e0e066..43ff94e2 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_recent_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_recent_stickers_gen.go @@ -138,7 +138,7 @@ func (r *MessagesRecentStickersNotModified) DecodeBare(b *bin.Buffer) error { // // See https://core.telegram.org/constructor/messages.recentStickers for reference. type MessagesRecentStickers struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_reorder_quick_replies_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_reorder_quick_replies_gen.go index e768743f..fff6ca3c 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_reorder_quick_replies_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_reorder_quick_replies_gen.go @@ -32,10 +32,19 @@ var ( ) // MessagesReorderQuickRepliesRequest represents TL type `messages.reorderQuickReplies#60331907`. +// Reorder quick reply shortcuts¹. +// This will emit an updateQuickReplies¹ update to other logged-in sessions. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts +// 2. https://core.telegram.org/constructor/updateQuickReplies // // See https://core.telegram.org/method/messages.reorderQuickReplies for reference. type MessagesReorderQuickRepliesRequest struct { - // Order field of MessagesReorderQuickRepliesRequest. + // IDs of all created quick reply shortcuts¹, in the desired order. + // + // Links: + // 1) https://core.telegram.org/api/business#quick-reply-shortcuts Order []int } @@ -174,6 +183,16 @@ func (r *MessagesReorderQuickRepliesRequest) GetOrder() (value []int) { } // MessagesReorderQuickReplies invokes method messages.reorderQuickReplies#60331907 returning error if any. +// Reorder quick reply shortcuts¹. +// This will emit an updateQuickReplies¹ update to other logged-in sessions. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts +// 2. https://core.telegram.org/constructor/updateQuickReplies +// +// Possible errors: +// +// 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. // // See https://core.telegram.org/method/messages.reorderQuickReplies for reference. func (c *Client) MessagesReorderQuickReplies(ctx context.Context, order []int) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_report_reaction_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_report_reaction_gen.go index b4d96bf3..a6b920bf 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_report_reaction_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_report_reaction_gen.go @@ -237,6 +237,7 @@ func (r *MessagesReportReactionRequest) GetReactionPeer() (value InputPeerClass) // Possible errors: // // 400 MSG_ID_INVALID: Invalid message ID provided. +// 400 PEER_ID_INVALID: The provided peer id is invalid. // 400 USER_ID_INVALID: The provided user ID is invalid. // // See https://core.telegram.org/method/messages.reportReaction for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_request_app_web_view_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_request_app_web_view_gen.go index 30db8ae5..97542e8e 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_request_app_web_view_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_request_app_web_view_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesRequestAppWebViewRequest represents TL type `messages.requestAppWebView#8c5a3b3c`. +// MessagesRequestAppWebViewRequest represents TL type `messages.requestAppWebView#53618bce`. // Open a bot mini app¹ from a direct Mini App deep link², sending over user // information after user confirmation. // After calling this method, until the user closes the webview, messages @@ -55,6 +55,13 @@ type MessagesRequestAppWebViewRequest struct { // Links: // 1) https://core.telegram.org/api/links#direct-mini-app-links WriteAllowed bool + // If set, requests to open the mini app in compact mode (as opposed to fullview mode). + // Must be set if the mode parameter of the direct Mini App deep link¹ is equal to + // compact. + // + // Links: + // 1) https://core.telegram.org/api/links#direct-mini-app-links + Compact bool // If the client has clicked on the link in a Telegram chat, pass the chat's peer // information; otherwise pass the bot's peer information, instead. Peer InputPeerClass @@ -85,7 +92,7 @@ type MessagesRequestAppWebViewRequest struct { } // MessagesRequestAppWebViewRequestTypeID is TL type id of MessagesRequestAppWebViewRequest. -const MessagesRequestAppWebViewRequestTypeID = 0x8c5a3b3c +const MessagesRequestAppWebViewRequestTypeID = 0x53618bce // Ensuring interfaces in compile-time for MessagesRequestAppWebViewRequest. var ( @@ -105,6 +112,9 @@ func (r *MessagesRequestAppWebViewRequest) Zero() bool { if !(r.WriteAllowed == false) { return false } + if !(r.Compact == false) { + return false + } if !(r.Peer == nil) { return false } @@ -136,6 +146,7 @@ func (r *MessagesRequestAppWebViewRequest) String() string { // FillFrom fills MessagesRequestAppWebViewRequest from given interface. func (r *MessagesRequestAppWebViewRequest) FillFrom(from interface { GetWriteAllowed() (value bool) + GetCompact() (value bool) GetPeer() (value InputPeerClass) GetApp() (value InputBotAppClass) GetStartParam() (value string, ok bool) @@ -143,6 +154,7 @@ func (r *MessagesRequestAppWebViewRequest) FillFrom(from interface { GetPlatform() (value string) }) { r.WriteAllowed = from.GetWriteAllowed() + r.Compact = from.GetCompact() r.Peer = from.GetPeer() r.App = from.GetApp() if val, ok := from.GetStartParam(); ok { @@ -184,6 +196,11 @@ func (r *MessagesRequestAppWebViewRequest) TypeInfo() tdp.Type { SchemaName: "write_allowed", Null: !r.Flags.Has(0), }, + { + Name: "Compact", + SchemaName: "compact", + Null: !r.Flags.Has(7), + }, { Name: "Peer", SchemaName: "peer", @@ -215,6 +232,9 @@ func (r *MessagesRequestAppWebViewRequest) SetFlags() { if !(r.WriteAllowed == false) { r.Flags.Set(0) } + if !(r.Compact == false) { + r.Flags.Set(7) + } if !(r.StartParam == "") { r.Flags.Set(1) } @@ -226,7 +246,7 @@ func (r *MessagesRequestAppWebViewRequest) SetFlags() { // Encode implements bin.Encoder. func (r *MessagesRequestAppWebViewRequest) Encode(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't encode messages.requestAppWebView#8c5a3b3c as nil") + return fmt.Errorf("can't encode messages.requestAppWebView#53618bce as nil") } b.PutID(MessagesRequestAppWebViewRequestTypeID) return r.EncodeBare(b) @@ -235,30 +255,30 @@ func (r *MessagesRequestAppWebViewRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (r *MessagesRequestAppWebViewRequest) EncodeBare(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't encode messages.requestAppWebView#8c5a3b3c as nil") + return fmt.Errorf("can't encode messages.requestAppWebView#53618bce as nil") } r.SetFlags() if err := r.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.requestAppWebView#8c5a3b3c: field flags: %w", err) + return fmt.Errorf("unable to encode messages.requestAppWebView#53618bce: field flags: %w", err) } if r.Peer == nil { - return fmt.Errorf("unable to encode messages.requestAppWebView#8c5a3b3c: field peer is nil") + return fmt.Errorf("unable to encode messages.requestAppWebView#53618bce: field peer is nil") } if err := r.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.requestAppWebView#8c5a3b3c: field peer: %w", err) + return fmt.Errorf("unable to encode messages.requestAppWebView#53618bce: field peer: %w", err) } if r.App == nil { - return fmt.Errorf("unable to encode messages.requestAppWebView#8c5a3b3c: field app is nil") + return fmt.Errorf("unable to encode messages.requestAppWebView#53618bce: field app is nil") } if err := r.App.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.requestAppWebView#8c5a3b3c: field app: %w", err) + return fmt.Errorf("unable to encode messages.requestAppWebView#53618bce: field app: %w", err) } if r.Flags.Has(1) { b.PutString(r.StartParam) } if r.Flags.Has(2) { if err := r.ThemeParams.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.requestAppWebView#8c5a3b3c: field theme_params: %w", err) + return fmt.Errorf("unable to encode messages.requestAppWebView#53618bce: field theme_params: %w", err) } } b.PutString(r.Platform) @@ -268,10 +288,10 @@ func (r *MessagesRequestAppWebViewRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (r *MessagesRequestAppWebViewRequest) Decode(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't decode messages.requestAppWebView#8c5a3b3c to nil") + return fmt.Errorf("can't decode messages.requestAppWebView#53618bce to nil") } if err := b.ConsumeID(MessagesRequestAppWebViewRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.requestAppWebView#8c5a3b3c: %w", err) + return fmt.Errorf("unable to decode messages.requestAppWebView#53618bce: %w", err) } return r.DecodeBare(b) } @@ -279,44 +299,45 @@ func (r *MessagesRequestAppWebViewRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (r *MessagesRequestAppWebViewRequest) DecodeBare(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't decode messages.requestAppWebView#8c5a3b3c to nil") + return fmt.Errorf("can't decode messages.requestAppWebView#53618bce to nil") } { if err := r.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.requestAppWebView#8c5a3b3c: field flags: %w", err) + return fmt.Errorf("unable to decode messages.requestAppWebView#53618bce: field flags: %w", err) } } r.WriteAllowed = r.Flags.Has(0) + r.Compact = r.Flags.Has(7) { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.requestAppWebView#8c5a3b3c: field peer: %w", err) + return fmt.Errorf("unable to decode messages.requestAppWebView#53618bce: field peer: %w", err) } r.Peer = value } { value, err := DecodeInputBotApp(b) if err != nil { - return fmt.Errorf("unable to decode messages.requestAppWebView#8c5a3b3c: field app: %w", err) + return fmt.Errorf("unable to decode messages.requestAppWebView#53618bce: field app: %w", err) } r.App = value } if r.Flags.Has(1) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messages.requestAppWebView#8c5a3b3c: field start_param: %w", err) + return fmt.Errorf("unable to decode messages.requestAppWebView#53618bce: field start_param: %w", err) } r.StartParam = value } if r.Flags.Has(2) { if err := r.ThemeParams.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.requestAppWebView#8c5a3b3c: field theme_params: %w", err) + return fmt.Errorf("unable to decode messages.requestAppWebView#53618bce: field theme_params: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messages.requestAppWebView#8c5a3b3c: field platform: %w", err) + return fmt.Errorf("unable to decode messages.requestAppWebView#53618bce: field platform: %w", err) } r.Platform = value } @@ -342,6 +363,25 @@ func (r *MessagesRequestAppWebViewRequest) GetWriteAllowed() (value bool) { return r.Flags.Has(0) } +// SetCompact sets value of Compact conditional field. +func (r *MessagesRequestAppWebViewRequest) SetCompact(value bool) { + if value { + r.Flags.Set(7) + r.Compact = true + } else { + r.Flags.Unset(7) + r.Compact = false + } +} + +// GetCompact returns value of Compact conditional field. +func (r *MessagesRequestAppWebViewRequest) GetCompact() (value bool) { + if r == nil { + return + } + return r.Flags.Has(7) +} + // GetPeer returns value of Peer field. func (r *MessagesRequestAppWebViewRequest) GetPeer() (value InputPeerClass) { if r == nil { @@ -402,7 +442,7 @@ func (r *MessagesRequestAppWebViewRequest) GetPlatform() (value string) { return r.Platform } -// MessagesRequestAppWebView invokes method messages.requestAppWebView#8c5a3b3c returning error if any. +// MessagesRequestAppWebView invokes method messages.requestAppWebView#53618bce returning error if any. // Open a bot mini app¹ from a direct Mini App deep link², sending over user // information after user confirmation. // After calling this method, until the user closes the webview, messages @@ -419,8 +459,8 @@ func (r *MessagesRequestAppWebViewRequest) GetPlatform() (value string) { // 400 BOT_APP_SHORTNAME_INVALID: The specified bot app short name is invalid. // // See https://core.telegram.org/method/messages.requestAppWebView for reference. -func (c *Client) MessagesRequestAppWebView(ctx context.Context, request *MessagesRequestAppWebViewRequest) (*AppWebViewResultURL, error) { - var result AppWebViewResultURL +func (c *Client) MessagesRequestAppWebView(ctx context.Context, request *MessagesRequestAppWebViewRequest) (*WebViewResultURL, error) { + var result WebViewResultURL if err := c.rpc.Invoke(ctx, request, &result); err != nil { return nil, err diff --git a/vendor/github.com/gotd/td/tg/tl_messages_request_main_web_view_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_request_main_web_view_gen.go new file mode 100644 index 00000000..b3c65493 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_messages_request_main_web_view_gen.go @@ -0,0 +1,414 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesRequestMainWebViewRequest represents TL type `messages.requestMainWebView#c9e01e7b`. +// Open a Main Mini App¹. +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-apps +// +// See https://core.telegram.org/method/messages.requestMainWebView for reference. +type MessagesRequestMainWebViewRequest struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // If set, requests to open the mini app in compact mode (as opposed to fullview mode). + // Must be set if the mode parameter of the Main Mini App link¹ is equal to compact. + // + // Links: + // 1) https://core.telegram.org/api/links#main-mini-app-links + Compact bool + // Currently open chat, may be inputPeerEmpty¹ if no chat is currently open. + // + // Links: + // 1) https://core.telegram.org/constructor/inputPeerEmpty + Peer InputPeerClass + // Bot that owns the main mini app. + Bot InputUserClass + // Start parameter, if opening from a Main Mini App link »¹. + // + // Links: + // 1) https://core.telegram.org/api/links#main-mini-app-links + // + // Use SetStartParam and GetStartParam helpers. + StartParam string + // Theme parameters »¹ + // + // Links: + // 1) https://core.telegram.org/api/bots/webapps#theme-parameters + // + // Use SetThemeParams and GetThemeParams helpers. + ThemeParams DataJSON + // Short name of the application; 0-64 English letters, digits, and underscores + Platform string +} + +// MessagesRequestMainWebViewRequestTypeID is TL type id of MessagesRequestMainWebViewRequest. +const MessagesRequestMainWebViewRequestTypeID = 0xc9e01e7b + +// Ensuring interfaces in compile-time for MessagesRequestMainWebViewRequest. +var ( + _ bin.Encoder = &MessagesRequestMainWebViewRequest{} + _ bin.Decoder = &MessagesRequestMainWebViewRequest{} + _ bin.BareEncoder = &MessagesRequestMainWebViewRequest{} + _ bin.BareDecoder = &MessagesRequestMainWebViewRequest{} +) + +func (r *MessagesRequestMainWebViewRequest) Zero() bool { + if r == nil { + return true + } + if !(r.Flags.Zero()) { + return false + } + if !(r.Compact == false) { + return false + } + if !(r.Peer == nil) { + return false + } + if !(r.Bot == nil) { + return false + } + if !(r.StartParam == "") { + return false + } + if !(r.ThemeParams.Zero()) { + return false + } + if !(r.Platform == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (r *MessagesRequestMainWebViewRequest) String() string { + if r == nil { + return "MessagesRequestMainWebViewRequest(nil)" + } + type Alias MessagesRequestMainWebViewRequest + return fmt.Sprintf("MessagesRequestMainWebViewRequest%+v", Alias(*r)) +} + +// FillFrom fills MessagesRequestMainWebViewRequest from given interface. +func (r *MessagesRequestMainWebViewRequest) FillFrom(from interface { + GetCompact() (value bool) + GetPeer() (value InputPeerClass) + GetBot() (value InputUserClass) + GetStartParam() (value string, ok bool) + GetThemeParams() (value DataJSON, ok bool) + GetPlatform() (value string) +}) { + r.Compact = from.GetCompact() + r.Peer = from.GetPeer() + r.Bot = from.GetBot() + if val, ok := from.GetStartParam(); ok { + r.StartParam = val + } + + if val, ok := from.GetThemeParams(); ok { + r.ThemeParams = val + } + + r.Platform = from.GetPlatform() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesRequestMainWebViewRequest) TypeID() uint32 { + return MessagesRequestMainWebViewRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesRequestMainWebViewRequest) TypeName() string { + return "messages.requestMainWebView" +} + +// TypeInfo returns info about TL type. +func (r *MessagesRequestMainWebViewRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.requestMainWebView", + ID: MessagesRequestMainWebViewRequestTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Compact", + SchemaName: "compact", + Null: !r.Flags.Has(7), + }, + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "Bot", + SchemaName: "bot", + }, + { + Name: "StartParam", + SchemaName: "start_param", + Null: !r.Flags.Has(1), + }, + { + Name: "ThemeParams", + SchemaName: "theme_params", + Null: !r.Flags.Has(0), + }, + { + Name: "Platform", + SchemaName: "platform", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (r *MessagesRequestMainWebViewRequest) SetFlags() { + if !(r.Compact == false) { + r.Flags.Set(7) + } + if !(r.StartParam == "") { + r.Flags.Set(1) + } + if !(r.ThemeParams.Zero()) { + r.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (r *MessagesRequestMainWebViewRequest) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode messages.requestMainWebView#c9e01e7b as nil") + } + b.PutID(MessagesRequestMainWebViewRequestTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *MessagesRequestMainWebViewRequest) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode messages.requestMainWebView#c9e01e7b as nil") + } + r.SetFlags() + if err := r.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.requestMainWebView#c9e01e7b: field flags: %w", err) + } + if r.Peer == nil { + return fmt.Errorf("unable to encode messages.requestMainWebView#c9e01e7b: field peer is nil") + } + if err := r.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.requestMainWebView#c9e01e7b: field peer: %w", err) + } + if r.Bot == nil { + return fmt.Errorf("unable to encode messages.requestMainWebView#c9e01e7b: field bot is nil") + } + if err := r.Bot.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.requestMainWebView#c9e01e7b: field bot: %w", err) + } + if r.Flags.Has(1) { + b.PutString(r.StartParam) + } + if r.Flags.Has(0) { + if err := r.ThemeParams.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.requestMainWebView#c9e01e7b: field theme_params: %w", err) + } + } + b.PutString(r.Platform) + return nil +} + +// Decode implements bin.Decoder. +func (r *MessagesRequestMainWebViewRequest) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode messages.requestMainWebView#c9e01e7b to nil") + } + if err := b.ConsumeID(MessagesRequestMainWebViewRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.requestMainWebView#c9e01e7b: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *MessagesRequestMainWebViewRequest) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode messages.requestMainWebView#c9e01e7b to nil") + } + { + if err := r.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messages.requestMainWebView#c9e01e7b: field flags: %w", err) + } + } + r.Compact = r.Flags.Has(7) + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode messages.requestMainWebView#c9e01e7b: field peer: %w", err) + } + r.Peer = value + } + { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode messages.requestMainWebView#c9e01e7b: field bot: %w", err) + } + r.Bot = value + } + if r.Flags.Has(1) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.requestMainWebView#c9e01e7b: field start_param: %w", err) + } + r.StartParam = value + } + if r.Flags.Has(0) { + if err := r.ThemeParams.Decode(b); err != nil { + return fmt.Errorf("unable to decode messages.requestMainWebView#c9e01e7b: field theme_params: %w", err) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.requestMainWebView#c9e01e7b: field platform: %w", err) + } + r.Platform = value + } + return nil +} + +// SetCompact sets value of Compact conditional field. +func (r *MessagesRequestMainWebViewRequest) SetCompact(value bool) { + if value { + r.Flags.Set(7) + r.Compact = true + } else { + r.Flags.Unset(7) + r.Compact = false + } +} + +// GetCompact returns value of Compact conditional field. +func (r *MessagesRequestMainWebViewRequest) GetCompact() (value bool) { + if r == nil { + return + } + return r.Flags.Has(7) +} + +// GetPeer returns value of Peer field. +func (r *MessagesRequestMainWebViewRequest) GetPeer() (value InputPeerClass) { + if r == nil { + return + } + return r.Peer +} + +// GetBot returns value of Bot field. +func (r *MessagesRequestMainWebViewRequest) GetBot() (value InputUserClass) { + if r == nil { + return + } + return r.Bot +} + +// SetStartParam sets value of StartParam conditional field. +func (r *MessagesRequestMainWebViewRequest) SetStartParam(value string) { + r.Flags.Set(1) + r.StartParam = value +} + +// GetStartParam returns value of StartParam conditional field and +// boolean which is true if field was set. +func (r *MessagesRequestMainWebViewRequest) GetStartParam() (value string, ok bool) { + if r == nil { + return + } + if !r.Flags.Has(1) { + return value, false + } + return r.StartParam, true +} + +// SetThemeParams sets value of ThemeParams conditional field. +func (r *MessagesRequestMainWebViewRequest) SetThemeParams(value DataJSON) { + r.Flags.Set(0) + r.ThemeParams = value +} + +// GetThemeParams returns value of ThemeParams conditional field and +// boolean which is true if field was set. +func (r *MessagesRequestMainWebViewRequest) GetThemeParams() (value DataJSON, ok bool) { + if r == nil { + return + } + if !r.Flags.Has(0) { + return value, false + } + return r.ThemeParams, true +} + +// GetPlatform returns value of Platform field. +func (r *MessagesRequestMainWebViewRequest) GetPlatform() (value string) { + if r == nil { + return + } + return r.Platform +} + +// MessagesRequestMainWebView invokes method messages.requestMainWebView#c9e01e7b returning error if any. +// Open a Main Mini App¹. +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-apps +// +// Possible errors: +// +// 400 BOT_INVALID: This is not a valid bot. +// +// See https://core.telegram.org/method/messages.requestMainWebView for reference. +func (c *Client) MessagesRequestMainWebView(ctx context.Context, request *MessagesRequestMainWebViewRequest) (*WebViewResultURL, error) { + var result WebViewResultURL + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_messages_request_main_web_view_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_request_main_web_view_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_messages_request_main_web_view_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_messages_request_simple_web_view_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_request_simple_web_view_gen.go index 49c6aeb7..a32c04ae 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_request_simple_web_view_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_request_simple_web_view_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesRequestSimpleWebViewRequest represents TL type `messages.requestSimpleWebView#1a46500a`. +// MessagesRequestSimpleWebViewRequest represents TL type `messages.requestSimpleWebView#413a3e73`. // Open a bot mini app¹. // // Links: @@ -50,23 +50,20 @@ type MessagesRequestSimpleWebViewRequest struct { // Links: // 1) https://core.telegram.org/method/messages.getInlineBotResults FromSwitchWebview bool - // Set this flag if opening the Mini App from the installed side menu entry »¹ or from - // a Mini App link »². + // Set this flag if opening the Mini App from the installed side menu entry »¹. // // Links: // 1) https://core.telegram.org/api/bots/attach - // 2) https://core.telegram.org/api/links#mini-app-links FromSideMenu bool + // Deprecated. + Compact bool // Bot that owns the mini app Bot InputUserClass // Web app URL, if opening from a keyboard button or inline result // // Use SetURL and GetURL helpers. URL string - // Start parameter, if opening from a Mini App link »¹. - // - // Links: - // 1) https://core.telegram.org/api/links#mini-app-links + // Deprecated. // // Use SetStartParam and GetStartParam helpers. StartParam string @@ -82,7 +79,7 @@ type MessagesRequestSimpleWebViewRequest struct { } // MessagesRequestSimpleWebViewRequestTypeID is TL type id of MessagesRequestSimpleWebViewRequest. -const MessagesRequestSimpleWebViewRequestTypeID = 0x1a46500a +const MessagesRequestSimpleWebViewRequestTypeID = 0x413a3e73 // Ensuring interfaces in compile-time for MessagesRequestSimpleWebViewRequest. var ( @@ -105,6 +102,9 @@ func (r *MessagesRequestSimpleWebViewRequest) Zero() bool { if !(r.FromSideMenu == false) { return false } + if !(r.Compact == false) { + return false + } if !(r.Bot == nil) { return false } @@ -137,6 +137,7 @@ func (r *MessagesRequestSimpleWebViewRequest) String() string { func (r *MessagesRequestSimpleWebViewRequest) FillFrom(from interface { GetFromSwitchWebview() (value bool) GetFromSideMenu() (value bool) + GetCompact() (value bool) GetBot() (value InputUserClass) GetURL() (value string, ok bool) GetStartParam() (value string, ok bool) @@ -145,6 +146,7 @@ func (r *MessagesRequestSimpleWebViewRequest) FillFrom(from interface { }) { r.FromSwitchWebview = from.GetFromSwitchWebview() r.FromSideMenu = from.GetFromSideMenu() + r.Compact = from.GetCompact() r.Bot = from.GetBot() if val, ok := from.GetURL(); ok { r.URL = val @@ -194,6 +196,11 @@ func (r *MessagesRequestSimpleWebViewRequest) TypeInfo() tdp.Type { SchemaName: "from_side_menu", Null: !r.Flags.Has(2), }, + { + Name: "Compact", + SchemaName: "compact", + Null: !r.Flags.Has(7), + }, { Name: "Bot", SchemaName: "bot", @@ -229,6 +236,9 @@ func (r *MessagesRequestSimpleWebViewRequest) SetFlags() { if !(r.FromSideMenu == false) { r.Flags.Set(2) } + if !(r.Compact == false) { + r.Flags.Set(7) + } if !(r.URL == "") { r.Flags.Set(3) } @@ -243,7 +253,7 @@ func (r *MessagesRequestSimpleWebViewRequest) SetFlags() { // Encode implements bin.Encoder. func (r *MessagesRequestSimpleWebViewRequest) Encode(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't encode messages.requestSimpleWebView#1a46500a as nil") + return fmt.Errorf("can't encode messages.requestSimpleWebView#413a3e73 as nil") } b.PutID(MessagesRequestSimpleWebViewRequestTypeID) return r.EncodeBare(b) @@ -252,17 +262,17 @@ func (r *MessagesRequestSimpleWebViewRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (r *MessagesRequestSimpleWebViewRequest) EncodeBare(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't encode messages.requestSimpleWebView#1a46500a as nil") + return fmt.Errorf("can't encode messages.requestSimpleWebView#413a3e73 as nil") } r.SetFlags() if err := r.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.requestSimpleWebView#1a46500a: field flags: %w", err) + return fmt.Errorf("unable to encode messages.requestSimpleWebView#413a3e73: field flags: %w", err) } if r.Bot == nil { - return fmt.Errorf("unable to encode messages.requestSimpleWebView#1a46500a: field bot is nil") + return fmt.Errorf("unable to encode messages.requestSimpleWebView#413a3e73: field bot is nil") } if err := r.Bot.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.requestSimpleWebView#1a46500a: field bot: %w", err) + return fmt.Errorf("unable to encode messages.requestSimpleWebView#413a3e73: field bot: %w", err) } if r.Flags.Has(3) { b.PutString(r.URL) @@ -272,7 +282,7 @@ func (r *MessagesRequestSimpleWebViewRequest) EncodeBare(b *bin.Buffer) error { } if r.Flags.Has(0) { if err := r.ThemeParams.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.requestSimpleWebView#1a46500a: field theme_params: %w", err) + return fmt.Errorf("unable to encode messages.requestSimpleWebView#413a3e73: field theme_params: %w", err) } } b.PutString(r.Platform) @@ -282,10 +292,10 @@ func (r *MessagesRequestSimpleWebViewRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (r *MessagesRequestSimpleWebViewRequest) Decode(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't decode messages.requestSimpleWebView#1a46500a to nil") + return fmt.Errorf("can't decode messages.requestSimpleWebView#413a3e73 to nil") } if err := b.ConsumeID(MessagesRequestSimpleWebViewRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.requestSimpleWebView#1a46500a: %w", err) + return fmt.Errorf("unable to decode messages.requestSimpleWebView#413a3e73: %w", err) } return r.DecodeBare(b) } @@ -293,45 +303,46 @@ func (r *MessagesRequestSimpleWebViewRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (r *MessagesRequestSimpleWebViewRequest) DecodeBare(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't decode messages.requestSimpleWebView#1a46500a to nil") + return fmt.Errorf("can't decode messages.requestSimpleWebView#413a3e73 to nil") } { if err := r.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.requestSimpleWebView#1a46500a: field flags: %w", err) + return fmt.Errorf("unable to decode messages.requestSimpleWebView#413a3e73: field flags: %w", err) } } r.FromSwitchWebview = r.Flags.Has(1) r.FromSideMenu = r.Flags.Has(2) + r.Compact = r.Flags.Has(7) { value, err := DecodeInputUser(b) if err != nil { - return fmt.Errorf("unable to decode messages.requestSimpleWebView#1a46500a: field bot: %w", err) + return fmt.Errorf("unable to decode messages.requestSimpleWebView#413a3e73: field bot: %w", err) } r.Bot = value } if r.Flags.Has(3) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messages.requestSimpleWebView#1a46500a: field url: %w", err) + return fmt.Errorf("unable to decode messages.requestSimpleWebView#413a3e73: field url: %w", err) } r.URL = value } if r.Flags.Has(4) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messages.requestSimpleWebView#1a46500a: field start_param: %w", err) + return fmt.Errorf("unable to decode messages.requestSimpleWebView#413a3e73: field start_param: %w", err) } r.StartParam = value } if r.Flags.Has(0) { if err := r.ThemeParams.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.requestSimpleWebView#1a46500a: field theme_params: %w", err) + return fmt.Errorf("unable to decode messages.requestSimpleWebView#413a3e73: field theme_params: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messages.requestSimpleWebView#1a46500a: field platform: %w", err) + return fmt.Errorf("unable to decode messages.requestSimpleWebView#413a3e73: field platform: %w", err) } r.Platform = value } @@ -376,6 +387,25 @@ func (r *MessagesRequestSimpleWebViewRequest) GetFromSideMenu() (value bool) { return r.Flags.Has(2) } +// SetCompact sets value of Compact conditional field. +func (r *MessagesRequestSimpleWebViewRequest) SetCompact(value bool) { + if value { + r.Flags.Set(7) + r.Compact = true + } else { + r.Flags.Unset(7) + r.Compact = false + } +} + +// GetCompact returns value of Compact conditional field. +func (r *MessagesRequestSimpleWebViewRequest) GetCompact() (value bool) { + if r == nil { + return + } + return r.Flags.Has(7) +} + // GetBot returns value of Bot field. func (r *MessagesRequestSimpleWebViewRequest) GetBot() (value InputUserClass) { if r == nil { @@ -446,15 +476,20 @@ func (r *MessagesRequestSimpleWebViewRequest) GetPlatform() (value string) { return r.Platform } -// MessagesRequestSimpleWebView invokes method messages.requestSimpleWebView#1a46500a returning error if any. +// MessagesRequestSimpleWebView invokes method messages.requestSimpleWebView#413a3e73 returning error if any. // Open a bot mini app¹. // // Links: // 1. https://core.telegram.org/api/bots/webapps // +// Possible errors: +// +// 400 BOT_INVALID: This is not a valid bot. +// 400 URL_INVALID: Invalid URL provided. +// // See https://core.telegram.org/method/messages.requestSimpleWebView for reference. -func (c *Client) MessagesRequestSimpleWebView(ctx context.Context, request *MessagesRequestSimpleWebViewRequest) (*SimpleWebViewResultURL, error) { - var result SimpleWebViewResultURL +func (c *Client) MessagesRequestSimpleWebView(ctx context.Context, request *MessagesRequestSimpleWebViewRequest) (*WebViewResultURL, error) { + var result WebViewResultURL if err := c.rpc.Invoke(ctx, request, &result); err != nil { return nil, err diff --git a/vendor/github.com/gotd/td/tg/tl_messages_request_web_view_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_request_web_view_gen.go index 0d3179ce..d57be165 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_request_web_view_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_request_web_view_gen.go @@ -59,6 +59,13 @@ type MessagesRequestWebViewRequest struct { // Links: // 1) https://core.telegram.org/method/messages.sendWebViewResultMessage Silent bool + // If set, requests to open the mini app in compact mode (as opposed to fullview mode). + // Must be set if the mode parameter of the attachment menu deep link¹ is equal to + // compact. + // + // Links: + // 1) https://core.telegram.org/api/links#bot-attachment-or-side-menu-links + Compact bool // Dialog where the web app is being opened, and where the resulting message will be sent // (see the docs for more info »¹). // @@ -134,6 +141,9 @@ func (r *MessagesRequestWebViewRequest) Zero() bool { if !(r.Silent == false) { return false } + if !(r.Compact == false) { + return false + } if !(r.Peer == nil) { return false } @@ -175,6 +185,7 @@ func (r *MessagesRequestWebViewRequest) String() string { func (r *MessagesRequestWebViewRequest) FillFrom(from interface { GetFromBotMenu() (value bool) GetSilent() (value bool) + GetCompact() (value bool) GetPeer() (value InputPeerClass) GetBot() (value InputUserClass) GetURL() (value string, ok bool) @@ -186,6 +197,7 @@ func (r *MessagesRequestWebViewRequest) FillFrom(from interface { }) { r.FromBotMenu = from.GetFromBotMenu() r.Silent = from.GetSilent() + r.Compact = from.GetCompact() r.Peer = from.GetPeer() r.Bot = from.GetBot() if val, ok := from.GetURL(); ok { @@ -244,6 +256,11 @@ func (r *MessagesRequestWebViewRequest) TypeInfo() tdp.Type { SchemaName: "silent", Null: !r.Flags.Has(5), }, + { + Name: "Compact", + SchemaName: "compact", + Null: !r.Flags.Has(7), + }, { Name: "Peer", SchemaName: "peer", @@ -293,6 +310,9 @@ func (r *MessagesRequestWebViewRequest) SetFlags() { if !(r.Silent == false) { r.Flags.Set(5) } + if !(r.Compact == false) { + r.Flags.Set(7) + } if !(r.URL == "") { r.Flags.Set(1) } @@ -394,6 +414,7 @@ func (r *MessagesRequestWebViewRequest) DecodeBare(b *bin.Buffer) error { } r.FromBotMenu = r.Flags.Has(4) r.Silent = r.Flags.Has(5) + r.Compact = r.Flags.Has(7) { value, err := DecodeInputPeer(b) if err != nil { @@ -489,6 +510,25 @@ func (r *MessagesRequestWebViewRequest) GetSilent() (value bool) { return r.Flags.Has(5) } +// SetCompact sets value of Compact conditional field. +func (r *MessagesRequestWebViewRequest) SetCompact(value bool) { + if value { + r.Flags.Set(7) + r.Compact = true + } else { + r.Flags.Unset(7) + r.Compact = false + } +} + +// GetCompact returns value of Compact conditional field. +func (r *MessagesRequestWebViewRequest) GetCompact() (value bool) { + if r == nil { + return + } + return r.Flags.Has(7) +} + // GetPeer returns value of Peer field. func (r *MessagesRequestWebViewRequest) GetPeer() (value InputPeerClass) { if r == nil { @@ -617,7 +657,10 @@ func (r *MessagesRequestWebViewRequest) GetSendAs() (value InputPeerClass, ok bo // 400 BOT_INVALID: This is not a valid bot. // 400 BOT_WEBVIEW_DISABLED: A webview cannot be opened in the specified conditions: emitted for example if from_bot_menu or url are set and peer is not the chat with the bot. // 400 INPUT_USER_DEACTIVATED: The specified user was deleted. +// 400 MSG_ID_INVALID: Invalid message ID provided. // 400 PEER_ID_INVALID: The provided peer id is invalid. +// 403 PRIVACY_PREMIUM_REQUIRED: You need a Telegram Premium subscription to send a message to this user. +// 400 SEND_AS_PEER_INVALID: You can't send messages as the specified peer. // 400 YOU_BLOCKED_USER: You blocked this user. // // See https://core.telegram.org/method/messages.requestWebView for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_save_draft_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_save_draft_gen.go index 8301f491..87b477a8 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_save_draft_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_save_draft_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesSaveDraftRequest represents TL type `messages.saveDraft#7ff3b806`. +// MessagesSaveDraftRequest represents TL type `messages.saveDraft#d372c5ce`. // Save a message draft¹ associated to a chat. // // Links: @@ -69,10 +69,17 @@ type MessagesSaveDraftRequest struct { // // Use SetMedia and GetMedia helpers. Media InputMediaClass + // Specifies a message effect »¹ to use for the message. + // + // Links: + // 1) https://core.telegram.org/api/effects + // + // Use SetEffect and GetEffect helpers. + Effect int64 } // MessagesSaveDraftRequestTypeID is TL type id of MessagesSaveDraftRequest. -const MessagesSaveDraftRequestTypeID = 0x7ff3b806 +const MessagesSaveDraftRequestTypeID = 0xd372c5ce // Ensuring interfaces in compile-time for MessagesSaveDraftRequest. var ( @@ -110,6 +117,9 @@ func (s *MessagesSaveDraftRequest) Zero() bool { if !(s.Media == nil) { return false } + if !(s.Effect == 0) { + return false + } return true } @@ -132,6 +142,7 @@ func (s *MessagesSaveDraftRequest) FillFrom(from interface { GetMessage() (value string) GetEntities() (value []MessageEntityClass, ok bool) GetMedia() (value InputMediaClass, ok bool) + GetEffect() (value int64, ok bool) }) { s.NoWebpage = from.GetNoWebpage() s.InvertMedia = from.GetInvertMedia() @@ -149,6 +160,10 @@ func (s *MessagesSaveDraftRequest) FillFrom(from interface { s.Media = val } + if val, ok := from.GetEffect(); ok { + s.Effect = val + } + } // TypeID returns type id in TL schema. @@ -207,6 +222,11 @@ func (s *MessagesSaveDraftRequest) TypeInfo() tdp.Type { SchemaName: "media", Null: !s.Flags.Has(5), }, + { + Name: "Effect", + SchemaName: "effect", + Null: !s.Flags.Has(7), + }, } return typ } @@ -228,12 +248,15 @@ func (s *MessagesSaveDraftRequest) SetFlags() { if !(s.Media == nil) { s.Flags.Set(5) } + if !(s.Effect == 0) { + s.Flags.Set(7) + } } // Encode implements bin.Encoder. func (s *MessagesSaveDraftRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode messages.saveDraft#7ff3b806 as nil") + return fmt.Errorf("can't encode messages.saveDraft#d372c5ce as nil") } b.PutID(MessagesSaveDraftRequestTypeID) return s.EncodeBare(b) @@ -242,56 +265,59 @@ func (s *MessagesSaveDraftRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *MessagesSaveDraftRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode messages.saveDraft#7ff3b806 as nil") + return fmt.Errorf("can't encode messages.saveDraft#d372c5ce as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.saveDraft#7ff3b806: field flags: %w", err) + return fmt.Errorf("unable to encode messages.saveDraft#d372c5ce: field flags: %w", err) } if s.Flags.Has(4) { if s.ReplyTo == nil { - return fmt.Errorf("unable to encode messages.saveDraft#7ff3b806: field reply_to is nil") + return fmt.Errorf("unable to encode messages.saveDraft#d372c5ce: field reply_to is nil") } if err := s.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.saveDraft#7ff3b806: field reply_to: %w", err) + return fmt.Errorf("unable to encode messages.saveDraft#d372c5ce: field reply_to: %w", err) } } if s.Peer == nil { - return fmt.Errorf("unable to encode messages.saveDraft#7ff3b806: field peer is nil") + return fmt.Errorf("unable to encode messages.saveDraft#d372c5ce: field peer is nil") } if err := s.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.saveDraft#7ff3b806: field peer: %w", err) + return fmt.Errorf("unable to encode messages.saveDraft#d372c5ce: field peer: %w", err) } b.PutString(s.Message) if s.Flags.Has(3) { b.PutVectorHeader(len(s.Entities)) for idx, v := range s.Entities { if v == nil { - return fmt.Errorf("unable to encode messages.saveDraft#7ff3b806: field entities element with index %d is nil", idx) + return fmt.Errorf("unable to encode messages.saveDraft#d372c5ce: field entities element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.saveDraft#7ff3b806: field entities element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode messages.saveDraft#d372c5ce: field entities element with index %d: %w", idx, err) } } } if s.Flags.Has(5) { if s.Media == nil { - return fmt.Errorf("unable to encode messages.saveDraft#7ff3b806: field media is nil") + return fmt.Errorf("unable to encode messages.saveDraft#d372c5ce: field media is nil") } if err := s.Media.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.saveDraft#7ff3b806: field media: %w", err) + return fmt.Errorf("unable to encode messages.saveDraft#d372c5ce: field media: %w", err) } } + if s.Flags.Has(7) { + b.PutLong(s.Effect) + } return nil } // Decode implements bin.Decoder. func (s *MessagesSaveDraftRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode messages.saveDraft#7ff3b806 to nil") + return fmt.Errorf("can't decode messages.saveDraft#d372c5ce to nil") } if err := b.ConsumeID(MessagesSaveDraftRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.saveDraft#7ff3b806: %w", err) + return fmt.Errorf("unable to decode messages.saveDraft#d372c5ce: %w", err) } return s.DecodeBare(b) } @@ -299,11 +325,11 @@ func (s *MessagesSaveDraftRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *MessagesSaveDraftRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode messages.saveDraft#7ff3b806 to nil") + return fmt.Errorf("can't decode messages.saveDraft#d372c5ce to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.saveDraft#7ff3b806: field flags: %w", err) + return fmt.Errorf("unable to decode messages.saveDraft#d372c5ce: field flags: %w", err) } } s.NoWebpage = s.Flags.Has(1) @@ -311,28 +337,28 @@ func (s *MessagesSaveDraftRequest) DecodeBare(b *bin.Buffer) error { if s.Flags.Has(4) { value, err := DecodeInputReplyTo(b) if err != nil { - return fmt.Errorf("unable to decode messages.saveDraft#7ff3b806: field reply_to: %w", err) + return fmt.Errorf("unable to decode messages.saveDraft#d372c5ce: field reply_to: %w", err) } s.ReplyTo = value } { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.saveDraft#7ff3b806: field peer: %w", err) + return fmt.Errorf("unable to decode messages.saveDraft#d372c5ce: field peer: %w", err) } s.Peer = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messages.saveDraft#7ff3b806: field message: %w", err) + return fmt.Errorf("unable to decode messages.saveDraft#d372c5ce: field message: %w", err) } s.Message = value } if s.Flags.Has(3) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messages.saveDraft#7ff3b806: field entities: %w", err) + return fmt.Errorf("unable to decode messages.saveDraft#d372c5ce: field entities: %w", err) } if headerLen > 0 { @@ -341,7 +367,7 @@ func (s *MessagesSaveDraftRequest) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMessageEntity(b) if err != nil { - return fmt.Errorf("unable to decode messages.saveDraft#7ff3b806: field entities: %w", err) + return fmt.Errorf("unable to decode messages.saveDraft#d372c5ce: field entities: %w", err) } s.Entities = append(s.Entities, value) } @@ -349,10 +375,17 @@ func (s *MessagesSaveDraftRequest) DecodeBare(b *bin.Buffer) error { if s.Flags.Has(5) { value, err := DecodeInputMedia(b) if err != nil { - return fmt.Errorf("unable to decode messages.saveDraft#7ff3b806: field media: %w", err) + return fmt.Errorf("unable to decode messages.saveDraft#d372c5ce: field media: %w", err) } s.Media = value } + if s.Flags.Has(7) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messages.saveDraft#d372c5ce: field effect: %w", err) + } + s.Effect = value + } return nil } @@ -464,6 +497,24 @@ func (s *MessagesSaveDraftRequest) GetMedia() (value InputMediaClass, ok bool) { return s.Media, true } +// SetEffect sets value of Effect conditional field. +func (s *MessagesSaveDraftRequest) SetEffect(value int64) { + s.Flags.Set(7) + s.Effect = value +} + +// GetEffect returns value of Effect conditional field and +// boolean which is true if field was set. +func (s *MessagesSaveDraftRequest) GetEffect() (value int64, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(7) { + return value, false + } + return s.Effect, true +} + // MapEntities returns field Entities wrapped in MessageEntityClassArray helper. func (s *MessagesSaveDraftRequest) MapEntities() (value MessageEntityClassArray, ok bool) { if !s.Flags.Has(3) { @@ -472,7 +523,7 @@ func (s *MessagesSaveDraftRequest) MapEntities() (value MessageEntityClassArray, return MessageEntityClassArray(s.Entities), true } -// MessagesSaveDraft invokes method messages.saveDraft#7ff3b806 returning error if any. +// MessagesSaveDraft invokes method messages.saveDraft#d372c5ce returning error if any. // Save a message draft¹ associated to a chat. // // Links: @@ -480,7 +531,7 @@ func (s *MessagesSaveDraftRequest) MapEntities() (value MessageEntityClassArray, // // Possible errors: // -// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. +// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. // 400 MSG_ID_INVALID: Invalid message ID provided. // 400 PEER_ID_INVALID: The provided peer id is invalid. // diff --git a/vendor/github.com/gotd/td/tg/tl_messages_saved_gifs_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_saved_gifs_gen.go index 5da96e48..9941ea9d 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_saved_gifs_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_saved_gifs_gen.go @@ -138,7 +138,7 @@ func (s *MessagesSavedGifsNotModified) DecodeBare(b *bin.Buffer) error { // // See https://core.telegram.org/constructor/messages.savedGifs for reference. type MessagesSavedGifs struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_saved_reaction_tags_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_saved_reaction_tags_gen.go index 41acb12b..a5371e2a 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_saved_reaction_tags_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_saved_reaction_tags_gen.go @@ -32,6 +32,10 @@ var ( ) // MessagesSavedReactionTagsNotModified represents TL type `messages.savedReactionTagsNotModified#889b59ef`. +// The list of reaction tag »¹ names assigned by the user hasn't changed. +// +// Links: +// 1. https://core.telegram.org/api/saved-messages#tags // // See https://core.telegram.org/constructor/messages.savedReactionTagsNotModified for reference. type MessagesSavedReactionTagsNotModified struct { @@ -133,12 +137,19 @@ func (s *MessagesSavedReactionTagsNotModified) DecodeBare(b *bin.Buffer) error { } // MessagesSavedReactionTags represents TL type `messages.savedReactionTags#3259950a`. +// List of reaction tag »¹ names assigned by the user. +// +// Links: +// 1. https://core.telegram.org/api/saved-messages#tags // // See https://core.telegram.org/constructor/messages.savedReactionTags for reference. type MessagesSavedReactionTags struct { - // Tags field of MessagesSavedReactionTags. + // Saved reaction tags. Tags []SavedReactionTag - // Hash field of MessagesSavedReactionTags. + // Hash used for caching, for more info click here¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets#hash-generation Hash int64 } diff --git a/vendor/github.com/gotd/td/tg/tl_messages_search_custom_emoji_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_search_custom_emoji_gen.go index 5219af89..4d7dd094 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_search_custom_emoji_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_search_custom_emoji_gen.go @@ -41,7 +41,7 @@ var ( type MessagesSearchCustomEmojiRequest struct { // The emoji Emoticon string - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation @@ -205,7 +205,6 @@ func (s *MessagesSearchCustomEmojiRequest) GetHash() (value int64) { // 400 EMOTICON_EMPTY: The emoji is empty. // // See https://core.telegram.org/method/messages.searchCustomEmoji for reference. -// Can be used by bots. func (c *Client) MessagesSearchCustomEmoji(ctx context.Context, request *MessagesSearchCustomEmojiRequest) (EmojiListClass, error) { var result EmojiListBox diff --git a/vendor/github.com/gotd/td/tg/tl_messages_search_emoji_sticker_sets_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_search_emoji_sticker_sets_gen.go index 6c1e7d99..68170cbe 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_search_emoji_sticker_sets_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_search_emoji_sticker_sets_gen.go @@ -48,7 +48,7 @@ type MessagesSearchEmojiStickerSetsRequest struct { ExcludeFeatured bool // Query string Q string - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_search_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_search_gen.go index 4ecd1297..a4efc958 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_search_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_search_gen.go @@ -63,7 +63,11 @@ type MessagesSearchRequest struct { // // Use SetSavedPeerID and GetSavedPeerID helpers. SavedPeerID InputPeerClass - // SavedReaction field of MessagesSearchRequest. + // You may search for saved messages tagged »¹ with one or more reactions using this + // flag. + // + // Links: + // 1) https://core.telegram.org/api/saved-messages#tags // // Use SetSavedReaction and GetSavedReaction helpers. SavedReaction []ReactionClass diff --git a/vendor/github.com/gotd/td/tg/tl_messages_search_global_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_search_global_gen.go index 98897739..89ca93c2 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_search_global_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_search_global_gen.go @@ -41,7 +41,11 @@ type MessagesSearchGlobalRequest struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // BroadcastsOnly field of MessagesSearchGlobalRequest. + // If set, only returns results from channels (used in the global channel search tab + // »¹). + // + // Links: + // 1) https://core.telegram.org/api/search#global-search BroadcastsOnly bool // Peer folder ID, for more info click here¹ // @@ -487,6 +491,7 @@ func (s *MessagesSearchGlobalRequest) GetLimit() (value int) { // Possible errors: // // 400 FOLDER_ID_INVALID: Invalid folder ID. +// 400 INPUT_FILTER_INVALID: The specified filter is invalid. // 400 SEARCH_QUERY_EMPTY: The search query is empty. // // See https://core.telegram.org/method/messages.searchGlobal for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_search_sticker_sets_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_search_sticker_sets_gen.go index f82bcac2..5a85143a 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_search_sticker_sets_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_search_sticker_sets_gen.go @@ -45,7 +45,7 @@ type MessagesSearchStickerSetsRequest struct { ExcludeFeatured bool // Query string Q string - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹. // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_send_bot_requested_peer_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_send_bot_requested_peer_gen.go index 252b1893..b75ad9cc 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_send_bot_requested_peer_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_send_bot_requested_peer_gen.go @@ -289,6 +289,10 @@ func (s *MessagesSendBotRequestedPeerRequest) MapRequestedPeers() (value InputPe // Links: // 1. https://core.telegram.org/constructor/keyboardButtonRequestPeer // +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// // See https://core.telegram.org/method/messages.sendBotRequestedPeer for reference. func (c *Client) MessagesSendBotRequestedPeer(ctx context.Context, request *MessagesSendBotRequestedPeerRequest) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_messages_send_inline_bot_result_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_send_inline_bot_result_gen.go index 4e66c694..02ba2c2c 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_send_inline_bot_result_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_send_inline_bot_result_gen.go @@ -87,7 +87,10 @@ type MessagesSendInlineBotResultRequest struct { // // Use SetSendAs and GetSendAs helpers. SendAs InputPeerClass - // QuickReplyShortcut field of MessagesSendInlineBotResultRequest. + // Add the message to the specified quick reply shortcut »¹, instead. + // + // Links: + // 1) https://core.telegram.org/api/business#quick-reply-shortcuts // // Use SetQuickReplyShortcut and GetQuickReplyShortcut helpers. QuickReplyShortcut InputQuickReplyShortcutClass @@ -644,7 +647,7 @@ func (s *MessagesSendInlineBotResultRequest) GetQuickReplyShortcut() (value Inpu // 400 CHANNEL_INVALID: The provided channel is invalid. // 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. // 400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. -// 403 CHAT_GUEST_SEND_FORBIDDEN: You join the discussion group before commenting, see here » for more info. +// 403 CHAT_GUEST_SEND_FORBIDDEN: You join the discussion group before commenting, see here » for more info. // 400 CHAT_RESTRICTED: You can't send messages in this chat, you were restricted. // 403 CHAT_SEND_AUDIOS_FORBIDDEN: You can't send audio messages in this chat. // 403 CHAT_SEND_GAME_FORBIDDEN: You can't send a game to this chat. @@ -656,14 +659,16 @@ func (s *MessagesSendInlineBotResultRequest) GetQuickReplyShortcut() (value Inpu // 403 CHAT_SEND_STICKERS_FORBIDDEN: You can't send stickers in this chat. // 403 CHAT_SEND_VOICES_FORBIDDEN: You can't send voice recordings in this chat. // 403 CHAT_WRITE_FORBIDDEN: You can't write in this chat. -// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. +// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. // 400 INLINE_RESULT_EXPIRED: The inline query expired. // 400 INPUT_USER_DEACTIVATED: The specified user was deleted. // 400 MEDIA_EMPTY: The provided media object is invalid. // 400 MSG_ID_INVALID: Invalid message ID provided. // 400 PEER_ID_INVALID: The provided peer id is invalid. // 400 QUERY_ID_EMPTY: The query ID is empty. +// 400 QUICK_REPLIES_TOO_MUCH: A maximum of appConfig.quick_replies_limit shortcuts may be created, the limit was reached. // 500 RANDOM_ID_DUPLICATE: You provided a random ID that was already used. +// 400 REPLY_MESSAGES_TOO_MUCH: Each shortcut can contain a maximum of appConfig.quick_reply_messages_limit messages, the limit was reached. // 400 RESULT_ID_EMPTY: Result ID empty. // 400 RESULT_ID_INVALID: One of the specified result IDs is invalid. // 400 SCHEDULE_DATE_TOO_LATE: You can't schedule a message this far in the future. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_send_media_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_send_media_gen.go index 0f8b9275..84cb532c 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_send_media_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_send_media_gen.go @@ -96,11 +96,17 @@ type MessagesSendMediaRequest struct { // // Use SetSendAs and GetSendAs helpers. SendAs InputPeerClass - // QuickReplyShortcut field of MessagesSendMediaRequest. + // Add the message to the specified quick reply shortcut »¹, instead. + // + // Links: + // 1) https://core.telegram.org/api/business#quick-reply-shortcuts // // Use SetQuickReplyShortcut and GetQuickReplyShortcut helpers. QuickReplyShortcut InputQuickReplyShortcutClass - // Effect field of MessagesSendMediaRequest. + // Specifies a message effect »¹ to use for the message. + // + // Links: + // 1) https://core.telegram.org/api/effects // // Use SetEffect and GetEffect helpers. Effect int64 @@ -885,16 +891,18 @@ func (s *MessagesSendMediaRequest) MapEntities() (value MessageEntityClassArray, // // Possible errors: // +// 400 BOT_GAMES_DISABLED: Games can't be sent to channels. // 400 BOT_PAYMENTS_DISABLED: Please enable bot payments in botfather before calling this method. // 400 BROADCAST_PUBLIC_VOTERS_FORBIDDEN: You can't forward polls with public voters. // 400 BUTTON_DATA_INVALID: The data of one or more of the buttons you provided is invalid. +// 400 BUTTON_POS_INVALID: The position of one of the keyboard buttons is invalid (i.e. a Game or Pay button not in the first position, and so on...). // 400 BUTTON_TYPE_INVALID: The type of one or more of the buttons you provided is invalid. // 400 BUTTON_URL_INVALID: Button URL invalid. // 400 CHANNEL_INVALID: The provided channel is invalid. // 406 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. // 403 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. // 400 CHAT_FORWARDS_RESTRICTED: You can't forward messages from a protected chat. -// 403 CHAT_GUEST_SEND_FORBIDDEN: You join the discussion group before commenting, see here » for more info. +// 403 CHAT_GUEST_SEND_FORBIDDEN: You join the discussion group before commenting, see here » for more info. // 400 CHAT_RESTRICTED: You can't send messages in this chat, you were restricted. // 403 CHAT_SEND_AUDIOS_FORBIDDEN: You can't send audio messages in this chat. // 403 CHAT_SEND_DOCS_FORBIDDEN: You can't send documents in this chat. @@ -903,6 +911,7 @@ func (s *MessagesSendMediaRequest) MapEntities() (value MessageEntityClassArray, // 403 CHAT_SEND_PHOTOS_FORBIDDEN: You can't send photos in this chat. // 403 CHAT_SEND_PLAIN_FORBIDDEN: You can't send non-media (text) messages in this chat. // 403 CHAT_SEND_POLL_FORBIDDEN: You can't send polls in this chat. +// 403 CHAT_SEND_ROUNDVIDEOS_FORBIDDEN: You can't send round videos to this chat. // 403 CHAT_SEND_STICKERS_FORBIDDEN: You can't send stickers in this chat. // 403 CHAT_SEND_VIDEOS_FORBIDDEN: You can't send videos in this chat. // 403 CHAT_SEND_VOICES_FORBIDDEN: You can't send voice recordings in this chat. @@ -910,7 +919,7 @@ func (s *MessagesSendMediaRequest) MapEntities() (value MessageEntityClassArray, // 400 CURRENCY_TOTAL_AMOUNT_INVALID: The total amount of all prices is invalid. // 400 DOCUMENT_INVALID: The specified document is invalid. // 400 EMOTICON_INVALID: The specified emoji is invalid. -// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. +// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. // 400 EXTERNAL_URL_INVALID: External URL invalid. // 400 FILE_PARTS_INVALID: The number of file parts is invalid. // 400 FILE_PART_LENGTH_INVALID: The length of a file part is invalid. @@ -918,6 +927,7 @@ func (s *MessagesSendMediaRequest) MapEntities() (value MessageEntityClassArray, // 400 FILE_REFERENCE_EXPIRED: File reference expired, it must be refetched as described in the documentation. // 400 GAME_BOT_INVALID: Bots can't send another bot's game. // 400 IMAGE_PROCESS_FAILED: Failure while processing image. +// 400 INPUT_FILE_INVALID: The specified InputFile is invalid. // 400 INPUT_USER_DEACTIVATED: The specified user was deleted. // 400 MD5_CHECKSUM_INVALID: The MD5 checksums do not match. // 400 MEDIA_CAPTION_TOO_LONG: The caption is too long. @@ -936,19 +946,24 @@ func (s *MessagesSendMediaRequest) MapEntities() (value MessageEntityClassArray, // 400 POLL_OPTION_INVALID: Invalid poll option provided. // 400 POLL_QUESTION_INVALID: One of the poll questions is not acceptable. // 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. +// 403 PRIVACY_PREMIUM_REQUIRED: You need a Telegram Premium subscription to send a message to this user. +// 400 QUICK_REPLIES_TOO_MUCH: A maximum of appConfig.quick_replies_limit shortcuts may be created, the limit was reached. // 400 QUIZ_CORRECT_ANSWERS_EMPTY: No correct quiz answer was specified. // 400 QUIZ_CORRECT_ANSWERS_TOO_MUCH: You specified too many correct answers in a quiz, quizzes can only have one right answer! // 400 QUIZ_CORRECT_ANSWER_INVALID: An invalid value was provided to the correct_answers field. // 400 QUIZ_MULTIPLE_INVALID: Quizzes can't have the multiple_choice flag set! // 500 RANDOM_ID_DUPLICATE: You provided a random ID that was already used. // 400 REPLY_MARKUP_BUY_EMPTY: Reply markup for buy button empty. +// 400 REPLY_MARKUP_GAME_EMPTY: A game message is being edited, but the newly provided keyboard doesn't have a keyboardButtonGame button. // 400 REPLY_MARKUP_INVALID: The provided reply markup is invalid. // 400 REPLY_MARKUP_TOO_LONG: The specified reply_markup is too long. +// 400 REPLY_MESSAGES_TOO_MUCH: Each shortcut can contain a maximum of appConfig.quick_reply_messages_limit messages, the limit was reached. // 400 SCHEDULE_BOT_NOT_ALLOWED: Bots cannot schedule messages. // 400 SCHEDULE_DATE_TOO_LATE: You can't schedule a message this far in the future. // 400 SCHEDULE_TOO_MUCH: There are too many scheduled messages. // 400 SEND_AS_PEER_INVALID: You can't send messages as the specified peer. // 420 SLOWMODE_WAIT_%d: Slowmode is enabled in this chat: wait %d seconds before sending another message to this chat. +// 400 STORY_ID_INVALID: The specified story ID is invalid. // 406 TOPIC_CLOSED: This topic was closed, you can't send messages to it anymore. // 406 TOPIC_DELETED: The specified topic was deleted. // 400 TTL_MEDIA_INVALID: Invalid media Time To Live was provided. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_send_message_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_send_message_gen.go index 14f3b687..e2c00d17 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_send_message_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_send_message_gen.go @@ -66,7 +66,7 @@ type MessagesSendMessageRequest struct { // The destination where the message will be sent Peer InputPeerClass // If set, indicates that the message should be sent in reply to the specified message or - // story. + // story. Also used to quote other messages. // // Use SetReplyTo and GetReplyTo helpers. ReplyTo InputReplyToClass @@ -96,11 +96,17 @@ type MessagesSendMessageRequest struct { // // Use SetSendAs and GetSendAs helpers. SendAs InputPeerClass - // QuickReplyShortcut field of MessagesSendMessageRequest. + // Add the message to the specified quick reply shortcut »¹, instead. + // + // Links: + // 1) https://core.telegram.org/api/business#quick-reply-shortcuts // // Use SetQuickReplyShortcut and GetQuickReplyShortcut helpers. QuickReplyShortcut InputQuickReplyShortcutClass - // Effect field of MessagesSendMessageRequest. + // Specifies a message effect »¹ to use for the message. + // + // Links: + // 1) https://core.telegram.org/api/effects // // Use SetEffect and GetEffect helpers. Effect int64 @@ -891,6 +897,7 @@ func (s *MessagesSendMessageRequest) MapEntities() (value MessageEntityClassArra // 400 ADMIN_RIGHTS_EMPTY: The chatAdminRights constructor passed in keyboardButtonRequestPeer.peer_type.user_admin_rights has no rights set (i.e. flags is 0). // 400 BOT_DOMAIN_INVALID: Bot domain invalid. // 400 BOT_INVALID: This is not a valid bot. +// 400 BUSINESS_PEER_INVALID: Messages can't be set to the specified peer through the current business connection. // 400 BUTTON_DATA_INVALID: The data of one or more of the buttons you provided is invalid. // 400 BUTTON_TYPE_INVALID: The type of one or more of the buttons you provided is invalid. // 400 BUTTON_URL_INVALID: Button URL invalid. @@ -899,7 +906,7 @@ func (s *MessagesSendMessageRequest) MapEntities() (value MessageEntityClassArra // 400 CHANNEL_INVALID: The provided channel is invalid. // 406 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. // 403 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. -// 403 CHAT_GUEST_SEND_FORBIDDEN: You join the discussion group before commenting, see here » for more info. +// 403 CHAT_GUEST_SEND_FORBIDDEN: You join the discussion group before commenting, see here » for more info. // 400 CHAT_ID_INVALID: The provided chat id is invalid. // 400 CHAT_RESTRICTED: You can't send messages in this chat, you were restricted. // 403 CHAT_SEND_PLAIN_FORBIDDEN: You can't send non-media (text) messages in this chat. @@ -907,7 +914,7 @@ func (s *MessagesSendMessageRequest) MapEntities() (value MessageEntityClassArra // 400 DOCUMENT_INVALID: The specified document is invalid. // 400 ENCRYPTION_DECLINED: The secret chat was declined. // 400 ENTITIES_TOO_LONG: You provided too many styled message entities. -// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. +// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. // 400 ENTITY_MENTION_USER_INVALID: You mentioned an invalid user. // 400 FROM_MESSAGE_BOT_DISABLED: Bots can't use fromMessage min constructors. // 400 INPUT_USER_DEACTIVATED: The specified user was deleted. @@ -915,14 +922,18 @@ func (s *MessagesSendMessageRequest) MapEntities() (value MessageEntityClassArra // 400 MESSAGE_TOO_LONG: The provided message is too long. // 400 MSG_ID_INVALID: Invalid message ID provided. // 500 MSG_WAIT_FAILED: A waiting call returned an error. -// 406 PAYMENT_UNSUPPORTED: A detailed description of the error will be received separately as described here ». +// 406 PAYMENT_UNSUPPORTED: A detailed description of the error will be received separately as described here ». // 400 PEER_ID_INVALID: The provided peer id is invalid. // 400 PINNED_DIALOGS_TOO_MUCH: Too many pinned dialogs. // 400 POLL_OPTION_INVALID: Invalid poll option provided. // 406 PRIVACY_PREMIUM_REQUIRED: You need a Telegram Premium subscription to send a message to this user. +// 400 QUICK_REPLIES_TOO_MUCH: A maximum of appConfig.quick_replies_limit shortcuts may be created, the limit was reached. +// 400 QUOTE_TEXT_INVALID: The specified reply_to.quote_text field is invalid. // 500 RANDOM_ID_DUPLICATE: You provided a random ID that was already used. // 400 REPLY_MARKUP_INVALID: The provided reply markup is invalid. // 400 REPLY_MARKUP_TOO_LONG: The specified reply_markup is too long. +// 400 REPLY_MESSAGES_TOO_MUCH: Each shortcut can contain a maximum of appConfig.quick_reply_messages_limit messages, the limit was reached. +// 400 REPLY_MESSAGE_ID_INVALID: The specified reply-to message ID is invalid. // 400 REPLY_TO_INVALID: The specified reply_to field is invalid. // 400 REPLY_TO_USER_INVALID: The replied-to user is invalid. // 400 SCHEDULE_BOT_NOT_ALLOWED: Bots cannot schedule messages. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_send_multi_media_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_send_multi_media_gen.go index aac09bb6..e1adb338 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_send_multi_media_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_send_multi_media_gen.go @@ -88,11 +88,17 @@ type MessagesSendMultiMediaRequest struct { // // Use SetSendAs and GetSendAs helpers. SendAs InputPeerClass - // QuickReplyShortcut field of MessagesSendMultiMediaRequest. + // Add the message to the specified quick reply shortcut »¹, instead. + // + // Links: + // 1) https://core.telegram.org/api/business#quick-reply-shortcuts // // Use SetQuickReplyShortcut and GetQuickReplyShortcut helpers. QuickReplyShortcut InputQuickReplyShortcutClass - // Effect field of MessagesSendMultiMediaRequest. + // Specifies a message effect »¹ to use for the message. + // + // Links: + // 1) https://core.telegram.org/api/effects // // Use SetEffect and GetEffect helpers. Effect int64 @@ -721,6 +727,7 @@ func (s *MessagesSendMultiMediaRequest) GetEffect() (value int64, ok bool) { // // Possible errors: // +// 400 CHANNEL_INVALID: The provided channel is invalid. // 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. // 400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. // 400 CHAT_FORWARDS_RESTRICTED: You can't forward messages from a protected chat. @@ -728,14 +735,18 @@ func (s *MessagesSendMultiMediaRequest) GetEffect() (value int64, ok bool) { // 403 CHAT_SEND_PHOTOS_FORBIDDEN: You can't send photos in this chat. // 403 CHAT_SEND_VIDEOS_FORBIDDEN: You can't send videos in this chat. // 403 CHAT_WRITE_FORBIDDEN: You can't write in this chat. -// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. +// 400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length. +// 400 FILE_REFERENCE_%d_EXPIRED: The file reference of the media file at index %d in the passed media array expired, it must be refreshed. +// 400 FILE_REFERENCE_%d_INVALID: The file reference of the media file at index %d in the passed media array is invalid. // 400 MEDIA_CAPTION_TOO_LONG: The caption is too long. // 400 MEDIA_EMPTY: The provided media object is invalid. // 400 MEDIA_INVALID: Media invalid. // 400 MULTI_MEDIA_TOO_LONG: Too many media files for album. // 400 PEER_ID_INVALID: The provided peer id is invalid. +// 400 QUICK_REPLIES_TOO_MUCH: A maximum of appConfig.quick_replies_limit shortcuts may be created, the limit was reached. // 500 RANDOM_ID_DUPLICATE: You provided a random ID that was already used. // 400 RANDOM_ID_EMPTY: Random ID empty. +// 400 REPLY_MESSAGES_TOO_MUCH: Each shortcut can contain a maximum of appConfig.quick_reply_messages_limit messages, the limit was reached. // 400 SCHEDULE_DATE_TOO_LATE: You can't schedule a message this far in the future. // 400 SCHEDULE_TOO_MUCH: There are too many scheduled messages. // 400 SEND_AS_PEER_INVALID: You can't send messages as the specified peer. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_send_paid_reaction_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_send_paid_reaction_gen.go new file mode 100644 index 00000000..84599580 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_messages_send_paid_reaction_gen.go @@ -0,0 +1,325 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesSendPaidReactionRequest represents TL type `messages.sendPaidReaction#9dd6a67b`. +// +// See https://core.telegram.org/method/messages.sendPaidReaction for reference. +type MessagesSendPaidReactionRequest struct { + // Flags field of MessagesSendPaidReactionRequest. + Flags bin.Fields + // Peer field of MessagesSendPaidReactionRequest. + Peer InputPeerClass + // MsgID field of MessagesSendPaidReactionRequest. + MsgID int + // Count field of MessagesSendPaidReactionRequest. + Count int + // RandomID field of MessagesSendPaidReactionRequest. + RandomID int64 + // Private field of MessagesSendPaidReactionRequest. + // + // Use SetPrivate and GetPrivate helpers. + Private bool +} + +// MessagesSendPaidReactionRequestTypeID is TL type id of MessagesSendPaidReactionRequest. +const MessagesSendPaidReactionRequestTypeID = 0x9dd6a67b + +// Ensuring interfaces in compile-time for MessagesSendPaidReactionRequest. +var ( + _ bin.Encoder = &MessagesSendPaidReactionRequest{} + _ bin.Decoder = &MessagesSendPaidReactionRequest{} + _ bin.BareEncoder = &MessagesSendPaidReactionRequest{} + _ bin.BareDecoder = &MessagesSendPaidReactionRequest{} +) + +func (s *MessagesSendPaidReactionRequest) Zero() bool { + if s == nil { + return true + } + if !(s.Flags.Zero()) { + return false + } + if !(s.Peer == nil) { + return false + } + if !(s.MsgID == 0) { + return false + } + if !(s.Count == 0) { + return false + } + if !(s.RandomID == 0) { + return false + } + if !(s.Private == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *MessagesSendPaidReactionRequest) String() string { + if s == nil { + return "MessagesSendPaidReactionRequest(nil)" + } + type Alias MessagesSendPaidReactionRequest + return fmt.Sprintf("MessagesSendPaidReactionRequest%+v", Alias(*s)) +} + +// FillFrom fills MessagesSendPaidReactionRequest from given interface. +func (s *MessagesSendPaidReactionRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) + GetMsgID() (value int) + GetCount() (value int) + GetRandomID() (value int64) + GetPrivate() (value bool, ok bool) +}) { + s.Peer = from.GetPeer() + s.MsgID = from.GetMsgID() + s.Count = from.GetCount() + s.RandomID = from.GetRandomID() + if val, ok := from.GetPrivate(); ok { + s.Private = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesSendPaidReactionRequest) TypeID() uint32 { + return MessagesSendPaidReactionRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesSendPaidReactionRequest) TypeName() string { + return "messages.sendPaidReaction" +} + +// TypeInfo returns info about TL type. +func (s *MessagesSendPaidReactionRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.sendPaidReaction", + ID: MessagesSendPaidReactionRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "MsgID", + SchemaName: "msg_id", + }, + { + Name: "Count", + SchemaName: "count", + }, + { + Name: "RandomID", + SchemaName: "random_id", + }, + { + Name: "Private", + SchemaName: "private", + Null: !s.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (s *MessagesSendPaidReactionRequest) SetFlags() { + if !(s.Private == false) { + s.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (s *MessagesSendPaidReactionRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode messages.sendPaidReaction#9dd6a67b as nil") + } + b.PutID(MessagesSendPaidReactionRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *MessagesSendPaidReactionRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode messages.sendPaidReaction#9dd6a67b as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.sendPaidReaction#9dd6a67b: field flags: %w", err) + } + if s.Peer == nil { + return fmt.Errorf("unable to encode messages.sendPaidReaction#9dd6a67b: field peer is nil") + } + if err := s.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.sendPaidReaction#9dd6a67b: field peer: %w", err) + } + b.PutInt(s.MsgID) + b.PutInt(s.Count) + b.PutLong(s.RandomID) + if s.Flags.Has(0) { + b.PutBool(s.Private) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *MessagesSendPaidReactionRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode messages.sendPaidReaction#9dd6a67b to nil") + } + if err := b.ConsumeID(MessagesSendPaidReactionRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.sendPaidReaction#9dd6a67b: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *MessagesSendPaidReactionRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode messages.sendPaidReaction#9dd6a67b to nil") + } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messages.sendPaidReaction#9dd6a67b: field flags: %w", err) + } + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode messages.sendPaidReaction#9dd6a67b: field peer: %w", err) + } + s.Peer = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.sendPaidReaction#9dd6a67b: field msg_id: %w", err) + } + s.MsgID = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.sendPaidReaction#9dd6a67b: field count: %w", err) + } + s.Count = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messages.sendPaidReaction#9dd6a67b: field random_id: %w", err) + } + s.RandomID = value + } + if s.Flags.Has(0) { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messages.sendPaidReaction#9dd6a67b: field private: %w", err) + } + s.Private = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (s *MessagesSendPaidReactionRequest) GetPeer() (value InputPeerClass) { + if s == nil { + return + } + return s.Peer +} + +// GetMsgID returns value of MsgID field. +func (s *MessagesSendPaidReactionRequest) GetMsgID() (value int) { + if s == nil { + return + } + return s.MsgID +} + +// GetCount returns value of Count field. +func (s *MessagesSendPaidReactionRequest) GetCount() (value int) { + if s == nil { + return + } + return s.Count +} + +// GetRandomID returns value of RandomID field. +func (s *MessagesSendPaidReactionRequest) GetRandomID() (value int64) { + if s == nil { + return + } + return s.RandomID +} + +// SetPrivate sets value of Private conditional field. +func (s *MessagesSendPaidReactionRequest) SetPrivate(value bool) { + s.Flags.Set(0) + s.Private = value +} + +// GetPrivate returns value of Private conditional field and +// boolean which is true if field was set. +func (s *MessagesSendPaidReactionRequest) GetPrivate() (value bool, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(0) { + return value, false + } + return s.Private, true +} + +// MessagesSendPaidReaction invokes method messages.sendPaidReaction#9dd6a67b returning error if any. +// +// See https://core.telegram.org/method/messages.sendPaidReaction for reference. +func (c *Client) MessagesSendPaidReaction(ctx context.Context, request *MessagesSendPaidReactionRequest) (UpdatesClass, error) { + var result UpdatesBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.Updates, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_messages_send_paid_reaction_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_send_paid_reaction_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_messages_send_paid_reaction_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_messages_send_quick_reply_messages_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_send_quick_reply_messages_gen.go index 4f1c1725..973a5ed9 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_send_quick_reply_messages_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_send_quick_reply_messages_gen.go @@ -32,16 +32,22 @@ var ( ) // MessagesSendQuickReplyMessagesRequest represents TL type `messages.sendQuickReplyMessages#6c750de1`. +// Send a quick reply shortcut »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts // // See https://core.telegram.org/method/messages.sendQuickReplyMessages for reference. type MessagesSendQuickReplyMessagesRequest struct { - // Peer field of MessagesSendQuickReplyMessagesRequest. + // The peer where to send the shortcut (users only, for now). Peer InputPeerClass - // ShortcutID field of MessagesSendQuickReplyMessagesRequest. + // The ID of the quick reply shortcut to send. ShortcutID int - // ID field of MessagesSendQuickReplyMessagesRequest. + // Specify a subset of messages from the shortcut to send; if empty, defaults to all of + // them. ID []int - // RandomID field of MessagesSendQuickReplyMessagesRequest. + // Unique client IDs required to prevent message resending, one for each message we're + // sending, may be empty (but not recommended). RandomID []int64 } @@ -273,6 +279,15 @@ func (s *MessagesSendQuickReplyMessagesRequest) GetRandomID() (value []int64) { } // MessagesSendQuickReplyMessages invokes method messages.sendQuickReplyMessages#6c750de1 returning error if any. +// Send a quick reply shortcut »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts +// +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. // // See https://core.telegram.org/method/messages.sendQuickReplyMessages for reference. func (c *Client) MessagesSendQuickReplyMessages(ctx context.Context, request *MessagesSendQuickReplyMessagesRequest) (UpdatesClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_send_reaction_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_send_reaction_gen.go index 623001ae..15d550cc 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_send_reaction_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_send_reaction_gen.go @@ -387,7 +387,7 @@ func (s *MessagesSendReactionRequest) MapReaction() (value ReactionClassArray, o // 400 MSG_ID_INVALID: Invalid message ID provided. // 400 PEER_ID_INVALID: The provided peer id is invalid. // 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. -// 400 REACTIONS_TOO_MANY: The message already has exactly reactions_uniq_max reaction emojis, you can't react with a new emoji, see the docs for more info ». +// 400 REACTIONS_TOO_MANY: The message already has exactly reactions_uniq_max reaction emojis, you can't react with a new emoji, see the docs for more info ». // 400 REACTION_EMPTY: Empty reaction provided. // 400 REACTION_INVALID: The specified reaction is invalid. // 400 USER_BANNED_IN_CHANNEL: You're banned from sending messages in supergroups/channels. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_send_scheduled_messages_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_send_scheduled_messages_gen.go index 29158352..9d0d838f 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_send_scheduled_messages_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_send_scheduled_messages_gen.go @@ -213,6 +213,7 @@ func (s *MessagesSendScheduledMessagesRequest) GetID() (value []int) { // // 400 MESSAGE_ID_INVALID: The provided message id is invalid. // 400 PEER_ID_INVALID: The provided peer id is invalid. +// 500 RANDOM_ID_DUPLICATE: You provided a random ID that was already used. // // See https://core.telegram.org/method/messages.sendScheduledMessages for reference. func (c *Client) MessagesSendScheduledMessages(ctx context.Context, request *MessagesSendScheduledMessagesRequest) (UpdatesClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_send_web_view_data_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_send_web_view_data_gen.go index e3886f72..d0dc094a 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_send_web_view_data_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_send_web_view_data_gen.go @@ -264,6 +264,10 @@ func (s *MessagesSendWebViewDataRequest) GetData() (value string) { // Links: // 1. https://core.telegram.org/api/bots/webapps // +// Possible errors: +// +// 400 BOT_INVALID: This is not a valid bot. +// // See https://core.telegram.org/method/messages.sendWebViewData for reference. func (c *Client) MessagesSendWebViewData(ctx context.Context, request *MessagesSendWebViewDataRequest) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_messages_send_web_view_result_message_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_send_web_view_result_message_gen.go index 1496f13c..689627b1 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_send_web_view_result_message_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_send_web_view_result_message_gen.go @@ -210,6 +210,7 @@ func (s *MessagesSendWebViewResultMessageRequest) GetResult() (value InputBotInl // Possible errors: // // 400 QUERY_ID_INVALID: The query ID is invalid. +// 400 USER_BOT_REQUIRED: This method can only be called by a bot. // // See https://core.telegram.org/method/messages.sendWebViewResultMessage for reference. // Can be used by bots. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_set_bot_precheckout_results_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_set_bot_precheckout_results_gen.go index b5e2ab3a..ad80b01b 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_set_bot_precheckout_results_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_set_bot_precheckout_results_gen.go @@ -291,6 +291,7 @@ func (s *MessagesSetBotPrecheckoutResultsRequest) GetError() (value string, ok b // Possible errors: // // 400 ERROR_TEXT_EMPTY: The provided error message is empty. +// 400 USER_BOT_REQUIRED: This method can only be called by a bot. // // See https://core.telegram.org/method/messages.setBotPrecheckoutResults for reference. // Can be used by bots. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_set_bot_shipping_results_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_set_bot_shipping_results_gen.go index 32f0ff47..356edb46 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_set_bot_shipping_results_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_set_bot_shipping_results_gen.go @@ -311,6 +311,7 @@ func (s *MessagesSetBotShippingResultsRequest) GetShippingOptions() (value []Shi // Possible errors: // // 400 QUERY_ID_INVALID: The query ID is invalid. +// 400 USER_BOT_REQUIRED: This method can only be called by a bot. // // See https://core.telegram.org/method/messages.setBotShippingResults for reference. // Can be used by bots. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_set_chat_available_reactions_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_set_chat_available_reactions_gen.go index 7056e216..0dddcb78 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_set_chat_available_reactions_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_set_chat_available_reactions_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesSetChatAvailableReactionsRequest represents TL type `messages.setChatAvailableReactions#5a150bd4`. +// MessagesSetChatAvailableReactionsRequest represents TL type `messages.setChatAvailableReactions#864b2581`. // Change the set of message reactions »¹ that can be used in a certain group, // supergroup or channel // @@ -40,20 +40,34 @@ var ( // // See https://core.telegram.org/method/messages.setChatAvailableReactions for reference. type MessagesSetChatAvailableReactionsRequest struct { - // Flags field of MessagesSetChatAvailableReactionsRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // Group where to apply changes Peer InputPeerClass // Allowed reaction emojis AvailableReactions ChatReactionsClass - // ReactionsLimit field of MessagesSetChatAvailableReactionsRequest. + // This flag may be used to impose a custom limit of unique reactions (i.e. a + // customizable version of appConfig.reactions_uniq_max¹); this field and the other info + // set by the method will then be available to users in channelFull² and chatFull³. + // + // Links: + // 1) https://core.telegram.org/api/config#reactions-uniq-max + // 2) https://core.telegram.org/constructor/channelFull + // 3) https://core.telegram.org/constructor/chatFull // // Use SetReactionsLimit and GetReactionsLimit helpers. ReactionsLimit int + // PaidEnabled field of MessagesSetChatAvailableReactionsRequest. + // + // Use SetPaidEnabled and GetPaidEnabled helpers. + PaidEnabled bool } // MessagesSetChatAvailableReactionsRequestTypeID is TL type id of MessagesSetChatAvailableReactionsRequest. -const MessagesSetChatAvailableReactionsRequestTypeID = 0x5a150bd4 +const MessagesSetChatAvailableReactionsRequestTypeID = 0x864b2581 // Ensuring interfaces in compile-time for MessagesSetChatAvailableReactionsRequest. var ( @@ -79,6 +93,9 @@ func (s *MessagesSetChatAvailableReactionsRequest) Zero() bool { if !(s.ReactionsLimit == 0) { return false } + if !(s.PaidEnabled == false) { + return false + } return true } @@ -97,6 +114,7 @@ func (s *MessagesSetChatAvailableReactionsRequest) FillFrom(from interface { GetPeer() (value InputPeerClass) GetAvailableReactions() (value ChatReactionsClass) GetReactionsLimit() (value int, ok bool) + GetPaidEnabled() (value bool, ok bool) }) { s.Peer = from.GetPeer() s.AvailableReactions = from.GetAvailableReactions() @@ -104,6 +122,10 @@ func (s *MessagesSetChatAvailableReactionsRequest) FillFrom(from interface { s.ReactionsLimit = val } + if val, ok := from.GetPaidEnabled(); ok { + s.PaidEnabled = val + } + } // TypeID returns type id in TL schema. @@ -142,6 +164,11 @@ func (s *MessagesSetChatAvailableReactionsRequest) TypeInfo() tdp.Type { SchemaName: "reactions_limit", Null: !s.Flags.Has(0), }, + { + Name: "PaidEnabled", + SchemaName: "paid_enabled", + Null: !s.Flags.Has(1), + }, } return typ } @@ -151,12 +178,15 @@ func (s *MessagesSetChatAvailableReactionsRequest) SetFlags() { if !(s.ReactionsLimit == 0) { s.Flags.Set(0) } + if !(s.PaidEnabled == false) { + s.Flags.Set(1) + } } // Encode implements bin.Encoder. func (s *MessagesSetChatAvailableReactionsRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode messages.setChatAvailableReactions#5a150bd4 as nil") + return fmt.Errorf("can't encode messages.setChatAvailableReactions#864b2581 as nil") } b.PutID(MessagesSetChatAvailableReactionsRequestTypeID) return s.EncodeBare(b) @@ -165,37 +195,40 @@ func (s *MessagesSetChatAvailableReactionsRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *MessagesSetChatAvailableReactionsRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode messages.setChatAvailableReactions#5a150bd4 as nil") + return fmt.Errorf("can't encode messages.setChatAvailableReactions#864b2581 as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.setChatAvailableReactions#5a150bd4: field flags: %w", err) + return fmt.Errorf("unable to encode messages.setChatAvailableReactions#864b2581: field flags: %w", err) } if s.Peer == nil { - return fmt.Errorf("unable to encode messages.setChatAvailableReactions#5a150bd4: field peer is nil") + return fmt.Errorf("unable to encode messages.setChatAvailableReactions#864b2581: field peer is nil") } if err := s.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.setChatAvailableReactions#5a150bd4: field peer: %w", err) + return fmt.Errorf("unable to encode messages.setChatAvailableReactions#864b2581: field peer: %w", err) } if s.AvailableReactions == nil { - return fmt.Errorf("unable to encode messages.setChatAvailableReactions#5a150bd4: field available_reactions is nil") + return fmt.Errorf("unable to encode messages.setChatAvailableReactions#864b2581: field available_reactions is nil") } if err := s.AvailableReactions.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.setChatAvailableReactions#5a150bd4: field available_reactions: %w", err) + return fmt.Errorf("unable to encode messages.setChatAvailableReactions#864b2581: field available_reactions: %w", err) } if s.Flags.Has(0) { b.PutInt(s.ReactionsLimit) } + if s.Flags.Has(1) { + b.PutBool(s.PaidEnabled) + } return nil } // Decode implements bin.Decoder. func (s *MessagesSetChatAvailableReactionsRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode messages.setChatAvailableReactions#5a150bd4 to nil") + return fmt.Errorf("can't decode messages.setChatAvailableReactions#864b2581 to nil") } if err := b.ConsumeID(MessagesSetChatAvailableReactionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.setChatAvailableReactions#5a150bd4: %w", err) + return fmt.Errorf("unable to decode messages.setChatAvailableReactions#864b2581: %w", err) } return s.DecodeBare(b) } @@ -203,34 +236,41 @@ func (s *MessagesSetChatAvailableReactionsRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *MessagesSetChatAvailableReactionsRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode messages.setChatAvailableReactions#5a150bd4 to nil") + return fmt.Errorf("can't decode messages.setChatAvailableReactions#864b2581 to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.setChatAvailableReactions#5a150bd4: field flags: %w", err) + return fmt.Errorf("unable to decode messages.setChatAvailableReactions#864b2581: field flags: %w", err) } } { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.setChatAvailableReactions#5a150bd4: field peer: %w", err) + return fmt.Errorf("unable to decode messages.setChatAvailableReactions#864b2581: field peer: %w", err) } s.Peer = value } { value, err := DecodeChatReactions(b) if err != nil { - return fmt.Errorf("unable to decode messages.setChatAvailableReactions#5a150bd4: field available_reactions: %w", err) + return fmt.Errorf("unable to decode messages.setChatAvailableReactions#864b2581: field available_reactions: %w", err) } s.AvailableReactions = value } if s.Flags.Has(0) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.setChatAvailableReactions#5a150bd4: field reactions_limit: %w", err) + return fmt.Errorf("unable to decode messages.setChatAvailableReactions#864b2581: field reactions_limit: %w", err) } s.ReactionsLimit = value } + if s.Flags.Has(1) { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messages.setChatAvailableReactions#864b2581: field paid_enabled: %w", err) + } + s.PaidEnabled = value + } return nil } @@ -268,7 +308,25 @@ func (s *MessagesSetChatAvailableReactionsRequest) GetReactionsLimit() (value in return s.ReactionsLimit, true } -// MessagesSetChatAvailableReactions invokes method messages.setChatAvailableReactions#5a150bd4 returning error if any. +// SetPaidEnabled sets value of PaidEnabled conditional field. +func (s *MessagesSetChatAvailableReactionsRequest) SetPaidEnabled(value bool) { + s.Flags.Set(1) + s.PaidEnabled = value +} + +// GetPaidEnabled returns value of PaidEnabled conditional field and +// boolean which is true if field was set. +func (s *MessagesSetChatAvailableReactionsRequest) GetPaidEnabled() (value bool, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(1) { + return value, false + } + return s.PaidEnabled, true +} + +// MessagesSetChatAvailableReactions invokes method messages.setChatAvailableReactions#864b2581 returning error if any. // Change the set of message reactions »¹ that can be used in a certain group, // supergroup or channel // diff --git a/vendor/github.com/gotd/td/tg/tl_messages_set_chat_wall_paper_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_set_chat_wall_paper_gen.go index 613f8eb2..39351fa8 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_set_chat_wall_paper_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_set_chat_wall_paper_gen.go @@ -444,7 +444,6 @@ func (s *MessagesSetChatWallPaperRequest) GetID() (value int, ok bool) { // 400 WALLPAPER_NOT_FOUND: The specified wallpaper could not be found. // // See https://core.telegram.org/method/messages.setChatWallPaper for reference. -// Can be used by bots. func (c *Client) MessagesSetChatWallPaper(ctx context.Context, request *MessagesSetChatWallPaperRequest) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_messages_set_default_history_ttl_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_set_default_history_ttl_gen.go index 291ccba9..1fe8b947 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_set_default_history_ttl_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_set_default_history_ttl_gen.go @@ -169,7 +169,6 @@ func (s *MessagesSetDefaultHistoryTTLRequest) GetPeriod() (value int) { // 400 TTL_PERIOD_INVALID: The specified TTL period is invalid. // // See https://core.telegram.org/method/messages.setDefaultHistoryTTL for reference. -// Can be used by bots. func (c *Client) MessagesSetDefaultHistoryTTL(ctx context.Context, period int) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_messages_set_history_ttl_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_set_history_ttl_gen.go index 13eea9d7..83190ee2 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_set_history_ttl_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_set_history_ttl_gen.go @@ -199,6 +199,7 @@ func (s *MessagesSetHistoryTTLRequest) GetPeriod() (value int) { // Possible errors: // // 400 CHAT_NOT_MODIFIED: No changes were made to chat information because the new information you passed is identical to the current information. +// 400 PEER_ID_INVALID: The provided peer id is invalid. // 400 TTL_PERIOD_INVALID: The specified TTL period is invalid. // // See https://core.telegram.org/method/messages.setHistoryTTL for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_set_inline_bot_results_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_set_inline_bot_results_gen.go index ff925dea..89bfb966 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_set_inline_bot_results_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_set_inline_bot_results_gen.go @@ -518,8 +518,10 @@ func (s *MessagesSetInlineBotResultsRequest) MapResults() (value InputBotInlineR // 400 START_PARAM_INVALID: Start parameter invalid. // 400 STICKER_DOCUMENT_INVALID: The specified sticker document is invalid. // 400 SWITCH_PM_TEXT_EMPTY: The switch_pm.text field was empty. +// 400 SWITCH_WEBVIEW_URL_INVALID: The URL specified in switch_webview.url is invalid! // 400 URL_INVALID: Invalid URL provided. // 403 USER_BOT_INVALID: User accounts must provide the bot method parameter when calling this method. If there is no such method parameter, this method can only be invoked by bot accounts. +// 400 USER_BOT_REQUIRED: This method can only be called by a bot. // 400 VIDEO_TITLE_EMPTY: The specified video title is empty. // 400 WEBDOCUMENT_INVALID: Invalid webdocument URL provided. // 400 WEBDOCUMENT_MIME_INVALID: Invalid webdocument mime type provided. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_stickers_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_stickers_gen.go index 2c07595b..5a1a9b84 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_stickers_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_stickers_gen.go @@ -138,7 +138,7 @@ func (s *MessagesStickersNotModified) DecodeBare(b *bin.Buffer) error { // // See https://core.telegram.org/constructor/messages.stickers for reference. type MessagesStickers struct { - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation diff --git a/vendor/github.com/gotd/td/tg/tl_messages_toggle_bot_in_attach_menu_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_toggle_bot_in_attach_menu_gen.go index 92126c81..d7f70fb3 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_toggle_bot_in_attach_menu_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_toggle_bot_in_attach_menu_gen.go @@ -262,6 +262,10 @@ func (t *MessagesToggleBotInAttachMenuRequest) GetEnabled() (value bool) { // Links: // 1. https://core.telegram.org/api/bots/attach // +// Possible errors: +// +// 400 BOT_INVALID: This is not a valid bot. +// // See https://core.telegram.org/method/messages.toggleBotInAttachMenu for reference. func (c *Client) MessagesToggleBotInAttachMenu(ctx context.Context, request *MessagesToggleBotInAttachMenuRequest) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_messages_toggle_dialog_filter_tags_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_toggle_dialog_filter_tags_gen.go index 2d07138f..6b00ba14 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_toggle_dialog_filter_tags_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_toggle_dialog_filter_tags_gen.go @@ -32,10 +32,14 @@ var ( ) // MessagesToggleDialogFilterTagsRequest represents TL type `messages.toggleDialogFilterTags#fd2dda49`. +// Enable or disable folder tags »¹. +// +// Links: +// 1. https://core.telegram.org/api/folders#folder-tags // // See https://core.telegram.org/method/messages.toggleDialogFilterTags for reference. type MessagesToggleDialogFilterTagsRequest struct { - // Enabled field of MessagesToggleDialogFilterTagsRequest. + // Enable or disable folder tags. Enabled bool } @@ -161,6 +165,14 @@ func (t *MessagesToggleDialogFilterTagsRequest) GetEnabled() (value bool) { } // MessagesToggleDialogFilterTags invokes method messages.toggleDialogFilterTags#fd2dda49 returning error if any. +// Enable or disable folder tags »¹. +// +// Links: +// 1. https://core.telegram.org/api/folders#folder-tags +// +// Possible errors: +// +// 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. // // See https://core.telegram.org/method/messages.toggleDialogFilterTags for reference. func (c *Client) MessagesToggleDialogFilterTags(ctx context.Context, enabled bool) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_toggle_paid_reaction_privacy_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_toggle_paid_reaction_privacy_gen.go new file mode 100644 index 00000000..b891c0e4 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_messages_toggle_paid_reaction_privacy_gen.go @@ -0,0 +1,233 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesTogglePaidReactionPrivacyRequest represents TL type `messages.togglePaidReactionPrivacy#849ad397`. +// +// See https://core.telegram.org/method/messages.togglePaidReactionPrivacy for reference. +type MessagesTogglePaidReactionPrivacyRequest struct { + // Peer field of MessagesTogglePaidReactionPrivacyRequest. + Peer InputPeerClass + // MsgID field of MessagesTogglePaidReactionPrivacyRequest. + MsgID int + // Private field of MessagesTogglePaidReactionPrivacyRequest. + Private bool +} + +// MessagesTogglePaidReactionPrivacyRequestTypeID is TL type id of MessagesTogglePaidReactionPrivacyRequest. +const MessagesTogglePaidReactionPrivacyRequestTypeID = 0x849ad397 + +// Ensuring interfaces in compile-time for MessagesTogglePaidReactionPrivacyRequest. +var ( + _ bin.Encoder = &MessagesTogglePaidReactionPrivacyRequest{} + _ bin.Decoder = &MessagesTogglePaidReactionPrivacyRequest{} + _ bin.BareEncoder = &MessagesTogglePaidReactionPrivacyRequest{} + _ bin.BareDecoder = &MessagesTogglePaidReactionPrivacyRequest{} +) + +func (t *MessagesTogglePaidReactionPrivacyRequest) Zero() bool { + if t == nil { + return true + } + if !(t.Peer == nil) { + return false + } + if !(t.MsgID == 0) { + return false + } + if !(t.Private == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *MessagesTogglePaidReactionPrivacyRequest) String() string { + if t == nil { + return "MessagesTogglePaidReactionPrivacyRequest(nil)" + } + type Alias MessagesTogglePaidReactionPrivacyRequest + return fmt.Sprintf("MessagesTogglePaidReactionPrivacyRequest%+v", Alias(*t)) +} + +// FillFrom fills MessagesTogglePaidReactionPrivacyRequest from given interface. +func (t *MessagesTogglePaidReactionPrivacyRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) + GetMsgID() (value int) + GetPrivate() (value bool) +}) { + t.Peer = from.GetPeer() + t.MsgID = from.GetMsgID() + t.Private = from.GetPrivate() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesTogglePaidReactionPrivacyRequest) TypeID() uint32 { + return MessagesTogglePaidReactionPrivacyRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesTogglePaidReactionPrivacyRequest) TypeName() string { + return "messages.togglePaidReactionPrivacy" +} + +// TypeInfo returns info about TL type. +func (t *MessagesTogglePaidReactionPrivacyRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.togglePaidReactionPrivacy", + ID: MessagesTogglePaidReactionPrivacyRequestTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "MsgID", + SchemaName: "msg_id", + }, + { + Name: "Private", + SchemaName: "private", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *MessagesTogglePaidReactionPrivacyRequest) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode messages.togglePaidReactionPrivacy#849ad397 as nil") + } + b.PutID(MessagesTogglePaidReactionPrivacyRequestTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *MessagesTogglePaidReactionPrivacyRequest) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode messages.togglePaidReactionPrivacy#849ad397 as nil") + } + if t.Peer == nil { + return fmt.Errorf("unable to encode messages.togglePaidReactionPrivacy#849ad397: field peer is nil") + } + if err := t.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.togglePaidReactionPrivacy#849ad397: field peer: %w", err) + } + b.PutInt(t.MsgID) + b.PutBool(t.Private) + return nil +} + +// Decode implements bin.Decoder. +func (t *MessagesTogglePaidReactionPrivacyRequest) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode messages.togglePaidReactionPrivacy#849ad397 to nil") + } + if err := b.ConsumeID(MessagesTogglePaidReactionPrivacyRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.togglePaidReactionPrivacy#849ad397: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *MessagesTogglePaidReactionPrivacyRequest) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode messages.togglePaidReactionPrivacy#849ad397 to nil") + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode messages.togglePaidReactionPrivacy#849ad397: field peer: %w", err) + } + t.Peer = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.togglePaidReactionPrivacy#849ad397: field msg_id: %w", err) + } + t.MsgID = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messages.togglePaidReactionPrivacy#849ad397: field private: %w", err) + } + t.Private = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (t *MessagesTogglePaidReactionPrivacyRequest) GetPeer() (value InputPeerClass) { + if t == nil { + return + } + return t.Peer +} + +// GetMsgID returns value of MsgID field. +func (t *MessagesTogglePaidReactionPrivacyRequest) GetMsgID() (value int) { + if t == nil { + return + } + return t.MsgID +} + +// GetPrivate returns value of Private field. +func (t *MessagesTogglePaidReactionPrivacyRequest) GetPrivate() (value bool) { + if t == nil { + return + } + return t.Private +} + +// MessagesTogglePaidReactionPrivacy invokes method messages.togglePaidReactionPrivacy#849ad397 returning error if any. +// +// See https://core.telegram.org/method/messages.togglePaidReactionPrivacy for reference. +func (c *Client) MessagesTogglePaidReactionPrivacy(ctx context.Context, request *MessagesTogglePaidReactionPrivacyRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_messages_toggle_paid_reaction_privacy_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_toggle_paid_reaction_privacy_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_messages_toggle_paid_reaction_privacy_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_messages_toggle_peer_translations_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_toggle_peer_translations_gen.go index 92212549..1685b9ea 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_toggle_peer_translations_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_toggle_peer_translations_gen.go @@ -231,8 +231,11 @@ func (t *MessagesTogglePeerTranslationsRequest) GetPeer() (value InputPeerClass) // Links: // 1. https://core.telegram.org/api/translation // +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// // See https://core.telegram.org/method/messages.togglePeerTranslations for reference. -// Can be used by bots. func (c *Client) MessagesTogglePeerTranslations(ctx context.Context, request *MessagesTogglePeerTranslationsRequest) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_messages_translate_text_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_translate_text_gen.go index 03fa9250..147e8c56 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_translate_text_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_translate_text_gen.go @@ -379,6 +379,7 @@ func (t *MessagesTranslateTextRequest) GetToLang() (value string) { // 400 MSG_ID_INVALID: Invalid message ID provided. // 400 PEER_ID_INVALID: The provided peer id is invalid. // 400 TO_LANG_INVALID: The specified destination language is invalid. +// 400 TRANSLATE_REQ_QUOTA_EXCEEDED: Translation is currently unavailable due to a temporary server-side lack of resources. // // See https://core.telegram.org/method/messages.translateText for reference. func (c *Client) MessagesTranslateText(ctx context.Context, request *MessagesTranslateTextRequest) (*MessagesTranslateResult, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_unpin_all_messages_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_unpin_all_messages_gen.go index 1528854c..a3de1dbc 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_unpin_all_messages_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_unpin_all_messages_gen.go @@ -251,6 +251,7 @@ func (u *MessagesUnpinAllMessagesRequest) GetTopMsgID() (value int, ok bool) { // // 400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. // 400 CHAT_NOT_MODIFIED: No changes were made to chat information because the new information you passed is identical to the current information. +// 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/messages.unpinAllMessages for reference. // Can be used by bots. diff --git a/vendor/github.com/gotd/td/tg/tl_messages_update_dialog_filter_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_update_dialog_filter_gen.go index 92120c93..cc95a13d 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_update_dialog_filter_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_update_dialog_filter_gen.go @@ -257,6 +257,8 @@ func (u *MessagesUpdateDialogFilterRequest) GetFilter() (value DialogFilterClass // 400 FILTER_ID_INVALID: The specified filter ID is invalid. // 400 FILTER_INCLUDE_EMPTY: The include_peers vector of the filter is empty. // 400 FILTER_TITLE_EMPTY: The title field of the filter is empty. +// 400 MSG_ID_INVALID: Invalid message ID provided. +// 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/messages.updateDialogFilter for reference. func (c *Client) MessagesUpdateDialogFilter(ctx context.Context, request *MessagesUpdateDialogFilterRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_update_saved_reaction_tag_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_update_saved_reaction_tag_gen.go index 5491d999..8c1af1b1 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_update_saved_reaction_tag_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_update_saved_reaction_tag_gen.go @@ -32,14 +32,25 @@ var ( ) // MessagesUpdateSavedReactionTagRequest represents TL type `messages.updateSavedReactionTag#60297dec`. +// Update the description of a saved message tag »¹. +// +// Links: +// 1. https://core.telegram.org/api/saved-messages#tags // // See https://core.telegram.org/method/messages.updateSavedReactionTag for reference. type MessagesUpdateSavedReactionTagRequest struct { - // Flags field of MessagesUpdateSavedReactionTagRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Reaction field of MessagesUpdateSavedReactionTagRequest. + // Reaction¹ associated to the tag + // + // Links: + // 1) https://core.telegram.org/api/reactions Reaction ReactionClass - // Title field of MessagesUpdateSavedReactionTagRequest. + // Tag description, max 12 UTF-8 characters; to remove the description call the method + // without setting this flag. // // Use SetTitle and GetTitle helpers. Title string @@ -232,6 +243,15 @@ func (u *MessagesUpdateSavedReactionTagRequest) GetTitle() (value string, ok boo } // MessagesUpdateSavedReactionTag invokes method messages.updateSavedReactionTag#60297dec returning error if any. +// Update the description of a saved message tag »¹. +// +// Links: +// 1. https://core.telegram.org/api/saved-messages#tags +// +// Possible errors: +// +// 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. +// 400 REACTION_INVALID: The specified reaction is invalid. // // See https://core.telegram.org/method/messages.updateSavedReactionTag for reference. func (c *Client) MessagesUpdateSavedReactionTag(ctx context.Context, request *MessagesUpdateSavedReactionTagRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_upload_encrypted_file_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_upload_encrypted_file_gen.go index 72c19ffc..b0048afb 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_upload_encrypted_file_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_upload_encrypted_file_gen.go @@ -201,6 +201,10 @@ func (u *MessagesUploadEncryptedFileRequest) GetFileAsNotEmpty() (NotEmptyInputE // MessagesUploadEncryptedFile invokes method messages.uploadEncryptedFile#5057c497 returning error if any. // Upload encrypted file and associate it to a secret chat // +// Possible errors: +// +// 400 CHAT_ID_INVALID: The provided chat id is invalid. +// // See https://core.telegram.org/method/messages.uploadEncryptedFile for reference. func (c *Client) MessagesUploadEncryptedFile(ctx context.Context, request *MessagesUploadEncryptedFileRequest) (EncryptedFileClass, error) { var result EncryptedFileBox diff --git a/vendor/github.com/gotd/td/tg/tl_messages_upload_imported_media_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_upload_imported_media_gen.go index 470440ed..03e89d2d 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_upload_imported_media_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_upload_imported_media_gen.go @@ -268,6 +268,7 @@ func (u *MessagesUploadImportedMediaRequest) GetMedia() (value InputMediaClass) // Possible errors: // // 400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. +// 400 IMPORT_ID_INVALID: The specified import ID is invalid. // // See https://core.telegram.org/method/messages.uploadImportedMedia for reference. func (c *Client) MessagesUploadImportedMedia(ctx context.Context, request *MessagesUploadImportedMediaRequest) (MessageMediaClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_messages_upload_media_gen.go b/vendor/github.com/gotd/td/tg/tl_messages_upload_media_gen.go index 3b55b61f..ba7a72c1 100644 --- a/vendor/github.com/gotd/td/tg/tl_messages_upload_media_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_messages_upload_media_gen.go @@ -36,9 +36,16 @@ var ( // // See https://core.telegram.org/method/messages.uploadMedia for reference. type MessagesUploadMediaRequest struct { - // Flags field of MessagesUploadMediaRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // BusinessConnectionID field of MessagesUploadMediaRequest. + // Whether the media will be used only in the specified business connection »¹, and not + // directly by the bot. + // + // Links: + // 1) https://core.telegram.org/api/business#connected-bots // // Use SetBusinessConnectionID and GetBusinessConnectionID helpers. BusinessConnectionID string diff --git a/vendor/github.com/gotd/td/tg/tl_missing_invitee_gen.go b/vendor/github.com/gotd/td/tg/tl_missing_invitee_gen.go index 8d802b9e..79b484ac 100644 --- a/vendor/github.com/gotd/td/tg/tl_missing_invitee_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_missing_invitee_gen.go @@ -32,16 +32,37 @@ var ( ) // MissingInvitee represents TL type `missingInvitee#628c9224`. +// Info about why a specific user could not be invited »¹. +// +// Links: +// 1. https://core.telegram.org/api/invites#direct-invites // // See https://core.telegram.org/constructor/missingInvitee for reference. type MissingInvitee struct { - // Flags field of MissingInvitee. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // PremiumWouldAllowInvite field of MissingInvitee. + // If set, we could not add the user only because the current account needs to purchase a + // Telegram Premium¹ subscription to complete the operation. + // + // Links: + // 1) https://core.telegram.org/api/premium PremiumWouldAllowInvite bool - // PremiumRequiredForPm field of MissingInvitee. + // If set, we could not add the user because of their privacy settings, and additionally, + // the current account needs to purchase a Telegram Premium¹ subscription to directly + // share an invite link with the user via a private message. + // + // Links: + // 1) https://core.telegram.org/api/premium PremiumRequiredForPm bool - // UserID field of MissingInvitee. + // ID of the user. If neither of the flags below are set, we could not add the user + // because of their privacy settings, and we can create and directly share an invite + // link¹ with them using a normal message, instead. + // + // Links: + // 1) https://core.telegram.org/api/invites#invite-links UserID int64 } diff --git a/vendor/github.com/gotd/td/tg/tl_outbox_read_date_gen.go b/vendor/github.com/gotd/td/tg/tl_outbox_read_date_gen.go index 5f5b1e41..f04ab755 100644 --- a/vendor/github.com/gotd/td/tg/tl_outbox_read_date_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_outbox_read_date_gen.go @@ -32,10 +32,11 @@ var ( ) // OutboxReadDate represents TL type `outboxReadDate#3bb842ac`. +// Exact read date of a private message we sent to another user. // // See https://core.telegram.org/constructor/outboxReadDate for reference. type OutboxReadDate struct { - // Date field of OutboxReadDate. + // UNIX timestamp with the read date. Date int } diff --git a/vendor/github.com/gotd/td/tg/tl_payments_assign_app_store_transaction_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_assign_app_store_transaction_gen.go index a20f59ae..3ed1631d 100644 --- a/vendor/github.com/gotd/td/tg/tl_payments_assign_app_store_transaction_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_payments_assign_app_store_transaction_gen.go @@ -198,6 +198,10 @@ func (a *PaymentsAssignAppStoreTransactionRequest) GetPurpose() (value InputStor // Informs server about a purchase made through the App Store: for official applications // only. // +// Possible errors: +// +// 400 RECEIPT_EMPTY: The specified receipt is empty. +// // See https://core.telegram.org/method/payments.assignAppStoreTransaction for reference. func (c *Client) PaymentsAssignAppStoreTransaction(ctx context.Context, request *PaymentsAssignAppStoreTransactionRequest) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_payments_assign_play_market_transaction_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_assign_play_market_transaction_gen.go index 5bbfe09f..5b6669f4 100644 --- a/vendor/github.com/gotd/td/tg/tl_payments_assign_play_market_transaction_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_payments_assign_play_market_transaction_gen.go @@ -198,6 +198,10 @@ func (a *PaymentsAssignPlayMarketTransactionRequest) GetPurpose() (value InputSt // Informs server about a purchase made through the Play Store: for official applications // only. // +// Possible errors: +// +// 400 DATA_JSON_INVALID: The provided JSON data is invalid. +// // See https://core.telegram.org/method/payments.assignPlayMarketTransaction for reference. func (c *Client) PaymentsAssignPlayMarketTransaction(ctx context.Context, request *PaymentsAssignPlayMarketTransactionRequest) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_payments_can_purchase_premium_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_can_purchase_premium_gen.go index 5b004892..762808a7 100644 --- a/vendor/github.com/gotd/td/tg/tl_payments_can_purchase_premium_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_payments_can_purchase_premium_gen.go @@ -171,6 +171,10 @@ func (c *PaymentsCanPurchasePremiumRequest) GetPurpose() (value InputStorePaymen // Checks whether Telegram Premium purchase is possible. Must be called before in-store // Premium purchase, official apps only. // +// Possible errors: +// +// 406 PREMIUM_CURRENTLY_UNAVAILABLE: You cannot currently purchase a Premium subscription. +// // See https://core.telegram.org/method/payments.canPurchasePremium for reference. func (c *Client) PaymentsCanPurchasePremium(ctx context.Context, purpose InputStorePaymentPurposeClass) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_payments_change_stars_subscription_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_change_stars_subscription_gen.go new file mode 100644 index 00000000..3a4f20ab --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_change_stars_subscription_gen.go @@ -0,0 +1,272 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// PaymentsChangeStarsSubscriptionRequest represents TL type `payments.changeStarsSubscription#c7770878`. +// +// See https://core.telegram.org/method/payments.changeStarsSubscription for reference. +type PaymentsChangeStarsSubscriptionRequest struct { + // Flags field of PaymentsChangeStarsSubscriptionRequest. + Flags bin.Fields + // Peer field of PaymentsChangeStarsSubscriptionRequest. + Peer InputPeerClass + // SubscriptionID field of PaymentsChangeStarsSubscriptionRequest. + SubscriptionID string + // Canceled field of PaymentsChangeStarsSubscriptionRequest. + // + // Use SetCanceled and GetCanceled helpers. + Canceled bool +} + +// PaymentsChangeStarsSubscriptionRequestTypeID is TL type id of PaymentsChangeStarsSubscriptionRequest. +const PaymentsChangeStarsSubscriptionRequestTypeID = 0xc7770878 + +// Ensuring interfaces in compile-time for PaymentsChangeStarsSubscriptionRequest. +var ( + _ bin.Encoder = &PaymentsChangeStarsSubscriptionRequest{} + _ bin.Decoder = &PaymentsChangeStarsSubscriptionRequest{} + _ bin.BareEncoder = &PaymentsChangeStarsSubscriptionRequest{} + _ bin.BareDecoder = &PaymentsChangeStarsSubscriptionRequest{} +) + +func (c *PaymentsChangeStarsSubscriptionRequest) Zero() bool { + if c == nil { + return true + } + if !(c.Flags.Zero()) { + return false + } + if !(c.Peer == nil) { + return false + } + if !(c.SubscriptionID == "") { + return false + } + if !(c.Canceled == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *PaymentsChangeStarsSubscriptionRequest) String() string { + if c == nil { + return "PaymentsChangeStarsSubscriptionRequest(nil)" + } + type Alias PaymentsChangeStarsSubscriptionRequest + return fmt.Sprintf("PaymentsChangeStarsSubscriptionRequest%+v", Alias(*c)) +} + +// FillFrom fills PaymentsChangeStarsSubscriptionRequest from given interface. +func (c *PaymentsChangeStarsSubscriptionRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) + GetSubscriptionID() (value string) + GetCanceled() (value bool, ok bool) +}) { + c.Peer = from.GetPeer() + c.SubscriptionID = from.GetSubscriptionID() + if val, ok := from.GetCanceled(); ok { + c.Canceled = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsChangeStarsSubscriptionRequest) TypeID() uint32 { + return PaymentsChangeStarsSubscriptionRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsChangeStarsSubscriptionRequest) TypeName() string { + return "payments.changeStarsSubscription" +} + +// TypeInfo returns info about TL type. +func (c *PaymentsChangeStarsSubscriptionRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.changeStarsSubscription", + ID: PaymentsChangeStarsSubscriptionRequestTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "SubscriptionID", + SchemaName: "subscription_id", + }, + { + Name: "Canceled", + SchemaName: "canceled", + Null: !c.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (c *PaymentsChangeStarsSubscriptionRequest) SetFlags() { + if !(c.Canceled == false) { + c.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (c *PaymentsChangeStarsSubscriptionRequest) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode payments.changeStarsSubscription#c7770878 as nil") + } + b.PutID(PaymentsChangeStarsSubscriptionRequestTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *PaymentsChangeStarsSubscriptionRequest) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode payments.changeStarsSubscription#c7770878 as nil") + } + c.SetFlags() + if err := c.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.changeStarsSubscription#c7770878: field flags: %w", err) + } + if c.Peer == nil { + return fmt.Errorf("unable to encode payments.changeStarsSubscription#c7770878: field peer is nil") + } + if err := c.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.changeStarsSubscription#c7770878: field peer: %w", err) + } + b.PutString(c.SubscriptionID) + if c.Flags.Has(0) { + b.PutBool(c.Canceled) + } + return nil +} + +// Decode implements bin.Decoder. +func (c *PaymentsChangeStarsSubscriptionRequest) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode payments.changeStarsSubscription#c7770878 to nil") + } + if err := b.ConsumeID(PaymentsChangeStarsSubscriptionRequestTypeID); err != nil { + return fmt.Errorf("unable to decode payments.changeStarsSubscription#c7770878: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *PaymentsChangeStarsSubscriptionRequest) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode payments.changeStarsSubscription#c7770878 to nil") + } + { + if err := c.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode payments.changeStarsSubscription#c7770878: field flags: %w", err) + } + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode payments.changeStarsSubscription#c7770878: field peer: %w", err) + } + c.Peer = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode payments.changeStarsSubscription#c7770878: field subscription_id: %w", err) + } + c.SubscriptionID = value + } + if c.Flags.Has(0) { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode payments.changeStarsSubscription#c7770878: field canceled: %w", err) + } + c.Canceled = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (c *PaymentsChangeStarsSubscriptionRequest) GetPeer() (value InputPeerClass) { + if c == nil { + return + } + return c.Peer +} + +// GetSubscriptionID returns value of SubscriptionID field. +func (c *PaymentsChangeStarsSubscriptionRequest) GetSubscriptionID() (value string) { + if c == nil { + return + } + return c.SubscriptionID +} + +// SetCanceled sets value of Canceled conditional field. +func (c *PaymentsChangeStarsSubscriptionRequest) SetCanceled(value bool) { + c.Flags.Set(0) + c.Canceled = value +} + +// GetCanceled returns value of Canceled conditional field and +// boolean which is true if field was set. +func (c *PaymentsChangeStarsSubscriptionRequest) GetCanceled() (value bool, ok bool) { + if c == nil { + return + } + if !c.Flags.Has(0) { + return value, false + } + return c.Canceled, true +} + +// PaymentsChangeStarsSubscription invokes method payments.changeStarsSubscription#c7770878 returning error if any. +// +// See https://core.telegram.org/method/payments.changeStarsSubscription for reference. +func (c *Client) PaymentsChangeStarsSubscription(ctx context.Context, request *PaymentsChangeStarsSubscriptionRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_payments_change_stars_subscription_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_change_stars_subscription_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_change_stars_subscription_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_payments_check_gift_code_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_check_gift_code_gen.go index e60e57b0..012f8c99 100644 --- a/vendor/github.com/gotd/td/tg/tl_payments_check_gift_code_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_payments_check_gift_code_gen.go @@ -172,6 +172,7 @@ func (c *PaymentsCheckGiftCodeRequest) GetSlug() (value string) { // // Possible errors: // +// 400 GIFT_SLUG_EXPIRED: The specified gift slug has expired. // 400 GIFT_SLUG_INVALID: The specified slug is invalid. // // See https://core.telegram.org/method/payments.checkGiftCode for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_payments_fulfill_stars_subscription_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_fulfill_stars_subscription_gen.go new file mode 100644 index 00000000..f3ee6717 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_fulfill_stars_subscription_gen.go @@ -0,0 +1,206 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// PaymentsFulfillStarsSubscriptionRequest represents TL type `payments.fulfillStarsSubscription#cc5bebb3`. +// +// See https://core.telegram.org/method/payments.fulfillStarsSubscription for reference. +type PaymentsFulfillStarsSubscriptionRequest struct { + // Peer field of PaymentsFulfillStarsSubscriptionRequest. + Peer InputPeerClass + // SubscriptionID field of PaymentsFulfillStarsSubscriptionRequest. + SubscriptionID string +} + +// PaymentsFulfillStarsSubscriptionRequestTypeID is TL type id of PaymentsFulfillStarsSubscriptionRequest. +const PaymentsFulfillStarsSubscriptionRequestTypeID = 0xcc5bebb3 + +// Ensuring interfaces in compile-time for PaymentsFulfillStarsSubscriptionRequest. +var ( + _ bin.Encoder = &PaymentsFulfillStarsSubscriptionRequest{} + _ bin.Decoder = &PaymentsFulfillStarsSubscriptionRequest{} + _ bin.BareEncoder = &PaymentsFulfillStarsSubscriptionRequest{} + _ bin.BareDecoder = &PaymentsFulfillStarsSubscriptionRequest{} +) + +func (f *PaymentsFulfillStarsSubscriptionRequest) Zero() bool { + if f == nil { + return true + } + if !(f.Peer == nil) { + return false + } + if !(f.SubscriptionID == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (f *PaymentsFulfillStarsSubscriptionRequest) String() string { + if f == nil { + return "PaymentsFulfillStarsSubscriptionRequest(nil)" + } + type Alias PaymentsFulfillStarsSubscriptionRequest + return fmt.Sprintf("PaymentsFulfillStarsSubscriptionRequest%+v", Alias(*f)) +} + +// FillFrom fills PaymentsFulfillStarsSubscriptionRequest from given interface. +func (f *PaymentsFulfillStarsSubscriptionRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) + GetSubscriptionID() (value string) +}) { + f.Peer = from.GetPeer() + f.SubscriptionID = from.GetSubscriptionID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsFulfillStarsSubscriptionRequest) TypeID() uint32 { + return PaymentsFulfillStarsSubscriptionRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsFulfillStarsSubscriptionRequest) TypeName() string { + return "payments.fulfillStarsSubscription" +} + +// TypeInfo returns info about TL type. +func (f *PaymentsFulfillStarsSubscriptionRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.fulfillStarsSubscription", + ID: PaymentsFulfillStarsSubscriptionRequestTypeID, + } + if f == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "SubscriptionID", + SchemaName: "subscription_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (f *PaymentsFulfillStarsSubscriptionRequest) Encode(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't encode payments.fulfillStarsSubscription#cc5bebb3 as nil") + } + b.PutID(PaymentsFulfillStarsSubscriptionRequestTypeID) + return f.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (f *PaymentsFulfillStarsSubscriptionRequest) EncodeBare(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't encode payments.fulfillStarsSubscription#cc5bebb3 as nil") + } + if f.Peer == nil { + return fmt.Errorf("unable to encode payments.fulfillStarsSubscription#cc5bebb3: field peer is nil") + } + if err := f.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.fulfillStarsSubscription#cc5bebb3: field peer: %w", err) + } + b.PutString(f.SubscriptionID) + return nil +} + +// Decode implements bin.Decoder. +func (f *PaymentsFulfillStarsSubscriptionRequest) Decode(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't decode payments.fulfillStarsSubscription#cc5bebb3 to nil") + } + if err := b.ConsumeID(PaymentsFulfillStarsSubscriptionRequestTypeID); err != nil { + return fmt.Errorf("unable to decode payments.fulfillStarsSubscription#cc5bebb3: %w", err) + } + return f.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (f *PaymentsFulfillStarsSubscriptionRequest) DecodeBare(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't decode payments.fulfillStarsSubscription#cc5bebb3 to nil") + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode payments.fulfillStarsSubscription#cc5bebb3: field peer: %w", err) + } + f.Peer = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode payments.fulfillStarsSubscription#cc5bebb3: field subscription_id: %w", err) + } + f.SubscriptionID = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (f *PaymentsFulfillStarsSubscriptionRequest) GetPeer() (value InputPeerClass) { + if f == nil { + return + } + return f.Peer +} + +// GetSubscriptionID returns value of SubscriptionID field. +func (f *PaymentsFulfillStarsSubscriptionRequest) GetSubscriptionID() (value string) { + if f == nil { + return + } + return f.SubscriptionID +} + +// PaymentsFulfillStarsSubscription invokes method payments.fulfillStarsSubscription#cc5bebb3 returning error if any. +// +// See https://core.telegram.org/method/payments.fulfillStarsSubscription for reference. +func (c *Client) PaymentsFulfillStarsSubscription(ctx context.Context, request *PaymentsFulfillStarsSubscriptionRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_payments_fulfill_stars_subscription_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_fulfill_stars_subscription_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_fulfill_stars_subscription_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_payment_form_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_payment_form_gen.go index ba15c001..610dd53b 100644 --- a/vendor/github.com/gotd/td/tg/tl_payments_get_payment_form_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_payment_form_gen.go @@ -246,6 +246,7 @@ func (g *PaymentsGetPaymentFormRequest) GetThemeParams() (value DataJSON, ok boo // // 400 BOOST_PEER_INVALID: The specified boost_peer is invalid. // 400 MESSAGE_ID_INVALID: The provided message id is invalid. +// 400 PEER_ID_INVALID: The provided peer id is invalid. // 400 SLUG_INVALID: The specified invoice slug is invalid. // 400 UNTIL_DATE_INVALID: Invalid until date provided. // diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_gift_options_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_gift_options_gen.go new file mode 100644 index 00000000..eaabf22c --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_gift_options_gen.go @@ -0,0 +1,230 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// PaymentsGetStarsGiftOptionsRequest represents TL type `payments.getStarsGiftOptions#d3c96bc8`. +// Obtain a list of Telegram Stars gift options »¹ as starsGiftOption² constructors. +// +// Links: +// 1. https://core.telegram.org/api/stars#buying-or-gifting-stars +// 2. https://core.telegram.org/constructor/starsGiftOption +// +// See https://core.telegram.org/method/payments.getStarsGiftOptions for reference. +type PaymentsGetStarsGiftOptionsRequest struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // Receiver of the gift (optional). + // + // Use SetUserID and GetUserID helpers. + UserID InputUserClass +} + +// PaymentsGetStarsGiftOptionsRequestTypeID is TL type id of PaymentsGetStarsGiftOptionsRequest. +const PaymentsGetStarsGiftOptionsRequestTypeID = 0xd3c96bc8 + +// Ensuring interfaces in compile-time for PaymentsGetStarsGiftOptionsRequest. +var ( + _ bin.Encoder = &PaymentsGetStarsGiftOptionsRequest{} + _ bin.Decoder = &PaymentsGetStarsGiftOptionsRequest{} + _ bin.BareEncoder = &PaymentsGetStarsGiftOptionsRequest{} + _ bin.BareDecoder = &PaymentsGetStarsGiftOptionsRequest{} +) + +func (g *PaymentsGetStarsGiftOptionsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Flags.Zero()) { + return false + } + if !(g.UserID == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *PaymentsGetStarsGiftOptionsRequest) String() string { + if g == nil { + return "PaymentsGetStarsGiftOptionsRequest(nil)" + } + type Alias PaymentsGetStarsGiftOptionsRequest + return fmt.Sprintf("PaymentsGetStarsGiftOptionsRequest%+v", Alias(*g)) +} + +// FillFrom fills PaymentsGetStarsGiftOptionsRequest from given interface. +func (g *PaymentsGetStarsGiftOptionsRequest) FillFrom(from interface { + GetUserID() (value InputUserClass, ok bool) +}) { + if val, ok := from.GetUserID(); ok { + g.UserID = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsGetStarsGiftOptionsRequest) TypeID() uint32 { + return PaymentsGetStarsGiftOptionsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsGetStarsGiftOptionsRequest) TypeName() string { + return "payments.getStarsGiftOptions" +} + +// TypeInfo returns info about TL type. +func (g *PaymentsGetStarsGiftOptionsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.getStarsGiftOptions", + ID: PaymentsGetStarsGiftOptionsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "UserID", + SchemaName: "user_id", + Null: !g.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (g *PaymentsGetStarsGiftOptionsRequest) SetFlags() { + if !(g.UserID == nil) { + g.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (g *PaymentsGetStarsGiftOptionsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getStarsGiftOptions#d3c96bc8 as nil") + } + b.PutID(PaymentsGetStarsGiftOptionsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *PaymentsGetStarsGiftOptionsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getStarsGiftOptions#d3c96bc8 as nil") + } + g.SetFlags() + if err := g.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.getStarsGiftOptions#d3c96bc8: field flags: %w", err) + } + if g.Flags.Has(0) { + if g.UserID == nil { + return fmt.Errorf("unable to encode payments.getStarsGiftOptions#d3c96bc8: field user_id is nil") + } + if err := g.UserID.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.getStarsGiftOptions#d3c96bc8: field user_id: %w", err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (g *PaymentsGetStarsGiftOptionsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getStarsGiftOptions#d3c96bc8 to nil") + } + if err := b.ConsumeID(PaymentsGetStarsGiftOptionsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode payments.getStarsGiftOptions#d3c96bc8: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *PaymentsGetStarsGiftOptionsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getStarsGiftOptions#d3c96bc8 to nil") + } + { + if err := g.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode payments.getStarsGiftOptions#d3c96bc8: field flags: %w", err) + } + } + if g.Flags.Has(0) { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode payments.getStarsGiftOptions#d3c96bc8: field user_id: %w", err) + } + g.UserID = value + } + return nil +} + +// SetUserID sets value of UserID conditional field. +func (g *PaymentsGetStarsGiftOptionsRequest) SetUserID(value InputUserClass) { + g.Flags.Set(0) + g.UserID = value +} + +// GetUserID returns value of UserID conditional field and +// boolean which is true if field was set. +func (g *PaymentsGetStarsGiftOptionsRequest) GetUserID() (value InputUserClass, ok bool) { + if g == nil { + return + } + if !g.Flags.Has(0) { + return value, false + } + return g.UserID, true +} + +// PaymentsGetStarsGiftOptions invokes method payments.getStarsGiftOptions#d3c96bc8 returning error if any. +// Obtain a list of Telegram Stars gift options »¹ as starsGiftOption² constructors. +// +// Links: +// 1. https://core.telegram.org/api/stars#buying-or-gifting-stars +// 2. https://core.telegram.org/constructor/starsGiftOption +// +// See https://core.telegram.org/method/payments.getStarsGiftOptions for reference. +func (c *Client) PaymentsGetStarsGiftOptions(ctx context.Context, request *PaymentsGetStarsGiftOptionsRequest) ([]StarsGiftOption, error) { + var result StarsGiftOptionVector + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return []StarsGiftOption(result.Elems), nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_gift_options_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_gift_options_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_gift_options_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_giveaway_options_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_giveaway_options_gen.go new file mode 100644 index 00000000..5ca5c85f --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_giveaway_options_gen.go @@ -0,0 +1,141 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// PaymentsGetStarsGiveawayOptionsRequest represents TL type `payments.getStarsGiveawayOptions#bd1efd3e`. +// +// See https://core.telegram.org/method/payments.getStarsGiveawayOptions for reference. +type PaymentsGetStarsGiveawayOptionsRequest struct { +} + +// PaymentsGetStarsGiveawayOptionsRequestTypeID is TL type id of PaymentsGetStarsGiveawayOptionsRequest. +const PaymentsGetStarsGiveawayOptionsRequestTypeID = 0xbd1efd3e + +// Ensuring interfaces in compile-time for PaymentsGetStarsGiveawayOptionsRequest. +var ( + _ bin.Encoder = &PaymentsGetStarsGiveawayOptionsRequest{} + _ bin.Decoder = &PaymentsGetStarsGiveawayOptionsRequest{} + _ bin.BareEncoder = &PaymentsGetStarsGiveawayOptionsRequest{} + _ bin.BareDecoder = &PaymentsGetStarsGiveawayOptionsRequest{} +) + +func (g *PaymentsGetStarsGiveawayOptionsRequest) Zero() bool { + if g == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (g *PaymentsGetStarsGiveawayOptionsRequest) String() string { + if g == nil { + return "PaymentsGetStarsGiveawayOptionsRequest(nil)" + } + type Alias PaymentsGetStarsGiveawayOptionsRequest + return fmt.Sprintf("PaymentsGetStarsGiveawayOptionsRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsGetStarsGiveawayOptionsRequest) TypeID() uint32 { + return PaymentsGetStarsGiveawayOptionsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsGetStarsGiveawayOptionsRequest) TypeName() string { + return "payments.getStarsGiveawayOptions" +} + +// TypeInfo returns info about TL type. +func (g *PaymentsGetStarsGiveawayOptionsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.getStarsGiveawayOptions", + ID: PaymentsGetStarsGiveawayOptionsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (g *PaymentsGetStarsGiveawayOptionsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getStarsGiveawayOptions#bd1efd3e as nil") + } + b.PutID(PaymentsGetStarsGiveawayOptionsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *PaymentsGetStarsGiveawayOptionsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getStarsGiveawayOptions#bd1efd3e as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (g *PaymentsGetStarsGiveawayOptionsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getStarsGiveawayOptions#bd1efd3e to nil") + } + if err := b.ConsumeID(PaymentsGetStarsGiveawayOptionsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode payments.getStarsGiveawayOptions#bd1efd3e: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *PaymentsGetStarsGiveawayOptionsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getStarsGiveawayOptions#bd1efd3e to nil") + } + return nil +} + +// PaymentsGetStarsGiveawayOptions invokes method payments.getStarsGiveawayOptions#bd1efd3e returning error if any. +// +// See https://core.telegram.org/method/payments.getStarsGiveawayOptions for reference. +func (c *Client) PaymentsGetStarsGiveawayOptions(ctx context.Context) ([]StarsGiveawayOption, error) { + var result StarsGiveawayOptionVector + + request := &PaymentsGetStarsGiveawayOptionsRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return []StarsGiveawayOption(result.Elems), nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_giveaway_options_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_giveaway_options_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_giveaway_options_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_ads_account_url_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_ads_account_url_gen.go new file mode 100644 index 00000000..e166cf9c --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_ads_account_url_gen.go @@ -0,0 +1,197 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// PaymentsGetStarsRevenueAdsAccountURLRequest represents TL type `payments.getStarsRevenueAdsAccountUrl#d1d7efc5`. +// Returns a URL for a Telegram Ad platform account that can be used to set up +// advertisements for channel/bot in peer, paid using the Telegram Stars owned by the +// specified peer, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/stars#paying-for-ads +// +// See https://core.telegram.org/method/payments.getStarsRevenueAdsAccountUrl for reference. +type PaymentsGetStarsRevenueAdsAccountURLRequest struct { + // Channel or bot that owns the stars. + Peer InputPeerClass +} + +// PaymentsGetStarsRevenueAdsAccountURLRequestTypeID is TL type id of PaymentsGetStarsRevenueAdsAccountURLRequest. +const PaymentsGetStarsRevenueAdsAccountURLRequestTypeID = 0xd1d7efc5 + +// Ensuring interfaces in compile-time for PaymentsGetStarsRevenueAdsAccountURLRequest. +var ( + _ bin.Encoder = &PaymentsGetStarsRevenueAdsAccountURLRequest{} + _ bin.Decoder = &PaymentsGetStarsRevenueAdsAccountURLRequest{} + _ bin.BareEncoder = &PaymentsGetStarsRevenueAdsAccountURLRequest{} + _ bin.BareDecoder = &PaymentsGetStarsRevenueAdsAccountURLRequest{} +) + +func (g *PaymentsGetStarsRevenueAdsAccountURLRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Peer == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *PaymentsGetStarsRevenueAdsAccountURLRequest) String() string { + if g == nil { + return "PaymentsGetStarsRevenueAdsAccountURLRequest(nil)" + } + type Alias PaymentsGetStarsRevenueAdsAccountURLRequest + return fmt.Sprintf("PaymentsGetStarsRevenueAdsAccountURLRequest%+v", Alias(*g)) +} + +// FillFrom fills PaymentsGetStarsRevenueAdsAccountURLRequest from given interface. +func (g *PaymentsGetStarsRevenueAdsAccountURLRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) +}) { + g.Peer = from.GetPeer() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsGetStarsRevenueAdsAccountURLRequest) TypeID() uint32 { + return PaymentsGetStarsRevenueAdsAccountURLRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsGetStarsRevenueAdsAccountURLRequest) TypeName() string { + return "payments.getStarsRevenueAdsAccountUrl" +} + +// TypeInfo returns info about TL type. +func (g *PaymentsGetStarsRevenueAdsAccountURLRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.getStarsRevenueAdsAccountUrl", + ID: PaymentsGetStarsRevenueAdsAccountURLRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *PaymentsGetStarsRevenueAdsAccountURLRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getStarsRevenueAdsAccountUrl#d1d7efc5 as nil") + } + b.PutID(PaymentsGetStarsRevenueAdsAccountURLRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *PaymentsGetStarsRevenueAdsAccountURLRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getStarsRevenueAdsAccountUrl#d1d7efc5 as nil") + } + if g.Peer == nil { + return fmt.Errorf("unable to encode payments.getStarsRevenueAdsAccountUrl#d1d7efc5: field peer is nil") + } + if err := g.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.getStarsRevenueAdsAccountUrl#d1d7efc5: field peer: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (g *PaymentsGetStarsRevenueAdsAccountURLRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getStarsRevenueAdsAccountUrl#d1d7efc5 to nil") + } + if err := b.ConsumeID(PaymentsGetStarsRevenueAdsAccountURLRequestTypeID); err != nil { + return fmt.Errorf("unable to decode payments.getStarsRevenueAdsAccountUrl#d1d7efc5: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *PaymentsGetStarsRevenueAdsAccountURLRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getStarsRevenueAdsAccountUrl#d1d7efc5 to nil") + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode payments.getStarsRevenueAdsAccountUrl#d1d7efc5: field peer: %w", err) + } + g.Peer = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (g *PaymentsGetStarsRevenueAdsAccountURLRequest) GetPeer() (value InputPeerClass) { + if g == nil { + return + } + return g.Peer +} + +// PaymentsGetStarsRevenueAdsAccountURL invokes method payments.getStarsRevenueAdsAccountUrl#d1d7efc5 returning error if any. +// Returns a URL for a Telegram Ad platform account that can be used to set up +// advertisements for channel/bot in peer, paid using the Telegram Stars owned by the +// specified peer, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/stars#paying-for-ads +// +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// +// See https://core.telegram.org/method/payments.getStarsRevenueAdsAccountUrl for reference. +func (c *Client) PaymentsGetStarsRevenueAdsAccountURL(ctx context.Context, peer InputPeerClass) (*PaymentsStarsRevenueAdsAccountURL, error) { + var result PaymentsStarsRevenueAdsAccountURL + + request := &PaymentsGetStarsRevenueAdsAccountURLRequest{ + Peer: peer, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_ads_account_url_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_ads_account_url_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_ads_account_url_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_stats_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_stats_gen.go new file mode 100644 index 00000000..ff77b1b6 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_stats_gen.go @@ -0,0 +1,249 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// PaymentsGetStarsRevenueStatsRequest represents TL type `payments.getStarsRevenueStats#d91ffad6`. +// Get Telegram Star revenue statistics »¹. +// +// Links: +// 1. https://core.telegram.org/api/stars +// +// See https://core.telegram.org/method/payments.getStarsRevenueStats for reference. +type PaymentsGetStarsRevenueStatsRequest struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // Whether to enable dark theme for graph colors + Dark bool + // Get statistics for the specified bot, channel or ourselves (inputPeerSelf¹). + // + // Links: + // 1) https://core.telegram.org/constructor/inputPeerSelf + Peer InputPeerClass +} + +// PaymentsGetStarsRevenueStatsRequestTypeID is TL type id of PaymentsGetStarsRevenueStatsRequest. +const PaymentsGetStarsRevenueStatsRequestTypeID = 0xd91ffad6 + +// Ensuring interfaces in compile-time for PaymentsGetStarsRevenueStatsRequest. +var ( + _ bin.Encoder = &PaymentsGetStarsRevenueStatsRequest{} + _ bin.Decoder = &PaymentsGetStarsRevenueStatsRequest{} + _ bin.BareEncoder = &PaymentsGetStarsRevenueStatsRequest{} + _ bin.BareDecoder = &PaymentsGetStarsRevenueStatsRequest{} +) + +func (g *PaymentsGetStarsRevenueStatsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Flags.Zero()) { + return false + } + if !(g.Dark == false) { + return false + } + if !(g.Peer == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *PaymentsGetStarsRevenueStatsRequest) String() string { + if g == nil { + return "PaymentsGetStarsRevenueStatsRequest(nil)" + } + type Alias PaymentsGetStarsRevenueStatsRequest + return fmt.Sprintf("PaymentsGetStarsRevenueStatsRequest%+v", Alias(*g)) +} + +// FillFrom fills PaymentsGetStarsRevenueStatsRequest from given interface. +func (g *PaymentsGetStarsRevenueStatsRequest) FillFrom(from interface { + GetDark() (value bool) + GetPeer() (value InputPeerClass) +}) { + g.Dark = from.GetDark() + g.Peer = from.GetPeer() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsGetStarsRevenueStatsRequest) TypeID() uint32 { + return PaymentsGetStarsRevenueStatsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsGetStarsRevenueStatsRequest) TypeName() string { + return "payments.getStarsRevenueStats" +} + +// TypeInfo returns info about TL type. +func (g *PaymentsGetStarsRevenueStatsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.getStarsRevenueStats", + ID: PaymentsGetStarsRevenueStatsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Dark", + SchemaName: "dark", + Null: !g.Flags.Has(0), + }, + { + Name: "Peer", + SchemaName: "peer", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (g *PaymentsGetStarsRevenueStatsRequest) SetFlags() { + if !(g.Dark == false) { + g.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (g *PaymentsGetStarsRevenueStatsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getStarsRevenueStats#d91ffad6 as nil") + } + b.PutID(PaymentsGetStarsRevenueStatsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *PaymentsGetStarsRevenueStatsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getStarsRevenueStats#d91ffad6 as nil") + } + g.SetFlags() + if err := g.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.getStarsRevenueStats#d91ffad6: field flags: %w", err) + } + if g.Peer == nil { + return fmt.Errorf("unable to encode payments.getStarsRevenueStats#d91ffad6: field peer is nil") + } + if err := g.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.getStarsRevenueStats#d91ffad6: field peer: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (g *PaymentsGetStarsRevenueStatsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getStarsRevenueStats#d91ffad6 to nil") + } + if err := b.ConsumeID(PaymentsGetStarsRevenueStatsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode payments.getStarsRevenueStats#d91ffad6: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *PaymentsGetStarsRevenueStatsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getStarsRevenueStats#d91ffad6 to nil") + } + { + if err := g.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode payments.getStarsRevenueStats#d91ffad6: field flags: %w", err) + } + } + g.Dark = g.Flags.Has(0) + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode payments.getStarsRevenueStats#d91ffad6: field peer: %w", err) + } + g.Peer = value + } + return nil +} + +// SetDark sets value of Dark conditional field. +func (g *PaymentsGetStarsRevenueStatsRequest) SetDark(value bool) { + if value { + g.Flags.Set(0) + g.Dark = true + } else { + g.Flags.Unset(0) + g.Dark = false + } +} + +// GetDark returns value of Dark conditional field. +func (g *PaymentsGetStarsRevenueStatsRequest) GetDark() (value bool) { + if g == nil { + return + } + return g.Flags.Has(0) +} + +// GetPeer returns value of Peer field. +func (g *PaymentsGetStarsRevenueStatsRequest) GetPeer() (value InputPeerClass) { + if g == nil { + return + } + return g.Peer +} + +// PaymentsGetStarsRevenueStats invokes method payments.getStarsRevenueStats#d91ffad6 returning error if any. +// Get Telegram Star revenue statistics »¹. +// +// Links: +// 1. https://core.telegram.org/api/stars +// +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// +// See https://core.telegram.org/method/payments.getStarsRevenueStats for reference. +func (c *Client) PaymentsGetStarsRevenueStats(ctx context.Context, request *PaymentsGetStarsRevenueStatsRequest) (*PaymentsStarsRevenueStats, error) { + var result PaymentsStarsRevenueStats + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_stats_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_stats_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_stats_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_withdrawal_url_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_withdrawal_url_gen.go new file mode 100644 index 00000000..e994d32a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_withdrawal_url_gen.go @@ -0,0 +1,259 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// PaymentsGetStarsRevenueWithdrawalURLRequest represents TL type `payments.getStarsRevenueWithdrawalUrl#13bbe8b3`. +// Withdraw funds from a channel or bot's star balance »¹. +// +// Links: +// 1. https://core.telegram.org/api/stars#withdrawing-revenue +// +// See https://core.telegram.org/method/payments.getStarsRevenueWithdrawalUrl for reference. +type PaymentsGetStarsRevenueWithdrawalURLRequest struct { + // Channel or bot from which to withdraw funds. + Peer InputPeerClass + // Amount of stars to withdraw. + Stars int64 + // 2FA password, see here »¹ for more info. + // + // Links: + // 1) https://core.telegram.org/api/srp#using-the-2fa-password + Password InputCheckPasswordSRPClass +} + +// PaymentsGetStarsRevenueWithdrawalURLRequestTypeID is TL type id of PaymentsGetStarsRevenueWithdrawalURLRequest. +const PaymentsGetStarsRevenueWithdrawalURLRequestTypeID = 0x13bbe8b3 + +// Ensuring interfaces in compile-time for PaymentsGetStarsRevenueWithdrawalURLRequest. +var ( + _ bin.Encoder = &PaymentsGetStarsRevenueWithdrawalURLRequest{} + _ bin.Decoder = &PaymentsGetStarsRevenueWithdrawalURLRequest{} + _ bin.BareEncoder = &PaymentsGetStarsRevenueWithdrawalURLRequest{} + _ bin.BareDecoder = &PaymentsGetStarsRevenueWithdrawalURLRequest{} +) + +func (g *PaymentsGetStarsRevenueWithdrawalURLRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Peer == nil) { + return false + } + if !(g.Stars == 0) { + return false + } + if !(g.Password == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *PaymentsGetStarsRevenueWithdrawalURLRequest) String() string { + if g == nil { + return "PaymentsGetStarsRevenueWithdrawalURLRequest(nil)" + } + type Alias PaymentsGetStarsRevenueWithdrawalURLRequest + return fmt.Sprintf("PaymentsGetStarsRevenueWithdrawalURLRequest%+v", Alias(*g)) +} + +// FillFrom fills PaymentsGetStarsRevenueWithdrawalURLRequest from given interface. +func (g *PaymentsGetStarsRevenueWithdrawalURLRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) + GetStars() (value int64) + GetPassword() (value InputCheckPasswordSRPClass) +}) { + g.Peer = from.GetPeer() + g.Stars = from.GetStars() + g.Password = from.GetPassword() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsGetStarsRevenueWithdrawalURLRequest) TypeID() uint32 { + return PaymentsGetStarsRevenueWithdrawalURLRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsGetStarsRevenueWithdrawalURLRequest) TypeName() string { + return "payments.getStarsRevenueWithdrawalUrl" +} + +// TypeInfo returns info about TL type. +func (g *PaymentsGetStarsRevenueWithdrawalURLRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.getStarsRevenueWithdrawalUrl", + ID: PaymentsGetStarsRevenueWithdrawalURLRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "Stars", + SchemaName: "stars", + }, + { + Name: "Password", + SchemaName: "password", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *PaymentsGetStarsRevenueWithdrawalURLRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getStarsRevenueWithdrawalUrl#13bbe8b3 as nil") + } + b.PutID(PaymentsGetStarsRevenueWithdrawalURLRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *PaymentsGetStarsRevenueWithdrawalURLRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getStarsRevenueWithdrawalUrl#13bbe8b3 as nil") + } + if g.Peer == nil { + return fmt.Errorf("unable to encode payments.getStarsRevenueWithdrawalUrl#13bbe8b3: field peer is nil") + } + if err := g.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.getStarsRevenueWithdrawalUrl#13bbe8b3: field peer: %w", err) + } + b.PutLong(g.Stars) + if g.Password == nil { + return fmt.Errorf("unable to encode payments.getStarsRevenueWithdrawalUrl#13bbe8b3: field password is nil") + } + if err := g.Password.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.getStarsRevenueWithdrawalUrl#13bbe8b3: field password: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (g *PaymentsGetStarsRevenueWithdrawalURLRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getStarsRevenueWithdrawalUrl#13bbe8b3 to nil") + } + if err := b.ConsumeID(PaymentsGetStarsRevenueWithdrawalURLRequestTypeID); err != nil { + return fmt.Errorf("unable to decode payments.getStarsRevenueWithdrawalUrl#13bbe8b3: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *PaymentsGetStarsRevenueWithdrawalURLRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getStarsRevenueWithdrawalUrl#13bbe8b3 to nil") + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode payments.getStarsRevenueWithdrawalUrl#13bbe8b3: field peer: %w", err) + } + g.Peer = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode payments.getStarsRevenueWithdrawalUrl#13bbe8b3: field stars: %w", err) + } + g.Stars = value + } + { + value, err := DecodeInputCheckPasswordSRP(b) + if err != nil { + return fmt.Errorf("unable to decode payments.getStarsRevenueWithdrawalUrl#13bbe8b3: field password: %w", err) + } + g.Password = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (g *PaymentsGetStarsRevenueWithdrawalURLRequest) GetPeer() (value InputPeerClass) { + if g == nil { + return + } + return g.Peer +} + +// GetStars returns value of Stars field. +func (g *PaymentsGetStarsRevenueWithdrawalURLRequest) GetStars() (value int64) { + if g == nil { + return + } + return g.Stars +} + +// GetPassword returns value of Password field. +func (g *PaymentsGetStarsRevenueWithdrawalURLRequest) GetPassword() (value InputCheckPasswordSRPClass) { + if g == nil { + return + } + return g.Password +} + +// GetPasswordAsNotEmpty returns mapped value of Password field. +func (g *PaymentsGetStarsRevenueWithdrawalURLRequest) GetPasswordAsNotEmpty() (*InputCheckPasswordSRP, bool) { + return g.Password.AsNotEmpty() +} + +// PaymentsGetStarsRevenueWithdrawalURL invokes method payments.getStarsRevenueWithdrawalUrl#13bbe8b3 returning error if any. +// Withdraw funds from a channel or bot's star balance »¹. +// +// Links: +// 1. https://core.telegram.org/api/stars#withdrawing-revenue +// +// Possible errors: +// +// 400 PASSWORD_HASH_INVALID: The provided password hash is invalid. +// 400 PASSWORD_MISSING: You must enable 2FA before executing this operation. +// 400 PASSWORD_TOO_FRESH_%d: The password was modified less than 24 hours ago, try again in %d seconds. +// +// See https://core.telegram.org/method/payments.getStarsRevenueWithdrawalUrl for reference. +func (c *Client) PaymentsGetStarsRevenueWithdrawalURL(ctx context.Context, request *PaymentsGetStarsRevenueWithdrawalURLRequest) (*PaymentsStarsRevenueWithdrawalURL, error) { + var result PaymentsStarsRevenueWithdrawalURL + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_withdrawal_url_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_withdrawal_url_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_revenue_withdrawal_url_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_status_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_status_gen.go index 5fb99967..a4f19014 100644 --- a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_status_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_status_gen.go @@ -32,10 +32,16 @@ var ( ) // PaymentsGetStarsStatusRequest represents TL type `payments.getStarsStatus#104fcfa7`. +// Get the current Telegram Stars balance¹ of the current account (with +// peer=inputPeerSelf²), or the stars balance of the bot specified in peer. +// +// Links: +// 1. https://core.telegram.org/api/stars +// 2. https://core.telegram.org/constructor/inputPeerSelf // // See https://core.telegram.org/method/payments.getStarsStatus for reference. type PaymentsGetStarsStatusRequest struct { - // Peer field of PaymentsGetStarsStatusRequest. + // Peer of which to get the balance. Peer InputPeerClass } @@ -166,6 +172,16 @@ func (g *PaymentsGetStarsStatusRequest) GetPeer() (value InputPeerClass) { } // PaymentsGetStarsStatus invokes method payments.getStarsStatus#104fcfa7 returning error if any. +// Get the current Telegram Stars balance¹ of the current account (with +// peer=inputPeerSelf²), or the stars balance of the bot specified in peer. +// +// Links: +// 1. https://core.telegram.org/api/stars +// 2. https://core.telegram.org/constructor/inputPeerSelf +// +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/payments.getStarsStatus for reference. func (c *Client) PaymentsGetStarsStatus(ctx context.Context, peer InputPeerClass) (*PaymentsStarsStatus, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_subscriptions_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_subscriptions_gen.go new file mode 100644 index 00000000..9462c932 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_subscriptions_gen.go @@ -0,0 +1,258 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// PaymentsGetStarsSubscriptionsRequest represents TL type `payments.getStarsSubscriptions#32512c5`. +// +// See https://core.telegram.org/method/payments.getStarsSubscriptions for reference. +type PaymentsGetStarsSubscriptionsRequest struct { + // Flags field of PaymentsGetStarsSubscriptionsRequest. + Flags bin.Fields + // MissingBalance field of PaymentsGetStarsSubscriptionsRequest. + MissingBalance bool + // Peer field of PaymentsGetStarsSubscriptionsRequest. + Peer InputPeerClass + // Offset field of PaymentsGetStarsSubscriptionsRequest. + Offset string +} + +// PaymentsGetStarsSubscriptionsRequestTypeID is TL type id of PaymentsGetStarsSubscriptionsRequest. +const PaymentsGetStarsSubscriptionsRequestTypeID = 0x32512c5 + +// Ensuring interfaces in compile-time for PaymentsGetStarsSubscriptionsRequest. +var ( + _ bin.Encoder = &PaymentsGetStarsSubscriptionsRequest{} + _ bin.Decoder = &PaymentsGetStarsSubscriptionsRequest{} + _ bin.BareEncoder = &PaymentsGetStarsSubscriptionsRequest{} + _ bin.BareDecoder = &PaymentsGetStarsSubscriptionsRequest{} +) + +func (g *PaymentsGetStarsSubscriptionsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Flags.Zero()) { + return false + } + if !(g.MissingBalance == false) { + return false + } + if !(g.Peer == nil) { + return false + } + if !(g.Offset == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *PaymentsGetStarsSubscriptionsRequest) String() string { + if g == nil { + return "PaymentsGetStarsSubscriptionsRequest(nil)" + } + type Alias PaymentsGetStarsSubscriptionsRequest + return fmt.Sprintf("PaymentsGetStarsSubscriptionsRequest%+v", Alias(*g)) +} + +// FillFrom fills PaymentsGetStarsSubscriptionsRequest from given interface. +func (g *PaymentsGetStarsSubscriptionsRequest) FillFrom(from interface { + GetMissingBalance() (value bool) + GetPeer() (value InputPeerClass) + GetOffset() (value string) +}) { + g.MissingBalance = from.GetMissingBalance() + g.Peer = from.GetPeer() + g.Offset = from.GetOffset() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsGetStarsSubscriptionsRequest) TypeID() uint32 { + return PaymentsGetStarsSubscriptionsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsGetStarsSubscriptionsRequest) TypeName() string { + return "payments.getStarsSubscriptions" +} + +// TypeInfo returns info about TL type. +func (g *PaymentsGetStarsSubscriptionsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.getStarsSubscriptions", + ID: PaymentsGetStarsSubscriptionsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "MissingBalance", + SchemaName: "missing_balance", + Null: !g.Flags.Has(0), + }, + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "Offset", + SchemaName: "offset", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (g *PaymentsGetStarsSubscriptionsRequest) SetFlags() { + if !(g.MissingBalance == false) { + g.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (g *PaymentsGetStarsSubscriptionsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getStarsSubscriptions#32512c5 as nil") + } + b.PutID(PaymentsGetStarsSubscriptionsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *PaymentsGetStarsSubscriptionsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getStarsSubscriptions#32512c5 as nil") + } + g.SetFlags() + if err := g.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.getStarsSubscriptions#32512c5: field flags: %w", err) + } + if g.Peer == nil { + return fmt.Errorf("unable to encode payments.getStarsSubscriptions#32512c5: field peer is nil") + } + if err := g.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.getStarsSubscriptions#32512c5: field peer: %w", err) + } + b.PutString(g.Offset) + return nil +} + +// Decode implements bin.Decoder. +func (g *PaymentsGetStarsSubscriptionsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getStarsSubscriptions#32512c5 to nil") + } + if err := b.ConsumeID(PaymentsGetStarsSubscriptionsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode payments.getStarsSubscriptions#32512c5: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *PaymentsGetStarsSubscriptionsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getStarsSubscriptions#32512c5 to nil") + } + { + if err := g.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode payments.getStarsSubscriptions#32512c5: field flags: %w", err) + } + } + g.MissingBalance = g.Flags.Has(0) + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode payments.getStarsSubscriptions#32512c5: field peer: %w", err) + } + g.Peer = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode payments.getStarsSubscriptions#32512c5: field offset: %w", err) + } + g.Offset = value + } + return nil +} + +// SetMissingBalance sets value of MissingBalance conditional field. +func (g *PaymentsGetStarsSubscriptionsRequest) SetMissingBalance(value bool) { + if value { + g.Flags.Set(0) + g.MissingBalance = true + } else { + g.Flags.Unset(0) + g.MissingBalance = false + } +} + +// GetMissingBalance returns value of MissingBalance conditional field. +func (g *PaymentsGetStarsSubscriptionsRequest) GetMissingBalance() (value bool) { + if g == nil { + return + } + return g.Flags.Has(0) +} + +// GetPeer returns value of Peer field. +func (g *PaymentsGetStarsSubscriptionsRequest) GetPeer() (value InputPeerClass) { + if g == nil { + return + } + return g.Peer +} + +// GetOffset returns value of Offset field. +func (g *PaymentsGetStarsSubscriptionsRequest) GetOffset() (value string) { + if g == nil { + return + } + return g.Offset +} + +// PaymentsGetStarsSubscriptions invokes method payments.getStarsSubscriptions#32512c5 returning error if any. +// +// See https://core.telegram.org/method/payments.getStarsSubscriptions for reference. +func (c *Client) PaymentsGetStarsSubscriptions(ctx context.Context, request *PaymentsGetStarsSubscriptionsRequest) (*PaymentsStarsStatus, error) { + var result PaymentsStarsStatus + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_subscriptions_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_subscriptions_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_subscriptions_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_topup_options_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_topup_options_gen.go index bb6f7828..2cd810a8 100644 --- a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_topup_options_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_topup_options_gen.go @@ -32,6 +32,11 @@ var ( ) // PaymentsGetStarsTopupOptionsRequest represents TL type `payments.getStarsTopupOptions#c00ec7d3`. +// Obtain a list of Telegram Stars topup options »¹ as starsTopupOption² constructors. +// +// Links: +// 1. https://core.telegram.org/api/stars#buying-or-gifting-stars +// 2. https://core.telegram.org/constructor/starsTopupOption // // See https://core.telegram.org/method/payments.getStarsTopupOptions for reference. type PaymentsGetStarsTopupOptionsRequest struct { @@ -128,6 +133,11 @@ func (g *PaymentsGetStarsTopupOptionsRequest) DecodeBare(b *bin.Buffer) error { } // PaymentsGetStarsTopupOptions invokes method payments.getStarsTopupOptions#c00ec7d3 returning error if any. +// Obtain a list of Telegram Stars topup options »¹ as starsTopupOption² constructors. +// +// Links: +// 1. https://core.telegram.org/api/stars#buying-or-gifting-stars +// 2. https://core.telegram.org/constructor/starsTopupOption // // See https://core.telegram.org/method/payments.getStarsTopupOptions for reference. func (c *Client) PaymentsGetStarsTopupOptions(ctx context.Context) ([]StarsTopupOption, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_transactions_by_id_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_transactions_by_id_gen.go new file mode 100644 index 00000000..c6e3e5b1 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_transactions_by_id_gen.go @@ -0,0 +1,232 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// PaymentsGetStarsTransactionsByIDRequest represents TL type `payments.getStarsTransactionsByID#27842d2e`. +// Obtain info about Telegram Star transactions »¹ using specific transaction IDs. +// +// Links: +// 1. https://core.telegram.org/api/stars#balance-and-transaction-history +// +// See https://core.telegram.org/method/payments.getStarsTransactionsByID for reference. +type PaymentsGetStarsTransactionsByIDRequest struct { + // Channel or bot. + Peer InputPeerClass + // Transaction IDs. + ID []InputStarsTransaction +} + +// PaymentsGetStarsTransactionsByIDRequestTypeID is TL type id of PaymentsGetStarsTransactionsByIDRequest. +const PaymentsGetStarsTransactionsByIDRequestTypeID = 0x27842d2e + +// Ensuring interfaces in compile-time for PaymentsGetStarsTransactionsByIDRequest. +var ( + _ bin.Encoder = &PaymentsGetStarsTransactionsByIDRequest{} + _ bin.Decoder = &PaymentsGetStarsTransactionsByIDRequest{} + _ bin.BareEncoder = &PaymentsGetStarsTransactionsByIDRequest{} + _ bin.BareDecoder = &PaymentsGetStarsTransactionsByIDRequest{} +) + +func (g *PaymentsGetStarsTransactionsByIDRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Peer == nil) { + return false + } + if !(g.ID == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *PaymentsGetStarsTransactionsByIDRequest) String() string { + if g == nil { + return "PaymentsGetStarsTransactionsByIDRequest(nil)" + } + type Alias PaymentsGetStarsTransactionsByIDRequest + return fmt.Sprintf("PaymentsGetStarsTransactionsByIDRequest%+v", Alias(*g)) +} + +// FillFrom fills PaymentsGetStarsTransactionsByIDRequest from given interface. +func (g *PaymentsGetStarsTransactionsByIDRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) + GetID() (value []InputStarsTransaction) +}) { + g.Peer = from.GetPeer() + g.ID = from.GetID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsGetStarsTransactionsByIDRequest) TypeID() uint32 { + return PaymentsGetStarsTransactionsByIDRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsGetStarsTransactionsByIDRequest) TypeName() string { + return "payments.getStarsTransactionsByID" +} + +// TypeInfo returns info about TL type. +func (g *PaymentsGetStarsTransactionsByIDRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.getStarsTransactionsByID", + ID: PaymentsGetStarsTransactionsByIDRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "ID", + SchemaName: "id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *PaymentsGetStarsTransactionsByIDRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getStarsTransactionsByID#27842d2e as nil") + } + b.PutID(PaymentsGetStarsTransactionsByIDRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *PaymentsGetStarsTransactionsByIDRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getStarsTransactionsByID#27842d2e as nil") + } + if g.Peer == nil { + return fmt.Errorf("unable to encode payments.getStarsTransactionsByID#27842d2e: field peer is nil") + } + if err := g.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.getStarsTransactionsByID#27842d2e: field peer: %w", err) + } + b.PutVectorHeader(len(g.ID)) + for idx, v := range g.ID { + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.getStarsTransactionsByID#27842d2e: field id element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (g *PaymentsGetStarsTransactionsByIDRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getStarsTransactionsByID#27842d2e to nil") + } + if err := b.ConsumeID(PaymentsGetStarsTransactionsByIDRequestTypeID); err != nil { + return fmt.Errorf("unable to decode payments.getStarsTransactionsByID#27842d2e: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *PaymentsGetStarsTransactionsByIDRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getStarsTransactionsByID#27842d2e to nil") + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode payments.getStarsTransactionsByID#27842d2e: field peer: %w", err) + } + g.Peer = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode payments.getStarsTransactionsByID#27842d2e: field id: %w", err) + } + + if headerLen > 0 { + g.ID = make([]InputStarsTransaction, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value InputStarsTransaction + if err := value.Decode(b); err != nil { + return fmt.Errorf("unable to decode payments.getStarsTransactionsByID#27842d2e: field id: %w", err) + } + g.ID = append(g.ID, value) + } + } + return nil +} + +// GetPeer returns value of Peer field. +func (g *PaymentsGetStarsTransactionsByIDRequest) GetPeer() (value InputPeerClass) { + if g == nil { + return + } + return g.Peer +} + +// GetID returns value of ID field. +func (g *PaymentsGetStarsTransactionsByIDRequest) GetID() (value []InputStarsTransaction) { + if g == nil { + return + } + return g.ID +} + +// PaymentsGetStarsTransactionsByID invokes method payments.getStarsTransactionsByID#27842d2e returning error if any. +// Obtain info about Telegram Star transactions »¹ using specific transaction IDs. +// +// Links: +// 1. https://core.telegram.org/api/stars#balance-and-transaction-history +// +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// +// See https://core.telegram.org/method/payments.getStarsTransactionsByID for reference. +func (c *Client) PaymentsGetStarsTransactionsByID(ctx context.Context, request *PaymentsGetStarsTransactionsByIDRequest) (*PaymentsStarsStatus, error) { + var result PaymentsStarsStatus + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_transactions_by_id_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_transactions_by_id_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_transactions_by_id_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_transactions_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_transactions_gen.go index 4a66d174..d9d96d52 100644 --- a/vendor/github.com/gotd/td/tg/tl_payments_get_stars_transactions_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_payments_get_stars_transactions_gen.go @@ -31,24 +31,51 @@ var ( _ = tdjson.Encoder{} ) -// PaymentsGetStarsTransactionsRequest represents TL type `payments.getStarsTransactions#673ac2f9`. +// PaymentsGetStarsTransactionsRequest represents TL type `payments.getStarsTransactions#69da4557`. +// Fetch Telegram Stars transactions¹. +// The inbound and outbound flags are mutually exclusive: if none of the two are set, +// both incoming and outgoing transactions are fetched. +// +// Links: +// 1. https://core.telegram.org/api/stars#balance-and-transaction-history // // See https://core.telegram.org/method/payments.getStarsTransactions for reference. type PaymentsGetStarsTransactionsRequest struct { - // Flags field of PaymentsGetStarsTransactionsRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Inbound field of PaymentsGetStarsTransactionsRequest. + // If set, fetches only incoming transactions. Inbound bool - // Outbound field of PaymentsGetStarsTransactionsRequest. + // If set, fetches only outgoing transactions. Outbound bool - // Peer field of PaymentsGetStarsTransactionsRequest. + // Return transactions in ascending order by date (instead of descending order by date). + Ascending bool + // SubscriptionID field of PaymentsGetStarsTransactionsRequest. + // + // Use SetSubscriptionID and GetSubscriptionID helpers. + SubscriptionID string + // Fetch the transaction history of the peer (inputPeerSelf¹ or a bot we own). + // + // Links: + // 1) https://core.telegram.org/constructor/inputPeerSelf Peer InputPeerClass - // Offset field of PaymentsGetStarsTransactionsRequest. + // Offset for pagination, obtained from the returned next_offset, initially an empty + // string »¹. + // + // Links: + // 1) https://core.telegram.org/api/offsets Offset string + // Maximum number of results to return, see pagination¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets + Limit int } // PaymentsGetStarsTransactionsRequestTypeID is TL type id of PaymentsGetStarsTransactionsRequest. -const PaymentsGetStarsTransactionsRequestTypeID = 0x673ac2f9 +const PaymentsGetStarsTransactionsRequestTypeID = 0x69da4557 // Ensuring interfaces in compile-time for PaymentsGetStarsTransactionsRequest. var ( @@ -71,12 +98,21 @@ func (g *PaymentsGetStarsTransactionsRequest) Zero() bool { if !(g.Outbound == false) { return false } + if !(g.Ascending == false) { + return false + } + if !(g.SubscriptionID == "") { + return false + } if !(g.Peer == nil) { return false } if !(g.Offset == "") { return false } + if !(g.Limit == 0) { + return false + } return true } @@ -94,13 +130,22 @@ func (g *PaymentsGetStarsTransactionsRequest) String() string { func (g *PaymentsGetStarsTransactionsRequest) FillFrom(from interface { GetInbound() (value bool) GetOutbound() (value bool) + GetAscending() (value bool) + GetSubscriptionID() (value string, ok bool) GetPeer() (value InputPeerClass) GetOffset() (value string) + GetLimit() (value int) }) { g.Inbound = from.GetInbound() g.Outbound = from.GetOutbound() + g.Ascending = from.GetAscending() + if val, ok := from.GetSubscriptionID(); ok { + g.SubscriptionID = val + } + g.Peer = from.GetPeer() g.Offset = from.GetOffset() + g.Limit = from.GetLimit() } // TypeID returns type id in TL schema. @@ -136,6 +181,16 @@ func (g *PaymentsGetStarsTransactionsRequest) TypeInfo() tdp.Type { SchemaName: "outbound", Null: !g.Flags.Has(1), }, + { + Name: "Ascending", + SchemaName: "ascending", + Null: !g.Flags.Has(2), + }, + { + Name: "SubscriptionID", + SchemaName: "subscription_id", + Null: !g.Flags.Has(3), + }, { Name: "Peer", SchemaName: "peer", @@ -144,6 +199,10 @@ func (g *PaymentsGetStarsTransactionsRequest) TypeInfo() tdp.Type { Name: "Offset", SchemaName: "offset", }, + { + Name: "Limit", + SchemaName: "limit", + }, } return typ } @@ -156,12 +215,18 @@ func (g *PaymentsGetStarsTransactionsRequest) SetFlags() { if !(g.Outbound == false) { g.Flags.Set(1) } + if !(g.Ascending == false) { + g.Flags.Set(2) + } + if !(g.SubscriptionID == "") { + g.Flags.Set(3) + } } // Encode implements bin.Encoder. func (g *PaymentsGetStarsTransactionsRequest) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode payments.getStarsTransactions#673ac2f9 as nil") + return fmt.Errorf("can't encode payments.getStarsTransactions#69da4557 as nil") } b.PutID(PaymentsGetStarsTransactionsRequestTypeID) return g.EncodeBare(b) @@ -170,29 +235,33 @@ func (g *PaymentsGetStarsTransactionsRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (g *PaymentsGetStarsTransactionsRequest) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode payments.getStarsTransactions#673ac2f9 as nil") + return fmt.Errorf("can't encode payments.getStarsTransactions#69da4557 as nil") } g.SetFlags() if err := g.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode payments.getStarsTransactions#673ac2f9: field flags: %w", err) + return fmt.Errorf("unable to encode payments.getStarsTransactions#69da4557: field flags: %w", err) + } + if g.Flags.Has(3) { + b.PutString(g.SubscriptionID) } if g.Peer == nil { - return fmt.Errorf("unable to encode payments.getStarsTransactions#673ac2f9: field peer is nil") + return fmt.Errorf("unable to encode payments.getStarsTransactions#69da4557: field peer is nil") } if err := g.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode payments.getStarsTransactions#673ac2f9: field peer: %w", err) + return fmt.Errorf("unable to encode payments.getStarsTransactions#69da4557: field peer: %w", err) } b.PutString(g.Offset) + b.PutInt(g.Limit) return nil } // Decode implements bin.Decoder. func (g *PaymentsGetStarsTransactionsRequest) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode payments.getStarsTransactions#673ac2f9 to nil") + return fmt.Errorf("can't decode payments.getStarsTransactions#69da4557 to nil") } if err := b.ConsumeID(PaymentsGetStarsTransactionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode payments.getStarsTransactions#673ac2f9: %w", err) + return fmt.Errorf("unable to decode payments.getStarsTransactions#69da4557: %w", err) } return g.DecodeBare(b) } @@ -200,29 +269,44 @@ func (g *PaymentsGetStarsTransactionsRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (g *PaymentsGetStarsTransactionsRequest) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode payments.getStarsTransactions#673ac2f9 to nil") + return fmt.Errorf("can't decode payments.getStarsTransactions#69da4557 to nil") } { if err := g.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode payments.getStarsTransactions#673ac2f9: field flags: %w", err) + return fmt.Errorf("unable to decode payments.getStarsTransactions#69da4557: field flags: %w", err) } } g.Inbound = g.Flags.Has(0) g.Outbound = g.Flags.Has(1) + g.Ascending = g.Flags.Has(2) + if g.Flags.Has(3) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode payments.getStarsTransactions#69da4557: field subscription_id: %w", err) + } + g.SubscriptionID = value + } { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode payments.getStarsTransactions#673ac2f9: field peer: %w", err) + return fmt.Errorf("unable to decode payments.getStarsTransactions#69da4557: field peer: %w", err) } g.Peer = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode payments.getStarsTransactions#673ac2f9: field offset: %w", err) + return fmt.Errorf("unable to decode payments.getStarsTransactions#69da4557: field offset: %w", err) } g.Offset = value } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode payments.getStarsTransactions#69da4557: field limit: %w", err) + } + g.Limit = value + } return nil } @@ -264,6 +348,43 @@ func (g *PaymentsGetStarsTransactionsRequest) GetOutbound() (value bool) { return g.Flags.Has(1) } +// SetAscending sets value of Ascending conditional field. +func (g *PaymentsGetStarsTransactionsRequest) SetAscending(value bool) { + if value { + g.Flags.Set(2) + g.Ascending = true + } else { + g.Flags.Unset(2) + g.Ascending = false + } +} + +// GetAscending returns value of Ascending conditional field. +func (g *PaymentsGetStarsTransactionsRequest) GetAscending() (value bool) { + if g == nil { + return + } + return g.Flags.Has(2) +} + +// SetSubscriptionID sets value of SubscriptionID conditional field. +func (g *PaymentsGetStarsTransactionsRequest) SetSubscriptionID(value string) { + g.Flags.Set(3) + g.SubscriptionID = value +} + +// GetSubscriptionID returns value of SubscriptionID conditional field and +// boolean which is true if field was set. +func (g *PaymentsGetStarsTransactionsRequest) GetSubscriptionID() (value string, ok bool) { + if g == nil { + return + } + if !g.Flags.Has(3) { + return value, false + } + return g.SubscriptionID, true +} + // GetPeer returns value of Peer field. func (g *PaymentsGetStarsTransactionsRequest) GetPeer() (value InputPeerClass) { if g == nil { @@ -280,9 +401,29 @@ func (g *PaymentsGetStarsTransactionsRequest) GetOffset() (value string) { return g.Offset } -// PaymentsGetStarsTransactions invokes method payments.getStarsTransactions#673ac2f9 returning error if any. +// GetLimit returns value of Limit field. +func (g *PaymentsGetStarsTransactionsRequest) GetLimit() (value int) { + if g == nil { + return + } + return g.Limit +} + +// PaymentsGetStarsTransactions invokes method payments.getStarsTransactions#69da4557 returning error if any. +// Fetch Telegram Stars transactions¹. +// The inbound and outbound flags are mutually exclusive: if none of the two are set, +// both incoming and outgoing transactions are fetched. +// +// Links: +// 1. https://core.telegram.org/api/stars#balance-and-transaction-history +// +// Possible errors: +// +// 400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. +// 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/payments.getStarsTransactions for reference. +// Can be used by bots. func (c *Client) PaymentsGetStarsTransactions(ctx context.Context, request *PaymentsGetStarsTransactionsRequest) (*PaymentsStarsStatus, error) { var result PaymentsStarsStatus diff --git a/vendor/github.com/gotd/td/tg/tl_payments_giveaway_info_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_giveaway_info_gen.go index b5ba7454..3b226c76 100644 --- a/vendor/github.com/gotd/td/tg/tl_payments_giveaway_info_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_payments_giveaway_info_gen.go @@ -415,7 +415,7 @@ func (g *PaymentsGiveawayInfo) GetDisallowedCountry() (value string, ok bool) { return g.DisallowedCountry, true } -// PaymentsGiveawayInfoResults represents TL type `payments.giveawayInfoResults#cd5570`. +// PaymentsGiveawayInfoResults represents TL type `payments.giveawayInfoResults#e175e66f`. // A giveaway¹ has ended. // // Links: @@ -443,6 +443,10 @@ type PaymentsGiveawayInfoResults struct { // // Use SetGiftCodeSlug and GetGiftCodeSlug helpers. GiftCodeSlug string + // StarsPrize field of PaymentsGiveawayInfoResults. + // + // Use SetStarsPrize and GetStarsPrize helpers. + StarsPrize int64 // End date of the giveaway. May be bigger than the end date specified in parameters of // the giveaway. FinishDate int @@ -452,11 +456,13 @@ type PaymentsGiveawayInfoResults struct { // // Links: // 1) https://core.telegram.org/api/links#premium-giftcode-links + // + // Use SetActivatedCount and GetActivatedCount helpers. ActivatedCount int } // PaymentsGiveawayInfoResultsTypeID is TL type id of PaymentsGiveawayInfoResults. -const PaymentsGiveawayInfoResultsTypeID = 0xcd5570 +const PaymentsGiveawayInfoResultsTypeID = 0xe175e66f // construct implements constructor of PaymentsGiveawayInfoClass. func (g PaymentsGiveawayInfoResults) construct() PaymentsGiveawayInfoClass { return &g } @@ -490,6 +496,9 @@ func (g *PaymentsGiveawayInfoResults) Zero() bool { if !(g.GiftCodeSlug == "") { return false } + if !(g.StarsPrize == 0) { + return false + } if !(g.FinishDate == 0) { return false } @@ -518,9 +527,10 @@ func (g *PaymentsGiveawayInfoResults) FillFrom(from interface { GetRefunded() (value bool) GetStartDate() (value int) GetGiftCodeSlug() (value string, ok bool) + GetStarsPrize() (value int64, ok bool) GetFinishDate() (value int) GetWinnersCount() (value int) - GetActivatedCount() (value int) + GetActivatedCount() (value int, ok bool) }) { g.Winner = from.GetWinner() g.Refunded = from.GetRefunded() @@ -529,9 +539,16 @@ func (g *PaymentsGiveawayInfoResults) FillFrom(from interface { g.GiftCodeSlug = val } + if val, ok := from.GetStarsPrize(); ok { + g.StarsPrize = val + } + g.FinishDate = from.GetFinishDate() g.WinnersCount = from.GetWinnersCount() - g.ActivatedCount = from.GetActivatedCount() + if val, ok := from.GetActivatedCount(); ok { + g.ActivatedCount = val + } + } // TypeID returns type id in TL schema. @@ -574,7 +591,12 @@ func (g *PaymentsGiveawayInfoResults) TypeInfo() tdp.Type { { Name: "GiftCodeSlug", SchemaName: "gift_code_slug", - Null: !g.Flags.Has(0), + Null: !g.Flags.Has(3), + }, + { + Name: "StarsPrize", + SchemaName: "stars_prize", + Null: !g.Flags.Has(4), }, { Name: "FinishDate", @@ -587,6 +609,7 @@ func (g *PaymentsGiveawayInfoResults) TypeInfo() tdp.Type { { Name: "ActivatedCount", SchemaName: "activated_count", + Null: !g.Flags.Has(2), }, } return typ @@ -601,14 +624,20 @@ func (g *PaymentsGiveawayInfoResults) SetFlags() { g.Flags.Set(1) } if !(g.GiftCodeSlug == "") { - g.Flags.Set(0) + g.Flags.Set(3) + } + if !(g.StarsPrize == 0) { + g.Flags.Set(4) + } + if !(g.ActivatedCount == 0) { + g.Flags.Set(2) } } // Encode implements bin.Encoder. func (g *PaymentsGiveawayInfoResults) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode payments.giveawayInfoResults#cd5570 as nil") + return fmt.Errorf("can't encode payments.giveawayInfoResults#e175e66f as nil") } b.PutID(PaymentsGiveawayInfoResultsTypeID) return g.EncodeBare(b) @@ -617,29 +646,34 @@ func (g *PaymentsGiveawayInfoResults) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (g *PaymentsGiveawayInfoResults) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode payments.giveawayInfoResults#cd5570 as nil") + return fmt.Errorf("can't encode payments.giveawayInfoResults#e175e66f as nil") } g.SetFlags() if err := g.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode payments.giveawayInfoResults#cd5570: field flags: %w", err) + return fmt.Errorf("unable to encode payments.giveawayInfoResults#e175e66f: field flags: %w", err) } b.PutInt(g.StartDate) - if g.Flags.Has(0) { + if g.Flags.Has(3) { b.PutString(g.GiftCodeSlug) } + if g.Flags.Has(4) { + b.PutLong(g.StarsPrize) + } b.PutInt(g.FinishDate) b.PutInt(g.WinnersCount) - b.PutInt(g.ActivatedCount) + if g.Flags.Has(2) { + b.PutInt(g.ActivatedCount) + } return nil } // Decode implements bin.Decoder. func (g *PaymentsGiveawayInfoResults) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode payments.giveawayInfoResults#cd5570 to nil") + return fmt.Errorf("can't decode payments.giveawayInfoResults#e175e66f to nil") } if err := b.ConsumeID(PaymentsGiveawayInfoResultsTypeID); err != nil { - return fmt.Errorf("unable to decode payments.giveawayInfoResults#cd5570: %w", err) + return fmt.Errorf("unable to decode payments.giveawayInfoResults#e175e66f: %w", err) } return g.DecodeBare(b) } @@ -647,11 +681,11 @@ func (g *PaymentsGiveawayInfoResults) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (g *PaymentsGiveawayInfoResults) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode payments.giveawayInfoResults#cd5570 to nil") + return fmt.Errorf("can't decode payments.giveawayInfoResults#e175e66f to nil") } { if err := g.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode payments.giveawayInfoResults#cd5570: field flags: %w", err) + return fmt.Errorf("unable to decode payments.giveawayInfoResults#e175e66f: field flags: %w", err) } } g.Winner = g.Flags.Has(0) @@ -659,35 +693,42 @@ func (g *PaymentsGiveawayInfoResults) DecodeBare(b *bin.Buffer) error { { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode payments.giveawayInfoResults#cd5570: field start_date: %w", err) + return fmt.Errorf("unable to decode payments.giveawayInfoResults#e175e66f: field start_date: %w", err) } g.StartDate = value } - if g.Flags.Has(0) { + if g.Flags.Has(3) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode payments.giveawayInfoResults#cd5570: field gift_code_slug: %w", err) + return fmt.Errorf("unable to decode payments.giveawayInfoResults#e175e66f: field gift_code_slug: %w", err) } g.GiftCodeSlug = value } + if g.Flags.Has(4) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode payments.giveawayInfoResults#e175e66f: field stars_prize: %w", err) + } + g.StarsPrize = value + } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode payments.giveawayInfoResults#cd5570: field finish_date: %w", err) + return fmt.Errorf("unable to decode payments.giveawayInfoResults#e175e66f: field finish_date: %w", err) } g.FinishDate = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode payments.giveawayInfoResults#cd5570: field winners_count: %w", err) + return fmt.Errorf("unable to decode payments.giveawayInfoResults#e175e66f: field winners_count: %w", err) } g.WinnersCount = value } - { + if g.Flags.Has(2) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode payments.giveawayInfoResults#cd5570: field activated_count: %w", err) + return fmt.Errorf("unable to decode payments.giveawayInfoResults#e175e66f: field activated_count: %w", err) } g.ActivatedCount = value } @@ -742,7 +783,7 @@ func (g *PaymentsGiveawayInfoResults) GetStartDate() (value int) { // SetGiftCodeSlug sets value of GiftCodeSlug conditional field. func (g *PaymentsGiveawayInfoResults) SetGiftCodeSlug(value string) { - g.Flags.Set(0) + g.Flags.Set(3) g.GiftCodeSlug = value } @@ -752,12 +793,30 @@ func (g *PaymentsGiveawayInfoResults) GetGiftCodeSlug() (value string, ok bool) if g == nil { return } - if !g.Flags.Has(0) { + if !g.Flags.Has(3) { return value, false } return g.GiftCodeSlug, true } +// SetStarsPrize sets value of StarsPrize conditional field. +func (g *PaymentsGiveawayInfoResults) SetStarsPrize(value int64) { + g.Flags.Set(4) + g.StarsPrize = value +} + +// GetStarsPrize returns value of StarsPrize conditional field and +// boolean which is true if field was set. +func (g *PaymentsGiveawayInfoResults) GetStarsPrize() (value int64, ok bool) { + if g == nil { + return + } + if !g.Flags.Has(4) { + return value, false + } + return g.StarsPrize, true +} + // GetFinishDate returns value of FinishDate field. func (g *PaymentsGiveawayInfoResults) GetFinishDate() (value int) { if g == nil { @@ -774,12 +833,22 @@ func (g *PaymentsGiveawayInfoResults) GetWinnersCount() (value int) { return g.WinnersCount } -// GetActivatedCount returns value of ActivatedCount field. -func (g *PaymentsGiveawayInfoResults) GetActivatedCount() (value int) { +// SetActivatedCount sets value of ActivatedCount conditional field. +func (g *PaymentsGiveawayInfoResults) SetActivatedCount(value int) { + g.Flags.Set(2) + g.ActivatedCount = value +} + +// GetActivatedCount returns value of ActivatedCount conditional field and +// boolean which is true if field was set. +func (g *PaymentsGiveawayInfoResults) GetActivatedCount() (value int, ok bool) { if g == nil { return } - return g.ActivatedCount + if !g.Flags.Has(2) { + return value, false + } + return g.ActivatedCount, true } // PaymentsGiveawayInfoClassName is schema name of PaymentsGiveawayInfoClass. @@ -797,7 +866,7 @@ const PaymentsGiveawayInfoClassName = "payments.GiveawayInfo" // } // switch v := g.(type) { // case *tg.PaymentsGiveawayInfo: // payments.giveawayInfo#4367daa0 -// case *tg.PaymentsGiveawayInfoResults: // payments.giveawayInfoResults#cd5570 +// case *tg.PaymentsGiveawayInfoResults: // payments.giveawayInfoResults#e175e66f // default: panic(v) // } type PaymentsGiveawayInfoClass interface { @@ -837,7 +906,7 @@ func DecodePaymentsGiveawayInfo(buf *bin.Buffer) (PaymentsGiveawayInfoClass, err } return &v, nil case PaymentsGiveawayInfoResultsTypeID: - // Decoding payments.giveawayInfoResults#cd5570. + // Decoding payments.giveawayInfoResults#e175e66f. v := PaymentsGiveawayInfoResults{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode PaymentsGiveawayInfoClass: %w", err) diff --git a/vendor/github.com/gotd/td/tg/tl_payments_payment_form_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_payment_form_gen.go index e6bb3c33..fadc30b4 100644 --- a/vendor/github.com/gotd/td/tg/tl_payments_payment_form_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_payments_payment_form_gen.go @@ -803,26 +803,34 @@ func (p *PaymentsPaymentForm) MapUsers() (value UserClassArray) { } // PaymentsPaymentFormStars represents TL type `payments.paymentFormStars#7bf6b15c`. +// Represents a payment form, for payments to be using Telegram Stars, see here »¹ for +// more info. +// +// Links: +// 1. https://core.telegram.org/api/stars // // See https://core.telegram.org/constructor/payments.paymentFormStars for reference. type PaymentsPaymentFormStars struct { - // Flags field of PaymentsPaymentFormStars. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // FormID field of PaymentsPaymentFormStars. + // Form ID. FormID int64 - // BotID field of PaymentsPaymentFormStars. + // Bot ID. BotID int64 - // Title field of PaymentsPaymentFormStars. + // Form title Title string - // Description field of PaymentsPaymentFormStars. + // Description Description string - // Photo field of PaymentsPaymentFormStars. + // Product photo // // Use SetPhoto and GetPhoto helpers. Photo WebDocumentClass - // Invoice field of PaymentsPaymentFormStars. + // Invoice Invoice Invoice - // Users field of PaymentsPaymentFormStars. + // Info about users mentioned in the other fields. Users []UserClass } diff --git a/vendor/github.com/gotd/td/tg/tl_payments_payment_receipt_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_payment_receipt_gen.go index c3ba05c2..5b3c1934 100644 --- a/vendor/github.com/gotd/td/tg/tl_payments_payment_receipt_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_payments_payment_receipt_gen.go @@ -660,32 +660,42 @@ func (p *PaymentsPaymentReceipt) MapUsers() (value UserClassArray) { } // PaymentsPaymentReceiptStars represents TL type `payments.paymentReceiptStars#dabbf83a`. +// Receipt for payment made using Telegram Stars¹. +// +// Links: +// 1. https://core.telegram.org/api/stars // // See https://core.telegram.org/constructor/payments.paymentReceiptStars for reference. type PaymentsPaymentReceiptStars struct { - // Flags field of PaymentsPaymentReceiptStars. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Date field of PaymentsPaymentReceiptStars. + // Date of generation Date int - // BotID field of PaymentsPaymentReceiptStars. + // Bot ID BotID int64 - // Title field of PaymentsPaymentReceiptStars. + // Title Title string - // Description field of PaymentsPaymentReceiptStars. + // Description Description string - // Photo field of PaymentsPaymentReceiptStars. + // Product photo // // Use SetPhoto and GetPhoto helpers. Photo WebDocumentClass - // Invoice field of PaymentsPaymentReceiptStars. + // Invoice Invoice Invoice - // Currency field of PaymentsPaymentReceiptStars. + // Currency, always XTR. Currency string - // TotalAmount field of PaymentsPaymentReceiptStars. + // Amount of Telegram Stars¹. + // + // Links: + // 1) https://core.telegram.org/api/stars TotalAmount int64 - // TransactionID field of PaymentsPaymentReceiptStars. + // Transaction ID TransactionID string - // Users field of PaymentsPaymentReceiptStars. + // Info about users mentioned in the other fields. Users []UserClass } diff --git a/vendor/github.com/gotd/td/tg/tl_payments_refund_stars_charge_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_refund_stars_charge_gen.go index f24655cb..f7bdfdbb 100644 --- a/vendor/github.com/gotd/td/tg/tl_payments_refund_stars_charge_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_payments_refund_stars_charge_gen.go @@ -32,12 +32,17 @@ var ( ) // PaymentsRefundStarsChargeRequest represents TL type `payments.refundStarsCharge#25ae8f4a`. +// Refund a Telegram Stars¹ transaction, see here »² for more info. +// +// Links: +// 1. https://core.telegram.org/api/stars +// 2. https://core.telegram.org/api/payments#6-refunds // // See https://core.telegram.org/method/payments.refundStarsCharge for reference. type PaymentsRefundStarsChargeRequest struct { - // UserID field of PaymentsRefundStarsChargeRequest. + // User to refund. UserID InputUserClass - // ChargeID field of PaymentsRefundStarsChargeRequest. + // Transaction ID. ChargeID string } @@ -193,8 +198,20 @@ func (r *PaymentsRefundStarsChargeRequest) GetChargeID() (value string) { } // PaymentsRefundStarsCharge invokes method payments.refundStarsCharge#25ae8f4a returning error if any. +// Refund a Telegram Stars¹ transaction, see here »² for more info. +// +// Links: +// 1. https://core.telegram.org/api/stars +// 2. https://core.telegram.org/api/payments#6-refunds +// +// Possible errors: +// +// 400 CHARGE_ALREADY_REFUNDED: The transaction was already refunded. +// 400 USER_BOT_REQUIRED: This method can only be called by a bot. +// 400 USER_ID_INVALID: The provided user ID is invalid. // // See https://core.telegram.org/method/payments.refundStarsCharge for reference. +// Can be used by bots. func (c *Client) PaymentsRefundStarsCharge(ctx context.Context, request *PaymentsRefundStarsChargeRequest) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_payments_send_payment_form_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_send_payment_form_gen.go index eb2c9cbf..1d6603f0 100644 --- a/vendor/github.com/gotd/td/tg/tl_payments_send_payment_form_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_payments_send_payment_form_gen.go @@ -405,6 +405,7 @@ func (s *PaymentsSendPaymentFormRequest) GetTipAmount() (value int64, ok bool) { // Possible errors: // // 400 MESSAGE_ID_INVALID: The provided message id is invalid. +// 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/payments.sendPaymentForm for reference. func (c *Client) PaymentsSendPaymentForm(ctx context.Context, request *PaymentsSendPaymentFormRequest) (PaymentsPaymentResultClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_payments_send_stars_form_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_send_stars_form_gen.go index e2609940..ad062643 100644 --- a/vendor/github.com/gotd/td/tg/tl_payments_send_stars_form_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_payments_send_stars_form_gen.go @@ -32,14 +32,21 @@ var ( ) // PaymentsSendStarsFormRequest represents TL type `payments.sendStarsForm#2bb731d`. +// Make a payment using Telegram Stars, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/stars#using-stars // // See https://core.telegram.org/method/payments.sendStarsForm for reference. type PaymentsSendStarsFormRequest struct { - // Flags field of PaymentsSendStarsFormRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // FormID field of PaymentsSendStarsFormRequest. + // Payment form ID FormID int64 - // Invoice field of PaymentsSendStarsFormRequest. + // Invoice Invoice InputInvoiceClass } @@ -211,6 +218,16 @@ func (s *PaymentsSendStarsFormRequest) GetInvoice() (value InputInvoiceClass) { } // PaymentsSendStarsForm invokes method payments.sendStarsForm#2bb731d returning error if any. +// Make a payment using Telegram Stars, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/stars#using-stars +// +// Possible errors: +// +// 400 BALANCE_TOO_LOW: The transaction cannot be completed because the current Telegram Stars balance is too low. +// 400 FORM_EXPIRED: The form was generated more than 10 minutes ago and has expired, please re-generate it using payments.getPaymentForm and pass the new form_id. +// 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/payments.sendStarsForm for reference. func (c *Client) PaymentsSendStarsForm(ctx context.Context, request *PaymentsSendStarsFormRequest) (PaymentsPaymentResultClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_ads_account_url_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_ads_account_url_gen.go new file mode 100644 index 00000000..a60c2217 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_ads_account_url_gen.go @@ -0,0 +1,166 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// PaymentsStarsRevenueAdsAccountURL represents TL type `payments.starsRevenueAdsAccountUrl#394e7f21`. +// Contains a URL leading to a page where the user will be able to place ads for the +// channel/bot, paying using Telegram Stars¹. +// +// Links: +// 1. https://core.telegram.org/api/stars#paying-for-ads +// +// See https://core.telegram.org/constructor/payments.starsRevenueAdsAccountUrl for reference. +type PaymentsStarsRevenueAdsAccountURL struct { + // URL to open. + URL string +} + +// PaymentsStarsRevenueAdsAccountURLTypeID is TL type id of PaymentsStarsRevenueAdsAccountURL. +const PaymentsStarsRevenueAdsAccountURLTypeID = 0x394e7f21 + +// Ensuring interfaces in compile-time for PaymentsStarsRevenueAdsAccountURL. +var ( + _ bin.Encoder = &PaymentsStarsRevenueAdsAccountURL{} + _ bin.Decoder = &PaymentsStarsRevenueAdsAccountURL{} + _ bin.BareEncoder = &PaymentsStarsRevenueAdsAccountURL{} + _ bin.BareDecoder = &PaymentsStarsRevenueAdsAccountURL{} +) + +func (s *PaymentsStarsRevenueAdsAccountURL) Zero() bool { + if s == nil { + return true + } + if !(s.URL == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *PaymentsStarsRevenueAdsAccountURL) String() string { + if s == nil { + return "PaymentsStarsRevenueAdsAccountURL(nil)" + } + type Alias PaymentsStarsRevenueAdsAccountURL + return fmt.Sprintf("PaymentsStarsRevenueAdsAccountURL%+v", Alias(*s)) +} + +// FillFrom fills PaymentsStarsRevenueAdsAccountURL from given interface. +func (s *PaymentsStarsRevenueAdsAccountURL) FillFrom(from interface { + GetURL() (value string) +}) { + s.URL = from.GetURL() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsStarsRevenueAdsAccountURL) TypeID() uint32 { + return PaymentsStarsRevenueAdsAccountURLTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsStarsRevenueAdsAccountURL) TypeName() string { + return "payments.starsRevenueAdsAccountUrl" +} + +// TypeInfo returns info about TL type. +func (s *PaymentsStarsRevenueAdsAccountURL) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.starsRevenueAdsAccountUrl", + ID: PaymentsStarsRevenueAdsAccountURLTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "URL", + SchemaName: "url", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *PaymentsStarsRevenueAdsAccountURL) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode payments.starsRevenueAdsAccountUrl#394e7f21 as nil") + } + b.PutID(PaymentsStarsRevenueAdsAccountURLTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *PaymentsStarsRevenueAdsAccountURL) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode payments.starsRevenueAdsAccountUrl#394e7f21 as nil") + } + b.PutString(s.URL) + return nil +} + +// Decode implements bin.Decoder. +func (s *PaymentsStarsRevenueAdsAccountURL) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode payments.starsRevenueAdsAccountUrl#394e7f21 to nil") + } + if err := b.ConsumeID(PaymentsStarsRevenueAdsAccountURLTypeID); err != nil { + return fmt.Errorf("unable to decode payments.starsRevenueAdsAccountUrl#394e7f21: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *PaymentsStarsRevenueAdsAccountURL) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode payments.starsRevenueAdsAccountUrl#394e7f21 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode payments.starsRevenueAdsAccountUrl#394e7f21: field url: %w", err) + } + s.URL = value + } + return nil +} + +// GetURL returns value of URL field. +func (s *PaymentsStarsRevenueAdsAccountURL) GetURL() (value string) { + if s == nil { + return + } + return s.URL +} diff --git a/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_ads_account_url_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_ads_account_url_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_ads_account_url_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_stats_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_stats_gen.go new file mode 100644 index 00000000..bd3f040e --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_stats_gen.go @@ -0,0 +1,225 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// PaymentsStarsRevenueStats represents TL type `payments.starsRevenueStats#c92bb73b`. +// Star revenue statistics, see here »¹ for more info. +// Note that all balances and currency amounts and graph values are in Stars. +// +// Links: +// 1. https://core.telegram.org/api/stars +// +// See https://core.telegram.org/constructor/payments.starsRevenueStats for reference. +type PaymentsStarsRevenueStats struct { + // Star revenue graph (number of earned stars) + RevenueGraph StatsGraphClass + // Current balance, current withdrawable balance and overall earned Telegram Stars + Status StarsRevenueStatus + // Current conversion rate of Telegram Stars to USD + UsdRate float64 +} + +// PaymentsStarsRevenueStatsTypeID is TL type id of PaymentsStarsRevenueStats. +const PaymentsStarsRevenueStatsTypeID = 0xc92bb73b + +// Ensuring interfaces in compile-time for PaymentsStarsRevenueStats. +var ( + _ bin.Encoder = &PaymentsStarsRevenueStats{} + _ bin.Decoder = &PaymentsStarsRevenueStats{} + _ bin.BareEncoder = &PaymentsStarsRevenueStats{} + _ bin.BareDecoder = &PaymentsStarsRevenueStats{} +) + +func (s *PaymentsStarsRevenueStats) Zero() bool { + if s == nil { + return true + } + if !(s.RevenueGraph == nil) { + return false + } + if !(s.Status.Zero()) { + return false + } + if !(s.UsdRate == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *PaymentsStarsRevenueStats) String() string { + if s == nil { + return "PaymentsStarsRevenueStats(nil)" + } + type Alias PaymentsStarsRevenueStats + return fmt.Sprintf("PaymentsStarsRevenueStats%+v", Alias(*s)) +} + +// FillFrom fills PaymentsStarsRevenueStats from given interface. +func (s *PaymentsStarsRevenueStats) FillFrom(from interface { + GetRevenueGraph() (value StatsGraphClass) + GetStatus() (value StarsRevenueStatus) + GetUsdRate() (value float64) +}) { + s.RevenueGraph = from.GetRevenueGraph() + s.Status = from.GetStatus() + s.UsdRate = from.GetUsdRate() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsStarsRevenueStats) TypeID() uint32 { + return PaymentsStarsRevenueStatsTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsStarsRevenueStats) TypeName() string { + return "payments.starsRevenueStats" +} + +// TypeInfo returns info about TL type. +func (s *PaymentsStarsRevenueStats) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.starsRevenueStats", + ID: PaymentsStarsRevenueStatsTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "RevenueGraph", + SchemaName: "revenue_graph", + }, + { + Name: "Status", + SchemaName: "status", + }, + { + Name: "UsdRate", + SchemaName: "usd_rate", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *PaymentsStarsRevenueStats) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode payments.starsRevenueStats#c92bb73b as nil") + } + b.PutID(PaymentsStarsRevenueStatsTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *PaymentsStarsRevenueStats) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode payments.starsRevenueStats#c92bb73b as nil") + } + if s.RevenueGraph == nil { + return fmt.Errorf("unable to encode payments.starsRevenueStats#c92bb73b: field revenue_graph is nil") + } + if err := s.RevenueGraph.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.starsRevenueStats#c92bb73b: field revenue_graph: %w", err) + } + if err := s.Status.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.starsRevenueStats#c92bb73b: field status: %w", err) + } + b.PutDouble(s.UsdRate) + return nil +} + +// Decode implements bin.Decoder. +func (s *PaymentsStarsRevenueStats) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode payments.starsRevenueStats#c92bb73b to nil") + } + if err := b.ConsumeID(PaymentsStarsRevenueStatsTypeID); err != nil { + return fmt.Errorf("unable to decode payments.starsRevenueStats#c92bb73b: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *PaymentsStarsRevenueStats) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode payments.starsRevenueStats#c92bb73b to nil") + } + { + value, err := DecodeStatsGraph(b) + if err != nil { + return fmt.Errorf("unable to decode payments.starsRevenueStats#c92bb73b: field revenue_graph: %w", err) + } + s.RevenueGraph = value + } + { + if err := s.Status.Decode(b); err != nil { + return fmt.Errorf("unable to decode payments.starsRevenueStats#c92bb73b: field status: %w", err) + } + } + { + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode payments.starsRevenueStats#c92bb73b: field usd_rate: %w", err) + } + s.UsdRate = value + } + return nil +} + +// GetRevenueGraph returns value of RevenueGraph field. +func (s *PaymentsStarsRevenueStats) GetRevenueGraph() (value StatsGraphClass) { + if s == nil { + return + } + return s.RevenueGraph +} + +// GetStatus returns value of Status field. +func (s *PaymentsStarsRevenueStats) GetStatus() (value StarsRevenueStatus) { + if s == nil { + return + } + return s.Status +} + +// GetUsdRate returns value of UsdRate field. +func (s *PaymentsStarsRevenueStats) GetUsdRate() (value float64) { + if s == nil { + return + } + return s.UsdRate +} diff --git a/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_stats_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_stats_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_stats_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_withdrawal_url_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_withdrawal_url_gen.go new file mode 100644 index 00000000..8e3ec457 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_withdrawal_url_gen.go @@ -0,0 +1,168 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// PaymentsStarsRevenueWithdrawalURL represents TL type `payments.starsRevenueWithdrawalUrl#1dab80b7`. +// Contains the URL to use to withdraw Telegram Star revenue¹. +// +// Links: +// 1. https://core.telegram.org/api/stars#withdrawing-revenue +// +// See https://core.telegram.org/constructor/payments.starsRevenueWithdrawalUrl for reference. +type PaymentsStarsRevenueWithdrawalURL struct { + // Contains the URL to use to withdraw Telegram Star revenue¹. + // + // Links: + // 1) https://core.telegram.org/api/stars#withdrawing-revenue + URL string +} + +// PaymentsStarsRevenueWithdrawalURLTypeID is TL type id of PaymentsStarsRevenueWithdrawalURL. +const PaymentsStarsRevenueWithdrawalURLTypeID = 0x1dab80b7 + +// Ensuring interfaces in compile-time for PaymentsStarsRevenueWithdrawalURL. +var ( + _ bin.Encoder = &PaymentsStarsRevenueWithdrawalURL{} + _ bin.Decoder = &PaymentsStarsRevenueWithdrawalURL{} + _ bin.BareEncoder = &PaymentsStarsRevenueWithdrawalURL{} + _ bin.BareDecoder = &PaymentsStarsRevenueWithdrawalURL{} +) + +func (s *PaymentsStarsRevenueWithdrawalURL) Zero() bool { + if s == nil { + return true + } + if !(s.URL == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *PaymentsStarsRevenueWithdrawalURL) String() string { + if s == nil { + return "PaymentsStarsRevenueWithdrawalURL(nil)" + } + type Alias PaymentsStarsRevenueWithdrawalURL + return fmt.Sprintf("PaymentsStarsRevenueWithdrawalURL%+v", Alias(*s)) +} + +// FillFrom fills PaymentsStarsRevenueWithdrawalURL from given interface. +func (s *PaymentsStarsRevenueWithdrawalURL) FillFrom(from interface { + GetURL() (value string) +}) { + s.URL = from.GetURL() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsStarsRevenueWithdrawalURL) TypeID() uint32 { + return PaymentsStarsRevenueWithdrawalURLTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsStarsRevenueWithdrawalURL) TypeName() string { + return "payments.starsRevenueWithdrawalUrl" +} + +// TypeInfo returns info about TL type. +func (s *PaymentsStarsRevenueWithdrawalURL) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.starsRevenueWithdrawalUrl", + ID: PaymentsStarsRevenueWithdrawalURLTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "URL", + SchemaName: "url", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *PaymentsStarsRevenueWithdrawalURL) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode payments.starsRevenueWithdrawalUrl#1dab80b7 as nil") + } + b.PutID(PaymentsStarsRevenueWithdrawalURLTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *PaymentsStarsRevenueWithdrawalURL) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode payments.starsRevenueWithdrawalUrl#1dab80b7 as nil") + } + b.PutString(s.URL) + return nil +} + +// Decode implements bin.Decoder. +func (s *PaymentsStarsRevenueWithdrawalURL) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode payments.starsRevenueWithdrawalUrl#1dab80b7 to nil") + } + if err := b.ConsumeID(PaymentsStarsRevenueWithdrawalURLTypeID); err != nil { + return fmt.Errorf("unable to decode payments.starsRevenueWithdrawalUrl#1dab80b7: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *PaymentsStarsRevenueWithdrawalURL) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode payments.starsRevenueWithdrawalUrl#1dab80b7 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode payments.starsRevenueWithdrawalUrl#1dab80b7: field url: %w", err) + } + s.URL = value + } + return nil +} + +// GetURL returns value of URL field. +func (s *PaymentsStarsRevenueWithdrawalURL) GetURL() (value string) { + if s == nil { + return + } + return s.URL +} diff --git a/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_withdrawal_url_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_withdrawal_url_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_payments_stars_revenue_withdrawal_url_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_payments_stars_status_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_stars_status_gen.go index d43e047b..4844c4bb 100644 --- a/vendor/github.com/gotd/td/tg/tl_payments_stars_status_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_payments_stars_status_gen.go @@ -31,28 +31,53 @@ var ( _ = tdjson.Encoder{} ) -// PaymentsStarsStatus represents TL type `payments.starsStatus#8cf4ee60`. +// PaymentsStarsStatus represents TL type `payments.starsStatus#bbfa316c`. +// Info about the current Telegram Star balance and transaction history »¹. +// +// Links: +// 1. https://core.telegram.org/api/stars#balance-and-transaction-history // // See https://core.telegram.org/constructor/payments.starsStatus for reference. type PaymentsStarsStatus struct { - // Flags field of PaymentsStarsStatus. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Balance field of PaymentsStarsStatus. + // Current Telegram Star balance. Balance int64 - // History field of PaymentsStarsStatus. + // Subscriptions field of PaymentsStarsStatus. + // + // Use SetSubscriptions and GetSubscriptions helpers. + Subscriptions []StarsSubscription + // SubscriptionsNextOffset field of PaymentsStarsStatus. + // + // Use SetSubscriptionsNextOffset and GetSubscriptionsNextOffset helpers. + SubscriptionsNextOffset string + // SubscriptionsMissingBalance field of PaymentsStarsStatus. + // + // Use SetSubscriptionsMissingBalance and GetSubscriptionsMissingBalance helpers. + SubscriptionsMissingBalance int64 + // List of Telegram Star transactions (partial if next_offset is set). + // + // Use SetHistory and GetHistory helpers. History []StarsTransaction - // NextOffset field of PaymentsStarsStatus. + // Offset to use to fetch more transactions from the transaction history using payments + // getStarsTransactions¹. + // + // Links: + // 1) https://core.telegram.org/method/payments.getStarsTransactions // // Use SetNextOffset and GetNextOffset helpers. NextOffset string - // Chats field of PaymentsStarsStatus. + // Chats mentioned in history. Chats []ChatClass - // Users field of PaymentsStarsStatus. + // Users mentioned in history. Users []UserClass } // PaymentsStarsStatusTypeID is TL type id of PaymentsStarsStatus. -const PaymentsStarsStatusTypeID = 0x8cf4ee60 +const PaymentsStarsStatusTypeID = 0xbbfa316c // Ensuring interfaces in compile-time for PaymentsStarsStatus. var ( @@ -72,6 +97,15 @@ func (s *PaymentsStarsStatus) Zero() bool { if !(s.Balance == 0) { return false } + if !(s.Subscriptions == nil) { + return false + } + if !(s.SubscriptionsNextOffset == "") { + return false + } + if !(s.SubscriptionsMissingBalance == 0) { + return false + } if !(s.History == nil) { return false } @@ -100,13 +134,31 @@ func (s *PaymentsStarsStatus) String() string { // FillFrom fills PaymentsStarsStatus from given interface. func (s *PaymentsStarsStatus) FillFrom(from interface { GetBalance() (value int64) - GetHistory() (value []StarsTransaction) + GetSubscriptions() (value []StarsSubscription, ok bool) + GetSubscriptionsNextOffset() (value string, ok bool) + GetSubscriptionsMissingBalance() (value int64, ok bool) + GetHistory() (value []StarsTransaction, ok bool) GetNextOffset() (value string, ok bool) GetChats() (value []ChatClass) GetUsers() (value []UserClass) }) { s.Balance = from.GetBalance() - s.History = from.GetHistory() + if val, ok := from.GetSubscriptions(); ok { + s.Subscriptions = val + } + + if val, ok := from.GetSubscriptionsNextOffset(); ok { + s.SubscriptionsNextOffset = val + } + + if val, ok := from.GetSubscriptionsMissingBalance(); ok { + s.SubscriptionsMissingBalance = val + } + + if val, ok := from.GetHistory(); ok { + s.History = val + } + if val, ok := from.GetNextOffset(); ok { s.NextOffset = val } @@ -142,9 +194,25 @@ func (s *PaymentsStarsStatus) TypeInfo() tdp.Type { Name: "Balance", SchemaName: "balance", }, + { + Name: "Subscriptions", + SchemaName: "subscriptions", + Null: !s.Flags.Has(1), + }, + { + Name: "SubscriptionsNextOffset", + SchemaName: "subscriptions_next_offset", + Null: !s.Flags.Has(2), + }, + { + Name: "SubscriptionsMissingBalance", + SchemaName: "subscriptions_missing_balance", + Null: !s.Flags.Has(4), + }, { Name: "History", SchemaName: "history", + Null: !s.Flags.Has(3), }, { Name: "NextOffset", @@ -165,6 +233,18 @@ func (s *PaymentsStarsStatus) TypeInfo() tdp.Type { // SetFlags sets flags for non-zero fields. func (s *PaymentsStarsStatus) SetFlags() { + if !(s.Subscriptions == nil) { + s.Flags.Set(1) + } + if !(s.SubscriptionsNextOffset == "") { + s.Flags.Set(2) + } + if !(s.SubscriptionsMissingBalance == 0) { + s.Flags.Set(4) + } + if !(s.History == nil) { + s.Flags.Set(3) + } if !(s.NextOffset == "") { s.Flags.Set(0) } @@ -173,7 +253,7 @@ func (s *PaymentsStarsStatus) SetFlags() { // Encode implements bin.Encoder. func (s *PaymentsStarsStatus) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode payments.starsStatus#8cf4ee60 as nil") + return fmt.Errorf("can't encode payments.starsStatus#bbfa316c as nil") } b.PutID(PaymentsStarsStatusTypeID) return s.EncodeBare(b) @@ -182,17 +262,33 @@ func (s *PaymentsStarsStatus) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *PaymentsStarsStatus) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode payments.starsStatus#8cf4ee60 as nil") + return fmt.Errorf("can't encode payments.starsStatus#bbfa316c as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode payments.starsStatus#8cf4ee60: field flags: %w", err) + return fmt.Errorf("unable to encode payments.starsStatus#bbfa316c: field flags: %w", err) } b.PutLong(s.Balance) - b.PutVectorHeader(len(s.History)) - for idx, v := range s.History { - if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode payments.starsStatus#8cf4ee60: field history element with index %d: %w", idx, err) + if s.Flags.Has(1) { + b.PutVectorHeader(len(s.Subscriptions)) + for idx, v := range s.Subscriptions { + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.starsStatus#bbfa316c: field subscriptions element with index %d: %w", idx, err) + } + } + } + if s.Flags.Has(2) { + b.PutString(s.SubscriptionsNextOffset) + } + if s.Flags.Has(4) { + b.PutLong(s.SubscriptionsMissingBalance) + } + if s.Flags.Has(3) { + b.PutVectorHeader(len(s.History)) + for idx, v := range s.History { + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.starsStatus#bbfa316c: field history element with index %d: %w", idx, err) + } } } if s.Flags.Has(0) { @@ -201,19 +297,19 @@ func (s *PaymentsStarsStatus) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(s.Chats)) for idx, v := range s.Chats { if v == nil { - return fmt.Errorf("unable to encode payments.starsStatus#8cf4ee60: field chats element with index %d is nil", idx) + return fmt.Errorf("unable to encode payments.starsStatus#bbfa316c: field chats element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode payments.starsStatus#8cf4ee60: field chats element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode payments.starsStatus#bbfa316c: field chats element with index %d: %w", idx, err) } } b.PutVectorHeader(len(s.Users)) for idx, v := range s.Users { if v == nil { - return fmt.Errorf("unable to encode payments.starsStatus#8cf4ee60: field users element with index %d is nil", idx) + return fmt.Errorf("unable to encode payments.starsStatus#bbfa316c: field users element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode payments.starsStatus#8cf4ee60: field users element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode payments.starsStatus#bbfa316c: field users element with index %d: %w", idx, err) } } return nil @@ -222,10 +318,10 @@ func (s *PaymentsStarsStatus) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *PaymentsStarsStatus) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode payments.starsStatus#8cf4ee60 to nil") + return fmt.Errorf("can't decode payments.starsStatus#bbfa316c to nil") } if err := b.ConsumeID(PaymentsStarsStatusTypeID); err != nil { - return fmt.Errorf("unable to decode payments.starsStatus#8cf4ee60: %w", err) + return fmt.Errorf("unable to decode payments.starsStatus#bbfa316c: %w", err) } return s.DecodeBare(b) } @@ -233,24 +329,55 @@ func (s *PaymentsStarsStatus) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *PaymentsStarsStatus) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode payments.starsStatus#8cf4ee60 to nil") + return fmt.Errorf("can't decode payments.starsStatus#bbfa316c to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode payments.starsStatus#8cf4ee60: field flags: %w", err) + return fmt.Errorf("unable to decode payments.starsStatus#bbfa316c: field flags: %w", err) } } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode payments.starsStatus#8cf4ee60: field balance: %w", err) + return fmt.Errorf("unable to decode payments.starsStatus#bbfa316c: field balance: %w", err) } s.Balance = value } - { + if s.Flags.Has(1) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode payments.starsStatus#8cf4ee60: field history: %w", err) + return fmt.Errorf("unable to decode payments.starsStatus#bbfa316c: field subscriptions: %w", err) + } + + if headerLen > 0 { + s.Subscriptions = make([]StarsSubscription, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value StarsSubscription + if err := value.Decode(b); err != nil { + return fmt.Errorf("unable to decode payments.starsStatus#bbfa316c: field subscriptions: %w", err) + } + s.Subscriptions = append(s.Subscriptions, value) + } + } + if s.Flags.Has(2) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode payments.starsStatus#bbfa316c: field subscriptions_next_offset: %w", err) + } + s.SubscriptionsNextOffset = value + } + if s.Flags.Has(4) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode payments.starsStatus#bbfa316c: field subscriptions_missing_balance: %w", err) + } + s.SubscriptionsMissingBalance = value + } + if s.Flags.Has(3) { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode payments.starsStatus#bbfa316c: field history: %w", err) } if headerLen > 0 { @@ -259,7 +386,7 @@ func (s *PaymentsStarsStatus) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value StarsTransaction if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode payments.starsStatus#8cf4ee60: field history: %w", err) + return fmt.Errorf("unable to decode payments.starsStatus#bbfa316c: field history: %w", err) } s.History = append(s.History, value) } @@ -267,14 +394,14 @@ func (s *PaymentsStarsStatus) DecodeBare(b *bin.Buffer) error { if s.Flags.Has(0) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode payments.starsStatus#8cf4ee60: field next_offset: %w", err) + return fmt.Errorf("unable to decode payments.starsStatus#bbfa316c: field next_offset: %w", err) } s.NextOffset = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode payments.starsStatus#8cf4ee60: field chats: %w", err) + return fmt.Errorf("unable to decode payments.starsStatus#bbfa316c: field chats: %w", err) } if headerLen > 0 { @@ -283,7 +410,7 @@ func (s *PaymentsStarsStatus) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeChat(b) if err != nil { - return fmt.Errorf("unable to decode payments.starsStatus#8cf4ee60: field chats: %w", err) + return fmt.Errorf("unable to decode payments.starsStatus#bbfa316c: field chats: %w", err) } s.Chats = append(s.Chats, value) } @@ -291,7 +418,7 @@ func (s *PaymentsStarsStatus) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode payments.starsStatus#8cf4ee60: field users: %w", err) + return fmt.Errorf("unable to decode payments.starsStatus#bbfa316c: field users: %w", err) } if headerLen > 0 { @@ -300,7 +427,7 @@ func (s *PaymentsStarsStatus) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeUser(b) if err != nil { - return fmt.Errorf("unable to decode payments.starsStatus#8cf4ee60: field users: %w", err) + return fmt.Errorf("unable to decode payments.starsStatus#bbfa316c: field users: %w", err) } s.Users = append(s.Users, value) } @@ -316,12 +443,76 @@ func (s *PaymentsStarsStatus) GetBalance() (value int64) { return s.Balance } -// GetHistory returns value of History field. -func (s *PaymentsStarsStatus) GetHistory() (value []StarsTransaction) { +// SetSubscriptions sets value of Subscriptions conditional field. +func (s *PaymentsStarsStatus) SetSubscriptions(value []StarsSubscription) { + s.Flags.Set(1) + s.Subscriptions = value +} + +// GetSubscriptions returns value of Subscriptions conditional field and +// boolean which is true if field was set. +func (s *PaymentsStarsStatus) GetSubscriptions() (value []StarsSubscription, ok bool) { if s == nil { return } - return s.History + if !s.Flags.Has(1) { + return value, false + } + return s.Subscriptions, true +} + +// SetSubscriptionsNextOffset sets value of SubscriptionsNextOffset conditional field. +func (s *PaymentsStarsStatus) SetSubscriptionsNextOffset(value string) { + s.Flags.Set(2) + s.SubscriptionsNextOffset = value +} + +// GetSubscriptionsNextOffset returns value of SubscriptionsNextOffset conditional field and +// boolean which is true if field was set. +func (s *PaymentsStarsStatus) GetSubscriptionsNextOffset() (value string, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(2) { + return value, false + } + return s.SubscriptionsNextOffset, true +} + +// SetSubscriptionsMissingBalance sets value of SubscriptionsMissingBalance conditional field. +func (s *PaymentsStarsStatus) SetSubscriptionsMissingBalance(value int64) { + s.Flags.Set(4) + s.SubscriptionsMissingBalance = value +} + +// GetSubscriptionsMissingBalance returns value of SubscriptionsMissingBalance conditional field and +// boolean which is true if field was set. +func (s *PaymentsStarsStatus) GetSubscriptionsMissingBalance() (value int64, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(4) { + return value, false + } + return s.SubscriptionsMissingBalance, true +} + +// SetHistory sets value of History conditional field. +func (s *PaymentsStarsStatus) SetHistory(value []StarsTransaction) { + s.Flags.Set(3) + s.History = value +} + +// GetHistory returns value of History conditional field and +// boolean which is true if field was set. +func (s *PaymentsStarsStatus) GetHistory() (value []StarsTransaction, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(3) { + return value, false + } + return s.History, true } // SetNextOffset sets value of NextOffset conditional field. diff --git a/vendor/github.com/gotd/td/tg/tl_payments_validate_requested_info_gen.go b/vendor/github.com/gotd/td/tg/tl_payments_validate_requested_info_gen.go index 4119e7c9..ed248849 100644 --- a/vendor/github.com/gotd/td/tg/tl_payments_validate_requested_info_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_payments_validate_requested_info_gen.go @@ -255,6 +255,7 @@ func (v *PaymentsValidateRequestedInfoRequest) GetInfo() (value PaymentRequested // Possible errors: // // 400 MESSAGE_ID_INVALID: The provided message id is invalid. +// 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/payments.validateRequestedInfo for reference. func (c *Client) PaymentsValidateRequestedInfo(ctx context.Context, request *PaymentsValidateRequestedInfoRequest) (*PaymentsValidatedRequestedInfo, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_peer_settings_gen.go b/vendor/github.com/gotd/td/tg/tl_peer_settings_gen.go index dd8d8937..b8905d4c 100644 --- a/vendor/github.com/gotd/td/tg/tl_peer_settings_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_peer_settings_gen.go @@ -74,9 +74,21 @@ type PeerSettings struct { // 1) https://core.telegram.org/api/invites#join-requests // 2) https://core.telegram.org/api/invites#join-requests RequestChatBroadcast bool - // BusinessBotPaused field of PeerSettings. + // This flag is set if both business_bot_id and business_bot_manage_url are set and all + // connected business bots »¹ were paused in this chat using account + // toggleConnectedBotPaused »². + // + // Links: + // 1) https://core.telegram.org/api/business#connected-bots + // 2) https://core.telegram.org/method/account.toggleConnectedBotPaused BusinessBotPaused bool - // BusinessBotCanReply field of PeerSettings. + // This flag is set if both business_bot_id and business_bot_manage_url are set and + // connected business bots »¹ can reply to messages in this chat, as specified by the + // settings during initial configuration². + // + // Links: + // 1) https://core.telegram.org/api/business#connected-bots + // 2) https://core.telegram.org/api/business#connected-bots BusinessBotCanReply bool // Distance in meters between us and this peer // @@ -96,11 +108,19 @@ type PeerSettings struct { // // Use SetRequestChatDate and GetRequestChatDate helpers. RequestChatDate int - // BusinessBotID field of PeerSettings. + // Contains the ID of the business bot »¹ managing this chat, used to display info + // about the bot in the action bar. + // + // Links: + // 1) https://core.telegram.org/api/business#connected-bots // // Use SetBusinessBotID and GetBusinessBotID helpers. BusinessBotID int64 - // BusinessBotManageURL field of PeerSettings. + // Contains a deep link »¹, used to open a management menu in the business bot. This + // flag is set if and only if business_bot_id is set. + // + // Links: + // 1) https://core.telegram.org/api/links // // Use SetBusinessBotManageURL and GetBusinessBotManageURL helpers. BusinessBotManageURL string diff --git a/vendor/github.com/gotd/td/tg/tl_phone_call_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_call_gen.go index 3f33639f..63dea155 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_call_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_call_gen.go @@ -1288,11 +1288,11 @@ type PhoneCall struct { KeyFingerprint int64 // Call protocol info to be passed to libtgvoip Protocol PhoneCallProtocol - // List of endpoints the user can connect to to exchange call data + // List of endpoints the user can connect to exchange call data Connections []PhoneConnectionClass // When was the call actually started StartDate int - // CustomParameters field of PhoneCall. + // Custom JSON-encoded call parameters to be passed to tgcalls. // // Use SetCustomParameters and GetCustomParameters helpers. CustomParameters DataJSON diff --git a/vendor/github.com/gotd/td/tg/tl_phone_check_group_call_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_check_group_call_gen.go index ff386a3e..14ab447d 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_check_group_call_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_check_group_call_gen.go @@ -212,6 +212,7 @@ func (c *PhoneCheckGroupCallRequest) GetSources() (value []int) { // // Possible errors: // +// 400 GROUPCALL_INVALID: The specified group call is invalid. // 400 GROUPCALL_JOIN_MISSING: You haven't joined this group call. // // See https://core.telegram.org/method/phone.checkGroupCall for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_phone_edit_group_call_participant_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_edit_group_call_participant_gen.go index 4d0ff8a7..0a829dbf 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_edit_group_call_participant_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_edit_group_call_participant_gen.go @@ -518,8 +518,12 @@ func (e *PhoneEditGroupCallParticipantRequest) GetPresentationPaused() (value bo // Possible errors: // // 403 GROUPCALL_FORBIDDEN: The group call has already ended. +// 400 GROUPCALL_INVALID: The specified group call is invalid. // 400 PARTICIPANT_JOIN_MISSING: Trying to enable a presentation, when the user hasn't joined the Video Chat with phone.joinGroupCall. +// 400 RAISE_HAND_FORBIDDEN: You cannot raise your hand. // 400 USER_VOLUME_INVALID: The specified user volume is invalid. +// 400 VIDEO_PAUSE_FORBIDDEN: You cannot pause the video stream. +// 400 VIDEO_STOP_FORBIDDEN: You cannot stop the video stream. // // See https://core.telegram.org/method/phone.editGroupCallParticipant for reference. func (c *Client) PhoneEditGroupCallParticipant(ctx context.Context, request *PhoneEditGroupCallParticipantRequest) (UpdatesClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_phone_edit_group_call_title_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_edit_group_call_title_gen.go index 8f851ae6..83080d83 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_edit_group_call_title_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_edit_group_call_title_gen.go @@ -194,6 +194,7 @@ func (e *PhoneEditGroupCallTitleRequest) GetTitle() (value string) { // Possible errors: // // 403 GROUPCALL_FORBIDDEN: The group call has already ended. +// 400 GROUPCALL_INVALID: The specified group call is invalid. // // See https://core.telegram.org/method/phone.editGroupCallTitle for reference. func (c *Client) PhoneEditGroupCallTitle(ctx context.Context, request *PhoneEditGroupCallTitleRequest) (UpdatesClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_phone_export_group_call_invite_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_export_group_call_invite_gen.go index 1443ddcf..b169d40f 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_export_group_call_invite_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_export_group_call_invite_gen.go @@ -230,6 +230,7 @@ func (e *PhoneExportGroupCallInviteRequest) GetCall() (value InputGroupCall) { // // Possible errors: // +// 400 GROUPCALL_INVALID: The specified group call is invalid. // 403 PUBLIC_CHANNEL_MISSING: You can only export group call invite links for public chats or channels. // // See https://core.telegram.org/method/phone.exportGroupCallInvite for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_phone_get_group_call_stream_rtmp_url_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_get_group_call_stream_rtmp_url_gen.go index 76a3f4a1..2bd11c26 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_get_group_call_stream_rtmp_url_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_get_group_call_stream_rtmp_url_gen.go @@ -207,6 +207,7 @@ func (g *PhoneGetGroupCallStreamRtmpURLRequest) GetRevoke() (value bool) { // Possible errors: // // 400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. +// 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/phone.getGroupCallStreamRtmpUrl for reference. func (c *Client) PhoneGetGroupCallStreamRtmpURL(ctx context.Context, request *PhoneGetGroupCallStreamRtmpURLRequest) (*PhoneGroupCallStreamRtmpURL, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_phone_get_group_participants_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_get_group_participants_gen.go index 80da26a4..76b366b4 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_get_group_participants_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_get_group_participants_gen.go @@ -318,6 +318,10 @@ func (g *PhoneGetGroupParticipantsRequest) MapIDs() (value InputPeerClassArray) // PhoneGetGroupParticipants invokes method phone.getGroupParticipants#c558d8ab returning error if any. // Get group call participants // +// Possible errors: +// +// 400 GROUPCALL_INVALID: The specified group call is invalid. +// // See https://core.telegram.org/method/phone.getGroupParticipants for reference. func (c *Client) PhoneGetGroupParticipants(ctx context.Context, request *PhoneGetGroupParticipantsRequest) (*PhoneGroupParticipants, error) { var result PhoneGroupParticipants diff --git a/vendor/github.com/gotd/td/tg/tl_phone_invite_to_group_call_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_invite_to_group_call_gen.go index a54cf133..bbc7c887 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_invite_to_group_call_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_invite_to_group_call_gen.go @@ -220,6 +220,7 @@ func (i *PhoneInviteToGroupCallRequest) MapUsers() (value InputUserClassArray) { // 400 GROUPCALL_INVALID: The specified group call is invalid. // 400 INVITE_FORBIDDEN_WITH_JOINAS: If the user has anonymously joined a group call as a channel, they can't invite other users to the group call because that would cause deanonymization, because the invite would be sent using the original user ID, not the anonymized channel ID. // 400 USER_ALREADY_INVITED: You have already invited this user. +// 403 USER_NOT_PARTICIPANT: You're not a member of this supergroup/channel. // // See https://core.telegram.org/method/phone.inviteToGroupCall for reference. func (c *Client) PhoneInviteToGroupCall(ctx context.Context, request *PhoneInviteToGroupCallRequest) (UpdatesClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_phone_join_group_call_presentation_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_join_group_call_presentation_gen.go index 1a0bfc5d..6b638231 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_join_group_call_presentation_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_join_group_call_presentation_gen.go @@ -193,6 +193,7 @@ func (j *PhoneJoinGroupCallPresentationRequest) GetParams() (value DataJSON) { // // Possible errors: // +// 400 GROUPCALL_INVALID: The specified group call is invalid. // 403 PARTICIPANT_JOIN_MISSING: Trying to enable a presentation, when the user hasn't joined the Video Chat with phone.joinGroupCall. // // See https://core.telegram.org/method/phone.joinGroupCallPresentation for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_phone_leave_group_call_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_leave_group_call_gen.go index 3473924e..c803f8a3 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_leave_group_call_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_leave_group_call_gen.go @@ -191,6 +191,10 @@ func (l *PhoneLeaveGroupCallRequest) GetSource() (value int) { // PhoneLeaveGroupCall invokes method phone.leaveGroupCall#500377f9 returning error if any. // Leave a group call // +// Possible errors: +// +// 400 GROUPCALL_INVALID: The specified group call is invalid. +// // See https://core.telegram.org/method/phone.leaveGroupCall for reference. func (c *Client) PhoneLeaveGroupCall(ctx context.Context, request *PhoneLeaveGroupCallRequest) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_phone_leave_group_call_presentation_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_leave_group_call_presentation_gen.go index 2ef894c0..ccf9e500 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_leave_group_call_presentation_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_leave_group_call_presentation_gen.go @@ -164,6 +164,10 @@ func (l *PhoneLeaveGroupCallPresentationRequest) GetCall() (value InputGroupCall // PhoneLeaveGroupCallPresentation invokes method phone.leaveGroupCallPresentation#1c50d144 returning error if any. // Stop screen sharing in a group call // +// Possible errors: +// +// 400 GROUPCALL_INVALID: The specified group call is invalid. +// // See https://core.telegram.org/method/phone.leaveGroupCallPresentation for reference. func (c *Client) PhoneLeaveGroupCallPresentation(ctx context.Context, call InputGroupCall) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_phone_save_call_log_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_save_call_log_gen.go index e51ffd3a..f4412497 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_save_call_log_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_save_call_log_gen.go @@ -196,6 +196,10 @@ func (s *PhoneSaveCallLogRequest) GetFile() (value InputFileClass) { // PhoneSaveCallLog invokes method phone.saveCallLog#41248786 returning error if any. // Save phone call debug information // +// Possible errors: +// +// 400 CALL_PEER_INVALID: The provided call peer object is invalid. +// // See https://core.telegram.org/method/phone.saveCallLog for reference. func (c *Client) PhoneSaveCallLog(ctx context.Context, request *PhoneSaveCallLogRequest) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_phone_save_default_group_call_join_as_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_save_default_group_call_join_as_gen.go index e3c4ef5d..72c90e30 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_save_default_group_call_join_as_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_save_default_group_call_join_as_gen.go @@ -205,6 +205,7 @@ func (s *PhoneSaveDefaultGroupCallJoinAsRequest) GetJoinAs() (value InputPeerCla // Possible errors: // // 400 JOIN_AS_PEER_INVALID: The specified peer cannot be used to join a group call. +// 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/phone.saveDefaultGroupCallJoinAs for reference. func (c *Client) PhoneSaveDefaultGroupCallJoinAs(ctx context.Context, request *PhoneSaveDefaultGroupCallJoinAsRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_phone_send_signaling_data_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_send_signaling_data_gen.go index f259509e..86294f9d 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_send_signaling_data_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_send_signaling_data_gen.go @@ -191,6 +191,10 @@ func (s *PhoneSendSignalingDataRequest) GetData() (value []byte) { // PhoneSendSignalingData invokes method phone.sendSignalingData#ff7a9383 returning error if any. // Send VoIP signaling data // +// Possible errors: +// +// 400 CALL_PEER_INVALID: The provided call peer object is invalid. +// // See https://core.telegram.org/method/phone.sendSignalingData for reference. func (c *Client) PhoneSendSignalingData(ctx context.Context, request *PhoneSendSignalingDataRequest) (bool, error) { var result BoolBox diff --git a/vendor/github.com/gotd/td/tg/tl_phone_start_scheduled_group_call_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_start_scheduled_group_call_gen.go index 46b382a3..5e5035c9 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_start_scheduled_group_call_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_start_scheduled_group_call_gen.go @@ -164,6 +164,11 @@ func (s *PhoneStartScheduledGroupCallRequest) GetCall() (value InputGroupCall) { // PhoneStartScheduledGroupCall invokes method phone.startScheduledGroupCall#5680e342 returning error if any. // Start a scheduled group call. // +// Possible errors: +// +// 403 GROUPCALL_ALREADY_STARTED: The groupcall has already started, you can join directly using phone.joinGroupCall. +// 400 GROUPCALL_INVALID: The specified group call is invalid. +// // See https://core.telegram.org/method/phone.startScheduledGroupCall for reference. func (c *Client) PhoneStartScheduledGroupCall(ctx context.Context, call InputGroupCall) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_phone_toggle_group_call_record_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_toggle_group_call_record_gen.go index c5771be8..557d4e97 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_toggle_group_call_record_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_toggle_group_call_record_gen.go @@ -356,6 +356,7 @@ func (t *PhoneToggleGroupCallRecordRequest) GetVideoPortrait() (value bool, ok b // Possible errors: // // 403 GROUPCALL_FORBIDDEN: The group call has already ended. +// 400 GROUPCALL_INVALID: The specified group call is invalid. // 400 GROUPCALL_NOT_MODIFIED: Group call settings weren't modified. // // See https://core.telegram.org/method/phone.toggleGroupCallRecord for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_phone_toggle_group_call_settings_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_toggle_group_call_settings_gen.go index 95b942e2..f3c1096c 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_toggle_group_call_settings_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_toggle_group_call_settings_gen.go @@ -271,6 +271,7 @@ func (t *PhoneToggleGroupCallSettingsRequest) GetJoinMuted() (value bool, ok boo // // Possible errors: // +// 400 GROUPCALL_INVALID: The specified group call is invalid. // 400 GROUPCALL_NOT_MODIFIED: Group call settings weren't modified. // // See https://core.telegram.org/method/phone.toggleGroupCallSettings for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_phone_toggle_group_call_start_subscription_gen.go b/vendor/github.com/gotd/td/tg/tl_phone_toggle_group_call_start_subscription_gen.go index 0e5a9722..6af9f2f2 100644 --- a/vendor/github.com/gotd/td/tg/tl_phone_toggle_group_call_start_subscription_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_phone_toggle_group_call_start_subscription_gen.go @@ -194,6 +194,7 @@ func (t *PhoneToggleGroupCallStartSubscriptionRequest) GetSubscribed() (value bo // Possible errors: // // 403 GROUPCALL_ALREADY_STARTED: The groupcall has already started, you can join directly using phone.joinGroupCall. +// 400 GROUPCALL_INVALID: The specified group call is invalid. // // See https://core.telegram.org/method/phone.toggleGroupCallStartSubscription for reference. func (c *Client) PhoneToggleGroupCallStartSubscription(ctx context.Context, request *PhoneToggleGroupCallStartSubscriptionRequest) (UpdatesClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_photos_upload_contact_profile_photo_gen.go b/vendor/github.com/gotd/td/tg/tl_photos_upload_contact_profile_photo_gen.go index 0a2c2e3f..6cea55b2 100644 --- a/vendor/github.com/gotd/td/tg/tl_photos_upload_contact_profile_photo_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_photos_upload_contact_profile_photo_gen.go @@ -498,7 +498,6 @@ func (u *PhotosUploadContactProfilePhotoRequest) GetVideoEmojiMarkup() (value Vi // 400 USER_ID_INVALID: The provided user ID is invalid. // // See https://core.telegram.org/method/photos.uploadContactProfilePhoto for reference. -// Can be used by bots. func (c *Client) PhotosUploadContactProfilePhoto(ctx context.Context, request *PhotosUploadContactProfilePhotoRequest) (*PhotosPhoto, error) { var result PhotosPhoto diff --git a/vendor/github.com/gotd/td/tg/tl_poll_answer_gen.go b/vendor/github.com/gotd/td/tg/tl_poll_answer_gen.go index d13892fb..d9da62d7 100644 --- a/vendor/github.com/gotd/td/tg/tl_poll_answer_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_poll_answer_gen.go @@ -36,7 +36,12 @@ var ( // // See https://core.telegram.org/constructor/pollAnswer for reference. type PollAnswer struct { - // Textual representation of the answer + // Textual representation of the answer (only Premium¹ users can use custom emoji + // entities² here). + // + // Links: + // 1) https://core.telegram.org/api/premium + // 2) https://core.telegram.org/api/custom-emoji Text TextWithEntities // The param that has to be passed to messages.sendVote¹. // diff --git a/vendor/github.com/gotd/td/tg/tl_poll_gen.go b/vendor/github.com/gotd/td/tg/tl_poll_gen.go index dd90dd04..6ccb47bf 100644 --- a/vendor/github.com/gotd/td/tg/tl_poll_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_poll_gen.go @@ -52,7 +52,11 @@ type Poll struct { // Whether this is a quiz (with wrong and correct answers, results shown in the return // type) Quiz bool - // The question of the poll + // The question of the poll (only Premium¹ users can use custom emoji entities² here). + // + // Links: + // 1) https://core.telegram.org/api/premium + // 2) https://core.telegram.org/api/custom-emoji Question TextWithEntities // The possible answers, vote using messages.sendVote¹. // diff --git a/vendor/github.com/gotd/td/tg/tl_premium_boosts_status_gen.go b/vendor/github.com/gotd/td/tg/tl_premium_boosts_status_gen.go index 605d14ec..959d6833 100644 --- a/vendor/github.com/gotd/td/tg/tl_premium_boosts_status_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_premium_boosts_status_gen.go @@ -44,16 +44,17 @@ type PremiumBoostsStatus struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Whether we're currently boosting this channel, my_boost_slots will also be set. + // Whether we're currently boosting this channel/supergroup, my_boost_slots will also be + // set. MyBoost bool - // The current boost level of the channel. + // The current boost level of the channel/supergroup. Level int // The number of boosts acquired so far in the current level. CurrentLevelBoosts int // Total number of boosts acquired so far. Boosts int // The number of boosts acquired from created Telegram Premium gift codes¹ and - // giveaways²; only returned to channel admins. + // giveaways²; only returned to channel/supergroup admins. // // Links: // 1) https://core.telegram.org/api/giveaways @@ -66,8 +67,9 @@ type PremiumBoostsStatus struct { // // Use SetNextLevelBoosts and GetNextLevelBoosts helpers. NextLevelBoosts int - // Only returned to channel admins: contains the approximated number of Premium users - // subscribed to the channel, related to the total number of subscribers. + // Only returned to channel/supergroup admins: contains the approximated number of + // Premium users subscribed to the channel/supergroup, related to the total number of + // subscribers. // // Use SetPremiumAudience and GetPremiumAudience helpers. PremiumAudience StatsPercentValue @@ -76,13 +78,14 @@ type PremiumBoostsStatus struct { // Links: // 1) https://core.telegram.org/api/links#boost-links BoostURL string - // A list of prepaid giveaways¹ available for the chat; only returned to channel admins. + // A list of prepaid giveaways¹ available for the chat; only returned to + // channel/supergroup admins. // // Links: // 1) https://core.telegram.org/api/giveaways // // Use SetPrepaidGiveaways and GetPrepaidGiveaways helpers. - PrepaidGiveaways []PrepaidGiveaway + PrepaidGiveaways []PrepaidGiveawayClass // Indicates which of our boost slots¹ we've assigned to this peer (populated if // my_boost is set). // @@ -164,7 +167,7 @@ func (b *PremiumBoostsStatus) FillFrom(from interface { GetNextLevelBoosts() (value int, ok bool) GetPremiumAudience() (value StatsPercentValue, ok bool) GetBoostURL() (value string) - GetPrepaidGiveaways() (value []PrepaidGiveaway, ok bool) + GetPrepaidGiveaways() (value []PrepaidGiveawayClass, ok bool) GetMyBoostSlots() (value []int, ok bool) }) { b.MyBoost = from.GetMyBoost() @@ -325,6 +328,9 @@ func (b *PremiumBoostsStatus) EncodeBare(buf *bin.Buffer) error { if b.Flags.Has(3) { buf.PutVectorHeader(len(b.PrepaidGiveaways)) for idx, v := range b.PrepaidGiveaways { + if v == nil { + return fmt.Errorf("unable to encode premium.boostsStatus#4959427a: field prepaid_giveaways element with index %d is nil", idx) + } if err := v.Encode(buf); err != nil { return fmt.Errorf("unable to encode premium.boostsStatus#4959427a: field prepaid_giveaways element with index %d: %w", idx, err) } @@ -415,11 +421,11 @@ func (b *PremiumBoostsStatus) DecodeBare(buf *bin.Buffer) error { } if headerLen > 0 { - b.PrepaidGiveaways = make([]PrepaidGiveaway, 0, headerLen%bin.PreallocateLimit) + b.PrepaidGiveaways = make([]PrepaidGiveawayClass, 0, headerLen%bin.PreallocateLimit) } for idx := 0; idx < headerLen; idx++ { - var value PrepaidGiveaway - if err := value.Decode(buf); err != nil { + value, err := DecodePrepaidGiveaway(buf) + if err != nil { return fmt.Errorf("unable to decode premium.boostsStatus#4959427a: field prepaid_giveaways: %w", err) } b.PrepaidGiveaways = append(b.PrepaidGiveaways, value) @@ -551,14 +557,14 @@ func (b *PremiumBoostsStatus) GetBoostURL() (value string) { } // SetPrepaidGiveaways sets value of PrepaidGiveaways conditional field. -func (b *PremiumBoostsStatus) SetPrepaidGiveaways(value []PrepaidGiveaway) { +func (b *PremiumBoostsStatus) SetPrepaidGiveaways(value []PrepaidGiveawayClass) { b.Flags.Set(3) b.PrepaidGiveaways = value } // GetPrepaidGiveaways returns value of PrepaidGiveaways conditional field and // boolean which is true if field was set. -func (b *PremiumBoostsStatus) GetPrepaidGiveaways() (value []PrepaidGiveaway, ok bool) { +func (b *PremiumBoostsStatus) GetPrepaidGiveaways() (value []PrepaidGiveawayClass, ok bool) { if b == nil { return } @@ -585,3 +591,11 @@ func (b *PremiumBoostsStatus) GetMyBoostSlots() (value []int, ok bool) { } return b.MyBoostSlots, true } + +// MapPrepaidGiveaways returns field PrepaidGiveaways wrapped in PrepaidGiveawayClassArray helper. +func (b *PremiumBoostsStatus) MapPrepaidGiveaways() (value PrepaidGiveawayClassArray, ok bool) { + if !b.Flags.Has(3) { + return value, false + } + return PrepaidGiveawayClassArray(b.PrepaidGiveaways), true +} diff --git a/vendor/github.com/gotd/td/tg/tl_premium_get_boosts_list_gen.go b/vendor/github.com/gotd/td/tg/tl_premium_get_boosts_list_gen.go index ec6fb97e..a46a3e6c 100644 --- a/vendor/github.com/gotd/td/tg/tl_premium_get_boosts_list_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_premium_get_boosts_list_gen.go @@ -32,7 +32,8 @@ var ( ) // PremiumGetBoostsListRequest represents TL type `premium.getBoostsList#60f67660`. -// Obtains info about the boosts that were applied to a certain channel (admins only) +// Obtains info about the boosts that were applied to a certain channel or supergroup +// (admins only) // // See https://core.telegram.org/method/premium.getBoostsList for reference. type PremiumGetBoostsListRequest struct { @@ -42,12 +43,12 @@ type PremiumGetBoostsListRequest struct { // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // Whether to return only info about boosts received from gift codes and giveaways - // created by the channel »¹ + // created by the channel/supergroup »¹ // // Links: // 1) https://core.telegram.org/api/giveaways Gifts bool - // The channel + // The channel/supergroup Peer InputPeerClass // Offset for pagination, obtained from premium.boostsList¹.next_offset // @@ -287,7 +288,8 @@ func (g *PremiumGetBoostsListRequest) GetLimit() (value int) { } // PremiumGetBoostsList invokes method premium.getBoostsList#60f67660 returning error if any. -// Obtains info about the boosts that were applied to a certain channel (admins only) +// Obtains info about the boosts that were applied to a certain channel or supergroup +// (admins only) // // Possible errors: // diff --git a/vendor/github.com/gotd/td/tg/tl_premium_get_boosts_status_gen.go b/vendor/github.com/gotd/td/tg/tl_premium_get_boosts_status_gen.go index 21ea527c..6d562340 100644 --- a/vendor/github.com/gotd/td/tg/tl_premium_get_boosts_status_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_premium_get_boosts_status_gen.go @@ -32,7 +32,7 @@ var ( ) // PremiumGetBoostsStatusRequest represents TL type `premium.getBoostsStatus#42f1f61`. -// Gets the current number of boosts¹ of a channel. +// Gets the current number of boosts¹ of a channel/supergroup. // // Links: // 1. https://core.telegram.org/api/boost @@ -170,7 +170,7 @@ func (g *PremiumGetBoostsStatusRequest) GetPeer() (value InputPeerClass) { } // PremiumGetBoostsStatus invokes method premium.getBoostsStatus#42f1f61 returning error if any. -// Gets the current number of boosts¹ of a channel. +// Gets the current number of boosts¹ of a channel/supergroup. // // Links: // 1. https://core.telegram.org/api/boost diff --git a/vendor/github.com/gotd/td/tg/tl_premium_get_user_boosts_gen.go b/vendor/github.com/gotd/td/tg/tl_premium_get_user_boosts_gen.go index bd5b4ede..f4e28db2 100644 --- a/vendor/github.com/gotd/td/tg/tl_premium_get_user_boosts_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_premium_get_user_boosts_gen.go @@ -32,12 +32,12 @@ var ( ) // PremiumGetUserBoostsRequest represents TL type `premium.getUserBoosts#39854d1f`. -// Returns the lists of boost that were applied to a channel by a specific user (admins -// only) +// Returns the lists of boost that were applied to a channel/supergroup by a specific +// user (admins only) // // See https://core.telegram.org/method/premium.getUserBoosts for reference. type PremiumGetUserBoostsRequest struct { - // The channel + // The channel/supergroup Peer InputPeerClass // The user UserID InputUserClass @@ -200,8 +200,8 @@ func (g *PremiumGetUserBoostsRequest) GetUserID() (value InputUserClass) { } // PremiumGetUserBoosts invokes method premium.getUserBoosts#39854d1f returning error if any. -// Returns the lists of boost that were applied to a channel by a specific user (admins -// only) +// Returns the lists of boost that were applied to a channel/supergroup by a specific +// user (admins only) // // Possible errors: // diff --git a/vendor/github.com/gotd/td/tg/tl_prepaid_giveaway_gen.go b/vendor/github.com/gotd/td/tg/tl_prepaid_giveaway_gen.go index a1a7a6fd..44be3ba8 100644 --- a/vendor/github.com/gotd/td/tg/tl_prepaid_giveaway_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_prepaid_giveaway_gen.go @@ -58,12 +58,17 @@ type PrepaidGiveaway struct { // PrepaidGiveawayTypeID is TL type id of PrepaidGiveaway. const PrepaidGiveawayTypeID = 0xb2539d54 +// construct implements constructor of PrepaidGiveawayClass. +func (p PrepaidGiveaway) construct() PrepaidGiveawayClass { return &p } + // Ensuring interfaces in compile-time for PrepaidGiveaway. var ( _ bin.Encoder = &PrepaidGiveaway{} _ bin.Decoder = &PrepaidGiveaway{} _ bin.BareEncoder = &PrepaidGiveaway{} _ bin.BareDecoder = &PrepaidGiveaway{} + + _ PrepaidGiveawayClass = &PrepaidGiveaway{} ) func (p *PrepaidGiveaway) Zero() bool { @@ -250,3 +255,346 @@ func (p *PrepaidGiveaway) GetDate() (value int) { } return p.Date } + +// PrepaidStarsGiveaway represents TL type `prepaidStarsGiveaway#9a9d77e0`. +// +// See https://core.telegram.org/constructor/prepaidStarsGiveaway for reference. +type PrepaidStarsGiveaway struct { + // ID field of PrepaidStarsGiveaway. + ID int64 + // Stars field of PrepaidStarsGiveaway. + Stars int64 + // Quantity field of PrepaidStarsGiveaway. + Quantity int + // Boosts field of PrepaidStarsGiveaway. + Boosts int + // Date field of PrepaidStarsGiveaway. + Date int +} + +// PrepaidStarsGiveawayTypeID is TL type id of PrepaidStarsGiveaway. +const PrepaidStarsGiveawayTypeID = 0x9a9d77e0 + +// construct implements constructor of PrepaidGiveawayClass. +func (p PrepaidStarsGiveaway) construct() PrepaidGiveawayClass { return &p } + +// Ensuring interfaces in compile-time for PrepaidStarsGiveaway. +var ( + _ bin.Encoder = &PrepaidStarsGiveaway{} + _ bin.Decoder = &PrepaidStarsGiveaway{} + _ bin.BareEncoder = &PrepaidStarsGiveaway{} + _ bin.BareDecoder = &PrepaidStarsGiveaway{} + + _ PrepaidGiveawayClass = &PrepaidStarsGiveaway{} +) + +func (p *PrepaidStarsGiveaway) Zero() bool { + if p == nil { + return true + } + if !(p.ID == 0) { + return false + } + if !(p.Stars == 0) { + return false + } + if !(p.Quantity == 0) { + return false + } + if !(p.Boosts == 0) { + return false + } + if !(p.Date == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *PrepaidStarsGiveaway) String() string { + if p == nil { + return "PrepaidStarsGiveaway(nil)" + } + type Alias PrepaidStarsGiveaway + return fmt.Sprintf("PrepaidStarsGiveaway%+v", Alias(*p)) +} + +// FillFrom fills PrepaidStarsGiveaway from given interface. +func (p *PrepaidStarsGiveaway) FillFrom(from interface { + GetID() (value int64) + GetStars() (value int64) + GetQuantity() (value int) + GetBoosts() (value int) + GetDate() (value int) +}) { + p.ID = from.GetID() + p.Stars = from.GetStars() + p.Quantity = from.GetQuantity() + p.Boosts = from.GetBoosts() + p.Date = from.GetDate() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PrepaidStarsGiveaway) TypeID() uint32 { + return PrepaidStarsGiveawayTypeID +} + +// TypeName returns name of type in TL schema. +func (*PrepaidStarsGiveaway) TypeName() string { + return "prepaidStarsGiveaway" +} + +// TypeInfo returns info about TL type. +func (p *PrepaidStarsGiveaway) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "prepaidStarsGiveaway", + ID: PrepaidStarsGiveawayTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ID", + SchemaName: "id", + }, + { + Name: "Stars", + SchemaName: "stars", + }, + { + Name: "Quantity", + SchemaName: "quantity", + }, + { + Name: "Boosts", + SchemaName: "boosts", + }, + { + Name: "Date", + SchemaName: "date", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *PrepaidStarsGiveaway) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode prepaidStarsGiveaway#9a9d77e0 as nil") + } + b.PutID(PrepaidStarsGiveawayTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PrepaidStarsGiveaway) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode prepaidStarsGiveaway#9a9d77e0 as nil") + } + b.PutLong(p.ID) + b.PutLong(p.Stars) + b.PutInt(p.Quantity) + b.PutInt(p.Boosts) + b.PutInt(p.Date) + return nil +} + +// Decode implements bin.Decoder. +func (p *PrepaidStarsGiveaway) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode prepaidStarsGiveaway#9a9d77e0 to nil") + } + if err := b.ConsumeID(PrepaidStarsGiveawayTypeID); err != nil { + return fmt.Errorf("unable to decode prepaidStarsGiveaway#9a9d77e0: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PrepaidStarsGiveaway) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode prepaidStarsGiveaway#9a9d77e0 to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode prepaidStarsGiveaway#9a9d77e0: field id: %w", err) + } + p.ID = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode prepaidStarsGiveaway#9a9d77e0: field stars: %w", err) + } + p.Stars = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode prepaidStarsGiveaway#9a9d77e0: field quantity: %w", err) + } + p.Quantity = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode prepaidStarsGiveaway#9a9d77e0: field boosts: %w", err) + } + p.Boosts = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode prepaidStarsGiveaway#9a9d77e0: field date: %w", err) + } + p.Date = value + } + return nil +} + +// GetID returns value of ID field. +func (p *PrepaidStarsGiveaway) GetID() (value int64) { + if p == nil { + return + } + return p.ID +} + +// GetStars returns value of Stars field. +func (p *PrepaidStarsGiveaway) GetStars() (value int64) { + if p == nil { + return + } + return p.Stars +} + +// GetQuantity returns value of Quantity field. +func (p *PrepaidStarsGiveaway) GetQuantity() (value int) { + if p == nil { + return + } + return p.Quantity +} + +// GetBoosts returns value of Boosts field. +func (p *PrepaidStarsGiveaway) GetBoosts() (value int) { + if p == nil { + return + } + return p.Boosts +} + +// GetDate returns value of Date field. +func (p *PrepaidStarsGiveaway) GetDate() (value int) { + if p == nil { + return + } + return p.Date +} + +// PrepaidGiveawayClassName is schema name of PrepaidGiveawayClass. +const PrepaidGiveawayClassName = "PrepaidGiveaway" + +// PrepaidGiveawayClass represents PrepaidGiveaway generic type. +// +// See https://core.telegram.org/type/PrepaidGiveaway for reference. +// +// Example: +// +// g, err := tg.DecodePrepaidGiveaway(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tg.PrepaidGiveaway: // prepaidGiveaway#b2539d54 +// case *tg.PrepaidStarsGiveaway: // prepaidStarsGiveaway#9a9d77e0 +// default: panic(v) +// } +type PrepaidGiveawayClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() PrepaidGiveawayClass + + // TypeID returns type id in TL schema. + // + // See https://core.telegram.org/mtproto/TL-tl#remarks. + TypeID() uint32 + // TypeName returns name of type in TL schema. + TypeName() string + // String implements fmt.Stringer. + String() string + // Zero returns true if current object has a zero value. + Zero() bool + + // Prepaid giveaway ID. + GetID() (value int64) + + // Number of given away Telegram Premium¹ subscriptions. + // + // Links: + // 1) https://core.telegram.org/api/premium + GetQuantity() (value int) + + // Payment date. + GetDate() (value int) +} + +// DecodePrepaidGiveaway implements binary de-serialization for PrepaidGiveawayClass. +func DecodePrepaidGiveaway(buf *bin.Buffer) (PrepaidGiveawayClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case PrepaidGiveawayTypeID: + // Decoding prepaidGiveaway#b2539d54. + v := PrepaidGiveaway{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PrepaidGiveawayClass: %w", err) + } + return &v, nil + case PrepaidStarsGiveawayTypeID: + // Decoding prepaidStarsGiveaway#9a9d77e0. + v := PrepaidStarsGiveaway{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PrepaidGiveawayClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode PrepaidGiveawayClass: %w", bin.NewUnexpectedID(id)) + } +} + +// PrepaidGiveaway boxes the PrepaidGiveawayClass providing a helper. +type PrepaidGiveawayBox struct { + PrepaidGiveaway PrepaidGiveawayClass +} + +// Decode implements bin.Decoder for PrepaidGiveawayBox. +func (b *PrepaidGiveawayBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode PrepaidGiveawayBox to nil") + } + v, err := DecodePrepaidGiveaway(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.PrepaidGiveaway = v + return nil +} + +// Encode implements bin.Encode for PrepaidGiveawayBox. +func (b *PrepaidGiveawayBox) Encode(buf *bin.Buffer) error { + if b == nil || b.PrepaidGiveaway == nil { + return fmt.Errorf("unable to encode PrepaidGiveawayClass as nil") + } + return b.PrepaidGiveaway.Encode(buf) +} diff --git a/vendor/github.com/gotd/td/tg/tl_prepaid_giveaway_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_prepaid_giveaway_slices_gen.go index fe21471a..b9db13ec 100644 --- a/vendor/github.com/gotd/td/tg/tl_prepaid_giveaway_slices_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_prepaid_giveaway_slices_gen.go @@ -33,3 +33,423 @@ var ( _ = tgerr.Error{} _ = tdjson.Encoder{} ) + +// PrepaidGiveawayClassArray is adapter for slice of PrepaidGiveawayClass. +type PrepaidGiveawayClassArray []PrepaidGiveawayClass + +// Sort sorts slice of PrepaidGiveawayClass. +func (s PrepaidGiveawayClassArray) Sort(less func(a, b PrepaidGiveawayClass) bool) PrepaidGiveawayClassArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of PrepaidGiveawayClass. +func (s PrepaidGiveawayClassArray) SortStable(less func(a, b PrepaidGiveawayClass) bool) PrepaidGiveawayClassArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of PrepaidGiveawayClass. +func (s PrepaidGiveawayClassArray) Retain(keep func(x PrepaidGiveawayClass) bool) PrepaidGiveawayClassArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s PrepaidGiveawayClassArray) First() (v PrepaidGiveawayClass, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s PrepaidGiveawayClassArray) Last() (v PrepaidGiveawayClass, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *PrepaidGiveawayClassArray) PopFirst() (v PrepaidGiveawayClass, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero PrepaidGiveawayClass + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *PrepaidGiveawayClassArray) Pop() (v PrepaidGiveawayClass, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// SortByID sorts slice of PrepaidGiveawayClass by ID. +func (s PrepaidGiveawayClassArray) SortByID() PrepaidGiveawayClassArray { + return s.Sort(func(a, b PrepaidGiveawayClass) bool { + return a.GetID() < b.GetID() + }) +} + +// SortStableByID sorts slice of PrepaidGiveawayClass by ID. +func (s PrepaidGiveawayClassArray) SortStableByID() PrepaidGiveawayClassArray { + return s.SortStable(func(a, b PrepaidGiveawayClass) bool { + return a.GetID() < b.GetID() + }) +} + +// SortByDate sorts slice of PrepaidGiveawayClass by Date. +func (s PrepaidGiveawayClassArray) SortByDate() PrepaidGiveawayClassArray { + return s.Sort(func(a, b PrepaidGiveawayClass) bool { + return a.GetDate() < b.GetDate() + }) +} + +// SortStableByDate sorts slice of PrepaidGiveawayClass by Date. +func (s PrepaidGiveawayClassArray) SortStableByDate() PrepaidGiveawayClassArray { + return s.SortStable(func(a, b PrepaidGiveawayClass) bool { + return a.GetDate() < b.GetDate() + }) +} + +// FillPrepaidGiveawayMap fills only PrepaidGiveaway constructors to given map. +func (s PrepaidGiveawayClassArray) FillPrepaidGiveawayMap(to map[int64]*PrepaidGiveaway) { + for _, elem := range s { + value, ok := elem.(*PrepaidGiveaway) + if !ok { + continue + } + to[value.GetID()] = value + } +} + +// PrepaidGiveawayToMap collects only PrepaidGiveaway constructors to map. +func (s PrepaidGiveawayClassArray) PrepaidGiveawayToMap() map[int64]*PrepaidGiveaway { + r := make(map[int64]*PrepaidGiveaway, len(s)) + s.FillPrepaidGiveawayMap(r) + return r +} + +// AsPrepaidGiveaway returns copy with only PrepaidGiveaway constructors. +func (s PrepaidGiveawayClassArray) AsPrepaidGiveaway() (to PrepaidGiveawayArray) { + for _, elem := range s { + value, ok := elem.(*PrepaidGiveaway) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// FillPrepaidStarsGiveawayMap fills only PrepaidStarsGiveaway constructors to given map. +func (s PrepaidGiveawayClassArray) FillPrepaidStarsGiveawayMap(to map[int64]*PrepaidStarsGiveaway) { + for _, elem := range s { + value, ok := elem.(*PrepaidStarsGiveaway) + if !ok { + continue + } + to[value.GetID()] = value + } +} + +// PrepaidStarsGiveawayToMap collects only PrepaidStarsGiveaway constructors to map. +func (s PrepaidGiveawayClassArray) PrepaidStarsGiveawayToMap() map[int64]*PrepaidStarsGiveaway { + r := make(map[int64]*PrepaidStarsGiveaway, len(s)) + s.FillPrepaidStarsGiveawayMap(r) + return r +} + +// AsPrepaidStarsGiveaway returns copy with only PrepaidStarsGiveaway constructors. +func (s PrepaidGiveawayClassArray) AsPrepaidStarsGiveaway() (to PrepaidStarsGiveawayArray) { + for _, elem := range s { + value, ok := elem.(*PrepaidStarsGiveaway) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// PrepaidGiveawayArray is adapter for slice of PrepaidGiveaway. +type PrepaidGiveawayArray []PrepaidGiveaway + +// Sort sorts slice of PrepaidGiveaway. +func (s PrepaidGiveawayArray) Sort(less func(a, b PrepaidGiveaway) bool) PrepaidGiveawayArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of PrepaidGiveaway. +func (s PrepaidGiveawayArray) SortStable(less func(a, b PrepaidGiveaway) bool) PrepaidGiveawayArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of PrepaidGiveaway. +func (s PrepaidGiveawayArray) Retain(keep func(x PrepaidGiveaway) bool) PrepaidGiveawayArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s PrepaidGiveawayArray) First() (v PrepaidGiveaway, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s PrepaidGiveawayArray) Last() (v PrepaidGiveaway, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *PrepaidGiveawayArray) PopFirst() (v PrepaidGiveaway, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero PrepaidGiveaway + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *PrepaidGiveawayArray) Pop() (v PrepaidGiveaway, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// SortByID sorts slice of PrepaidGiveaway by ID. +func (s PrepaidGiveawayArray) SortByID() PrepaidGiveawayArray { + return s.Sort(func(a, b PrepaidGiveaway) bool { + return a.GetID() < b.GetID() + }) +} + +// SortStableByID sorts slice of PrepaidGiveaway by ID. +func (s PrepaidGiveawayArray) SortStableByID() PrepaidGiveawayArray { + return s.SortStable(func(a, b PrepaidGiveaway) bool { + return a.GetID() < b.GetID() + }) +} + +// SortByDate sorts slice of PrepaidGiveaway by Date. +func (s PrepaidGiveawayArray) SortByDate() PrepaidGiveawayArray { + return s.Sort(func(a, b PrepaidGiveaway) bool { + return a.GetDate() < b.GetDate() + }) +} + +// SortStableByDate sorts slice of PrepaidGiveaway by Date. +func (s PrepaidGiveawayArray) SortStableByDate() PrepaidGiveawayArray { + return s.SortStable(func(a, b PrepaidGiveaway) bool { + return a.GetDate() < b.GetDate() + }) +} + +// FillMap fills constructors to given map. +func (s PrepaidGiveawayArray) FillMap(to map[int64]PrepaidGiveaway) { + for _, value := range s { + to[value.GetID()] = value + } +} + +// ToMap collects constructors to map. +func (s PrepaidGiveawayArray) ToMap() map[int64]PrepaidGiveaway { + r := make(map[int64]PrepaidGiveaway, len(s)) + s.FillMap(r) + return r +} + +// PrepaidStarsGiveawayArray is adapter for slice of PrepaidStarsGiveaway. +type PrepaidStarsGiveawayArray []PrepaidStarsGiveaway + +// Sort sorts slice of PrepaidStarsGiveaway. +func (s PrepaidStarsGiveawayArray) Sort(less func(a, b PrepaidStarsGiveaway) bool) PrepaidStarsGiveawayArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of PrepaidStarsGiveaway. +func (s PrepaidStarsGiveawayArray) SortStable(less func(a, b PrepaidStarsGiveaway) bool) PrepaidStarsGiveawayArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of PrepaidStarsGiveaway. +func (s PrepaidStarsGiveawayArray) Retain(keep func(x PrepaidStarsGiveaway) bool) PrepaidStarsGiveawayArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s PrepaidStarsGiveawayArray) First() (v PrepaidStarsGiveaway, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s PrepaidStarsGiveawayArray) Last() (v PrepaidStarsGiveaway, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *PrepaidStarsGiveawayArray) PopFirst() (v PrepaidStarsGiveaway, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero PrepaidStarsGiveaway + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *PrepaidStarsGiveawayArray) Pop() (v PrepaidStarsGiveaway, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// SortByID sorts slice of PrepaidStarsGiveaway by ID. +func (s PrepaidStarsGiveawayArray) SortByID() PrepaidStarsGiveawayArray { + return s.Sort(func(a, b PrepaidStarsGiveaway) bool { + return a.GetID() < b.GetID() + }) +} + +// SortStableByID sorts slice of PrepaidStarsGiveaway by ID. +func (s PrepaidStarsGiveawayArray) SortStableByID() PrepaidStarsGiveawayArray { + return s.SortStable(func(a, b PrepaidStarsGiveaway) bool { + return a.GetID() < b.GetID() + }) +} + +// SortByDate sorts slice of PrepaidStarsGiveaway by Date. +func (s PrepaidStarsGiveawayArray) SortByDate() PrepaidStarsGiveawayArray { + return s.Sort(func(a, b PrepaidStarsGiveaway) bool { + return a.GetDate() < b.GetDate() + }) +} + +// SortStableByDate sorts slice of PrepaidStarsGiveaway by Date. +func (s PrepaidStarsGiveawayArray) SortStableByDate() PrepaidStarsGiveawayArray { + return s.SortStable(func(a, b PrepaidStarsGiveaway) bool { + return a.GetDate() < b.GetDate() + }) +} + +// FillMap fills constructors to given map. +func (s PrepaidStarsGiveawayArray) FillMap(to map[int64]PrepaidStarsGiveaway) { + for _, value := range s { + to[value.GetID()] = value + } +} + +// ToMap collects constructors to map. +func (s PrepaidStarsGiveawayArray) ToMap() map[int64]PrepaidStarsGiveaway { + r := make(map[int64]PrepaidStarsGiveaway, len(s)) + s.FillMap(r) + return r +} diff --git a/vendor/github.com/gotd/td/tg/tl_privacy_key_gen.go b/vendor/github.com/gotd/td/tg/tl_privacy_key_gen.go index 7315113f..36cf9dc9 100644 --- a/vendor/github.com/gotd/td/tg/tl_privacy_key_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_privacy_key_gen.go @@ -32,7 +32,20 @@ var ( ) // PrivacyKeyStatusTimestamp represents TL type `privacyKeyStatusTimestamp#bc2eab30`. -// Whether we can see the last online timestamp of this user +// Whether we can see the last online timestamp of this user. +// Note that if we decide to hide our exact last online timestamp to someone (i.e., users +// A, B, C, or all users) and we do not have a Premium¹ subscription, we won't be able +// to see the exact last online timestamp of those users (A, B, C, or all users), even if +// those users do share it with us. +// If those users do share their exact online status with us, but we can't see it due to +// the reason mentioned above, the by_me flag of userStatusRecently¹, +// userStatusLastWeek², userStatusLastMonth³ will be set. +// +// Links: +// 1. https://core.telegram.org/api/premium +// 2. https://core.telegram.org/constructor/userStatusRecently +// 3. https://core.telegram.org/constructor/userStatusLastWeek +// 4. https://core.telegram.org/constructor/userStatusLastMonth // // See https://core.telegram.org/constructor/privacyKeyStatusTimestamp for reference. type PrivacyKeyStatusTimestamp struct { @@ -1055,6 +1068,7 @@ func (p *PrivacyKeyAbout) DecodeBare(b *bin.Buffer) error { } // PrivacyKeyBirthday represents TL type `privacyKeyBirthday#2000a518`. +// Whether the user can see our birthday. // // See https://core.telegram.org/constructor/privacyKeyBirthday for reference. type PrivacyKeyBirthday struct { diff --git a/vendor/github.com/gotd/td/tg/tl_privacy_rule_gen.go b/vendor/github.com/gotd/td/tg/tl_privacy_rule_gen.go index 791ec949..cbf9f6c3 100644 --- a/vendor/github.com/gotd/td/tg/tl_privacy_rule_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_privacy_rule_gen.go @@ -1137,6 +1137,12 @@ func (p *PrivacyValueAllowCloseFriends) DecodeBare(b *bin.Buffer) error { } // PrivacyValueAllowPremium represents TL type `privacyValueAllowPremium#ece9814b`. +// Allow only users with a Premium subscription »¹, currently only usable for +// inputPrivacyKeyChatInvite². +// +// Links: +// 1. https://core.telegram.org/api/premium +// 2. https://core.telegram.org/constructor/inputPrivacyKeyChatInvite // // See https://core.telegram.org/constructor/privacyValueAllowPremium for reference. type PrivacyValueAllowPremium struct { diff --git a/vendor/github.com/gotd/td/tg/tl_quick_reply_gen.go b/vendor/github.com/gotd/td/tg/tl_quick_reply_gen.go index 97859a2e..9f652e57 100644 --- a/vendor/github.com/gotd/td/tg/tl_quick_reply_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_quick_reply_gen.go @@ -32,16 +32,20 @@ var ( ) // QuickReply represents TL type `quickReply#697102b`. +// A quick reply shortcut¹. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts // // See https://core.telegram.org/constructor/quickReply for reference. type QuickReply struct { - // ShortcutID field of QuickReply. + // Unique shortcut ID. ShortcutID int - // Shortcut field of QuickReply. + // Shortcut name. Shortcut string - // TopMessage field of QuickReply. + // ID of the last message in the shortcut. TopMessage int - // Count field of QuickReply. + // Total number of messages in the shortcut. Count int } diff --git a/vendor/github.com/gotd/td/tg/tl_reaction_gen.go b/vendor/github.com/gotd/td/tg/tl_reaction_gen.go index 6cb06234..9bcb445d 100644 --- a/vendor/github.com/gotd/td/tg/tl_reaction_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_reaction_gen.go @@ -409,6 +409,107 @@ func (r *ReactionCustomEmoji) GetDocumentID() (value int64) { return r.DocumentID } +// ReactionPaid represents TL type `reactionPaid#523da4eb`. +// +// See https://core.telegram.org/constructor/reactionPaid for reference. +type ReactionPaid struct { +} + +// ReactionPaidTypeID is TL type id of ReactionPaid. +const ReactionPaidTypeID = 0x523da4eb + +// construct implements constructor of ReactionClass. +func (r ReactionPaid) construct() ReactionClass { return &r } + +// Ensuring interfaces in compile-time for ReactionPaid. +var ( + _ bin.Encoder = &ReactionPaid{} + _ bin.Decoder = &ReactionPaid{} + _ bin.BareEncoder = &ReactionPaid{} + _ bin.BareDecoder = &ReactionPaid{} + + _ ReactionClass = &ReactionPaid{} +) + +func (r *ReactionPaid) Zero() bool { + if r == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (r *ReactionPaid) String() string { + if r == nil { + return "ReactionPaid(nil)" + } + type Alias ReactionPaid + return fmt.Sprintf("ReactionPaid%+v", Alias(*r)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ReactionPaid) TypeID() uint32 { + return ReactionPaidTypeID +} + +// TypeName returns name of type in TL schema. +func (*ReactionPaid) TypeName() string { + return "reactionPaid" +} + +// TypeInfo returns info about TL type. +func (r *ReactionPaid) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "reactionPaid", + ID: ReactionPaidTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (r *ReactionPaid) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reactionPaid#523da4eb as nil") + } + b.PutID(ReactionPaidTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *ReactionPaid) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reactionPaid#523da4eb as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (r *ReactionPaid) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reactionPaid#523da4eb to nil") + } + if err := b.ConsumeID(ReactionPaidTypeID); err != nil { + return fmt.Errorf("unable to decode reactionPaid#523da4eb: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *ReactionPaid) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reactionPaid#523da4eb to nil") + } + return nil +} + // ReactionClassName is schema name of ReactionClass. const ReactionClassName = "Reaction" @@ -426,6 +527,7 @@ const ReactionClassName = "Reaction" // case *tg.ReactionEmpty: // reactionEmpty#79f5d419 // case *tg.ReactionEmoji: // reactionEmoji#1b2286b8 // case *tg.ReactionCustomEmoji: // reactionCustomEmoji#8935fc73 +// case *tg.ReactionPaid: // reactionPaid#523da4eb // default: panic(v) // } type ReactionClass interface { @@ -475,6 +577,13 @@ func DecodeReaction(buf *bin.Buffer) (ReactionClass, error) { return nil, fmt.Errorf("unable to decode ReactionClass: %w", err) } return &v, nil + case ReactionPaidTypeID: + // Decoding reactionPaid#523da4eb. + v := ReactionPaid{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ReactionClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode ReactionClass: %w", bin.NewUnexpectedID(id)) } diff --git a/vendor/github.com/gotd/td/tg/tl_reaction_notifications_from_gen.go b/vendor/github.com/gotd/td/tg/tl_reaction_notifications_from_gen.go index 1f0f312a..6babc34d 100644 --- a/vendor/github.com/gotd/td/tg/tl_reaction_notifications_from_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_reaction_notifications_from_gen.go @@ -32,6 +32,7 @@ var ( ) // ReactionNotificationsFromContacts represents TL type `reactionNotificationsFromContacts#bac3a61a`. +// Receive notifications about reactions made only by our contacts. // // See https://core.telegram.org/constructor/reactionNotificationsFromContacts for reference. type ReactionNotificationsFromContacts struct { @@ -133,6 +134,7 @@ func (r *ReactionNotificationsFromContacts) DecodeBare(b *bin.Buffer) error { } // ReactionNotificationsFromAll represents TL type `reactionNotificationsFromAll#4b9e22a0`. +// Receive notifications about reactions made by any user. // // See https://core.telegram.org/constructor/reactionNotificationsFromAll for reference. type ReactionNotificationsFromAll struct { diff --git a/vendor/github.com/gotd/td/tg/tl_reactions_notify_settings_gen.go b/vendor/github.com/gotd/td/tg/tl_reactions_notify_settings_gen.go index 27254d0d..05ff5daf 100644 --- a/vendor/github.com/gotd/td/tg/tl_reactions_notify_settings_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_reactions_notify_settings_gen.go @@ -32,22 +32,39 @@ var ( ) // ReactionsNotifySettings represents TL type `reactionsNotifySettings#56e34970`. +// Reaction notification settings, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/reactions#notifications-about-reactions // // See https://core.telegram.org/constructor/reactionsNotifySettings for reference. type ReactionsNotifySettings struct { - // Flags field of ReactionsNotifySettings. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // MessagesNotifyFrom field of ReactionsNotifySettings. + // Message reaction notification settings, if not set completely disables + // notifications/updates about message reactions. // // Use SetMessagesNotifyFrom and GetMessagesNotifyFrom helpers. MessagesNotifyFrom ReactionNotificationsFromClass - // StoriesNotifyFrom field of ReactionsNotifySettings. + // Story reaction notification settings, if not set completely disables + // notifications/updates about reactions to stories. // // Use SetStoriesNotifyFrom and GetStoriesNotifyFrom helpers. StoriesNotifyFrom ReactionNotificationsFromClass - // Sound field of ReactionsNotifySettings. + // Notification sound for reactions »¹ + // + // Links: + // 1) https://core.telegram.org/api/ringtones Sound NotificationSoundClass - // ShowPreviews field of ReactionsNotifySettings. + // If false, push notifications »¹ about message/story reactions will only be of type + // REACT_HIDDEN/REACT_STORY_HIDDEN, without any information about the reacted-to story or + // the reaction itself. + // + // Links: + // 1) https://core.telegram.org/api/push-updates ShowPreviews bool } diff --git a/vendor/github.com/gotd/td/tg/tl_registry_gen.go b/vendor/github.com/gotd/td/tg/tl_registry_gen.go index 868d4331..0686b6df 100644 --- a/vendor/github.com/gotd/td/tg/tl_registry_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_registry_gen.go @@ -32,7 +32,7 @@ var ( ) // Layer version of schema. -const Layer = 181 +const Layer = 187 // TypesMap returns mapping from type ids to TL type names. func TypesMap() map[uint32]string { @@ -56,6 +56,7 @@ func TypesMap() map[uint32]string { InputPhoneContactTypeID: "inputPhoneContact#f392b7f4", InputFileTypeID: "inputFile#f52ff27f", InputFileBigTypeID: "inputFileBig#fa4f0bb5", + InputFileStoryDocumentTypeID: "inputFileStoryDocument#62dc8b48", InputMediaEmptyTypeID: "inputMediaEmpty#9664f57f", InputMediaUploadedPhotoTypeID: "inputMediaUploadedPhoto#1e287d04", InputMediaPhotoTypeID: "inputMediaPhoto#b3ba0635", @@ -73,6 +74,7 @@ func TypesMap() map[uint32]string { InputMediaDiceTypeID: "inputMediaDice#e66fbf7b", InputMediaStoryTypeID: "inputMediaStory#89fdd778", InputMediaWebPageTypeID: "inputMediaWebPage#c21b8849", + InputMediaPaidMediaTypeID: "inputMediaPaidMedia#c4103386", InputChatPhotoEmptyTypeID: "inputChatPhotoEmpty#1ca48f57", InputChatUploadedPhotoTypeID: "inputChatUploadedPhoto#bdcdaec0", InputChatPhotoTypeID: "inputChatPhoto#8953ad37", @@ -104,7 +106,7 @@ func TypesMap() map[uint32]string { StorageFileMp4TypeID: "storage.fileMp4#b3cea0e4", StorageFileWebpTypeID: "storage.fileWebp#1081464c", UserEmptyTypeID: "userEmpty#d3bc4b7a", - UserTypeID: "user#215c4438", + UserTypeID: "user#83314fca", UserProfilePhotoEmptyTypeID: "userProfilePhotoEmpty#4f11bae1", UserProfilePhotoTypeID: "userProfilePhoto#82d1f706", UserStatusEmptyTypeID: "userStatusEmpty#9d05049", @@ -116,7 +118,7 @@ func TypesMap() map[uint32]string { ChatEmptyTypeID: "chatEmpty#29562865", ChatTypeID: "chat#41cbf256", ChatForbiddenTypeID: "chatForbidden#6592a1a7", - ChannelTypeID: "channel#aadfc8f", + ChannelTypeID: "channel#fe4478bd", ChannelForbiddenTypeID: "channelForbidden#17d493d5", ChatFullTypeID: "chatFull#2633421b", ChannelFullTypeID: "channelFull#bbab348d", @@ -144,8 +146,9 @@ func TypesMap() map[uint32]string { MessageMediaPollTypeID: "messageMediaPoll#4bd6e798", MessageMediaDiceTypeID: "messageMediaDice#3f7ee58b", MessageMediaStoryTypeID: "messageMediaStory#68cb6283", - MessageMediaGiveawayTypeID: "messageMediaGiveaway#daad85b0", - MessageMediaGiveawayResultsTypeID: "messageMediaGiveawayResults#c6991068", + MessageMediaGiveawayTypeID: "messageMediaGiveaway#aa073beb", + MessageMediaGiveawayResultsTypeID: "messageMediaGiveawayResults#ceaa3ea1", + MessageMediaPaidMediaTypeID: "messageMediaPaidMedia#a8852491", MessageActionEmptyTypeID: "messageActionEmpty#b6aef7b0", MessageActionChatCreateTypeID: "messageActionChatCreate#bd47cbad", MessageActionChatEditTitleTypeID: "messageActionChatEditTitle#b5a1ce5a", @@ -185,10 +188,13 @@ func TypesMap() map[uint32]string { MessageActionRequestedPeerTypeID: "messageActionRequestedPeer#31518e9b", MessageActionSetChatWallPaperTypeID: "messageActionSetChatWallPaper#5060a3f4", MessageActionGiftCodeTypeID: "messageActionGiftCode#678c2e09", - MessageActionGiveawayLaunchTypeID: "messageActionGiveawayLaunch#332ba9ed", - MessageActionGiveawayResultsTypeID: "messageActionGiveawayResults#2a9fadc5", + MessageActionGiveawayLaunchTypeID: "messageActionGiveawayLaunch#a80f51e4", + MessageActionGiveawayResultsTypeID: "messageActionGiveawayResults#87e2f155", MessageActionBoostApplyTypeID: "messageActionBoostApply#cc02aa6d", MessageActionRequestedPeerSentMeTypeID: "messageActionRequestedPeerSentMe#93b31848", + MessageActionPaymentRefundedTypeID: "messageActionPaymentRefunded#41b3e202", + MessageActionGiftStarsTypeID: "messageActionGiftStars#45d5b021", + MessageActionPrizeStarsTypeID: "messageActionPrizeStars#b00c47a2", DialogTypeID: "dialog#d58a08c6", DialogFolderTypeID: "dialogFolder#71bd134c", PhotoEmptyTypeID: "photoEmpty#2331b22d", @@ -369,7 +375,7 @@ func TypesMap() map[uint32]string { UpdateRecentEmojiStatusesTypeID: "updateRecentEmojiStatuses#30f443db", UpdateRecentReactionsTypeID: "updateRecentReactions#6f7863f4", UpdateMoveStickerSetToTopTypeID: "updateMoveStickerSetToTop#86fccf85", - UpdateMessageExtendedMediaTypeID: "updateMessageExtendedMedia#5a73a98c", + UpdateMessageExtendedMediaTypeID: "updateMessageExtendedMedia#d5a41724", UpdateChannelPinnedTopicTypeID: "updateChannelPinnedTopic#192efbe3", UpdateChannelPinnedTopicsTypeID: "updateChannelPinnedTopics#fe198602", UpdateUserTypeID: "updateUser#20529438", @@ -400,6 +406,10 @@ func TypesMap() map[uint32]string { UpdateNewStoryReactionTypeID: "updateNewStoryReaction#1824e40b", UpdateBroadcastRevenueTransactionsTypeID: "updateBroadcastRevenueTransactions#dfd961f5", UpdateStarsBalanceTypeID: "updateStarsBalance#fb85198", + UpdateBusinessBotCallbackQueryTypeID: "updateBusinessBotCallbackQuery#1ea2fda7", + UpdateStarsRevenueStatusTypeID: "updateStarsRevenueStatus#a584b019", + UpdateBotPurchasedPaidMediaTypeID: "updateBotPurchasedPaidMedia#283bd312", + UpdatePaidReactionPrivacyTypeID: "updatePaidReactionPrivacy#51ca7aec", UpdatesStateTypeID: "updates.state#a56c2a3e", UpdatesDifferenceEmptyTypeID: "updates.differenceEmpty#5d75a138", UpdatesDifferenceTypeID: "updates.difference#f49ca0", @@ -517,7 +527,7 @@ func TypesMap() map[uint32]string { DocumentAttributeImageSizeTypeID: "documentAttributeImageSize#6c37c15c", DocumentAttributeAnimatedTypeID: "documentAttributeAnimated#11b58939", DocumentAttributeStickerTypeID: "documentAttributeSticker#6319d612", - DocumentAttributeVideoTypeID: "documentAttributeVideo#d38ff1c2", + DocumentAttributeVideoTypeID: "documentAttributeVideo#17399fad", DocumentAttributeAudioTypeID: "documentAttributeAudio#9852f9c6", DocumentAttributeFilenameTypeID: "documentAttributeFilename#15590068", DocumentAttributeHasStickersTypeID: "documentAttributeHasStickers#9801d2f7", @@ -539,10 +549,10 @@ func TypesMap() map[uint32]string { AccountPasswordInputSettingsTypeID: "account.passwordInputSettings#c23727c9", AuthPasswordRecoveryTypeID: "auth.passwordRecovery#137948a5", ReceivedNotifyMessageTypeID: "receivedNotifyMessage#a384b779", - ChatInviteExportedTypeID: "chatInviteExported#ab4a819", + ChatInviteExportedTypeID: "chatInviteExported#a22cbd96", ChatInvitePublicJoinRequestsTypeID: "chatInvitePublicJoinRequests#ed107ab7", ChatInviteAlreadyTypeID: "chatInviteAlready#5a686d7c", - ChatInviteTypeID: "chatInvite#cde0ec40", + ChatInviteTypeID: "chatInvite#fe65389d", ChatInvitePeekTypeID: "chatInvitePeek#61695cb0", InputStickerSetEmptyTypeID: "inputStickerSetEmpty#ffb62b95", InputStickerSetIDTypeID: "inputStickerSetID#9de7a269", @@ -559,7 +569,7 @@ func TypesMap() map[uint32]string { MessagesStickerSetTypeID: "messages.stickerSet#6e153f16", MessagesStickerSetNotModifiedTypeID: "messages.stickerSetNotModified#d3f924eb", BotCommandTypeID: "botCommand#c27ac8c7", - BotInfoTypeID: "botInfo#8f300b57", + BotInfoTypeID: "botInfo#82437e74", KeyboardButtonTypeID: "keyboardButton#a2fa4880", KeyboardButtonURLTypeID: "keyboardButtonUrl#258aff05", KeyboardButtonCallbackTypeID: "keyboardButtonCallback#35bbdb6b", @@ -613,8 +623,8 @@ func TypesMap() map[uint32]string { UpdatesChannelDifferenceTypeID: "updates.channelDifference#2064674e", ChannelMessagesFilterEmptyTypeID: "channelMessagesFilterEmpty#94d42ee7", ChannelMessagesFilterTypeID: "channelMessagesFilter#cd77d957", - ChannelParticipantTypeID: "channelParticipant#c00c07c0", - ChannelParticipantSelfTypeID: "channelParticipantSelf#35a8bfa7", + ChannelParticipantTypeID: "channelParticipant#cb397619", + ChannelParticipantSelfTypeID: "channelParticipantSelf#4f607bef", ChannelParticipantCreatorTypeID: "channelParticipantCreator#2fe601d3", ChannelParticipantAdminTypeID: "channelParticipantAdmin#34c3bb53", ChannelParticipantBannedTypeID: "channelParticipantBanned#6df8014e", @@ -670,7 +680,7 @@ func TypesMap() map[uint32]string { AuthSentCodeTypeEmailCodeTypeID: "auth.sentCodeTypeEmailCode#f450f59b", AuthSentCodeTypeSetUpEmailRequiredTypeID: "auth.sentCodeTypeSetUpEmailRequired#a5491dea", AuthSentCodeTypeFragmentSMSTypeID: "auth.sentCodeTypeFragmentSms#d9565c39", - AuthSentCodeTypeFirebaseSMSTypeID: "auth.sentCodeTypeFirebaseSms#13c90f17", + AuthSentCodeTypeFirebaseSMSTypeID: "auth.sentCodeTypeFirebaseSms#9fd736", AuthSentCodeTypeSMSWordTypeID: "auth.sentCodeTypeSmsWord#a416ac81", AuthSentCodeTypeSMSPhraseTypeID: "auth.sentCodeTypeSmsPhrase#b37794af", MessagesBotCallbackAnswerTypeID: "messages.botCallbackAnswer#36585ea4", @@ -688,12 +698,13 @@ func TypesMap() map[uint32]string { TopPeerCategoryPhoneCallsTypeID: "topPeerCategoryPhoneCalls#1e76a78c", TopPeerCategoryForwardUsersTypeID: "topPeerCategoryForwardUsers#a8406ca9", TopPeerCategoryForwardChatsTypeID: "topPeerCategoryForwardChats#fbeec0f0", + TopPeerCategoryBotsAppTypeID: "topPeerCategoryBotsApp#fd9e7bec", TopPeerCategoryPeersTypeID: "topPeerCategoryPeers#fb834291", ContactsTopPeersNotModifiedTypeID: "contacts.topPeersNotModified#de266ef5", ContactsTopPeersTypeID: "contacts.topPeers#70b772a8", ContactsTopPeersDisabledTypeID: "contacts.topPeersDisabled#b52c939d", DraftMessageEmptyTypeID: "draftMessageEmpty#1b0c841a", - DraftMessageTypeID: "draftMessage#3fccf7ef", + DraftMessageTypeID: "draftMessage#2d65321f", MessagesFeaturedStickersNotModifiedTypeID: "messages.featuredStickersNotModified#c6dc0c66", MessagesFeaturedStickersTypeID: "messages.featuredStickers#be382906", MessagesRecentStickersNotModifiedTypeID: "messages.recentStickersNotModified#b17f890", @@ -859,6 +870,8 @@ func TypesMap() map[uint32]string { ChannelAdminLogEventActionChangeWallpaperTypeID: "channelAdminLogEventActionChangeWallpaper#31bb5d52", ChannelAdminLogEventActionChangeEmojiStatusTypeID: "channelAdminLogEventActionChangeEmojiStatus#3ea9feb1", ChannelAdminLogEventActionChangeEmojiStickerSetTypeID: "channelAdminLogEventActionChangeEmojiStickerSet#46d840ab", + ChannelAdminLogEventActionToggleSignatureProfilesTypeID: "channelAdminLogEventActionToggleSignatureProfiles#60a79c79", + ChannelAdminLogEventActionParticipantSubExtendTypeID: "channelAdminLogEventActionParticipantSubExtend#64642db3", ChannelAdminLogEventTypeID: "channelAdminLogEvent#1fad68cd", ChannelsAdminLogResultsTypeID: "channels.adminLogResults#ed8af74d", ChannelAdminLogEventsFilterTypeID: "channelAdminLogEventsFilter#ea107ae4", @@ -1087,7 +1100,7 @@ func TypesMap() map[uint32]string { AccountResetPasswordFailedWaitTypeID: "account.resetPasswordFailedWait#e3779861", AccountResetPasswordRequestedWaitTypeID: "account.resetPasswordRequestedWait#e9effc7d", AccountResetPasswordOkTypeID: "account.resetPasswordOk#e926d63e", - SponsoredMessageTypeID: "sponsoredMessage#bdedf566", + SponsoredMessageTypeID: "sponsoredMessage#4d93a990", MessagesSponsoredMessagesTypeID: "messages.sponsoredMessages#c9ee1d87", MessagesSponsoredMessagesEmptyTypeID: "messages.sponsoredMessagesEmpty#1839490f", SearchResultsCalendarPeriodTypeID: "searchResultsCalendarPeriod#c9b0539f", @@ -1099,7 +1112,7 @@ func TypesMap() map[uint32]string { MessagesPeerSettingsTypeID: "messages.peerSettings#6880b94d", AuthLoggedOutTypeID: "auth.loggedOut#c3a2835f", ReactionCountTypeID: "reactionCount#a3d1cb80", - MessageReactionsTypeID: "messageReactions#4f2b9479", + MessageReactionsTypeID: "messageReactions#a339f0b", MessagesMessageReactionsListTypeID: "messages.messageReactionsList#31bd492d", AvailableReactionTypeID: "availableReaction#c077ec01", MessagesAvailableReactionsNotModifiedTypeID: "messages.availableReactionsNotModified#9f071957", @@ -1114,8 +1127,7 @@ func TypesMap() map[uint32]string { AttachMenuBotsNotModifiedTypeID: "attachMenuBotsNotModified#f1d88a5c", AttachMenuBotsTypeID: "attachMenuBots#3c4301c0", AttachMenuBotsBotTypeID: "attachMenuBotsBot#93bf667f", - WebViewResultURLTypeID: "webViewResultUrl#c14557c", - SimpleWebViewResultURLTypeID: "simpleWebViewResultUrl#882f76bb", + WebViewResultURLTypeID: "webViewResultUrl#4d22ff98", WebViewMessageSentTypeID: "webViewMessageSent#c94511c", BotMenuButtonDefaultTypeID: "botMenuButtonDefault#7533a588", BotMenuButtonCommandsTypeID: "botMenuButtonCommands#4258c205", @@ -1136,7 +1148,8 @@ func TypesMap() map[uint32]string { InputInvoiceMessageTypeID: "inputInvoiceMessage#c5b56859", InputInvoiceSlugTypeID: "inputInvoiceSlug#c326caef", InputInvoicePremiumGiftCodeTypeID: "inputInvoicePremiumGiftCode#98986c0d", - InputInvoiceStarsTypeID: "inputInvoiceStars#1da33ad8", + InputInvoiceStarsTypeID: "inputInvoiceStars#65f00ce3", + InputInvoiceChatInviteSubscriptionTypeID: "inputInvoiceChatInviteSubscription#34e793f1", PaymentsExportedInvoiceTypeID: "payments.exportedInvoice#aed0cbd9", MessagesTranscribedAudioTypeID: "messages.transcribedAudio#cfb9d957", HelpPremiumPromoTypeID: "help.premiumPromo#5334759c", @@ -1144,7 +1157,9 @@ func TypesMap() map[uint32]string { InputStorePaymentGiftPremiumTypeID: "inputStorePaymentGiftPremium#616f7fe8", InputStorePaymentPremiumGiftCodeTypeID: "inputStorePaymentPremiumGiftCode#a3805f3f", InputStorePaymentPremiumGiveawayTypeID: "inputStorePaymentPremiumGiveaway#160544ca", - InputStorePaymentStarsTypeID: "inputStorePaymentStars#4f0ee8df", + InputStorePaymentStarsTopupTypeID: "inputStorePaymentStarsTopup#dddd0f56", + InputStorePaymentStarsGiftTypeID: "inputStorePaymentStarsGift#1d741ef7", + InputStorePaymentStarsGiveawayTypeID: "inputStorePaymentStarsGiveaway#751f08fa", PremiumGiftOptionTypeID: "premiumGiftOption#74c34319", PaymentFormMethodTypeID: "paymentFormMethod#88f8f21b", EmojiStatusEmptyTypeID: "emojiStatusEmpty#2de11aae", @@ -1155,6 +1170,7 @@ func TypesMap() map[uint32]string { ReactionEmptyTypeID: "reactionEmpty#79f5d419", ReactionEmojiTypeID: "reactionEmoji#1b2286b8", ReactionCustomEmojiTypeID: "reactionCustomEmoji#8935fc73", + ReactionPaidTypeID: "reactionPaid#523da4eb", ChatReactionsNoneTypeID: "chatReactionsNone#eafc32bc", ChatReactionsAllTypeID: "chatReactionsAll#52928bca", ChatReactionsSomeTypeID: "chatReactionsSome#661d4037", @@ -1201,7 +1217,6 @@ func TypesMap() map[uint32]string { BotAppNotModifiedTypeID: "botAppNotModified#5da674b7", BotAppTypeID: "botApp#95fcd1d6", MessagesBotAppTypeID: "messages.botApp#eb50adf5", - AppWebViewResultURLTypeID: "appWebViewResultUrl#3c1b4f0d", InlineBotWebViewTypeID: "inlineBotWebView#b57295d5", ReadParticipantDateTypeID: "readParticipantDate#4a4ff172", InputChatlistDialogFilterTypeID: "inputChatlistDialogFilter#f3e0da33", @@ -1231,22 +1246,25 @@ func TypesMap() map[uint32]string { InputReplyToStoryTypeID: "inputReplyToStory#5881323a", ExportedStoryLinkTypeID: "exportedStoryLink#3fc9053b", StoriesStealthModeTypeID: "storiesStealthMode#712e27fd", - MediaAreaCoordinatesTypeID: "mediaAreaCoordinates#3d1ea4e", + MediaAreaCoordinatesTypeID: "mediaAreaCoordinates#cfc9e002", MediaAreaVenueTypeID: "mediaAreaVenue#be82db9c", InputMediaAreaVenueTypeID: "inputMediaAreaVenue#b282217f", - MediaAreaGeoPointTypeID: "mediaAreaGeoPoint#df8b3b22", + MediaAreaGeoPointTypeID: "mediaAreaGeoPoint#cad5452d", MediaAreaSuggestedReactionTypeID: "mediaAreaSuggestedReaction#14455871", MediaAreaChannelPostTypeID: "mediaAreaChannelPost#770416af", InputMediaAreaChannelPostTypeID: "inputMediaAreaChannelPost#2271f2bf", + MediaAreaURLTypeID: "mediaAreaUrl#37381085", + MediaAreaWeatherTypeID: "mediaAreaWeather#49a6549c", PeerStoriesTypeID: "peerStories#9a35e999", StoriesPeerStoriesTypeID: "stories.peerStories#cae68768", MessagesWebPageTypeID: "messages.webPage#fd5e12bd", PremiumGiftCodeOptionTypeID: "premiumGiftCodeOption#257e962b", PaymentsCheckedGiftCodeTypeID: "payments.checkedGiftCode#284a1096", PaymentsGiveawayInfoTypeID: "payments.giveawayInfo#4367daa0", - PaymentsGiveawayInfoResultsTypeID: "payments.giveawayInfoResults#cd5570", + PaymentsGiveawayInfoResultsTypeID: "payments.giveawayInfoResults#e175e66f", PrepaidGiveawayTypeID: "prepaidGiveaway#b2539d54", - BoostTypeID: "boost#2a1c8c71", + PrepaidStarsGiveawayTypeID: "prepaidStarsGiveaway#9a9d77e0", + BoostTypeID: "boost#4b3e14d6", PremiumBoostsListTypeID: "premium.boostsList#86f8613c", MyBoostTypeID: "myBoost#c448415c", PremiumMyBoostsTypeID: "premium.myBoosts#9ae228e2", @@ -1336,7 +1354,7 @@ func TypesMap() map[uint32]string { ReactionNotificationsFromContactsTypeID: "reactionNotificationsFromContacts#bac3a61a", ReactionNotificationsFromAllTypeID: "reactionNotificationsFromAll#4b9e22a0", ReactionsNotifySettingsTypeID: "reactionsNotifySettings#56e34970", - BroadcastRevenueBalancesTypeID: "broadcastRevenueBalances#8438f1c6", + BroadcastRevenueBalancesTypeID: "broadcastRevenueBalances#c3ff71e7", AvailableEffectTypeID: "availableEffect#93c3e27e", MessagesAvailableEffectsNotModifiedTypeID: "messages.availableEffectsNotModified#d1ed9a5b", MessagesAvailableEffectsTypeID: "messages.availableEffects#bddb616e", @@ -1347,9 +1365,27 @@ func TypesMap() map[uint32]string { StarsTransactionPeerPremiumBotTypeID: "starsTransactionPeerPremiumBot#250dbaf8", StarsTransactionPeerFragmentTypeID: "starsTransactionPeerFragment#e92fd902", StarsTransactionPeerTypeID: "starsTransactionPeer#d80da15d", + StarsTransactionPeerAdsTypeID: "starsTransactionPeerAds#60682812", StarsTopupOptionTypeID: "starsTopupOption#bd915c0", - StarsTransactionTypeID: "starsTransaction#cc7079b2", - PaymentsStarsStatusTypeID: "payments.starsStatus#8cf4ee60", + StarsTransactionTypeID: "starsTransaction#ee7522d5", + PaymentsStarsStatusTypeID: "payments.starsStatus#bbfa316c", + FoundStoryTypeID: "foundStory#e87acbc0", + StoriesFoundStoriesTypeID: "stories.foundStories#e2de7737", + GeoPointAddressTypeID: "geoPointAddress#de4c5d93", + StarsRevenueStatusTypeID: "starsRevenueStatus#79342946", + PaymentsStarsRevenueStatsTypeID: "payments.starsRevenueStats#c92bb73b", + PaymentsStarsRevenueWithdrawalURLTypeID: "payments.starsRevenueWithdrawalUrl#1dab80b7", + PaymentsStarsRevenueAdsAccountURLTypeID: "payments.starsRevenueAdsAccountUrl#394e7f21", + InputStarsTransactionTypeID: "inputStarsTransaction#206ae6d1", + StarsGiftOptionTypeID: "starsGiftOption#5e0589f1", + BotsPopularAppBotsTypeID: "bots.popularAppBots#1991b13b", + BotPreviewMediaTypeID: "botPreviewMedia#23e91ba3", + BotsPreviewInfoTypeID: "bots.previewInfo#ca71d64", + StarsSubscriptionPricingTypeID: "starsSubscriptionPricing#5416d58", + StarsSubscriptionTypeID: "starsSubscription#538ecf18", + MessageReactorTypeID: "messageReactor#4ba3a95a", + StarsGiveawayOptionTypeID: "starsGiveawayOption#94ce852a", + StarsGiveawayWinnersOptionTypeID: "starsGiveawayWinnersOption#54236209", InvokeAfterMsgRequestTypeID: "invokeAfterMsg#cb9f372d", InvokeAfterMsgsRequestTypeID: "invokeAfterMsgs#3dc4b4f0", InitConnectionRequestTypeID: "initConnection#c1cd5ea9", @@ -1562,7 +1598,7 @@ func TypesMap() map[uint32]string { MessagesGetStickersRequestTypeID: "messages.getStickers#d5a5d3a1", MessagesGetAllStickersRequestTypeID: "messages.getAllStickers#b8a0a1a8", MessagesGetWebPagePreviewRequestTypeID: "messages.getWebPagePreview#8b68b0cc", - MessagesExportChatInviteRequestTypeID: "messages.exportChatInvite#a02ce5d5", + MessagesExportChatInviteRequestTypeID: "messages.exportChatInvite#a455de90", MessagesCheckChatInviteRequestTypeID: "messages.checkChatInvite#3eadb1bb", MessagesImportChatInviteRequestTypeID: "messages.importChatInvite#6c50051c", MessagesGetStickerSetRequestTypeID: "messages.getStickerSet#c8a0ec74", @@ -1586,7 +1622,7 @@ func TypesMap() map[uint32]string { MessagesGetBotCallbackAnswerRequestTypeID: "messages.getBotCallbackAnswer#9342ca07", MessagesSetBotCallbackAnswerRequestTypeID: "messages.setBotCallbackAnswer#d58f130a", MessagesGetPeerDialogsRequestTypeID: "messages.getPeerDialogs#e470bcfd", - MessagesSaveDraftRequestTypeID: "messages.saveDraft#7ff3b806", + MessagesSaveDraftRequestTypeID: "messages.saveDraft#d372c5ce", MessagesGetAllDraftsRequestTypeID: "messages.getAllDrafts#6a3f8d65", MessagesGetFeaturedStickersRequestTypeID: "messages.getFeaturedStickers#64780b14", MessagesReadFeaturedStickersRequestTypeID: "messages.readFeaturedStickers#5b118126", @@ -1676,7 +1712,7 @@ func TypesMap() map[uint32]string { MessagesSendReactionRequestTypeID: "messages.sendReaction#d30d78d4", MessagesGetMessagesReactionsRequestTypeID: "messages.getMessagesReactions#8bba90e6", MessagesGetMessageReactionsListRequestTypeID: "messages.getMessageReactionsList#461b3f48", - MessagesSetChatAvailableReactionsRequestTypeID: "messages.setChatAvailableReactions#5a150bd4", + MessagesSetChatAvailableReactionsRequestTypeID: "messages.setChatAvailableReactions#864b2581", MessagesGetAvailableReactionsRequestTypeID: "messages.getAvailableReactions#18dea0ac", MessagesSetDefaultReactionRequestTypeID: "messages.setDefaultReaction#4f47a016", MessagesTranslateTextRequestTypeID: "messages.translateText#63183030", @@ -1688,7 +1724,7 @@ func TypesMap() map[uint32]string { MessagesToggleBotInAttachMenuRequestTypeID: "messages.toggleBotInAttachMenu#69f59d69", MessagesRequestWebViewRequestTypeID: "messages.requestWebView#269dc2c1", MessagesProlongWebViewRequestTypeID: "messages.prolongWebView#b0d81a83", - MessagesRequestSimpleWebViewRequestTypeID: "messages.requestSimpleWebView#1a46500a", + MessagesRequestSimpleWebViewRequestTypeID: "messages.requestSimpleWebView#413a3e73", MessagesSendWebViewResultMessageRequestTypeID: "messages.sendWebViewResultMessage#a4314f5", MessagesSendWebViewDataRequestTypeID: "messages.sendWebViewData#dc0242c8", MessagesTranscribeAudioRequestTypeID: "messages.transcribeAudio#269e9a49", @@ -1710,7 +1746,7 @@ func TypesMap() map[uint32]string { MessagesSearchCustomEmojiRequestTypeID: "messages.searchCustomEmoji#2c11c0d7", MessagesTogglePeerTranslationsRequestTypeID: "messages.togglePeerTranslations#e47cb579", MessagesGetBotAppRequestTypeID: "messages.getBotApp#34fdc5c3", - MessagesRequestAppWebViewRequestTypeID: "messages.requestAppWebView#8c5a3b3c", + MessagesRequestAppWebViewRequestTypeID: "messages.requestAppWebView#53618bce", MessagesSetChatWallPaperRequestTypeID: "messages.setChatWallPaper#8ffacae1", MessagesSearchEmojiStickerSetsRequestTypeID: "messages.searchEmojiStickerSets#92b4494c", MessagesGetSavedDialogsRequestTypeID: "messages.getSavedDialogs#5381d21a", @@ -1738,6 +1774,10 @@ func TypesMap() map[uint32]string { MessagesEditFactCheckRequestTypeID: "messages.editFactCheck#589ee75", MessagesDeleteFactCheckRequestTypeID: "messages.deleteFactCheck#d1da940c", MessagesGetFactCheckRequestTypeID: "messages.getFactCheck#b9cdc5ee", + MessagesRequestMainWebViewRequestTypeID: "messages.requestMainWebView#c9e01e7b", + MessagesSendPaidReactionRequestTypeID: "messages.sendPaidReaction#9dd6a67b", + MessagesTogglePaidReactionPrivacyRequestTypeID: "messages.togglePaidReactionPrivacy#849ad397", + MessagesGetPaidReactionPrivacyRequestTypeID: "messages.getPaidReactionPrivacy#472455aa", UpdatesGetStateRequestTypeID: "updates.getState#edd4882a", UpdatesGetDifferenceRequestTypeID: "updates.getDifference#19c2f763", UpdatesGetChannelDifferenceRequestTypeID: "updates.getChannelDifference#3173d78", @@ -1798,7 +1838,7 @@ func TypesMap() map[uint32]string { ChannelsInviteToChannelRequestTypeID: "channels.inviteToChannel#c9e33d54", ChannelsDeleteChannelRequestTypeID: "channels.deleteChannel#c0111fe3", ChannelsExportMessageLinkRequestTypeID: "channels.exportMessageLink#e63fadeb", - ChannelsToggleSignaturesRequestTypeID: "channels.toggleSignatures#1f69b606", + ChannelsToggleSignaturesRequestTypeID: "channels.toggleSignatures#418d549c", ChannelsGetAdminedPublicChannelsRequestTypeID: "channels.getAdminedPublicChannels#f8b036af", ChannelsEditBannedRequestTypeID: "channels.editBanned#96e6cd81", ChannelsGetAdminLogRequestTypeID: "channels.getAdminLog#33ddf480", @@ -1860,6 +1900,13 @@ func TypesMap() map[uint32]string { BotsCanSendMessageRequestTypeID: "bots.canSendMessage#1359f4e6", BotsAllowSendMessageRequestTypeID: "bots.allowSendMessage#f132e3ef", BotsInvokeWebViewCustomMethodRequestTypeID: "bots.invokeWebViewCustomMethod#87fc5e7", + BotsGetPopularAppBotsRequestTypeID: "bots.getPopularAppBots#c2510192", + BotsAddPreviewMediaRequestTypeID: "bots.addPreviewMedia#17aeb75a", + BotsEditPreviewMediaRequestTypeID: "bots.editPreviewMedia#8525606f", + BotsDeletePreviewMediaRequestTypeID: "bots.deletePreviewMedia#2d0135b3", + BotsReorderPreviewMediasRequestTypeID: "bots.reorderPreviewMedias#b627f3aa", + BotsGetPreviewInfoRequestTypeID: "bots.getPreviewInfo#423ab3ad", + BotsGetPreviewMediasRequestTypeID: "bots.getPreviewMedias#a2a5594d", PaymentsGetPaymentFormRequestTypeID: "payments.getPaymentForm#37148dbb", PaymentsGetPaymentReceiptRequestTypeID: "payments.getPaymentReceipt#2478d1cc", PaymentsValidateRequestedInfoRequestTypeID: "payments.validateRequestedInfo#b6c8f12b", @@ -1878,9 +1925,18 @@ func TypesMap() map[uint32]string { PaymentsLaunchPrepaidGiveawayRequestTypeID: "payments.launchPrepaidGiveaway#5ff58f20", PaymentsGetStarsTopupOptionsRequestTypeID: "payments.getStarsTopupOptions#c00ec7d3", PaymentsGetStarsStatusRequestTypeID: "payments.getStarsStatus#104fcfa7", - PaymentsGetStarsTransactionsRequestTypeID: "payments.getStarsTransactions#673ac2f9", + PaymentsGetStarsTransactionsRequestTypeID: "payments.getStarsTransactions#69da4557", PaymentsSendStarsFormRequestTypeID: "payments.sendStarsForm#2bb731d", PaymentsRefundStarsChargeRequestTypeID: "payments.refundStarsCharge#25ae8f4a", + PaymentsGetStarsRevenueStatsRequestTypeID: "payments.getStarsRevenueStats#d91ffad6", + PaymentsGetStarsRevenueWithdrawalURLRequestTypeID: "payments.getStarsRevenueWithdrawalUrl#13bbe8b3", + PaymentsGetStarsRevenueAdsAccountURLRequestTypeID: "payments.getStarsRevenueAdsAccountUrl#d1d7efc5", + PaymentsGetStarsTransactionsByIDRequestTypeID: "payments.getStarsTransactionsByID#27842d2e", + PaymentsGetStarsGiftOptionsRequestTypeID: "payments.getStarsGiftOptions#d3c96bc8", + PaymentsGetStarsSubscriptionsRequestTypeID: "payments.getStarsSubscriptions#32512c5", + PaymentsChangeStarsSubscriptionRequestTypeID: "payments.changeStarsSubscription#c7770878", + PaymentsFulfillStarsSubscriptionRequestTypeID: "payments.fulfillStarsSubscription#cc5bebb3", + PaymentsGetStarsGiveawayOptionsRequestTypeID: "payments.getStarsGiveawayOptions#bd1efd3e", StickersCreateStickerSetRequestTypeID: "stickers.createStickerSet#9021ab67", StickersRemoveStickerFromSetRequestTypeID: "stickers.removeStickerFromSet#f7760f51", StickersChangeStickerPositionRequestTypeID: "stickers.changeStickerPosition#ffb6d4ca", @@ -1975,6 +2031,7 @@ func TypesMap() map[uint32]string { StoriesTogglePeerStoriesHiddenRequestTypeID: "stories.togglePeerStoriesHidden#bd0415c4", StoriesGetStoryReactionsListRequestTypeID: "stories.getStoryReactionsList#b9b2881f", StoriesTogglePinnedToTopRequestTypeID: "stories.togglePinnedToTop#b297e9b", + StoriesSearchPostsRequestTypeID: "stories.searchPosts#6cea116a", PremiumGetBoostsListRequestTypeID: "premium.getBoostsList#60f67660", PremiumGetMyBoostsRequestTypeID: "premium.getMyBoosts#be77b4a", PremiumApplyBoostRequestTypeID: "premium.applyBoost#6b7da746", @@ -2026,6 +2083,7 @@ func NamesMap() map[string]uint32 { "inputPhoneContact": InputPhoneContactTypeID, "inputFile": InputFileTypeID, "inputFileBig": InputFileBigTypeID, + "inputFileStoryDocument": InputFileStoryDocumentTypeID, "inputMediaEmpty": InputMediaEmptyTypeID, "inputMediaUploadedPhoto": InputMediaUploadedPhotoTypeID, "inputMediaPhoto": InputMediaPhotoTypeID, @@ -2043,6 +2101,7 @@ func NamesMap() map[string]uint32 { "inputMediaDice": InputMediaDiceTypeID, "inputMediaStory": InputMediaStoryTypeID, "inputMediaWebPage": InputMediaWebPageTypeID, + "inputMediaPaidMedia": InputMediaPaidMediaTypeID, "inputChatPhotoEmpty": InputChatPhotoEmptyTypeID, "inputChatUploadedPhoto": InputChatUploadedPhotoTypeID, "inputChatPhoto": InputChatPhotoTypeID, @@ -2116,6 +2175,7 @@ func NamesMap() map[string]uint32 { "messageMediaStory": MessageMediaStoryTypeID, "messageMediaGiveaway": MessageMediaGiveawayTypeID, "messageMediaGiveawayResults": MessageMediaGiveawayResultsTypeID, + "messageMediaPaidMedia": MessageMediaPaidMediaTypeID, "messageActionEmpty": MessageActionEmptyTypeID, "messageActionChatCreate": MessageActionChatCreateTypeID, "messageActionChatEditTitle": MessageActionChatEditTitleTypeID, @@ -2159,6 +2219,9 @@ func NamesMap() map[string]uint32 { "messageActionGiveawayResults": MessageActionGiveawayResultsTypeID, "messageActionBoostApply": MessageActionBoostApplyTypeID, "messageActionRequestedPeerSentMe": MessageActionRequestedPeerSentMeTypeID, + "messageActionPaymentRefunded": MessageActionPaymentRefundedTypeID, + "messageActionGiftStars": MessageActionGiftStarsTypeID, + "messageActionPrizeStars": MessageActionPrizeStarsTypeID, "dialog": DialogTypeID, "dialogFolder": DialogFolderTypeID, "photoEmpty": PhotoEmptyTypeID, @@ -2370,6 +2433,10 @@ func NamesMap() map[string]uint32 { "updateNewStoryReaction": UpdateNewStoryReactionTypeID, "updateBroadcastRevenueTransactions": UpdateBroadcastRevenueTransactionsTypeID, "updateStarsBalance": UpdateStarsBalanceTypeID, + "updateBusinessBotCallbackQuery": UpdateBusinessBotCallbackQueryTypeID, + "updateStarsRevenueStatus": UpdateStarsRevenueStatusTypeID, + "updateBotPurchasedPaidMedia": UpdateBotPurchasedPaidMediaTypeID, + "updatePaidReactionPrivacy": UpdatePaidReactionPrivacyTypeID, "updates.state": UpdatesStateTypeID, "updates.differenceEmpty": UpdatesDifferenceEmptyTypeID, "updates.difference": UpdatesDifferenceTypeID, @@ -2658,6 +2725,7 @@ func NamesMap() map[string]uint32 { "topPeerCategoryPhoneCalls": TopPeerCategoryPhoneCallsTypeID, "topPeerCategoryForwardUsers": TopPeerCategoryForwardUsersTypeID, "topPeerCategoryForwardChats": TopPeerCategoryForwardChatsTypeID, + "topPeerCategoryBotsApp": TopPeerCategoryBotsAppTypeID, "topPeerCategoryPeers": TopPeerCategoryPeersTypeID, "contacts.topPeersNotModified": ContactsTopPeersNotModifiedTypeID, "contacts.topPeers": ContactsTopPeersTypeID, @@ -2829,6 +2897,8 @@ func NamesMap() map[string]uint32 { "channelAdminLogEventActionChangeWallpaper": ChannelAdminLogEventActionChangeWallpaperTypeID, "channelAdminLogEventActionChangeEmojiStatus": ChannelAdminLogEventActionChangeEmojiStatusTypeID, "channelAdminLogEventActionChangeEmojiStickerSet": ChannelAdminLogEventActionChangeEmojiStickerSetTypeID, + "channelAdminLogEventActionToggleSignatureProfiles": ChannelAdminLogEventActionToggleSignatureProfilesTypeID, + "channelAdminLogEventActionParticipantSubExtend": ChannelAdminLogEventActionParticipantSubExtendTypeID, "channelAdminLogEvent": ChannelAdminLogEventTypeID, "channels.adminLogResults": ChannelsAdminLogResultsTypeID, "channelAdminLogEventsFilter": ChannelAdminLogEventsFilterTypeID, @@ -3085,7 +3155,6 @@ func NamesMap() map[string]uint32 { "attachMenuBots": AttachMenuBotsTypeID, "attachMenuBotsBot": AttachMenuBotsBotTypeID, "webViewResultUrl": WebViewResultURLTypeID, - "simpleWebViewResultUrl": SimpleWebViewResultURLTypeID, "webViewMessageSent": WebViewMessageSentTypeID, "botMenuButtonDefault": BotMenuButtonDefaultTypeID, "botMenuButtonCommands": BotMenuButtonCommandsTypeID, @@ -3107,6 +3176,7 @@ func NamesMap() map[string]uint32 { "inputInvoiceSlug": InputInvoiceSlugTypeID, "inputInvoicePremiumGiftCode": InputInvoicePremiumGiftCodeTypeID, "inputInvoiceStars": InputInvoiceStarsTypeID, + "inputInvoiceChatInviteSubscription": InputInvoiceChatInviteSubscriptionTypeID, "payments.exportedInvoice": PaymentsExportedInvoiceTypeID, "messages.transcribedAudio": MessagesTranscribedAudioTypeID, "help.premiumPromo": HelpPremiumPromoTypeID, @@ -3114,7 +3184,9 @@ func NamesMap() map[string]uint32 { "inputStorePaymentGiftPremium": InputStorePaymentGiftPremiumTypeID, "inputStorePaymentPremiumGiftCode": InputStorePaymentPremiumGiftCodeTypeID, "inputStorePaymentPremiumGiveaway": InputStorePaymentPremiumGiveawayTypeID, - "inputStorePaymentStars": InputStorePaymentStarsTypeID, + "inputStorePaymentStarsTopup": InputStorePaymentStarsTopupTypeID, + "inputStorePaymentStarsGift": InputStorePaymentStarsGiftTypeID, + "inputStorePaymentStarsGiveaway": InputStorePaymentStarsGiveawayTypeID, "premiumGiftOption": PremiumGiftOptionTypeID, "paymentFormMethod": PaymentFormMethodTypeID, "emojiStatusEmpty": EmojiStatusEmptyTypeID, @@ -3125,6 +3197,7 @@ func NamesMap() map[string]uint32 { "reactionEmpty": ReactionEmptyTypeID, "reactionEmoji": ReactionEmojiTypeID, "reactionCustomEmoji": ReactionCustomEmojiTypeID, + "reactionPaid": ReactionPaidTypeID, "chatReactionsNone": ChatReactionsNoneTypeID, "chatReactionsAll": ChatReactionsAllTypeID, "chatReactionsSome": ChatReactionsSomeTypeID, @@ -3171,7 +3244,6 @@ func NamesMap() map[string]uint32 { "botAppNotModified": BotAppNotModifiedTypeID, "botApp": BotAppTypeID, "messages.botApp": MessagesBotAppTypeID, - "appWebViewResultUrl": AppWebViewResultURLTypeID, "inlineBotWebView": InlineBotWebViewTypeID, "readParticipantDate": ReadParticipantDateTypeID, "inputChatlistDialogFilter": InputChatlistDialogFilterTypeID, @@ -3208,6 +3280,8 @@ func NamesMap() map[string]uint32 { "mediaAreaSuggestedReaction": MediaAreaSuggestedReactionTypeID, "mediaAreaChannelPost": MediaAreaChannelPostTypeID, "inputMediaAreaChannelPost": InputMediaAreaChannelPostTypeID, + "mediaAreaUrl": MediaAreaURLTypeID, + "mediaAreaWeather": MediaAreaWeatherTypeID, "peerStories": PeerStoriesTypeID, "stories.peerStories": StoriesPeerStoriesTypeID, "messages.webPage": MessagesWebPageTypeID, @@ -3216,6 +3290,7 @@ func NamesMap() map[string]uint32 { "payments.giveawayInfo": PaymentsGiveawayInfoTypeID, "payments.giveawayInfoResults": PaymentsGiveawayInfoResultsTypeID, "prepaidGiveaway": PrepaidGiveawayTypeID, + "prepaidStarsGiveaway": PrepaidStarsGiveawayTypeID, "boost": BoostTypeID, "premium.boostsList": PremiumBoostsListTypeID, "myBoost": MyBoostTypeID, @@ -3317,9 +3392,27 @@ func NamesMap() map[string]uint32 { "starsTransactionPeerPremiumBot": StarsTransactionPeerPremiumBotTypeID, "starsTransactionPeerFragment": StarsTransactionPeerFragmentTypeID, "starsTransactionPeer": StarsTransactionPeerTypeID, + "starsTransactionPeerAds": StarsTransactionPeerAdsTypeID, "starsTopupOption": StarsTopupOptionTypeID, "starsTransaction": StarsTransactionTypeID, "payments.starsStatus": PaymentsStarsStatusTypeID, + "foundStory": FoundStoryTypeID, + "stories.foundStories": StoriesFoundStoriesTypeID, + "geoPointAddress": GeoPointAddressTypeID, + "starsRevenueStatus": StarsRevenueStatusTypeID, + "payments.starsRevenueStats": PaymentsStarsRevenueStatsTypeID, + "payments.starsRevenueWithdrawalUrl": PaymentsStarsRevenueWithdrawalURLTypeID, + "payments.starsRevenueAdsAccountUrl": PaymentsStarsRevenueAdsAccountURLTypeID, + "inputStarsTransaction": InputStarsTransactionTypeID, + "starsGiftOption": StarsGiftOptionTypeID, + "bots.popularAppBots": BotsPopularAppBotsTypeID, + "botPreviewMedia": BotPreviewMediaTypeID, + "bots.previewInfo": BotsPreviewInfoTypeID, + "starsSubscriptionPricing": StarsSubscriptionPricingTypeID, + "starsSubscription": StarsSubscriptionTypeID, + "messageReactor": MessageReactorTypeID, + "starsGiveawayOption": StarsGiveawayOptionTypeID, + "starsGiveawayWinnersOption": StarsGiveawayWinnersOptionTypeID, "invokeAfterMsg": InvokeAfterMsgRequestTypeID, "invokeAfterMsgs": InvokeAfterMsgsRequestTypeID, "initConnection": InitConnectionRequestTypeID, @@ -3708,6 +3801,10 @@ func NamesMap() map[string]uint32 { "messages.editFactCheck": MessagesEditFactCheckRequestTypeID, "messages.deleteFactCheck": MessagesDeleteFactCheckRequestTypeID, "messages.getFactCheck": MessagesGetFactCheckRequestTypeID, + "messages.requestMainWebView": MessagesRequestMainWebViewRequestTypeID, + "messages.sendPaidReaction": MessagesSendPaidReactionRequestTypeID, + "messages.togglePaidReactionPrivacy": MessagesTogglePaidReactionPrivacyRequestTypeID, + "messages.getPaidReactionPrivacy": MessagesGetPaidReactionPrivacyRequestTypeID, "updates.getState": UpdatesGetStateRequestTypeID, "updates.getDifference": UpdatesGetDifferenceRequestTypeID, "updates.getChannelDifference": UpdatesGetChannelDifferenceRequestTypeID, @@ -3830,6 +3927,13 @@ func NamesMap() map[string]uint32 { "bots.canSendMessage": BotsCanSendMessageRequestTypeID, "bots.allowSendMessage": BotsAllowSendMessageRequestTypeID, "bots.invokeWebViewCustomMethod": BotsInvokeWebViewCustomMethodRequestTypeID, + "bots.getPopularAppBots": BotsGetPopularAppBotsRequestTypeID, + "bots.addPreviewMedia": BotsAddPreviewMediaRequestTypeID, + "bots.editPreviewMedia": BotsEditPreviewMediaRequestTypeID, + "bots.deletePreviewMedia": BotsDeletePreviewMediaRequestTypeID, + "bots.reorderPreviewMedias": BotsReorderPreviewMediasRequestTypeID, + "bots.getPreviewInfo": BotsGetPreviewInfoRequestTypeID, + "bots.getPreviewMedias": BotsGetPreviewMediasRequestTypeID, "payments.getPaymentForm": PaymentsGetPaymentFormRequestTypeID, "payments.getPaymentReceipt": PaymentsGetPaymentReceiptRequestTypeID, "payments.validateRequestedInfo": PaymentsValidateRequestedInfoRequestTypeID, @@ -3851,6 +3955,15 @@ func NamesMap() map[string]uint32 { "payments.getStarsTransactions": PaymentsGetStarsTransactionsRequestTypeID, "payments.sendStarsForm": PaymentsSendStarsFormRequestTypeID, "payments.refundStarsCharge": PaymentsRefundStarsChargeRequestTypeID, + "payments.getStarsRevenueStats": PaymentsGetStarsRevenueStatsRequestTypeID, + "payments.getStarsRevenueWithdrawalUrl": PaymentsGetStarsRevenueWithdrawalURLRequestTypeID, + "payments.getStarsRevenueAdsAccountUrl": PaymentsGetStarsRevenueAdsAccountURLRequestTypeID, + "payments.getStarsTransactionsByID": PaymentsGetStarsTransactionsByIDRequestTypeID, + "payments.getStarsGiftOptions": PaymentsGetStarsGiftOptionsRequestTypeID, + "payments.getStarsSubscriptions": PaymentsGetStarsSubscriptionsRequestTypeID, + "payments.changeStarsSubscription": PaymentsChangeStarsSubscriptionRequestTypeID, + "payments.fulfillStarsSubscription": PaymentsFulfillStarsSubscriptionRequestTypeID, + "payments.getStarsGiveawayOptions": PaymentsGetStarsGiveawayOptionsRequestTypeID, "stickers.createStickerSet": StickersCreateStickerSetRequestTypeID, "stickers.removeStickerFromSet": StickersRemoveStickerFromSetRequestTypeID, "stickers.changeStickerPosition": StickersChangeStickerPositionRequestTypeID, @@ -3945,6 +4058,7 @@ func NamesMap() map[string]uint32 { "stories.togglePeerStoriesHidden": StoriesTogglePeerStoriesHiddenRequestTypeID, "stories.getStoryReactionsList": StoriesGetStoryReactionsListRequestTypeID, "stories.togglePinnedToTop": StoriesTogglePinnedToTopRequestTypeID, + "stories.searchPosts": StoriesSearchPostsRequestTypeID, "premium.getBoostsList": PremiumGetBoostsListRequestTypeID, "premium.getMyBoosts": PremiumGetMyBoostsRequestTypeID, "premium.applyBoost": PremiumApplyBoostRequestTypeID, @@ -3996,6 +4110,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InputPhoneContactTypeID: func() bin.Object { return &InputPhoneContact{} }, InputFileTypeID: func() bin.Object { return &InputFile{} }, InputFileBigTypeID: func() bin.Object { return &InputFileBig{} }, + InputFileStoryDocumentTypeID: func() bin.Object { return &InputFileStoryDocument{} }, InputMediaEmptyTypeID: func() bin.Object { return &InputMediaEmpty{} }, InputMediaUploadedPhotoTypeID: func() bin.Object { return &InputMediaUploadedPhoto{} }, InputMediaPhotoTypeID: func() bin.Object { return &InputMediaPhoto{} }, @@ -4013,6 +4128,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InputMediaDiceTypeID: func() bin.Object { return &InputMediaDice{} }, InputMediaStoryTypeID: func() bin.Object { return &InputMediaStory{} }, InputMediaWebPageTypeID: func() bin.Object { return &InputMediaWebPage{} }, + InputMediaPaidMediaTypeID: func() bin.Object { return &InputMediaPaidMedia{} }, InputChatPhotoEmptyTypeID: func() bin.Object { return &InputChatPhotoEmpty{} }, InputChatUploadedPhotoTypeID: func() bin.Object { return &InputChatUploadedPhoto{} }, InputChatPhotoTypeID: func() bin.Object { return &InputChatPhoto{} }, @@ -4086,6 +4202,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessageMediaStoryTypeID: func() bin.Object { return &MessageMediaStory{} }, MessageMediaGiveawayTypeID: func() bin.Object { return &MessageMediaGiveaway{} }, MessageMediaGiveawayResultsTypeID: func() bin.Object { return &MessageMediaGiveawayResults{} }, + MessageMediaPaidMediaTypeID: func() bin.Object { return &MessageMediaPaidMedia{} }, MessageActionEmptyTypeID: func() bin.Object { return &MessageActionEmpty{} }, MessageActionChatCreateTypeID: func() bin.Object { return &MessageActionChatCreate{} }, MessageActionChatEditTitleTypeID: func() bin.Object { return &MessageActionChatEditTitle{} }, @@ -4129,6 +4246,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessageActionGiveawayResultsTypeID: func() bin.Object { return &MessageActionGiveawayResults{} }, MessageActionBoostApplyTypeID: func() bin.Object { return &MessageActionBoostApply{} }, MessageActionRequestedPeerSentMeTypeID: func() bin.Object { return &MessageActionRequestedPeerSentMe{} }, + MessageActionPaymentRefundedTypeID: func() bin.Object { return &MessageActionPaymentRefunded{} }, + MessageActionGiftStarsTypeID: func() bin.Object { return &MessageActionGiftStars{} }, + MessageActionPrizeStarsTypeID: func() bin.Object { return &MessageActionPrizeStars{} }, DialogTypeID: func() bin.Object { return &Dialog{} }, DialogFolderTypeID: func() bin.Object { return &DialogFolder{} }, PhotoEmptyTypeID: func() bin.Object { return &PhotoEmpty{} }, @@ -4340,6 +4460,10 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateNewStoryReactionTypeID: func() bin.Object { return &UpdateNewStoryReaction{} }, UpdateBroadcastRevenueTransactionsTypeID: func() bin.Object { return &UpdateBroadcastRevenueTransactions{} }, UpdateStarsBalanceTypeID: func() bin.Object { return &UpdateStarsBalance{} }, + UpdateBusinessBotCallbackQueryTypeID: func() bin.Object { return &UpdateBusinessBotCallbackQuery{} }, + UpdateStarsRevenueStatusTypeID: func() bin.Object { return &UpdateStarsRevenueStatus{} }, + UpdateBotPurchasedPaidMediaTypeID: func() bin.Object { return &UpdateBotPurchasedPaidMedia{} }, + UpdatePaidReactionPrivacyTypeID: func() bin.Object { return &UpdatePaidReactionPrivacy{} }, UpdatesStateTypeID: func() bin.Object { return &UpdatesState{} }, UpdatesDifferenceEmptyTypeID: func() bin.Object { return &UpdatesDifferenceEmpty{} }, UpdatesDifferenceTypeID: func() bin.Object { return &UpdatesDifference{} }, @@ -4628,6 +4752,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { TopPeerCategoryPhoneCallsTypeID: func() bin.Object { return &TopPeerCategoryPhoneCalls{} }, TopPeerCategoryForwardUsersTypeID: func() bin.Object { return &TopPeerCategoryForwardUsers{} }, TopPeerCategoryForwardChatsTypeID: func() bin.Object { return &TopPeerCategoryForwardChats{} }, + TopPeerCategoryBotsAppTypeID: func() bin.Object { return &TopPeerCategoryBotsApp{} }, TopPeerCategoryPeersTypeID: func() bin.Object { return &TopPeerCategoryPeers{} }, ContactsTopPeersNotModifiedTypeID: func() bin.Object { return &ContactsTopPeersNotModified{} }, ContactsTopPeersTypeID: func() bin.Object { return &ContactsTopPeers{} }, @@ -4799,6 +4924,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChannelAdminLogEventActionChangeWallpaperTypeID: func() bin.Object { return &ChannelAdminLogEventActionChangeWallpaper{} }, ChannelAdminLogEventActionChangeEmojiStatusTypeID: func() bin.Object { return &ChannelAdminLogEventActionChangeEmojiStatus{} }, ChannelAdminLogEventActionChangeEmojiStickerSetTypeID: func() bin.Object { return &ChannelAdminLogEventActionChangeEmojiStickerSet{} }, + ChannelAdminLogEventActionToggleSignatureProfilesTypeID: func() bin.Object { return &ChannelAdminLogEventActionToggleSignatureProfiles{} }, + ChannelAdminLogEventActionParticipantSubExtendTypeID: func() bin.Object { return &ChannelAdminLogEventActionParticipantSubExtend{} }, ChannelAdminLogEventTypeID: func() bin.Object { return &ChannelAdminLogEvent{} }, ChannelsAdminLogResultsTypeID: func() bin.Object { return &ChannelsAdminLogResults{} }, ChannelAdminLogEventsFilterTypeID: func() bin.Object { return &ChannelAdminLogEventsFilter{} }, @@ -5055,7 +5182,6 @@ func TypesConstructorMap() map[uint32]func() bin.Object { AttachMenuBotsTypeID: func() bin.Object { return &AttachMenuBots{} }, AttachMenuBotsBotTypeID: func() bin.Object { return &AttachMenuBotsBot{} }, WebViewResultURLTypeID: func() bin.Object { return &WebViewResultURL{} }, - SimpleWebViewResultURLTypeID: func() bin.Object { return &SimpleWebViewResultURL{} }, WebViewMessageSentTypeID: func() bin.Object { return &WebViewMessageSent{} }, BotMenuButtonDefaultTypeID: func() bin.Object { return &BotMenuButtonDefault{} }, BotMenuButtonCommandsTypeID: func() bin.Object { return &BotMenuButtonCommands{} }, @@ -5077,6 +5203,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InputInvoiceSlugTypeID: func() bin.Object { return &InputInvoiceSlug{} }, InputInvoicePremiumGiftCodeTypeID: func() bin.Object { return &InputInvoicePremiumGiftCode{} }, InputInvoiceStarsTypeID: func() bin.Object { return &InputInvoiceStars{} }, + InputInvoiceChatInviteSubscriptionTypeID: func() bin.Object { return &InputInvoiceChatInviteSubscription{} }, PaymentsExportedInvoiceTypeID: func() bin.Object { return &PaymentsExportedInvoice{} }, MessagesTranscribedAudioTypeID: func() bin.Object { return &MessagesTranscribedAudio{} }, HelpPremiumPromoTypeID: func() bin.Object { return &HelpPremiumPromo{} }, @@ -5084,7 +5211,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InputStorePaymentGiftPremiumTypeID: func() bin.Object { return &InputStorePaymentGiftPremium{} }, InputStorePaymentPremiumGiftCodeTypeID: func() bin.Object { return &InputStorePaymentPremiumGiftCode{} }, InputStorePaymentPremiumGiveawayTypeID: func() bin.Object { return &InputStorePaymentPremiumGiveaway{} }, - InputStorePaymentStarsTypeID: func() bin.Object { return &InputStorePaymentStars{} }, + InputStorePaymentStarsTopupTypeID: func() bin.Object { return &InputStorePaymentStarsTopup{} }, + InputStorePaymentStarsGiftTypeID: func() bin.Object { return &InputStorePaymentStarsGift{} }, + InputStorePaymentStarsGiveawayTypeID: func() bin.Object { return &InputStorePaymentStarsGiveaway{} }, PremiumGiftOptionTypeID: func() bin.Object { return &PremiumGiftOption{} }, PaymentFormMethodTypeID: func() bin.Object { return &PaymentFormMethod{} }, EmojiStatusEmptyTypeID: func() bin.Object { return &EmojiStatusEmpty{} }, @@ -5095,6 +5224,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ReactionEmptyTypeID: func() bin.Object { return &ReactionEmpty{} }, ReactionEmojiTypeID: func() bin.Object { return &ReactionEmoji{} }, ReactionCustomEmojiTypeID: func() bin.Object { return &ReactionCustomEmoji{} }, + ReactionPaidTypeID: func() bin.Object { return &ReactionPaid{} }, ChatReactionsNoneTypeID: func() bin.Object { return &ChatReactionsNone{} }, ChatReactionsAllTypeID: func() bin.Object { return &ChatReactionsAll{} }, ChatReactionsSomeTypeID: func() bin.Object { return &ChatReactionsSome{} }, @@ -5141,7 +5271,6 @@ func TypesConstructorMap() map[uint32]func() bin.Object { BotAppNotModifiedTypeID: func() bin.Object { return &BotAppNotModified{} }, BotAppTypeID: func() bin.Object { return &BotApp{} }, MessagesBotAppTypeID: func() bin.Object { return &MessagesBotApp{} }, - AppWebViewResultURLTypeID: func() bin.Object { return &AppWebViewResultURL{} }, InlineBotWebViewTypeID: func() bin.Object { return &InlineBotWebView{} }, ReadParticipantDateTypeID: func() bin.Object { return &ReadParticipantDate{} }, InputChatlistDialogFilterTypeID: func() bin.Object { return &InputChatlistDialogFilter{} }, @@ -5178,6 +5307,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MediaAreaSuggestedReactionTypeID: func() bin.Object { return &MediaAreaSuggestedReaction{} }, MediaAreaChannelPostTypeID: func() bin.Object { return &MediaAreaChannelPost{} }, InputMediaAreaChannelPostTypeID: func() bin.Object { return &InputMediaAreaChannelPost{} }, + MediaAreaURLTypeID: func() bin.Object { return &MediaAreaURL{} }, + MediaAreaWeatherTypeID: func() bin.Object { return &MediaAreaWeather{} }, PeerStoriesTypeID: func() bin.Object { return &PeerStories{} }, StoriesPeerStoriesTypeID: func() bin.Object { return &StoriesPeerStories{} }, MessagesWebPageTypeID: func() bin.Object { return &MessagesWebPage{} }, @@ -5186,6 +5317,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PaymentsGiveawayInfoTypeID: func() bin.Object { return &PaymentsGiveawayInfo{} }, PaymentsGiveawayInfoResultsTypeID: func() bin.Object { return &PaymentsGiveawayInfoResults{} }, PrepaidGiveawayTypeID: func() bin.Object { return &PrepaidGiveaway{} }, + PrepaidStarsGiveawayTypeID: func() bin.Object { return &PrepaidStarsGiveaway{} }, BoostTypeID: func() bin.Object { return &Boost{} }, PremiumBoostsListTypeID: func() bin.Object { return &PremiumBoostsList{} }, MyBoostTypeID: func() bin.Object { return &MyBoost{} }, @@ -5287,9 +5419,27 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StarsTransactionPeerPremiumBotTypeID: func() bin.Object { return &StarsTransactionPeerPremiumBot{} }, StarsTransactionPeerFragmentTypeID: func() bin.Object { return &StarsTransactionPeerFragment{} }, StarsTransactionPeerTypeID: func() bin.Object { return &StarsTransactionPeer{} }, + StarsTransactionPeerAdsTypeID: func() bin.Object { return &StarsTransactionPeerAds{} }, StarsTopupOptionTypeID: func() bin.Object { return &StarsTopupOption{} }, StarsTransactionTypeID: func() bin.Object { return &StarsTransaction{} }, PaymentsStarsStatusTypeID: func() bin.Object { return &PaymentsStarsStatus{} }, + FoundStoryTypeID: func() bin.Object { return &FoundStory{} }, + StoriesFoundStoriesTypeID: func() bin.Object { return &StoriesFoundStories{} }, + GeoPointAddressTypeID: func() bin.Object { return &GeoPointAddress{} }, + StarsRevenueStatusTypeID: func() bin.Object { return &StarsRevenueStatus{} }, + PaymentsStarsRevenueStatsTypeID: func() bin.Object { return &PaymentsStarsRevenueStats{} }, + PaymentsStarsRevenueWithdrawalURLTypeID: func() bin.Object { return &PaymentsStarsRevenueWithdrawalURL{} }, + PaymentsStarsRevenueAdsAccountURLTypeID: func() bin.Object { return &PaymentsStarsRevenueAdsAccountURL{} }, + InputStarsTransactionTypeID: func() bin.Object { return &InputStarsTransaction{} }, + StarsGiftOptionTypeID: func() bin.Object { return &StarsGiftOption{} }, + BotsPopularAppBotsTypeID: func() bin.Object { return &BotsPopularAppBots{} }, + BotPreviewMediaTypeID: func() bin.Object { return &BotPreviewMedia{} }, + BotsPreviewInfoTypeID: func() bin.Object { return &BotsPreviewInfo{} }, + StarsSubscriptionPricingTypeID: func() bin.Object { return &StarsSubscriptionPricing{} }, + StarsSubscriptionTypeID: func() bin.Object { return &StarsSubscription{} }, + MessageReactorTypeID: func() bin.Object { return &MessageReactor{} }, + StarsGiveawayOptionTypeID: func() bin.Object { return &StarsGiveawayOption{} }, + StarsGiveawayWinnersOptionTypeID: func() bin.Object { return &StarsGiveawayWinnersOption{} }, InvokeAfterMsgRequestTypeID: func() bin.Object { return &InvokeAfterMsgRequest{} }, InvokeAfterMsgsRequestTypeID: func() bin.Object { return &InvokeAfterMsgsRequest{} }, InitConnectionRequestTypeID: func() bin.Object { return &InitConnectionRequest{} }, @@ -5678,6 +5828,10 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessagesEditFactCheckRequestTypeID: func() bin.Object { return &MessagesEditFactCheckRequest{} }, MessagesDeleteFactCheckRequestTypeID: func() bin.Object { return &MessagesDeleteFactCheckRequest{} }, MessagesGetFactCheckRequestTypeID: func() bin.Object { return &MessagesGetFactCheckRequest{} }, + MessagesRequestMainWebViewRequestTypeID: func() bin.Object { return &MessagesRequestMainWebViewRequest{} }, + MessagesSendPaidReactionRequestTypeID: func() bin.Object { return &MessagesSendPaidReactionRequest{} }, + MessagesTogglePaidReactionPrivacyRequestTypeID: func() bin.Object { return &MessagesTogglePaidReactionPrivacyRequest{} }, + MessagesGetPaidReactionPrivacyRequestTypeID: func() bin.Object { return &MessagesGetPaidReactionPrivacyRequest{} }, UpdatesGetStateRequestTypeID: func() bin.Object { return &UpdatesGetStateRequest{} }, UpdatesGetDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetDifferenceRequest{} }, UpdatesGetChannelDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetChannelDifferenceRequest{} }, @@ -5800,6 +5954,13 @@ func TypesConstructorMap() map[uint32]func() bin.Object { BotsCanSendMessageRequestTypeID: func() bin.Object { return &BotsCanSendMessageRequest{} }, BotsAllowSendMessageRequestTypeID: func() bin.Object { return &BotsAllowSendMessageRequest{} }, BotsInvokeWebViewCustomMethodRequestTypeID: func() bin.Object { return &BotsInvokeWebViewCustomMethodRequest{} }, + BotsGetPopularAppBotsRequestTypeID: func() bin.Object { return &BotsGetPopularAppBotsRequest{} }, + BotsAddPreviewMediaRequestTypeID: func() bin.Object { return &BotsAddPreviewMediaRequest{} }, + BotsEditPreviewMediaRequestTypeID: func() bin.Object { return &BotsEditPreviewMediaRequest{} }, + BotsDeletePreviewMediaRequestTypeID: func() bin.Object { return &BotsDeletePreviewMediaRequest{} }, + BotsReorderPreviewMediasRequestTypeID: func() bin.Object { return &BotsReorderPreviewMediasRequest{} }, + BotsGetPreviewInfoRequestTypeID: func() bin.Object { return &BotsGetPreviewInfoRequest{} }, + BotsGetPreviewMediasRequestTypeID: func() bin.Object { return &BotsGetPreviewMediasRequest{} }, PaymentsGetPaymentFormRequestTypeID: func() bin.Object { return &PaymentsGetPaymentFormRequest{} }, PaymentsGetPaymentReceiptRequestTypeID: func() bin.Object { return &PaymentsGetPaymentReceiptRequest{} }, PaymentsValidateRequestedInfoRequestTypeID: func() bin.Object { return &PaymentsValidateRequestedInfoRequest{} }, @@ -5821,6 +5982,15 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PaymentsGetStarsTransactionsRequestTypeID: func() bin.Object { return &PaymentsGetStarsTransactionsRequest{} }, PaymentsSendStarsFormRequestTypeID: func() bin.Object { return &PaymentsSendStarsFormRequest{} }, PaymentsRefundStarsChargeRequestTypeID: func() bin.Object { return &PaymentsRefundStarsChargeRequest{} }, + PaymentsGetStarsRevenueStatsRequestTypeID: func() bin.Object { return &PaymentsGetStarsRevenueStatsRequest{} }, + PaymentsGetStarsRevenueWithdrawalURLRequestTypeID: func() bin.Object { return &PaymentsGetStarsRevenueWithdrawalURLRequest{} }, + PaymentsGetStarsRevenueAdsAccountURLRequestTypeID: func() bin.Object { return &PaymentsGetStarsRevenueAdsAccountURLRequest{} }, + PaymentsGetStarsTransactionsByIDRequestTypeID: func() bin.Object { return &PaymentsGetStarsTransactionsByIDRequest{} }, + PaymentsGetStarsGiftOptionsRequestTypeID: func() bin.Object { return &PaymentsGetStarsGiftOptionsRequest{} }, + PaymentsGetStarsSubscriptionsRequestTypeID: func() bin.Object { return &PaymentsGetStarsSubscriptionsRequest{} }, + PaymentsChangeStarsSubscriptionRequestTypeID: func() bin.Object { return &PaymentsChangeStarsSubscriptionRequest{} }, + PaymentsFulfillStarsSubscriptionRequestTypeID: func() bin.Object { return &PaymentsFulfillStarsSubscriptionRequest{} }, + PaymentsGetStarsGiveawayOptionsRequestTypeID: func() bin.Object { return &PaymentsGetStarsGiveawayOptionsRequest{} }, StickersCreateStickerSetRequestTypeID: func() bin.Object { return &StickersCreateStickerSetRequest{} }, StickersRemoveStickerFromSetRequestTypeID: func() bin.Object { return &StickersRemoveStickerFromSetRequest{} }, StickersChangeStickerPositionRequestTypeID: func() bin.Object { return &StickersChangeStickerPositionRequest{} }, @@ -5915,6 +6085,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StoriesTogglePeerStoriesHiddenRequestTypeID: func() bin.Object { return &StoriesTogglePeerStoriesHiddenRequest{} }, StoriesGetStoryReactionsListRequestTypeID: func() bin.Object { return &StoriesGetStoryReactionsListRequest{} }, StoriesTogglePinnedToTopRequestTypeID: func() bin.Object { return &StoriesTogglePinnedToTopRequest{} }, + StoriesSearchPostsRequestTypeID: func() bin.Object { return &StoriesSearchPostsRequest{} }, PremiumGetBoostsListRequestTypeID: func() bin.Object { return &PremiumGetBoostsListRequest{} }, PremiumGetMyBoostsRequestTypeID: func() bin.Object { return &PremiumGetMyBoostsRequest{} }, PremiumApplyBoostRequestTypeID: func() bin.Object { return &PremiumApplyBoostRequest{} }, @@ -6121,6 +6292,8 @@ func ClassConstructorsMap() map[string][]uint32 { ChannelAdminLogEventActionChangeWallpaperTypeID, ChannelAdminLogEventActionChangeEmojiStatusTypeID, ChannelAdminLogEventActionChangeEmojiStickerSetTypeID, + ChannelAdminLogEventActionToggleSignatureProfilesTypeID, + ChannelAdminLogEventActionParticipantSubExtendTypeID, }, ChannelLocationClassName: { ChannelLocationEmptyTypeID, @@ -6413,6 +6586,7 @@ func ClassConstructorsMap() map[string][]uint32 { InputFileClassName: { InputFileTypeID, InputFileBigTypeID, + InputFileStoryDocumentTypeID, }, InputFileLocationClassName: { InputFileLocationTypeID, @@ -6441,6 +6615,7 @@ func ClassConstructorsMap() map[string][]uint32 { InputInvoiceSlugTypeID, InputInvoicePremiumGiftCodeTypeID, InputInvoiceStarsTypeID, + InputInvoiceChatInviteSubscriptionTypeID, }, InputMediaClassName: { InputMediaEmptyTypeID, @@ -6460,6 +6635,7 @@ func ClassConstructorsMap() map[string][]uint32 { InputMediaDiceTypeID, InputMediaStoryTypeID, InputMediaWebPageTypeID, + InputMediaPaidMediaTypeID, }, InputMessageClassName: { InputMessageIDTypeID, @@ -6552,7 +6728,9 @@ func ClassConstructorsMap() map[string][]uint32 { InputStorePaymentGiftPremiumTypeID, InputStorePaymentPremiumGiftCodeTypeID, InputStorePaymentPremiumGiveawayTypeID, - InputStorePaymentStarsTypeID, + InputStorePaymentStarsTopupTypeID, + InputStorePaymentStarsGiftTypeID, + InputStorePaymentStarsGiveawayTypeID, }, InputThemeClassName: { InputThemeTypeID, @@ -6613,6 +6791,8 @@ func ClassConstructorsMap() map[string][]uint32 { MediaAreaSuggestedReactionTypeID, MediaAreaChannelPostTypeID, InputMediaAreaChannelPostTypeID, + MediaAreaURLTypeID, + MediaAreaWeatherTypeID, }, MessageActionClassName: { MessageActionEmptyTypeID, @@ -6658,6 +6838,9 @@ func ClassConstructorsMap() map[string][]uint32 { MessageActionGiveawayResultsTypeID, MessageActionBoostApplyTypeID, MessageActionRequestedPeerSentMeTypeID, + MessageActionPaymentRefundedTypeID, + MessageActionGiftStarsTypeID, + MessageActionPrizeStarsTypeID, }, MessageClassName: { MessageEmptyTypeID, @@ -6708,6 +6891,7 @@ func ClassConstructorsMap() map[string][]uint32 { MessageMediaStoryTypeID, MessageMediaGiveawayTypeID, MessageMediaGiveawayResultsTypeID, + MessageMediaPaidMediaTypeID, }, MessagePeerVoteClassName: { MessagePeerVoteTypeID, @@ -6952,6 +7136,10 @@ func ClassConstructorsMap() map[string][]uint32 { PostInteractionCountersMessageTypeID, PostInteractionCountersStoryTypeID, }, + PrepaidGiveawayClassName: { + PrepaidGiveawayTypeID, + PrepaidStarsGiveawayTypeID, + }, PrivacyKeyClassName: { PrivacyKeyStatusTimestampTypeID, PrivacyKeyChatInviteTypeID, @@ -6985,6 +7173,7 @@ func ClassConstructorsMap() map[string][]uint32 { ReactionEmptyTypeID, ReactionEmojiTypeID, ReactionCustomEmojiTypeID, + ReactionPaidTypeID, }, ReactionNotificationsFromClassName: { ReactionNotificationsFromContactsTypeID, @@ -7113,6 +7302,7 @@ func ClassConstructorsMap() map[string][]uint32 { StarsTransactionPeerPremiumBotTypeID, StarsTransactionPeerFragmentTypeID, StarsTransactionPeerTypeID, + StarsTransactionPeerAdsTypeID, }, StatsGraphClassName: { StatsGraphAsyncTypeID, @@ -7165,6 +7355,7 @@ func ClassConstructorsMap() map[string][]uint32 { TopPeerCategoryPhoneCallsTypeID, TopPeerCategoryForwardUsersTypeID, TopPeerCategoryForwardChatsTypeID, + TopPeerCategoryBotsAppTypeID, }, URLAuthResultClassName: { URLAuthResultRequestTypeID, @@ -7309,6 +7500,10 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateNewStoryReactionTypeID, UpdateBroadcastRevenueTransactionsTypeID, UpdateStarsBalanceTypeID, + UpdateBusinessBotCallbackQueryTypeID, + UpdateStarsRevenueStatusTypeID, + UpdateBotPurchasedPaidMediaTypeID, + UpdatePaidReactionPrivacyTypeID, }, UpdatesChannelDifferenceClassName: { UpdatesChannelDifferenceEmptyTypeID, diff --git a/vendor/github.com/gotd/td/tg/tl_requested_peer_gen.go b/vendor/github.com/gotd/td/tg/tl_requested_peer_gen.go index 1542e3c9..5f57f936 100644 --- a/vendor/github.com/gotd/td/tg/tl_requested_peer_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_requested_peer_gen.go @@ -32,26 +32,37 @@ var ( ) // RequestedPeerUser represents TL type `requestedPeerUser#d62ff46a`. +// Info about a user, shared by a user with the currently logged in bot using messages +// sendBotRequestedPeer¹. +// All fields except the ID are optional, and will be populated if present on the chosen +// user, according to the parameters of the requesting inputKeyboardButtonRequestPeer¹. +// +// Links: +// 1. https://core.telegram.org/method/messages.sendBotRequestedPeer +// 2. https://core.telegram.org/constructor/inputKeyboardButtonRequestPeer // // See https://core.telegram.org/constructor/requestedPeerUser for reference. type RequestedPeerUser struct { - // Flags field of RequestedPeerUser. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // UserID field of RequestedPeerUser. + // User ID. UserID int64 - // FirstName field of RequestedPeerUser. + // First name. // // Use SetFirstName and GetFirstName helpers. FirstName string - // LastName field of RequestedPeerUser. + // Last name. // // Use SetLastName and GetLastName helpers. LastName string - // Username field of RequestedPeerUser. + // Username. // // Use SetUsername and GetUsername helpers. Username string - // Photo field of RequestedPeerUser. + // Profile photo. // // Use SetPhoto and GetPhoto helpers. Photo PhotoClass @@ -381,18 +392,30 @@ func (r *RequestedPeerUser) GetPhoto() (value PhotoClass, ok bool) { } // RequestedPeerChat represents TL type `requestedPeerChat#7307544f`. +// Info about a chat¹, shared by a user with the currently logged in bot using messages +// sendBotRequestedPeer². +// All fields except the ID are optional, and will be populated if present on the chosen +// chat, according to the parameters of the requesting inputKeyboardButtonRequestPeer¹. +// +// Links: +// 1. https://core.telegram.org/api/channel +// 2. https://core.telegram.org/method/messages.sendBotRequestedPeer +// 3. https://core.telegram.org/constructor/inputKeyboardButtonRequestPeer // // See https://core.telegram.org/constructor/requestedPeerChat for reference. type RequestedPeerChat struct { - // Flags field of RequestedPeerChat. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // ChatID field of RequestedPeerChat. + // Chat ID. ChatID int64 - // Title field of RequestedPeerChat. + // Chat title. // // Use SetTitle and GetTitle helpers. Title string - // Photo field of RequestedPeerChat. + // Chat photo. // // Use SetPhoto and GetPhoto helpers. Photo PhotoClass @@ -634,22 +657,35 @@ func (r *RequestedPeerChat) GetPhoto() (value PhotoClass, ok bool) { } // RequestedPeerChannel represents TL type `requestedPeerChannel#8ba403e4`. +// Info about a channel/supergroup¹, shared by a user with the currently logged in bot +// using messages.sendBotRequestedPeer². +// All fields except the ID are optional, and will be populated if present on the chosen +// channel/supergroup, according to the parameters of the requesting +// inputKeyboardButtonRequestPeer¹. +// +// Links: +// 1. https://core.telegram.org/api/channel +// 2. https://core.telegram.org/method/messages.sendBotRequestedPeer +// 3. https://core.telegram.org/constructor/inputKeyboardButtonRequestPeer // // See https://core.telegram.org/constructor/requestedPeerChannel for reference. type RequestedPeerChannel struct { - // Flags field of RequestedPeerChannel. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // ChannelID field of RequestedPeerChannel. + // Channel/supergroup ID. ChannelID int64 - // Title field of RequestedPeerChannel. + // Channel/supergroup title. // // Use SetTitle and GetTitle helpers. Title string - // Username field of RequestedPeerChannel. + // Channel/supergroup username. // // Use SetUsername and GetUsername helpers. Username string - // Photo field of RequestedPeerChannel. + // Channel/supergroup photo. // // Use SetPhoto and GetPhoto helpers. Photo PhotoClass @@ -971,7 +1007,7 @@ type RequestedPeerClass interface { // Zero returns true if current object has a zero value. Zero() bool - // Photo field of RequestedPeerUser. + // Profile photo. GetPhoto() (value PhotoClass, ok bool) } diff --git a/vendor/github.com/gotd/td/tg/tl_saved_reaction_tag_gen.go b/vendor/github.com/gotd/td/tg/tl_saved_reaction_tag_gen.go index 2c0911a7..2e416ade 100644 --- a/vendor/github.com/gotd/td/tg/tl_saved_reaction_tag_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_saved_reaction_tag_gen.go @@ -32,18 +32,28 @@ var ( ) // SavedReactionTag represents TL type `savedReactionTag#cb6ff828`. +// Info about a saved message reaction tag »¹. +// +// Links: +// 1. https://core.telegram.org/api/saved-messages#tags // // See https://core.telegram.org/constructor/savedReactionTag for reference. type SavedReactionTag struct { - // Flags field of SavedReactionTag. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Reaction field of SavedReactionTag. + // Reaction¹ associated to the tag. + // + // Links: + // 1) https://core.telegram.org/api/reactions Reaction ReactionClass - // Title field of SavedReactionTag. + // Custom tag name assigned by the user (max 12 UTF-8 chars). // // Use SetTitle and GetTitle helpers. Title string - // Count field of SavedReactionTag. + // Number of messages tagged with this tag. Count int } diff --git a/vendor/github.com/gotd/td/tg/tl_server_gen.go b/vendor/github.com/gotd/td/tg/tl_server_gen.go index 0c1176b1..7c35e3ea 100644 --- a/vendor/github.com/gotd/td/tg/tl_server_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_server_gen.go @@ -6073,7 +6073,7 @@ func (s *ServerDispatcher) OnMessagesProlongWebView(f func(ctx context.Context, s.handlers[MessagesProlongWebViewRequestTypeID] = handler } -func (s *ServerDispatcher) OnMessagesRequestSimpleWebView(f func(ctx context.Context, request *MessagesRequestSimpleWebViewRequest) (*SimpleWebViewResultURL, error)) { +func (s *ServerDispatcher) OnMessagesRequestSimpleWebView(f func(ctx context.Context, request *MessagesRequestSimpleWebViewRequest) (*WebViewResultURL, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request MessagesRequestSimpleWebViewRequest if err := request.Decode(b); err != nil { @@ -6467,7 +6467,7 @@ func (s *ServerDispatcher) OnMessagesGetBotApp(f func(ctx context.Context, reque s.handlers[MessagesGetBotAppRequestTypeID] = handler } -func (s *ServerDispatcher) OnMessagesRequestAppWebView(f func(ctx context.Context, request *MessagesRequestAppWebViewRequest) (*AppWebViewResultURL, error)) { +func (s *ServerDispatcher) OnMessagesRequestAppWebView(f func(ctx context.Context, request *MessagesRequestAppWebViewRequest) (*WebViewResultURL, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request MessagesRequestAppWebViewRequest if err := request.Decode(b); err != nil { @@ -6975,6 +6975,78 @@ func (s *ServerDispatcher) OnMessagesGetFactCheck(f func(ctx context.Context, re s.handlers[MessagesGetFactCheckRequestTypeID] = handler } +func (s *ServerDispatcher) OnMessagesRequestMainWebView(f func(ctx context.Context, request *MessagesRequestMainWebViewRequest) (*WebViewResultURL, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesRequestMainWebViewRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[MessagesRequestMainWebViewRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesSendPaidReaction(f func(ctx context.Context, request *MessagesSendPaidReactionRequest) (UpdatesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesSendPaidReactionRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return &UpdatesBox{Updates: response}, nil + } + + s.handlers[MessagesSendPaidReactionRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesTogglePaidReactionPrivacy(f func(ctx context.Context, request *MessagesTogglePaidReactionPrivacyRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesTogglePaidReactionPrivacyRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[MessagesTogglePaidReactionPrivacyRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesGetPaidReactionPrivacy(f func(ctx context.Context) (UpdatesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesGetPaidReactionPrivacyRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx) + if err != nil { + return nil, err + } + return &UpdatesBox{Updates: response}, nil + } + + s.handlers[MessagesGetPaidReactionPrivacyRequestTypeID] = handler +} + func (s *ServerDispatcher) OnUpdatesGetState(f func(ctx context.Context) (*UpdatesState, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request UpdatesGetStateRequest @@ -9177,6 +9249,133 @@ func (s *ServerDispatcher) OnBotsInvokeWebViewCustomMethod(f func(ctx context.Co s.handlers[BotsInvokeWebViewCustomMethodRequestTypeID] = handler } +func (s *ServerDispatcher) OnBotsGetPopularAppBots(f func(ctx context.Context, request *BotsGetPopularAppBotsRequest) (*BotsPopularAppBots, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request BotsGetPopularAppBotsRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[BotsGetPopularAppBotsRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnBotsAddPreviewMedia(f func(ctx context.Context, request *BotsAddPreviewMediaRequest) (*BotPreviewMedia, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request BotsAddPreviewMediaRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[BotsAddPreviewMediaRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnBotsEditPreviewMedia(f func(ctx context.Context, request *BotsEditPreviewMediaRequest) (*BotPreviewMedia, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request BotsEditPreviewMediaRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[BotsEditPreviewMediaRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnBotsDeletePreviewMedia(f func(ctx context.Context, request *BotsDeletePreviewMediaRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request BotsDeletePreviewMediaRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[BotsDeletePreviewMediaRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnBotsReorderPreviewMedias(f func(ctx context.Context, request *BotsReorderPreviewMediasRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request BotsReorderPreviewMediasRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[BotsReorderPreviewMediasRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnBotsGetPreviewInfo(f func(ctx context.Context, request *BotsGetPreviewInfoRequest) (*BotsPreviewInfo, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request BotsGetPreviewInfoRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[BotsGetPreviewInfoRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnBotsGetPreviewMedias(f func(ctx context.Context, bot InputUserClass) ([]BotPreviewMedia, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request BotsGetPreviewMediasRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Bot) + if err != nil { + return nil, err + } + return &BotPreviewMediaVector{Elems: response}, nil + } + + s.handlers[BotsGetPreviewMediasRequestTypeID] = handler +} + func (s *ServerDispatcher) OnPaymentsGetPaymentForm(f func(ctx context.Context, request *PaymentsGetPaymentFormRequest) (PaymentsPaymentFormClass, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request PaymentsGetPaymentFormRequest @@ -9542,6 +9741,167 @@ func (s *ServerDispatcher) OnPaymentsRefundStarsCharge(f func(ctx context.Contex s.handlers[PaymentsRefundStarsChargeRequestTypeID] = handler } +func (s *ServerDispatcher) OnPaymentsGetStarsRevenueStats(f func(ctx context.Context, request *PaymentsGetStarsRevenueStatsRequest) (*PaymentsStarsRevenueStats, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request PaymentsGetStarsRevenueStatsRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[PaymentsGetStarsRevenueStatsRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnPaymentsGetStarsRevenueWithdrawalURL(f func(ctx context.Context, request *PaymentsGetStarsRevenueWithdrawalURLRequest) (*PaymentsStarsRevenueWithdrawalURL, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request PaymentsGetStarsRevenueWithdrawalURLRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[PaymentsGetStarsRevenueWithdrawalURLRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnPaymentsGetStarsRevenueAdsAccountURL(f func(ctx context.Context, peer InputPeerClass) (*PaymentsStarsRevenueAdsAccountURL, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request PaymentsGetStarsRevenueAdsAccountURLRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Peer) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[PaymentsGetStarsRevenueAdsAccountURLRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnPaymentsGetStarsTransactionsByID(f func(ctx context.Context, request *PaymentsGetStarsTransactionsByIDRequest) (*PaymentsStarsStatus, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request PaymentsGetStarsTransactionsByIDRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[PaymentsGetStarsTransactionsByIDRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnPaymentsGetStarsGiftOptions(f func(ctx context.Context, request *PaymentsGetStarsGiftOptionsRequest) ([]StarsGiftOption, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request PaymentsGetStarsGiftOptionsRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return &StarsGiftOptionVector{Elems: response}, nil + } + + s.handlers[PaymentsGetStarsGiftOptionsRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnPaymentsGetStarsSubscriptions(f func(ctx context.Context, request *PaymentsGetStarsSubscriptionsRequest) (*PaymentsStarsStatus, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request PaymentsGetStarsSubscriptionsRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[PaymentsGetStarsSubscriptionsRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnPaymentsChangeStarsSubscription(f func(ctx context.Context, request *PaymentsChangeStarsSubscriptionRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request PaymentsChangeStarsSubscriptionRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[PaymentsChangeStarsSubscriptionRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnPaymentsFulfillStarsSubscription(f func(ctx context.Context, request *PaymentsFulfillStarsSubscriptionRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request PaymentsFulfillStarsSubscriptionRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[PaymentsFulfillStarsSubscriptionRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnPaymentsGetStarsGiveawayOptions(f func(ctx context.Context) ([]StarsGiveawayOption, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request PaymentsGetStarsGiveawayOptionsRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx) + if err != nil { + return nil, err + } + return &StarsGiveawayOptionVector{Elems: response}, nil + } + + s.handlers[PaymentsGetStarsGiveawayOptionsRequestTypeID] = handler +} + func (s *ServerDispatcher) OnStickersCreateStickerSet(f func(ctx context.Context, request *StickersCreateStickerSetRequest) (MessagesStickerSetClass, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request StickersCreateStickerSetRequest @@ -11200,6 +11560,23 @@ func (s *ServerDispatcher) OnStoriesTogglePinnedToTop(f func(ctx context.Context s.handlers[StoriesTogglePinnedToTopRequestTypeID] = handler } +func (s *ServerDispatcher) OnStoriesSearchPosts(f func(ctx context.Context, request *StoriesSearchPostsRequest) (*StoriesFoundStories, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request StoriesSearchPostsRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[StoriesSearchPostsRequestTypeID] = handler +} + func (s *ServerDispatcher) OnPremiumGetBoostsList(f func(ctx context.Context, request *PremiumGetBoostsListRequest) (*PremiumBoostsList, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request PremiumGetBoostsListRequest diff --git a/vendor/github.com/gotd/td/tg/tl_simple_web_view_result_url_gen.go b/vendor/github.com/gotd/td/tg/tl_simple_web_view_result_url_gen.go deleted file mode 100644 index c5d7dab1..00000000 --- a/vendor/github.com/gotd/td/tg/tl_simple_web_view_result_url_gen.go +++ /dev/null @@ -1,162 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tg - -import ( - "context" - "errors" - "fmt" - "sort" - "strings" - - "go.uber.org/multierr" - - "github.com/gotd/td/bin" - "github.com/gotd/td/tdjson" - "github.com/gotd/td/tdp" - "github.com/gotd/td/tgerr" -) - -// No-op definition for keeping imports. -var ( - _ = bin.Buffer{} - _ = context.Background() - _ = fmt.Stringer(nil) - _ = strings.Builder{} - _ = errors.Is - _ = multierr.AppendInto - _ = sort.Ints - _ = tdp.Format - _ = tgerr.Error{} - _ = tdjson.Encoder{} -) - -// SimpleWebViewResultURL represents TL type `simpleWebViewResultUrl#882f76bb`. -// Contains the webview URL with appropriate theme parameters added -// -// See https://core.telegram.org/constructor/simpleWebViewResultUrl for reference. -type SimpleWebViewResultURL struct { - // URL - URL string -} - -// SimpleWebViewResultURLTypeID is TL type id of SimpleWebViewResultURL. -const SimpleWebViewResultURLTypeID = 0x882f76bb - -// Ensuring interfaces in compile-time for SimpleWebViewResultURL. -var ( - _ bin.Encoder = &SimpleWebViewResultURL{} - _ bin.Decoder = &SimpleWebViewResultURL{} - _ bin.BareEncoder = &SimpleWebViewResultURL{} - _ bin.BareDecoder = &SimpleWebViewResultURL{} -) - -func (s *SimpleWebViewResultURL) Zero() bool { - if s == nil { - return true - } - if !(s.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SimpleWebViewResultURL) String() string { - if s == nil { - return "SimpleWebViewResultURL(nil)" - } - type Alias SimpleWebViewResultURL - return fmt.Sprintf("SimpleWebViewResultURL%+v", Alias(*s)) -} - -// FillFrom fills SimpleWebViewResultURL from given interface. -func (s *SimpleWebViewResultURL) FillFrom(from interface { - GetURL() (value string) -}) { - s.URL = from.GetURL() -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SimpleWebViewResultURL) TypeID() uint32 { - return SimpleWebViewResultURLTypeID -} - -// TypeName returns name of type in TL schema. -func (*SimpleWebViewResultURL) TypeName() string { - return "simpleWebViewResultUrl" -} - -// TypeInfo returns info about TL type. -func (s *SimpleWebViewResultURL) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "simpleWebViewResultUrl", - ID: SimpleWebViewResultURLTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SimpleWebViewResultURL) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode simpleWebViewResultUrl#882f76bb as nil") - } - b.PutID(SimpleWebViewResultURLTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SimpleWebViewResultURL) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode simpleWebViewResultUrl#882f76bb as nil") - } - b.PutString(s.URL) - return nil -} - -// Decode implements bin.Decoder. -func (s *SimpleWebViewResultURL) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode simpleWebViewResultUrl#882f76bb to nil") - } - if err := b.ConsumeID(SimpleWebViewResultURLTypeID); err != nil { - return fmt.Errorf("unable to decode simpleWebViewResultUrl#882f76bb: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SimpleWebViewResultURL) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode simpleWebViewResultUrl#882f76bb to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode simpleWebViewResultUrl#882f76bb: field url: %w", err) - } - s.URL = value - } - return nil -} - -// GetURL returns value of URL field. -func (s *SimpleWebViewResultURL) GetURL() (value string) { - if s == nil { - return - } - return s.URL -} diff --git a/vendor/github.com/gotd/td/tg/tl_sms_job_gen.go b/vendor/github.com/gotd/td/tg/tl_sms_job_gen.go index a2f5bd3b..d6995bff 100644 --- a/vendor/github.com/gotd/td/tg/tl_sms_job_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_sms_job_gen.go @@ -32,14 +32,15 @@ var ( ) // SMSJob represents TL type `smsJob#e6a1eeb8`. +// Info about an SMS job. // // See https://core.telegram.org/constructor/smsJob for reference. type SMSJob struct { - // JobID field of SMSJob. + // Job ID JobID string - // PhoneNumber field of SMSJob. + // Destination phone number PhoneNumber string - // Text field of SMSJob. + // Text Text string } diff --git a/vendor/github.com/gotd/td/tg/tl_smsjobs_eligible_to_join_gen.go b/vendor/github.com/gotd/td/tg/tl_smsjobs_eligible_to_join_gen.go index 3f936b52..f833b9f7 100644 --- a/vendor/github.com/gotd/td/tg/tl_smsjobs_eligible_to_join_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_smsjobs_eligible_to_join_gen.go @@ -32,12 +32,13 @@ var ( ) // SMSJobsEligibleToJoin represents TL type `smsjobs.eligibleToJoin#dc8b44cf`. +// SMS jobs eligibility // // See https://core.telegram.org/constructor/smsjobs.eligibleToJoin for reference. type SMSJobsEligibleToJoin struct { - // TermsURL field of SMSJobsEligibleToJoin. + // Terms of service URL TermsURL string - // MonthlySentSMS field of SMSJobsEligibleToJoin. + // Monthly sent SMSes MonthlySentSMS int } diff --git a/vendor/github.com/gotd/td/tg/tl_smsjobs_finish_job_gen.go b/vendor/github.com/gotd/td/tg/tl_smsjobs_finish_job_gen.go index b9988269..ed6730cc 100644 --- a/vendor/github.com/gotd/td/tg/tl_smsjobs_finish_job_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_smsjobs_finish_job_gen.go @@ -32,14 +32,18 @@ var ( ) // SMSJobsFinishJobRequest represents TL type `smsjobs.finishJob#4f1ebf24`. +// Finish an SMS job (official clients only). // // See https://core.telegram.org/method/smsjobs.finishJob for reference. type SMSJobsFinishJobRequest struct { - // Flags field of SMSJobsFinishJobRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // JobID field of SMSJobsFinishJobRequest. + // Job ID. JobID string - // Error field of SMSJobsFinishJobRequest. + // If failed, the error. // // Use SetError and GetError helpers. Error string @@ -227,6 +231,11 @@ func (f *SMSJobsFinishJobRequest) GetError() (value string, ok bool) { } // SMSJobsFinishJob invokes method smsjobs.finishJob#4f1ebf24 returning error if any. +// Finish an SMS job (official clients only). +// +// Possible errors: +// +// 400 SMSJOB_ID_INVALID: The specified job ID is invalid. // // See https://core.telegram.org/method/smsjobs.finishJob for reference. func (c *Client) SMSJobsFinishJob(ctx context.Context, request *SMSJobsFinishJobRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_smsjobs_get_sms_job_gen.go b/vendor/github.com/gotd/td/tg/tl_smsjobs_get_sms_job_gen.go index ab0921ca..e3481b7b 100644 --- a/vendor/github.com/gotd/td/tg/tl_smsjobs_get_sms_job_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_smsjobs_get_sms_job_gen.go @@ -32,10 +32,11 @@ var ( ) // SMSJobsGetSMSJobRequest represents TL type `smsjobs.getSmsJob#778d902f`. +// Get info about an SMS job (official clients only). // // See https://core.telegram.org/method/smsjobs.getSmsJob for reference. type SMSJobsGetSMSJobRequest struct { - // JobID field of SMSJobsGetSMSJobRequest. + // Job ID JobID string } @@ -161,6 +162,11 @@ func (g *SMSJobsGetSMSJobRequest) GetJobID() (value string) { } // SMSJobsGetSMSJob invokes method smsjobs.getSmsJob#778d902f returning error if any. +// Get info about an SMS job (official clients only). +// +// Possible errors: +// +// 400 SMSJOB_ID_INVALID: The specified job ID is invalid. // // See https://core.telegram.org/method/smsjobs.getSmsJob for reference. func (c *Client) SMSJobsGetSMSJob(ctx context.Context, jobid string) (*SMSJob, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_smsjobs_get_status_gen.go b/vendor/github.com/gotd/td/tg/tl_smsjobs_get_status_gen.go index 77470c38..a9f165d7 100644 --- a/vendor/github.com/gotd/td/tg/tl_smsjobs_get_status_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_smsjobs_get_status_gen.go @@ -32,6 +32,7 @@ var ( ) // SMSJobsGetStatusRequest represents TL type `smsjobs.getStatus#10a698e8`. +// Get SMS jobs status (official clients only). // // See https://core.telegram.org/method/smsjobs.getStatus for reference. type SMSJobsGetStatusRequest struct { @@ -128,6 +129,11 @@ func (g *SMSJobsGetStatusRequest) DecodeBare(b *bin.Buffer) error { } // SMSJobsGetStatus invokes method smsjobs.getStatus#10a698e8 returning error if any. +// Get SMS jobs status (official clients only). +// +// Possible errors: +// +// 400 NOT_JOINED: The current user hasn't joined the Peer-to-Peer Login Program. // // See https://core.telegram.org/method/smsjobs.getStatus for reference. func (c *Client) SMSJobsGetStatus(ctx context.Context) (*SMSJobsStatus, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_smsjobs_is_eligible_to_join_gen.go b/vendor/github.com/gotd/td/tg/tl_smsjobs_is_eligible_to_join_gen.go index 10f08738..8b262c5c 100644 --- a/vendor/github.com/gotd/td/tg/tl_smsjobs_is_eligible_to_join_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_smsjobs_is_eligible_to_join_gen.go @@ -32,6 +32,7 @@ var ( ) // SMSJobsIsEligibleToJoinRequest represents TL type `smsjobs.isEligibleToJoin#edc39d0`. +// Check if we can process SMS jobs (official clients only). // // See https://core.telegram.org/method/smsjobs.isEligibleToJoin for reference. type SMSJobsIsEligibleToJoinRequest struct { @@ -128,6 +129,11 @@ func (i *SMSJobsIsEligibleToJoinRequest) DecodeBare(b *bin.Buffer) error { } // SMSJobsIsEligibleToJoin invokes method smsjobs.isEligibleToJoin#edc39d0 returning error if any. +// Check if we can process SMS jobs (official clients only). +// +// Possible errors: +// +// 403 NOT_ELIGIBLE: The current user is not eligible to join the Peer-to-Peer Login Program. // // See https://core.telegram.org/method/smsjobs.isEligibleToJoin for reference. func (c *Client) SMSJobsIsEligibleToJoin(ctx context.Context) (*SMSJobsEligibleToJoin, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_smsjobs_join_gen.go b/vendor/github.com/gotd/td/tg/tl_smsjobs_join_gen.go index d4636eca..e08abc8a 100644 --- a/vendor/github.com/gotd/td/tg/tl_smsjobs_join_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_smsjobs_join_gen.go @@ -32,6 +32,7 @@ var ( ) // SMSJobsJoinRequest represents TL type `smsjobs.join#a74ece2d`. +// Enable SMS jobs (official clients only). // // See https://core.telegram.org/method/smsjobs.join for reference. type SMSJobsJoinRequest struct { @@ -128,6 +129,11 @@ func (j *SMSJobsJoinRequest) DecodeBare(b *bin.Buffer) error { } // SMSJobsJoin invokes method smsjobs.join#a74ece2d returning error if any. +// Enable SMS jobs (official clients only). +// +// Possible errors: +// +// 400 NOT_ELIGIBLE: The current user is not eligible to join the Peer-to-Peer Login Program. // // See https://core.telegram.org/method/smsjobs.join for reference. func (c *Client) SMSJobsJoin(ctx context.Context) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_smsjobs_leave_gen.go b/vendor/github.com/gotd/td/tg/tl_smsjobs_leave_gen.go index 2acec6e1..4839cf4b 100644 --- a/vendor/github.com/gotd/td/tg/tl_smsjobs_leave_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_smsjobs_leave_gen.go @@ -32,6 +32,7 @@ var ( ) // SMSJobsLeaveRequest represents TL type `smsjobs.leave#9898ad73`. +// Disable SMS jobs (official clients only). // // See https://core.telegram.org/method/smsjobs.leave for reference. type SMSJobsLeaveRequest struct { @@ -128,6 +129,11 @@ func (l *SMSJobsLeaveRequest) DecodeBare(b *bin.Buffer) error { } // SMSJobsLeave invokes method smsjobs.leave#9898ad73 returning error if any. +// Disable SMS jobs (official clients only). +// +// Possible errors: +// +// 400 NOT_JOINED: The current user hasn't joined the Peer-to-Peer Login Program. // // See https://core.telegram.org/method/smsjobs.leave for reference. func (c *Client) SMSJobsLeave(ctx context.Context) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_smsjobs_status_gen.go b/vendor/github.com/gotd/td/tg/tl_smsjobs_status_gen.go index 744bbd61..36003c39 100644 --- a/vendor/github.com/gotd/td/tg/tl_smsjobs_status_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_smsjobs_status_gen.go @@ -32,28 +32,32 @@ var ( ) // SMSJobsStatus represents TL type `smsjobs.status#2aee9191`. +// Status // // See https://core.telegram.org/constructor/smsjobs.status for reference. type SMSJobsStatus struct { - // Flags field of SMSJobsStatus. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // AllowInternational field of SMSJobsStatus. + // Allow international numbers AllowInternational bool - // RecentSent field of SMSJobsStatus. + // Recently sent RecentSent int - // RecentSince field of SMSJobsStatus. + // Since RecentSince int - // RecentRemains field of SMSJobsStatus. + // Remaining RecentRemains int - // TotalSent field of SMSJobsStatus. + // Total sent TotalSent int - // TotalSince field of SMSJobsStatus. + // Total since TotalSince int - // LastGiftSlug field of SMSJobsStatus. + // Last gift deep link // // Use SetLastGiftSlug and GetLastGiftSlug helpers. LastGiftSlug string - // TermsURL field of SMSJobsStatus. + // Terms of service URL TermsURL string } diff --git a/vendor/github.com/gotd/td/tg/tl_smsjobs_update_settings_gen.go b/vendor/github.com/gotd/td/tg/tl_smsjobs_update_settings_gen.go index f9872522..87e9a722 100644 --- a/vendor/github.com/gotd/td/tg/tl_smsjobs_update_settings_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_smsjobs_update_settings_gen.go @@ -32,12 +32,16 @@ var ( ) // SMSJobsUpdateSettingsRequest represents TL type `smsjobs.updateSettings#93fa0bf`. +// Update SMS job settings (official clients only). // // See https://core.telegram.org/method/smsjobs.updateSettings for reference. type SMSJobsUpdateSettingsRequest struct { - // Flags field of SMSJobsUpdateSettingsRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // AllowInternational field of SMSJobsUpdateSettingsRequest. + // Allow international numbers? AllowInternational bool } @@ -187,6 +191,11 @@ func (u *SMSJobsUpdateSettingsRequest) GetAllowInternational() (value bool) { } // SMSJobsUpdateSettings invokes method smsjobs.updateSettings#93fa0bf returning error if any. +// Update SMS job settings (official clients only). +// +// Possible errors: +// +// 400 NOT_JOINED: The current user hasn't joined the Peer-to-Peer Login Program. // // See https://core.telegram.org/method/smsjobs.updateSettings for reference. func (c *Client) SMSJobsUpdateSettings(ctx context.Context, request *SMSJobsUpdateSettingsRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_sponsored_message_gen.go b/vendor/github.com/gotd/td/tg/tl_sponsored_message_gen.go index 0237f560..1e34b75d 100644 --- a/vendor/github.com/gotd/td/tg/tl_sponsored_message_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_sponsored_message_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// SponsoredMessage represents TL type `sponsoredMessage#bdedf566`. +// SponsoredMessage represents TL type `sponsoredMessage#4d93a990`. // A sponsored message¹. // // Links: @@ -46,32 +46,44 @@ type SponsoredMessage struct { Flags bin.Fields // Whether the message needs to be labeled as "recommended" instead of "sponsored" Recommended bool - // CanReport field of SponsoredMessage. + // Whether this message can be reported as specified here »¹. + // + // Links: + // 1) https://core.telegram.org/api/sponsored-messages#reporting-sponsored-messages CanReport bool // Message ID RandomID []byte - // URL field of SponsoredMessage. + // Contains the URL to open when the user clicks on the sponsored message. URL string - // Title field of SponsoredMessage. + // Contains the title of the sponsored message. Title string // Sponsored message Message string - // Message entities for styled text¹ + // Message entities for styled text¹ in message. // // Links: // 1) https://core.telegram.org/api/entities // // Use SetEntities and GetEntities helpers. Entities []MessageEntityClass - // Photo field of SponsoredMessage. + // If set, contains a custom profile photo bubble that should be displayed for the + // sponsored message, like for messages sent in groups. // // Use SetPhoto and GetPhoto helpers. Photo PhotoClass - // Color field of SponsoredMessage. + // Media field of SponsoredMessage. + // + // Use SetMedia and GetMedia helpers. + Media MessageMediaClass + // If set, the sponsored message should use the message accent color »¹ specified in + // color. + // + // Links: + // 1) https://core.telegram.org/api/colors // // Use SetColor and GetColor helpers. Color PeerColor - // Text of the sponsored message button. + // Label of the sponsored message button. ButtonText string // If set, contains additional information about the sponsor to be shown along with the // message. @@ -86,7 +98,7 @@ type SponsoredMessage struct { } // SponsoredMessageTypeID is TL type id of SponsoredMessage. -const SponsoredMessageTypeID = 0xbdedf566 +const SponsoredMessageTypeID = 0x4d93a990 // Ensuring interfaces in compile-time for SponsoredMessage. var ( @@ -127,6 +139,9 @@ func (s *SponsoredMessage) Zero() bool { if !(s.Photo == nil) { return false } + if !(s.Media == nil) { + return false + } if !(s.Color.Zero()) { return false } @@ -162,6 +177,7 @@ func (s *SponsoredMessage) FillFrom(from interface { GetMessage() (value string) GetEntities() (value []MessageEntityClass, ok bool) GetPhoto() (value PhotoClass, ok bool) + GetMedia() (value MessageMediaClass, ok bool) GetColor() (value PeerColor, ok bool) GetButtonText() (value string) GetSponsorInfo() (value string, ok bool) @@ -181,6 +197,10 @@ func (s *SponsoredMessage) FillFrom(from interface { s.Photo = val } + if val, ok := from.GetMedia(); ok { + s.Media = val + } + if val, ok := from.GetColor(); ok { s.Color = val } @@ -255,6 +275,11 @@ func (s *SponsoredMessage) TypeInfo() tdp.Type { SchemaName: "photo", Null: !s.Flags.Has(6), }, + { + Name: "Media", + SchemaName: "media", + Null: !s.Flags.Has(14), + }, { Name: "Color", SchemaName: "color", @@ -292,6 +317,9 @@ func (s *SponsoredMessage) SetFlags() { if !(s.Photo == nil) { s.Flags.Set(6) } + if !(s.Media == nil) { + s.Flags.Set(14) + } if !(s.Color.Zero()) { s.Flags.Set(13) } @@ -306,7 +334,7 @@ func (s *SponsoredMessage) SetFlags() { // Encode implements bin.Encoder. func (s *SponsoredMessage) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode sponsoredMessage#bdedf566 as nil") + return fmt.Errorf("can't encode sponsoredMessage#4d93a990 as nil") } b.PutID(SponsoredMessageTypeID) return s.EncodeBare(b) @@ -315,11 +343,11 @@ func (s *SponsoredMessage) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SponsoredMessage) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode sponsoredMessage#bdedf566 as nil") + return fmt.Errorf("can't encode sponsoredMessage#4d93a990 as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#bdedf566: field flags: %w", err) + return fmt.Errorf("unable to encode sponsoredMessage#4d93a990: field flags: %w", err) } b.PutBytes(s.RandomID) b.PutString(s.URL) @@ -329,24 +357,32 @@ func (s *SponsoredMessage) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(s.Entities)) for idx, v := range s.Entities { if v == nil { - return fmt.Errorf("unable to encode sponsoredMessage#bdedf566: field entities element with index %d is nil", idx) + return fmt.Errorf("unable to encode sponsoredMessage#4d93a990: field entities element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#bdedf566: field entities element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode sponsoredMessage#4d93a990: field entities element with index %d: %w", idx, err) } } } if s.Flags.Has(6) { if s.Photo == nil { - return fmt.Errorf("unable to encode sponsoredMessage#bdedf566: field photo is nil") + return fmt.Errorf("unable to encode sponsoredMessage#4d93a990: field photo is nil") } if err := s.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#bdedf566: field photo: %w", err) + return fmt.Errorf("unable to encode sponsoredMessage#4d93a990: field photo: %w", err) + } + } + if s.Flags.Has(14) { + if s.Media == nil { + return fmt.Errorf("unable to encode sponsoredMessage#4d93a990: field media is nil") + } + if err := s.Media.Encode(b); err != nil { + return fmt.Errorf("unable to encode sponsoredMessage#4d93a990: field media: %w", err) } } if s.Flags.Has(13) { if err := s.Color.Encode(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#bdedf566: field color: %w", err) + return fmt.Errorf("unable to encode sponsoredMessage#4d93a990: field color: %w", err) } } b.PutString(s.ButtonText) @@ -362,10 +398,10 @@ func (s *SponsoredMessage) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *SponsoredMessage) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode sponsoredMessage#bdedf566 to nil") + return fmt.Errorf("can't decode sponsoredMessage#4d93a990 to nil") } if err := b.ConsumeID(SponsoredMessageTypeID); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#bdedf566: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#4d93a990: %w", err) } return s.DecodeBare(b) } @@ -373,11 +409,11 @@ func (s *SponsoredMessage) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SponsoredMessage) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode sponsoredMessage#bdedf566 to nil") + return fmt.Errorf("can't decode sponsoredMessage#4d93a990 to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#bdedf566: field flags: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#4d93a990: field flags: %w", err) } } s.Recommended = s.Flags.Has(5) @@ -385,35 +421,35 @@ func (s *SponsoredMessage) DecodeBare(b *bin.Buffer) error { { value, err := b.Bytes() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#bdedf566: field random_id: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#4d93a990: field random_id: %w", err) } s.RandomID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#bdedf566: field url: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#4d93a990: field url: %w", err) } s.URL = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#bdedf566: field title: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#4d93a990: field title: %w", err) } s.Title = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#bdedf566: field message: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#4d93a990: field message: %w", err) } s.Message = value } if s.Flags.Has(1) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#bdedf566: field entities: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#4d93a990: field entities: %w", err) } if headerLen > 0 { @@ -422,7 +458,7 @@ func (s *SponsoredMessage) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMessageEntity(b) if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#bdedf566: field entities: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#4d93a990: field entities: %w", err) } s.Entities = append(s.Entities, value) } @@ -430,33 +466,40 @@ func (s *SponsoredMessage) DecodeBare(b *bin.Buffer) error { if s.Flags.Has(6) { value, err := DecodePhoto(b) if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#bdedf566: field photo: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#4d93a990: field photo: %w", err) } s.Photo = value } + if s.Flags.Has(14) { + value, err := DecodeMessageMedia(b) + if err != nil { + return fmt.Errorf("unable to decode sponsoredMessage#4d93a990: field media: %w", err) + } + s.Media = value + } if s.Flags.Has(13) { if err := s.Color.Decode(b); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#bdedf566: field color: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#4d93a990: field color: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#bdedf566: field button_text: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#4d93a990: field button_text: %w", err) } s.ButtonText = value } if s.Flags.Has(7) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#bdedf566: field sponsor_info: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#4d93a990: field sponsor_info: %w", err) } s.SponsorInfo = value } if s.Flags.Has(8) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#bdedf566: field additional_info: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#4d93a990: field additional_info: %w", err) } s.AdditionalInfo = value } @@ -569,6 +612,24 @@ func (s *SponsoredMessage) GetPhoto() (value PhotoClass, ok bool) { return s.Photo, true } +// SetMedia sets value of Media conditional field. +func (s *SponsoredMessage) SetMedia(value MessageMediaClass) { + s.Flags.Set(14) + s.Media = value +} + +// GetMedia returns value of Media conditional field and +// boolean which is true if field was set. +func (s *SponsoredMessage) GetMedia() (value MessageMediaClass, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(14) { + return value, false + } + return s.Media, true +} + // SetColor sets value of Color conditional field. func (s *SponsoredMessage) SetColor(value PeerColor) { s.Flags.Set(13) diff --git a/vendor/github.com/gotd/td/tg/tl_sponsored_message_report_option_gen.go b/vendor/github.com/gotd/td/tg/tl_sponsored_message_report_option_gen.go index 88e229bb..19a33e9e 100644 --- a/vendor/github.com/gotd/td/tg/tl_sponsored_message_report_option_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_sponsored_message_report_option_gen.go @@ -32,12 +32,19 @@ var ( ) // SponsoredMessageReportOption represents TL type `sponsoredMessageReportOption#430d3150`. +// A report option for a sponsored message »¹. +// +// Links: +// 1. https://core.telegram.org/api/sponsored-messages#reporting-sponsored-messages // // See https://core.telegram.org/constructor/sponsoredMessageReportOption for reference. type SponsoredMessageReportOption struct { - // Text field of SponsoredMessageReportOption. + // Localized description of the option. Text string - // Option field of SponsoredMessageReportOption. + // Option identifier to pass to channels.reportSponsoredMessage¹. + // + // Links: + // 1) https://core.telegram.org/method/channels.reportSponsoredMessage Option []byte } diff --git a/vendor/github.com/gotd/td/tg/tl_stars_gift_option_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_gift_option_gen.go new file mode 100644 index 00000000..235b071b --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stars_gift_option_gen.go @@ -0,0 +1,332 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// StarsGiftOption represents TL type `starsGiftOption#5e0589f1`. +// Telegram Stars gift option¹. +// +// Links: +// 1. https://core.telegram.org/api/stars#buying-or-gifting-stars +// +// See https://core.telegram.org/constructor/starsGiftOption for reference. +type StarsGiftOption struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // If set, the option must only be shown in the full list of topup options. + Extended bool + // Amount of Telegram stars. + Stars int64 + // Identifier of the store product associated with the option, official apps only. + // + // Use SetStoreProduct and GetStoreProduct helpers. + StoreProduct string + // Three-letter ISO 4217 currency¹ code + // + // Links: + // 1) https://core.telegram.org/bots/payments#supported-currencies + Currency string + // Price of the product in the smallest units of the currency (integer, not float/double) + // For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in + // currencies.json¹, it shows the number of digits past the decimal point for each + // currency (2 for the majority of currencies). + // + // Links: + // 1) https://core.telegram.org/bots/payments/currencies.json + Amount int64 +} + +// StarsGiftOptionTypeID is TL type id of StarsGiftOption. +const StarsGiftOptionTypeID = 0x5e0589f1 + +// Ensuring interfaces in compile-time for StarsGiftOption. +var ( + _ bin.Encoder = &StarsGiftOption{} + _ bin.Decoder = &StarsGiftOption{} + _ bin.BareEncoder = &StarsGiftOption{} + _ bin.BareDecoder = &StarsGiftOption{} +) + +func (s *StarsGiftOption) Zero() bool { + if s == nil { + return true + } + if !(s.Flags.Zero()) { + return false + } + if !(s.Extended == false) { + return false + } + if !(s.Stars == 0) { + return false + } + if !(s.StoreProduct == "") { + return false + } + if !(s.Currency == "") { + return false + } + if !(s.Amount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarsGiftOption) String() string { + if s == nil { + return "StarsGiftOption(nil)" + } + type Alias StarsGiftOption + return fmt.Sprintf("StarsGiftOption%+v", Alias(*s)) +} + +// FillFrom fills StarsGiftOption from given interface. +func (s *StarsGiftOption) FillFrom(from interface { + GetExtended() (value bool) + GetStars() (value int64) + GetStoreProduct() (value string, ok bool) + GetCurrency() (value string) + GetAmount() (value int64) +}) { + s.Extended = from.GetExtended() + s.Stars = from.GetStars() + if val, ok := from.GetStoreProduct(); ok { + s.StoreProduct = val + } + + s.Currency = from.GetCurrency() + s.Amount = from.GetAmount() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarsGiftOption) TypeID() uint32 { + return StarsGiftOptionTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarsGiftOption) TypeName() string { + return "starsGiftOption" +} + +// TypeInfo returns info about TL type. +func (s *StarsGiftOption) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starsGiftOption", + ID: StarsGiftOptionTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Extended", + SchemaName: "extended", + Null: !s.Flags.Has(1), + }, + { + Name: "Stars", + SchemaName: "stars", + }, + { + Name: "StoreProduct", + SchemaName: "store_product", + Null: !s.Flags.Has(0), + }, + { + Name: "Currency", + SchemaName: "currency", + }, + { + Name: "Amount", + SchemaName: "amount", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (s *StarsGiftOption) SetFlags() { + if !(s.Extended == false) { + s.Flags.Set(1) + } + if !(s.StoreProduct == "") { + s.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (s *StarsGiftOption) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starsGiftOption#5e0589f1 as nil") + } + b.PutID(StarsGiftOptionTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarsGiftOption) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starsGiftOption#5e0589f1 as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode starsGiftOption#5e0589f1: field flags: %w", err) + } + b.PutLong(s.Stars) + if s.Flags.Has(0) { + b.PutString(s.StoreProduct) + } + b.PutString(s.Currency) + b.PutLong(s.Amount) + return nil +} + +// Decode implements bin.Decoder. +func (s *StarsGiftOption) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starsGiftOption#5e0589f1 to nil") + } + if err := b.ConsumeID(StarsGiftOptionTypeID); err != nil { + return fmt.Errorf("unable to decode starsGiftOption#5e0589f1: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarsGiftOption) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starsGiftOption#5e0589f1 to nil") + } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode starsGiftOption#5e0589f1: field flags: %w", err) + } + } + s.Extended = s.Flags.Has(1) + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode starsGiftOption#5e0589f1: field stars: %w", err) + } + s.Stars = value + } + if s.Flags.Has(0) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode starsGiftOption#5e0589f1: field store_product: %w", err) + } + s.StoreProduct = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode starsGiftOption#5e0589f1: field currency: %w", err) + } + s.Currency = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode starsGiftOption#5e0589f1: field amount: %w", err) + } + s.Amount = value + } + return nil +} + +// SetExtended sets value of Extended conditional field. +func (s *StarsGiftOption) SetExtended(value bool) { + if value { + s.Flags.Set(1) + s.Extended = true + } else { + s.Flags.Unset(1) + s.Extended = false + } +} + +// GetExtended returns value of Extended conditional field. +func (s *StarsGiftOption) GetExtended() (value bool) { + if s == nil { + return + } + return s.Flags.Has(1) +} + +// GetStars returns value of Stars field. +func (s *StarsGiftOption) GetStars() (value int64) { + if s == nil { + return + } + return s.Stars +} + +// SetStoreProduct sets value of StoreProduct conditional field. +func (s *StarsGiftOption) SetStoreProduct(value string) { + s.Flags.Set(0) + s.StoreProduct = value +} + +// GetStoreProduct returns value of StoreProduct conditional field and +// boolean which is true if field was set. +func (s *StarsGiftOption) GetStoreProduct() (value string, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(0) { + return value, false + } + return s.StoreProduct, true +} + +// GetCurrency returns value of Currency field. +func (s *StarsGiftOption) GetCurrency() (value string) { + if s == nil { + return + } + return s.Currency +} + +// GetAmount returns value of Amount field. +func (s *StarsGiftOption) GetAmount() (value int64) { + if s == nil { + return + } + return s.Amount +} diff --git a/vendor/github.com/gotd/td/tg/tl_stars_gift_option_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_gift_option_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stars_gift_option_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_stars_gift_option_vector_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_gift_option_vector_gen.go new file mode 100644 index 00000000..80a59ccd --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stars_gift_option_vector_gen.go @@ -0,0 +1,172 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// StarsGiftOptionVector is a box for Vector +type StarsGiftOptionVector struct { + // Elements of Vector + Elems []StarsGiftOption +} + +// StarsGiftOptionVectorTypeID is TL type id of StarsGiftOptionVector. +const StarsGiftOptionVectorTypeID = bin.TypeVector + +// Ensuring interfaces in compile-time for StarsGiftOptionVector. +var ( + _ bin.Encoder = &StarsGiftOptionVector{} + _ bin.Decoder = &StarsGiftOptionVector{} + _ bin.BareEncoder = &StarsGiftOptionVector{} + _ bin.BareDecoder = &StarsGiftOptionVector{} +) + +func (vec *StarsGiftOptionVector) Zero() bool { + if vec == nil { + return true + } + if !(vec.Elems == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (vec *StarsGiftOptionVector) String() string { + if vec == nil { + return "StarsGiftOptionVector(nil)" + } + type Alias StarsGiftOptionVector + return fmt.Sprintf("StarsGiftOptionVector%+v", Alias(*vec)) +} + +// FillFrom fills StarsGiftOptionVector from given interface. +func (vec *StarsGiftOptionVector) FillFrom(from interface { + GetElems() (value []StarsGiftOption) +}) { + vec.Elems = from.GetElems() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarsGiftOptionVector) TypeID() uint32 { + return StarsGiftOptionVectorTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarsGiftOptionVector) TypeName() string { + return "" +} + +// TypeInfo returns info about TL type. +func (vec *StarsGiftOptionVector) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "", + ID: StarsGiftOptionVectorTypeID, + } + if vec == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Elems", + SchemaName: "Elems", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (vec *StarsGiftOptionVector) Encode(b *bin.Buffer) error { + if vec == nil { + return fmt.Errorf("can't encode Vector as nil") + } + + return vec.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (vec *StarsGiftOptionVector) EncodeBare(b *bin.Buffer) error { + if vec == nil { + return fmt.Errorf("can't encode Vector as nil") + } + b.PutVectorHeader(len(vec.Elems)) + for idx, v := range vec.Elems { + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode Vector: field Elems element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (vec *StarsGiftOptionVector) Decode(b *bin.Buffer) error { + if vec == nil { + return fmt.Errorf("can't decode Vector to nil") + } + + return vec.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (vec *StarsGiftOptionVector) DecodeBare(b *bin.Buffer) error { + if vec == nil { + return fmt.Errorf("can't decode Vector to nil") + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode Vector: field Elems: %w", err) + } + + if headerLen > 0 { + vec.Elems = make([]StarsGiftOption, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value StarsGiftOption + if err := value.Decode(b); err != nil { + return fmt.Errorf("unable to decode Vector: field Elems: %w", err) + } + vec.Elems = append(vec.Elems, value) + } + } + return nil +} + +// GetElems returns value of Elems field. +func (vec *StarsGiftOptionVector) GetElems() (value []StarsGiftOption) { + if vec == nil { + return + } + return vec.Elems +} diff --git a/vendor/github.com/gotd/td/tg/tl_stars_gift_option_vector_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_gift_option_vector_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stars_gift_option_vector_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_stars_giveaway_option_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_giveaway_option_gen.go new file mode 100644 index 00000000..dc95d8f6 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stars_giveaway_option_gen.go @@ -0,0 +1,420 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// StarsGiveawayOption represents TL type `starsGiveawayOption#94ce852a`. +// +// See https://core.telegram.org/constructor/starsGiveawayOption for reference. +type StarsGiveawayOption struct { + // Flags field of StarsGiveawayOption. + Flags bin.Fields + // Extended field of StarsGiveawayOption. + Extended bool + // Default field of StarsGiveawayOption. + Default bool + // Stars field of StarsGiveawayOption. + Stars int64 + // YearlyBoosts field of StarsGiveawayOption. + YearlyBoosts int + // StoreProduct field of StarsGiveawayOption. + // + // Use SetStoreProduct and GetStoreProduct helpers. + StoreProduct string + // Currency field of StarsGiveawayOption. + Currency string + // Amount field of StarsGiveawayOption. + Amount int64 + // Winners field of StarsGiveawayOption. + Winners []StarsGiveawayWinnersOption +} + +// StarsGiveawayOptionTypeID is TL type id of StarsGiveawayOption. +const StarsGiveawayOptionTypeID = 0x94ce852a + +// Ensuring interfaces in compile-time for StarsGiveawayOption. +var ( + _ bin.Encoder = &StarsGiveawayOption{} + _ bin.Decoder = &StarsGiveawayOption{} + _ bin.BareEncoder = &StarsGiveawayOption{} + _ bin.BareDecoder = &StarsGiveawayOption{} +) + +func (s *StarsGiveawayOption) Zero() bool { + if s == nil { + return true + } + if !(s.Flags.Zero()) { + return false + } + if !(s.Extended == false) { + return false + } + if !(s.Default == false) { + return false + } + if !(s.Stars == 0) { + return false + } + if !(s.YearlyBoosts == 0) { + return false + } + if !(s.StoreProduct == "") { + return false + } + if !(s.Currency == "") { + return false + } + if !(s.Amount == 0) { + return false + } + if !(s.Winners == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarsGiveawayOption) String() string { + if s == nil { + return "StarsGiveawayOption(nil)" + } + type Alias StarsGiveawayOption + return fmt.Sprintf("StarsGiveawayOption%+v", Alias(*s)) +} + +// FillFrom fills StarsGiveawayOption from given interface. +func (s *StarsGiveawayOption) FillFrom(from interface { + GetExtended() (value bool) + GetDefault() (value bool) + GetStars() (value int64) + GetYearlyBoosts() (value int) + GetStoreProduct() (value string, ok bool) + GetCurrency() (value string) + GetAmount() (value int64) + GetWinners() (value []StarsGiveawayWinnersOption) +}) { + s.Extended = from.GetExtended() + s.Default = from.GetDefault() + s.Stars = from.GetStars() + s.YearlyBoosts = from.GetYearlyBoosts() + if val, ok := from.GetStoreProduct(); ok { + s.StoreProduct = val + } + + s.Currency = from.GetCurrency() + s.Amount = from.GetAmount() + s.Winners = from.GetWinners() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarsGiveawayOption) TypeID() uint32 { + return StarsGiveawayOptionTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarsGiveawayOption) TypeName() string { + return "starsGiveawayOption" +} + +// TypeInfo returns info about TL type. +func (s *StarsGiveawayOption) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starsGiveawayOption", + ID: StarsGiveawayOptionTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Extended", + SchemaName: "extended", + Null: !s.Flags.Has(0), + }, + { + Name: "Default", + SchemaName: "default", + Null: !s.Flags.Has(1), + }, + { + Name: "Stars", + SchemaName: "stars", + }, + { + Name: "YearlyBoosts", + SchemaName: "yearly_boosts", + }, + { + Name: "StoreProduct", + SchemaName: "store_product", + Null: !s.Flags.Has(2), + }, + { + Name: "Currency", + SchemaName: "currency", + }, + { + Name: "Amount", + SchemaName: "amount", + }, + { + Name: "Winners", + SchemaName: "winners", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (s *StarsGiveawayOption) SetFlags() { + if !(s.Extended == false) { + s.Flags.Set(0) + } + if !(s.Default == false) { + s.Flags.Set(1) + } + if !(s.StoreProduct == "") { + s.Flags.Set(2) + } +} + +// Encode implements bin.Encoder. +func (s *StarsGiveawayOption) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starsGiveawayOption#94ce852a as nil") + } + b.PutID(StarsGiveawayOptionTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarsGiveawayOption) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starsGiveawayOption#94ce852a as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode starsGiveawayOption#94ce852a: field flags: %w", err) + } + b.PutLong(s.Stars) + b.PutInt(s.YearlyBoosts) + if s.Flags.Has(2) { + b.PutString(s.StoreProduct) + } + b.PutString(s.Currency) + b.PutLong(s.Amount) + b.PutVectorHeader(len(s.Winners)) + for idx, v := range s.Winners { + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode starsGiveawayOption#94ce852a: field winners element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StarsGiveawayOption) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starsGiveawayOption#94ce852a to nil") + } + if err := b.ConsumeID(StarsGiveawayOptionTypeID); err != nil { + return fmt.Errorf("unable to decode starsGiveawayOption#94ce852a: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarsGiveawayOption) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starsGiveawayOption#94ce852a to nil") + } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode starsGiveawayOption#94ce852a: field flags: %w", err) + } + } + s.Extended = s.Flags.Has(0) + s.Default = s.Flags.Has(1) + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode starsGiveawayOption#94ce852a: field stars: %w", err) + } + s.Stars = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starsGiveawayOption#94ce852a: field yearly_boosts: %w", err) + } + s.YearlyBoosts = value + } + if s.Flags.Has(2) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode starsGiveawayOption#94ce852a: field store_product: %w", err) + } + s.StoreProduct = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode starsGiveawayOption#94ce852a: field currency: %w", err) + } + s.Currency = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode starsGiveawayOption#94ce852a: field amount: %w", err) + } + s.Amount = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode starsGiveawayOption#94ce852a: field winners: %w", err) + } + + if headerLen > 0 { + s.Winners = make([]StarsGiveawayWinnersOption, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value StarsGiveawayWinnersOption + if err := value.Decode(b); err != nil { + return fmt.Errorf("unable to decode starsGiveawayOption#94ce852a: field winners: %w", err) + } + s.Winners = append(s.Winners, value) + } + } + return nil +} + +// SetExtended sets value of Extended conditional field. +func (s *StarsGiveawayOption) SetExtended(value bool) { + if value { + s.Flags.Set(0) + s.Extended = true + } else { + s.Flags.Unset(0) + s.Extended = false + } +} + +// GetExtended returns value of Extended conditional field. +func (s *StarsGiveawayOption) GetExtended() (value bool) { + if s == nil { + return + } + return s.Flags.Has(0) +} + +// SetDefault sets value of Default conditional field. +func (s *StarsGiveawayOption) SetDefault(value bool) { + if value { + s.Flags.Set(1) + s.Default = true + } else { + s.Flags.Unset(1) + s.Default = false + } +} + +// GetDefault returns value of Default conditional field. +func (s *StarsGiveawayOption) GetDefault() (value bool) { + if s == nil { + return + } + return s.Flags.Has(1) +} + +// GetStars returns value of Stars field. +func (s *StarsGiveawayOption) GetStars() (value int64) { + if s == nil { + return + } + return s.Stars +} + +// GetYearlyBoosts returns value of YearlyBoosts field. +func (s *StarsGiveawayOption) GetYearlyBoosts() (value int) { + if s == nil { + return + } + return s.YearlyBoosts +} + +// SetStoreProduct sets value of StoreProduct conditional field. +func (s *StarsGiveawayOption) SetStoreProduct(value string) { + s.Flags.Set(2) + s.StoreProduct = value +} + +// GetStoreProduct returns value of StoreProduct conditional field and +// boolean which is true if field was set. +func (s *StarsGiveawayOption) GetStoreProduct() (value string, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(2) { + return value, false + } + return s.StoreProduct, true +} + +// GetCurrency returns value of Currency field. +func (s *StarsGiveawayOption) GetCurrency() (value string) { + if s == nil { + return + } + return s.Currency +} + +// GetAmount returns value of Amount field. +func (s *StarsGiveawayOption) GetAmount() (value int64) { + if s == nil { + return + } + return s.Amount +} + +// GetWinners returns value of Winners field. +func (s *StarsGiveawayOption) GetWinners() (value []StarsGiveawayWinnersOption) { + if s == nil { + return + } + return s.Winners +} diff --git a/vendor/github.com/gotd/td/tg/tl_stars_giveaway_option_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_giveaway_option_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stars_giveaway_option_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_stars_giveaway_option_vector_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_giveaway_option_vector_gen.go new file mode 100644 index 00000000..ba8898e3 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stars_giveaway_option_vector_gen.go @@ -0,0 +1,172 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// StarsGiveawayOptionVector is a box for Vector +type StarsGiveawayOptionVector struct { + // Elements of Vector + Elems []StarsGiveawayOption +} + +// StarsGiveawayOptionVectorTypeID is TL type id of StarsGiveawayOptionVector. +const StarsGiveawayOptionVectorTypeID = bin.TypeVector + +// Ensuring interfaces in compile-time for StarsGiveawayOptionVector. +var ( + _ bin.Encoder = &StarsGiveawayOptionVector{} + _ bin.Decoder = &StarsGiveawayOptionVector{} + _ bin.BareEncoder = &StarsGiveawayOptionVector{} + _ bin.BareDecoder = &StarsGiveawayOptionVector{} +) + +func (vec *StarsGiveawayOptionVector) Zero() bool { + if vec == nil { + return true + } + if !(vec.Elems == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (vec *StarsGiveawayOptionVector) String() string { + if vec == nil { + return "StarsGiveawayOptionVector(nil)" + } + type Alias StarsGiveawayOptionVector + return fmt.Sprintf("StarsGiveawayOptionVector%+v", Alias(*vec)) +} + +// FillFrom fills StarsGiveawayOptionVector from given interface. +func (vec *StarsGiveawayOptionVector) FillFrom(from interface { + GetElems() (value []StarsGiveawayOption) +}) { + vec.Elems = from.GetElems() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarsGiveawayOptionVector) TypeID() uint32 { + return StarsGiveawayOptionVectorTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarsGiveawayOptionVector) TypeName() string { + return "" +} + +// TypeInfo returns info about TL type. +func (vec *StarsGiveawayOptionVector) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "", + ID: StarsGiveawayOptionVectorTypeID, + } + if vec == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Elems", + SchemaName: "Elems", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (vec *StarsGiveawayOptionVector) Encode(b *bin.Buffer) error { + if vec == nil { + return fmt.Errorf("can't encode Vector as nil") + } + + return vec.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (vec *StarsGiveawayOptionVector) EncodeBare(b *bin.Buffer) error { + if vec == nil { + return fmt.Errorf("can't encode Vector as nil") + } + b.PutVectorHeader(len(vec.Elems)) + for idx, v := range vec.Elems { + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode Vector: field Elems element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (vec *StarsGiveawayOptionVector) Decode(b *bin.Buffer) error { + if vec == nil { + return fmt.Errorf("can't decode Vector to nil") + } + + return vec.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (vec *StarsGiveawayOptionVector) DecodeBare(b *bin.Buffer) error { + if vec == nil { + return fmt.Errorf("can't decode Vector to nil") + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode Vector: field Elems: %w", err) + } + + if headerLen > 0 { + vec.Elems = make([]StarsGiveawayOption, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value StarsGiveawayOption + if err := value.Decode(b); err != nil { + return fmt.Errorf("unable to decode Vector: field Elems: %w", err) + } + vec.Elems = append(vec.Elems, value) + } + } + return nil +} + +// GetElems returns value of Elems field. +func (vec *StarsGiveawayOptionVector) GetElems() (value []StarsGiveawayOption) { + if vec == nil { + return + } + return vec.Elems +} diff --git a/vendor/github.com/gotd/td/tg/tl_stars_giveaway_option_vector_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_giveaway_option_vector_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stars_giveaway_option_vector_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_stars_giveaway_winners_option_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_giveaway_winners_option_gen.go new file mode 100644 index 00000000..caa566ae --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stars_giveaway_winners_option_gen.go @@ -0,0 +1,241 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// StarsGiveawayWinnersOption represents TL type `starsGiveawayWinnersOption#54236209`. +// +// See https://core.telegram.org/constructor/starsGiveawayWinnersOption for reference. +type StarsGiveawayWinnersOption struct { + // Flags field of StarsGiveawayWinnersOption. + Flags bin.Fields + // Default field of StarsGiveawayWinnersOption. + Default bool + // Users field of StarsGiveawayWinnersOption. + Users int + // PerUserStars field of StarsGiveawayWinnersOption. + PerUserStars int64 +} + +// StarsGiveawayWinnersOptionTypeID is TL type id of StarsGiveawayWinnersOption. +const StarsGiveawayWinnersOptionTypeID = 0x54236209 + +// Ensuring interfaces in compile-time for StarsGiveawayWinnersOption. +var ( + _ bin.Encoder = &StarsGiveawayWinnersOption{} + _ bin.Decoder = &StarsGiveawayWinnersOption{} + _ bin.BareEncoder = &StarsGiveawayWinnersOption{} + _ bin.BareDecoder = &StarsGiveawayWinnersOption{} +) + +func (s *StarsGiveawayWinnersOption) Zero() bool { + if s == nil { + return true + } + if !(s.Flags.Zero()) { + return false + } + if !(s.Default == false) { + return false + } + if !(s.Users == 0) { + return false + } + if !(s.PerUserStars == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarsGiveawayWinnersOption) String() string { + if s == nil { + return "StarsGiveawayWinnersOption(nil)" + } + type Alias StarsGiveawayWinnersOption + return fmt.Sprintf("StarsGiveawayWinnersOption%+v", Alias(*s)) +} + +// FillFrom fills StarsGiveawayWinnersOption from given interface. +func (s *StarsGiveawayWinnersOption) FillFrom(from interface { + GetDefault() (value bool) + GetUsers() (value int) + GetPerUserStars() (value int64) +}) { + s.Default = from.GetDefault() + s.Users = from.GetUsers() + s.PerUserStars = from.GetPerUserStars() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarsGiveawayWinnersOption) TypeID() uint32 { + return StarsGiveawayWinnersOptionTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarsGiveawayWinnersOption) TypeName() string { + return "starsGiveawayWinnersOption" +} + +// TypeInfo returns info about TL type. +func (s *StarsGiveawayWinnersOption) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starsGiveawayWinnersOption", + ID: StarsGiveawayWinnersOptionTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Default", + SchemaName: "default", + Null: !s.Flags.Has(0), + }, + { + Name: "Users", + SchemaName: "users", + }, + { + Name: "PerUserStars", + SchemaName: "per_user_stars", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (s *StarsGiveawayWinnersOption) SetFlags() { + if !(s.Default == false) { + s.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (s *StarsGiveawayWinnersOption) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starsGiveawayWinnersOption#54236209 as nil") + } + b.PutID(StarsGiveawayWinnersOptionTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarsGiveawayWinnersOption) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starsGiveawayWinnersOption#54236209 as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode starsGiveawayWinnersOption#54236209: field flags: %w", err) + } + b.PutInt(s.Users) + b.PutLong(s.PerUserStars) + return nil +} + +// Decode implements bin.Decoder. +func (s *StarsGiveawayWinnersOption) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starsGiveawayWinnersOption#54236209 to nil") + } + if err := b.ConsumeID(StarsGiveawayWinnersOptionTypeID); err != nil { + return fmt.Errorf("unable to decode starsGiveawayWinnersOption#54236209: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarsGiveawayWinnersOption) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starsGiveawayWinnersOption#54236209 to nil") + } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode starsGiveawayWinnersOption#54236209: field flags: %w", err) + } + } + s.Default = s.Flags.Has(0) + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starsGiveawayWinnersOption#54236209: field users: %w", err) + } + s.Users = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode starsGiveawayWinnersOption#54236209: field per_user_stars: %w", err) + } + s.PerUserStars = value + } + return nil +} + +// SetDefault sets value of Default conditional field. +func (s *StarsGiveawayWinnersOption) SetDefault(value bool) { + if value { + s.Flags.Set(0) + s.Default = true + } else { + s.Flags.Unset(0) + s.Default = false + } +} + +// GetDefault returns value of Default conditional field. +func (s *StarsGiveawayWinnersOption) GetDefault() (value bool) { + if s == nil { + return + } + return s.Flags.Has(0) +} + +// GetUsers returns value of Users field. +func (s *StarsGiveawayWinnersOption) GetUsers() (value int) { + if s == nil { + return + } + return s.Users +} + +// GetPerUserStars returns value of PerUserStars field. +func (s *StarsGiveawayWinnersOption) GetPerUserStars() (value int64) { + if s == nil { + return + } + return s.PerUserStars +} diff --git a/vendor/github.com/gotd/td/tg/tl_stars_giveaway_winners_option_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_giveaway_winners_option_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stars_giveaway_winners_option_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_stars_revenue_status_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_revenue_status_gen.go new file mode 100644 index 00000000..8cb4bdd1 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stars_revenue_status_gen.go @@ -0,0 +1,327 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// StarsRevenueStatus represents TL type `starsRevenueStatus#79342946`. +// Describes Telegram Star revenue balances »¹. +// +// Links: +// 1. https://core.telegram.org/api/stars +// +// See https://core.telegram.org/constructor/starsRevenueStatus for reference. +type StarsRevenueStatus struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // If set, the user may withdraw¹ up to available_balance stars. + // + // Links: + // 1) https://core.telegram.org/api/stars#withdrawing-revenue + WithdrawalEnabled bool + // Amount of not-yet-withdrawn Telegram Stars. + CurrentBalance int64 + // Amount of withdrawable Telegram Stars. + AvailableBalance int64 + // Total amount of earned Telegram Stars. + OverallRevenue int64 + // Unixtime indicating when will withdrawal be available to the user. If not set, + // withdrawal can be started now. + // + // Use SetNextWithdrawalAt and GetNextWithdrawalAt helpers. + NextWithdrawalAt int +} + +// StarsRevenueStatusTypeID is TL type id of StarsRevenueStatus. +const StarsRevenueStatusTypeID = 0x79342946 + +// Ensuring interfaces in compile-time for StarsRevenueStatus. +var ( + _ bin.Encoder = &StarsRevenueStatus{} + _ bin.Decoder = &StarsRevenueStatus{} + _ bin.BareEncoder = &StarsRevenueStatus{} + _ bin.BareDecoder = &StarsRevenueStatus{} +) + +func (s *StarsRevenueStatus) Zero() bool { + if s == nil { + return true + } + if !(s.Flags.Zero()) { + return false + } + if !(s.WithdrawalEnabled == false) { + return false + } + if !(s.CurrentBalance == 0) { + return false + } + if !(s.AvailableBalance == 0) { + return false + } + if !(s.OverallRevenue == 0) { + return false + } + if !(s.NextWithdrawalAt == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarsRevenueStatus) String() string { + if s == nil { + return "StarsRevenueStatus(nil)" + } + type Alias StarsRevenueStatus + return fmt.Sprintf("StarsRevenueStatus%+v", Alias(*s)) +} + +// FillFrom fills StarsRevenueStatus from given interface. +func (s *StarsRevenueStatus) FillFrom(from interface { + GetWithdrawalEnabled() (value bool) + GetCurrentBalance() (value int64) + GetAvailableBalance() (value int64) + GetOverallRevenue() (value int64) + GetNextWithdrawalAt() (value int, ok bool) +}) { + s.WithdrawalEnabled = from.GetWithdrawalEnabled() + s.CurrentBalance = from.GetCurrentBalance() + s.AvailableBalance = from.GetAvailableBalance() + s.OverallRevenue = from.GetOverallRevenue() + if val, ok := from.GetNextWithdrawalAt(); ok { + s.NextWithdrawalAt = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarsRevenueStatus) TypeID() uint32 { + return StarsRevenueStatusTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarsRevenueStatus) TypeName() string { + return "starsRevenueStatus" +} + +// TypeInfo returns info about TL type. +func (s *StarsRevenueStatus) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starsRevenueStatus", + ID: StarsRevenueStatusTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "WithdrawalEnabled", + SchemaName: "withdrawal_enabled", + Null: !s.Flags.Has(0), + }, + { + Name: "CurrentBalance", + SchemaName: "current_balance", + }, + { + Name: "AvailableBalance", + SchemaName: "available_balance", + }, + { + Name: "OverallRevenue", + SchemaName: "overall_revenue", + }, + { + Name: "NextWithdrawalAt", + SchemaName: "next_withdrawal_at", + Null: !s.Flags.Has(1), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (s *StarsRevenueStatus) SetFlags() { + if !(s.WithdrawalEnabled == false) { + s.Flags.Set(0) + } + if !(s.NextWithdrawalAt == 0) { + s.Flags.Set(1) + } +} + +// Encode implements bin.Encoder. +func (s *StarsRevenueStatus) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starsRevenueStatus#79342946 as nil") + } + b.PutID(StarsRevenueStatusTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarsRevenueStatus) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starsRevenueStatus#79342946 as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode starsRevenueStatus#79342946: field flags: %w", err) + } + b.PutLong(s.CurrentBalance) + b.PutLong(s.AvailableBalance) + b.PutLong(s.OverallRevenue) + if s.Flags.Has(1) { + b.PutInt(s.NextWithdrawalAt) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StarsRevenueStatus) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starsRevenueStatus#79342946 to nil") + } + if err := b.ConsumeID(StarsRevenueStatusTypeID); err != nil { + return fmt.Errorf("unable to decode starsRevenueStatus#79342946: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarsRevenueStatus) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starsRevenueStatus#79342946 to nil") + } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode starsRevenueStatus#79342946: field flags: %w", err) + } + } + s.WithdrawalEnabled = s.Flags.Has(0) + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode starsRevenueStatus#79342946: field current_balance: %w", err) + } + s.CurrentBalance = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode starsRevenueStatus#79342946: field available_balance: %w", err) + } + s.AvailableBalance = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode starsRevenueStatus#79342946: field overall_revenue: %w", err) + } + s.OverallRevenue = value + } + if s.Flags.Has(1) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starsRevenueStatus#79342946: field next_withdrawal_at: %w", err) + } + s.NextWithdrawalAt = value + } + return nil +} + +// SetWithdrawalEnabled sets value of WithdrawalEnabled conditional field. +func (s *StarsRevenueStatus) SetWithdrawalEnabled(value bool) { + if value { + s.Flags.Set(0) + s.WithdrawalEnabled = true + } else { + s.Flags.Unset(0) + s.WithdrawalEnabled = false + } +} + +// GetWithdrawalEnabled returns value of WithdrawalEnabled conditional field. +func (s *StarsRevenueStatus) GetWithdrawalEnabled() (value bool) { + if s == nil { + return + } + return s.Flags.Has(0) +} + +// GetCurrentBalance returns value of CurrentBalance field. +func (s *StarsRevenueStatus) GetCurrentBalance() (value int64) { + if s == nil { + return + } + return s.CurrentBalance +} + +// GetAvailableBalance returns value of AvailableBalance field. +func (s *StarsRevenueStatus) GetAvailableBalance() (value int64) { + if s == nil { + return + } + return s.AvailableBalance +} + +// GetOverallRevenue returns value of OverallRevenue field. +func (s *StarsRevenueStatus) GetOverallRevenue() (value int64) { + if s == nil { + return + } + return s.OverallRevenue +} + +// SetNextWithdrawalAt sets value of NextWithdrawalAt conditional field. +func (s *StarsRevenueStatus) SetNextWithdrawalAt(value int) { + s.Flags.Set(1) + s.NextWithdrawalAt = value +} + +// GetNextWithdrawalAt returns value of NextWithdrawalAt conditional field and +// boolean which is true if field was set. +func (s *StarsRevenueStatus) GetNextWithdrawalAt() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(1) { + return value, false + } + return s.NextWithdrawalAt, true +} diff --git a/vendor/github.com/gotd/td/tg/tl_stars_revenue_status_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_revenue_status_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stars_revenue_status_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_stars_subscription_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_subscription_gen.go new file mode 100644 index 00000000..9add3acb --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stars_subscription_gen.go @@ -0,0 +1,418 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// StarsSubscription represents TL type `starsSubscription#538ecf18`. +// +// See https://core.telegram.org/constructor/starsSubscription for reference. +type StarsSubscription struct { + // Flags field of StarsSubscription. + Flags bin.Fields + // Canceled field of StarsSubscription. + Canceled bool + // CanRefulfill field of StarsSubscription. + CanRefulfill bool + // MissingBalance field of StarsSubscription. + MissingBalance bool + // ID field of StarsSubscription. + ID string + // Peer field of StarsSubscription. + Peer PeerClass + // UntilDate field of StarsSubscription. + UntilDate int + // Pricing field of StarsSubscription. + Pricing StarsSubscriptionPricing + // ChatInviteHash field of StarsSubscription. + // + // Use SetChatInviteHash and GetChatInviteHash helpers. + ChatInviteHash string +} + +// StarsSubscriptionTypeID is TL type id of StarsSubscription. +const StarsSubscriptionTypeID = 0x538ecf18 + +// Ensuring interfaces in compile-time for StarsSubscription. +var ( + _ bin.Encoder = &StarsSubscription{} + _ bin.Decoder = &StarsSubscription{} + _ bin.BareEncoder = &StarsSubscription{} + _ bin.BareDecoder = &StarsSubscription{} +) + +func (s *StarsSubscription) Zero() bool { + if s == nil { + return true + } + if !(s.Flags.Zero()) { + return false + } + if !(s.Canceled == false) { + return false + } + if !(s.CanRefulfill == false) { + return false + } + if !(s.MissingBalance == false) { + return false + } + if !(s.ID == "") { + return false + } + if !(s.Peer == nil) { + return false + } + if !(s.UntilDate == 0) { + return false + } + if !(s.Pricing.Zero()) { + return false + } + if !(s.ChatInviteHash == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarsSubscription) String() string { + if s == nil { + return "StarsSubscription(nil)" + } + type Alias StarsSubscription + return fmt.Sprintf("StarsSubscription%+v", Alias(*s)) +} + +// FillFrom fills StarsSubscription from given interface. +func (s *StarsSubscription) FillFrom(from interface { + GetCanceled() (value bool) + GetCanRefulfill() (value bool) + GetMissingBalance() (value bool) + GetID() (value string) + GetPeer() (value PeerClass) + GetUntilDate() (value int) + GetPricing() (value StarsSubscriptionPricing) + GetChatInviteHash() (value string, ok bool) +}) { + s.Canceled = from.GetCanceled() + s.CanRefulfill = from.GetCanRefulfill() + s.MissingBalance = from.GetMissingBalance() + s.ID = from.GetID() + s.Peer = from.GetPeer() + s.UntilDate = from.GetUntilDate() + s.Pricing = from.GetPricing() + if val, ok := from.GetChatInviteHash(); ok { + s.ChatInviteHash = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarsSubscription) TypeID() uint32 { + return StarsSubscriptionTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarsSubscription) TypeName() string { + return "starsSubscription" +} + +// TypeInfo returns info about TL type. +func (s *StarsSubscription) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starsSubscription", + ID: StarsSubscriptionTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Canceled", + SchemaName: "canceled", + Null: !s.Flags.Has(0), + }, + { + Name: "CanRefulfill", + SchemaName: "can_refulfill", + Null: !s.Flags.Has(1), + }, + { + Name: "MissingBalance", + SchemaName: "missing_balance", + Null: !s.Flags.Has(2), + }, + { + Name: "ID", + SchemaName: "id", + }, + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "UntilDate", + SchemaName: "until_date", + }, + { + Name: "Pricing", + SchemaName: "pricing", + }, + { + Name: "ChatInviteHash", + SchemaName: "chat_invite_hash", + Null: !s.Flags.Has(3), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (s *StarsSubscription) SetFlags() { + if !(s.Canceled == false) { + s.Flags.Set(0) + } + if !(s.CanRefulfill == false) { + s.Flags.Set(1) + } + if !(s.MissingBalance == false) { + s.Flags.Set(2) + } + if !(s.ChatInviteHash == "") { + s.Flags.Set(3) + } +} + +// Encode implements bin.Encoder. +func (s *StarsSubscription) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starsSubscription#538ecf18 as nil") + } + b.PutID(StarsSubscriptionTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarsSubscription) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starsSubscription#538ecf18 as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode starsSubscription#538ecf18: field flags: %w", err) + } + b.PutString(s.ID) + if s.Peer == nil { + return fmt.Errorf("unable to encode starsSubscription#538ecf18: field peer is nil") + } + if err := s.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode starsSubscription#538ecf18: field peer: %w", err) + } + b.PutInt(s.UntilDate) + if err := s.Pricing.Encode(b); err != nil { + return fmt.Errorf("unable to encode starsSubscription#538ecf18: field pricing: %w", err) + } + if s.Flags.Has(3) { + b.PutString(s.ChatInviteHash) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StarsSubscription) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starsSubscription#538ecf18 to nil") + } + if err := b.ConsumeID(StarsSubscriptionTypeID); err != nil { + return fmt.Errorf("unable to decode starsSubscription#538ecf18: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarsSubscription) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starsSubscription#538ecf18 to nil") + } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode starsSubscription#538ecf18: field flags: %w", err) + } + } + s.Canceled = s.Flags.Has(0) + s.CanRefulfill = s.Flags.Has(1) + s.MissingBalance = s.Flags.Has(2) + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode starsSubscription#538ecf18: field id: %w", err) + } + s.ID = value + } + { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode starsSubscription#538ecf18: field peer: %w", err) + } + s.Peer = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starsSubscription#538ecf18: field until_date: %w", err) + } + s.UntilDate = value + } + { + if err := s.Pricing.Decode(b); err != nil { + return fmt.Errorf("unable to decode starsSubscription#538ecf18: field pricing: %w", err) + } + } + if s.Flags.Has(3) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode starsSubscription#538ecf18: field chat_invite_hash: %w", err) + } + s.ChatInviteHash = value + } + return nil +} + +// SetCanceled sets value of Canceled conditional field. +func (s *StarsSubscription) SetCanceled(value bool) { + if value { + s.Flags.Set(0) + s.Canceled = true + } else { + s.Flags.Unset(0) + s.Canceled = false + } +} + +// GetCanceled returns value of Canceled conditional field. +func (s *StarsSubscription) GetCanceled() (value bool) { + if s == nil { + return + } + return s.Flags.Has(0) +} + +// SetCanRefulfill sets value of CanRefulfill conditional field. +func (s *StarsSubscription) SetCanRefulfill(value bool) { + if value { + s.Flags.Set(1) + s.CanRefulfill = true + } else { + s.Flags.Unset(1) + s.CanRefulfill = false + } +} + +// GetCanRefulfill returns value of CanRefulfill conditional field. +func (s *StarsSubscription) GetCanRefulfill() (value bool) { + if s == nil { + return + } + return s.Flags.Has(1) +} + +// SetMissingBalance sets value of MissingBalance conditional field. +func (s *StarsSubscription) SetMissingBalance(value bool) { + if value { + s.Flags.Set(2) + s.MissingBalance = true + } else { + s.Flags.Unset(2) + s.MissingBalance = false + } +} + +// GetMissingBalance returns value of MissingBalance conditional field. +func (s *StarsSubscription) GetMissingBalance() (value bool) { + if s == nil { + return + } + return s.Flags.Has(2) +} + +// GetID returns value of ID field. +func (s *StarsSubscription) GetID() (value string) { + if s == nil { + return + } + return s.ID +} + +// GetPeer returns value of Peer field. +func (s *StarsSubscription) GetPeer() (value PeerClass) { + if s == nil { + return + } + return s.Peer +} + +// GetUntilDate returns value of UntilDate field. +func (s *StarsSubscription) GetUntilDate() (value int) { + if s == nil { + return + } + return s.UntilDate +} + +// GetPricing returns value of Pricing field. +func (s *StarsSubscription) GetPricing() (value StarsSubscriptionPricing) { + if s == nil { + return + } + return s.Pricing +} + +// SetChatInviteHash sets value of ChatInviteHash conditional field. +func (s *StarsSubscription) SetChatInviteHash(value string) { + s.Flags.Set(3) + s.ChatInviteHash = value +} + +// GetChatInviteHash returns value of ChatInviteHash conditional field and +// boolean which is true if field was set. +func (s *StarsSubscription) GetChatInviteHash() (value string, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(3) { + return value, false + } + return s.ChatInviteHash, true +} diff --git a/vendor/github.com/gotd/td/tg/tl_stars_subscription_pricing_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_subscription_pricing_gen.go new file mode 100644 index 00000000..1ab62d69 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stars_subscription_pricing_gen.go @@ -0,0 +1,188 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// StarsSubscriptionPricing represents TL type `starsSubscriptionPricing#5416d58`. +// +// See https://core.telegram.org/constructor/starsSubscriptionPricing for reference. +type StarsSubscriptionPricing struct { + // Period field of StarsSubscriptionPricing. + Period int + // Amount field of StarsSubscriptionPricing. + Amount int64 +} + +// StarsSubscriptionPricingTypeID is TL type id of StarsSubscriptionPricing. +const StarsSubscriptionPricingTypeID = 0x5416d58 + +// Ensuring interfaces in compile-time for StarsSubscriptionPricing. +var ( + _ bin.Encoder = &StarsSubscriptionPricing{} + _ bin.Decoder = &StarsSubscriptionPricing{} + _ bin.BareEncoder = &StarsSubscriptionPricing{} + _ bin.BareDecoder = &StarsSubscriptionPricing{} +) + +func (s *StarsSubscriptionPricing) Zero() bool { + if s == nil { + return true + } + if !(s.Period == 0) { + return false + } + if !(s.Amount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarsSubscriptionPricing) String() string { + if s == nil { + return "StarsSubscriptionPricing(nil)" + } + type Alias StarsSubscriptionPricing + return fmt.Sprintf("StarsSubscriptionPricing%+v", Alias(*s)) +} + +// FillFrom fills StarsSubscriptionPricing from given interface. +func (s *StarsSubscriptionPricing) FillFrom(from interface { + GetPeriod() (value int) + GetAmount() (value int64) +}) { + s.Period = from.GetPeriod() + s.Amount = from.GetAmount() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarsSubscriptionPricing) TypeID() uint32 { + return StarsSubscriptionPricingTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarsSubscriptionPricing) TypeName() string { + return "starsSubscriptionPricing" +} + +// TypeInfo returns info about TL type. +func (s *StarsSubscriptionPricing) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starsSubscriptionPricing", + ID: StarsSubscriptionPricingTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Period", + SchemaName: "period", + }, + { + Name: "Amount", + SchemaName: "amount", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StarsSubscriptionPricing) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starsSubscriptionPricing#5416d58 as nil") + } + b.PutID(StarsSubscriptionPricingTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarsSubscriptionPricing) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starsSubscriptionPricing#5416d58 as nil") + } + b.PutInt(s.Period) + b.PutLong(s.Amount) + return nil +} + +// Decode implements bin.Decoder. +func (s *StarsSubscriptionPricing) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starsSubscriptionPricing#5416d58 to nil") + } + if err := b.ConsumeID(StarsSubscriptionPricingTypeID); err != nil { + return fmt.Errorf("unable to decode starsSubscriptionPricing#5416d58: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarsSubscriptionPricing) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starsSubscriptionPricing#5416d58 to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starsSubscriptionPricing#5416d58: field period: %w", err) + } + s.Period = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode starsSubscriptionPricing#5416d58: field amount: %w", err) + } + s.Amount = value + } + return nil +} + +// GetPeriod returns value of Period field. +func (s *StarsSubscriptionPricing) GetPeriod() (value int) { + if s == nil { + return + } + return s.Period +} + +// GetAmount returns value of Amount field. +func (s *StarsSubscriptionPricing) GetAmount() (value int64) { + if s == nil { + return + } + return s.Amount +} diff --git a/vendor/github.com/gotd/td/tg/tl_stars_subscription_pricing_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_subscription_pricing_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stars_subscription_pricing_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_stars_subscription_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_subscription_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stars_subscription_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_stars_topup_option_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_topup_option_gen.go index f1317373..496ac138 100644 --- a/vendor/github.com/gotd/td/tg/tl_stars_topup_option_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stars_topup_option_gen.go @@ -32,22 +32,38 @@ var ( ) // StarsTopupOption represents TL type `starsTopupOption#bd915c0`. +// Telegram Stars topup option¹. +// +// Links: +// 1. https://core.telegram.org/api/stars // // See https://core.telegram.org/constructor/starsTopupOption for reference. type StarsTopupOption struct { - // Flags field of StarsTopupOption. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Extended field of StarsTopupOption. + // If set, the option must only be shown in the full list of topup options. Extended bool - // Stars field of StarsTopupOption. + // Amount of Telegram stars. Stars int64 - // StoreProduct field of StarsTopupOption. + // Identifier of the store product associated with the option, official apps only. // // Use SetStoreProduct and GetStoreProduct helpers. StoreProduct string - // Currency field of StarsTopupOption. + // Three-letter ISO 4217 currency¹ code + // + // Links: + // 1) https://core.telegram.org/bots/payments#supported-currencies Currency string - // Amount field of StarsTopupOption. + // Price of the product in the smallest units of the currency (integer, not float/double) + // For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in + // currencies.json¹, it shows the number of digits past the decimal point for each + // currency (2 for the majority of currencies). + // + // Links: + // 1) https://core.telegram.org/bots/payments/currencies.json Amount int64 } diff --git a/vendor/github.com/gotd/td/tg/tl_stars_transaction_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_transaction_gen.go index 0e1f85be..cce80bfd 100644 --- a/vendor/github.com/gotd/td/tg/tl_stars_transaction_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stars_transaction_gen.go @@ -31,38 +31,97 @@ var ( _ = tdjson.Encoder{} ) -// StarsTransaction represents TL type `starsTransaction#cc7079b2`. +// StarsTransaction represents TL type `starsTransaction#ee7522d5`. +// Represents a Telegram Stars transaction »¹. +// +// Links: +// 1. https://core.telegram.org/api/stars // // See https://core.telegram.org/constructor/starsTransaction for reference. type StarsTransaction struct { - // Flags field of StarsTransaction. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Refund field of StarsTransaction. + // Whether this transaction is a refund. Refund bool - // ID field of StarsTransaction. + // The transaction is currently pending. + Pending bool + // This transaction has failed. + Failed bool + // This transaction was a gift from the user in peer.peer. + Gift bool + // Reaction field of StarsTransaction. + Reaction bool + // Transaction ID. ID string - // Stars field of StarsTransaction. + // Amount of Stars (negative for outgoing transactions). Stars int64 - // Date field of StarsTransaction. + // Date of the transaction (unixtime). Date int - // Peer field of StarsTransaction. + // Source of the incoming transaction, or its recipient for outgoing transactions. Peer StarsTransactionPeerClass - // Title field of StarsTransaction. + // For transactions with bots, title of the bought product. // // Use SetTitle and GetTitle helpers. Title string - // Description field of StarsTransaction. + // For transactions with bots, description of the bought product. // // Use SetDescription and GetDescription helpers. Description string - // Photo field of StarsTransaction. + // For transactions with bots, photo of the bought product. // // Use SetPhoto and GetPhoto helpers. Photo WebDocumentClass + // If neither pending nor failed are set, the transaction was completed successfully, and + // this field will contain the point in time (Unix timestamp) when the withdrawal was + // completed successfully. + // + // Use SetTransactionDate and GetTransactionDate helpers. + TransactionDate int + // If neither pending nor failed are set, the transaction was completed successfully, and + // this field will contain a URL where the withdrawal transaction can be viewed. + // + // Use SetTransactionURL and GetTransactionURL helpers. + TransactionURL string + // Bot specified invoice payload (i.e. the payload passed to inputMediaInvoice¹ when + // creating the invoice²). + // + // Links: + // 1) https://core.telegram.org/constructor/inputMediaInvoice + // 2) https://core.telegram.org/api/payments + // + // Use SetBotPayload and GetBotPayload helpers. + BotPayload []byte + // For paid media transactions »¹, message ID of the paid media posted to peer.peer + // (can point to a deleted message; either way, extended_media will always contain the + // bought media). + // + // Links: + // 1) https://core.telegram.org/api/paid-media + // + // Use SetMsgID and GetMsgID helpers. + MsgID int + // The purchased paid media »¹. + // + // Links: + // 1) https://core.telegram.org/api/paid-media + // + // Use SetExtendedMedia and GetExtendedMedia helpers. + ExtendedMedia []MessageMediaClass + // SubscriptionPeriod field of StarsTransaction. + // + // Use SetSubscriptionPeriod and GetSubscriptionPeriod helpers. + SubscriptionPeriod int + // GiveawayPostID field of StarsTransaction. + // + // Use SetGiveawayPostID and GetGiveawayPostID helpers. + GiveawayPostID int } // StarsTransactionTypeID is TL type id of StarsTransaction. -const StarsTransactionTypeID = 0xcc7079b2 +const StarsTransactionTypeID = 0xee7522d5 // Ensuring interfaces in compile-time for StarsTransaction. var ( @@ -82,6 +141,18 @@ func (s *StarsTransaction) Zero() bool { if !(s.Refund == false) { return false } + if !(s.Pending == false) { + return false + } + if !(s.Failed == false) { + return false + } + if !(s.Gift == false) { + return false + } + if !(s.Reaction == false) { + return false + } if !(s.ID == "") { return false } @@ -103,6 +174,27 @@ func (s *StarsTransaction) Zero() bool { if !(s.Photo == nil) { return false } + if !(s.TransactionDate == 0) { + return false + } + if !(s.TransactionURL == "") { + return false + } + if !(s.BotPayload == nil) { + return false + } + if !(s.MsgID == 0) { + return false + } + if !(s.ExtendedMedia == nil) { + return false + } + if !(s.SubscriptionPeriod == 0) { + return false + } + if !(s.GiveawayPostID == 0) { + return false + } return true } @@ -119,6 +211,10 @@ func (s *StarsTransaction) String() string { // FillFrom fills StarsTransaction from given interface. func (s *StarsTransaction) FillFrom(from interface { GetRefund() (value bool) + GetPending() (value bool) + GetFailed() (value bool) + GetGift() (value bool) + GetReaction() (value bool) GetID() (value string) GetStars() (value int64) GetDate() (value int) @@ -126,8 +222,19 @@ func (s *StarsTransaction) FillFrom(from interface { GetTitle() (value string, ok bool) GetDescription() (value string, ok bool) GetPhoto() (value WebDocumentClass, ok bool) + GetTransactionDate() (value int, ok bool) + GetTransactionURL() (value string, ok bool) + GetBotPayload() (value []byte, ok bool) + GetMsgID() (value int, ok bool) + GetExtendedMedia() (value []MessageMediaClass, ok bool) + GetSubscriptionPeriod() (value int, ok bool) + GetGiveawayPostID() (value int, ok bool) }) { s.Refund = from.GetRefund() + s.Pending = from.GetPending() + s.Failed = from.GetFailed() + s.Gift = from.GetGift() + s.Reaction = from.GetReaction() s.ID = from.GetID() s.Stars = from.GetStars() s.Date = from.GetDate() @@ -144,6 +251,34 @@ func (s *StarsTransaction) FillFrom(from interface { s.Photo = val } + if val, ok := from.GetTransactionDate(); ok { + s.TransactionDate = val + } + + if val, ok := from.GetTransactionURL(); ok { + s.TransactionURL = val + } + + if val, ok := from.GetBotPayload(); ok { + s.BotPayload = val + } + + if val, ok := from.GetMsgID(); ok { + s.MsgID = val + } + + if val, ok := from.GetExtendedMedia(); ok { + s.ExtendedMedia = val + } + + if val, ok := from.GetSubscriptionPeriod(); ok { + s.SubscriptionPeriod = val + } + + if val, ok := from.GetGiveawayPostID(); ok { + s.GiveawayPostID = val + } + } // TypeID returns type id in TL schema. @@ -174,6 +309,26 @@ func (s *StarsTransaction) TypeInfo() tdp.Type { SchemaName: "refund", Null: !s.Flags.Has(3), }, + { + Name: "Pending", + SchemaName: "pending", + Null: !s.Flags.Has(4), + }, + { + Name: "Failed", + SchemaName: "failed", + Null: !s.Flags.Has(6), + }, + { + Name: "Gift", + SchemaName: "gift", + Null: !s.Flags.Has(10), + }, + { + Name: "Reaction", + SchemaName: "reaction", + Null: !s.Flags.Has(11), + }, { Name: "ID", SchemaName: "id", @@ -205,6 +360,41 @@ func (s *StarsTransaction) TypeInfo() tdp.Type { SchemaName: "photo", Null: !s.Flags.Has(2), }, + { + Name: "TransactionDate", + SchemaName: "transaction_date", + Null: !s.Flags.Has(5), + }, + { + Name: "TransactionURL", + SchemaName: "transaction_url", + Null: !s.Flags.Has(5), + }, + { + Name: "BotPayload", + SchemaName: "bot_payload", + Null: !s.Flags.Has(7), + }, + { + Name: "MsgID", + SchemaName: "msg_id", + Null: !s.Flags.Has(8), + }, + { + Name: "ExtendedMedia", + SchemaName: "extended_media", + Null: !s.Flags.Has(9), + }, + { + Name: "SubscriptionPeriod", + SchemaName: "subscription_period", + Null: !s.Flags.Has(12), + }, + { + Name: "GiveawayPostID", + SchemaName: "giveaway_post_id", + Null: !s.Flags.Has(13), + }, } return typ } @@ -214,6 +404,18 @@ func (s *StarsTransaction) SetFlags() { if !(s.Refund == false) { s.Flags.Set(3) } + if !(s.Pending == false) { + s.Flags.Set(4) + } + if !(s.Failed == false) { + s.Flags.Set(6) + } + if !(s.Gift == false) { + s.Flags.Set(10) + } + if !(s.Reaction == false) { + s.Flags.Set(11) + } if !(s.Title == "") { s.Flags.Set(0) } @@ -223,12 +425,33 @@ func (s *StarsTransaction) SetFlags() { if !(s.Photo == nil) { s.Flags.Set(2) } + if !(s.TransactionDate == 0) { + s.Flags.Set(5) + } + if !(s.TransactionURL == "") { + s.Flags.Set(5) + } + if !(s.BotPayload == nil) { + s.Flags.Set(7) + } + if !(s.MsgID == 0) { + s.Flags.Set(8) + } + if !(s.ExtendedMedia == nil) { + s.Flags.Set(9) + } + if !(s.SubscriptionPeriod == 0) { + s.Flags.Set(12) + } + if !(s.GiveawayPostID == 0) { + s.Flags.Set(13) + } } // Encode implements bin.Encoder. func (s *StarsTransaction) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starsTransaction#cc7079b2 as nil") + return fmt.Errorf("can't encode starsTransaction#ee7522d5 as nil") } b.PutID(StarsTransactionTypeID) return s.EncodeBare(b) @@ -237,20 +460,20 @@ func (s *StarsTransaction) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StarsTransaction) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starsTransaction#cc7079b2 as nil") + return fmt.Errorf("can't encode starsTransaction#ee7522d5 as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode starsTransaction#cc7079b2: field flags: %w", err) + return fmt.Errorf("unable to encode starsTransaction#ee7522d5: field flags: %w", err) } b.PutString(s.ID) b.PutLong(s.Stars) b.PutInt(s.Date) if s.Peer == nil { - return fmt.Errorf("unable to encode starsTransaction#cc7079b2: field peer is nil") + return fmt.Errorf("unable to encode starsTransaction#ee7522d5: field peer is nil") } if err := s.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode starsTransaction#cc7079b2: field peer: %w", err) + return fmt.Errorf("unable to encode starsTransaction#ee7522d5: field peer: %w", err) } if s.Flags.Has(0) { b.PutString(s.Title) @@ -260,22 +483,51 @@ func (s *StarsTransaction) EncodeBare(b *bin.Buffer) error { } if s.Flags.Has(2) { if s.Photo == nil { - return fmt.Errorf("unable to encode starsTransaction#cc7079b2: field photo is nil") + return fmt.Errorf("unable to encode starsTransaction#ee7522d5: field photo is nil") } if err := s.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode starsTransaction#cc7079b2: field photo: %w", err) + return fmt.Errorf("unable to encode starsTransaction#ee7522d5: field photo: %w", err) } } + if s.Flags.Has(5) { + b.PutInt(s.TransactionDate) + } + if s.Flags.Has(5) { + b.PutString(s.TransactionURL) + } + if s.Flags.Has(7) { + b.PutBytes(s.BotPayload) + } + if s.Flags.Has(8) { + b.PutInt(s.MsgID) + } + if s.Flags.Has(9) { + b.PutVectorHeader(len(s.ExtendedMedia)) + for idx, v := range s.ExtendedMedia { + if v == nil { + return fmt.Errorf("unable to encode starsTransaction#ee7522d5: field extended_media element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode starsTransaction#ee7522d5: field extended_media element with index %d: %w", idx, err) + } + } + } + if s.Flags.Has(12) { + b.PutInt(s.SubscriptionPeriod) + } + if s.Flags.Has(13) { + b.PutInt(s.GiveawayPostID) + } return nil } // Decode implements bin.Decoder. func (s *StarsTransaction) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starsTransaction#cc7079b2 to nil") + return fmt.Errorf("can't decode starsTransaction#ee7522d5 to nil") } if err := b.ConsumeID(StarsTransactionTypeID); err != nil { - return fmt.Errorf("unable to decode starsTransaction#cc7079b2: %w", err) + return fmt.Errorf("unable to decode starsTransaction#ee7522d5: %w", err) } return s.DecodeBare(b) } @@ -283,63 +535,126 @@ func (s *StarsTransaction) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StarsTransaction) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starsTransaction#cc7079b2 to nil") + return fmt.Errorf("can't decode starsTransaction#ee7522d5 to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode starsTransaction#cc7079b2: field flags: %w", err) + return fmt.Errorf("unable to decode starsTransaction#ee7522d5: field flags: %w", err) } } s.Refund = s.Flags.Has(3) + s.Pending = s.Flags.Has(4) + s.Failed = s.Flags.Has(6) + s.Gift = s.Flags.Has(10) + s.Reaction = s.Flags.Has(11) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starsTransaction#cc7079b2: field id: %w", err) + return fmt.Errorf("unable to decode starsTransaction#ee7522d5: field id: %w", err) } s.ID = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starsTransaction#cc7079b2: field stars: %w", err) + return fmt.Errorf("unable to decode starsTransaction#ee7522d5: field stars: %w", err) } s.Stars = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starsTransaction#cc7079b2: field date: %w", err) + return fmt.Errorf("unable to decode starsTransaction#ee7522d5: field date: %w", err) } s.Date = value } { value, err := DecodeStarsTransactionPeer(b) if err != nil { - return fmt.Errorf("unable to decode starsTransaction#cc7079b2: field peer: %w", err) + return fmt.Errorf("unable to decode starsTransaction#ee7522d5: field peer: %w", err) } s.Peer = value } if s.Flags.Has(0) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starsTransaction#cc7079b2: field title: %w", err) + return fmt.Errorf("unable to decode starsTransaction#ee7522d5: field title: %w", err) } s.Title = value } if s.Flags.Has(1) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starsTransaction#cc7079b2: field description: %w", err) + return fmt.Errorf("unable to decode starsTransaction#ee7522d5: field description: %w", err) } s.Description = value } if s.Flags.Has(2) { value, err := DecodeWebDocument(b) if err != nil { - return fmt.Errorf("unable to decode starsTransaction#cc7079b2: field photo: %w", err) + return fmt.Errorf("unable to decode starsTransaction#ee7522d5: field photo: %w", err) } s.Photo = value } + if s.Flags.Has(5) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starsTransaction#ee7522d5: field transaction_date: %w", err) + } + s.TransactionDate = value + } + if s.Flags.Has(5) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode starsTransaction#ee7522d5: field transaction_url: %w", err) + } + s.TransactionURL = value + } + if s.Flags.Has(7) { + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode starsTransaction#ee7522d5: field bot_payload: %w", err) + } + s.BotPayload = value + } + if s.Flags.Has(8) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starsTransaction#ee7522d5: field msg_id: %w", err) + } + s.MsgID = value + } + if s.Flags.Has(9) { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode starsTransaction#ee7522d5: field extended_media: %w", err) + } + + if headerLen > 0 { + s.ExtendedMedia = make([]MessageMediaClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeMessageMedia(b) + if err != nil { + return fmt.Errorf("unable to decode starsTransaction#ee7522d5: field extended_media: %w", err) + } + s.ExtendedMedia = append(s.ExtendedMedia, value) + } + } + if s.Flags.Has(12) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starsTransaction#ee7522d5: field subscription_period: %w", err) + } + s.SubscriptionPeriod = value + } + if s.Flags.Has(13) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starsTransaction#ee7522d5: field giveaway_post_id: %w", err) + } + s.GiveawayPostID = value + } return nil } @@ -362,6 +677,82 @@ func (s *StarsTransaction) GetRefund() (value bool) { return s.Flags.Has(3) } +// SetPending sets value of Pending conditional field. +func (s *StarsTransaction) SetPending(value bool) { + if value { + s.Flags.Set(4) + s.Pending = true + } else { + s.Flags.Unset(4) + s.Pending = false + } +} + +// GetPending returns value of Pending conditional field. +func (s *StarsTransaction) GetPending() (value bool) { + if s == nil { + return + } + return s.Flags.Has(4) +} + +// SetFailed sets value of Failed conditional field. +func (s *StarsTransaction) SetFailed(value bool) { + if value { + s.Flags.Set(6) + s.Failed = true + } else { + s.Flags.Unset(6) + s.Failed = false + } +} + +// GetFailed returns value of Failed conditional field. +func (s *StarsTransaction) GetFailed() (value bool) { + if s == nil { + return + } + return s.Flags.Has(6) +} + +// SetGift sets value of Gift conditional field. +func (s *StarsTransaction) SetGift(value bool) { + if value { + s.Flags.Set(10) + s.Gift = true + } else { + s.Flags.Unset(10) + s.Gift = false + } +} + +// GetGift returns value of Gift conditional field. +func (s *StarsTransaction) GetGift() (value bool) { + if s == nil { + return + } + return s.Flags.Has(10) +} + +// SetReaction sets value of Reaction conditional field. +func (s *StarsTransaction) SetReaction(value bool) { + if value { + s.Flags.Set(11) + s.Reaction = true + } else { + s.Flags.Unset(11) + s.Reaction = false + } +} + +// GetReaction returns value of Reaction conditional field. +func (s *StarsTransaction) GetReaction() (value bool) { + if s == nil { + return + } + return s.Flags.Has(11) +} + // GetID returns value of ID field. func (s *StarsTransaction) GetID() (value string) { if s == nil { @@ -447,3 +838,137 @@ func (s *StarsTransaction) GetPhoto() (value WebDocumentClass, ok bool) { } return s.Photo, true } + +// SetTransactionDate sets value of TransactionDate conditional field. +func (s *StarsTransaction) SetTransactionDate(value int) { + s.Flags.Set(5) + s.TransactionDate = value +} + +// GetTransactionDate returns value of TransactionDate conditional field and +// boolean which is true if field was set. +func (s *StarsTransaction) GetTransactionDate() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(5) { + return value, false + } + return s.TransactionDate, true +} + +// SetTransactionURL sets value of TransactionURL conditional field. +func (s *StarsTransaction) SetTransactionURL(value string) { + s.Flags.Set(5) + s.TransactionURL = value +} + +// GetTransactionURL returns value of TransactionURL conditional field and +// boolean which is true if field was set. +func (s *StarsTransaction) GetTransactionURL() (value string, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(5) { + return value, false + } + return s.TransactionURL, true +} + +// SetBotPayload sets value of BotPayload conditional field. +func (s *StarsTransaction) SetBotPayload(value []byte) { + s.Flags.Set(7) + s.BotPayload = value +} + +// GetBotPayload returns value of BotPayload conditional field and +// boolean which is true if field was set. +func (s *StarsTransaction) GetBotPayload() (value []byte, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(7) { + return value, false + } + return s.BotPayload, true +} + +// SetMsgID sets value of MsgID conditional field. +func (s *StarsTransaction) SetMsgID(value int) { + s.Flags.Set(8) + s.MsgID = value +} + +// GetMsgID returns value of MsgID conditional field and +// boolean which is true if field was set. +func (s *StarsTransaction) GetMsgID() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(8) { + return value, false + } + return s.MsgID, true +} + +// SetExtendedMedia sets value of ExtendedMedia conditional field. +func (s *StarsTransaction) SetExtendedMedia(value []MessageMediaClass) { + s.Flags.Set(9) + s.ExtendedMedia = value +} + +// GetExtendedMedia returns value of ExtendedMedia conditional field and +// boolean which is true if field was set. +func (s *StarsTransaction) GetExtendedMedia() (value []MessageMediaClass, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(9) { + return value, false + } + return s.ExtendedMedia, true +} + +// SetSubscriptionPeriod sets value of SubscriptionPeriod conditional field. +func (s *StarsTransaction) SetSubscriptionPeriod(value int) { + s.Flags.Set(12) + s.SubscriptionPeriod = value +} + +// GetSubscriptionPeriod returns value of SubscriptionPeriod conditional field and +// boolean which is true if field was set. +func (s *StarsTransaction) GetSubscriptionPeriod() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(12) { + return value, false + } + return s.SubscriptionPeriod, true +} + +// SetGiveawayPostID sets value of GiveawayPostID conditional field. +func (s *StarsTransaction) SetGiveawayPostID(value int) { + s.Flags.Set(13) + s.GiveawayPostID = value +} + +// GetGiveawayPostID returns value of GiveawayPostID conditional field and +// boolean which is true if field was set. +func (s *StarsTransaction) GetGiveawayPostID() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(13) { + return value, false + } + return s.GiveawayPostID, true +} + +// MapExtendedMedia returns field ExtendedMedia wrapped in MessageMediaClassArray helper. +func (s *StarsTransaction) MapExtendedMedia() (value MessageMediaClassArray, ok bool) { + if !s.Flags.Has(9) { + return value, false + } + return MessageMediaClassArray(s.ExtendedMedia), true +} diff --git a/vendor/github.com/gotd/td/tg/tl_stars_transaction_peer_gen.go b/vendor/github.com/gotd/td/tg/tl_stars_transaction_peer_gen.go index c1bd005b..980b0830 100644 --- a/vendor/github.com/gotd/td/tg/tl_stars_transaction_peer_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stars_transaction_peer_gen.go @@ -32,6 +32,11 @@ var ( ) // StarsTransactionPeerUnsupported represents TL type `starsTransactionPeerUnsupported#95f2bfe4`. +// Describes a Telegram Star¹ transaction that cannot be described using the current +// layer. +// +// Links: +// 1. https://core.telegram.org/api/stars // // See https://core.telegram.org/constructor/starsTransactionPeerUnsupported for reference. type StarsTransactionPeerUnsupported struct { @@ -133,6 +138,11 @@ func (s *StarsTransactionPeerUnsupported) DecodeBare(b *bin.Buffer) error { } // StarsTransactionPeerAppStore represents TL type `starsTransactionPeerAppStore#b457b375`. +// Describes a Telegram Star¹ transaction with the App Store, used when purchasing +// Telegram Stars through the App Store. +// +// Links: +// 1. https://core.telegram.org/api/stars // // See https://core.telegram.org/constructor/starsTransactionPeerAppStore for reference. type StarsTransactionPeerAppStore struct { @@ -234,6 +244,11 @@ func (s *StarsTransactionPeerAppStore) DecodeBare(b *bin.Buffer) error { } // StarsTransactionPeerPlayMarket represents TL type `starsTransactionPeerPlayMarket#7b560a0b`. +// Describes a Telegram Star¹ transaction with the Play Store, used when purchasing +// Telegram Stars through the Play Store. +// +// Links: +// 1. https://core.telegram.org/api/stars // // See https://core.telegram.org/constructor/starsTransactionPeerPlayMarket for reference. type StarsTransactionPeerPlayMarket struct { @@ -335,6 +350,14 @@ func (s *StarsTransactionPeerPlayMarket) DecodeBare(b *bin.Buffer) error { } // StarsTransactionPeerPremiumBot represents TL type `starsTransactionPeerPremiumBot#250dbaf8`. +// Describes a Telegram Star¹ transaction made using @PremiumBot² (i.e. using the +// inputInvoiceStars³ flow described here »⁴). +// +// Links: +// 1. https://core.telegram.org/api/stars +// 2. https://t.me/premiumbot +// 3. https://core.telegram.org/constructor/inputInvoiceStars +// 4. https://core.telegram.org/api/stars#buying-or-gifting-stars // // See https://core.telegram.org/constructor/starsTransactionPeerPremiumBot for reference. type StarsTransactionPeerPremiumBot struct { @@ -436,6 +459,13 @@ func (s *StarsTransactionPeerPremiumBot) DecodeBare(b *bin.Buffer) error { } // StarsTransactionPeerFragment represents TL type `starsTransactionPeerFragment#e92fd902`. +// Describes a Telegram Star¹ transaction with Fragment², used when purchasing Telegram +// Stars through Fragment³. +// +// Links: +// 1. https://core.telegram.org/api/stars +// 2. https://fragment.com +// 3. https://fragment.com // // See https://core.telegram.org/constructor/starsTransactionPeerFragment for reference. type StarsTransactionPeerFragment struct { @@ -537,10 +567,14 @@ func (s *StarsTransactionPeerFragment) DecodeBare(b *bin.Buffer) error { } // StarsTransactionPeer represents TL type `starsTransactionPeer#d80da15d`. +// Describes a Telegram Star¹ transaction with another peer. +// +// Links: +// 1. https://core.telegram.org/api/stars // // See https://core.telegram.org/constructor/starsTransactionPeer for reference. type StarsTransactionPeer struct { - // Peer field of StarsTransactionPeer. + // The peer. Peer PeerClass } @@ -675,6 +709,113 @@ func (s *StarsTransactionPeer) GetPeer() (value PeerClass) { return s.Peer } +// StarsTransactionPeerAds represents TL type `starsTransactionPeerAds#60682812`. +// Describes a Telegram Star¹ transaction used to pay for Telegram ads as specified here +// »². +// +// Links: +// 1. https://core.telegram.org/api/stars +// 2. https://core.telegram.org/api/stars#paying-for-ads +// +// See https://core.telegram.org/constructor/starsTransactionPeerAds for reference. +type StarsTransactionPeerAds struct { +} + +// StarsTransactionPeerAdsTypeID is TL type id of StarsTransactionPeerAds. +const StarsTransactionPeerAdsTypeID = 0x60682812 + +// construct implements constructor of StarsTransactionPeerClass. +func (s StarsTransactionPeerAds) construct() StarsTransactionPeerClass { return &s } + +// Ensuring interfaces in compile-time for StarsTransactionPeerAds. +var ( + _ bin.Encoder = &StarsTransactionPeerAds{} + _ bin.Decoder = &StarsTransactionPeerAds{} + _ bin.BareEncoder = &StarsTransactionPeerAds{} + _ bin.BareDecoder = &StarsTransactionPeerAds{} + + _ StarsTransactionPeerClass = &StarsTransactionPeerAds{} +) + +func (s *StarsTransactionPeerAds) Zero() bool { + if s == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarsTransactionPeerAds) String() string { + if s == nil { + return "StarsTransactionPeerAds(nil)" + } + type Alias StarsTransactionPeerAds + return fmt.Sprintf("StarsTransactionPeerAds%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarsTransactionPeerAds) TypeID() uint32 { + return StarsTransactionPeerAdsTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarsTransactionPeerAds) TypeName() string { + return "starsTransactionPeerAds" +} + +// TypeInfo returns info about TL type. +func (s *StarsTransactionPeerAds) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starsTransactionPeerAds", + ID: StarsTransactionPeerAdsTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (s *StarsTransactionPeerAds) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starsTransactionPeerAds#60682812 as nil") + } + b.PutID(StarsTransactionPeerAdsTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarsTransactionPeerAds) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starsTransactionPeerAds#60682812 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StarsTransactionPeerAds) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starsTransactionPeerAds#60682812 to nil") + } + if err := b.ConsumeID(StarsTransactionPeerAdsTypeID); err != nil { + return fmt.Errorf("unable to decode starsTransactionPeerAds#60682812: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarsTransactionPeerAds) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starsTransactionPeerAds#60682812 to nil") + } + return nil +} + // StarsTransactionPeerClassName is schema name of StarsTransactionPeerClass. const StarsTransactionPeerClassName = "StarsTransactionPeer" @@ -695,6 +836,7 @@ const StarsTransactionPeerClassName = "StarsTransactionPeer" // case *tg.StarsTransactionPeerPremiumBot: // starsTransactionPeerPremiumBot#250dbaf8 // case *tg.StarsTransactionPeerFragment: // starsTransactionPeerFragment#e92fd902 // case *tg.StarsTransactionPeer: // starsTransactionPeer#d80da15d +// case *tg.StarsTransactionPeerAds: // starsTransactionPeerAds#60682812 // default: panic(v) // } type StarsTransactionPeerClass interface { @@ -765,6 +907,13 @@ func DecodeStarsTransactionPeer(buf *bin.Buffer) (StarsTransactionPeerClass, err return nil, fmt.Errorf("unable to decode StarsTransactionPeerClass: %w", err) } return &v, nil + case StarsTransactionPeerAdsTypeID: + // Decoding starsTransactionPeerAds#60682812. + v := StarsTransactionPeerAds{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StarsTransactionPeerClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode StarsTransactionPeerClass: %w", bin.NewUnexpectedID(id)) } diff --git a/vendor/github.com/gotd/td/tg/tl_stats_broadcast_revenue_stats_gen.go b/vendor/github.com/gotd/td/tg/tl_stats_broadcast_revenue_stats_gen.go index 0808a8e3..d0364f47 100644 --- a/vendor/github.com/gotd/td/tg/tl_stats_broadcast_revenue_stats_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stats_broadcast_revenue_stats_gen.go @@ -32,16 +32,25 @@ var ( ) // StatsBroadcastRevenueStats represents TL type `stats.broadcastRevenueStats#5407e297`. +// Channel revenue ad statistics, see here »¹ for more info. +// Note that all balances and currency amounts and graph values are in the smallest unit +// of the chosen cryptocurrency (currently nanotons for TONs, so to obtain a value in USD +// divide the chosen amount by 10^9, and then divide by usd_rate). +// +// Links: +// 1. https://core.telegram.org/api/revenue // // See https://core.telegram.org/constructor/stats.broadcastRevenueStats for reference. type StatsBroadcastRevenueStats struct { - // TopHoursGraph field of StatsBroadcastRevenueStats. + // Ad impressions graph TopHoursGraph StatsGraphClass - // RevenueGraph field of StatsBroadcastRevenueStats. + // Ad revenue graph (in the smallest unit of the cryptocurrency in which revenue is + // calculated) RevenueGraph StatsGraphClass - // Balances field of StatsBroadcastRevenueStats. + // Current balance, current withdrawable balance and overall revenue Balances BroadcastRevenueBalances - // UsdRate field of StatsBroadcastRevenueStats. + // Current conversion rate of the cryptocurrency (not in the smallest unit) in which + // revenue is calculated to USD UsdRate float64 } diff --git a/vendor/github.com/gotd/td/tg/tl_stats_broadcast_revenue_transactions_gen.go b/vendor/github.com/gotd/td/tg/tl_stats_broadcast_revenue_transactions_gen.go index c349e29a..10983528 100644 --- a/vendor/github.com/gotd/td/tg/tl_stats_broadcast_revenue_transactions_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stats_broadcast_revenue_transactions_gen.go @@ -32,12 +32,16 @@ var ( ) // StatsBroadcastRevenueTransactions represents TL type `stats.broadcastRevenueTransactions#87158466`. +// Channel ad revenue transactions »¹. +// +// Links: +// 1. https://core.telegram.org/api/revenue // // See https://core.telegram.org/constructor/stats.broadcastRevenueTransactions for reference. type StatsBroadcastRevenueTransactions struct { - // Count field of StatsBroadcastRevenueTransactions. + // Total number of transactions. Count int - // Transactions field of StatsBroadcastRevenueTransactions. + // Transactions Transactions []BroadcastRevenueTransactionClass } diff --git a/vendor/github.com/gotd/td/tg/tl_stats_broadcast_revenue_withdrawal_url_gen.go b/vendor/github.com/gotd/td/tg/tl_stats_broadcast_revenue_withdrawal_url_gen.go index 8c90977b..50d10786 100644 --- a/vendor/github.com/gotd/td/tg/tl_stats_broadcast_revenue_withdrawal_url_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stats_broadcast_revenue_withdrawal_url_gen.go @@ -32,10 +32,15 @@ var ( ) // StatsBroadcastRevenueWithdrawalURL represents TL type `stats.broadcastRevenueWithdrawalUrl#ec659737`. +// Contains the URL to use to withdraw channel ad revenue¹. +// +// Links: +// 1. https://core.telegram.org/api/revenue#withdrawing-revenue // // See https://core.telegram.org/constructor/stats.broadcastRevenueWithdrawalUrl for reference. type StatsBroadcastRevenueWithdrawalURL struct { - // URL field of StatsBroadcastRevenueWithdrawalURL. + // A unique URL to a Fragment page where the user will be able to specify and submit the + // address of the TON wallet where the funds will be sent. URL string } diff --git a/vendor/github.com/gotd/td/tg/tl_stats_get_broadcast_revenue_stats_gen.go b/vendor/github.com/gotd/td/tg/tl_stats_get_broadcast_revenue_stats_gen.go index fe2cdfbc..9b1c52c9 100644 --- a/vendor/github.com/gotd/td/tg/tl_stats_get_broadcast_revenue_stats_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stats_get_broadcast_revenue_stats_gen.go @@ -32,14 +32,21 @@ var ( ) // StatsGetBroadcastRevenueStatsRequest represents TL type `stats.getBroadcastRevenueStats#75dfb671`. +// Get channel ad revenue statistics »¹. +// +// Links: +// 1. https://core.telegram.org/api/revenue // // See https://core.telegram.org/method/stats.getBroadcastRevenueStats for reference. type StatsGetBroadcastRevenueStatsRequest struct { - // Flags field of StatsGetBroadcastRevenueStatsRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Dark field of StatsGetBroadcastRevenueStatsRequest. + // Whether to enable dark theme for graph colors Dark bool - // Channel field of StatsGetBroadcastRevenueStatsRequest. + // The channel Channel InputChannelClass } @@ -224,6 +231,15 @@ func (g *StatsGetBroadcastRevenueStatsRequest) GetChannelAsNotEmpty() (NotEmptyI } // StatsGetBroadcastRevenueStats invokes method stats.getBroadcastRevenueStats#75dfb671 returning error if any. +// Get channel ad revenue statistics »¹. +// +// Links: +// 1. https://core.telegram.org/api/revenue +// +// Possible errors: +// +// 400 CHANNEL_INVALID: The provided channel is invalid. +// 400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. // // See https://core.telegram.org/method/stats.getBroadcastRevenueStats for reference. func (c *Client) StatsGetBroadcastRevenueStats(ctx context.Context, request *StatsGetBroadcastRevenueStatsRequest) (*StatsBroadcastRevenueStats, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_stats_get_broadcast_revenue_transactions_gen.go b/vendor/github.com/gotd/td/tg/tl_stats_get_broadcast_revenue_transactions_gen.go index e368ee65..5a58ac3c 100644 --- a/vendor/github.com/gotd/td/tg/tl_stats_get_broadcast_revenue_transactions_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stats_get_broadcast_revenue_transactions_gen.go @@ -32,14 +32,24 @@ var ( ) // StatsGetBroadcastRevenueTransactionsRequest represents TL type `stats.getBroadcastRevenueTransactions#69280f`. +// Fetch channel ad revenue transaction history »¹. +// +// Links: +// 1. https://core.telegram.org/api/revenue // // See https://core.telegram.org/method/stats.getBroadcastRevenueTransactions for reference. type StatsGetBroadcastRevenueTransactionsRequest struct { - // Channel field of StatsGetBroadcastRevenueTransactionsRequest. + // The channel Channel InputChannelClass - // Offset field of StatsGetBroadcastRevenueTransactionsRequest. + // Offset for pagination¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets Offset int - // Limit field of StatsGetBroadcastRevenueTransactionsRequest. + // Maximum number of results to return, see pagination¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets Limit int } @@ -225,6 +235,14 @@ func (g *StatsGetBroadcastRevenueTransactionsRequest) GetChannelAsNotEmpty() (No } // StatsGetBroadcastRevenueTransactions invokes method stats.getBroadcastRevenueTransactions#69280f returning error if any. +// Fetch channel ad revenue transaction history »¹. +// +// Links: +// 1. https://core.telegram.org/api/revenue +// +// Possible errors: +// +// 400 CHANNEL_INVALID: The provided channel is invalid. // // See https://core.telegram.org/method/stats.getBroadcastRevenueTransactions for reference. func (c *Client) StatsGetBroadcastRevenueTransactions(ctx context.Context, request *StatsGetBroadcastRevenueTransactionsRequest) (*StatsBroadcastRevenueTransactions, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_stats_get_broadcast_revenue_withdrawal_url_gen.go b/vendor/github.com/gotd/td/tg/tl_stats_get_broadcast_revenue_withdrawal_url_gen.go index ba06c5fe..33247c11 100644 --- a/vendor/github.com/gotd/td/tg/tl_stats_get_broadcast_revenue_withdrawal_url_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stats_get_broadcast_revenue_withdrawal_url_gen.go @@ -32,12 +32,19 @@ var ( ) // StatsGetBroadcastRevenueWithdrawalURLRequest represents TL type `stats.getBroadcastRevenueWithdrawalUrl#2a65ef73`. +// Withdraw funds from a channel's ad revenue balance »¹. +// +// Links: +// 1. https://core.telegram.org/api/revenue // // See https://core.telegram.org/method/stats.getBroadcastRevenueWithdrawalUrl for reference. type StatsGetBroadcastRevenueWithdrawalURLRequest struct { - // Channel field of StatsGetBroadcastRevenueWithdrawalURLRequest. + // The channel Channel InputChannelClass - // Password field of StatsGetBroadcastRevenueWithdrawalURLRequest. + // 2FA password, see here »¹ for more info. + // + // Links: + // 1) https://core.telegram.org/api/srp#using-the-2fa-password Password InputCheckPasswordSRPClass } @@ -208,6 +215,16 @@ func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) GetPasswordAsNotEmpty() ( } // StatsGetBroadcastRevenueWithdrawalURL invokes method stats.getBroadcastRevenueWithdrawalUrl#2a65ef73 returning error if any. +// Withdraw funds from a channel's ad revenue balance »¹. +// +// Links: +// 1. https://core.telegram.org/api/revenue +// +// Possible errors: +// +// 400 PASSWORD_HASH_INVALID: The provided password hash is invalid. +// 400 PASSWORD_MISSING: You must enable 2FA before executing this operation. +// 400 PASSWORD_TOO_FRESH_%d: The password was modified less than 24 hours ago, try again in %d seconds. // // See https://core.telegram.org/method/stats.getBroadcastRevenueWithdrawalUrl for reference. func (c *Client) StatsGetBroadcastRevenueWithdrawalURL(ctx context.Context, request *StatsGetBroadcastRevenueWithdrawalURLRequest) (*StatsBroadcastRevenueWithdrawalURL, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_sticker_set_gen.go b/vendor/github.com/gotd/td/tg/tl_sticker_set_gen.go index 904af30e..2e547bda 100644 --- a/vendor/github.com/gotd/td/tg/tl_sticker_set_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_sticker_set_gen.go @@ -54,12 +54,13 @@ type StickerSet struct { // color when used in messages, the accent color if used as emoji status, white on chat // photos, or another appropriate color based on context. TextColor bool - // If set, this custom emoji stickerset can be used in channel emoji statuses¹. + // If set, this custom emoji stickerset can be used in channel/supergroup emoji + // statuses¹. // // Links: // 1) https://core.telegram.org/api/emoji-status ChannelEmojiStatus bool - // Creator field of StickerSet. + // Whether we created this stickerset Creator bool // When was this stickerset installed // diff --git a/vendor/github.com/gotd/td/tg/tl_stickers_add_sticker_to_set_gen.go b/vendor/github.com/gotd/td/tg/tl_stickers_add_sticker_to_set_gen.go index b9207213..7bc6744e 100644 --- a/vendor/github.com/gotd/td/tg/tl_stickers_add_sticker_to_set_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stickers_add_sticker_to_set_gen.go @@ -32,8 +32,8 @@ var ( ) // StickersAddStickerToSetRequest represents TL type `stickers.addStickerToSet#8653febe`. -// Add a sticker to a stickerset, bots only. The sticker set must have been created by -// the bot. +// Add a sticker to a stickerset. The sticker set must have been created by the current +// user/bot. // // See https://core.telegram.org/method/stickers.addStickerToSet for reference. type StickersAddStickerToSetRequest struct { @@ -195,12 +195,11 @@ func (a *StickersAddStickerToSetRequest) GetSticker() (value InputStickerSetItem } // StickersAddStickerToSet invokes method stickers.addStickerToSet#8653febe returning error if any. -// Add a sticker to a stickerset, bots only. The sticker set must have been created by -// the bot. +// Add a sticker to a stickerset. The sticker set must have been created by the current +// user/bot. // // Possible errors: // -// 400 BOT_MISSING: Only bots can call this method, please use @stickers if you're a user. // 400 STICKERPACK_STICKERS_TOO_MUCH: There are too many stickers in this stickerpack, you can't add any more. // 406 STICKERSET_INVALID: The provided sticker set is invalid. // 400 STICKERS_TOO_MUCH: There are too many stickers in this stickerpack, you can't add any more. diff --git a/vendor/github.com/gotd/td/tg/tl_stickers_change_sticker_gen.go b/vendor/github.com/gotd/td/tg/tl_stickers_change_sticker_gen.go index f6be7e42..cf7e5898 100644 --- a/vendor/github.com/gotd/td/tg/tl_stickers_change_sticker_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stickers_change_sticker_gen.go @@ -32,7 +32,7 @@ var ( ) // StickersChangeStickerRequest represents TL type `stickers.changeSticker#f5537ebc`. -// Update the keywords, emojis or mask coordinates¹ of a sticker, bots only. +// Update the keywords, emojis or mask coordinates¹ of a sticker. // // Links: // 1. https://core.telegram.org/api/stickers#mask-stickers @@ -344,14 +344,13 @@ func (c *StickersChangeStickerRequest) GetStickerAsNotEmpty() (*InputDocument, b } // StickersChangeSticker invokes method stickers.changeSticker#f5537ebc returning error if any. -// Update the keywords, emojis or mask coordinates¹ of a sticker, bots only. +// Update the keywords, emojis or mask coordinates¹ of a sticker. // // Links: // 1. https://core.telegram.org/api/stickers#mask-stickers // // Possible errors: // -// 400 BOT_MISSING: Only bots can call this method, please use @stickers if you're a user. // 400 STICKER_INVALID: The provided sticker is invalid. // // See https://core.telegram.org/method/stickers.changeSticker for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_stickers_change_sticker_position_gen.go b/vendor/github.com/gotd/td/tg/tl_stickers_change_sticker_position_gen.go index 7de51b89..876f8f66 100644 --- a/vendor/github.com/gotd/td/tg/tl_stickers_change_sticker_position_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stickers_change_sticker_position_gen.go @@ -32,8 +32,8 @@ var ( ) // StickersChangeStickerPositionRequest represents TL type `stickers.changeStickerPosition#ffb6d4ca`. -// Changes the absolute position of a sticker in the set to which it belongs; for bots -// only. The sticker set must have been created by the bot +// Changes the absolute position of a sticker in the set to which it belongs. The sticker +// set must have been created by the current user/bot. // // See https://core.telegram.org/method/stickers.changeStickerPosition for reference. type StickersChangeStickerPositionRequest struct { @@ -200,8 +200,8 @@ func (c *StickersChangeStickerPositionRequest) GetStickerAsNotEmpty() (*InputDoc } // StickersChangeStickerPosition invokes method stickers.changeStickerPosition#ffb6d4ca returning error if any. -// Changes the absolute position of a sticker in the set to which it belongs; for bots -// only. The sticker set must have been created by the bot +// Changes the absolute position of a sticker in the set to which it belongs. The sticker +// set must have been created by the current user/bot. // // Possible errors: // diff --git a/vendor/github.com/gotd/td/tg/tl_stickers_create_sticker_set_gen.go b/vendor/github.com/gotd/td/tg/tl_stickers_create_sticker_set_gen.go index 339ce16d..6d594096 100644 --- a/vendor/github.com/gotd/td/tg/tl_stickers_create_sticker_set_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stickers_create_sticker_set_gen.go @@ -32,7 +32,7 @@ var ( ) // StickersCreateStickerSetRequest represents TL type `stickers.createStickerSet#9021ab67`. -// Create a stickerset, bots only. +// Create a stickerset. // // See https://core.telegram.org/method/stickers.createStickerSet for reference. type StickersCreateStickerSetRequest struct { @@ -515,7 +515,7 @@ func (c *StickersCreateStickerSetRequest) GetThumbAsNotEmpty() (*InputDocument, } // StickersCreateStickerSet invokes method stickers.createStickerSet#9021ab67 returning error if any. -// Create a stickerset, bots only. +// Create a stickerset. // // Possible errors: // diff --git a/vendor/github.com/gotd/td/tg/tl_stickers_delete_sticker_set_gen.go b/vendor/github.com/gotd/td/tg/tl_stickers_delete_sticker_set_gen.go index ba705874..aacf3d01 100644 --- a/vendor/github.com/gotd/td/tg/tl_stickers_delete_sticker_set_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stickers_delete_sticker_set_gen.go @@ -32,7 +32,7 @@ var ( ) // StickersDeleteStickerSetRequest represents TL type `stickers.deleteStickerSet#87704394`. -// Deletes a stickerset we created, bots only. +// Deletes a stickerset we created. // // See https://core.telegram.org/method/stickers.deleteStickerSet for reference. type StickersDeleteStickerSetRequest struct { @@ -167,11 +167,10 @@ func (d *StickersDeleteStickerSetRequest) GetStickerset() (value InputStickerSet } // StickersDeleteStickerSet invokes method stickers.deleteStickerSet#87704394 returning error if any. -// Deletes a stickerset we created, bots only. +// Deletes a stickerset we created. // // Possible errors: // -// 400 BOT_MISSING: Only bots can call this method, please use @stickers if you're a user. // 400 STICKERSET_INVALID: The provided sticker set is invalid. // // See https://core.telegram.org/method/stickers.deleteStickerSet for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_stickers_remove_sticker_from_set_gen.go b/vendor/github.com/gotd/td/tg/tl_stickers_remove_sticker_from_set_gen.go index 27845998..2ceb4d27 100644 --- a/vendor/github.com/gotd/td/tg/tl_stickers_remove_sticker_from_set_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stickers_remove_sticker_from_set_gen.go @@ -32,8 +32,8 @@ var ( ) // StickersRemoveStickerFromSetRequest represents TL type `stickers.removeStickerFromSet#f7760f51`. -// Remove a sticker from the set where it belongs, bots only. The sticker set must have -// been created by the bot. +// Remove a sticker from the set where it belongs. The sticker set must have been created +// by the current user/bot. // // See https://core.telegram.org/method/stickers.removeStickerFromSet for reference. type StickersRemoveStickerFromSetRequest struct { @@ -173,12 +173,11 @@ func (r *StickersRemoveStickerFromSetRequest) GetStickerAsNotEmpty() (*InputDocu } // StickersRemoveStickerFromSet invokes method stickers.removeStickerFromSet#f7760f51 returning error if any. -// Remove a sticker from the set where it belongs, bots only. The sticker set must have -// been created by the bot. +// Remove a sticker from the set where it belongs. The sticker set must have been created +// by the current user/bot. // // Possible errors: // -// 400 BOT_MISSING: Only bots can call this method, please use @stickers if you're a user. // 400 STICKER_INVALID: The provided sticker is invalid. // // See https://core.telegram.org/method/stickers.removeStickerFromSet for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_stickers_rename_sticker_set_gen.go b/vendor/github.com/gotd/td/tg/tl_stickers_rename_sticker_set_gen.go index 873e413b..c5c73e02 100644 --- a/vendor/github.com/gotd/td/tg/tl_stickers_rename_sticker_set_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stickers_rename_sticker_set_gen.go @@ -32,7 +32,7 @@ var ( ) // StickersRenameStickerSetRequest represents TL type `stickers.renameStickerSet#124b1c00`. -// Renames a stickerset, bots only. +// Renames a stickerset. // // See https://core.telegram.org/method/stickers.renameStickerSet for reference. type StickersRenameStickerSetRequest struct { @@ -194,7 +194,7 @@ func (r *StickersRenameStickerSetRequest) GetTitle() (value string) { } // StickersRenameStickerSet invokes method stickers.renameStickerSet#124b1c00 returning error if any. -// Renames a stickerset, bots only. +// Renames a stickerset. // // Possible errors: // diff --git a/vendor/github.com/gotd/td/tg/tl_stickers_replace_sticker_gen.go b/vendor/github.com/gotd/td/tg/tl_stickers_replace_sticker_gen.go index 8a2645ce..d3c5c647 100644 --- a/vendor/github.com/gotd/td/tg/tl_stickers_replace_sticker_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stickers_replace_sticker_gen.go @@ -32,12 +32,16 @@ var ( ) // StickersReplaceStickerRequest represents TL type `stickers.replaceSticker#4696459a`. +// Replace a sticker in a stickerset »¹. +// +// Links: +// 1. https://core.telegram.org/api/stickers // // See https://core.telegram.org/method/stickers.replaceSticker for reference. type StickersReplaceStickerRequest struct { - // Sticker field of StickersReplaceStickerRequest. + // Old sticker document. Sticker InputDocumentClass - // NewSticker field of StickersReplaceStickerRequest. + // New sticker. NewSticker InputStickerSetItem } @@ -198,8 +202,17 @@ func (r *StickersReplaceStickerRequest) GetStickerAsNotEmpty() (*InputDocument, } // StickersReplaceSticker invokes method stickers.replaceSticker#4696459a returning error if any. +// Replace a sticker in a stickerset »¹. +// +// Links: +// 1. https://core.telegram.org/api/stickers +// +// Possible errors: +// +// 400 STICKER_INVALID: The provided sticker is invalid. // // See https://core.telegram.org/method/stickers.replaceSticker for reference. +// Can be used by bots. func (c *Client) StickersReplaceSticker(ctx context.Context, request *StickersReplaceStickerRequest) (MessagesStickerSetClass, error) { var result MessagesStickerSetBox diff --git a/vendor/github.com/gotd/td/tg/tl_stories_activate_stealth_mode_gen.go b/vendor/github.com/gotd/td/tg/tl_stories_activate_stealth_mode_gen.go index c2eab595..935b1d0c 100644 --- a/vendor/github.com/gotd/td/tg/tl_stories_activate_stealth_mode_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stories_activate_stealth_mode_gen.go @@ -250,6 +250,10 @@ func (a *StoriesActivateStealthModeRequest) GetFuture() (value bool) { // 2. https://core.telegram.org/api/stories#stealth-mode // 3. https://core.telegram.org/constructor/updateStoriesStealthMode // +// Possible errors: +// +// 400 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. +// // See https://core.telegram.org/method/stories.activateStealthMode for reference. func (c *Client) StoriesActivateStealthMode(ctx context.Context, request *StoriesActivateStealthModeRequest) (UpdatesClass, error) { var result UpdatesBox diff --git a/vendor/github.com/gotd/td/tg/tl_stories_delete_stories_gen.go b/vendor/github.com/gotd/td/tg/tl_stories_delete_stories_gen.go index 9f457682..051a74b8 100644 --- a/vendor/github.com/gotd/td/tg/tl_stories_delete_stories_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stories_delete_stories_gen.go @@ -218,6 +218,7 @@ func (d *StoriesDeleteStoriesRequest) GetID() (value []int) { // Possible errors: // // 400 PEER_ID_INVALID: The provided peer id is invalid. +// 400 STORY_ID_EMPTY: You specified no story IDs. // // See https://core.telegram.org/method/stories.deleteStories for reference. func (c *Client) StoriesDeleteStories(ctx context.Context, request *StoriesDeleteStoriesRequest) ([]int, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_stories_found_stories_gen.go b/vendor/github.com/gotd/td/tg/tl_stories_found_stories_gen.go new file mode 100644 index 00000000..853ae293 --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stories_found_stories_gen.go @@ -0,0 +1,376 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// StoriesFoundStories represents TL type `stories.foundStories#e2de7737`. +// Stories found using global story search »¹. +// +// Links: +// 1. https://core.telegram.org/api/stories#searching-stories +// +// See https://core.telegram.org/constructor/stories.foundStories for reference. +type StoriesFoundStories struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // Total number of results found for the query. + Count int + // Matching stories. + Stories []FoundStory + // Offset used to fetch the next page, if not set this is the final page. + // + // Use SetNextOffset and GetNextOffset helpers. + NextOffset string + // Mentioned chats + Chats []ChatClass + // Mentioned users + Users []UserClass +} + +// StoriesFoundStoriesTypeID is TL type id of StoriesFoundStories. +const StoriesFoundStoriesTypeID = 0xe2de7737 + +// Ensuring interfaces in compile-time for StoriesFoundStories. +var ( + _ bin.Encoder = &StoriesFoundStories{} + _ bin.Decoder = &StoriesFoundStories{} + _ bin.BareEncoder = &StoriesFoundStories{} + _ bin.BareDecoder = &StoriesFoundStories{} +) + +func (f *StoriesFoundStories) Zero() bool { + if f == nil { + return true + } + if !(f.Flags.Zero()) { + return false + } + if !(f.Count == 0) { + return false + } + if !(f.Stories == nil) { + return false + } + if !(f.NextOffset == "") { + return false + } + if !(f.Chats == nil) { + return false + } + if !(f.Users == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (f *StoriesFoundStories) String() string { + if f == nil { + return "StoriesFoundStories(nil)" + } + type Alias StoriesFoundStories + return fmt.Sprintf("StoriesFoundStories%+v", Alias(*f)) +} + +// FillFrom fills StoriesFoundStories from given interface. +func (f *StoriesFoundStories) FillFrom(from interface { + GetCount() (value int) + GetStories() (value []FoundStory) + GetNextOffset() (value string, ok bool) + GetChats() (value []ChatClass) + GetUsers() (value []UserClass) +}) { + f.Count = from.GetCount() + f.Stories = from.GetStories() + if val, ok := from.GetNextOffset(); ok { + f.NextOffset = val + } + + f.Chats = from.GetChats() + f.Users = from.GetUsers() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoriesFoundStories) TypeID() uint32 { + return StoriesFoundStoriesTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoriesFoundStories) TypeName() string { + return "stories.foundStories" +} + +// TypeInfo returns info about TL type. +func (f *StoriesFoundStories) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "stories.foundStories", + ID: StoriesFoundStoriesTypeID, + } + if f == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Count", + SchemaName: "count", + }, + { + Name: "Stories", + SchemaName: "stories", + }, + { + Name: "NextOffset", + SchemaName: "next_offset", + Null: !f.Flags.Has(0), + }, + { + Name: "Chats", + SchemaName: "chats", + }, + { + Name: "Users", + SchemaName: "users", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (f *StoriesFoundStories) SetFlags() { + if !(f.NextOffset == "") { + f.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (f *StoriesFoundStories) Encode(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't encode stories.foundStories#e2de7737 as nil") + } + b.PutID(StoriesFoundStoriesTypeID) + return f.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (f *StoriesFoundStories) EncodeBare(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't encode stories.foundStories#e2de7737 as nil") + } + f.SetFlags() + if err := f.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode stories.foundStories#e2de7737: field flags: %w", err) + } + b.PutInt(f.Count) + b.PutVectorHeader(len(f.Stories)) + for idx, v := range f.Stories { + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode stories.foundStories#e2de7737: field stories element with index %d: %w", idx, err) + } + } + if f.Flags.Has(0) { + b.PutString(f.NextOffset) + } + b.PutVectorHeader(len(f.Chats)) + for idx, v := range f.Chats { + if v == nil { + return fmt.Errorf("unable to encode stories.foundStories#e2de7737: field chats element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode stories.foundStories#e2de7737: field chats element with index %d: %w", idx, err) + } + } + b.PutVectorHeader(len(f.Users)) + for idx, v := range f.Users { + if v == nil { + return fmt.Errorf("unable to encode stories.foundStories#e2de7737: field users element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode stories.foundStories#e2de7737: field users element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (f *StoriesFoundStories) Decode(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't decode stories.foundStories#e2de7737 to nil") + } + if err := b.ConsumeID(StoriesFoundStoriesTypeID); err != nil { + return fmt.Errorf("unable to decode stories.foundStories#e2de7737: %w", err) + } + return f.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (f *StoriesFoundStories) DecodeBare(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't decode stories.foundStories#e2de7737 to nil") + } + { + if err := f.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode stories.foundStories#e2de7737: field flags: %w", err) + } + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode stories.foundStories#e2de7737: field count: %w", err) + } + f.Count = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode stories.foundStories#e2de7737: field stories: %w", err) + } + + if headerLen > 0 { + f.Stories = make([]FoundStory, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value FoundStory + if err := value.Decode(b); err != nil { + return fmt.Errorf("unable to decode stories.foundStories#e2de7737: field stories: %w", err) + } + f.Stories = append(f.Stories, value) + } + } + if f.Flags.Has(0) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode stories.foundStories#e2de7737: field next_offset: %w", err) + } + f.NextOffset = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode stories.foundStories#e2de7737: field chats: %w", err) + } + + if headerLen > 0 { + f.Chats = make([]ChatClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeChat(b) + if err != nil { + return fmt.Errorf("unable to decode stories.foundStories#e2de7737: field chats: %w", err) + } + f.Chats = append(f.Chats, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode stories.foundStories#e2de7737: field users: %w", err) + } + + if headerLen > 0 { + f.Users = make([]UserClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeUser(b) + if err != nil { + return fmt.Errorf("unable to decode stories.foundStories#e2de7737: field users: %w", err) + } + f.Users = append(f.Users, value) + } + } + return nil +} + +// GetCount returns value of Count field. +func (f *StoriesFoundStories) GetCount() (value int) { + if f == nil { + return + } + return f.Count +} + +// GetStories returns value of Stories field. +func (f *StoriesFoundStories) GetStories() (value []FoundStory) { + if f == nil { + return + } + return f.Stories +} + +// SetNextOffset sets value of NextOffset conditional field. +func (f *StoriesFoundStories) SetNextOffset(value string) { + f.Flags.Set(0) + f.NextOffset = value +} + +// GetNextOffset returns value of NextOffset conditional field and +// boolean which is true if field was set. +func (f *StoriesFoundStories) GetNextOffset() (value string, ok bool) { + if f == nil { + return + } + if !f.Flags.Has(0) { + return value, false + } + return f.NextOffset, true +} + +// GetChats returns value of Chats field. +func (f *StoriesFoundStories) GetChats() (value []ChatClass) { + if f == nil { + return + } + return f.Chats +} + +// GetUsers returns value of Users field. +func (f *StoriesFoundStories) GetUsers() (value []UserClass) { + if f == nil { + return + } + return f.Users +} + +// MapChats returns field Chats wrapped in ChatClassArray helper. +func (f *StoriesFoundStories) MapChats() (value ChatClassArray) { + return ChatClassArray(f.Chats) +} + +// MapUsers returns field Users wrapped in UserClassArray helper. +func (f *StoriesFoundStories) MapUsers() (value UserClassArray) { + return UserClassArray(f.Users) +} diff --git a/vendor/github.com/gotd/td/tg/tl_stories_found_stories_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_stories_found_stories_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stories_found_stories_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_stories_get_stories_by_id_gen.go b/vendor/github.com/gotd/td/tg/tl_stories_get_stories_by_id_gen.go index 060fed64..4db29f9c 100644 --- a/vendor/github.com/gotd/td/tg/tl_stories_get_stories_by_id_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stories_get_stories_by_id_gen.go @@ -218,6 +218,7 @@ func (g *StoriesGetStoriesByIDRequest) GetID() (value []int) { // Possible errors: // // 400 CHANNEL_INVALID: The provided channel is invalid. +// 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. // 400 PEER_ID_INVALID: The provided peer id is invalid. // 400 STORIES_NEVER_CREATED: This peer hasn't ever posted any stories. // 400 STORY_ID_EMPTY: You specified no story IDs. diff --git a/vendor/github.com/gotd/td/tg/tl_stories_search_posts_gen.go b/vendor/github.com/gotd/td/tg/tl_stories_search_posts_gen.go new file mode 100644 index 00000000..acc83b2d --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stories_search_posts_gen.go @@ -0,0 +1,356 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// StoriesSearchPostsRequest represents TL type `stories.searchPosts#6cea116a`. +// Globally search for stories¹ using a hashtag or a location media area², see here +// »³ for more info on the full flow. +// Either hashtag or area must be set when invoking the method. +// +// Links: +// 1. https://core.telegram.org/api/stories +// 2. https://core.telegram.org/api/stories#location-tags +// 3. https://core.telegram.org/api/stories#searching-stories +// +// See https://core.telegram.org/method/stories.searchPosts for reference. +type StoriesSearchPostsRequest struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // Hashtag (without the #) + // + // Use SetHashtag and GetHashtag helpers. + Hashtag string + // A mediaAreaGeoPoint¹ or a mediaAreaVenue². Note mediaAreaGeoPoint³ areas may be + // searched only if they have an associated address. + // + // Links: + // 1) https://core.telegram.org/constructor/mediaAreaGeoPoint + // 2) https://core.telegram.org/constructor/mediaAreaVenue + // 3) https://core.telegram.org/constructor/mediaAreaGeoPoint + // + // Use SetArea and GetArea helpers. + Area MediaAreaClass + // Offset for pagination¹: initially an empty string, then the next_offset from the + // previously returned stories.foundStories². + // + // Links: + // 1) https://core.telegram.org/api/offsets + // 2) https://core.telegram.org/constructor/stories.foundStories + Offset string + // Maximum number of results to return, see pagination¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets + Limit int +} + +// StoriesSearchPostsRequestTypeID is TL type id of StoriesSearchPostsRequest. +const StoriesSearchPostsRequestTypeID = 0x6cea116a + +// Ensuring interfaces in compile-time for StoriesSearchPostsRequest. +var ( + _ bin.Encoder = &StoriesSearchPostsRequest{} + _ bin.Decoder = &StoriesSearchPostsRequest{} + _ bin.BareEncoder = &StoriesSearchPostsRequest{} + _ bin.BareDecoder = &StoriesSearchPostsRequest{} +) + +func (s *StoriesSearchPostsRequest) Zero() bool { + if s == nil { + return true + } + if !(s.Flags.Zero()) { + return false + } + if !(s.Hashtag == "") { + return false + } + if !(s.Area == nil) { + return false + } + if !(s.Offset == "") { + return false + } + if !(s.Limit == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoriesSearchPostsRequest) String() string { + if s == nil { + return "StoriesSearchPostsRequest(nil)" + } + type Alias StoriesSearchPostsRequest + return fmt.Sprintf("StoriesSearchPostsRequest%+v", Alias(*s)) +} + +// FillFrom fills StoriesSearchPostsRequest from given interface. +func (s *StoriesSearchPostsRequest) FillFrom(from interface { + GetHashtag() (value string, ok bool) + GetArea() (value MediaAreaClass, ok bool) + GetOffset() (value string) + GetLimit() (value int) +}) { + if val, ok := from.GetHashtag(); ok { + s.Hashtag = val + } + + if val, ok := from.GetArea(); ok { + s.Area = val + } + + s.Offset = from.GetOffset() + s.Limit = from.GetLimit() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoriesSearchPostsRequest) TypeID() uint32 { + return StoriesSearchPostsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoriesSearchPostsRequest) TypeName() string { + return "stories.searchPosts" +} + +// TypeInfo returns info about TL type. +func (s *StoriesSearchPostsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "stories.searchPosts", + ID: StoriesSearchPostsRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Hashtag", + SchemaName: "hashtag", + Null: !s.Flags.Has(0), + }, + { + Name: "Area", + SchemaName: "area", + Null: !s.Flags.Has(1), + }, + { + Name: "Offset", + SchemaName: "offset", + }, + { + Name: "Limit", + SchemaName: "limit", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (s *StoriesSearchPostsRequest) SetFlags() { + if !(s.Hashtag == "") { + s.Flags.Set(0) + } + if !(s.Area == nil) { + s.Flags.Set(1) + } +} + +// Encode implements bin.Encoder. +func (s *StoriesSearchPostsRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode stories.searchPosts#6cea116a as nil") + } + b.PutID(StoriesSearchPostsRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoriesSearchPostsRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode stories.searchPosts#6cea116a as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode stories.searchPosts#6cea116a: field flags: %w", err) + } + if s.Flags.Has(0) { + b.PutString(s.Hashtag) + } + if s.Flags.Has(1) { + if s.Area == nil { + return fmt.Errorf("unable to encode stories.searchPosts#6cea116a: field area is nil") + } + if err := s.Area.Encode(b); err != nil { + return fmt.Errorf("unable to encode stories.searchPosts#6cea116a: field area: %w", err) + } + } + b.PutString(s.Offset) + b.PutInt(s.Limit) + return nil +} + +// Decode implements bin.Decoder. +func (s *StoriesSearchPostsRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode stories.searchPosts#6cea116a to nil") + } + if err := b.ConsumeID(StoriesSearchPostsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode stories.searchPosts#6cea116a: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoriesSearchPostsRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode stories.searchPosts#6cea116a to nil") + } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode stories.searchPosts#6cea116a: field flags: %w", err) + } + } + if s.Flags.Has(0) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode stories.searchPosts#6cea116a: field hashtag: %w", err) + } + s.Hashtag = value + } + if s.Flags.Has(1) { + value, err := DecodeMediaArea(b) + if err != nil { + return fmt.Errorf("unable to decode stories.searchPosts#6cea116a: field area: %w", err) + } + s.Area = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode stories.searchPosts#6cea116a: field offset: %w", err) + } + s.Offset = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode stories.searchPosts#6cea116a: field limit: %w", err) + } + s.Limit = value + } + return nil +} + +// SetHashtag sets value of Hashtag conditional field. +func (s *StoriesSearchPostsRequest) SetHashtag(value string) { + s.Flags.Set(0) + s.Hashtag = value +} + +// GetHashtag returns value of Hashtag conditional field and +// boolean which is true if field was set. +func (s *StoriesSearchPostsRequest) GetHashtag() (value string, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(0) { + return value, false + } + return s.Hashtag, true +} + +// SetArea sets value of Area conditional field. +func (s *StoriesSearchPostsRequest) SetArea(value MediaAreaClass) { + s.Flags.Set(1) + s.Area = value +} + +// GetArea returns value of Area conditional field and +// boolean which is true if field was set. +func (s *StoriesSearchPostsRequest) GetArea() (value MediaAreaClass, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(1) { + return value, false + } + return s.Area, true +} + +// GetOffset returns value of Offset field. +func (s *StoriesSearchPostsRequest) GetOffset() (value string) { + if s == nil { + return + } + return s.Offset +} + +// GetLimit returns value of Limit field. +func (s *StoriesSearchPostsRequest) GetLimit() (value int) { + if s == nil { + return + } + return s.Limit +} + +// StoriesSearchPosts invokes method stories.searchPosts#6cea116a returning error if any. +// Globally search for stories¹ using a hashtag or a location media area², see here +// »³ for more info on the full flow. +// Either hashtag or area must be set when invoking the method. +// +// Links: +// 1. https://core.telegram.org/api/stories +// 2. https://core.telegram.org/api/stories#location-tags +// 3. https://core.telegram.org/api/stories#searching-stories +// +// Possible errors: +// +// 400 HASHTAG_INVALID: The specified hashtag is invalid. +// +// See https://core.telegram.org/method/stories.searchPosts for reference. +func (c *Client) StoriesSearchPosts(ctx context.Context, request *StoriesSearchPostsRequest) (*StoriesFoundStories, error) { + var result StoriesFoundStories + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/vendor/github.com/gotd/td/tg/tl_stories_search_posts_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_stories_search_posts_slices_gen.go new file mode 100644 index 00000000..fe21471a --- /dev/null +++ b/vendor/github.com/gotd/td/tg/tl_stories_search_posts_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/vendor/github.com/gotd/td/tg/tl_stories_send_reaction_gen.go b/vendor/github.com/gotd/td/tg/tl_stories_send_reaction_gen.go index 875f1ecc..108db749 100644 --- a/vendor/github.com/gotd/td/tg/tl_stories_send_reaction_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stories_send_reaction_gen.go @@ -292,6 +292,7 @@ func (s *StoriesSendReactionRequest) GetReaction() (value ReactionClass) { // 400 PEER_ID_INVALID: The provided peer id is invalid. // 400 REACTION_INVALID: The specified reaction is invalid. // 400 STORY_ID_EMPTY: You specified no story IDs. +// 400 STORY_ID_INVALID: The specified story ID is invalid. // // See https://core.telegram.org/method/stories.sendReaction for reference. func (c *Client) StoriesSendReaction(ctx context.Context, request *StoriesSendReactionRequest) (UpdatesClass, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_stories_send_story_gen.go b/vendor/github.com/gotd/td/tg/tl_stories_send_story_gen.go index ac088aa2..cee66d99 100644 --- a/vendor/github.com/gotd/td/tg/tl_stories_send_story_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stories_send_story_gen.go @@ -778,6 +778,7 @@ func (s *StoriesSendStoryRequest) MapPrivacyRules() (value InputPrivacyRuleClass // // Possible errors: // +// 400 BOOSTS_REQUIRED: The specified channel must first be boosted by its users in order to perform this action. // 400 IMAGE_PROCESS_FAILED: Failure while processing image. // 400 MEDIA_EMPTY: The provided media object is invalid. // 400 MEDIA_FILE_INVALID: The specified media file is invalid. diff --git a/vendor/github.com/gotd/td/tg/tl_stories_stories_gen.go b/vendor/github.com/gotd/td/tg/tl_stories_stories_gen.go index ff3ce2eb..f2fb78e0 100644 --- a/vendor/github.com/gotd/td/tg/tl_stories_stories_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stories_stories_gen.go @@ -39,13 +39,16 @@ var ( // // See https://core.telegram.org/constructor/stories.stories for reference. type StoriesStories struct { - // Flags field of StoriesStories. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // Total number of stories that can be fetched Count int // Stories Stories []StoryItemClass - // PinnedToTop field of StoriesStories. + // IDs of pinned stories. // // Use SetPinnedToTop and GetPinnedToTop helpers. PinnedToTop []int diff --git a/vendor/github.com/gotd/td/tg/tl_stories_toggle_pinned_to_top_gen.go b/vendor/github.com/gotd/td/tg/tl_stories_toggle_pinned_to_top_gen.go index 6a3e153e..139774c3 100644 --- a/vendor/github.com/gotd/td/tg/tl_stories_toggle_pinned_to_top_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_stories_toggle_pinned_to_top_gen.go @@ -32,12 +32,19 @@ var ( ) // StoriesTogglePinnedToTopRequest represents TL type `stories.togglePinnedToTop#b297e9b`. +// Pin some stories to the top of the profile, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/stories#pinned-or-archived-stories // // See https://core.telegram.org/method/stories.togglePinnedToTop for reference. type StoriesTogglePinnedToTopRequest struct { - // Peer field of StoriesTogglePinnedToTopRequest. + // Peer where to pin stories. Peer InputPeerClass - // ID field of StoriesTogglePinnedToTopRequest. + // IDs of the stories to pin (max stories_pinned_to_top_count_max¹). + // + // Links: + // 1) https://core.telegram.org/api/config#stories-pinned-to-top-count-max ID []int } @@ -206,6 +213,15 @@ func (t *StoriesTogglePinnedToTopRequest) GetID() (value []int) { } // StoriesTogglePinnedToTop invokes method stories.togglePinnedToTop#b297e9b returning error if any. +// Pin some stories to the top of the profile, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/stories#pinned-or-archived-stories +// +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// 400 STORY_ID_INVALID: The specified story ID is invalid. // // See https://core.telegram.org/method/stories.togglePinnedToTop for reference. func (c *Client) StoriesTogglePinnedToTop(ctx context.Context, request *StoriesTogglePinnedToTopRequest) (bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_story_item_gen.go b/vendor/github.com/gotd/td/tg/tl_story_item_gen.go index 072b4bcd..5db612a5 100644 --- a/vendor/github.com/gotd/td/tg/tl_story_item_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_story_item_gen.go @@ -468,7 +468,7 @@ type StoryItem struct { ID int // When was the story posted. Date int - // FromID field of StoryItem. + // Sender of the story. // // Use SetFromID and GetFromID helpers. FromID PeerClass diff --git a/vendor/github.com/gotd/td/tg/tl_timezone_gen.go b/vendor/github.com/gotd/td/tg/tl_timezone_gen.go index 1a245403..c326306f 100644 --- a/vendor/github.com/gotd/td/tg/tl_timezone_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_timezone_gen.go @@ -32,14 +32,16 @@ var ( ) // Timezone represents TL type `timezone#ff9289f5`. +// Timezone information. // // See https://core.telegram.org/constructor/timezone for reference. type Timezone struct { - // ID field of Timezone. + // Unique timezone ID. ID string - // Name field of Timezone. + // Human-readable and localized timezone name. Name string - // UtcOffset field of Timezone. + // UTC offset in seconds, which may be displayed in hh:mm format by the client together + // with the human-readable name (i.e. $name UTC -01:00). UtcOffset int } diff --git a/vendor/github.com/gotd/td/tg/tl_top_peer_category_gen.go b/vendor/github.com/gotd/td/tg/tl_top_peer_category_gen.go index 5ea02714..31e31e11 100644 --- a/vendor/github.com/gotd/td/tg/tl_top_peer_category_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_top_peer_category_gen.go @@ -847,6 +847,111 @@ func (t *TopPeerCategoryForwardChats) DecodeBare(b *bin.Buffer) error { return nil } +// TopPeerCategoryBotsApp represents TL type `topPeerCategoryBotsApp#fd9e7bec`. +// Most frequently used Main Mini Bot Apps¹. +// +// Links: +// 1. https://core.telegram.org/api/bots/webapps#main-mini-apps +// +// See https://core.telegram.org/constructor/topPeerCategoryBotsApp for reference. +type TopPeerCategoryBotsApp struct { +} + +// TopPeerCategoryBotsAppTypeID is TL type id of TopPeerCategoryBotsApp. +const TopPeerCategoryBotsAppTypeID = 0xfd9e7bec + +// construct implements constructor of TopPeerCategoryClass. +func (t TopPeerCategoryBotsApp) construct() TopPeerCategoryClass { return &t } + +// Ensuring interfaces in compile-time for TopPeerCategoryBotsApp. +var ( + _ bin.Encoder = &TopPeerCategoryBotsApp{} + _ bin.Decoder = &TopPeerCategoryBotsApp{} + _ bin.BareEncoder = &TopPeerCategoryBotsApp{} + _ bin.BareDecoder = &TopPeerCategoryBotsApp{} + + _ TopPeerCategoryClass = &TopPeerCategoryBotsApp{} +) + +func (t *TopPeerCategoryBotsApp) Zero() bool { + if t == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (t *TopPeerCategoryBotsApp) String() string { + if t == nil { + return "TopPeerCategoryBotsApp(nil)" + } + type Alias TopPeerCategoryBotsApp + return fmt.Sprintf("TopPeerCategoryBotsApp%+v", Alias(*t)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*TopPeerCategoryBotsApp) TypeID() uint32 { + return TopPeerCategoryBotsAppTypeID +} + +// TypeName returns name of type in TL schema. +func (*TopPeerCategoryBotsApp) TypeName() string { + return "topPeerCategoryBotsApp" +} + +// TypeInfo returns info about TL type. +func (t *TopPeerCategoryBotsApp) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "topPeerCategoryBotsApp", + ID: TopPeerCategoryBotsAppTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (t *TopPeerCategoryBotsApp) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode topPeerCategoryBotsApp#fd9e7bec as nil") + } + b.PutID(TopPeerCategoryBotsAppTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *TopPeerCategoryBotsApp) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode topPeerCategoryBotsApp#fd9e7bec as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (t *TopPeerCategoryBotsApp) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode topPeerCategoryBotsApp#fd9e7bec to nil") + } + if err := b.ConsumeID(TopPeerCategoryBotsAppTypeID); err != nil { + return fmt.Errorf("unable to decode topPeerCategoryBotsApp#fd9e7bec: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *TopPeerCategoryBotsApp) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode topPeerCategoryBotsApp#fd9e7bec to nil") + } + return nil +} + // TopPeerCategoryClassName is schema name of TopPeerCategoryClass. const TopPeerCategoryClassName = "TopPeerCategory" @@ -869,6 +974,7 @@ const TopPeerCategoryClassName = "TopPeerCategory" // case *tg.TopPeerCategoryPhoneCalls: // topPeerCategoryPhoneCalls#1e76a78c // case *tg.TopPeerCategoryForwardUsers: // topPeerCategoryForwardUsers#a8406ca9 // case *tg.TopPeerCategoryForwardChats: // topPeerCategoryForwardChats#fbeec0f0 +// case *tg.TopPeerCategoryBotsApp: // topPeerCategoryBotsApp#fd9e7bec // default: panic(v) // } type TopPeerCategoryClass interface { @@ -953,6 +1059,13 @@ func DecodeTopPeerCategory(buf *bin.Buffer) (TopPeerCategoryClass, error) { return nil, fmt.Errorf("unable to decode TopPeerCategoryClass: %w", err) } return &v, nil + case TopPeerCategoryBotsAppTypeID: + // Decoding topPeerCategoryBotsApp#fd9e7bec. + v := TopPeerCategoryBotsApp{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode TopPeerCategoryClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode TopPeerCategoryClass: %w", bin.NewUnexpectedID(id)) } diff --git a/vendor/github.com/gotd/td/tg/tl_update_gen.go b/vendor/github.com/gotd/td/tg/tl_update_gen.go index 65f13258..10e638ba 100644 --- a/vendor/github.com/gotd/td/tg/tl_update_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_update_gen.go @@ -1529,7 +1529,7 @@ type UpdateNewAuthorization struct { // Links: // 1) https://core.telegram.org/api/auth#confirming-login Unconfirmed bool - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation @@ -5264,8 +5264,22 @@ func (u *UpdateChannelTooLong) GetPts() (value int, ok bool) { } // UpdateChannel represents TL type `updateChannel#635b4c09`. -// A new channel or supergroup is available, or info about an existing channel has -// changed and must be refeteched. +// Channel/supergroup (channel¹ and/or channelFull²) information was updated. +// This update can only be received through getDifference or in +// updates¹/updatesCombined² constructors, so it will always come bundled with the +// updated channel³, that should be applied as usual »⁴, without re-fetching the info +// manually. +// However, full peer information will not come bundled in updates, so the full peer +// cache (channelFull¹) must be invalidated for channel_id when receiving this update. +// +// Links: +// 1. https://core.telegram.org/constructor/channel +// 2. https://core.telegram.org/constructor/channelFull +// 3. https://core.telegram.org/constructor/updates +// 4. https://core.telegram.org/constructor/updatesCombined +// 5. https://core.telegram.org/constructor/channel +// 6. https://core.telegram.org/api/peers +// 7. https://core.telegram.org/constructor/channelFull // // See https://core.telegram.org/constructor/updateChannel for reference. type UpdateChannel struct { @@ -9627,10 +9641,11 @@ func (u *UpdateRecentStickers) DecodeBare(b *bin.Buffer) error { // UpdateConfig represents TL type `updateConfig#a229dd06`. // The server-side configuration has changed; the client should re-fetch the config using -// help.getConfig¹ +// help.getConfig¹ and help.getAppConfig². // // Links: // 1. https://core.telegram.org/method/help.getConfig +// 2. https://core.telegram.org/method/help.getAppConfig // // See https://core.telegram.org/constructor/updateConfig for reference. type UpdateConfig struct { @@ -11136,10 +11151,11 @@ type UpdateBotPrecheckoutQuery struct { // // Use SetShippingOptionID and GetShippingOptionID helpers. ShippingOptionID string - // Three-letter ISO 4217 currency¹ code + // Three-letter ISO 4217 currency¹ code, or XTR for Telegram Stars². // // Links: // 1) https://core.telegram.org/bots/payments#supported-currencies + // 2) https://core.telegram.org/api/stars Currency string // Total amount in the smallest units of the currency (integer, not float/double). For // example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in @@ -17109,7 +17125,22 @@ func (u *UpdatePinnedChannelMessages) GetPtsCount() (value int) { } // UpdateChat represents TL type `updateChat#f89a6a4e`. -// A new chat is available +// Chat (chat¹ and/or chatFull²) information was updated. +// This update can only be received through getDifference or in +// updates¹/updatesCombined² constructors, so it will always come bundled with the +// updated chat³, that should be applied as usual »⁴, without re-fetching the info +// manually. +// However, full peer information will not come bundled in updates, so the full peer +// cache (chatFull¹) must be invalidated for chat_id when receiving this update. +// +// Links: +// 1. https://core.telegram.org/constructor/chat +// 2. https://core.telegram.org/constructor/chatFull +// 3. https://core.telegram.org/constructor/updates +// 4. https://core.telegram.org/constructor/updatesCombined +// 5. https://core.telegram.org/constructor/chat +// 6. https://core.telegram.org/api/peers +// 7. https://core.telegram.org/constructor/chatFull // // See https://core.telegram.org/constructor/updateChat for reference. type UpdateChat struct { @@ -21652,21 +21683,27 @@ func (u *UpdateMoveStickerSetToTop) GetStickerset() (value int64) { return u.Stickerset } -// UpdateMessageExtendedMedia represents TL type `updateMessageExtendedMedia#5a73a98c`. -// Extended media update +// UpdateMessageExtendedMedia represents TL type `updateMessageExtendedMedia#d5a41724`. +// You bought a paid media »¹: this update contains the revealed media. +// +// Links: +// 1. https://core.telegram.org/api/paid-media // // See https://core.telegram.org/constructor/updateMessageExtendedMedia for reference. type UpdateMessageExtendedMedia struct { - // Peer + // Peer where the paid media was posted Peer PeerClass - // Message ID + // ID of the message containing the paid media MsgID int - // Extended media - ExtendedMedia MessageExtendedMediaClass + // Revealed media, contains only messageExtendedMedia¹ constructors. + // + // Links: + // 1) https://core.telegram.org/constructor/messageExtendedMedia + ExtendedMedia []MessageExtendedMediaClass } // UpdateMessageExtendedMediaTypeID is TL type id of UpdateMessageExtendedMedia. -const UpdateMessageExtendedMediaTypeID = 0x5a73a98c +const UpdateMessageExtendedMediaTypeID = 0xd5a41724 // construct implements constructor of UpdateClass. func (u UpdateMessageExtendedMedia) construct() UpdateClass { return &u } @@ -21711,7 +21748,7 @@ func (u *UpdateMessageExtendedMedia) String() string { func (u *UpdateMessageExtendedMedia) FillFrom(from interface { GetPeer() (value PeerClass) GetMsgID() (value int) - GetExtendedMedia() (value MessageExtendedMediaClass) + GetExtendedMedia() (value []MessageExtendedMediaClass) }) { u.Peer = from.GetPeer() u.MsgID = from.GetMsgID() @@ -21760,7 +21797,7 @@ func (u *UpdateMessageExtendedMedia) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *UpdateMessageExtendedMedia) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateMessageExtendedMedia#5a73a98c as nil") + return fmt.Errorf("can't encode updateMessageExtendedMedia#d5a41724 as nil") } b.PutID(UpdateMessageExtendedMediaTypeID) return u.EncodeBare(b) @@ -21769,20 +21806,23 @@ func (u *UpdateMessageExtendedMedia) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *UpdateMessageExtendedMedia) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateMessageExtendedMedia#5a73a98c as nil") + return fmt.Errorf("can't encode updateMessageExtendedMedia#d5a41724 as nil") } if u.Peer == nil { - return fmt.Errorf("unable to encode updateMessageExtendedMedia#5a73a98c: field peer is nil") + return fmt.Errorf("unable to encode updateMessageExtendedMedia#d5a41724: field peer is nil") } if err := u.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateMessageExtendedMedia#5a73a98c: field peer: %w", err) + return fmt.Errorf("unable to encode updateMessageExtendedMedia#d5a41724: field peer: %w", err) } b.PutInt(u.MsgID) - if u.ExtendedMedia == nil { - return fmt.Errorf("unable to encode updateMessageExtendedMedia#5a73a98c: field extended_media is nil") - } - if err := u.ExtendedMedia.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateMessageExtendedMedia#5a73a98c: field extended_media: %w", err) + b.PutVectorHeader(len(u.ExtendedMedia)) + for idx, v := range u.ExtendedMedia { + if v == nil { + return fmt.Errorf("unable to encode updateMessageExtendedMedia#d5a41724: field extended_media element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateMessageExtendedMedia#d5a41724: field extended_media element with index %d: %w", idx, err) + } } return nil } @@ -21790,10 +21830,10 @@ func (u *UpdateMessageExtendedMedia) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (u *UpdateMessageExtendedMedia) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateMessageExtendedMedia#5a73a98c to nil") + return fmt.Errorf("can't decode updateMessageExtendedMedia#d5a41724 to nil") } if err := b.ConsumeID(UpdateMessageExtendedMediaTypeID); err != nil { - return fmt.Errorf("unable to decode updateMessageExtendedMedia#5a73a98c: %w", err) + return fmt.Errorf("unable to decode updateMessageExtendedMedia#d5a41724: %w", err) } return u.DecodeBare(b) } @@ -21801,28 +21841,38 @@ func (u *UpdateMessageExtendedMedia) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *UpdateMessageExtendedMedia) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateMessageExtendedMedia#5a73a98c to nil") + return fmt.Errorf("can't decode updateMessageExtendedMedia#d5a41724 to nil") } { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode updateMessageExtendedMedia#5a73a98c: field peer: %w", err) + return fmt.Errorf("unable to decode updateMessageExtendedMedia#d5a41724: field peer: %w", err) } u.Peer = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateMessageExtendedMedia#5a73a98c: field msg_id: %w", err) + return fmt.Errorf("unable to decode updateMessageExtendedMedia#d5a41724: field msg_id: %w", err) } u.MsgID = value } { - value, err := DecodeMessageExtendedMedia(b) + headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode updateMessageExtendedMedia#5a73a98c: field extended_media: %w", err) + return fmt.Errorf("unable to decode updateMessageExtendedMedia#d5a41724: field extended_media: %w", err) + } + + if headerLen > 0 { + u.ExtendedMedia = make([]MessageExtendedMediaClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeMessageExtendedMedia(b) + if err != nil { + return fmt.Errorf("unable to decode updateMessageExtendedMedia#d5a41724: field extended_media: %w", err) + } + u.ExtendedMedia = append(u.ExtendedMedia, value) } - u.ExtendedMedia = value } return nil } @@ -21844,13 +21894,18 @@ func (u *UpdateMessageExtendedMedia) GetMsgID() (value int) { } // GetExtendedMedia returns value of ExtendedMedia field. -func (u *UpdateMessageExtendedMedia) GetExtendedMedia() (value MessageExtendedMediaClass) { +func (u *UpdateMessageExtendedMedia) GetExtendedMedia() (value []MessageExtendedMediaClass) { if u == nil { return } return u.ExtendedMedia } +// MapExtendedMedia returns field ExtendedMedia wrapped in MessageExtendedMediaClassArray helper. +func (u *UpdateMessageExtendedMedia) MapExtendedMedia() (value MessageExtendedMediaClassArray) { + return MessageExtendedMediaClassArray(u.ExtendedMedia) +} + // UpdateChannelPinnedTopic represents TL type `updateChannelPinnedTopic#192efbe3`. // A forum topic »¹ was pinned or unpinned. // @@ -22293,10 +22348,22 @@ func (u *UpdateChannelPinnedTopics) GetOrder() (value []int, ok bool) { } // UpdateUser represents TL type `updateUser#20529438`. -// User information was updated, it must be refetched using users.getFullUser¹. +// User (user¹ and/or userFull²) information was updated. +// This update can only be received through getDifference or in +// updates¹/updatesCombined² constructors, so it will always come bundled with the +// updated user³, that should be applied as usual »⁴, without re-fetching the info +// manually. +// However, full peer information will not come bundled in updates, so the full peer +// cache (userFull¹) must be invalidated for user_id when receiving this update. // // Links: -// 1. https://core.telegram.org/method/users.getFullUser +// 1. https://core.telegram.org/constructor/user +// 2. https://core.telegram.org/constructor/userFull +// 3. https://core.telegram.org/constructor/updates +// 4. https://core.telegram.org/constructor/updatesCombined +// 5. https://core.telegram.org/constructor/user +// 6. https://core.telegram.org/api/peers +// 7. https://core.telegram.org/constructor/userFull // // See https://core.telegram.org/constructor/updateUser for reference. type UpdateUser struct { @@ -23394,7 +23461,7 @@ func (u *UpdateSentStoryReaction) GetReaction() (value ReactionClass) { } // UpdateBotChatBoost represents TL type `updateBotChatBoost#904dd49c`. -// A channel boost¹ has changed (bots only) +// A channel/supergroup boost¹ has changed (bots only) // // Links: // 1. https://core.telegram.org/api/boost @@ -25052,6 +25119,12 @@ func (u *UpdatePinnedSavedDialogs) MapOrder() (value DialogPeerClassArray, ok bo } // UpdateSavedReactionTags represents TL type `updateSavedReactionTags#39c67432`. +// The list of reaction tag »¹ names assigned by the user has changed and should be +// refetched using messages.getSavedReactionTags »². +// +// Links: +// 1. https://core.telegram.org/api/saved-messages#tags +// 2. https://core.telegram.org/method/messages.getSavedReactionTags // // See https://core.telegram.org/constructor/updateSavedReactionTags for reference. type UpdateSavedReactionTags struct { @@ -25153,10 +25226,11 @@ func (u *UpdateSavedReactionTags) DecodeBare(b *bin.Buffer) error { } // UpdateSMSJob represents TL type `updateSmsJob#f16269d4`. +// A new SMS job was received // // See https://core.telegram.org/constructor/updateSmsJob for reference. type UpdateSMSJob struct { - // JobID field of UpdateSMSJob. + // SMS job ID JobID string } @@ -25287,10 +25361,14 @@ func (u *UpdateSMSJob) GetJobID() (value string) { } // UpdateQuickReplies represents TL type `updateQuickReplies#f9470ab2`. +// Info about or the order of quick reply shortcuts »¹ was changed. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts // // See https://core.telegram.org/constructor/updateQuickReplies for reference. type UpdateQuickReplies struct { - // QuickReplies field of UpdateQuickReplies. + // New quick reply shortcut order and information. QuickReplies []QuickReply } @@ -25436,10 +25514,14 @@ func (u *UpdateQuickReplies) GetQuickReplies() (value []QuickReply) { } // UpdateNewQuickReply represents TL type `updateNewQuickReply#f53da717`. +// A new quick reply shortcut »¹ was created. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts // // See https://core.telegram.org/constructor/updateNewQuickReply for reference. type UpdateNewQuickReply struct { - // QuickReply field of UpdateNewQuickReply. + // Quick reply shortcut. QuickReply QuickReply } @@ -25570,10 +25652,17 @@ func (u *UpdateNewQuickReply) GetQuickReply() (value QuickReply) { } // UpdateDeleteQuickReply represents TL type `updateDeleteQuickReply#53e6f1ec`. +// A quick reply shortcut »¹ was deleted. This will not emit +// updateDeleteQuickReplyMessages² updates, even if all the messages in the shortcut are +// also deleted by this update. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts +// 2. https://core.telegram.org/constructor/updateDeleteQuickReplyMessages // // See https://core.telegram.org/constructor/updateDeleteQuickReply for reference. type UpdateDeleteQuickReply struct { - // ShortcutID field of UpdateDeleteQuickReply. + // ID of the quick reply shortcut that was deleted. ShortcutID int } @@ -25704,10 +25793,18 @@ func (u *UpdateDeleteQuickReply) GetShortcutID() (value int) { } // UpdateQuickReplyMessage represents TL type `updateQuickReplyMessage#3e050d0f`. +// A new message was added to a quick reply shortcut »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts // // See https://core.telegram.org/constructor/updateQuickReplyMessage for reference. type UpdateQuickReplyMessage struct { - // Message field of UpdateQuickReplyMessage. + // The message that was added (the message¹.quick_reply_shortcut_id field will contain + // the shortcut ID). + // + // Links: + // 1) https://core.telegram.org/constructor/message Message MessageClass } @@ -25843,12 +25940,16 @@ func (u *UpdateQuickReplyMessage) GetMessage() (value MessageClass) { } // UpdateDeleteQuickReplyMessages represents TL type `updateDeleteQuickReplyMessages#566fe7cd`. +// One or more messages in a quick reply shortcut »¹ were deleted. +// +// Links: +// 1. https://core.telegram.org/api/business#quick-reply-shortcuts // // See https://core.telegram.org/constructor/updateDeleteQuickReplyMessages for reference. type UpdateDeleteQuickReplyMessages struct { - // ShortcutID field of UpdateDeleteQuickReplyMessages. + // Quick reply shortcut ID. ShortcutID int - // Messages field of UpdateDeleteQuickReplyMessages. + // IDs of the deleted messages. Messages []int } @@ -26017,12 +26118,23 @@ func (u *UpdateDeleteQuickReplyMessages) GetMessages() (value []int) { } // UpdateBotBusinessConnect represents TL type `updateBotBusinessConnect#8ae5c97a`. +// Connecting or disconnecting a business bot¹ or changing the connection settings will +// emit an updateBotBusinessConnect² update to the bot, with the new settings and a +// connection_id that will be used by the bot to handle updates from and send messages as +// the user. +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots +// 2. https://core.telegram.org/constructor/updateBotBusinessConnect // // See https://core.telegram.org/constructor/updateBotBusinessConnect for reference. type UpdateBotBusinessConnect struct { - // Connection field of UpdateBotBusinessConnect. + // Business connection settings Connection BotBusinessConnection - // Qts field of UpdateBotBusinessConnect. + // New qts value, see updates »¹ for more info. + // + // Links: + // 1) https://core.telegram.org/api/updates Qts int } @@ -26178,20 +26290,30 @@ func (u *UpdateBotBusinessConnect) GetQts() (value int) { } // UpdateBotNewBusinessMessage represents TL type `updateBotNewBusinessMessage#9ddb347c`. +// A message was received via a connected business chat »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots // // See https://core.telegram.org/constructor/updateBotNewBusinessMessage for reference. type UpdateBotNewBusinessMessage struct { - // Flags field of UpdateBotNewBusinessMessage. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // ConnectionID field of UpdateBotNewBusinessMessage. + // Connection ID. ConnectionID string - // Message field of UpdateBotNewBusinessMessage. + // New message. Message MessageClass - // ReplyToMessage field of UpdateBotNewBusinessMessage. + // The message that message is replying to. // // Use SetReplyToMessage and GetReplyToMessage helpers. ReplyToMessage MessageClass - // Qts field of UpdateBotNewBusinessMessage. + // New qts value, see updates »¹ for more info. + // + // Links: + // 1) https://core.telegram.org/api/updates Qts int } @@ -26442,20 +26564,30 @@ func (u *UpdateBotNewBusinessMessage) GetQts() (value int) { } // UpdateBotEditBusinessMessage represents TL type `updateBotEditBusinessMessage#7df587c`. +// A message was edited in a connected business chat »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots // // See https://core.telegram.org/constructor/updateBotEditBusinessMessage for reference. type UpdateBotEditBusinessMessage struct { - // Flags field of UpdateBotEditBusinessMessage. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // ConnectionID field of UpdateBotEditBusinessMessage. + // Business connection ID ConnectionID string - // Message field of UpdateBotEditBusinessMessage. + // New message. Message MessageClass - // ReplyToMessage field of UpdateBotEditBusinessMessage. + // The message that message is replying to. // // Use SetReplyToMessage and GetReplyToMessage helpers. ReplyToMessage MessageClass - // Qts field of UpdateBotEditBusinessMessage. + // New qts value, see updates »¹ for more info. + // + // Links: + // 1) https://core.telegram.org/api/updates Qts int } @@ -26706,16 +26838,26 @@ func (u *UpdateBotEditBusinessMessage) GetQts() (value int) { } // UpdateBotDeleteBusinessMessage represents TL type `updateBotDeleteBusinessMessage#a02a982e`. +// A message was deleted in a connected business chat »¹. +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots // // See https://core.telegram.org/constructor/updateBotDeleteBusinessMessage for reference. type UpdateBotDeleteBusinessMessage struct { - // ConnectionID field of UpdateBotDeleteBusinessMessage. + // Business connection ID. ConnectionID string - // Peer field of UpdateBotDeleteBusinessMessage. + // Peer¹ where the messages were deleted. + // + // Links: + // 1) https://core.telegram.org/api/peers Peer PeerClass - // Messages field of UpdateBotDeleteBusinessMessage. + // IDs of the messages that were deleted. Messages []int - // Qts field of UpdateBotDeleteBusinessMessage. + // New qts value, see updates »¹ for more info. + // + // Links: + // 1) https://core.telegram.org/api/updates Qts int } @@ -26939,14 +27081,24 @@ func (u *UpdateBotDeleteBusinessMessage) GetQts() (value int) { } // UpdateNewStoryReaction represents TL type `updateNewStoryReaction#1824e40b`. +// Represents a new reaction to a story¹. +// +// Links: +// 1. https://core.telegram.org/api/reactions#notifications-about-reactions // // See https://core.telegram.org/constructor/updateNewStoryReaction for reference. type UpdateNewStoryReaction struct { - // StoryID field of UpdateNewStoryReaction. + // Story ID¹. + // + // Links: + // 1) https://core.telegram.org/api/stories StoryID int - // Peer field of UpdateNewStoryReaction. + // The peer where the story was posted. Peer PeerClass - // Reaction field of UpdateNewStoryReaction. + // The reaction¹. + // + // Links: + // 1) https://core.telegram.org/api/reactions Reaction ReactionClass } @@ -27137,12 +27289,16 @@ func (u *UpdateNewStoryReaction) GetReaction() (value ReactionClass) { } // UpdateBroadcastRevenueTransactions represents TL type `updateBroadcastRevenueTransactions#dfd961f5`. +// A new channel ad revenue transaction was made, see here »¹ for more info. +// +// Links: +// 1. https://core.telegram.org/api/revenue#revenue-statistics // // See https://core.telegram.org/constructor/updateBroadcastRevenueTransactions for reference. type UpdateBroadcastRevenueTransactions struct { - // Peer field of UpdateBroadcastRevenueTransactions. + // Channel Peer PeerClass - // Balances field of UpdateBroadcastRevenueTransactions. + // New ad revenue balance. Balances BroadcastRevenueBalances } @@ -27303,10 +27459,14 @@ func (u *UpdateBroadcastRevenueTransactions) GetBalances() (value BroadcastReven } // UpdateStarsBalance represents TL type `updateStarsBalance#fb85198`. +// The current account's Telegram Stars balance »¹ has changed. +// +// Links: +// 1. https://core.telegram.org/api/stars // // See https://core.telegram.org/constructor/updateStarsBalance for reference. type UpdateStarsBalance struct { - // Balance field of UpdateStarsBalance. + // New balance. Balance int64 } @@ -27436,6 +27596,877 @@ func (u *UpdateStarsBalance) GetBalance() (value int64) { return u.Balance } +// UpdateBusinessBotCallbackQuery represents TL type `updateBusinessBotCallbackQuery#1ea2fda7`. +// A callback button sent via a business connection¹ was pressed, and the button data +// was sent to the bot that created the button. +// +// Links: +// 1. https://core.telegram.org/api/business#connected-bots +// +// See https://core.telegram.org/constructor/updateBusinessBotCallbackQuery for reference. +type UpdateBusinessBotCallbackQuery struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // Query ID + QueryID int64 + // ID of the user that pressed the button + UserID int64 + // Business connection ID¹ + // + // Links: + // 1) https://core.telegram.org/api/business#connected-bots + ConnectionID string + // Message that contains the keyboard (also contains info about the chat where the + // message was sent). + Message MessageClass + // The message that message is replying to. + // + // Use SetReplyToMessage and GetReplyToMessage helpers. + ReplyToMessage MessageClass + // Global identifier, uniquely corresponding to the chat to which the message with the + // callback button was sent. Useful for high scores in games. + ChatInstance int64 + // Callback data + // + // Use SetData and GetData helpers. + Data []byte +} + +// UpdateBusinessBotCallbackQueryTypeID is TL type id of UpdateBusinessBotCallbackQuery. +const UpdateBusinessBotCallbackQueryTypeID = 0x1ea2fda7 + +// construct implements constructor of UpdateClass. +func (u UpdateBusinessBotCallbackQuery) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateBusinessBotCallbackQuery. +var ( + _ bin.Encoder = &UpdateBusinessBotCallbackQuery{} + _ bin.Decoder = &UpdateBusinessBotCallbackQuery{} + _ bin.BareEncoder = &UpdateBusinessBotCallbackQuery{} + _ bin.BareDecoder = &UpdateBusinessBotCallbackQuery{} + + _ UpdateClass = &UpdateBusinessBotCallbackQuery{} +) + +func (u *UpdateBusinessBotCallbackQuery) Zero() bool { + if u == nil { + return true + } + if !(u.Flags.Zero()) { + return false + } + if !(u.QueryID == 0) { + return false + } + if !(u.UserID == 0) { + return false + } + if !(u.ConnectionID == "") { + return false + } + if !(u.Message == nil) { + return false + } + if !(u.ReplyToMessage == nil) { + return false + } + if !(u.ChatInstance == 0) { + return false + } + if !(u.Data == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateBusinessBotCallbackQuery) String() string { + if u == nil { + return "UpdateBusinessBotCallbackQuery(nil)" + } + type Alias UpdateBusinessBotCallbackQuery + return fmt.Sprintf("UpdateBusinessBotCallbackQuery%+v", Alias(*u)) +} + +// FillFrom fills UpdateBusinessBotCallbackQuery from given interface. +func (u *UpdateBusinessBotCallbackQuery) FillFrom(from interface { + GetQueryID() (value int64) + GetUserID() (value int64) + GetConnectionID() (value string) + GetMessage() (value MessageClass) + GetReplyToMessage() (value MessageClass, ok bool) + GetChatInstance() (value int64) + GetData() (value []byte, ok bool) +}) { + u.QueryID = from.GetQueryID() + u.UserID = from.GetUserID() + u.ConnectionID = from.GetConnectionID() + u.Message = from.GetMessage() + if val, ok := from.GetReplyToMessage(); ok { + u.ReplyToMessage = val + } + + u.ChatInstance = from.GetChatInstance() + if val, ok := from.GetData(); ok { + u.Data = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateBusinessBotCallbackQuery) TypeID() uint32 { + return UpdateBusinessBotCallbackQueryTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateBusinessBotCallbackQuery) TypeName() string { + return "updateBusinessBotCallbackQuery" +} + +// TypeInfo returns info about TL type. +func (u *UpdateBusinessBotCallbackQuery) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateBusinessBotCallbackQuery", + ID: UpdateBusinessBotCallbackQueryTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "QueryID", + SchemaName: "query_id", + }, + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "ConnectionID", + SchemaName: "connection_id", + }, + { + Name: "Message", + SchemaName: "message", + }, + { + Name: "ReplyToMessage", + SchemaName: "reply_to_message", + Null: !u.Flags.Has(2), + }, + { + Name: "ChatInstance", + SchemaName: "chat_instance", + }, + { + Name: "Data", + SchemaName: "data", + Null: !u.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (u *UpdateBusinessBotCallbackQuery) SetFlags() { + if !(u.ReplyToMessage == nil) { + u.Flags.Set(2) + } + if !(u.Data == nil) { + u.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (u *UpdateBusinessBotCallbackQuery) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateBusinessBotCallbackQuery#1ea2fda7 as nil") + } + b.PutID(UpdateBusinessBotCallbackQueryTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateBusinessBotCallbackQuery) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateBusinessBotCallbackQuery#1ea2fda7 as nil") + } + u.SetFlags() + if err := u.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateBusinessBotCallbackQuery#1ea2fda7: field flags: %w", err) + } + b.PutLong(u.QueryID) + b.PutLong(u.UserID) + b.PutString(u.ConnectionID) + if u.Message == nil { + return fmt.Errorf("unable to encode updateBusinessBotCallbackQuery#1ea2fda7: field message is nil") + } + if err := u.Message.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateBusinessBotCallbackQuery#1ea2fda7: field message: %w", err) + } + if u.Flags.Has(2) { + if u.ReplyToMessage == nil { + return fmt.Errorf("unable to encode updateBusinessBotCallbackQuery#1ea2fda7: field reply_to_message is nil") + } + if err := u.ReplyToMessage.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateBusinessBotCallbackQuery#1ea2fda7: field reply_to_message: %w", err) + } + } + b.PutLong(u.ChatInstance) + if u.Flags.Has(0) { + b.PutBytes(u.Data) + } + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateBusinessBotCallbackQuery) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateBusinessBotCallbackQuery#1ea2fda7 to nil") + } + if err := b.ConsumeID(UpdateBusinessBotCallbackQueryTypeID); err != nil { + return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateBusinessBotCallbackQuery) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateBusinessBotCallbackQuery#1ea2fda7 to nil") + } + { + if err := u.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: field flags: %w", err) + } + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: field query_id: %w", err) + } + u.QueryID = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: field user_id: %w", err) + } + u.UserID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: field connection_id: %w", err) + } + u.ConnectionID = value + } + { + value, err := DecodeMessage(b) + if err != nil { + return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: field message: %w", err) + } + u.Message = value + } + if u.Flags.Has(2) { + value, err := DecodeMessage(b) + if err != nil { + return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: field reply_to_message: %w", err) + } + u.ReplyToMessage = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: field chat_instance: %w", err) + } + u.ChatInstance = value + } + if u.Flags.Has(0) { + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: field data: %w", err) + } + u.Data = value + } + return nil +} + +// GetQueryID returns value of QueryID field. +func (u *UpdateBusinessBotCallbackQuery) GetQueryID() (value int64) { + if u == nil { + return + } + return u.QueryID +} + +// GetUserID returns value of UserID field. +func (u *UpdateBusinessBotCallbackQuery) GetUserID() (value int64) { + if u == nil { + return + } + return u.UserID +} + +// GetConnectionID returns value of ConnectionID field. +func (u *UpdateBusinessBotCallbackQuery) GetConnectionID() (value string) { + if u == nil { + return + } + return u.ConnectionID +} + +// GetMessage returns value of Message field. +func (u *UpdateBusinessBotCallbackQuery) GetMessage() (value MessageClass) { + if u == nil { + return + } + return u.Message +} + +// SetReplyToMessage sets value of ReplyToMessage conditional field. +func (u *UpdateBusinessBotCallbackQuery) SetReplyToMessage(value MessageClass) { + u.Flags.Set(2) + u.ReplyToMessage = value +} + +// GetReplyToMessage returns value of ReplyToMessage conditional field and +// boolean which is true if field was set. +func (u *UpdateBusinessBotCallbackQuery) GetReplyToMessage() (value MessageClass, ok bool) { + if u == nil { + return + } + if !u.Flags.Has(2) { + return value, false + } + return u.ReplyToMessage, true +} + +// GetChatInstance returns value of ChatInstance field. +func (u *UpdateBusinessBotCallbackQuery) GetChatInstance() (value int64) { + if u == nil { + return + } + return u.ChatInstance +} + +// SetData sets value of Data conditional field. +func (u *UpdateBusinessBotCallbackQuery) SetData(value []byte) { + u.Flags.Set(0) + u.Data = value +} + +// GetData returns value of Data conditional field and +// boolean which is true if field was set. +func (u *UpdateBusinessBotCallbackQuery) GetData() (value []byte, ok bool) { + if u == nil { + return + } + if !u.Flags.Has(0) { + return value, false + } + return u.Data, true +} + +// UpdateStarsRevenueStatus represents TL type `updateStarsRevenueStatus#a584b019`. +// The Telegram Star balance of a channel/bot we own has changed »¹. +// +// Links: +// 1. https://core.telegram.org/api/stars#revenue-statistics +// +// See https://core.telegram.org/constructor/updateStarsRevenueStatus for reference. +type UpdateStarsRevenueStatus struct { + // Channel/bot + Peer PeerClass + // New Telegram Star balance. + Status StarsRevenueStatus +} + +// UpdateStarsRevenueStatusTypeID is TL type id of UpdateStarsRevenueStatus. +const UpdateStarsRevenueStatusTypeID = 0xa584b019 + +// construct implements constructor of UpdateClass. +func (u UpdateStarsRevenueStatus) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateStarsRevenueStatus. +var ( + _ bin.Encoder = &UpdateStarsRevenueStatus{} + _ bin.Decoder = &UpdateStarsRevenueStatus{} + _ bin.BareEncoder = &UpdateStarsRevenueStatus{} + _ bin.BareDecoder = &UpdateStarsRevenueStatus{} + + _ UpdateClass = &UpdateStarsRevenueStatus{} +) + +func (u *UpdateStarsRevenueStatus) Zero() bool { + if u == nil { + return true + } + if !(u.Peer == nil) { + return false + } + if !(u.Status.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateStarsRevenueStatus) String() string { + if u == nil { + return "UpdateStarsRevenueStatus(nil)" + } + type Alias UpdateStarsRevenueStatus + return fmt.Sprintf("UpdateStarsRevenueStatus%+v", Alias(*u)) +} + +// FillFrom fills UpdateStarsRevenueStatus from given interface. +func (u *UpdateStarsRevenueStatus) FillFrom(from interface { + GetPeer() (value PeerClass) + GetStatus() (value StarsRevenueStatus) +}) { + u.Peer = from.GetPeer() + u.Status = from.GetStatus() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateStarsRevenueStatus) TypeID() uint32 { + return UpdateStarsRevenueStatusTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateStarsRevenueStatus) TypeName() string { + return "updateStarsRevenueStatus" +} + +// TypeInfo returns info about TL type. +func (u *UpdateStarsRevenueStatus) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateStarsRevenueStatus", + ID: UpdateStarsRevenueStatusTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "Status", + SchemaName: "status", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateStarsRevenueStatus) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateStarsRevenueStatus#a584b019 as nil") + } + b.PutID(UpdateStarsRevenueStatusTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateStarsRevenueStatus) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateStarsRevenueStatus#a584b019 as nil") + } + if u.Peer == nil { + return fmt.Errorf("unable to encode updateStarsRevenueStatus#a584b019: field peer is nil") + } + if err := u.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateStarsRevenueStatus#a584b019: field peer: %w", err) + } + if err := u.Status.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateStarsRevenueStatus#a584b019: field status: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateStarsRevenueStatus) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateStarsRevenueStatus#a584b019 to nil") + } + if err := b.ConsumeID(UpdateStarsRevenueStatusTypeID); err != nil { + return fmt.Errorf("unable to decode updateStarsRevenueStatus#a584b019: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateStarsRevenueStatus) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateStarsRevenueStatus#a584b019 to nil") + } + { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode updateStarsRevenueStatus#a584b019: field peer: %w", err) + } + u.Peer = value + } + { + if err := u.Status.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateStarsRevenueStatus#a584b019: field status: %w", err) + } + } + return nil +} + +// GetPeer returns value of Peer field. +func (u *UpdateStarsRevenueStatus) GetPeer() (value PeerClass) { + if u == nil { + return + } + return u.Peer +} + +// GetStatus returns value of Status field. +func (u *UpdateStarsRevenueStatus) GetStatus() (value StarsRevenueStatus) { + if u == nil { + return + } + return u.Status +} + +// UpdateBotPurchasedPaidMedia represents TL type `updateBotPurchasedPaidMedia#283bd312`. +// +// See https://core.telegram.org/constructor/updateBotPurchasedPaidMedia for reference. +type UpdateBotPurchasedPaidMedia struct { + // UserID field of UpdateBotPurchasedPaidMedia. + UserID int64 + // Payload field of UpdateBotPurchasedPaidMedia. + Payload string + // Qts field of UpdateBotPurchasedPaidMedia. + Qts int +} + +// UpdateBotPurchasedPaidMediaTypeID is TL type id of UpdateBotPurchasedPaidMedia. +const UpdateBotPurchasedPaidMediaTypeID = 0x283bd312 + +// construct implements constructor of UpdateClass. +func (u UpdateBotPurchasedPaidMedia) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateBotPurchasedPaidMedia. +var ( + _ bin.Encoder = &UpdateBotPurchasedPaidMedia{} + _ bin.Decoder = &UpdateBotPurchasedPaidMedia{} + _ bin.BareEncoder = &UpdateBotPurchasedPaidMedia{} + _ bin.BareDecoder = &UpdateBotPurchasedPaidMedia{} + + _ UpdateClass = &UpdateBotPurchasedPaidMedia{} +) + +func (u *UpdateBotPurchasedPaidMedia) Zero() bool { + if u == nil { + return true + } + if !(u.UserID == 0) { + return false + } + if !(u.Payload == "") { + return false + } + if !(u.Qts == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateBotPurchasedPaidMedia) String() string { + if u == nil { + return "UpdateBotPurchasedPaidMedia(nil)" + } + type Alias UpdateBotPurchasedPaidMedia + return fmt.Sprintf("UpdateBotPurchasedPaidMedia%+v", Alias(*u)) +} + +// FillFrom fills UpdateBotPurchasedPaidMedia from given interface. +func (u *UpdateBotPurchasedPaidMedia) FillFrom(from interface { + GetUserID() (value int64) + GetPayload() (value string) + GetQts() (value int) +}) { + u.UserID = from.GetUserID() + u.Payload = from.GetPayload() + u.Qts = from.GetQts() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateBotPurchasedPaidMedia) TypeID() uint32 { + return UpdateBotPurchasedPaidMediaTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateBotPurchasedPaidMedia) TypeName() string { + return "updateBotPurchasedPaidMedia" +} + +// TypeInfo returns info about TL type. +func (u *UpdateBotPurchasedPaidMedia) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateBotPurchasedPaidMedia", + ID: UpdateBotPurchasedPaidMediaTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "Payload", + SchemaName: "payload", + }, + { + Name: "Qts", + SchemaName: "qts", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateBotPurchasedPaidMedia) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateBotPurchasedPaidMedia#283bd312 as nil") + } + b.PutID(UpdateBotPurchasedPaidMediaTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateBotPurchasedPaidMedia) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateBotPurchasedPaidMedia#283bd312 as nil") + } + b.PutLong(u.UserID) + b.PutString(u.Payload) + b.PutInt(u.Qts) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateBotPurchasedPaidMedia) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateBotPurchasedPaidMedia#283bd312 to nil") + } + if err := b.ConsumeID(UpdateBotPurchasedPaidMediaTypeID); err != nil { + return fmt.Errorf("unable to decode updateBotPurchasedPaidMedia#283bd312: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateBotPurchasedPaidMedia) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateBotPurchasedPaidMedia#283bd312 to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode updateBotPurchasedPaidMedia#283bd312: field user_id: %w", err) + } + u.UserID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode updateBotPurchasedPaidMedia#283bd312: field payload: %w", err) + } + u.Payload = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateBotPurchasedPaidMedia#283bd312: field qts: %w", err) + } + u.Qts = value + } + return nil +} + +// GetUserID returns value of UserID field. +func (u *UpdateBotPurchasedPaidMedia) GetUserID() (value int64) { + if u == nil { + return + } + return u.UserID +} + +// GetPayload returns value of Payload field. +func (u *UpdateBotPurchasedPaidMedia) GetPayload() (value string) { + if u == nil { + return + } + return u.Payload +} + +// GetQts returns value of Qts field. +func (u *UpdateBotPurchasedPaidMedia) GetQts() (value int) { + if u == nil { + return + } + return u.Qts +} + +// UpdatePaidReactionPrivacy represents TL type `updatePaidReactionPrivacy#51ca7aec`. +// +// See https://core.telegram.org/constructor/updatePaidReactionPrivacy for reference. +type UpdatePaidReactionPrivacy struct { + // Private field of UpdatePaidReactionPrivacy. + Private bool +} + +// UpdatePaidReactionPrivacyTypeID is TL type id of UpdatePaidReactionPrivacy. +const UpdatePaidReactionPrivacyTypeID = 0x51ca7aec + +// construct implements constructor of UpdateClass. +func (u UpdatePaidReactionPrivacy) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdatePaidReactionPrivacy. +var ( + _ bin.Encoder = &UpdatePaidReactionPrivacy{} + _ bin.Decoder = &UpdatePaidReactionPrivacy{} + _ bin.BareEncoder = &UpdatePaidReactionPrivacy{} + _ bin.BareDecoder = &UpdatePaidReactionPrivacy{} + + _ UpdateClass = &UpdatePaidReactionPrivacy{} +) + +func (u *UpdatePaidReactionPrivacy) Zero() bool { + if u == nil { + return true + } + if !(u.Private == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdatePaidReactionPrivacy) String() string { + if u == nil { + return "UpdatePaidReactionPrivacy(nil)" + } + type Alias UpdatePaidReactionPrivacy + return fmt.Sprintf("UpdatePaidReactionPrivacy%+v", Alias(*u)) +} + +// FillFrom fills UpdatePaidReactionPrivacy from given interface. +func (u *UpdatePaidReactionPrivacy) FillFrom(from interface { + GetPrivate() (value bool) +}) { + u.Private = from.GetPrivate() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdatePaidReactionPrivacy) TypeID() uint32 { + return UpdatePaidReactionPrivacyTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdatePaidReactionPrivacy) TypeName() string { + return "updatePaidReactionPrivacy" +} + +// TypeInfo returns info about TL type. +func (u *UpdatePaidReactionPrivacy) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updatePaidReactionPrivacy", + ID: UpdatePaidReactionPrivacyTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Private", + SchemaName: "private", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdatePaidReactionPrivacy) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updatePaidReactionPrivacy#51ca7aec as nil") + } + b.PutID(UpdatePaidReactionPrivacyTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdatePaidReactionPrivacy) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updatePaidReactionPrivacy#51ca7aec as nil") + } + b.PutBool(u.Private) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdatePaidReactionPrivacy) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updatePaidReactionPrivacy#51ca7aec to nil") + } + if err := b.ConsumeID(UpdatePaidReactionPrivacyTypeID); err != nil { + return fmt.Errorf("unable to decode updatePaidReactionPrivacy#51ca7aec: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdatePaidReactionPrivacy) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updatePaidReactionPrivacy#51ca7aec to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode updatePaidReactionPrivacy#51ca7aec: field private: %w", err) + } + u.Private = value + } + return nil +} + +// GetPrivate returns value of Private field. +func (u *UpdatePaidReactionPrivacy) GetPrivate() (value bool) { + if u == nil { + return + } + return u.Private +} + // UpdateClassName is schema name of UpdateClass. const UpdateClassName = "Update" @@ -27556,7 +28587,7 @@ const UpdateClassName = "Update" // case *tg.UpdateRecentEmojiStatuses: // updateRecentEmojiStatuses#30f443db // case *tg.UpdateRecentReactions: // updateRecentReactions#6f7863f4 // case *tg.UpdateMoveStickerSetToTop: // updateMoveStickerSetToTop#86fccf85 -// case *tg.UpdateMessageExtendedMedia: // updateMessageExtendedMedia#5a73a98c +// case *tg.UpdateMessageExtendedMedia: // updateMessageExtendedMedia#d5a41724 // case *tg.UpdateChannelPinnedTopic: // updateChannelPinnedTopic#192efbe3 // case *tg.UpdateChannelPinnedTopics: // updateChannelPinnedTopics#fe198602 // case *tg.UpdateUser: // updateUser#20529438 @@ -27587,6 +28618,10 @@ const UpdateClassName = "Update" // case *tg.UpdateNewStoryReaction: // updateNewStoryReaction#1824e40b // case *tg.UpdateBroadcastRevenueTransactions: // updateBroadcastRevenueTransactions#dfd961f5 // case *tg.UpdateStarsBalance: // updateStarsBalance#fb85198 +// case *tg.UpdateBusinessBotCallbackQuery: // updateBusinessBotCallbackQuery#1ea2fda7 +// case *tg.UpdateStarsRevenueStatus: // updateStarsRevenueStatus#a584b019 +// case *tg.UpdateBotPurchasedPaidMedia: // updateBotPurchasedPaidMedia#283bd312 +// case *tg.UpdatePaidReactionPrivacy: // updatePaidReactionPrivacy#51ca7aec // default: panic(v) // } type UpdateClass interface { @@ -28358,7 +29393,7 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { } return &v, nil case UpdateMessageExtendedMediaTypeID: - // Decoding updateMessageExtendedMedia#5a73a98c. + // Decoding updateMessageExtendedMedia#d5a41724. v := UpdateMessageExtendedMedia{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) @@ -28574,6 +29609,34 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdateBusinessBotCallbackQueryTypeID: + // Decoding updateBusinessBotCallbackQuery#1ea2fda7. + v := UpdateBusinessBotCallbackQuery{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdateStarsRevenueStatusTypeID: + // Decoding updateStarsRevenueStatus#a584b019. + v := UpdateStarsRevenueStatus{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdateBotPurchasedPaidMediaTypeID: + // Decoding updateBotPurchasedPaidMedia#283bd312. + v := UpdateBotPurchasedPaidMedia{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdatePaidReactionPrivacyTypeID: + // Decoding updatePaidReactionPrivacy#51ca7aec. + v := UpdatePaidReactionPrivacy{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode UpdateClass: %w", bin.NewUnexpectedID(id)) } diff --git a/vendor/github.com/gotd/td/tg/tl_update_slices_gen.go b/vendor/github.com/gotd/td/tg/tl_update_slices_gen.go index 4d9fb239..2586f504 100644 --- a/vendor/github.com/gotd/td/tg/tl_update_slices_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_update_slices_gen.go @@ -1689,6 +1689,58 @@ func (s UpdateClassArray) AsUpdateStarsBalance() (to UpdateStarsBalanceArray) { return to } +// AsUpdateBusinessBotCallbackQuery returns copy with only UpdateBusinessBotCallbackQuery constructors. +func (s UpdateClassArray) AsUpdateBusinessBotCallbackQuery() (to UpdateBusinessBotCallbackQueryArray) { + for _, elem := range s { + value, ok := elem.(*UpdateBusinessBotCallbackQuery) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsUpdateStarsRevenueStatus returns copy with only UpdateStarsRevenueStatus constructors. +func (s UpdateClassArray) AsUpdateStarsRevenueStatus() (to UpdateStarsRevenueStatusArray) { + for _, elem := range s { + value, ok := elem.(*UpdateStarsRevenueStatus) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsUpdateBotPurchasedPaidMedia returns copy with only UpdateBotPurchasedPaidMedia constructors. +func (s UpdateClassArray) AsUpdateBotPurchasedPaidMedia() (to UpdateBotPurchasedPaidMediaArray) { + for _, elem := range s { + value, ok := elem.(*UpdateBotPurchasedPaidMedia) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsUpdatePaidReactionPrivacy returns copy with only UpdatePaidReactionPrivacy constructors. +func (s UpdateClassArray) AsUpdatePaidReactionPrivacy() (to UpdatePaidReactionPrivacyArray) { + for _, elem := range s { + value, ok := elem.(*UpdatePaidReactionPrivacy) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // UpdateNewMessageArray is adapter for slice of UpdateNewMessage. type UpdateNewMessageArray []UpdateNewMessage @@ -11876,3 +11928,331 @@ func (s *UpdateStarsBalanceArray) Pop() (v UpdateStarsBalance, ok bool) { return v, true } + +// UpdateBusinessBotCallbackQueryArray is adapter for slice of UpdateBusinessBotCallbackQuery. +type UpdateBusinessBotCallbackQueryArray []UpdateBusinessBotCallbackQuery + +// Sort sorts slice of UpdateBusinessBotCallbackQuery. +func (s UpdateBusinessBotCallbackQueryArray) Sort(less func(a, b UpdateBusinessBotCallbackQuery) bool) UpdateBusinessBotCallbackQueryArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdateBusinessBotCallbackQuery. +func (s UpdateBusinessBotCallbackQueryArray) SortStable(less func(a, b UpdateBusinessBotCallbackQuery) bool) UpdateBusinessBotCallbackQueryArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdateBusinessBotCallbackQuery. +func (s UpdateBusinessBotCallbackQueryArray) Retain(keep func(x UpdateBusinessBotCallbackQuery) bool) UpdateBusinessBotCallbackQueryArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s UpdateBusinessBotCallbackQueryArray) First() (v UpdateBusinessBotCallbackQuery, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdateBusinessBotCallbackQueryArray) Last() (v UpdateBusinessBotCallbackQuery, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *UpdateBusinessBotCallbackQueryArray) PopFirst() (v UpdateBusinessBotCallbackQuery, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero UpdateBusinessBotCallbackQuery + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *UpdateBusinessBotCallbackQueryArray) Pop() (v UpdateBusinessBotCallbackQuery, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// UpdateStarsRevenueStatusArray is adapter for slice of UpdateStarsRevenueStatus. +type UpdateStarsRevenueStatusArray []UpdateStarsRevenueStatus + +// Sort sorts slice of UpdateStarsRevenueStatus. +func (s UpdateStarsRevenueStatusArray) Sort(less func(a, b UpdateStarsRevenueStatus) bool) UpdateStarsRevenueStatusArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdateStarsRevenueStatus. +func (s UpdateStarsRevenueStatusArray) SortStable(less func(a, b UpdateStarsRevenueStatus) bool) UpdateStarsRevenueStatusArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdateStarsRevenueStatus. +func (s UpdateStarsRevenueStatusArray) Retain(keep func(x UpdateStarsRevenueStatus) bool) UpdateStarsRevenueStatusArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s UpdateStarsRevenueStatusArray) First() (v UpdateStarsRevenueStatus, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdateStarsRevenueStatusArray) Last() (v UpdateStarsRevenueStatus, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *UpdateStarsRevenueStatusArray) PopFirst() (v UpdateStarsRevenueStatus, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero UpdateStarsRevenueStatus + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *UpdateStarsRevenueStatusArray) Pop() (v UpdateStarsRevenueStatus, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// UpdateBotPurchasedPaidMediaArray is adapter for slice of UpdateBotPurchasedPaidMedia. +type UpdateBotPurchasedPaidMediaArray []UpdateBotPurchasedPaidMedia + +// Sort sorts slice of UpdateBotPurchasedPaidMedia. +func (s UpdateBotPurchasedPaidMediaArray) Sort(less func(a, b UpdateBotPurchasedPaidMedia) bool) UpdateBotPurchasedPaidMediaArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdateBotPurchasedPaidMedia. +func (s UpdateBotPurchasedPaidMediaArray) SortStable(less func(a, b UpdateBotPurchasedPaidMedia) bool) UpdateBotPurchasedPaidMediaArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdateBotPurchasedPaidMedia. +func (s UpdateBotPurchasedPaidMediaArray) Retain(keep func(x UpdateBotPurchasedPaidMedia) bool) UpdateBotPurchasedPaidMediaArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s UpdateBotPurchasedPaidMediaArray) First() (v UpdateBotPurchasedPaidMedia, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdateBotPurchasedPaidMediaArray) Last() (v UpdateBotPurchasedPaidMedia, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *UpdateBotPurchasedPaidMediaArray) PopFirst() (v UpdateBotPurchasedPaidMedia, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero UpdateBotPurchasedPaidMedia + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *UpdateBotPurchasedPaidMediaArray) Pop() (v UpdateBotPurchasedPaidMedia, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// UpdatePaidReactionPrivacyArray is adapter for slice of UpdatePaidReactionPrivacy. +type UpdatePaidReactionPrivacyArray []UpdatePaidReactionPrivacy + +// Sort sorts slice of UpdatePaidReactionPrivacy. +func (s UpdatePaidReactionPrivacyArray) Sort(less func(a, b UpdatePaidReactionPrivacy) bool) UpdatePaidReactionPrivacyArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdatePaidReactionPrivacy. +func (s UpdatePaidReactionPrivacyArray) SortStable(less func(a, b UpdatePaidReactionPrivacy) bool) UpdatePaidReactionPrivacyArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdatePaidReactionPrivacy. +func (s UpdatePaidReactionPrivacyArray) Retain(keep func(x UpdatePaidReactionPrivacy) bool) UpdatePaidReactionPrivacyArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s UpdatePaidReactionPrivacyArray) First() (v UpdatePaidReactionPrivacy, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdatePaidReactionPrivacyArray) Last() (v UpdatePaidReactionPrivacy, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *UpdatePaidReactionPrivacyArray) PopFirst() (v UpdatePaidReactionPrivacy, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero UpdatePaidReactionPrivacy + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *UpdatePaidReactionPrivacyArray) Pop() (v UpdatePaidReactionPrivacy, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/vendor/github.com/gotd/td/tg/tl_updates_channel_difference_gen.go b/vendor/github.com/gotd/td/tg/tl_updates_channel_difference_gen.go index 8d0f4e26..892b33aa 100644 --- a/vendor/github.com/gotd/td/tg/tl_updates_channel_difference_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_updates_channel_difference_gen.go @@ -49,7 +49,10 @@ type UpdatesChannelDifferenceEmpty struct { // 1) https://core.telegram.org/api/updates Pts int // Clients are supposed to refetch the channel difference after timeout seconds have - // elapsed + // elapsed, if the user is currently viewing the chat, see here »¹ for more info. + // + // Links: + // 1) https://core.telegram.org/api/updates#subscribing-to-updates-of-channels-supergroups // // Use SetTimeout and GetTimeout helpers. Timeout int @@ -696,7 +699,10 @@ type UpdatesChannelDifference struct { // 1) https://core.telegram.org/api/updates Pts int // Clients are supposed to refetch the channel difference after timeout seconds have - // elapsed + // elapsed, if the user is currently viewing the chat, see here »¹ for more info. + // + // Links: + // 1) https://core.telegram.org/api/updates#subscribing-to-updates-of-channels-supergroups // // Use SetTimeout and GetTimeout helpers. Timeout int @@ -1162,7 +1168,10 @@ type UpdatesChannelDifferenceClass interface { GetFinal() (value bool) // Clients are supposed to refetch the channel difference after timeout seconds have - // elapsed + // elapsed, if the user is currently viewing the chat, see here »¹ for more info. + // + // Links: + // 1) https://core.telegram.org/api/updates#subscribing-to-updates-of-channels-supergroups GetTimeout() (value int, ok bool) // AsNotEmpty tries to map UpdatesChannelDifferenceClass to NotEmptyUpdatesChannelDifference. diff --git a/vendor/github.com/gotd/td/tg/tl_updates_classifier_gen.go b/vendor/github.com/gotd/td/tg/tl_updates_classifier_gen.go index d37f3b1c..7d887f66 100644 --- a/vendor/github.com/gotd/td/tg/tl_updates_classifier_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_updates_classifier_gen.go @@ -84,6 +84,8 @@ func IsQtsUpdate(u UpdateClass) (qts int, ok bool) { return u.Qts, true case *UpdateBotDeleteBusinessMessage: return u.Qts, true + case *UpdateBotPurchasedPaidMedia: + return u.Qts, true } return diff --git a/vendor/github.com/gotd/td/tg/tl_upload_get_cdn_file_gen.go b/vendor/github.com/gotd/td/tg/tl_upload_get_cdn_file_gen.go index 8f5a66e0..e58c0408 100644 --- a/vendor/github.com/gotd/td/tg/tl_upload_get_cdn_file_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_upload_get_cdn_file_gen.go @@ -224,6 +224,10 @@ func (g *UploadGetCDNFileRequest) GetLimit() (value int) { // Links: // 1. https://core.telegram.org/cdn // +// Possible errors: +// +// 400 FILE_TOKEN_INVALID: The master DC did not accept the file_token (e.g., the token has expired). Continue downloading the file from the master DC using upload.getFile. +// // See https://core.telegram.org/method/upload.getCdnFile for reference. func (c *Client) UploadGetCDNFile(ctx context.Context, request *UploadGetCDNFileRequest) (UploadCDNFileClass, error) { var result UploadCDNFileBox diff --git a/vendor/github.com/gotd/td/tg/tl_upload_get_cdn_file_hashes_gen.go b/vendor/github.com/gotd/td/tg/tl_upload_get_cdn_file_hashes_gen.go index ae1084d5..066b05eb 100644 --- a/vendor/github.com/gotd/td/tg/tl_upload_get_cdn_file_hashes_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_upload_get_cdn_file_hashes_gen.go @@ -200,7 +200,7 @@ func (g *UploadGetCDNFileHashesRequest) GetOffset() (value int64) { // Possible errors: // // 400 CDN_METHOD_INVALID: You can't call this method in a CDN DC. -// 400 FILE_TOKEN_INVALID: The specified file token is invalid. +// 400 FILE_TOKEN_INVALID: The master DC did not accept the file_token (e.g., the token has expired). Continue downloading the file from the master DC using upload.getFile. // 400 RSA_DECRYPT_FAILED: Internal RSA decryption failed. // // See https://core.telegram.org/method/upload.getCdnFileHashes for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_upload_get_file_gen.go b/vendor/github.com/gotd/td/tg/tl_upload_get_file_gen.go index dbfcaefc..ed87c79e 100644 --- a/vendor/github.com/gotd/td/tg/tl_upload_get_file_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_upload_get_file_gen.go @@ -325,8 +325,8 @@ func (g *UploadGetFileRequest) GetLimit() (value int) { // 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. // 406 FILEREF_UPGRADE_NEEDED: The client has to be updated in order to support file references. // 400 FILE_ID_INVALID: The provided file id is invalid. -// 400 FILE_REFERENCE_*: The file reference expired, it must be refreshed. // 400 FILE_REFERENCE_EXPIRED: File reference expired, it must be refetched as described in the documentation. +// 420 FLOOD_PREMIUM_WAIT_%d: Please wait %d seconds before repeating the action, or purchase a Telegram Premium subscription to remove this rate limit. // 400 LIMIT_INVALID: The provided limit is invalid. // 400 LOCATION_INVALID: The provided location is invalid. // 400 MSG_ID_INVALID: Invalid message ID provided. diff --git a/vendor/github.com/gotd/td/tg/tl_upload_reupload_cdn_file_gen.go b/vendor/github.com/gotd/td/tg/tl_upload_reupload_cdn_file_gen.go index f2311192..0c7528e8 100644 --- a/vendor/github.com/gotd/td/tg/tl_upload_reupload_cdn_file_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_upload_reupload_cdn_file_gen.go @@ -201,7 +201,9 @@ func (r *UploadReuploadCDNFileRequest) GetRequestToken() (value []byte) { // // 400 CDN_METHOD_INVALID: You can't call this method in a CDN DC. // 500 CDN_UPLOAD_TIMEOUT: A server-side timeout occurred while reuploading the file to the CDN DC. -// 400 FILE_TOKEN_INVALID: The specified file token is invalid. +// 400 FILE_TOKEN_INVALID: The master DC did not accept the file_token (e.g., the token has expired). Continue downloading the file from the master DC using upload.getFile. +// 400 LOCATION_INVALID: The provided location is invalid. +// 400 REQUEST_TOKEN_INVALID: The master DC did not accept the request_token from the CDN DC. Continue downloading the file from the master DC using upload.getFile. // 400 RSA_DECRYPT_FAILED: Internal RSA decryption failed. // // See https://core.telegram.org/method/upload.reuploadCdnFile for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_user_full_gen.go b/vendor/github.com/gotd/td/tg/tl_user_full_gen.go index 5543eb17..d9ba474b 100644 --- a/vendor/github.com/gotd/td/tg/tl_user_full_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_user_full_gen.go @@ -33,6 +33,12 @@ var ( // UserFull represents TL type `userFull#cc997720`. // Extended user info +// When updating the local peer database »¹, all fields from the newly received +// constructor take priority over the old constructor cached locally (including by +// removing fields that aren't set in the new constructor). +// +// Links: +// 1. https://core.telegram.org/api/peers // // See https://core.telegram.org/constructor/userFull for reference. type UserFull struct { @@ -81,13 +87,37 @@ type UserFull struct { // 1) https://core.telegram.org/method/messages.setChatWallPaper // 2) https://core.telegram.org/api/wallpapers#installing-wallpapers-in-a-specific-chat-or-channel WallpaperOverridden bool - // ContactRequirePremium field of UserFull. + // If set, we cannot write to this user: subscribe to Telegram Premium¹ to get + // permission to write to this user. To set this flag for ourselves invoke account + // setGlobalPrivacySettings², setting the settings.new_noncontact_peers_require_premium + // flag, see here »³ for more info. + // + // Links: + // 1) https://core.telegram.org/api/premium + // 2) https://core.telegram.org/method/account.setGlobalPrivacySettings + // 3) https://core.telegram.org/api/privacy#require-premium-for-new-non-contact-users ContactRequirePremium bool - // ReadDatesPrivate field of UserFull. + // If set, we cannot fetch the exact read date of messages we send to this user using + // messages.getOutboxReadDate¹. The exact read date of messages might still be + // unavailable for other reasons, see here »² for more info. To set this flag for + // ourselves invoke account.setGlobalPrivacySettings³, setting the settings + // hide_read_marks flag. + // + // Links: + // 1) https://core.telegram.org/method/messages.getOutboxReadDate + // 2) https://core.telegram.org/method/messages.getOutboxReadDate + // 3) https://core.telegram.org/method/account.setGlobalPrivacySettings ReadDatesPrivate bool - // Flags2 field of UserFull. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags2 bin.Fields - // SponsoredEnabled field of UserFull. + // Whether ads were re-enabled for the current account (only accessible to the currently + // logged-in user), see here »¹ for more info. + // + // Links: + // 1) https://core.telegram.org/api/business#re-enable-ads SponsoredEnabled bool // User ID ID int64 @@ -181,35 +211,62 @@ type UserFull struct { // // Use SetStories and GetStories helpers. Stories PeerStories - // BusinessWorkHours field of UserFull. + // Telegram Business working hours »¹. + // + // Links: + // 1) https://core.telegram.org/api/business#opening-hours // // Use SetBusinessWorkHours and GetBusinessWorkHours helpers. BusinessWorkHours BusinessWorkHours - // BusinessLocation field of UserFull. + // Telegram Business location »¹. + // + // Links: + // 1) https://core.telegram.org/api/business#location // // Use SetBusinessLocation and GetBusinessLocation helpers. BusinessLocation BusinessLocation - // BusinessGreetingMessage field of UserFull. + // Telegram Business greeting message »¹. + // + // Links: + // 1) https://core.telegram.org/api/business#greeting-messages // // Use SetBusinessGreetingMessage and GetBusinessGreetingMessage helpers. BusinessGreetingMessage BusinessGreetingMessage - // BusinessAwayMessage field of UserFull. + // Telegram Business away message »¹. + // + // Links: + // 1) https://core.telegram.org/api/business#away-messages // // Use SetBusinessAwayMessage and GetBusinessAwayMessage helpers. BusinessAwayMessage BusinessAwayMessage - // BusinessIntro field of UserFull. + // Specifies a custom Telegram Business profile introduction »¹. + // + // Links: + // 1) https://core.telegram.org/api/business#business-introduction // // Use SetBusinessIntro and GetBusinessIntro helpers. BusinessIntro BusinessIntro - // Birthday field of UserFull. + // Contains info about the user's birthday »¹. + // + // Links: + // 1) https://core.telegram.org/api/profile#birthday // // Use SetBirthday and GetBirthday helpers. Birthday Birthday - // PersonalChannelID field of UserFull. + // ID of the associated personal channel »¹, that should be shown in the profile page². + // + // Links: + // 1) https://core.telegram.org/api/channel + // 2) https://core.telegram.org/api/profile#personal-channel // // Use SetPersonalChannelID and GetPersonalChannelID helpers. PersonalChannelID int64 - // PersonalChannelMessage field of UserFull. + // ID of the latest message of the associated personal channel »¹, that should be + // previewed in the profile page². + // + // Links: + // 1) https://core.telegram.org/api/channel + // 2) https://core.telegram.org/api/profile#personal-channel // // Use SetPersonalChannelMessage and GetPersonalChannelMessage helpers. PersonalChannelMessage int diff --git a/vendor/github.com/gotd/td/tg/tl_user_gen.go b/vendor/github.com/gotd/td/tg/tl_user_gen.go index eb260c3c..1663524f 100644 --- a/vendor/github.com/gotd/td/tg/tl_user_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_user_gen.go @@ -166,8 +166,18 @@ func (u *UserEmpty) GetID() (value int64) { return u.ID } -// User represents TL type `user#215c4438`. -// Indicates info about a certain user +// User represents TL type `user#83314fca`. +// Indicates info about a certain user. +// Unless specified otherwise, when updating the local peer database¹, all fields from +// the newly received constructor take priority over the old constructor cached locally +// (including by removing fields that aren't set in the new constructor). +// See here »¹ for an implementation of the logic to use when updating the local user +// peer database². +// +// Links: +// 1. https://core.telegram.org/api/peers +// 2. https://github.com/tdlib/td/blob/cb164927417f22811c74cd8678ed4a5ab7cb80ba/td/telegram/UserManager.cpp#L2267 +// 3. https://core.telegram.org/api/peers // // See https://core.telegram.org/constructor/user for reference. type User struct { @@ -178,13 +188,31 @@ type User struct { Flags bin.Fields // Whether this user indicates the currently logged in user Self bool - // Whether this user is a contact + // Whether this user is a contact When updating the local peer database¹, do not apply + // changes to this field if the min flag is set. + // + // Links: + // 1) https://core.telegram.org/api/peers Contact bool - // Whether this user is a mutual contact + // Whether this user is a mutual contact. When updating the local peer database¹, do not + // apply changes to this field if the min flag is set. + // + // Links: + // 1) https://core.telegram.org/api/peers MutualContact bool - // Whether the account of this user was deleted + // Whether the account of this user was deleted. Changes to this flag should invalidate + // the local userFull¹ cache for this user ID, see here »² for more info. + // + // Links: + // 1) https://core.telegram.org/constructor/userFull + // 2) https://core.telegram.org/api/peers#full-info-database Deleted bool - // Is this user a bot? + // Is this user a bot? Changes to this flag should invalidate the local userFull¹ cache + // for this user ID, see here »² for more info. + // + // Links: + // 1) https://core.telegram.org/constructor/userFull + // 2) https://core.telegram.org/api/peers#full-info-database Bot bool // Can the bot see all messages in groups? BotChatHistory bool @@ -205,7 +233,8 @@ type User struct { Support bool // This may be a scam user Scam bool - // If set, the profile picture for this user should be refetched + // If set and min is set, the value of photo can be used to update the local database, + // see the documentation of that flag for more info. ApplyMinPhoto bool // If set, this user was reported by many users as a fake or scam user: be careful when // interacting with them. @@ -215,12 +244,24 @@ type User struct { // Links: // 1) https://core.telegram.org/api/bots/attach BotAttachMenu bool - // Whether this user is a Telegram Premium user + // Whether this user is a Telegram Premium user Changes to this flag should invalidate + // the local userFull¹ cache for this user ID, see here »² for more info. Changes to + // this flag if the self flag is set should also trigger the following calls, to refresh + // the respective caches: - The help.getConfig³ cache - The messages.getTopReactions⁴ + // cache if the bot flag is not set + // + // Links: + // 1) https://core.telegram.org/constructor/userFull + // 2) https://core.telegram.org/api/peers#full-info-database + // 3) https://core.telegram.org/method/help.getConfig + // 4) https://core.telegram.org/method/messages.getTopReactions Premium bool - // Whether we installed the attachment menu web app¹ offered by this bot + // Whether we installed the attachment menu web app¹ offered by this bot. When updating + // the local peer database², do not apply changes to this field if the min flag is set. // // Links: // 1) https://core.telegram.org/api/bots/attach + // 2) https://core.telegram.org/api/peers AttachMenuEnabled bool // Flags, see TL conditional fields¹ // @@ -228,58 +269,159 @@ type User struct { // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags2 bin.Fields // Whether we can edit the profile picture, name, about text and description of this bot - // because we own it. + // because we own it. When updating the local peer database¹, do not apply changes to + // this field if the min flag is set. Changes to this flag (if min is not set) should + // invalidate the local userFull² cache for this user ID. + // + // Links: + // 1) https://core.telegram.org/api/peers + // 2) https://core.telegram.org/constructor/userFull BotCanEdit bool - // Whether we marked this user as a close friend, see here » for more info¹ + // Whether we marked this user as a close friend, see here » for more info¹. When + // updating the local peer database², do not apply changes to this field if the min flag + // is set. // // Links: // 1) https://core.telegram.org/api/privacy + // 2) https://core.telegram.org/api/peers CloseFriend bool - // Whether we have hidden »¹ all active stories of this user. + // Whether we have hidden »¹ all active stories of this user. When updating the local + // peer database², do not apply changes to this field if the min flag is set. // // Links: // 1) https://core.telegram.org/api/stories#hiding-stories-of-other-users + // 2) https://core.telegram.org/api/peers StoriesHidden bool // No stories from this user are visible. StoriesUnavailable bool - // ContactRequirePremium field of User. + // If set, we can only write to this user if they have already sent some messages to us, + // if we are subscribed to Telegram Premium¹, or if they're a mutual contact (user² + // mutual_contact). All the secondary conditions listed above must be checked separately + // to verify whether we can still write to the user, even if this flag is set (i.e. a + // mutual contact will have this flag set even if we can still write to them, and so on.. + // ); to avoid doing these extra checks if we haven't yet cached all the required + // information (for example while displaying the chat list in the sharing UI) the users + // getIsPremiumRequiredToContact³ method may be invoked instead, passing the list of + // users currently visible in the UI, returning a list of booleans that directly specify + // whether we can or cannot write to each user; alternatively, the userFull⁴ + // contact_require_premium flag contains the same (fully checked, i.e. it's not just a + // copy of this flag) info returned by users.getIsPremiumRequiredToContact⁵. To set + // this flag for ourselves invoke account.setGlobalPrivacySettings⁶, setting the + // settings.new_noncontact_peers_require_premium flag. + // + // Links: + // 1) https://core.telegram.org/api/premium + // 2) https://core.telegram.org/constructor/user + // 3) https://core.telegram.org/method/users.getIsPremiumRequiredToContact + // 4) https://core.telegram.org/constructor/userFull + // 5) https://core.telegram.org/method/users.getIsPremiumRequiredToContact + // 6) https://core.telegram.org/method/account.setGlobalPrivacySettings ContactRequirePremium bool - // BotBusiness field of User. + // Whether this bot can be connected to a user as specified here »¹. + // + // Links: + // 1) https://core.telegram.org/api/business#connected-bots BotBusiness bool - // ID of the user + // If set, this bot has configured a Main Mini App »¹. + // + // Links: + // 1) https://core.telegram.org/api/bots/webapps#main-mini-apps + BotHasMainApp bool + // ID of the user, see here »¹ for more info. + // + // Links: + // 1) https://core.telegram.org/api/peers#peer-id ID int64 - // Access hash of the user + // Access hash of the user, see here »¹ for more info. If this flag is set, when + // updating the local peer database², generate a virtual flag called min_access_hash, + // which is: - Set to true if min is set AND - The phone flag is not set OR - The phone + // flag is set and the associated phone number string is non-empty - Set to false + // otherwise. Then, apply both access_hash and min_access_hash to the local database if: + // - min_access_hash is false OR - min_access_hash is true AND - There is no locally + // cached object for this user OR - There is no access_hash in the local cache OR - The + // cached object's min_access_hash is also true If the final merged object stored to the + // database has the min_access_hash field set to true, the related access_hash is only + // suitable to use in inputPeerPhotoFileLocation »³, to directly download the profile + // pictures⁴ of users, everywhere else a inputPeer*FromMessage constructor will have to + // be generated as specified here »⁵. Bots can also use min access hashes in some + // conditions, by passing 0 instead of the min access hash. + // + // Links: + // 1) https://core.telegram.org/api/peers#access-hash + // 2) https://core.telegram.org/api/peers + // 3) https://core.telegram.org/constructor/inputPeerPhotoFileLocation + // 4) https://core.telegram.org/api/files + // 5) https://core.telegram.org/api/min // // Use SetAccessHash and GetAccessHash helpers. AccessHash int64 - // First name + // First name. When updating the local peer database¹, apply changes to this field only + // if: - The min flag is not set OR - The min flag is set AND - The min flag of the + // locally cached user entry is set. + // + // Links: + // 1) https://core.telegram.org/api/peers // // Use SetFirstName and GetFirstName helpers. FirstName string - // Last name + // Last name. When updating the local peer database¹, apply changes to this field only + // if: - The min flag is not set OR - The min flag is set AND - The min flag of the + // locally cached user entry is set. + // + // Links: + // 1) https://core.telegram.org/api/peers // // Use SetLastName and GetLastName helpers. LastName string - // Username + // Main active username. When updating the local peer database¹, apply changes to this + // field only if: - The min flag is not set OR - The min flag is set AND - The min flag + // of the locally cached user entry is set. Changes to this flag should invalidate the + // local userFull² cache for this user ID if the above conditions are respected and the + // bot_can_edit flag is also set. + // + // Links: + // 1) https://core.telegram.org/api/peers + // 2) https://core.telegram.org/constructor/userFull // // Use SetUsername and GetUsername helpers. Username string - // Phone number + // Phone number. When updating the local peer database¹, apply changes to this field + // only if: - The min flag is not set OR - The min flag is set AND - The min flag of the + // locally cached user entry is set. + // + // Links: + // 1) https://core.telegram.org/api/peers // // Use SetPhone and GetPhone helpers. Phone string - // Profile picture of user + // Profile picture of user. When updating the local peer database¹, apply changes to + // this field only if: - The min flag is not set OR - The min flag is set AND - The + // apply_min_photo flag is set OR - The min flag of the locally cached user entry is set. + // + // Links: + // 1) https://core.telegram.org/api/peers // // Use SetPhoto and GetPhoto helpers. Photo UserProfilePhotoClass - // Online status of user + // Online status of user. When updating the local peer database¹, apply changes to this + // field only if: - The min flag is not set OR - The min flag is set AND - The min flag + // of the locally cached user entry is set OR - The locally cached user entry is equal to + // userStatusEmpty². + // + // Links: + // 1) https://core.telegram.org/api/peers + // 2) https://core.telegram.org/constructor/userStatusEmpty // // Use SetStatus and GetStatus helpers. Status UserStatusClass - // Version of the bot_info field in userFull¹, incremented every time it changes + // Version of the bot_info field in userFull¹, incremented every time it changes. + // Changes to this flag should invalidate the local userFull² cache for this user ID, + // see here »³ for more info. // // Links: // 1) https://core.telegram.org/constructor/userFull + // 2) https://core.telegram.org/constructor/userFull + // 3) https://core.telegram.org/api/peers#full-info-database // // Use SetBotInfoVersion and GetBotInfoVersion helpers. BotInfoVersion int @@ -302,14 +444,23 @@ type User struct { // // Use SetEmojiStatus and GetEmojiStatus helpers. EmojiStatus EmojiStatusClass - // Additional usernames + // Additional usernames. When updating the local peer database¹, apply changes to this + // field only if: - The min flag is not set OR - The min flag is set AND - The min flag + // of the locally cached user entry is set. Changes to this flag (if the above conditions + // are respected) should invalidate the local userFull² cache for this user ID. + // + // Links: + // 1) https://core.telegram.org/api/peers + // 2) https://core.telegram.org/constructor/userFull // // Use SetUsernames and GetUsernames helpers. Usernames []Username - // ID of the maximum read story¹. + // ID of the maximum read story¹. When updating the local peer database², do not apply + // changes to this field if the min flag of the incoming constructor is set. // // Links: // 1) https://core.telegram.org/api/stories + // 2) https://core.telegram.org/api/peers // // Use SetStoriesMaxID and GetStoriesMaxID helpers. StoriesMaxID int @@ -327,10 +478,14 @@ type User struct { // // Use SetProfileColor and GetProfileColor helpers. ProfileColor PeerColor + // Monthly Active Users (MAU) of this bot (may be absent for small bots). + // + // Use SetBotActiveUsers and GetBotActiveUsers helpers. + BotActiveUsers int } // UserTypeID is TL type id of User. -const UserTypeID = 0x215c4438 +const UserTypeID = 0x83314fca // construct implements constructor of UserClass. func (u User) construct() UserClass { return &u } @@ -427,6 +582,9 @@ func (u *User) Zero() bool { if !(u.BotBusiness == false) { return false } + if !(u.BotHasMainApp == false) { + return false + } if !(u.ID == 0) { return false } @@ -478,6 +636,9 @@ func (u *User) Zero() bool { if !(u.ProfileColor.Zero()) { return false } + if !(u.BotActiveUsers == 0) { + return false + } return true } @@ -517,6 +678,7 @@ func (u *User) FillFrom(from interface { GetStoriesUnavailable() (value bool) GetContactRequirePremium() (value bool) GetBotBusiness() (value bool) + GetBotHasMainApp() (value bool) GetID() (value int64) GetAccessHash() (value int64, ok bool) GetFirstName() (value string, ok bool) @@ -534,6 +696,7 @@ func (u *User) FillFrom(from interface { GetStoriesMaxID() (value int, ok bool) GetColor() (value PeerColor, ok bool) GetProfileColor() (value PeerColor, ok bool) + GetBotActiveUsers() (value int, ok bool) }) { u.Self = from.GetSelf() u.Contact = from.GetContact() @@ -559,6 +722,7 @@ func (u *User) FillFrom(from interface { u.StoriesUnavailable = from.GetStoriesUnavailable() u.ContactRequirePremium = from.GetContactRequirePremium() u.BotBusiness = from.GetBotBusiness() + u.BotHasMainApp = from.GetBotHasMainApp() u.ID = from.GetID() if val, ok := from.GetAccessHash(); ok { u.AccessHash = val @@ -624,6 +788,10 @@ func (u *User) FillFrom(from interface { u.ProfileColor = val } + if val, ok := from.GetBotActiveUsers(); ok { + u.BotActiveUsers = val + } + } // TypeID returns type id in TL schema. @@ -769,6 +937,11 @@ func (u *User) TypeInfo() tdp.Type { SchemaName: "bot_business", Null: !u.Flags2.Has(11), }, + { + Name: "BotHasMainApp", + SchemaName: "bot_has_main_app", + Null: !u.Flags2.Has(13), + }, { Name: "ID", SchemaName: "id", @@ -853,6 +1026,11 @@ func (u *User) TypeInfo() tdp.Type { SchemaName: "profile_color", Null: !u.Flags2.Has(9), }, + { + Name: "BotActiveUsers", + SchemaName: "bot_active_users", + Null: !u.Flags2.Has(12), + }, } return typ } @@ -931,6 +1109,9 @@ func (u *User) SetFlags() { if !(u.BotBusiness == false) { u.Flags2.Set(11) } + if !(u.BotHasMainApp == false) { + u.Flags2.Set(13) + } if !(u.AccessHash == 0) { u.Flags.Set(0) } @@ -979,12 +1160,15 @@ func (u *User) SetFlags() { if !(u.ProfileColor.Zero()) { u.Flags2.Set(9) } + if !(u.BotActiveUsers == 0) { + u.Flags2.Set(12) + } } // Encode implements bin.Encoder. func (u *User) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode user#215c4438 as nil") + return fmt.Errorf("can't encode user#83314fca as nil") } b.PutID(UserTypeID) return u.EncodeBare(b) @@ -993,14 +1177,14 @@ func (u *User) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *User) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode user#215c4438 as nil") + return fmt.Errorf("can't encode user#83314fca as nil") } u.SetFlags() if err := u.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#215c4438: field flags: %w", err) + return fmt.Errorf("unable to encode user#83314fca: field flags: %w", err) } if err := u.Flags2.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#215c4438: field flags2: %w", err) + return fmt.Errorf("unable to encode user#83314fca: field flags2: %w", err) } b.PutLong(u.ID) if u.Flags.Has(0) { @@ -1020,18 +1204,18 @@ func (u *User) EncodeBare(b *bin.Buffer) error { } if u.Flags.Has(5) { if u.Photo == nil { - return fmt.Errorf("unable to encode user#215c4438: field photo is nil") + return fmt.Errorf("unable to encode user#83314fca: field photo is nil") } if err := u.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#215c4438: field photo: %w", err) + return fmt.Errorf("unable to encode user#83314fca: field photo: %w", err) } } if u.Flags.Has(6) { if u.Status == nil { - return fmt.Errorf("unable to encode user#215c4438: field status is nil") + return fmt.Errorf("unable to encode user#83314fca: field status is nil") } if err := u.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#215c4438: field status: %w", err) + return fmt.Errorf("unable to encode user#83314fca: field status: %w", err) } } if u.Flags.Has(14) { @@ -1041,7 +1225,7 @@ func (u *User) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(u.RestrictionReason)) for idx, v := range u.RestrictionReason { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#215c4438: field restriction_reason element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode user#83314fca: field restriction_reason element with index %d: %w", idx, err) } } } @@ -1053,17 +1237,17 @@ func (u *User) EncodeBare(b *bin.Buffer) error { } if u.Flags.Has(30) { if u.EmojiStatus == nil { - return fmt.Errorf("unable to encode user#215c4438: field emoji_status is nil") + return fmt.Errorf("unable to encode user#83314fca: field emoji_status is nil") } if err := u.EmojiStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#215c4438: field emoji_status: %w", err) + return fmt.Errorf("unable to encode user#83314fca: field emoji_status: %w", err) } } if u.Flags2.Has(0) { b.PutVectorHeader(len(u.Usernames)) for idx, v := range u.Usernames { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#215c4438: field usernames element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode user#83314fca: field usernames element with index %d: %w", idx, err) } } } @@ -1072,24 +1256,27 @@ func (u *User) EncodeBare(b *bin.Buffer) error { } if u.Flags2.Has(8) { if err := u.Color.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#215c4438: field color: %w", err) + return fmt.Errorf("unable to encode user#83314fca: field color: %w", err) } } if u.Flags2.Has(9) { if err := u.ProfileColor.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#215c4438: field profile_color: %w", err) + return fmt.Errorf("unable to encode user#83314fca: field profile_color: %w", err) } } + if u.Flags2.Has(12) { + b.PutInt(u.BotActiveUsers) + } return nil } // Decode implements bin.Decoder. func (u *User) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode user#215c4438 to nil") + return fmt.Errorf("can't decode user#83314fca to nil") } if err := b.ConsumeID(UserTypeID); err != nil { - return fmt.Errorf("unable to decode user#215c4438: %w", err) + return fmt.Errorf("unable to decode user#83314fca: %w", err) } return u.DecodeBare(b) } @@ -1097,11 +1284,11 @@ func (u *User) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *User) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode user#215c4438 to nil") + return fmt.Errorf("can't decode user#83314fca to nil") } { if err := u.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#215c4438: field flags: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field flags: %w", err) } } u.Self = u.Flags.Has(10) @@ -1124,7 +1311,7 @@ func (u *User) DecodeBare(b *bin.Buffer) error { u.AttachMenuEnabled = u.Flags.Has(29) { if err := u.Flags2.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#215c4438: field flags2: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field flags2: %w", err) } } u.BotCanEdit = u.Flags2.Has(1) @@ -1133,73 +1320,74 @@ func (u *User) DecodeBare(b *bin.Buffer) error { u.StoriesUnavailable = u.Flags2.Has(4) u.ContactRequirePremium = u.Flags2.Has(10) u.BotBusiness = u.Flags2.Has(11) + u.BotHasMainApp = u.Flags2.Has(13) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode user#215c4438: field id: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field id: %w", err) } u.ID = value } if u.Flags.Has(0) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode user#215c4438: field access_hash: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field access_hash: %w", err) } u.AccessHash = value } if u.Flags.Has(1) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#215c4438: field first_name: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field first_name: %w", err) } u.FirstName = value } if u.Flags.Has(2) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#215c4438: field last_name: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field last_name: %w", err) } u.LastName = value } if u.Flags.Has(3) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#215c4438: field username: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field username: %w", err) } u.Username = value } if u.Flags.Has(4) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#215c4438: field phone: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field phone: %w", err) } u.Phone = value } if u.Flags.Has(5) { value, err := DecodeUserProfilePhoto(b) if err != nil { - return fmt.Errorf("unable to decode user#215c4438: field photo: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field photo: %w", err) } u.Photo = value } if u.Flags.Has(6) { value, err := DecodeUserStatus(b) if err != nil { - return fmt.Errorf("unable to decode user#215c4438: field status: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field status: %w", err) } u.Status = value } if u.Flags.Has(14) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode user#215c4438: field bot_info_version: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field bot_info_version: %w", err) } u.BotInfoVersion = value } if u.Flags.Has(18) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode user#215c4438: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field restriction_reason: %w", err) } if headerLen > 0 { @@ -1208,7 +1396,7 @@ func (u *User) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value RestrictionReason if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#215c4438: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field restriction_reason: %w", err) } u.RestrictionReason = append(u.RestrictionReason, value) } @@ -1216,28 +1404,28 @@ func (u *User) DecodeBare(b *bin.Buffer) error { if u.Flags.Has(19) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#215c4438: field bot_inline_placeholder: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field bot_inline_placeholder: %w", err) } u.BotInlinePlaceholder = value } if u.Flags.Has(22) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#215c4438: field lang_code: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field lang_code: %w", err) } u.LangCode = value } if u.Flags.Has(30) { value, err := DecodeEmojiStatus(b) if err != nil { - return fmt.Errorf("unable to decode user#215c4438: field emoji_status: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field emoji_status: %w", err) } u.EmojiStatus = value } if u.Flags2.Has(0) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode user#215c4438: field usernames: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field usernames: %w", err) } if headerLen > 0 { @@ -1246,7 +1434,7 @@ func (u *User) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value Username if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#215c4438: field usernames: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field usernames: %w", err) } u.Usernames = append(u.Usernames, value) } @@ -1254,20 +1442,27 @@ func (u *User) DecodeBare(b *bin.Buffer) error { if u.Flags2.Has(5) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode user#215c4438: field stories_max_id: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field stories_max_id: %w", err) } u.StoriesMaxID = value } if u.Flags2.Has(8) { if err := u.Color.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#215c4438: field color: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field color: %w", err) } } if u.Flags2.Has(9) { if err := u.ProfileColor.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#215c4438: field profile_color: %w", err) + return fmt.Errorf("unable to decode user#83314fca: field profile_color: %w", err) } } + if u.Flags2.Has(12) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode user#83314fca: field bot_active_users: %w", err) + } + u.BotActiveUsers = value + } return nil } @@ -1727,6 +1922,25 @@ func (u *User) GetBotBusiness() (value bool) { return u.Flags2.Has(11) } +// SetBotHasMainApp sets value of BotHasMainApp conditional field. +func (u *User) SetBotHasMainApp(value bool) { + if value { + u.Flags2.Set(13) + u.BotHasMainApp = true + } else { + u.Flags2.Unset(13) + u.BotHasMainApp = false + } +} + +// GetBotHasMainApp returns value of BotHasMainApp conditional field. +func (u *User) GetBotHasMainApp() (value bool) { + if u == nil { + return + } + return u.Flags2.Has(13) +} + // GetID returns value of ID field. func (u *User) GetID() (value int64) { if u == nil { @@ -2023,6 +2237,24 @@ func (u *User) GetProfileColor() (value PeerColor, ok bool) { return u.ProfileColor, true } +// SetBotActiveUsers sets value of BotActiveUsers conditional field. +func (u *User) SetBotActiveUsers(value int) { + u.Flags2.Set(12) + u.BotActiveUsers = value +} + +// GetBotActiveUsers returns value of BotActiveUsers conditional field and +// boolean which is true if field was set. +func (u *User) GetBotActiveUsers() (value int, ok bool) { + if u == nil { + return + } + if !u.Flags2.Has(12) { + return value, false + } + return u.BotActiveUsers, true +} + // UserClassName is schema name of UserClass. const UserClassName = "User" @@ -2038,7 +2270,7 @@ const UserClassName = "User" // } // switch v := g.(type) { // case *tg.UserEmpty: // userEmpty#d3bc4b7a -// case *tg.User: // user#215c4438 +// case *tg.User: // user#83314fca // default: panic(v) // } type UserClass interface { @@ -2123,7 +2355,7 @@ func DecodeUser(buf *bin.Buffer) (UserClass, error) { } return &v, nil case UserTypeID: - // Decoding user#215c4438. + // Decoding user#83314fca. v := User{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UserClass: %w", err) diff --git a/vendor/github.com/gotd/td/tg/tl_user_status_gen.go b/vendor/github.com/gotd/td/tg/tl_user_status_gen.go index c48cb1ae..18824102 100644 --- a/vendor/github.com/gotd/td/tg/tl_user_status_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_user_status_gen.go @@ -408,9 +408,18 @@ func (u *UserStatusOffline) GetWasOnline() (value int) { // // See https://core.telegram.org/constructor/userStatusRecently for reference. type UserStatusRecently struct { - // Flags field of UserStatusRecently. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // ByMe field of UserStatusRecently. + // If set, the exact user status of this user is actually available to us, but to view it + // we must first purchase a Premium¹ subscription, or allow this user to see our exact + // last online status. See here »² for more info. + // + // Links: + // 1) https://core.telegram.org/api/premium + // 2) https://core.telegram.org/constructor/privacyKeyStatusTimestamp ByMe bool } @@ -569,9 +578,18 @@ func (u *UserStatusRecently) GetByMe() (value bool) { // // See https://core.telegram.org/constructor/userStatusLastWeek for reference. type UserStatusLastWeek struct { - // Flags field of UserStatusLastWeek. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // ByMe field of UserStatusLastWeek. + // If set, the exact user status of this user is actually available to us, but to view it + // we must first purchase a Premium¹ subscription, or allow this user to see our exact + // last online status. See here »² for more info. + // + // Links: + // 1) https://core.telegram.org/api/premium + // 2) https://core.telegram.org/constructor/privacyKeyStatusTimestamp ByMe bool } @@ -730,9 +748,18 @@ func (u *UserStatusLastWeek) GetByMe() (value bool) { // // See https://core.telegram.org/constructor/userStatusLastMonth for reference. type UserStatusLastMonth struct { - // Flags field of UserStatusLastMonth. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // ByMe field of UserStatusLastMonth. + // If set, the exact user status of this user is actually available to us, but to view it + // we must first purchase a Premium¹ subscription, or allow this user to see our exact + // last online status. See here »² for more info. + // + // Links: + // 1) https://core.telegram.org/api/premium + // 2) https://core.telegram.org/constructor/privacyKeyStatusTimestamp ByMe bool } diff --git a/vendor/github.com/gotd/td/tg/tl_users_get_is_premium_required_to_contact_gen.go b/vendor/github.com/gotd/td/tg/tl_users_get_is_premium_required_to_contact_gen.go index 620701fd..a1970abf 100644 --- a/vendor/github.com/gotd/td/tg/tl_users_get_is_premium_required_to_contact_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_users_get_is_premium_required_to_contact_gen.go @@ -32,10 +32,16 @@ var ( ) // UsersGetIsPremiumRequiredToContactRequest represents TL type `users.getIsPremiumRequiredToContact#a622aa10`. +// Check whether we can write to the specified user (this method can only be called by +// non-Premium¹ users), see here »² for more info on the full flow. +// +// Links: +// 1. https://core.telegram.org/api/premium +// 2. https://core.telegram.org/api/privacy#require-premium-for-new-non-contact-users // // See https://core.telegram.org/method/users.getIsPremiumRequiredToContact for reference. type UsersGetIsPremiumRequiredToContactRequest struct { - // ID field of UsersGetIsPremiumRequiredToContactRequest. + // Users to fetch info about. ID []InputUserClass } @@ -184,6 +190,12 @@ func (g *UsersGetIsPremiumRequiredToContactRequest) MapID() (value InputUserClas } // UsersGetIsPremiumRequiredToContact invokes method users.getIsPremiumRequiredToContact#a622aa10 returning error if any. +// Check whether we can write to the specified user (this method can only be called by +// non-Premium¹ users), see here »² for more info on the full flow. +// +// Links: +// 1. https://core.telegram.org/api/premium +// 2. https://core.telegram.org/api/privacy#require-premium-for-new-non-contact-users // // See https://core.telegram.org/method/users.getIsPremiumRequiredToContact for reference. func (c *Client) UsersGetIsPremiumRequiredToContact(ctx context.Context, id []InputUserClass) ([]bool, error) { diff --git a/vendor/github.com/gotd/td/tg/tl_users_get_users_gen.go b/vendor/github.com/gotd/td/tg/tl_users_get_users_gen.go index 4879d722..c03f76c5 100644 --- a/vendor/github.com/gotd/td/tg/tl_users_get_users_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_users_get_users_gen.go @@ -193,6 +193,7 @@ func (g *UsersGetUsersRequest) MapID() (value InputUserClassArray) { // 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. // 400 FROM_MESSAGE_BOT_DISABLED: Bots can't use fromMessage min constructors. // 400 MSG_ID_INVALID: Invalid message ID provided. +// 400 PEER_ID_INVALID: The provided peer id is invalid. // 400 USER_BANNED_IN_CHANNEL: You're banned from sending messages in supergroups/channels. // // See https://core.telegram.org/method/users.getUsers for reference. diff --git a/vendor/github.com/gotd/td/tg/tl_web_page_attribute_gen.go b/vendor/github.com/gotd/td/tg/tl_web_page_attribute_gen.go index 7ecee2a3..3117e639 100644 --- a/vendor/github.com/gotd/td/tg/tl_web_page_attribute_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_web_page_attribute_gen.go @@ -531,16 +531,32 @@ func (w *WebPageAttributeStory) GetStory() (value StoryItemClass, ok bool) { } // WebPageAttributeStickerSet represents TL type `webPageAttributeStickerSet#50cc03d3`. +// Contains info about a stickerset »¹, for a webPage² preview of a stickerset deep +// link »³ (the webPage⁴ will have a type of telegram_stickerset). +// +// Links: +// 1. https://core.telegram.org/api/stickers +// 2. https://core.telegram.org/constructor/webPage +// 3. https://core.telegram.org/api/links#stickerset-links +// 4. https://core.telegram.org/constructor/webPage // // See https://core.telegram.org/constructor/webPageAttributeStickerSet for reference. type WebPageAttributeStickerSet struct { - // Flags field of WebPageAttributeStickerSet. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Emojis field of WebPageAttributeStickerSet. + // Whether this i s a custom emoji stickerset¹. + // + // Links: + // 1) https://core.telegram.org/api/custom-emoji Emojis bool - // TextColor field of WebPageAttributeStickerSet. + // Whether the color of this TGS custom emoji stickerset should be changed to the text + // color when used in messages, the accent color if used as emoji status, white on chat + // photos, or another appropriate color based on context. TextColor bool - // Stickers field of WebPageAttributeStickerSet. + // A subset of the stickerset in the stickerset. Stickers []DocumentClass } diff --git a/vendor/github.com/gotd/td/tg/tl_web_page_gen.go b/vendor/github.com/gotd/td/tg/tl_web_page_gen.go index 92bbb3f5..59a8163b 100644 --- a/vendor/github.com/gotd/td/tg/tl_web_page_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_web_page_gen.go @@ -484,13 +484,16 @@ type WebPage struct { URL string // Webpage URL to be displayed to the user DisplayURL string - // Hash for pagination, for more info click here¹ + // Hash used for caching, for more info click here¹ // // Links: // 1) https://core.telegram.org/api/offsets#hash-generation Hash int // Type of the web page. Can be: article, photo, audio, video, document, profile, app, or - // something else + // something else, see here »¹ for a full list. + // + // Links: + // 1) https://github.com/telegramdesktop/tdesktop/blob/4f7a124f3e85f3f61d862b94fb5a45236976f38f/Telegram/SourceFiles/data/data_web_page.cpp#L127 // // Use SetType and GetType helpers. Type string diff --git a/vendor/github.com/gotd/td/tg/tl_web_view_result_url_gen.go b/vendor/github.com/gotd/td/tg/tl_web_view_result_url_gen.go index 8742d245..bc11ea96 100644 --- a/vendor/github.com/gotd/td/tg/tl_web_view_result_url_gen.go +++ b/vendor/github.com/gotd/td/tg/tl_web_view_result_url_gen.go @@ -31,19 +31,34 @@ var ( _ = tdjson.Encoder{} ) -// WebViewResultURL represents TL type `webViewResultUrl#c14557c`. +// WebViewResultURL represents TL type `webViewResultUrl#4d22ff98`. // Contains the webview URL with appropriate theme and user info parameters added // // See https://core.telegram.org/constructor/webViewResultUrl for reference. type WebViewResultURL struct { - // Webview session ID + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // If set, the app must be opened in fullsize mode instead of compact mode. + Fullsize bool + // Webview session ID (only returned by inline button mini apps¹, menu button mini + // apps², attachment menu mini apps³). + // + // Links: + // 1) https://core.telegram.org/api/bots/webapps#inline-button-mini-apps + // 2) https://core.telegram.org/api/bots/webapps#menu-button-mini-apps + // 3) https://core.telegram.org/api/bots/webapps#attachment-menu-mini-apps + // + // Use SetQueryID and GetQueryID helpers. QueryID int64 // Webview URL to open URL string } // WebViewResultURLTypeID is TL type id of WebViewResultURL. -const WebViewResultURLTypeID = 0xc14557c +const WebViewResultURLTypeID = 0x4d22ff98 // Ensuring interfaces in compile-time for WebViewResultURL. var ( @@ -57,6 +72,12 @@ func (w *WebViewResultURL) Zero() bool { if w == nil { return true } + if !(w.Flags.Zero()) { + return false + } + if !(w.Fullsize == false) { + return false + } if !(w.QueryID == 0) { return false } @@ -78,10 +99,15 @@ func (w *WebViewResultURL) String() string { // FillFrom fills WebViewResultURL from given interface. func (w *WebViewResultURL) FillFrom(from interface { - GetQueryID() (value int64) + GetFullsize() (value bool) + GetQueryID() (value int64, ok bool) GetURL() (value string) }) { - w.QueryID = from.GetQueryID() + w.Fullsize = from.GetFullsize() + if val, ok := from.GetQueryID(); ok { + w.QueryID = val + } + w.URL = from.GetURL() } @@ -108,9 +134,15 @@ func (w *WebViewResultURL) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Fullsize", + SchemaName: "fullsize", + Null: !w.Flags.Has(1), + }, { Name: "QueryID", SchemaName: "query_id", + Null: !w.Flags.Has(0), }, { Name: "URL", @@ -120,10 +152,20 @@ func (w *WebViewResultURL) TypeInfo() tdp.Type { return typ } +// SetFlags sets flags for non-zero fields. +func (w *WebViewResultURL) SetFlags() { + if !(w.Fullsize == false) { + w.Flags.Set(1) + } + if !(w.QueryID == 0) { + w.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (w *WebViewResultURL) Encode(b *bin.Buffer) error { if w == nil { - return fmt.Errorf("can't encode webViewResultUrl#c14557c as nil") + return fmt.Errorf("can't encode webViewResultUrl#4d22ff98 as nil") } b.PutID(WebViewResultURLTypeID) return w.EncodeBare(b) @@ -132,9 +174,15 @@ func (w *WebViewResultURL) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (w *WebViewResultURL) EncodeBare(b *bin.Buffer) error { if w == nil { - return fmt.Errorf("can't encode webViewResultUrl#c14557c as nil") + return fmt.Errorf("can't encode webViewResultUrl#4d22ff98 as nil") + } + w.SetFlags() + if err := w.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode webViewResultUrl#4d22ff98: field flags: %w", err) + } + if w.Flags.Has(0) { + b.PutLong(w.QueryID) } - b.PutLong(w.QueryID) b.PutString(w.URL) return nil } @@ -142,10 +190,10 @@ func (w *WebViewResultURL) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (w *WebViewResultURL) Decode(b *bin.Buffer) error { if w == nil { - return fmt.Errorf("can't decode webViewResultUrl#c14557c to nil") + return fmt.Errorf("can't decode webViewResultUrl#4d22ff98 to nil") } if err := b.ConsumeID(WebViewResultURLTypeID); err != nil { - return fmt.Errorf("unable to decode webViewResultUrl#c14557c: %w", err) + return fmt.Errorf("unable to decode webViewResultUrl#4d22ff98: %w", err) } return w.DecodeBare(b) } @@ -153,31 +201,66 @@ func (w *WebViewResultURL) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (w *WebViewResultURL) DecodeBare(b *bin.Buffer) error { if w == nil { - return fmt.Errorf("can't decode webViewResultUrl#c14557c to nil") + return fmt.Errorf("can't decode webViewResultUrl#4d22ff98 to nil") } { + if err := w.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode webViewResultUrl#4d22ff98: field flags: %w", err) + } + } + w.Fullsize = w.Flags.Has(1) + if w.Flags.Has(0) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode webViewResultUrl#c14557c: field query_id: %w", err) + return fmt.Errorf("unable to decode webViewResultUrl#4d22ff98: field query_id: %w", err) } w.QueryID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode webViewResultUrl#c14557c: field url: %w", err) + return fmt.Errorf("unable to decode webViewResultUrl#4d22ff98: field url: %w", err) } w.URL = value } return nil } -// GetQueryID returns value of QueryID field. -func (w *WebViewResultURL) GetQueryID() (value int64) { +// SetFullsize sets value of Fullsize conditional field. +func (w *WebViewResultURL) SetFullsize(value bool) { + if value { + w.Flags.Set(1) + w.Fullsize = true + } else { + w.Flags.Unset(1) + w.Fullsize = false + } +} + +// GetFullsize returns value of Fullsize conditional field. +func (w *WebViewResultURL) GetFullsize() (value bool) { if w == nil { return } - return w.QueryID + return w.Flags.Has(1) +} + +// SetQueryID sets value of QueryID conditional field. +func (w *WebViewResultURL) SetQueryID(value int64) { + w.Flags.Set(0) + w.QueryID = value +} + +// GetQueryID returns value of QueryID conditional field and +// boolean which is true if field was set. +func (w *WebViewResultURL) GetQueryID() (value int64, ok bool) { + if w == nil { + return + } + if !w.Flags.Has(0) { + return value, false + } + return w.QueryID, true } // GetURL returns value of URL field. diff --git a/vendor/github.com/gotd/td/tgerr/flood_wait.go b/vendor/github.com/gotd/td/tgerr/flood_wait.go index 5b9c7635..cfe36328 100644 --- a/vendor/github.com/gotd/td/tgerr/flood_wait.go +++ b/vendor/github.com/gotd/td/tgerr/flood_wait.go @@ -7,17 +7,25 @@ import ( "github.com/gotd/td/clock" ) +// ErrPremiumFloodWait is error type of "FLOOD_PREMIUM_WAIT" error. +const ErrPremiumFloodWait = "FLOOD_PREMIUM_WAIT" + // ErrFloodWait is error type of "FLOOD_WAIT" error. const ErrFloodWait = "FLOOD_WAIT" +// FloodWaitErrors is a list of errors that are considered as flood wait. +var FloodWaitErrors = []string{ErrFloodWait, ErrPremiumFloodWait} + // AsFloodWait returns wait duration and true boolean if err is // the "FLOOD_WAIT" error. // // Client should wait for that duration before issuing new requests with // same method. func AsFloodWait(err error) (d time.Duration, ok bool) { - if rpcErr, ok := AsType(err, ErrFloodWait); ok { - return time.Second * time.Duration(rpcErr.Argument), true + for _, e := range FloodWaitErrors { + if rpcErr, ok := AsType(err, e); ok { + return time.Second * time.Duration(rpcErr.Argument), true + } } return 0, false } diff --git a/vendor/github.com/jackc/pgx/v5/CHANGELOG.md b/vendor/github.com/jackc/pgx/v5/CHANGELOG.md index 61b4695f..a0ff9ba3 100644 --- a/vendor/github.com/jackc/pgx/v5/CHANGELOG.md +++ b/vendor/github.com/jackc/pgx/v5/CHANGELOG.md @@ -1,3 +1,25 @@ +# 5.7.1 (September 10, 2024) + +* Fix data race in tracelog.TraceLog +* Update puddle to v2.2.2. This removes the import of nanotime via linkname. +* Update golang.org/x/crypto and golang.org/x/text + +# 5.7.0 (September 7, 2024) + +* Add support for sslrootcert=system (Yann Soubeyrand) +* Add LoadTypes to load multiple types in a single SQL query (Nick Farrell) +* Add XMLCodec supports encoding + scanning XML column type like json (nickcruess-soda) +* Add MultiTrace (Stepan Rabotkin) +* Add TraceLogConfig with customizable TimeKey (stringintech) +* pgx.ErrNoRows wraps sql.ErrNoRows to aid in database/sql compatibility with native pgx functions (merlin) +* Support scanning binary formatted uint32 into string / TextScanner (jennifersp) +* Fix interval encoding to allow 0s and avoid extra spaces (Carlos Pérez-Aradros Herce) +* Update pgservicefile - fixes panic when parsing invalid file +* Better error message when reading past end of batch +* Don't print url when url.Parse returns an error (Kevin Biju) +* Fix snake case name normalization collision in RowToStructByName with db tag (nolandseigler) +* Fix: Scan and encode types with underlying types of arrays + # 5.6.0 (May 25, 2024) * Add StrictNamedArgs (Tomas Zahradnicek) diff --git a/vendor/github.com/jackc/pgx/v5/batch.go b/vendor/github.com/jackc/pgx/v5/batch.go index 3540f57f..c3c2834f 100644 --- a/vendor/github.com/jackc/pgx/v5/batch.go +++ b/vendor/github.com/jackc/pgx/v5/batch.go @@ -60,9 +60,13 @@ type Batch struct { QueuedQueries []*QueuedQuery } -// Queue queues a query to batch b. query can be an SQL query or the name of a prepared statement. -// The only pgx option argument that is supported is QueryRewriter. Queries are executed using the -// connection's DefaultQueryExecMode. +// Queue queues a query to batch b. query can be an SQL query or the name of a prepared statement. The only pgx option +// argument that is supported is QueryRewriter. Queries are executed using the connection's DefaultQueryExecMode. +// +// While query can contain multiple statements if the connection's DefaultQueryExecMode is QueryModeSimple, this should +// be avoided. QueuedQuery.Fn must not be set as it will only be called for the first query. That is, QueuedQuery.Query, +// QueuedQuery.QueryRow, and QueuedQuery.Exec must not be called. In addition, any error messages or tracing that +// include the current query may reference the wrong query. func (b *Batch) Queue(query string, arguments ...any) *QueuedQuery { qq := &QueuedQuery{ SQL: query, @@ -128,7 +132,7 @@ func (br *batchResults) Exec() (pgconn.CommandTag, error) { if !br.mrr.NextResult() { err := br.mrr.Close() if err == nil { - err = errors.New("no result") + err = errors.New("no more results in batch") } if br.conn.batchTracer != nil { br.conn.batchTracer.TraceBatchQuery(br.ctx, br.conn, TraceBatchQueryData{ @@ -180,7 +184,7 @@ func (br *batchResults) Query() (Rows, error) { if !br.mrr.NextResult() { rows.err = br.mrr.Close() if rows.err == nil { - rows.err = errors.New("no result") + rows.err = errors.New("no more results in batch") } rows.closed = true @@ -287,7 +291,10 @@ func (br *pipelineBatchResults) Exec() (pgconn.CommandTag, error) { return pgconn.CommandTag{}, br.err } - query, arguments, _ := br.nextQueryAndArgs() + query, arguments, err := br.nextQueryAndArgs() + if err != nil { + return pgconn.CommandTag{}, err + } results, err := br.pipeline.GetResults() if err != nil { @@ -330,9 +337,9 @@ func (br *pipelineBatchResults) Query() (Rows, error) { return &baseRows{err: br.err, closed: true}, br.err } - query, arguments, ok := br.nextQueryAndArgs() - if !ok { - query = "batch query" + query, arguments, err := br.nextQueryAndArgs() + if err != nil { + return &baseRows{err: err, closed: true}, err } rows := br.conn.getRows(br.ctx, query, arguments) @@ -421,13 +428,16 @@ func (br *pipelineBatchResults) earlyError() error { return br.err } -func (br *pipelineBatchResults) nextQueryAndArgs() (query string, args []any, ok bool) { - if br.b != nil && br.qqIdx < len(br.b.QueuedQueries) { - bi := br.b.QueuedQueries[br.qqIdx] - query = bi.SQL - args = bi.Arguments - ok = true - br.qqIdx++ +func (br *pipelineBatchResults) nextQueryAndArgs() (query string, args []any, err error) { + if br.b == nil { + return "", nil, errors.New("no reference to batch") } - return + + if br.qqIdx >= len(br.b.QueuedQueries) { + return "", nil, errors.New("no more results in batch") + } + + bi := br.b.QueuedQueries[br.qqIdx] + br.qqIdx++ + return bi.SQL, bi.Arguments, nil } diff --git a/vendor/github.com/jackc/pgx/v5/conn.go b/vendor/github.com/jackc/pgx/v5/conn.go index 31172145..187b3dd5 100644 --- a/vendor/github.com/jackc/pgx/v5/conn.go +++ b/vendor/github.com/jackc/pgx/v5/conn.go @@ -3,6 +3,7 @@ package pgx import ( "context" "crypto/sha256" + "database/sql" "encoding/hex" "errors" "fmt" @@ -102,13 +103,31 @@ func (ident Identifier) Sanitize() string { var ( // ErrNoRows occurs when rows are expected but none are returned. - ErrNoRows = errors.New("no rows in result set") + ErrNoRows = newProxyErr(sql.ErrNoRows, "no rows in result set") // ErrTooManyRows occurs when more rows than expected are returned. ErrTooManyRows = errors.New("too many rows in result set") ) -var errDisabledStatementCache = fmt.Errorf("cannot use QueryExecModeCacheStatement with disabled statement cache") -var errDisabledDescriptionCache = fmt.Errorf("cannot use QueryExecModeCacheDescribe with disabled description cache") +func newProxyErr(background error, msg string) error { + return &proxyError{ + msg: msg, + background: background, + } +} + +type proxyError struct { + msg string + background error +} + +func (err *proxyError) Error() string { return err.msg } + +func (err *proxyError) Unwrap() error { return err.background } + +var ( + errDisabledStatementCache = fmt.Errorf("cannot use QueryExecModeCacheStatement with disabled statement cache") + errDisabledDescriptionCache = fmt.Errorf("cannot use QueryExecModeCacheDescribe with disabled description cache") +) // Connect establishes a connection with a PostgreSQL server with a connection string. See // pgconn.Connect for details. @@ -843,7 +862,6 @@ func (c *Conn) getStatementDescription( mode QueryExecMode, sql string, ) (sd *pgconn.StatementDescription, err error) { - switch mode { case QueryExecModeCacheStatement: if c.statementCache == nil { diff --git a/vendor/github.com/jackc/pgx/v5/derived_types.go b/vendor/github.com/jackc/pgx/v5/derived_types.go new file mode 100644 index 00000000..22ab069c --- /dev/null +++ b/vendor/github.com/jackc/pgx/v5/derived_types.go @@ -0,0 +1,262 @@ +package pgx + +import ( + "context" + "fmt" + "regexp" + "strconv" + "strings" + + "github.com/jackc/pgx/v5/pgtype" +) + +/* +buildLoadDerivedTypesSQL generates the correct query for retrieving type information. + + pgVersion: the major version of the PostgreSQL server + typeNames: the names of the types to load. If nil, load all types. +*/ +func buildLoadDerivedTypesSQL(pgVersion int64, typeNames []string) string { + supportsMultirange := (pgVersion >= 14) + var typeNamesClause string + + if typeNames == nil { + // This should not occur; this will not return any types + typeNamesClause = "= ''" + } else { + typeNamesClause = "= ANY($1)" + } + parts := make([]string, 0, 10) + + // Each of the type names provided might be found in pg_class or pg_type. + // Additionally, it may or may not include a schema portion. + parts = append(parts, ` +WITH RECURSIVE +-- find the OIDs in pg_class which match one of the provided type names +selected_classes(oid,reltype) AS ( + -- this query uses the namespace search path, so will match type names without a schema prefix + SELECT pg_class.oid, pg_class.reltype + FROM pg_catalog.pg_class + LEFT JOIN pg_catalog.pg_namespace n ON n.oid = pg_class.relnamespace + WHERE pg_catalog.pg_table_is_visible(pg_class.oid) + AND relname `, typeNamesClause, ` +UNION ALL + -- this query will only match type names which include the schema prefix + SELECT pg_class.oid, pg_class.reltype + FROM pg_class + INNER JOIN pg_namespace ON (pg_class.relnamespace = pg_namespace.oid) + WHERE nspname || '.' || relname `, typeNamesClause, ` +), +selected_types(oid) AS ( + -- collect the OIDs from pg_types which correspond to the selected classes + SELECT reltype AS oid + FROM selected_classes +UNION ALL + -- as well as any other type names which match our criteria + SELECT pg_type.oid + FROM pg_type + LEFT OUTER JOIN pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) + WHERE typname `, typeNamesClause, ` + OR nspname || '.' || typname `, typeNamesClause, ` +), +-- this builds a parent/child mapping of objects, allowing us to know +-- all the child (ie: dependent) types that a parent (type) requires +-- As can be seen, there are 3 ways this can occur (the last of which +-- is due to being a composite class, where the composite fields are children) +pc(parent, child) AS ( + SELECT parent.oid, parent.typelem + FROM pg_type parent + WHERE parent.typtype = 'b' AND parent.typelem != 0 +UNION ALL + SELECT parent.oid, parent.typbasetype + FROM pg_type parent + WHERE parent.typtypmod = -1 AND parent.typbasetype != 0 +UNION ALL + SELECT pg_type.oid, atttypid + FROM pg_attribute + INNER JOIN pg_class ON (pg_class.oid = pg_attribute.attrelid) + INNER JOIN pg_type ON (pg_type.oid = pg_class.reltype) + WHERE NOT attisdropped + AND attnum > 0 +), +-- Now construct a recursive query which includes a 'depth' element. +-- This is used to ensure that the "youngest" children are registered before +-- their parents. +relationships(parent, child, depth) AS ( + SELECT DISTINCT 0::OID, selected_types.oid, 0 + FROM selected_types +UNION ALL + SELECT pg_type.oid AS parent, pg_attribute.atttypid AS child, 1 + FROM selected_classes c + inner join pg_type ON (c.reltype = pg_type.oid) + inner join pg_attribute on (c.oid = pg_attribute.attrelid) +UNION ALL + SELECT pc.parent, pc.child, relationships.depth + 1 + FROM pc + INNER JOIN relationships ON (pc.parent = relationships.child) +), +-- composite fields need to be encapsulated as a couple of arrays to provide the required information for registration +composite AS ( + SELECT pg_type.oid, ARRAY_AGG(attname ORDER BY attnum) AS attnames, ARRAY_AGG(atttypid ORDER BY ATTNUM) AS atttypids + FROM pg_attribute + INNER JOIN pg_class ON (pg_class.oid = pg_attribute.attrelid) + INNER JOIN pg_type ON (pg_type.oid = pg_class.reltype) + WHERE NOT attisdropped + AND attnum > 0 + GROUP BY pg_type.oid +) +-- Bring together this information, showing all the information which might possibly be required +-- to complete the registration, applying filters to only show the items which relate to the selected +-- types/classes. +SELECT typname, + pg_namespace.nspname, + typtype, + typbasetype, + typelem, + pg_type.oid,`) + if supportsMultirange { + parts = append(parts, ` + COALESCE(multirange.rngtypid, 0) AS rngtypid,`) + } else { + parts = append(parts, ` + 0 AS rngtypid,`) + } + parts = append(parts, ` + COALESCE(pg_range.rngsubtype, 0) AS rngsubtype, + attnames, atttypids + FROM relationships + INNER JOIN pg_type ON (pg_type.oid = relationships.child) + LEFT OUTER JOIN pg_range ON (pg_type.oid = pg_range.rngtypid)`) + if supportsMultirange { + parts = append(parts, ` + LEFT OUTER JOIN pg_range multirange ON (pg_type.oid = multirange.rngmultitypid)`) + } + + parts = append(parts, ` + LEFT OUTER JOIN composite USING (oid) + LEFT OUTER JOIN pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) + WHERE NOT (typtype = 'b' AND typelem = 0)`) + parts = append(parts, ` + GROUP BY typname, pg_namespace.nspname, typtype, typbasetype, typelem, pg_type.oid, pg_range.rngsubtype,`) + if supportsMultirange { + parts = append(parts, ` + multirange.rngtypid,`) + } + parts = append(parts, ` + attnames, atttypids + ORDER BY MAX(depth) desc, typname;`) + return strings.Join(parts, "") +} + +type derivedTypeInfo struct { + Oid, Typbasetype, Typelem, Rngsubtype, Rngtypid uint32 + TypeName, Typtype, NspName string + Attnames []string + Atttypids []uint32 +} + +// LoadTypes performs a single (complex) query, returning all the required +// information to register the named types, as well as any other types directly +// or indirectly required to complete the registration. +// The result of this call can be passed into RegisterTypes to complete the process. +func (c *Conn) LoadTypes(ctx context.Context, typeNames []string) ([]*pgtype.Type, error) { + m := c.TypeMap() + if typeNames == nil || len(typeNames) == 0 { + return nil, fmt.Errorf("No type names were supplied.") + } + + // Disregard server version errors. This will result in + // the SQL not support recent structures such as multirange + serverVersion, _ := serverVersion(c) + sql := buildLoadDerivedTypesSQL(serverVersion, typeNames) + var rows Rows + var err error + if typeNames == nil { + rows, err = c.Query(ctx, sql, QueryExecModeSimpleProtocol) + } else { + rows, err = c.Query(ctx, sql, QueryExecModeSimpleProtocol, typeNames) + } + if err != nil { + return nil, fmt.Errorf("While generating load types query: %w", err) + } + defer rows.Close() + result := make([]*pgtype.Type, 0, 100) + for rows.Next() { + ti := derivedTypeInfo{} + err = rows.Scan(&ti.TypeName, &ti.NspName, &ti.Typtype, &ti.Typbasetype, &ti.Typelem, &ti.Oid, &ti.Rngtypid, &ti.Rngsubtype, &ti.Attnames, &ti.Atttypids) + if err != nil { + return nil, fmt.Errorf("While scanning type information: %w", err) + } + var type_ *pgtype.Type + switch ti.Typtype { + case "b": // array + dt, ok := m.TypeForOID(ti.Typelem) + if !ok { + return nil, fmt.Errorf("Array element OID %v not registered while loading pgtype %q", ti.Typelem, ti.TypeName) + } + type_ = &pgtype.Type{Name: ti.TypeName, OID: ti.Oid, Codec: &pgtype.ArrayCodec{ElementType: dt}} + case "c": // composite + var fields []pgtype.CompositeCodecField + for i, fieldName := range ti.Attnames { + dt, ok := m.TypeForOID(ti.Atttypids[i]) + if !ok { + return nil, fmt.Errorf("Unknown field for composite type %q: field %q (OID %v) is not already registered.", ti.TypeName, fieldName, ti.Atttypids[i]) + } + fields = append(fields, pgtype.CompositeCodecField{Name: fieldName, Type: dt}) + } + + type_ = &pgtype.Type{Name: ti.TypeName, OID: ti.Oid, Codec: &pgtype.CompositeCodec{Fields: fields}} + case "d": // domain + dt, ok := m.TypeForOID(ti.Typbasetype) + if !ok { + return nil, fmt.Errorf("Domain base type OID %v was not already registered, needed for %q", ti.Typbasetype, ti.TypeName) + } + + type_ = &pgtype.Type{Name: ti.TypeName, OID: ti.Oid, Codec: dt.Codec} + case "e": // enum + type_ = &pgtype.Type{Name: ti.TypeName, OID: ti.Oid, Codec: &pgtype.EnumCodec{}} + case "r": // range + dt, ok := m.TypeForOID(ti.Rngsubtype) + if !ok { + return nil, fmt.Errorf("Range element OID %v was not already registered, needed for %q", ti.Rngsubtype, ti.TypeName) + } + + type_ = &pgtype.Type{Name: ti.TypeName, OID: ti.Oid, Codec: &pgtype.RangeCodec{ElementType: dt}} + case "m": // multirange + dt, ok := m.TypeForOID(ti.Rngtypid) + if !ok { + return nil, fmt.Errorf("Multirange element OID %v was not already registered, needed for %q", ti.Rngtypid, ti.TypeName) + } + + type_ = &pgtype.Type{Name: ti.TypeName, OID: ti.Oid, Codec: &pgtype.MultirangeCodec{ElementType: dt}} + default: + return nil, fmt.Errorf("Unknown typtype %q was found while registering %q", ti.Typtype, ti.TypeName) + } + if type_ != nil { + m.RegisterType(type_) + if ti.NspName != "" { + nspType := &pgtype.Type{Name: ti.NspName + "." + type_.Name, OID: type_.OID, Codec: type_.Codec} + m.RegisterType(nspType) + result = append(result, nspType) + } + result = append(result, type_) + } + } + return result, nil +} + +// serverVersion returns the postgresql server version. +func serverVersion(c *Conn) (int64, error) { + serverVersionStr := c.PgConn().ParameterStatus("server_version") + serverVersionStr = regexp.MustCompile(`^[0-9]+`).FindString(serverVersionStr) + // if not PostgreSQL do nothing + if serverVersionStr == "" { + return 0, fmt.Errorf("Cannot identify server version in %q", serverVersionStr) + } + + version, err := strconv.ParseInt(serverVersionStr, 10, 64) + if err != nil { + return 0, fmt.Errorf("postgres version parsing failed: %w", err) + } + return version, nil +} diff --git a/vendor/github.com/jackc/pgx/v5/doc.go b/vendor/github.com/jackc/pgx/v5/doc.go index bc0391dd..0e91d64e 100644 --- a/vendor/github.com/jackc/pgx/v5/doc.go +++ b/vendor/github.com/jackc/pgx/v5/doc.go @@ -175,7 +175,7 @@ notification is received or the context is canceled. Tracing and Logging -pgx supports tracing by setting ConnConfig.Tracer. +pgx supports tracing by setting ConnConfig.Tracer. To combine several tracers you can use the multitracer.Tracer. In addition, the tracelog package provides the TraceLog type which lets a traditional logger act as a Tracer. diff --git a/vendor/github.com/jackc/pgx/v5/pgconn/config.go b/vendor/github.com/jackc/pgx/v5/pgconn/config.go index 598917f5..6a198e67 100644 --- a/vendor/github.com/jackc/pgx/v5/pgconn/config.go +++ b/vendor/github.com/jackc/pgx/v5/pgconn/config.go @@ -467,14 +467,17 @@ func parseEnvSettings() map[string]string { func parseURLSettings(connString string) (map[string]string, error) { settings := make(map[string]string) - url, err := url.Parse(connString) + parsedURL, err := url.Parse(connString) if err != nil { + if urlErr := new(url.Error); errors.As(err, &urlErr) { + return nil, urlErr.Err + } return nil, err } - if url.User != nil { - settings["user"] = url.User.Username() - if password, present := url.User.Password(); present { + if parsedURL.User != nil { + settings["user"] = parsedURL.User.Username() + if password, present := parsedURL.User.Password(); present { settings["password"] = password } } @@ -482,7 +485,7 @@ func parseURLSettings(connString string) (map[string]string, error) { // Handle multiple host:port's in url.Host by splitting them into host,host,host and port,port,port. var hosts []string var ports []string - for _, host := range strings.Split(url.Host, ",") { + for _, host := range strings.Split(parsedURL.Host, ",") { if host == "" { continue } @@ -508,7 +511,7 @@ func parseURLSettings(connString string) (map[string]string, error) { settings["port"] = strings.Join(ports, ",") } - database := strings.TrimLeft(url.Path, "/") + database := strings.TrimLeft(parsedURL.Path, "/") if database != "" { settings["database"] = database } @@ -517,7 +520,7 @@ func parseURLSettings(connString string) (map[string]string, error) { "dbname": "database", } - for k, v := range url.Query() { + for k, v := range parsedURL.Query() { if k2, present := nameMap[k]; present { k = k2 } @@ -654,6 +657,36 @@ func configTLS(settings map[string]string, thisHost string, parseConfigOptions P tlsConfig := &tls.Config{} + if sslrootcert != "" { + var caCertPool *x509.CertPool + + if sslrootcert == "system" { + var err error + + caCertPool, err = x509.SystemCertPool() + if err != nil { + return nil, fmt.Errorf("unable to load system certificate pool: %w", err) + } + + sslmode = "verify-full" + } else { + caCertPool = x509.NewCertPool() + + caPath := sslrootcert + caCert, err := os.ReadFile(caPath) + if err != nil { + return nil, fmt.Errorf("unable to read CA file: %w", err) + } + + if !caCertPool.AppendCertsFromPEM(caCert) { + return nil, errors.New("unable to add CA to cert pool") + } + } + + tlsConfig.RootCAs = caCertPool + tlsConfig.ClientCAs = caCertPool + } + switch sslmode { case "disable": return []*tls.Config{nil}, nil @@ -711,23 +744,6 @@ func configTLS(settings map[string]string, thisHost string, parseConfigOptions P return nil, errors.New("sslmode is invalid") } - if sslrootcert != "" { - caCertPool := x509.NewCertPool() - - caPath := sslrootcert - caCert, err := os.ReadFile(caPath) - if err != nil { - return nil, fmt.Errorf("unable to read CA file: %w", err) - } - - if !caCertPool.AppendCertsFromPEM(caCert) { - return nil, errors.New("unable to add CA to cert pool") - } - - tlsConfig.RootCAs = caCertPool - tlsConfig.ClientCAs = caCertPool - } - if (sslcert != "" && sslkey == "") || (sslcert == "" && sslkey != "") { return nil, errors.New(`both "sslcert" and "sslkey" are required`) } diff --git a/vendor/github.com/jackc/pgx/v5/pgtype/doc.go b/vendor/github.com/jackc/pgx/v5/pgtype/doc.go index d56c1dc7..7687ea8f 100644 --- a/vendor/github.com/jackc/pgx/v5/pgtype/doc.go +++ b/vendor/github.com/jackc/pgx/v5/pgtype/doc.go @@ -53,6 +53,9 @@ similar fashion to database/sql. The second is to use a pointer to a pointer. return err } +When using nullable pgtype types as parameters for queries, one has to remember +to explicitly set their Valid field to true, otherwise the parameter's value will be NULL. + JSON Support pgtype automatically marshals and unmarshals data from json and jsonb PostgreSQL types. diff --git a/vendor/github.com/jackc/pgx/v5/pgtype/interval.go b/vendor/github.com/jackc/pgx/v5/pgtype/interval.go index 06703d4d..4b511629 100644 --- a/vendor/github.com/jackc/pgx/v5/pgtype/interval.go +++ b/vendor/github.com/jackc/pgx/v5/pgtype/interval.go @@ -132,29 +132,25 @@ func (encodePlanIntervalCodecText) Encode(value any, buf []byte) (newBuf []byte, if interval.Days != 0 { buf = append(buf, strconv.FormatInt(int64(interval.Days), 10)...) - buf = append(buf, " day"...) + buf = append(buf, " day "...) } - if interval.Microseconds != 0 { - buf = append(buf, " "...) + absMicroseconds := interval.Microseconds + if absMicroseconds < 0 { + absMicroseconds = -absMicroseconds + buf = append(buf, '-') + } - absMicroseconds := interval.Microseconds - if absMicroseconds < 0 { - absMicroseconds = -absMicroseconds - buf = append(buf, '-') - } + hours := absMicroseconds / microsecondsPerHour + minutes := (absMicroseconds % microsecondsPerHour) / microsecondsPerMinute + seconds := (absMicroseconds % microsecondsPerMinute) / microsecondsPerSecond - hours := absMicroseconds / microsecondsPerHour - minutes := (absMicroseconds % microsecondsPerHour) / microsecondsPerMinute - seconds := (absMicroseconds % microsecondsPerMinute) / microsecondsPerSecond + timeStr := fmt.Sprintf("%02d:%02d:%02d", hours, minutes, seconds) + buf = append(buf, timeStr...) - timeStr := fmt.Sprintf("%02d:%02d:%02d", hours, minutes, seconds) - buf = append(buf, timeStr...) - - microseconds := absMicroseconds % microsecondsPerSecond - if microseconds != 0 { - buf = append(buf, fmt.Sprintf(".%06d", microseconds)...) - } + microseconds := absMicroseconds % microsecondsPerSecond + if microseconds != 0 { + buf = append(buf, fmt.Sprintf(".%06d", microseconds)...) } return buf, nil diff --git a/vendor/github.com/jackc/pgx/v5/pgtype/json.go b/vendor/github.com/jackc/pgx/v5/pgtype/json.go index e71dcb9b..c2aa0d3b 100644 --- a/vendor/github.com/jackc/pgx/v5/pgtype/json.go +++ b/vendor/github.com/jackc/pgx/v5/pgtype/json.go @@ -37,7 +37,7 @@ func (c *JSONCodec) PlanEncode(m *Map, oid uint32, format int16, value any) Enco // // https://github.com/jackc/pgx/issues/1430 // - // Check for driver.Valuer must come before json.Marshaler so that it is guaranteed to beused + // Check for driver.Valuer must come before json.Marshaler so that it is guaranteed to be used // when both are implemented https://github.com/jackc/pgx/issues/1805 case driver.Valuer: return &encodePlanDriverValuer{m: m, oid: oid, formatCode: format} @@ -177,13 +177,6 @@ func (scanPlanJSONToByteSlice) Scan(src []byte, dst any) error { return nil } -type scanPlanJSONToBytesScanner struct{} - -func (scanPlanJSONToBytesScanner) Scan(src []byte, dst any) error { - scanner := (dst).(BytesScanner) - return scanner.ScanBytes(src) -} - type scanPlanJSONToJSONUnmarshal struct { unmarshal func(data []byte, v any) error } diff --git a/vendor/github.com/jackc/pgx/v5/pgtype/pgtype.go b/vendor/github.com/jackc/pgx/v5/pgtype/pgtype.go index 40829568..bdd9f05c 100644 --- a/vendor/github.com/jackc/pgx/v5/pgtype/pgtype.go +++ b/vendor/github.com/jackc/pgx/v5/pgtype/pgtype.go @@ -26,6 +26,8 @@ const ( XIDOID = 28 CIDOID = 29 JSONOID = 114 + XMLOID = 142 + XMLArrayOID = 143 JSONArrayOID = 199 PointOID = 600 LsegOID = 601 @@ -214,6 +216,15 @@ type Map struct { TryWrapScanPlanFuncs []TryWrapScanPlanFunc } +// Copy returns a new Map containing the same registered types. +func (m *Map) Copy() *Map { + newMap := NewMap() + for _, type_ := range m.oidToType { + newMap.RegisterType(type_) + } + return newMap +} + func NewMap() *Map { defaultMapInitOnce.Do(initDefaultMap) @@ -248,6 +259,13 @@ func NewMap() *Map { } } +// RegisterTypes registers multiple data types in the sequence they are provided. +func (m *Map) RegisterTypes(types []*Type) { + for _, t := range types { + m.RegisterType(t) + } +} + // RegisterType registers a data type with the Map. t must not be mutated after it is registered. func (m *Map) RegisterType(t *Type) { m.oidToType[t.OID] = t @@ -555,17 +573,24 @@ func TryFindUnderlyingTypeScanPlan(dst any) (plan WrappedScanPlanNextSetter, nex elemValue = dstValue.Elem() } nextDstType := elemKindToPointerTypes[elemValue.Kind()] - if nextDstType == nil && elemValue.Kind() == reflect.Slice { - if elemValue.Type().Elem().Kind() == reflect.Uint8 { - var v *[]byte - nextDstType = reflect.TypeOf(v) + if nextDstType == nil { + if elemValue.Kind() == reflect.Slice { + if elemValue.Type().Elem().Kind() == reflect.Uint8 { + var v *[]byte + nextDstType = reflect.TypeOf(v) + } + } + + // Get underlying type of any array. + // https://github.com/jackc/pgx/issues/2107 + if elemValue.Kind() == reflect.Array { + nextDstType = reflect.PointerTo(reflect.ArrayOf(elemValue.Len(), elemValue.Type().Elem())) } } if nextDstType != nil && dstValue.Type() != nextDstType && dstValue.CanConvert(nextDstType) { return &underlyingTypeScanPlan{dstType: dstValue.Type(), nextDstType: nextDstType}, dstValue.Convert(nextDstType).Interface(), true } - } return nil, nil, false @@ -1405,6 +1430,15 @@ func TryWrapFindUnderlyingTypeEncodePlan(value any) (plan WrappedEncodePlanNextS return &underlyingTypeEncodePlan{nextValueType: byteSliceType}, refValue.Convert(byteSliceType).Interface(), true } + // Get underlying type of any array. + // https://github.com/jackc/pgx/issues/2107 + if refValue.Kind() == reflect.Array { + underlyingArrayType := reflect.ArrayOf(refValue.Len(), refValue.Type().Elem()) + if refValue.Type() != underlyingArrayType { + return &underlyingTypeEncodePlan{nextValueType: underlyingArrayType}, refValue.Convert(underlyingArrayType).Interface(), true + } + } + return nil, nil, false } diff --git a/vendor/github.com/jackc/pgx/v5/pgtype/pgtype_default.go b/vendor/github.com/jackc/pgx/v5/pgtype/pgtype_default.go index 9525f37c..c8125731 100644 --- a/vendor/github.com/jackc/pgx/v5/pgtype/pgtype_default.go +++ b/vendor/github.com/jackc/pgx/v5/pgtype/pgtype_default.go @@ -2,6 +2,7 @@ package pgtype import ( "encoding/json" + "encoding/xml" "net" "net/netip" "reflect" @@ -89,6 +90,7 @@ func initDefaultMap() { defaultMap.RegisterType(&Type{Name: "varbit", OID: VarbitOID, Codec: BitsCodec{}}) defaultMap.RegisterType(&Type{Name: "varchar", OID: VarcharOID, Codec: TextCodec{}}) defaultMap.RegisterType(&Type{Name: "xid", OID: XIDOID, Codec: Uint32Codec{}}) + defaultMap.RegisterType(&Type{Name: "xml", OID: XMLOID, Codec: &XMLCodec{Marshal: xml.Marshal, Unmarshal: xml.Unmarshal}}) // Range types defaultMap.RegisterType(&Type{Name: "daterange", OID: DaterangeOID, Codec: &RangeCodec{ElementType: defaultMap.oidToType[DateOID]}}) @@ -153,6 +155,7 @@ func initDefaultMap() { defaultMap.RegisterType(&Type{Name: "_varbit", OID: VarbitArrayOID, Codec: &ArrayCodec{ElementType: defaultMap.oidToType[VarbitOID]}}) defaultMap.RegisterType(&Type{Name: "_varchar", OID: VarcharArrayOID, Codec: &ArrayCodec{ElementType: defaultMap.oidToType[VarcharOID]}}) defaultMap.RegisterType(&Type{Name: "_xid", OID: XIDArrayOID, Codec: &ArrayCodec{ElementType: defaultMap.oidToType[XIDOID]}}) + defaultMap.RegisterType(&Type{Name: "_xml", OID: XMLArrayOID, Codec: &ArrayCodec{ElementType: defaultMap.oidToType[XMLOID]}}) // Integer types that directly map to a PostgreSQL type registerDefaultPgTypeVariants[int16](defaultMap, "int2") diff --git a/vendor/github.com/jackc/pgx/v5/pgtype/time.go b/vendor/github.com/jackc/pgx/v5/pgtype/time.go index 61a3abdf..f8fd9489 100644 --- a/vendor/github.com/jackc/pgx/v5/pgtype/time.go +++ b/vendor/github.com/jackc/pgx/v5/pgtype/time.go @@ -19,9 +19,11 @@ type TimeValuer interface { // Time represents the PostgreSQL time type. The PostgreSQL time is a time of day without time zone. // -// Time is represented as the number of microseconds since midnight in the same way that PostgreSQL does. Other time -// and date types in pgtype can use time.Time as the underlying representation. However, pgtype.Time type cannot due -// to needing to handle 24:00:00. time.Time converts that to 00:00:00 on the following day. +// Time is represented as the number of microseconds since midnight in the same way that PostgreSQL does. Other time and +// date types in pgtype can use time.Time as the underlying representation. However, pgtype.Time type cannot due to +// needing to handle 24:00:00. time.Time converts that to 00:00:00 on the following day. +// +// The time with time zone type is not supported. Use of time with time zone is discouraged by the PostgreSQL documentation. type Time struct { Microseconds int64 // Number of microseconds since midnight Valid bool diff --git a/vendor/github.com/jackc/pgx/v5/pgtype/uint32.go b/vendor/github.com/jackc/pgx/v5/pgtype/uint32.go index 098c516c..f2b2fa6d 100644 --- a/vendor/github.com/jackc/pgx/v5/pgtype/uint32.go +++ b/vendor/github.com/jackc/pgx/v5/pgtype/uint32.go @@ -205,6 +205,8 @@ func (Uint32Codec) PlanScan(m *Map, oid uint32, format int16, target any) ScanPl return scanPlanBinaryUint32ToUint32{} case Uint32Scanner: return scanPlanBinaryUint32ToUint32Scanner{} + case TextScanner: + return scanPlanBinaryUint32ToTextScanner{} } case TextFormatCode: switch target.(type) { @@ -282,6 +284,26 @@ func (scanPlanBinaryUint32ToUint32Scanner) Scan(src []byte, dst any) error { return s.ScanUint32(Uint32{Uint32: n, Valid: true}) } +type scanPlanBinaryUint32ToTextScanner struct{} + +func (scanPlanBinaryUint32ToTextScanner) Scan(src []byte, dst any) error { + s, ok := (dst).(TextScanner) + if !ok { + return ErrScanTargetTypeChanged + } + + if src == nil { + return s.ScanText(Text{}) + } + + if len(src) != 4 { + return fmt.Errorf("invalid length for uint32: %v", len(src)) + } + + n := uint64(binary.BigEndian.Uint32(src)) + return s.ScanText(Text{String: strconv.FormatUint(n, 10), Valid: true}) +} + type scanPlanTextAnyToUint32Scanner struct{} func (scanPlanTextAnyToUint32Scanner) Scan(src []byte, dst any) error { diff --git a/vendor/github.com/jackc/pgx/v5/pgtype/xml.go b/vendor/github.com/jackc/pgx/v5/pgtype/xml.go new file mode 100644 index 00000000..fb4c49ad --- /dev/null +++ b/vendor/github.com/jackc/pgx/v5/pgtype/xml.go @@ -0,0 +1,198 @@ +package pgtype + +import ( + "database/sql" + "database/sql/driver" + "encoding/xml" + "fmt" + "reflect" +) + +type XMLCodec struct { + Marshal func(v any) ([]byte, error) + Unmarshal func(data []byte, v any) error +} + +func (*XMLCodec) FormatSupported(format int16) bool { + return format == TextFormatCode || format == BinaryFormatCode +} + +func (*XMLCodec) PreferredFormat() int16 { + return TextFormatCode +} + +func (c *XMLCodec) PlanEncode(m *Map, oid uint32, format int16, value any) EncodePlan { + switch value.(type) { + case string: + return encodePlanXMLCodecEitherFormatString{} + case []byte: + return encodePlanXMLCodecEitherFormatByteSlice{} + + // Cannot rely on driver.Valuer being handled later because anything can be marshalled. + // + // https://github.com/jackc/pgx/issues/1430 + // + // Check for driver.Valuer must come before xml.Marshaler so that it is guaranteed to be used + // when both are implemented https://github.com/jackc/pgx/issues/1805 + case driver.Valuer: + return &encodePlanDriverValuer{m: m, oid: oid, formatCode: format} + + // Must come before trying wrap encode plans because a pointer to a struct may be unwrapped to a struct that can be + // marshalled. + // + // https://github.com/jackc/pgx/issues/1681 + case xml.Marshaler: + return &encodePlanXMLCodecEitherFormatMarshal{ + marshal: c.Marshal, + } + } + + // Because anything can be marshalled the normal wrapping in Map.PlanScan doesn't get a chance to run. So try the + // appropriate wrappers here. + for _, f := range []TryWrapEncodePlanFunc{ + TryWrapDerefPointerEncodePlan, + TryWrapFindUnderlyingTypeEncodePlan, + } { + if wrapperPlan, nextValue, ok := f(value); ok { + if nextPlan := c.PlanEncode(m, oid, format, nextValue); nextPlan != nil { + wrapperPlan.SetNext(nextPlan) + return wrapperPlan + } + } + } + + return &encodePlanXMLCodecEitherFormatMarshal{ + marshal: c.Marshal, + } +} + +type encodePlanXMLCodecEitherFormatString struct{} + +func (encodePlanXMLCodecEitherFormatString) Encode(value any, buf []byte) (newBuf []byte, err error) { + xmlString := value.(string) + buf = append(buf, xmlString...) + return buf, nil +} + +type encodePlanXMLCodecEitherFormatByteSlice struct{} + +func (encodePlanXMLCodecEitherFormatByteSlice) Encode(value any, buf []byte) (newBuf []byte, err error) { + xmlBytes := value.([]byte) + if xmlBytes == nil { + return nil, nil + } + + buf = append(buf, xmlBytes...) + return buf, nil +} + +type encodePlanXMLCodecEitherFormatMarshal struct { + marshal func(v any) ([]byte, error) +} + +func (e *encodePlanXMLCodecEitherFormatMarshal) Encode(value any, buf []byte) (newBuf []byte, err error) { + xmlBytes, err := e.marshal(value) + if err != nil { + return nil, err + } + + buf = append(buf, xmlBytes...) + return buf, nil +} + +func (c *XMLCodec) PlanScan(m *Map, oid uint32, format int16, target any) ScanPlan { + switch target.(type) { + case *string: + return scanPlanAnyToString{} + + case **string: + // This is to fix **string scanning. It seems wrong to special case **string, but it's not clear what a better + // solution would be. + // + // https://github.com/jackc/pgx/issues/1470 -- **string + // https://github.com/jackc/pgx/issues/1691 -- ** anything else + + if wrapperPlan, nextDst, ok := TryPointerPointerScanPlan(target); ok { + if nextPlan := m.planScan(oid, format, nextDst); nextPlan != nil { + if _, failed := nextPlan.(*scanPlanFail); !failed { + wrapperPlan.SetNext(nextPlan) + return wrapperPlan + } + } + } + + case *[]byte: + return scanPlanXMLToByteSlice{} + case BytesScanner: + return scanPlanBinaryBytesToBytesScanner{} + + // Cannot rely on sql.Scanner being handled later because scanPlanXMLToXMLUnmarshal will take precedence. + // + // https://github.com/jackc/pgx/issues/1418 + case sql.Scanner: + return &scanPlanSQLScanner{formatCode: format} + } + + return &scanPlanXMLToXMLUnmarshal{ + unmarshal: c.Unmarshal, + } +} + +type scanPlanXMLToByteSlice struct{} + +func (scanPlanXMLToByteSlice) Scan(src []byte, dst any) error { + dstBuf := dst.(*[]byte) + if src == nil { + *dstBuf = nil + return nil + } + + *dstBuf = make([]byte, len(src)) + copy(*dstBuf, src) + return nil +} + +type scanPlanXMLToXMLUnmarshal struct { + unmarshal func(data []byte, v any) error +} + +func (s *scanPlanXMLToXMLUnmarshal) Scan(src []byte, dst any) error { + if src == nil { + dstValue := reflect.ValueOf(dst) + if dstValue.Kind() == reflect.Ptr { + el := dstValue.Elem() + switch el.Kind() { + case reflect.Ptr, reflect.Slice, reflect.Map, reflect.Interface, reflect.Struct: + el.Set(reflect.Zero(el.Type())) + return nil + } + } + + return fmt.Errorf("cannot scan NULL into %T", dst) + } + + elem := reflect.ValueOf(dst).Elem() + elem.Set(reflect.Zero(elem.Type())) + + return s.unmarshal(src, dst) +} + +func (c *XMLCodec) DecodeDatabaseSQLValue(m *Map, oid uint32, format int16, src []byte) (driver.Value, error) { + if src == nil { + return nil, nil + } + + dstBuf := make([]byte, len(src)) + copy(dstBuf, src) + return dstBuf, nil +} + +func (c *XMLCodec) DecodeValue(m *Map, oid uint32, format int16, src []byte) (any, error) { + if src == nil { + return nil, nil + } + + var dst any + err := c.Unmarshal(src, &dst) + return dst, err +} diff --git a/vendor/github.com/jackc/pgx/v5/pgxpool/tx.go b/vendor/github.com/jackc/pgx/v5/pgxpool/tx.go index 74df8593..b49e7f4d 100644 --- a/vendor/github.com/jackc/pgx/v5/pgxpool/tx.go +++ b/vendor/github.com/jackc/pgx/v5/pgxpool/tx.go @@ -18,9 +18,10 @@ func (tx *Tx) Begin(ctx context.Context) (pgx.Tx, error) { return tx.t.Begin(ctx) } -// Commit commits the transaction and returns the associated connection back to the Pool. Commit will return ErrTxClosed -// if the Tx is already closed, but is otherwise safe to call multiple times. If the commit fails with a rollback status -// (e.g. the transaction was already in a broken state) then ErrTxCommitRollback will be returned. +// Commit commits the transaction and returns the associated connection back to the Pool. Commit will return an error +// where errors.Is(ErrTxClosed) is true if the Tx is already closed, but is otherwise safe to call multiple times. If +// the commit fails with a rollback status (e.g. the transaction was already in a broken state) then ErrTxCommitRollback +// will be returned. func (tx *Tx) Commit(ctx context.Context) error { err := tx.t.Commit(ctx) if tx.c != nil { @@ -30,9 +31,9 @@ func (tx *Tx) Commit(ctx context.Context) error { return err } -// Rollback rolls back the transaction and returns the associated connection back to the Pool. Rollback will return ErrTxClosed -// if the Tx is already closed, but is otherwise safe to call multiple times. Hence, defer tx.Rollback() is safe even if -// tx.Commit() will be called first in a non-error condition. +// Rollback rolls back the transaction and returns the associated connection back to the Pool. Rollback will return +// where an error where errors.Is(ErrTxClosed) is true if the Tx is already closed, but is otherwise safe to call +// multiple times. Hence, defer tx.Rollback() is safe even if tx.Commit() will be called first in a non-error condition. func (tx *Tx) Rollback(ctx context.Context) error { err := tx.t.Rollback(ctx) if tx.c != nil { diff --git a/vendor/github.com/jackc/pgx/v5/rows.go b/vendor/github.com/jackc/pgx/v5/rows.go index d4f7a901..f23625d4 100644 --- a/vendor/github.com/jackc/pgx/v5/rows.go +++ b/vendor/github.com/jackc/pgx/v5/rows.go @@ -797,7 +797,7 @@ func computeNamedStructFields( if !dbTagPresent { colName = sf.Name } - fpos := fieldPosByName(fldDescs, colName) + fpos := fieldPosByName(fldDescs, colName, !dbTagPresent) if fpos == -1 { if missingField == "" { missingField = colName @@ -816,16 +816,21 @@ func computeNamedStructFields( const structTagKey = "db" -func fieldPosByName(fldDescs []pgconn.FieldDescription, field string) (i int) { +func fieldPosByName(fldDescs []pgconn.FieldDescription, field string, normalize bool) (i int) { i = -1 - for i, desc := range fldDescs { - // Snake case support. + if normalize { field = strings.ReplaceAll(field, "_", "") - descName := strings.ReplaceAll(desc.Name, "_", "") - - if strings.EqualFold(descName, field) { - return i + } + for i, desc := range fldDescs { + if normalize { + if strings.EqualFold(strings.ReplaceAll(desc.Name, "_", ""), field) { + return i + } + } else { + if desc.Name == field { + return i + } } } return diff --git a/vendor/github.com/jackc/pgx/v5/stdlib/sql.go b/vendor/github.com/jackc/pgx/v5/stdlib/sql.go index 29cd3fbb..c1d00ab4 100644 --- a/vendor/github.com/jackc/pgx/v5/stdlib/sql.go +++ b/vendor/github.com/jackc/pgx/v5/stdlib/sql.go @@ -75,6 +75,7 @@ import ( "math" "math/rand" "reflect" + "slices" "strconv" "strings" "sync" @@ -98,7 +99,7 @@ func init() { // if pgx driver was already registered by different pgx major version then we // skip registration under the default name. - if !contains(sql.Drivers(), "pgx") { + if !slices.Contains(sql.Drivers(), "pgx") { sql.Register("pgx", pgxDriver) } sql.Register("pgx/v5", pgxDriver) @@ -120,17 +121,6 @@ func init() { } } -// TODO replace by slices.Contains when experimental package will be merged to stdlib -// https://pkg.go.dev/golang.org/x/exp/slices#Contains -func contains(list []string, y string) bool { - for _, x := range list { - if x == y { - return true - } - } - return false -} - // OptionOpenDB options for configuring the driver when opening a new db pool. type OptionOpenDB func(*connector) @@ -805,6 +795,16 @@ func (r *Rows) Next(dest []driver.Value) error { } return d.Value() } + case pgtype.XMLOID: + var d []byte + scanPlan := m.PlanScan(dataTypeOID, format, &d) + r.valueFuncs[i] = func(src []byte) (driver.Value, error) { + err := scanPlan.Scan(src, &d) + if err != nil { + return nil, err + } + return d, nil + } default: var d string scanPlan := m.PlanScan(dataTypeOID, format, &d) diff --git a/vendor/github.com/jackc/puddle/v2/CHANGELOG.md b/vendor/github.com/jackc/puddle/v2/CHANGELOG.md index a15991c5..d0d202c7 100644 --- a/vendor/github.com/jackc/puddle/v2/CHANGELOG.md +++ b/vendor/github.com/jackc/puddle/v2/CHANGELOG.md @@ -1,3 +1,8 @@ +# 2.2.2 (September 10, 2024) + +* Add empty acquire time to stats (Maxim Ivanov) +* Stop importing nanotime from runtime via linkname (maypok86) + # 2.2.1 (July 15, 2023) * Fix: CreateResource cannot overflow pool. This changes documented behavior of CreateResource. Previously, diff --git a/vendor/github.com/jackc/puddle/v2/README.md b/vendor/github.com/jackc/puddle/v2/README.md index 0ad07ec4..fa82a9d4 100644 --- a/vendor/github.com/jackc/puddle/v2/README.md +++ b/vendor/github.com/jackc/puddle/v2/README.md @@ -1,4 +1,4 @@ -[![](https://godoc.org/github.com/jackc/puddle?status.svg)](https://godoc.org/github.com/jackc/puddle) +[![Go Reference](https://pkg.go.dev/badge/github.com/jackc/puddle/v2.svg)](https://pkg.go.dev/github.com/jackc/puddle/v2) ![Build Status](https://github.com/jackc/puddle/actions/workflows/ci.yml/badge.svg) # Puddle diff --git a/vendor/github.com/jackc/puddle/v2/nanotime.go b/vendor/github.com/jackc/puddle/v2/nanotime.go new file mode 100644 index 00000000..8a5351a0 --- /dev/null +++ b/vendor/github.com/jackc/puddle/v2/nanotime.go @@ -0,0 +1,16 @@ +package puddle + +import "time" + +// nanotime returns the time in nanoseconds since process start. +// +// This approach, described at +// https://github.com/golang/go/issues/61765#issuecomment-1672090302, +// is fast, monotonic, and portable, and avoids the previous +// dependence on runtime.nanotime using the (unsafe) linkname hack. +// In particular, time.Since does less work than time.Now. +func nanotime() int64 { + return time.Since(globalStart).Nanoseconds() +} + +var globalStart = time.Now() diff --git a/vendor/github.com/jackc/puddle/v2/nanotime_time.go b/vendor/github.com/jackc/puddle/v2/nanotime_time.go deleted file mode 100644 index f8e75938..00000000 --- a/vendor/github.com/jackc/puddle/v2/nanotime_time.go +++ /dev/null @@ -1,13 +0,0 @@ -//go:build purego || appengine || js - -// This file contains the safe implementation of nanotime using time.Now(). - -package puddle - -import ( - "time" -) - -func nanotime() int64 { - return time.Now().UnixNano() -} diff --git a/vendor/github.com/jackc/puddle/v2/nanotime_unsafe.go b/vendor/github.com/jackc/puddle/v2/nanotime_unsafe.go deleted file mode 100644 index fc3b8a25..00000000 --- a/vendor/github.com/jackc/puddle/v2/nanotime_unsafe.go +++ /dev/null @@ -1,12 +0,0 @@ -//go:build !purego && !appengine && !js - -// This file contains the implementation of nanotime using runtime.nanotime. - -package puddle - -import "unsafe" - -var _ = unsafe.Sizeof(0) - -//go:linkname nanotime runtime.nanotime -func nanotime() int64 diff --git a/vendor/github.com/jackc/puddle/v2/pool.go b/vendor/github.com/jackc/puddle/v2/pool.go index c8edc0fb..c411d2f6 100644 --- a/vendor/github.com/jackc/puddle/v2/pool.go +++ b/vendor/github.com/jackc/puddle/v2/pool.go @@ -139,6 +139,7 @@ type Pool[T any] struct { acquireCount int64 acquireDuration time.Duration emptyAcquireCount int64 + emptyAcquireWaitTime time.Duration canceledAcquireCount atomic.Int64 resetCount int @@ -154,7 +155,7 @@ type Config[T any] struct { MaxSize int32 } -// NewPool creates a new pool. Panics if maxSize is less than 1. +// NewPool creates a new pool. Returns an error iff MaxSize is less than 1. func NewPool[T any](config *Config[T]) (*Pool[T], error) { if config.MaxSize < 1 { return nil, errors.New("MaxSize must be >= 1") @@ -202,6 +203,7 @@ type Stat struct { acquireCount int64 acquireDuration time.Duration emptyAcquireCount int64 + emptyAcquireWaitTime time.Duration canceledAcquireCount int64 } @@ -251,6 +253,13 @@ func (s *Stat) EmptyAcquireCount() int64 { return s.emptyAcquireCount } +// EmptyAcquireWaitTime returns the cumulative time waited for successful acquires +// from the pool for a resource to be released or constructed because the pool was +// empty. +func (s *Stat) EmptyAcquireWaitTime() time.Duration { + return s.emptyAcquireWaitTime +} + // CanceledAcquireCount returns the cumulative count of acquires from the pool // that were canceled by a context. func (s *Stat) CanceledAcquireCount() int64 { @@ -266,6 +275,7 @@ func (p *Pool[T]) Stat() *Stat { maxResources: p.maxSize, acquireCount: p.acquireCount, emptyAcquireCount: p.emptyAcquireCount, + emptyAcquireWaitTime: p.emptyAcquireWaitTime, canceledAcquireCount: p.canceledAcquireCount.Load(), acquireDuration: p.acquireDuration, } @@ -363,11 +373,13 @@ func (p *Pool[T]) acquire(ctx context.Context) (*Resource[T], error) { // If a resource is available in the pool. if res := p.tryAcquireIdleResource(); res != nil { + waitTime := time.Duration(nanotime() - startNano) if waitedForLock { p.emptyAcquireCount += 1 + p.emptyAcquireWaitTime += waitTime } p.acquireCount += 1 - p.acquireDuration += time.Duration(nanotime() - startNano) + p.acquireDuration += waitTime p.mux.Unlock() return res, nil } @@ -391,7 +403,9 @@ func (p *Pool[T]) acquire(ctx context.Context) (*Resource[T], error) { p.emptyAcquireCount += 1 p.acquireCount += 1 - p.acquireDuration += time.Duration(nanotime() - startNano) + waitTime := time.Duration(nanotime() - startNano) + p.acquireDuration += waitTime + p.emptyAcquireWaitTime += waitTime return res, nil } diff --git a/vendor/github.com/klauspost/compress/README.md b/vendor/github.com/klauspost/compress/README.md index 05c7359e..684a3085 100644 --- a/vendor/github.com/klauspost/compress/README.md +++ b/vendor/github.com/klauspost/compress/README.md @@ -16,6 +16,20 @@ This package provides various compression algorithms. # changelog +* Jun 12th, 2024 - [1.17.9](https://github.com/klauspost/compress/releases/tag/v1.17.9) + * s2: Reduce ReadFrom temporary allocations https://github.com/klauspost/compress/pull/949 + * flate, zstd: Shave some bytes off amd64 matchLen by @greatroar in https://github.com/klauspost/compress/pull/963 + * Upgrade zip/zlib to 1.22.4 upstream https://github.com/klauspost/compress/pull/970 https://github.com/klauspost/compress/pull/971 + * zstd: BuildDict fails with RLE table https://github.com/klauspost/compress/pull/951 + +* Apr 9th, 2024 - [1.17.8](https://github.com/klauspost/compress/releases/tag/v1.17.8) + * zstd: Reject blocks where reserved values are not 0 https://github.com/klauspost/compress/pull/885 + * zstd: Add RLE detection+encoding https://github.com/klauspost/compress/pull/938 + +* Feb 21st, 2024 - [1.17.7](https://github.com/klauspost/compress/releases/tag/v1.17.7) + * s2: Add AsyncFlush method: Complete the block without flushing by @Jille in https://github.com/klauspost/compress/pull/927 + * s2: Fix literal+repeat exceeds dst crash https://github.com/klauspost/compress/pull/930 + * Feb 5th, 2024 - [1.17.6](https://github.com/klauspost/compress/releases/tag/v1.17.6) * zstd: Fix incorrect repeat coding in best mode https://github.com/klauspost/compress/pull/923 * s2: Fix DecodeConcurrent deadlock on errors https://github.com/klauspost/compress/pull/925 @@ -81,7 +95,7 @@ https://github.com/klauspost/compress/pull/919 https://github.com/klauspost/comp * zstd: Various minor improvements by @greatroar in https://github.com/klauspost/compress/pull/788 https://github.com/klauspost/compress/pull/794 https://github.com/klauspost/compress/pull/795 * s2: Fix huge block overflow https://github.com/klauspost/compress/pull/779 * s2: Allow CustomEncoder fallback https://github.com/klauspost/compress/pull/780 - * gzhttp: Suppport ResponseWriter Unwrap() in gzhttp handler by @jgimenez in https://github.com/klauspost/compress/pull/799 + * gzhttp: Support ResponseWriter Unwrap() in gzhttp handler by @jgimenez in https://github.com/klauspost/compress/pull/799 * Mar 13, 2023 - [v1.16.1](https://github.com/klauspost/compress/releases/tag/v1.16.1) * zstd: Speed up + improve best encoder by @greatroar in https://github.com/klauspost/compress/pull/776 @@ -136,7 +150,7 @@ https://github.com/klauspost/compress/pull/919 https://github.com/klauspost/comp * zstd: Add [WithDecodeAllCapLimit](https://pkg.go.dev/github.com/klauspost/compress@v1.15.10/zstd#WithDecodeAllCapLimit) https://github.com/klauspost/compress/pull/649 * Add Go 1.19 - deprecate Go 1.16 https://github.com/klauspost/compress/pull/651 * flate: Improve level 5+6 compression https://github.com/klauspost/compress/pull/656 - * zstd: Improve "better" compresssion https://github.com/klauspost/compress/pull/657 + * zstd: Improve "better" compression https://github.com/klauspost/compress/pull/657 * s2: Improve "best" compression https://github.com/klauspost/compress/pull/658 * s2: Improve "better" compression. https://github.com/klauspost/compress/pull/635 * s2: Slightly faster non-assembly decompression https://github.com/klauspost/compress/pull/646 @@ -339,7 +353,7 @@ While the release has been extensively tested, it is recommended to testing when * s2: Fix binaries. * Feb 25, 2021 (v1.11.8) - * s2: Fixed occational out-of-bounds write on amd64. Upgrade recommended. + * s2: Fixed occasional out-of-bounds write on amd64. Upgrade recommended. * s2: Add AMD64 assembly for better mode. 25-50% faster. [#315](https://github.com/klauspost/compress/pull/315) * s2: Less upfront decoder allocation. [#322](https://github.com/klauspost/compress/pull/322) * zstd: Faster "compression" of incompressible data. [#314](https://github.com/klauspost/compress/pull/314) @@ -518,7 +532,7 @@ While the release has been extensively tested, it is recommended to testing when * Feb 19, 2016: Faster bit writer, level -2 is 15% faster, level 1 is 4% faster. * Feb 19, 2016: Handle small payloads faster in level 1-3. * Feb 19, 2016: Added faster level 2 + 3 compression modes. -* Feb 19, 2016: [Rebalanced compression levels](https://blog.klauspost.com/rebalancing-deflate-compression-levels/), so there is a more even progresssion in terms of compression. New default level is 5. +* Feb 19, 2016: [Rebalanced compression levels](https://blog.klauspost.com/rebalancing-deflate-compression-levels/), so there is a more even progression in terms of compression. New default level is 5. * Feb 14, 2016: Snappy: Merge upstream changes. * Feb 14, 2016: Snappy: Fix aggressive skipping. * Feb 14, 2016: Snappy: Update benchmark. diff --git a/vendor/github.com/klauspost/compress/flate/deflate.go b/vendor/github.com/klauspost/compress/flate/deflate.go index 66d1657d..af53fb86 100644 --- a/vendor/github.com/klauspost/compress/flate/deflate.go +++ b/vendor/github.com/klauspost/compress/flate/deflate.go @@ -861,7 +861,7 @@ func (d *compressor) reset(w io.Writer) { } switch d.compressionLevel.chain { case 0: - // level was NoCompression or ConstantCompresssion. + // level was NoCompression or ConstantCompression. d.windowEnd = 0 default: s := d.state diff --git a/vendor/github.com/klauspost/compress/flate/inflate.go b/vendor/github.com/klauspost/compress/flate/inflate.go index 2f410d64..0d7b437f 100644 --- a/vendor/github.com/klauspost/compress/flate/inflate.go +++ b/vendor/github.com/klauspost/compress/flate/inflate.go @@ -298,6 +298,14 @@ const ( huffmanGenericReader ) +// flushMode tells decompressor when to return data +type flushMode uint8 + +const ( + syncFlush flushMode = iota // return data after sync flush block + partialFlush // return data after each block +) + // Decompress state. type decompressor struct { // Input source. @@ -332,6 +340,8 @@ type decompressor struct { nb uint final bool + + flushMode flushMode } func (f *decompressor) nextBlock() { @@ -618,7 +628,10 @@ func (f *decompressor) dataBlock() { } if n == 0 { - f.toRead = f.dict.readFlush() + if f.flushMode == syncFlush { + f.toRead = f.dict.readFlush() + } + f.finishBlock() return } @@ -657,8 +670,12 @@ func (f *decompressor) finishBlock() { if f.dict.availRead() > 0 { f.toRead = f.dict.readFlush() } + f.err = io.EOF + } else if f.flushMode == partialFlush && f.dict.availRead() > 0 { + f.toRead = f.dict.readFlush() } + f.step = nextBlock } @@ -789,6 +806,41 @@ func (f *decompressor) Reset(r io.Reader, dict []byte) error { return nil } +type ReaderOpt func(*decompressor) + +// WithPartialBlock tells decompressor to return after each block, +// so it can read data written with partial flush +func WithPartialBlock() ReaderOpt { + return func(f *decompressor) { + f.flushMode = partialFlush + } +} + +// WithDict initializes the reader with a preset dictionary +func WithDict(dict []byte) ReaderOpt { + return func(f *decompressor) { + f.dict.init(maxMatchOffset, dict) + } +} + +// NewReaderOpts returns new reader with provided options +func NewReaderOpts(r io.Reader, opts ...ReaderOpt) io.ReadCloser { + fixedHuffmanDecoderInit() + + var f decompressor + f.r = makeReader(r) + f.bits = new([maxNumLit + maxNumDist]int) + f.codebits = new([numCodes]int) + f.step = nextBlock + f.dict.init(maxMatchOffset, nil) + + for _, opt := range opts { + opt(&f) + } + + return &f +} + // NewReader returns a new ReadCloser that can be used // to read the uncompressed version of r. // If r does not also implement io.ByteReader, @@ -798,15 +850,7 @@ func (f *decompressor) Reset(r io.Reader, dict []byte) error { // // The ReadCloser returned by NewReader also implements Resetter. func NewReader(r io.Reader) io.ReadCloser { - fixedHuffmanDecoderInit() - - var f decompressor - f.r = makeReader(r) - f.bits = new([maxNumLit + maxNumDist]int) - f.codebits = new([numCodes]int) - f.step = nextBlock - f.dict.init(maxMatchOffset, nil) - return &f + return NewReaderOpts(r) } // NewReaderDict is like NewReader but initializes the reader @@ -817,13 +861,5 @@ func NewReader(r io.Reader) io.ReadCloser { // // The ReadCloser returned by NewReader also implements Resetter. func NewReaderDict(r io.Reader, dict []byte) io.ReadCloser { - fixedHuffmanDecoderInit() - - var f decompressor - f.r = makeReader(r) - f.bits = new([maxNumLit + maxNumDist]int) - f.codebits = new([numCodes]int) - f.step = nextBlock - f.dict.init(maxMatchOffset, dict) - return &f + return NewReaderOpts(r, WithDict(dict)) } diff --git a/vendor/github.com/klauspost/compress/fse/decompress.go b/vendor/github.com/klauspost/compress/fse/decompress.go index cc05d0f7..0c7dd4ff 100644 --- a/vendor/github.com/klauspost/compress/fse/decompress.go +++ b/vendor/github.com/klauspost/compress/fse/decompress.go @@ -15,7 +15,7 @@ const ( // It is possible, but by no way guaranteed that corrupt data will // return an error. // It is up to the caller to verify integrity of the returned data. -// Use a predefined Scrach to set maximum acceptable output size. +// Use a predefined Scratch to set maximum acceptable output size. func Decompress(b []byte, s *Scratch) ([]byte, error) { s, err := s.prepare(b) if err != nil { diff --git a/vendor/github.com/klauspost/compress/huff0/decompress.go b/vendor/github.com/klauspost/compress/huff0/decompress.go index 54bd08b2..0f56b02d 100644 --- a/vendor/github.com/klauspost/compress/huff0/decompress.go +++ b/vendor/github.com/klauspost/compress/huff0/decompress.go @@ -1136,7 +1136,7 @@ func (s *Scratch) matches(ct cTable, w io.Writer) { errs++ } if errs > 0 { - fmt.Fprintf(w, "%d errros in base, stopping\n", errs) + fmt.Fprintf(w, "%d errors in base, stopping\n", errs) continue } // Ensure that all combinations are covered. @@ -1152,7 +1152,7 @@ func (s *Scratch) matches(ct cTable, w io.Writer) { errs++ } if errs > 20 { - fmt.Fprintf(w, "%d errros, stopping\n", errs) + fmt.Fprintf(w, "%d errors, stopping\n", errs) break } } diff --git a/vendor/github.com/klauspost/compress/s2/writer.go b/vendor/github.com/klauspost/compress/s2/writer.go index 0a46f2b9..fd15078f 100644 --- a/vendor/github.com/klauspost/compress/s2/writer.go +++ b/vendor/github.com/klauspost/compress/s2/writer.go @@ -83,11 +83,14 @@ type Writer struct { snappy bool flushOnWrite bool appendIndex bool + bufferCB func([]byte) level uint8 } type result struct { b []byte + // return when writing + ret []byte // Uncompressed start offset startOffset int64 } @@ -146,6 +149,10 @@ func (w *Writer) Reset(writer io.Writer) { for write := range toWrite { // Wait for the data to be available. input := <-write + if input.ret != nil && w.bufferCB != nil { + w.bufferCB(input.ret) + input.ret = nil + } in := input.b if len(in) > 0 { if w.err(nil) == nil { @@ -341,7 +348,8 @@ func (w *Writer) AddSkippableBlock(id uint8, data []byte) (err error) { // but the input buffer cannot be written to by the caller // until Flush or Close has been called when concurrency != 1. // -// If you cannot control that, use the regular Write function. +// Use the WriterBufferDone to receive a callback when the buffer is done +// Processing. // // Note that input is not buffered. // This means that each write will result in discrete blocks being created. @@ -364,6 +372,9 @@ func (w *Writer) EncodeBuffer(buf []byte) (err error) { } if w.concurrency == 1 { _, err := w.writeSync(buf) + if w.bufferCB != nil { + w.bufferCB(buf) + } return err } @@ -378,7 +389,7 @@ func (w *Writer) EncodeBuffer(buf []byte) (err error) { hWriter <- result{startOffset: w.uncompWritten, b: magicChunkBytes} } } - + orgBuf := buf for len(buf) > 0 { // Cut input. uncompressed := buf @@ -397,6 +408,9 @@ func (w *Writer) EncodeBuffer(buf []byte) (err error) { startOffset: w.uncompWritten, } w.uncompWritten += int64(len(uncompressed)) + if len(buf) == 0 && w.bufferCB != nil { + res.ret = orgBuf + } go func() { race.ReadSlice(uncompressed) @@ -922,7 +936,7 @@ func WriterBetterCompression() WriterOption { } // WriterBestCompression will enable better compression. -// EncodeBetter compresses better than Encode but typically with a +// EncodeBest compresses better than Encode but typically with a // big speed decrease on compression. func WriterBestCompression() WriterOption { return func(w *Writer) error { @@ -941,6 +955,17 @@ func WriterUncompressed() WriterOption { } } +// WriterBufferDone will perform a callback when EncodeBuffer has finished +// writing a buffer to the output and the buffer can safely be reused. +// If the buffer was split into several blocks, it will be sent after the last block. +// Callbacks will not be done concurrently. +func WriterBufferDone(fn func(b []byte)) WriterOption { + return func(w *Writer) error { + w.bufferCB = fn + return nil + } +} + // WriterBlockSize allows to override the default block size. // Blocks will be this size or smaller. // Minimum size is 4KB and maximum size is 4MB. diff --git a/vendor/github.com/klauspost/compress/zstd/blockdec.go b/vendor/github.com/klauspost/compress/zstd/blockdec.go index 03744fbc..9c28840c 100644 --- a/vendor/github.com/klauspost/compress/zstd/blockdec.go +++ b/vendor/github.com/klauspost/compress/zstd/blockdec.go @@ -598,7 +598,9 @@ func (b *blockDec) prepareSequences(in []byte, hist *history) (err error) { printf("RLE set to 0x%x, code: %v", symb, v) } case compModeFSE: - println("Reading table for", tableIndex(i)) + if debugDecoder { + println("Reading table for", tableIndex(i)) + } if seq.fse == nil || seq.fse.preDefined { seq.fse = fseDecoderPool.Get().(*fseDecoder) } diff --git a/vendor/github.com/klauspost/compress/zstd/enc_better.go b/vendor/github.com/klauspost/compress/zstd/enc_better.go index a4f5bf91..84a79fde 100644 --- a/vendor/github.com/klauspost/compress/zstd/enc_better.go +++ b/vendor/github.com/klauspost/compress/zstd/enc_better.go @@ -179,9 +179,9 @@ encodeLoop: if repIndex >= 0 && load3232(src, repIndex) == uint32(cv>>(repOff*8)) { // Consider history as well. var seq seq - lenght := 4 + e.matchlen(s+4+repOff, repIndex+4, src) + length := 4 + e.matchlen(s+4+repOff, repIndex+4, src) - seq.matchLen = uint32(lenght - zstdMinMatch) + seq.matchLen = uint32(length - zstdMinMatch) // We might be able to match backwards. // Extend as long as we can. @@ -210,12 +210,12 @@ encodeLoop: // Index match start+1 (long) -> s - 1 index0 := s + repOff - s += lenght + repOff + s += length + repOff nextEmit = s if s >= sLimit { if debugEncoder { - println("repeat ended", s, lenght) + println("repeat ended", s, length) } break encodeLoop @@ -241,9 +241,9 @@ encodeLoop: if false && repIndex >= 0 && load6432(src, repIndex) == load6432(src, s+repOff) { // Consider history as well. var seq seq - lenght := 8 + e.matchlen(s+8+repOff2, repIndex+8, src) + length := 8 + e.matchlen(s+8+repOff2, repIndex+8, src) - seq.matchLen = uint32(lenght - zstdMinMatch) + seq.matchLen = uint32(length - zstdMinMatch) // We might be able to match backwards. // Extend as long as we can. @@ -270,11 +270,11 @@ encodeLoop: } blk.sequences = append(blk.sequences, seq) - s += lenght + repOff2 + s += length + repOff2 nextEmit = s if s >= sLimit { if debugEncoder { - println("repeat ended", s, lenght) + println("repeat ended", s, length) } break encodeLoop @@ -708,9 +708,9 @@ encodeLoop: if repIndex >= 0 && load3232(src, repIndex) == uint32(cv>>(repOff*8)) { // Consider history as well. var seq seq - lenght := 4 + e.matchlen(s+4+repOff, repIndex+4, src) + length := 4 + e.matchlen(s+4+repOff, repIndex+4, src) - seq.matchLen = uint32(lenght - zstdMinMatch) + seq.matchLen = uint32(length - zstdMinMatch) // We might be able to match backwards. // Extend as long as we can. @@ -738,12 +738,12 @@ encodeLoop: blk.sequences = append(blk.sequences, seq) // Index match start+1 (long) -> s - 1 - s += lenght + repOff + s += length + repOff nextEmit = s if s >= sLimit { if debugEncoder { - println("repeat ended", s, lenght) + println("repeat ended", s, length) } break encodeLoop @@ -772,9 +772,9 @@ encodeLoop: if false && repIndex >= 0 && load6432(src, repIndex) == load6432(src, s+repOff) { // Consider history as well. var seq seq - lenght := 8 + e.matchlen(s+8+repOff2, repIndex+8, src) + length := 8 + e.matchlen(s+8+repOff2, repIndex+8, src) - seq.matchLen = uint32(lenght - zstdMinMatch) + seq.matchLen = uint32(length - zstdMinMatch) // We might be able to match backwards. // Extend as long as we can. @@ -801,11 +801,11 @@ encodeLoop: } blk.sequences = append(blk.sequences, seq) - s += lenght + repOff2 + s += length + repOff2 nextEmit = s if s >= sLimit { if debugEncoder { - println("repeat ended", s, lenght) + println("repeat ended", s, length) } break encodeLoop diff --git a/vendor/github.com/klauspost/compress/zstd/enc_dfast.go b/vendor/github.com/klauspost/compress/zstd/enc_dfast.go index a154c18f..d36be7bd 100644 --- a/vendor/github.com/klauspost/compress/zstd/enc_dfast.go +++ b/vendor/github.com/klauspost/compress/zstd/enc_dfast.go @@ -138,9 +138,9 @@ encodeLoop: if repIndex >= 0 && load3232(src, repIndex) == uint32(cv>>(repOff*8)) { // Consider history as well. var seq seq - lenght := 4 + e.matchlen(s+4+repOff, repIndex+4, src) + length := 4 + e.matchlen(s+4+repOff, repIndex+4, src) - seq.matchLen = uint32(lenght - zstdMinMatch) + seq.matchLen = uint32(length - zstdMinMatch) // We might be able to match backwards. // Extend as long as we can. @@ -166,11 +166,11 @@ encodeLoop: println("repeat sequence", seq, "next s:", s) } blk.sequences = append(blk.sequences, seq) - s += lenght + repOff + s += length + repOff nextEmit = s if s >= sLimit { if debugEncoder { - println("repeat ended", s, lenght) + println("repeat ended", s, length) } break encodeLoop @@ -798,9 +798,9 @@ encodeLoop: if repIndex >= 0 && load3232(src, repIndex) == uint32(cv>>(repOff*8)) { // Consider history as well. var seq seq - lenght := 4 + e.matchlen(s+4+repOff, repIndex+4, src) + length := 4 + e.matchlen(s+4+repOff, repIndex+4, src) - seq.matchLen = uint32(lenght - zstdMinMatch) + seq.matchLen = uint32(length - zstdMinMatch) // We might be able to match backwards. // Extend as long as we can. @@ -826,11 +826,11 @@ encodeLoop: println("repeat sequence", seq, "next s:", s) } blk.sequences = append(blk.sequences, seq) - s += lenght + repOff + s += length + repOff nextEmit = s if s >= sLimit { if debugEncoder { - println("repeat ended", s, lenght) + println("repeat ended", s, length) } break encodeLoop diff --git a/vendor/github.com/klauspost/compress/zstd/encoder.go b/vendor/github.com/klauspost/compress/zstd/encoder.go index 72af7ef0..a79c4a52 100644 --- a/vendor/github.com/klauspost/compress/zstd/encoder.go +++ b/vendor/github.com/klauspost/compress/zstd/encoder.go @@ -202,7 +202,7 @@ func (e *Encoder) nextBlock(final bool) error { return nil } if final && len(s.filling) > 0 { - s.current = e.EncodeAll(s.filling, s.current[:0]) + s.current = e.encodeAll(s.encoder, s.filling, s.current[:0]) var n2 int n2, s.err = s.w.Write(s.current) if s.err != nil { @@ -469,6 +469,15 @@ func (e *Encoder) Close() error { // Data compressed with EncodeAll can be decoded with the Decoder, // using either a stream or DecodeAll. func (e *Encoder) EncodeAll(src, dst []byte) []byte { + e.init.Do(e.initialize) + enc := <-e.encoders + defer func() { + e.encoders <- enc + }() + return e.encodeAll(enc, src, dst) +} + +func (e *Encoder) encodeAll(enc encoder, src, dst []byte) []byte { if len(src) == 0 { if e.o.fullZero { // Add frame header. @@ -491,13 +500,7 @@ func (e *Encoder) EncodeAll(src, dst []byte) []byte { } return dst } - e.init.Do(e.initialize) - enc := <-e.encoders - defer func() { - // Release encoder reference to last block. - // If a non-single block is needed the encoder will reset again. - e.encoders <- enc - }() + // Use single segments when above minimum window and below window size. single := len(src) <= e.o.windowSize && len(src) > MinWindowSize if e.o.single != nil { diff --git a/vendor/github.com/klauspost/compress/zstd/framedec.go b/vendor/github.com/klauspost/compress/zstd/framedec.go index 53e160f7..e47af66e 100644 --- a/vendor/github.com/klauspost/compress/zstd/framedec.go +++ b/vendor/github.com/klauspost/compress/zstd/framedec.go @@ -146,7 +146,9 @@ func (d *frameDec) reset(br byteBuffer) error { } return err } - printf("raw: %x, mantissa: %d, exponent: %d\n", wd, wd&7, wd>>3) + if debugDecoder { + printf("raw: %x, mantissa: %d, exponent: %d\n", wd, wd&7, wd>>3) + } windowLog := 10 + (wd >> 3) windowBase := uint64(1) << windowLog windowAdd := (windowBase / 8) * uint64(wd&0x7) diff --git a/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.go b/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.go index 8adabd82..c59f17e0 100644 --- a/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.go +++ b/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.go @@ -146,7 +146,7 @@ func (s *sequenceDecs) decodeSyncSimple(hist []byte) (bool, error) { return true, fmt.Errorf("output bigger than max block size (%d)", maxBlockSize) default: - return true, fmt.Errorf("sequenceDecs_decode returned erronous code %d", errCode) + return true, fmt.Errorf("sequenceDecs_decode returned erroneous code %d", errCode) } s.seqSize += ctx.litRemain @@ -292,7 +292,7 @@ func (s *sequenceDecs) decode(seqs []seqVals) error { return io.ErrUnexpectedEOF } - return fmt.Errorf("sequenceDecs_decode_amd64 returned erronous code %d", errCode) + return fmt.Errorf("sequenceDecs_decode_amd64 returned erroneous code %d", errCode) } if ctx.litRemain < 0 { diff --git a/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.s b/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.s index 5b06174b..f5591fa1 100644 --- a/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.s +++ b/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.s @@ -1814,7 +1814,7 @@ TEXT ·sequenceDecs_decodeSync_amd64(SB), $64-32 MOVQ 40(SP), AX ADDQ AX, 48(SP) - // Calculate poiter to s.out[cap(s.out)] (a past-end pointer) + // Calculate pointer to s.out[cap(s.out)] (a past-end pointer) ADDQ R10, 32(SP) // outBase += outPosition @@ -2376,7 +2376,7 @@ TEXT ·sequenceDecs_decodeSync_bmi2(SB), $64-32 MOVQ 40(SP), CX ADDQ CX, 48(SP) - // Calculate poiter to s.out[cap(s.out)] (a past-end pointer) + // Calculate pointer to s.out[cap(s.out)] (a past-end pointer) ADDQ R9, 32(SP) // outBase += outPosition @@ -2896,7 +2896,7 @@ TEXT ·sequenceDecs_decodeSync_safe_amd64(SB), $64-32 MOVQ 40(SP), AX ADDQ AX, 48(SP) - // Calculate poiter to s.out[cap(s.out)] (a past-end pointer) + // Calculate pointer to s.out[cap(s.out)] (a past-end pointer) ADDQ R10, 32(SP) // outBase += outPosition @@ -3560,7 +3560,7 @@ TEXT ·sequenceDecs_decodeSync_safe_bmi2(SB), $64-32 MOVQ 40(SP), CX ADDQ CX, 48(SP) - // Calculate poiter to s.out[cap(s.out)] (a past-end pointer) + // Calculate pointer to s.out[cap(s.out)] (a past-end pointer) ADDQ R9, 32(SP) // outBase += outPosition diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_table.go b/vendor/github.com/mattn/go-runewidth/runewidth_table.go index e5d890c2..ad025ad5 100644 --- a/vendor/github.com/mattn/go-runewidth/runewidth_table.go +++ b/vendor/github.com/mattn/go-runewidth/runewidth_table.go @@ -4,20 +4,21 @@ package runewidth var combining = table{ {0x0300, 0x036F}, {0x0483, 0x0489}, {0x07EB, 0x07F3}, - {0x0C00, 0x0C00}, {0x0C04, 0x0C04}, {0x0D00, 0x0D01}, - {0x135D, 0x135F}, {0x1A7F, 0x1A7F}, {0x1AB0, 0x1AC0}, - {0x1B6B, 0x1B73}, {0x1DC0, 0x1DF9}, {0x1DFB, 0x1DFF}, + {0x0C00, 0x0C00}, {0x0C04, 0x0C04}, {0x0CF3, 0x0CF3}, + {0x0D00, 0x0D01}, {0x135D, 0x135F}, {0x1A7F, 0x1A7F}, + {0x1AB0, 0x1ACE}, {0x1B6B, 0x1B73}, {0x1DC0, 0x1DFF}, {0x20D0, 0x20F0}, {0x2CEF, 0x2CF1}, {0x2DE0, 0x2DFF}, {0x3099, 0x309A}, {0xA66F, 0xA672}, {0xA674, 0xA67D}, {0xA69E, 0xA69F}, {0xA6F0, 0xA6F1}, {0xA8E0, 0xA8F1}, {0xFE20, 0xFE2F}, {0x101FD, 0x101FD}, {0x10376, 0x1037A}, - {0x10EAB, 0x10EAC}, {0x10F46, 0x10F50}, {0x11300, 0x11301}, - {0x1133B, 0x1133C}, {0x11366, 0x1136C}, {0x11370, 0x11374}, - {0x16AF0, 0x16AF4}, {0x1D165, 0x1D169}, {0x1D16D, 0x1D172}, + {0x10EAB, 0x10EAC}, {0x10F46, 0x10F50}, {0x10F82, 0x10F85}, + {0x11300, 0x11301}, {0x1133B, 0x1133C}, {0x11366, 0x1136C}, + {0x11370, 0x11374}, {0x16AF0, 0x16AF4}, {0x1CF00, 0x1CF2D}, + {0x1CF30, 0x1CF46}, {0x1D165, 0x1D169}, {0x1D16D, 0x1D172}, {0x1D17B, 0x1D182}, {0x1D185, 0x1D18B}, {0x1D1AA, 0x1D1AD}, {0x1D242, 0x1D244}, {0x1E000, 0x1E006}, {0x1E008, 0x1E018}, {0x1E01B, 0x1E021}, {0x1E023, 0x1E024}, {0x1E026, 0x1E02A}, - {0x1E8D0, 0x1E8D6}, + {0x1E08F, 0x1E08F}, {0x1E8D0, 0x1E8D6}, } var doublewidth = table{ @@ -33,33 +34,34 @@ var doublewidth = table{ {0x2753, 0x2755}, {0x2757, 0x2757}, {0x2795, 0x2797}, {0x27B0, 0x27B0}, {0x27BF, 0x27BF}, {0x2B1B, 0x2B1C}, {0x2B50, 0x2B50}, {0x2B55, 0x2B55}, {0x2E80, 0x2E99}, - {0x2E9B, 0x2EF3}, {0x2F00, 0x2FD5}, {0x2FF0, 0x2FFB}, - {0x3000, 0x303E}, {0x3041, 0x3096}, {0x3099, 0x30FF}, - {0x3105, 0x312F}, {0x3131, 0x318E}, {0x3190, 0x31E3}, - {0x31F0, 0x321E}, {0x3220, 0x3247}, {0x3250, 0x4DBF}, - {0x4E00, 0xA48C}, {0xA490, 0xA4C6}, {0xA960, 0xA97C}, - {0xAC00, 0xD7A3}, {0xF900, 0xFAFF}, {0xFE10, 0xFE19}, - {0xFE30, 0xFE52}, {0xFE54, 0xFE66}, {0xFE68, 0xFE6B}, - {0xFF01, 0xFF60}, {0xFFE0, 0xFFE6}, {0x16FE0, 0x16FE4}, - {0x16FF0, 0x16FF1}, {0x17000, 0x187F7}, {0x18800, 0x18CD5}, - {0x18D00, 0x18D08}, {0x1B000, 0x1B11E}, {0x1B150, 0x1B152}, - {0x1B164, 0x1B167}, {0x1B170, 0x1B2FB}, {0x1F004, 0x1F004}, - {0x1F0CF, 0x1F0CF}, {0x1F18E, 0x1F18E}, {0x1F191, 0x1F19A}, - {0x1F200, 0x1F202}, {0x1F210, 0x1F23B}, {0x1F240, 0x1F248}, - {0x1F250, 0x1F251}, {0x1F260, 0x1F265}, {0x1F300, 0x1F320}, - {0x1F32D, 0x1F335}, {0x1F337, 0x1F37C}, {0x1F37E, 0x1F393}, - {0x1F3A0, 0x1F3CA}, {0x1F3CF, 0x1F3D3}, {0x1F3E0, 0x1F3F0}, - {0x1F3F4, 0x1F3F4}, {0x1F3F8, 0x1F43E}, {0x1F440, 0x1F440}, - {0x1F442, 0x1F4FC}, {0x1F4FF, 0x1F53D}, {0x1F54B, 0x1F54E}, - {0x1F550, 0x1F567}, {0x1F57A, 0x1F57A}, {0x1F595, 0x1F596}, - {0x1F5A4, 0x1F5A4}, {0x1F5FB, 0x1F64F}, {0x1F680, 0x1F6C5}, - {0x1F6CC, 0x1F6CC}, {0x1F6D0, 0x1F6D2}, {0x1F6D5, 0x1F6D7}, - {0x1F6EB, 0x1F6EC}, {0x1F6F4, 0x1F6FC}, {0x1F7E0, 0x1F7EB}, - {0x1F90C, 0x1F93A}, {0x1F93C, 0x1F945}, {0x1F947, 0x1F978}, - {0x1F97A, 0x1F9CB}, {0x1F9CD, 0x1F9FF}, {0x1FA70, 0x1FA74}, - {0x1FA78, 0x1FA7A}, {0x1FA80, 0x1FA86}, {0x1FA90, 0x1FAA8}, - {0x1FAB0, 0x1FAB6}, {0x1FAC0, 0x1FAC2}, {0x1FAD0, 0x1FAD6}, - {0x20000, 0x2FFFD}, {0x30000, 0x3FFFD}, + {0x2E9B, 0x2EF3}, {0x2F00, 0x2FD5}, {0x2FF0, 0x303E}, + {0x3041, 0x3096}, {0x3099, 0x30FF}, {0x3105, 0x312F}, + {0x3131, 0x318E}, {0x3190, 0x31E3}, {0x31EF, 0x321E}, + {0x3220, 0x3247}, {0x3250, 0x4DBF}, {0x4E00, 0xA48C}, + {0xA490, 0xA4C6}, {0xA960, 0xA97C}, {0xAC00, 0xD7A3}, + {0xF900, 0xFAFF}, {0xFE10, 0xFE19}, {0xFE30, 0xFE52}, + {0xFE54, 0xFE66}, {0xFE68, 0xFE6B}, {0xFF01, 0xFF60}, + {0xFFE0, 0xFFE6}, {0x16FE0, 0x16FE4}, {0x16FF0, 0x16FF1}, + {0x17000, 0x187F7}, {0x18800, 0x18CD5}, {0x18D00, 0x18D08}, + {0x1AFF0, 0x1AFF3}, {0x1AFF5, 0x1AFFB}, {0x1AFFD, 0x1AFFE}, + {0x1B000, 0x1B122}, {0x1B132, 0x1B132}, {0x1B150, 0x1B152}, + {0x1B155, 0x1B155}, {0x1B164, 0x1B167}, {0x1B170, 0x1B2FB}, + {0x1F004, 0x1F004}, {0x1F0CF, 0x1F0CF}, {0x1F18E, 0x1F18E}, + {0x1F191, 0x1F19A}, {0x1F200, 0x1F202}, {0x1F210, 0x1F23B}, + {0x1F240, 0x1F248}, {0x1F250, 0x1F251}, {0x1F260, 0x1F265}, + {0x1F300, 0x1F320}, {0x1F32D, 0x1F335}, {0x1F337, 0x1F37C}, + {0x1F37E, 0x1F393}, {0x1F3A0, 0x1F3CA}, {0x1F3CF, 0x1F3D3}, + {0x1F3E0, 0x1F3F0}, {0x1F3F4, 0x1F3F4}, {0x1F3F8, 0x1F43E}, + {0x1F440, 0x1F440}, {0x1F442, 0x1F4FC}, {0x1F4FF, 0x1F53D}, + {0x1F54B, 0x1F54E}, {0x1F550, 0x1F567}, {0x1F57A, 0x1F57A}, + {0x1F595, 0x1F596}, {0x1F5A4, 0x1F5A4}, {0x1F5FB, 0x1F64F}, + {0x1F680, 0x1F6C5}, {0x1F6CC, 0x1F6CC}, {0x1F6D0, 0x1F6D2}, + {0x1F6D5, 0x1F6D7}, {0x1F6DC, 0x1F6DF}, {0x1F6EB, 0x1F6EC}, + {0x1F6F4, 0x1F6FC}, {0x1F7E0, 0x1F7EB}, {0x1F7F0, 0x1F7F0}, + {0x1F90C, 0x1F93A}, {0x1F93C, 0x1F945}, {0x1F947, 0x1F9FF}, + {0x1FA70, 0x1FA7C}, {0x1FA80, 0x1FA88}, {0x1FA90, 0x1FABD}, + {0x1FABF, 0x1FAC5}, {0x1FACE, 0x1FADB}, {0x1FAE0, 0x1FAE8}, + {0x1FAF0, 0x1FAF8}, {0x20000, 0x2FFFD}, {0x30000, 0x3FFFD}, } var ambiguous = table{ @@ -154,43 +156,43 @@ var neutral = table{ {0x0402, 0x040F}, {0x0450, 0x0450}, {0x0452, 0x052F}, {0x0531, 0x0556}, {0x0559, 0x058A}, {0x058D, 0x058F}, {0x0591, 0x05C7}, {0x05D0, 0x05EA}, {0x05EF, 0x05F4}, - {0x0600, 0x061C}, {0x061E, 0x070D}, {0x070F, 0x074A}, - {0x074D, 0x07B1}, {0x07C0, 0x07FA}, {0x07FD, 0x082D}, - {0x0830, 0x083E}, {0x0840, 0x085B}, {0x085E, 0x085E}, - {0x0860, 0x086A}, {0x08A0, 0x08B4}, {0x08B6, 0x08C7}, - {0x08D3, 0x0983}, {0x0985, 0x098C}, {0x098F, 0x0990}, - {0x0993, 0x09A8}, {0x09AA, 0x09B0}, {0x09B2, 0x09B2}, - {0x09B6, 0x09B9}, {0x09BC, 0x09C4}, {0x09C7, 0x09C8}, - {0x09CB, 0x09CE}, {0x09D7, 0x09D7}, {0x09DC, 0x09DD}, - {0x09DF, 0x09E3}, {0x09E6, 0x09FE}, {0x0A01, 0x0A03}, - {0x0A05, 0x0A0A}, {0x0A0F, 0x0A10}, {0x0A13, 0x0A28}, - {0x0A2A, 0x0A30}, {0x0A32, 0x0A33}, {0x0A35, 0x0A36}, - {0x0A38, 0x0A39}, {0x0A3C, 0x0A3C}, {0x0A3E, 0x0A42}, - {0x0A47, 0x0A48}, {0x0A4B, 0x0A4D}, {0x0A51, 0x0A51}, - {0x0A59, 0x0A5C}, {0x0A5E, 0x0A5E}, {0x0A66, 0x0A76}, - {0x0A81, 0x0A83}, {0x0A85, 0x0A8D}, {0x0A8F, 0x0A91}, - {0x0A93, 0x0AA8}, {0x0AAA, 0x0AB0}, {0x0AB2, 0x0AB3}, - {0x0AB5, 0x0AB9}, {0x0ABC, 0x0AC5}, {0x0AC7, 0x0AC9}, - {0x0ACB, 0x0ACD}, {0x0AD0, 0x0AD0}, {0x0AE0, 0x0AE3}, - {0x0AE6, 0x0AF1}, {0x0AF9, 0x0AFF}, {0x0B01, 0x0B03}, - {0x0B05, 0x0B0C}, {0x0B0F, 0x0B10}, {0x0B13, 0x0B28}, - {0x0B2A, 0x0B30}, {0x0B32, 0x0B33}, {0x0B35, 0x0B39}, - {0x0B3C, 0x0B44}, {0x0B47, 0x0B48}, {0x0B4B, 0x0B4D}, - {0x0B55, 0x0B57}, {0x0B5C, 0x0B5D}, {0x0B5F, 0x0B63}, - {0x0B66, 0x0B77}, {0x0B82, 0x0B83}, {0x0B85, 0x0B8A}, - {0x0B8E, 0x0B90}, {0x0B92, 0x0B95}, {0x0B99, 0x0B9A}, - {0x0B9C, 0x0B9C}, {0x0B9E, 0x0B9F}, {0x0BA3, 0x0BA4}, - {0x0BA8, 0x0BAA}, {0x0BAE, 0x0BB9}, {0x0BBE, 0x0BC2}, - {0x0BC6, 0x0BC8}, {0x0BCA, 0x0BCD}, {0x0BD0, 0x0BD0}, - {0x0BD7, 0x0BD7}, {0x0BE6, 0x0BFA}, {0x0C00, 0x0C0C}, - {0x0C0E, 0x0C10}, {0x0C12, 0x0C28}, {0x0C2A, 0x0C39}, - {0x0C3D, 0x0C44}, {0x0C46, 0x0C48}, {0x0C4A, 0x0C4D}, - {0x0C55, 0x0C56}, {0x0C58, 0x0C5A}, {0x0C60, 0x0C63}, + {0x0600, 0x070D}, {0x070F, 0x074A}, {0x074D, 0x07B1}, + {0x07C0, 0x07FA}, {0x07FD, 0x082D}, {0x0830, 0x083E}, + {0x0840, 0x085B}, {0x085E, 0x085E}, {0x0860, 0x086A}, + {0x0870, 0x088E}, {0x0890, 0x0891}, {0x0898, 0x0983}, + {0x0985, 0x098C}, {0x098F, 0x0990}, {0x0993, 0x09A8}, + {0x09AA, 0x09B0}, {0x09B2, 0x09B2}, {0x09B6, 0x09B9}, + {0x09BC, 0x09C4}, {0x09C7, 0x09C8}, {0x09CB, 0x09CE}, + {0x09D7, 0x09D7}, {0x09DC, 0x09DD}, {0x09DF, 0x09E3}, + {0x09E6, 0x09FE}, {0x0A01, 0x0A03}, {0x0A05, 0x0A0A}, + {0x0A0F, 0x0A10}, {0x0A13, 0x0A28}, {0x0A2A, 0x0A30}, + {0x0A32, 0x0A33}, {0x0A35, 0x0A36}, {0x0A38, 0x0A39}, + {0x0A3C, 0x0A3C}, {0x0A3E, 0x0A42}, {0x0A47, 0x0A48}, + {0x0A4B, 0x0A4D}, {0x0A51, 0x0A51}, {0x0A59, 0x0A5C}, + {0x0A5E, 0x0A5E}, {0x0A66, 0x0A76}, {0x0A81, 0x0A83}, + {0x0A85, 0x0A8D}, {0x0A8F, 0x0A91}, {0x0A93, 0x0AA8}, + {0x0AAA, 0x0AB0}, {0x0AB2, 0x0AB3}, {0x0AB5, 0x0AB9}, + {0x0ABC, 0x0AC5}, {0x0AC7, 0x0AC9}, {0x0ACB, 0x0ACD}, + {0x0AD0, 0x0AD0}, {0x0AE0, 0x0AE3}, {0x0AE6, 0x0AF1}, + {0x0AF9, 0x0AFF}, {0x0B01, 0x0B03}, {0x0B05, 0x0B0C}, + {0x0B0F, 0x0B10}, {0x0B13, 0x0B28}, {0x0B2A, 0x0B30}, + {0x0B32, 0x0B33}, {0x0B35, 0x0B39}, {0x0B3C, 0x0B44}, + {0x0B47, 0x0B48}, {0x0B4B, 0x0B4D}, {0x0B55, 0x0B57}, + {0x0B5C, 0x0B5D}, {0x0B5F, 0x0B63}, {0x0B66, 0x0B77}, + {0x0B82, 0x0B83}, {0x0B85, 0x0B8A}, {0x0B8E, 0x0B90}, + {0x0B92, 0x0B95}, {0x0B99, 0x0B9A}, {0x0B9C, 0x0B9C}, + {0x0B9E, 0x0B9F}, {0x0BA3, 0x0BA4}, {0x0BA8, 0x0BAA}, + {0x0BAE, 0x0BB9}, {0x0BBE, 0x0BC2}, {0x0BC6, 0x0BC8}, + {0x0BCA, 0x0BCD}, {0x0BD0, 0x0BD0}, {0x0BD7, 0x0BD7}, + {0x0BE6, 0x0BFA}, {0x0C00, 0x0C0C}, {0x0C0E, 0x0C10}, + {0x0C12, 0x0C28}, {0x0C2A, 0x0C39}, {0x0C3C, 0x0C44}, + {0x0C46, 0x0C48}, {0x0C4A, 0x0C4D}, {0x0C55, 0x0C56}, + {0x0C58, 0x0C5A}, {0x0C5D, 0x0C5D}, {0x0C60, 0x0C63}, {0x0C66, 0x0C6F}, {0x0C77, 0x0C8C}, {0x0C8E, 0x0C90}, {0x0C92, 0x0CA8}, {0x0CAA, 0x0CB3}, {0x0CB5, 0x0CB9}, {0x0CBC, 0x0CC4}, {0x0CC6, 0x0CC8}, {0x0CCA, 0x0CCD}, - {0x0CD5, 0x0CD6}, {0x0CDE, 0x0CDE}, {0x0CE0, 0x0CE3}, - {0x0CE6, 0x0CEF}, {0x0CF1, 0x0CF2}, {0x0D00, 0x0D0C}, + {0x0CD5, 0x0CD6}, {0x0CDD, 0x0CDE}, {0x0CE0, 0x0CE3}, + {0x0CE6, 0x0CEF}, {0x0CF1, 0x0CF3}, {0x0D00, 0x0D0C}, {0x0D0E, 0x0D10}, {0x0D12, 0x0D44}, {0x0D46, 0x0D48}, {0x0D4A, 0x0D4F}, {0x0D54, 0x0D63}, {0x0D66, 0x0D7F}, {0x0D81, 0x0D83}, {0x0D85, 0x0D96}, {0x0D9A, 0x0DB1}, @@ -200,7 +202,7 @@ var neutral = table{ {0x0E01, 0x0E3A}, {0x0E3F, 0x0E5B}, {0x0E81, 0x0E82}, {0x0E84, 0x0E84}, {0x0E86, 0x0E8A}, {0x0E8C, 0x0EA3}, {0x0EA5, 0x0EA5}, {0x0EA7, 0x0EBD}, {0x0EC0, 0x0EC4}, - {0x0EC6, 0x0EC6}, {0x0EC8, 0x0ECD}, {0x0ED0, 0x0ED9}, + {0x0EC6, 0x0EC6}, {0x0EC8, 0x0ECE}, {0x0ED0, 0x0ED9}, {0x0EDC, 0x0EDF}, {0x0F00, 0x0F47}, {0x0F49, 0x0F6C}, {0x0F71, 0x0F97}, {0x0F99, 0x0FBC}, {0x0FBE, 0x0FCC}, {0x0FCE, 0x0FDA}, {0x1000, 0x10C5}, {0x10C7, 0x10C7}, @@ -212,20 +214,19 @@ var neutral = table{ {0x12D8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135A}, {0x135D, 0x137C}, {0x1380, 0x1399}, {0x13A0, 0x13F5}, {0x13F8, 0x13FD}, {0x1400, 0x169C}, {0x16A0, 0x16F8}, - {0x1700, 0x170C}, {0x170E, 0x1714}, {0x1720, 0x1736}, - {0x1740, 0x1753}, {0x1760, 0x176C}, {0x176E, 0x1770}, - {0x1772, 0x1773}, {0x1780, 0x17DD}, {0x17E0, 0x17E9}, - {0x17F0, 0x17F9}, {0x1800, 0x180E}, {0x1810, 0x1819}, - {0x1820, 0x1878}, {0x1880, 0x18AA}, {0x18B0, 0x18F5}, - {0x1900, 0x191E}, {0x1920, 0x192B}, {0x1930, 0x193B}, - {0x1940, 0x1940}, {0x1944, 0x196D}, {0x1970, 0x1974}, - {0x1980, 0x19AB}, {0x19B0, 0x19C9}, {0x19D0, 0x19DA}, - {0x19DE, 0x1A1B}, {0x1A1E, 0x1A5E}, {0x1A60, 0x1A7C}, - {0x1A7F, 0x1A89}, {0x1A90, 0x1A99}, {0x1AA0, 0x1AAD}, - {0x1AB0, 0x1AC0}, {0x1B00, 0x1B4B}, {0x1B50, 0x1B7C}, - {0x1B80, 0x1BF3}, {0x1BFC, 0x1C37}, {0x1C3B, 0x1C49}, - {0x1C4D, 0x1C88}, {0x1C90, 0x1CBA}, {0x1CBD, 0x1CC7}, - {0x1CD0, 0x1CFA}, {0x1D00, 0x1DF9}, {0x1DFB, 0x1F15}, + {0x1700, 0x1715}, {0x171F, 0x1736}, {0x1740, 0x1753}, + {0x1760, 0x176C}, {0x176E, 0x1770}, {0x1772, 0x1773}, + {0x1780, 0x17DD}, {0x17E0, 0x17E9}, {0x17F0, 0x17F9}, + {0x1800, 0x1819}, {0x1820, 0x1878}, {0x1880, 0x18AA}, + {0x18B0, 0x18F5}, {0x1900, 0x191E}, {0x1920, 0x192B}, + {0x1930, 0x193B}, {0x1940, 0x1940}, {0x1944, 0x196D}, + {0x1970, 0x1974}, {0x1980, 0x19AB}, {0x19B0, 0x19C9}, + {0x19D0, 0x19DA}, {0x19DE, 0x1A1B}, {0x1A1E, 0x1A5E}, + {0x1A60, 0x1A7C}, {0x1A7F, 0x1A89}, {0x1A90, 0x1A99}, + {0x1AA0, 0x1AAD}, {0x1AB0, 0x1ACE}, {0x1B00, 0x1B4C}, + {0x1B50, 0x1B7E}, {0x1B80, 0x1BF3}, {0x1BFC, 0x1C37}, + {0x1C3B, 0x1C49}, {0x1C4D, 0x1C88}, {0x1C90, 0x1CBA}, + {0x1CBD, 0x1CC7}, {0x1CD0, 0x1CFA}, {0x1D00, 0x1F15}, {0x1F18, 0x1F1D}, {0x1F20, 0x1F45}, {0x1F48, 0x1F4D}, {0x1F50, 0x1F57}, {0x1F59, 0x1F59}, {0x1F5B, 0x1F5B}, {0x1F5D, 0x1F5D}, {0x1F5F, 0x1F7D}, {0x1F80, 0x1FB4}, @@ -237,7 +238,7 @@ var neutral = table{ {0x2036, 0x203A}, {0x203C, 0x203D}, {0x203F, 0x2064}, {0x2066, 0x2071}, {0x2075, 0x207E}, {0x2080, 0x2080}, {0x2085, 0x208E}, {0x2090, 0x209C}, {0x20A0, 0x20A8}, - {0x20AA, 0x20AB}, {0x20AD, 0x20BF}, {0x20D0, 0x20F0}, + {0x20AA, 0x20AB}, {0x20AD, 0x20C0}, {0x20D0, 0x20F0}, {0x2100, 0x2102}, {0x2104, 0x2104}, {0x2106, 0x2108}, {0x210A, 0x2112}, {0x2114, 0x2115}, {0x2117, 0x2120}, {0x2123, 0x2125}, {0x2127, 0x212A}, {0x212C, 0x2152}, @@ -275,15 +276,15 @@ var neutral = table{ {0x2780, 0x2794}, {0x2798, 0x27AF}, {0x27B1, 0x27BE}, {0x27C0, 0x27E5}, {0x27EE, 0x2984}, {0x2987, 0x2B1A}, {0x2B1D, 0x2B4F}, {0x2B51, 0x2B54}, {0x2B5A, 0x2B73}, - {0x2B76, 0x2B95}, {0x2B97, 0x2C2E}, {0x2C30, 0x2C5E}, - {0x2C60, 0x2CF3}, {0x2CF9, 0x2D25}, {0x2D27, 0x2D27}, - {0x2D2D, 0x2D2D}, {0x2D30, 0x2D67}, {0x2D6F, 0x2D70}, - {0x2D7F, 0x2D96}, {0x2DA0, 0x2DA6}, {0x2DA8, 0x2DAE}, - {0x2DB0, 0x2DB6}, {0x2DB8, 0x2DBE}, {0x2DC0, 0x2DC6}, - {0x2DC8, 0x2DCE}, {0x2DD0, 0x2DD6}, {0x2DD8, 0x2DDE}, - {0x2DE0, 0x2E52}, {0x303F, 0x303F}, {0x4DC0, 0x4DFF}, - {0xA4D0, 0xA62B}, {0xA640, 0xA6F7}, {0xA700, 0xA7BF}, - {0xA7C2, 0xA7CA}, {0xA7F5, 0xA82C}, {0xA830, 0xA839}, + {0x2B76, 0x2B95}, {0x2B97, 0x2CF3}, {0x2CF9, 0x2D25}, + {0x2D27, 0x2D27}, {0x2D2D, 0x2D2D}, {0x2D30, 0x2D67}, + {0x2D6F, 0x2D70}, {0x2D7F, 0x2D96}, {0x2DA0, 0x2DA6}, + {0x2DA8, 0x2DAE}, {0x2DB0, 0x2DB6}, {0x2DB8, 0x2DBE}, + {0x2DC0, 0x2DC6}, {0x2DC8, 0x2DCE}, {0x2DD0, 0x2DD6}, + {0x2DD8, 0x2DDE}, {0x2DE0, 0x2E5D}, {0x303F, 0x303F}, + {0x4DC0, 0x4DFF}, {0xA4D0, 0xA62B}, {0xA640, 0xA6F7}, + {0xA700, 0xA7CA}, {0xA7D0, 0xA7D1}, {0xA7D3, 0xA7D3}, + {0xA7D5, 0xA7D9}, {0xA7F2, 0xA82C}, {0xA830, 0xA839}, {0xA840, 0xA877}, {0xA880, 0xA8C5}, {0xA8CE, 0xA8D9}, {0xA8E0, 0xA953}, {0xA95F, 0xA95F}, {0xA980, 0xA9CD}, {0xA9CF, 0xA9D9}, {0xA9DE, 0xA9FE}, {0xAA00, 0xAA36}, @@ -294,8 +295,8 @@ var neutral = table{ {0xD7B0, 0xD7C6}, {0xD7CB, 0xD7FB}, {0xD800, 0xDFFF}, {0xFB00, 0xFB06}, {0xFB13, 0xFB17}, {0xFB1D, 0xFB36}, {0xFB38, 0xFB3C}, {0xFB3E, 0xFB3E}, {0xFB40, 0xFB41}, - {0xFB43, 0xFB44}, {0xFB46, 0xFBC1}, {0xFBD3, 0xFD3F}, - {0xFD50, 0xFD8F}, {0xFD92, 0xFDC7}, {0xFDF0, 0xFDFD}, + {0xFB43, 0xFB44}, {0xFB46, 0xFBC2}, {0xFBD3, 0xFD8F}, + {0xFD92, 0xFDC7}, {0xFDCF, 0xFDCF}, {0xFDF0, 0xFDFF}, {0xFE20, 0xFE2F}, {0xFE70, 0xFE74}, {0xFE76, 0xFEFC}, {0xFEFF, 0xFEFF}, {0xFFF9, 0xFFFC}, {0x10000, 0x1000B}, {0x1000D, 0x10026}, {0x10028, 0x1003A}, {0x1003C, 0x1003D}, @@ -307,44 +308,48 @@ var neutral = table{ {0x10380, 0x1039D}, {0x1039F, 0x103C3}, {0x103C8, 0x103D5}, {0x10400, 0x1049D}, {0x104A0, 0x104A9}, {0x104B0, 0x104D3}, {0x104D8, 0x104FB}, {0x10500, 0x10527}, {0x10530, 0x10563}, - {0x1056F, 0x1056F}, {0x10600, 0x10736}, {0x10740, 0x10755}, - {0x10760, 0x10767}, {0x10800, 0x10805}, {0x10808, 0x10808}, - {0x1080A, 0x10835}, {0x10837, 0x10838}, {0x1083C, 0x1083C}, - {0x1083F, 0x10855}, {0x10857, 0x1089E}, {0x108A7, 0x108AF}, - {0x108E0, 0x108F2}, {0x108F4, 0x108F5}, {0x108FB, 0x1091B}, - {0x1091F, 0x10939}, {0x1093F, 0x1093F}, {0x10980, 0x109B7}, - {0x109BC, 0x109CF}, {0x109D2, 0x10A03}, {0x10A05, 0x10A06}, - {0x10A0C, 0x10A13}, {0x10A15, 0x10A17}, {0x10A19, 0x10A35}, - {0x10A38, 0x10A3A}, {0x10A3F, 0x10A48}, {0x10A50, 0x10A58}, - {0x10A60, 0x10A9F}, {0x10AC0, 0x10AE6}, {0x10AEB, 0x10AF6}, - {0x10B00, 0x10B35}, {0x10B39, 0x10B55}, {0x10B58, 0x10B72}, - {0x10B78, 0x10B91}, {0x10B99, 0x10B9C}, {0x10BA9, 0x10BAF}, - {0x10C00, 0x10C48}, {0x10C80, 0x10CB2}, {0x10CC0, 0x10CF2}, - {0x10CFA, 0x10D27}, {0x10D30, 0x10D39}, {0x10E60, 0x10E7E}, - {0x10E80, 0x10EA9}, {0x10EAB, 0x10EAD}, {0x10EB0, 0x10EB1}, - {0x10F00, 0x10F27}, {0x10F30, 0x10F59}, {0x10FB0, 0x10FCB}, - {0x10FE0, 0x10FF6}, {0x11000, 0x1104D}, {0x11052, 0x1106F}, - {0x1107F, 0x110C1}, {0x110CD, 0x110CD}, {0x110D0, 0x110E8}, - {0x110F0, 0x110F9}, {0x11100, 0x11134}, {0x11136, 0x11147}, - {0x11150, 0x11176}, {0x11180, 0x111DF}, {0x111E1, 0x111F4}, - {0x11200, 0x11211}, {0x11213, 0x1123E}, {0x11280, 0x11286}, - {0x11288, 0x11288}, {0x1128A, 0x1128D}, {0x1128F, 0x1129D}, - {0x1129F, 0x112A9}, {0x112B0, 0x112EA}, {0x112F0, 0x112F9}, - {0x11300, 0x11303}, {0x11305, 0x1130C}, {0x1130F, 0x11310}, - {0x11313, 0x11328}, {0x1132A, 0x11330}, {0x11332, 0x11333}, - {0x11335, 0x11339}, {0x1133B, 0x11344}, {0x11347, 0x11348}, - {0x1134B, 0x1134D}, {0x11350, 0x11350}, {0x11357, 0x11357}, - {0x1135D, 0x11363}, {0x11366, 0x1136C}, {0x11370, 0x11374}, - {0x11400, 0x1145B}, {0x1145D, 0x11461}, {0x11480, 0x114C7}, - {0x114D0, 0x114D9}, {0x11580, 0x115B5}, {0x115B8, 0x115DD}, - {0x11600, 0x11644}, {0x11650, 0x11659}, {0x11660, 0x1166C}, - {0x11680, 0x116B8}, {0x116C0, 0x116C9}, {0x11700, 0x1171A}, - {0x1171D, 0x1172B}, {0x11730, 0x1173F}, {0x11800, 0x1183B}, - {0x118A0, 0x118F2}, {0x118FF, 0x11906}, {0x11909, 0x11909}, - {0x1190C, 0x11913}, {0x11915, 0x11916}, {0x11918, 0x11935}, - {0x11937, 0x11938}, {0x1193B, 0x11946}, {0x11950, 0x11959}, - {0x119A0, 0x119A7}, {0x119AA, 0x119D7}, {0x119DA, 0x119E4}, - {0x11A00, 0x11A47}, {0x11A50, 0x11AA2}, {0x11AC0, 0x11AF8}, + {0x1056F, 0x1057A}, {0x1057C, 0x1058A}, {0x1058C, 0x10592}, + {0x10594, 0x10595}, {0x10597, 0x105A1}, {0x105A3, 0x105B1}, + {0x105B3, 0x105B9}, {0x105BB, 0x105BC}, {0x10600, 0x10736}, + {0x10740, 0x10755}, {0x10760, 0x10767}, {0x10780, 0x10785}, + {0x10787, 0x107B0}, {0x107B2, 0x107BA}, {0x10800, 0x10805}, + {0x10808, 0x10808}, {0x1080A, 0x10835}, {0x10837, 0x10838}, + {0x1083C, 0x1083C}, {0x1083F, 0x10855}, {0x10857, 0x1089E}, + {0x108A7, 0x108AF}, {0x108E0, 0x108F2}, {0x108F4, 0x108F5}, + {0x108FB, 0x1091B}, {0x1091F, 0x10939}, {0x1093F, 0x1093F}, + {0x10980, 0x109B7}, {0x109BC, 0x109CF}, {0x109D2, 0x10A03}, + {0x10A05, 0x10A06}, {0x10A0C, 0x10A13}, {0x10A15, 0x10A17}, + {0x10A19, 0x10A35}, {0x10A38, 0x10A3A}, {0x10A3F, 0x10A48}, + {0x10A50, 0x10A58}, {0x10A60, 0x10A9F}, {0x10AC0, 0x10AE6}, + {0x10AEB, 0x10AF6}, {0x10B00, 0x10B35}, {0x10B39, 0x10B55}, + {0x10B58, 0x10B72}, {0x10B78, 0x10B91}, {0x10B99, 0x10B9C}, + {0x10BA9, 0x10BAF}, {0x10C00, 0x10C48}, {0x10C80, 0x10CB2}, + {0x10CC0, 0x10CF2}, {0x10CFA, 0x10D27}, {0x10D30, 0x10D39}, + {0x10E60, 0x10E7E}, {0x10E80, 0x10EA9}, {0x10EAB, 0x10EAD}, + {0x10EB0, 0x10EB1}, {0x10EFD, 0x10F27}, {0x10F30, 0x10F59}, + {0x10F70, 0x10F89}, {0x10FB0, 0x10FCB}, {0x10FE0, 0x10FF6}, + {0x11000, 0x1104D}, {0x11052, 0x11075}, {0x1107F, 0x110C2}, + {0x110CD, 0x110CD}, {0x110D0, 0x110E8}, {0x110F0, 0x110F9}, + {0x11100, 0x11134}, {0x11136, 0x11147}, {0x11150, 0x11176}, + {0x11180, 0x111DF}, {0x111E1, 0x111F4}, {0x11200, 0x11211}, + {0x11213, 0x11241}, {0x11280, 0x11286}, {0x11288, 0x11288}, + {0x1128A, 0x1128D}, {0x1128F, 0x1129D}, {0x1129F, 0x112A9}, + {0x112B0, 0x112EA}, {0x112F0, 0x112F9}, {0x11300, 0x11303}, + {0x11305, 0x1130C}, {0x1130F, 0x11310}, {0x11313, 0x11328}, + {0x1132A, 0x11330}, {0x11332, 0x11333}, {0x11335, 0x11339}, + {0x1133B, 0x11344}, {0x11347, 0x11348}, {0x1134B, 0x1134D}, + {0x11350, 0x11350}, {0x11357, 0x11357}, {0x1135D, 0x11363}, + {0x11366, 0x1136C}, {0x11370, 0x11374}, {0x11400, 0x1145B}, + {0x1145D, 0x11461}, {0x11480, 0x114C7}, {0x114D0, 0x114D9}, + {0x11580, 0x115B5}, {0x115B8, 0x115DD}, {0x11600, 0x11644}, + {0x11650, 0x11659}, {0x11660, 0x1166C}, {0x11680, 0x116B9}, + {0x116C0, 0x116C9}, {0x11700, 0x1171A}, {0x1171D, 0x1172B}, + {0x11730, 0x11746}, {0x11800, 0x1183B}, {0x118A0, 0x118F2}, + {0x118FF, 0x11906}, {0x11909, 0x11909}, {0x1190C, 0x11913}, + {0x11915, 0x11916}, {0x11918, 0x11935}, {0x11937, 0x11938}, + {0x1193B, 0x11946}, {0x11950, 0x11959}, {0x119A0, 0x119A7}, + {0x119AA, 0x119D7}, {0x119DA, 0x119E4}, {0x11A00, 0x11A47}, + {0x11A50, 0x11AA2}, {0x11AB0, 0x11AF8}, {0x11B00, 0x11B09}, {0x11C00, 0x11C08}, {0x11C0A, 0x11C36}, {0x11C38, 0x11C45}, {0x11C50, 0x11C6C}, {0x11C70, 0x11C8F}, {0x11C92, 0x11CA7}, {0x11CA9, 0x11CB6}, {0x11D00, 0x11D06}, {0x11D08, 0x11D09}, @@ -352,30 +357,36 @@ var neutral = table{ {0x11D3F, 0x11D47}, {0x11D50, 0x11D59}, {0x11D60, 0x11D65}, {0x11D67, 0x11D68}, {0x11D6A, 0x11D8E}, {0x11D90, 0x11D91}, {0x11D93, 0x11D98}, {0x11DA0, 0x11DA9}, {0x11EE0, 0x11EF8}, + {0x11F00, 0x11F10}, {0x11F12, 0x11F3A}, {0x11F3E, 0x11F59}, {0x11FB0, 0x11FB0}, {0x11FC0, 0x11FF1}, {0x11FFF, 0x12399}, {0x12400, 0x1246E}, {0x12470, 0x12474}, {0x12480, 0x12543}, - {0x13000, 0x1342E}, {0x13430, 0x13438}, {0x14400, 0x14646}, + {0x12F90, 0x12FF2}, {0x13000, 0x13455}, {0x14400, 0x14646}, {0x16800, 0x16A38}, {0x16A40, 0x16A5E}, {0x16A60, 0x16A69}, - {0x16A6E, 0x16A6F}, {0x16AD0, 0x16AED}, {0x16AF0, 0x16AF5}, - {0x16B00, 0x16B45}, {0x16B50, 0x16B59}, {0x16B5B, 0x16B61}, - {0x16B63, 0x16B77}, {0x16B7D, 0x16B8F}, {0x16E40, 0x16E9A}, - {0x16F00, 0x16F4A}, {0x16F4F, 0x16F87}, {0x16F8F, 0x16F9F}, - {0x1BC00, 0x1BC6A}, {0x1BC70, 0x1BC7C}, {0x1BC80, 0x1BC88}, - {0x1BC90, 0x1BC99}, {0x1BC9C, 0x1BCA3}, {0x1D000, 0x1D0F5}, - {0x1D100, 0x1D126}, {0x1D129, 0x1D1E8}, {0x1D200, 0x1D245}, - {0x1D2E0, 0x1D2F3}, {0x1D300, 0x1D356}, {0x1D360, 0x1D378}, - {0x1D400, 0x1D454}, {0x1D456, 0x1D49C}, {0x1D49E, 0x1D49F}, - {0x1D4A2, 0x1D4A2}, {0x1D4A5, 0x1D4A6}, {0x1D4A9, 0x1D4AC}, - {0x1D4AE, 0x1D4B9}, {0x1D4BB, 0x1D4BB}, {0x1D4BD, 0x1D4C3}, - {0x1D4C5, 0x1D505}, {0x1D507, 0x1D50A}, {0x1D50D, 0x1D514}, - {0x1D516, 0x1D51C}, {0x1D51E, 0x1D539}, {0x1D53B, 0x1D53E}, - {0x1D540, 0x1D544}, {0x1D546, 0x1D546}, {0x1D54A, 0x1D550}, - {0x1D552, 0x1D6A5}, {0x1D6A8, 0x1D7CB}, {0x1D7CE, 0x1DA8B}, - {0x1DA9B, 0x1DA9F}, {0x1DAA1, 0x1DAAF}, {0x1E000, 0x1E006}, - {0x1E008, 0x1E018}, {0x1E01B, 0x1E021}, {0x1E023, 0x1E024}, - {0x1E026, 0x1E02A}, {0x1E100, 0x1E12C}, {0x1E130, 0x1E13D}, - {0x1E140, 0x1E149}, {0x1E14E, 0x1E14F}, {0x1E2C0, 0x1E2F9}, - {0x1E2FF, 0x1E2FF}, {0x1E800, 0x1E8C4}, {0x1E8C7, 0x1E8D6}, + {0x16A6E, 0x16ABE}, {0x16AC0, 0x16AC9}, {0x16AD0, 0x16AED}, + {0x16AF0, 0x16AF5}, {0x16B00, 0x16B45}, {0x16B50, 0x16B59}, + {0x16B5B, 0x16B61}, {0x16B63, 0x16B77}, {0x16B7D, 0x16B8F}, + {0x16E40, 0x16E9A}, {0x16F00, 0x16F4A}, {0x16F4F, 0x16F87}, + {0x16F8F, 0x16F9F}, {0x1BC00, 0x1BC6A}, {0x1BC70, 0x1BC7C}, + {0x1BC80, 0x1BC88}, {0x1BC90, 0x1BC99}, {0x1BC9C, 0x1BCA3}, + {0x1CF00, 0x1CF2D}, {0x1CF30, 0x1CF46}, {0x1CF50, 0x1CFC3}, + {0x1D000, 0x1D0F5}, {0x1D100, 0x1D126}, {0x1D129, 0x1D1EA}, + {0x1D200, 0x1D245}, {0x1D2C0, 0x1D2D3}, {0x1D2E0, 0x1D2F3}, + {0x1D300, 0x1D356}, {0x1D360, 0x1D378}, {0x1D400, 0x1D454}, + {0x1D456, 0x1D49C}, {0x1D49E, 0x1D49F}, {0x1D4A2, 0x1D4A2}, + {0x1D4A5, 0x1D4A6}, {0x1D4A9, 0x1D4AC}, {0x1D4AE, 0x1D4B9}, + {0x1D4BB, 0x1D4BB}, {0x1D4BD, 0x1D4C3}, {0x1D4C5, 0x1D505}, + {0x1D507, 0x1D50A}, {0x1D50D, 0x1D514}, {0x1D516, 0x1D51C}, + {0x1D51E, 0x1D539}, {0x1D53B, 0x1D53E}, {0x1D540, 0x1D544}, + {0x1D546, 0x1D546}, {0x1D54A, 0x1D550}, {0x1D552, 0x1D6A5}, + {0x1D6A8, 0x1D7CB}, {0x1D7CE, 0x1DA8B}, {0x1DA9B, 0x1DA9F}, + {0x1DAA1, 0x1DAAF}, {0x1DF00, 0x1DF1E}, {0x1DF25, 0x1DF2A}, + {0x1E000, 0x1E006}, {0x1E008, 0x1E018}, {0x1E01B, 0x1E021}, + {0x1E023, 0x1E024}, {0x1E026, 0x1E02A}, {0x1E030, 0x1E06D}, + {0x1E08F, 0x1E08F}, {0x1E100, 0x1E12C}, {0x1E130, 0x1E13D}, + {0x1E140, 0x1E149}, {0x1E14E, 0x1E14F}, {0x1E290, 0x1E2AE}, + {0x1E2C0, 0x1E2F9}, {0x1E2FF, 0x1E2FF}, {0x1E4D0, 0x1E4F9}, + {0x1E7E0, 0x1E7E6}, {0x1E7E8, 0x1E7EB}, {0x1E7ED, 0x1E7EE}, + {0x1E7F0, 0x1E7FE}, {0x1E800, 0x1E8C4}, {0x1E8C7, 0x1E8D6}, {0x1E900, 0x1E94B}, {0x1E950, 0x1E959}, {0x1E95E, 0x1E95F}, {0x1EC71, 0x1ECB4}, {0x1ED01, 0x1ED3D}, {0x1EE00, 0x1EE03}, {0x1EE05, 0x1EE1F}, {0x1EE21, 0x1EE22}, {0x1EE24, 0x1EE24}, @@ -400,8 +411,8 @@ var neutral = table{ {0x1F54F, 0x1F54F}, {0x1F568, 0x1F579}, {0x1F57B, 0x1F594}, {0x1F597, 0x1F5A3}, {0x1F5A5, 0x1F5FA}, {0x1F650, 0x1F67F}, {0x1F6C6, 0x1F6CB}, {0x1F6CD, 0x1F6CF}, {0x1F6D3, 0x1F6D4}, - {0x1F6E0, 0x1F6EA}, {0x1F6F0, 0x1F6F3}, {0x1F700, 0x1F773}, - {0x1F780, 0x1F7D8}, {0x1F800, 0x1F80B}, {0x1F810, 0x1F847}, + {0x1F6E0, 0x1F6EA}, {0x1F6F0, 0x1F6F3}, {0x1F700, 0x1F776}, + {0x1F77B, 0x1F7D9}, {0x1F800, 0x1F80B}, {0x1F810, 0x1F847}, {0x1F850, 0x1F859}, {0x1F860, 0x1F887}, {0x1F890, 0x1F8AD}, {0x1F8B0, 0x1F8B1}, {0x1F900, 0x1F90B}, {0x1F93B, 0x1F93B}, {0x1F946, 0x1F946}, {0x1FA00, 0x1FA53}, {0x1FA60, 0x1FA6D}, diff --git a/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c b/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c index 53d7560e..52ee2a3d 100644 --- a/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c +++ b/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c @@ -1,7 +1,7 @@ #ifndef USE_LIBSQLITE3 /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.45.1. By combining all the individual C code files into this +** version 3.46.1. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -19,7 +19,7 @@ ** separate file. This file contains only code for the core SQLite library. ** ** The content in this amalgamation comes from Fossil check-in -** e876e51a0ed5c5b3126f52e532044363a014. +** c9c2ab54ba1f5f46360f1b4f35d849cd3f08. */ #define SQLITE_CORE 1 #define SQLITE_AMALGAMATION 1 @@ -460,9 +460,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.45.1" -#define SQLITE_VERSION_NUMBER 3045001 -#define SQLITE_SOURCE_ID "2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a" +#define SQLITE_VERSION "3.46.1" +#define SQLITE_VERSION_NUMBER 3046001 +#define SQLITE_SOURCE_ID "2024-08-13 09:16:08 c9c2ab54ba1f5f46360f1b4f35d849cd3f080e6fc2b6c60e91b16c63f69a1e33" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -734,6 +734,8 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**); ** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running. **
  • The application must not modify the SQL statement text passed into ** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running. +**
  • The application must not dereference the arrays or string pointers +** passed as the 3rd and 4th callback parameters after it returns. ** */ SQLITE_API int sqlite3_exec( @@ -1076,11 +1078,11 @@ struct sqlite3_file { ** ** xLock() upgrades the database file lock. In other words, xLock() moves the ** database file lock in the direction NONE toward EXCLUSIVE. The argument to -** xLock() is always on of SHARED, RESERVED, PENDING, or EXCLUSIVE, never +** xLock() is always one of SHARED, RESERVED, PENDING, or EXCLUSIVE, never ** SQLITE_LOCK_NONE. If the database file lock is already at or above the ** requested lock, then the call to xLock() is a no-op. ** xUnlock() downgrades the database file lock to either SHARED or NONE. -* If the lock is already at or below the requested lock state, then the call +** If the lock is already at or below the requested lock state, then the call ** to xUnlock() is a no-op. ** The xCheckReservedLock() method checks whether any database connection, ** either in this process or in some other process, is holding a RESERVED, @@ -2455,6 +2457,22 @@ struct sqlite3_mem_methods { ** configuration setting is never used, then the default maximum is determined ** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that ** compile-time option is not set, then the default maximum is 1073741824. +** +** [[SQLITE_CONFIG_ROWID_IN_VIEW]] +**
    SQLITE_CONFIG_ROWID_IN_VIEW +**
    The SQLITE_CONFIG_ROWID_IN_VIEW option enables or disables the ability +** for VIEWs to have a ROWID. The capability can only be enabled if SQLite is +** compiled with -DSQLITE_ALLOW_ROWID_IN_VIEW, in which case the capability +** defaults to on. This configuration option queries the current setting or +** changes the setting to off or on. The argument is a pointer to an integer. +** If that integer initially holds a value of 1, then the ability for VIEWs to +** have ROWIDs is activated. If the integer initially holds zero, then the +** ability is deactivated. Any other initial value for the integer leaves the +** setting unchanged. After changes, if any, the integer is written with +** a 1 or 0, if the ability for VIEWs to have ROWIDs is on or off. If SQLite +** is compiled without -DSQLITE_ALLOW_ROWID_IN_VIEW (which is the usual and +** recommended case) then the integer is always filled with zero, regardless +** if its initial value. ** */ #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ @@ -2486,6 +2504,7 @@ struct sqlite3_mem_methods { #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */ #define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */ #define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */ +#define SQLITE_CONFIG_ROWID_IN_VIEW 30 /* int* */ /* ** CAPI3REF: Database Connection Configuration Options @@ -3600,8 +3619,8 @@ SQLITE_API int sqlite3_set_authorizer( #define SQLITE_RECURSIVE 33 /* NULL NULL */ /* -** CAPI3REF: Tracing And Profiling Functions -** METHOD: sqlite3 +** CAPI3REF: Deprecated Tracing And Profiling Functions +** DEPRECATED ** ** These routines are deprecated. Use the [sqlite3_trace_v2()] interface ** instead of the routines described here. @@ -7182,6 +7201,12 @@ SQLITE_API int sqlite3_autovacuum_pages( ** The exceptions defined in this paragraph might change in a future ** release of SQLite. ** +** Whether the update hook is invoked before or after the +** corresponding change is currently unspecified and may differ +** depending on the type of change. Do not rely on the order of the +** hook call with regards to the final result of the operation which +** triggers the hook. +** ** The update hook implementation must not do anything that will modify ** the database connection that invoked the update hook. Any actions ** to modify the database connection must be deferred until after the @@ -8652,7 +8677,7 @@ SQLITE_API int sqlite3_test_control(int op, ...); ** The sqlite3_keyword_count() interface returns the number of distinct ** keywords understood by SQLite. ** -** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and +** The sqlite3_keyword_name(N,Z,L) interface finds the 0-based N-th keyword and ** makes *Z point to that keyword expressed as UTF8 and writes the number ** of bytes in the keyword into *L. The string that *Z points to is not ** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns @@ -10231,24 +10256,45 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int); **
  • ** ^(If the sqlite3_vtab_distinct() interface returns 2, that means ** that the query planner does not need the rows returned in any particular -** order, as long as rows with the same values in all "aOrderBy" columns -** are adjacent.)^ ^(Furthermore, only a single row for each particular -** combination of values in the columns identified by the "aOrderBy" field -** needs to be returned.)^ ^It is always ok for two or more rows with the same -** values in all "aOrderBy" columns to be returned, as long as all such rows -** are adjacent. ^The virtual table may, if it chooses, omit extra rows -** that have the same value for all columns identified by "aOrderBy". -** ^However omitting the extra rows is optional. +** order, as long as rows with the same values in all columns identified +** by "aOrderBy" are adjacent.)^ ^(Furthermore, when two or more rows +** contain the same values for all columns identified by "colUsed", all but +** one such row may optionally be omitted from the result.)^ +** The virtual table is not required to omit rows that are duplicates +** over the "colUsed" columns, but if the virtual table can do that without +** too much extra effort, it could potentially help the query to run faster. ** This mode is used for a DISTINCT query. **

  • -** ^(If the sqlite3_vtab_distinct() interface returns 3, that means -** that the query planner needs only distinct rows but it does need the -** rows to be sorted.)^ ^The virtual table implementation is free to omit -** rows that are identical in all aOrderBy columns, if it wants to, but -** it is not required to omit any rows. This mode is used for queries +** ^(If the sqlite3_vtab_distinct() interface returns 3, that means the +** virtual table must return rows in the order defined by "aOrderBy" as +** if the sqlite3_vtab_distinct() interface had returned 0. However if +** two or more rows in the result have the same values for all columns +** identified by "colUsed", then all but one such row may optionally be +** omitted.)^ Like when the return value is 2, the virtual table +** is not required to omit rows that are duplicates over the "colUsed" +** columns, but if the virtual table can do that without +** too much extra effort, it could potentially help the query to run faster. +** This mode is used for queries ** that have both DISTINCT and ORDER BY clauses. ** ** +**

    The following table summarizes the conditions under which the +** virtual table is allowed to set the "orderByConsumed" flag based on +** the value returned by sqlite3_vtab_distinct(). This table is a +** restatement of the previous four paragraphs: +** +** +** +**
    sqlite3_vtab_distinct() return value +** Rows are returned in aOrderBy order +** Rows with the same value in all aOrderBy columns are adjacent +** Duplicates over all colUsed columns may be omitted +**
    0yesyesno +**
    1noyesno +**
    2noyesyes +**
    3yesyesyes +**
    +** ** ^For the purposes of comparing virtual table output values to see if the ** values are same value for sorting purposes, two NULL values are considered ** to be the same. In other words, the comparison operator is "IS" @@ -12293,6 +12339,30 @@ SQLITE_API int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const c */ SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); +/* +** CAPI3REF: Add A Single Change To A Changegroup +** METHOD: sqlite3_changegroup +** +** This function adds the single change currently indicated by the iterator +** passed as the second argument to the changegroup object. The rules for +** adding the change are just as described for [sqlite3changegroup_add()]. +** +** If the change is successfully added to the changegroup, SQLITE_OK is +** returned. Otherwise, an SQLite error code is returned. +** +** The iterator must point to a valid entry when this function is called. +** If it does not, SQLITE_ERROR is returned and no change is added to the +** changegroup. Additionally, the iterator must not have been opened with +** the SQLITE_CHANGESETAPPLY_INVERT flag. In this case SQLITE_ERROR is also +** returned. +*/ +SQLITE_API int sqlite3changegroup_add_change( + sqlite3_changegroup*, + sqlite3_changeset_iter* +); + + + /* ** CAPI3REF: Obtain A Composite Changeset From A Changegroup ** METHOD: sqlite3_changegroup @@ -13097,8 +13167,8 @@ struct Fts5PhraseIter { ** EXTENSION API FUNCTIONS ** ** xUserData(pFts): -** Return a copy of the context pointer the extension function was -** registered with. +** Return a copy of the pUserData pointer passed to the xCreateFunction() +** API when the extension function was registered. ** ** xColumnTotalSize(pFts, iCol, pnToken): ** If parameter iCol is less than zero, set output variable *pnToken @@ -14296,6 +14366,8 @@ struct fts5_api { # define SQLITE_OMIT_ALTERTABLE #endif +#define SQLITE_DIGIT_SEPARATOR '_' + /* ** Return true (non-zero) if the input is an integer that is too large ** to fit in 32-bits. This macro is used inside of various testcase() @@ -14588,8 +14660,8 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*); #define TK_TRUEFALSE 170 #define TK_ISNOT 171 #define TK_FUNCTION 172 -#define TK_UMINUS 173 -#define TK_UPLUS 174 +#define TK_UPLUS 173 +#define TK_UMINUS 174 #define TK_TRUTH 175 #define TK_REGISTER 176 #define TK_VECTOR 177 @@ -14598,8 +14670,9 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*); #define TK_ASTERISK 180 #define TK_SPAN 181 #define TK_ERROR 182 -#define TK_SPACE 183 -#define TK_ILLEGAL 184 +#define TK_QNUMBER 183 +#define TK_SPACE 184 +#define TK_ILLEGAL 185 /************** End of parse.h ***********************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ @@ -14861,7 +14934,7 @@ typedef INT16_TYPE LogEst; # define SQLITE_PTRSIZE __SIZEOF_POINTER__ # elif defined(i386) || defined(__i386__) || defined(_M_IX86) || \ defined(_M_ARM) || defined(__arm__) || defined(__x86) || \ - (defined(__APPLE__) && defined(__POWERPC__)) || \ + (defined(__APPLE__) && defined(__ppc__)) || \ (defined(__TOS_AIX__) && !defined(__64BIT__)) # define SQLITE_PTRSIZE 4 # else @@ -15098,6 +15171,7 @@ SQLITE_PRIVATE u32 sqlite3TreeTrace; ** 0x00010000 Beginning of DELETE/INSERT/UPDATE processing ** 0x00020000 Transform DISTINCT into GROUP BY ** 0x00040000 SELECT tree dump after all code has been generated +** 0x00080000 NOT NULL strength reduction */ /* @@ -15128,7 +15202,7 @@ SQLITE_PRIVATE u32 sqlite3WhereTrace; ** 0x00000010 Display sqlite3_index_info xBestIndex calls ** 0x00000020 Range an equality scan metrics ** 0x00000040 IN operator decisions -** 0x00000080 WhereLoop cost adjustements +** 0x00000080 WhereLoop cost adjustments ** 0x00000100 ** 0x00000200 Covering index decisions ** 0x00000400 OR optimization @@ -16277,6 +16351,7 @@ SQLITE_PRIVATE int sqlite3BtreeIntegrityCheck( sqlite3 *db, /* Database connection that is running the check */ Btree *p, /* The btree to be checked */ Pgno *aRoot, /* An array of root pages numbers for individual trees */ + sqlite3_value *aCnt, /* OUT: entry counts for each btree in aRoot[] */ int nRoot, /* Number of entries in aRoot[] */ int mxErr, /* Stop reporting errors after this many */ int *pnErr, /* OUT: Write number of errors seen to this variable */ @@ -16547,12 +16622,12 @@ typedef struct VdbeOpList VdbeOpList; #define OP_Vacuum 5 #define OP_VFilter 6 /* jump, synopsis: iplan=r[P3] zplan='P4' */ #define OP_VUpdate 7 /* synopsis: data=r[P3@P2] */ -#define OP_Init 8 /* jump, synopsis: Start at P2 */ +#define OP_Init 8 /* jump0, synopsis: Start at P2 */ #define OP_Goto 9 /* jump */ #define OP_Gosub 10 /* jump */ -#define OP_InitCoroutine 11 /* jump */ -#define OP_Yield 12 /* jump */ -#define OP_MustBeInt 13 /* jump */ +#define OP_InitCoroutine 11 /* jump0 */ +#define OP_Yield 12 /* jump0 */ +#define OP_MustBeInt 13 /* jump0 */ #define OP_Jump 14 /* jump */ #define OP_Once 15 /* jump */ #define OP_If 16 /* jump */ @@ -16560,22 +16635,22 @@ typedef struct VdbeOpList VdbeOpList; #define OP_IsType 18 /* jump, synopsis: if typeof(P1.P3) in P5 goto P2 */ #define OP_Not 19 /* same as TK_NOT, synopsis: r[P2]= !r[P1] */ #define OP_IfNullRow 20 /* jump, synopsis: if P1.nullRow then r[P3]=NULL, goto P2 */ -#define OP_SeekLT 21 /* jump, synopsis: key=r[P3@P4] */ -#define OP_SeekLE 22 /* jump, synopsis: key=r[P3@P4] */ -#define OP_SeekGE 23 /* jump, synopsis: key=r[P3@P4] */ -#define OP_SeekGT 24 /* jump, synopsis: key=r[P3@P4] */ +#define OP_SeekLT 21 /* jump0, synopsis: key=r[P3@P4] */ +#define OP_SeekLE 22 /* jump0, synopsis: key=r[P3@P4] */ +#define OP_SeekGE 23 /* jump0, synopsis: key=r[P3@P4] */ +#define OP_SeekGT 24 /* jump0, synopsis: key=r[P3@P4] */ #define OP_IfNotOpen 25 /* jump, synopsis: if( !csr[P1] ) goto P2 */ #define OP_IfNoHope 26 /* jump, synopsis: key=r[P3@P4] */ #define OP_NoConflict 27 /* jump, synopsis: key=r[P3@P4] */ #define OP_NotFound 28 /* jump, synopsis: key=r[P3@P4] */ #define OP_Found 29 /* jump, synopsis: key=r[P3@P4] */ -#define OP_SeekRowid 30 /* jump, synopsis: intkey=r[P3] */ +#define OP_SeekRowid 30 /* jump0, synopsis: intkey=r[P3] */ #define OP_NotExists 31 /* jump, synopsis: intkey=r[P3] */ -#define OP_Last 32 /* jump */ -#define OP_IfSmaller 33 /* jump */ +#define OP_Last 32 /* jump0 */ +#define OP_IfSizeBetween 33 /* jump */ #define OP_SorterSort 34 /* jump */ #define OP_Sort 35 /* jump */ -#define OP_Rewind 36 /* jump */ +#define OP_Rewind 36 /* jump0 */ #define OP_SorterNext 37 /* jump */ #define OP_Prev 38 /* jump */ #define OP_Next 39 /* jump */ @@ -16587,7 +16662,7 @@ typedef struct VdbeOpList VdbeOpList; #define OP_IdxGE 45 /* jump, synopsis: key=r[P3@P4] */ #define OP_RowSetRead 46 /* jump, synopsis: r[P3]=rowset(P1) */ #define OP_RowSetTest 47 /* jump, synopsis: if r[P3] in rowset(P1) goto P2 */ -#define OP_Program 48 /* jump */ +#define OP_Program 48 /* jump0 */ #define OP_FkIfZero 49 /* jump, synopsis: if fkctr[P1]==0 goto P2 */ #define OP_IsNull 50 /* jump, same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */ #define OP_NotNull 51 /* jump, same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */ @@ -16617,7 +16692,7 @@ typedef struct VdbeOpList VdbeOpList; #define OP_Null 75 /* synopsis: r[P2..P3]=NULL */ #define OP_SoftNull 76 /* synopsis: r[P1]=NULL */ #define OP_Blob 77 /* synopsis: r[P2]=P4 (len=P1) */ -#define OP_Variable 78 /* synopsis: r[P2]=parameter(P1,P4) */ +#define OP_Variable 78 /* synopsis: r[P2]=parameter(P1) */ #define OP_Move 79 /* synopsis: r[P2@P3]=r[P1@P3] */ #define OP_Copy 80 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ #define OP_SCopy 81 /* synopsis: r[P2]=r[P1] */ @@ -16741,14 +16816,15 @@ typedef struct VdbeOpList VdbeOpList; #define OPFLG_OUT2 0x10 /* out2: P2 is an output */ #define OPFLG_OUT3 0x20 /* out3: P3 is an output */ #define OPFLG_NCYCLE 0x40 /* ncycle:Cycles count against P1 */ +#define OPFLG_JUMP0 0x80 /* jump0: P2 might be zero */ #define OPFLG_INITIALIZER {\ /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x41, 0x00,\ -/* 8 */ 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x01, 0x01,\ -/* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0x49, 0x49, 0x49,\ -/* 24 */ 0x49, 0x01, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,\ -/* 32 */ 0x41, 0x01, 0x41, 0x41, 0x41, 0x01, 0x41, 0x41,\ +/* 8 */ 0x81, 0x01, 0x01, 0x81, 0x83, 0x83, 0x01, 0x01,\ +/* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0xc9, 0xc9, 0xc9,\ +/* 24 */ 0xc9, 0x01, 0x49, 0x49, 0x49, 0x49, 0xc9, 0x49,\ +/* 32 */ 0xc1, 0x01, 0x41, 0x41, 0xc1, 0x01, 0x41, 0x41,\ /* 40 */ 0x41, 0x41, 0x41, 0x26, 0x26, 0x41, 0x23, 0x0b,\ -/* 48 */ 0x01, 0x01, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ +/* 48 */ 0x81, 0x01, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ /* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x03, 0x03, 0x01, 0x41,\ /* 64 */ 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10,\ /* 72 */ 0x10, 0x10, 0x00, 0x10, 0x00, 0x10, 0x10, 0x00,\ @@ -16908,6 +16984,8 @@ SQLITE_PRIVATE RecordCompare sqlite3VdbeFindCompare(UnpackedRecord*); SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *); SQLITE_PRIVATE int sqlite3VdbeHasSubProgram(Vdbe*); +SQLITE_PRIVATE void sqlite3MemSetArrayInt64(sqlite3_value *aMem, int iIdx, i64 val); + SQLITE_PRIVATE int sqlite3NotPureFunc(sqlite3_context*); #ifdef SQLITE_ENABLE_BYTECODE_VTAB SQLITE_PRIVATE int sqlite3VdbeBytecodeVtabInit(sqlite3*); @@ -17495,6 +17573,10 @@ struct FuncDefHash { }; #define SQLITE_FUNC_HASH(C,L) (((C)+(L))%SQLITE_FUNC_HASH_SZ) +#if defined(SQLITE_USER_AUTHENTICATION) +# warning "The SQLITE_USER_AUTHENTICATION extension is deprecated. \ + See ext/userauth/user-auth.txt for details." +#endif #ifdef SQLITE_USER_AUTHENTICATION /* ** Information held in the "sqlite3" database connection object and used @@ -17798,7 +17880,7 @@ struct sqlite3 { #define SQLITE_CursorHints 0x00000400 /* Add OP_CursorHint opcodes */ #define SQLITE_Stat4 0x00000800 /* Use STAT4 data */ /* TH3 expects this value ^^^^^^^^^^ to be 0x0000800. Don't change it */ -#define SQLITE_PushDown 0x00001000 /* The push-down optimization */ +#define SQLITE_PushDown 0x00001000 /* WHERE-clause push-down opt */ #define SQLITE_SimplifyJoin 0x00002000 /* Convert LEFT JOIN to JOIN */ #define SQLITE_SkipScan 0x00004000 /* Skip-scans */ #define SQLITE_PropagateConst 0x00008000 /* The constant propagation opt */ @@ -18371,8 +18453,7 @@ struct Table { #define TF_HasStored 0x00000040 /* Has one or more STORED columns */ #define TF_HasGenerated 0x00000060 /* Combo: HasVirtual + HasStored */ #define TF_WithoutRowid 0x00000080 /* No rowid. PRIMARY KEY is the key */ -#define TF_StatsUsed 0x00000100 /* Query planner decisions affected by - ** Index.aiRowLogEst[] values */ +#define TF_MaybeReanalyze 0x00000100 /* Maybe run ANALYZE on this table */ #define TF_NoVisibleRowid 0x00000200 /* No user-visible "rowid" column */ #define TF_OOOHidden 0x00000400 /* Out-of-Order hidden columns */ #define TF_HasNotNull 0x00000800 /* Contains NOT NULL constraints */ @@ -18428,6 +18509,15 @@ struct Table { #define HasRowid(X) (((X)->tabFlags & TF_WithoutRowid)==0) #define VisibleRowid(X) (((X)->tabFlags & TF_NoVisibleRowid)==0) +/* Macro is true if the SQLITE_ALLOW_ROWID_IN_VIEW (mis-)feature is +** available. By default, this macro is false +*/ +#ifndef SQLITE_ALLOW_ROWID_IN_VIEW +# define ViewCanHaveRowid 0 +#else +# define ViewCanHaveRowid (sqlite3Config.mNoVisibleRowid==0) +#endif + /* ** Each foreign key constraint is an instance of the following structure. ** @@ -19163,10 +19253,12 @@ struct IdList { ** ** Union member validity: ** -** u1.zIndexedBy fg.isIndexedBy && !fg.isTabFunc -** u1.pFuncArg fg.isTabFunc && !fg.isIndexedBy -** u2.pIBIndex fg.isIndexedBy && !fg.isCte -** u2.pCteUse fg.isCte && !fg.isIndexedBy +** u1.zIndexedBy fg.isIndexedBy && !fg.isTabFunc +** u1.pFuncArg fg.isTabFunc && !fg.isIndexedBy +** u1.nRow !fg.isTabFunc && !fg.isIndexedBy +** +** u2.pIBIndex fg.isIndexedBy && !fg.isCte +** u2.pCteUse fg.isCte && !fg.isIndexedBy */ struct SrcItem { Schema *pSchema; /* Schema to which this item is fixed */ @@ -19194,6 +19286,7 @@ struct SrcItem { unsigned isOn :1; /* u3.pOn was once valid and non-NULL */ unsigned isSynthUsing :1; /* u3.pUsing is synthesized from NATURAL */ unsigned isNestedFrom :1; /* pSelect is a SF_NestedFrom subquery */ + unsigned rowidUsed :1; /* The ROWID of this table is referenced */ } fg; int iCursor; /* The VDBE cursor number used to access this table */ union { @@ -19204,6 +19297,7 @@ struct SrcItem { union { char *zIndexedBy; /* Identifier from "INDEXED BY " clause */ ExprList *pFuncArg; /* Arguments to table-valued-function */ + u32 nRow; /* Number of rows in a VALUES clause */ } u1; union { Index *pIBIndex; /* Index structure corresponding to u1.zIndexedBy */ @@ -19268,7 +19362,7 @@ struct SrcList { #define WHERE_AGG_DISTINCT 0x0400 /* Query is "SELECT agg(DISTINCT ...)" */ #define WHERE_ORDERBY_LIMIT 0x0800 /* ORDERBY+LIMIT on the inner loop */ #define WHERE_RIGHT_JOIN 0x1000 /* Processing a RIGHT JOIN */ - /* 0x2000 not currently used */ +#define WHERE_KEEP_ALL_JOINS 0x2000 /* Do not do the omit-noop-join opt */ #define WHERE_USE_LIMIT 0x4000 /* Use the LIMIT in cost estimates */ /* 0x8000 not currently used */ @@ -19347,6 +19441,7 @@ struct NameContext { #define NC_InAggFunc 0x020000 /* True if analyzing arguments to an agg func */ #define NC_FromDDL 0x040000 /* SQL text comes from sqlite_schema */ #define NC_NoSelect 0x080000 /* Do not descend into sub-selects */ +#define NC_Where 0x100000 /* Processing WHERE clause of a SELECT */ #define NC_OrderAgg 0x8000000 /* Has an aggregate other than count/min/max */ /* @@ -19370,6 +19465,7 @@ struct Upsert { Expr *pUpsertWhere; /* WHERE clause for the ON CONFLICT UPDATE */ Upsert *pNextUpsert; /* Next ON CONFLICT clause in the list */ u8 isDoUpdate; /* True for DO UPDATE. False for DO NOTHING */ + u8 isDup; /* True if 2nd or later with same pUpsertIdx */ /* Above this point is the parse tree for the ON CONFLICT clauses. ** The next group of fields stores intermediate data. */ void *pToFree; /* Free memory when deleting the Upsert object */ @@ -19459,11 +19555,12 @@ struct Select { #define SF_View 0x0200000 /* SELECT statement is a view */ #define SF_NoopOrderBy 0x0400000 /* ORDER BY is ignored for this query */ #define SF_UFSrcCheck 0x0800000 /* Check pSrc as required by UPDATE...FROM */ -#define SF_PushDown 0x1000000 /* SELECT has be modified by push-down opt */ +#define SF_PushDown 0x1000000 /* Modified by WHERE-clause push-down opt */ #define SF_MultiPart 0x2000000 /* Has multiple incompatible PARTITIONs */ #define SF_CopyCte 0x4000000 /* SELECT statement is a copy of a CTE */ #define SF_OrderByReqd 0x8000000 /* The ORDER BY clause may not be omitted */ #define SF_UpdateFrom 0x10000000 /* Query originates with UPDATE FROM */ +#define SF_Correlated 0x20000000 /* True if references the outer context */ /* True if S exists and has SF_NestedFrom */ #define IsNestedFrom(S) ((S)!=0 && ((S)->selFlags&SF_NestedFrom)!=0) @@ -19703,6 +19800,7 @@ struct Parse { u8 disableLookaside; /* Number of times lookaside has been disabled */ u8 prepFlags; /* SQLITE_PREPARE_* flags */ u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */ + u8 bHasWith; /* True if statement contains WITH */ #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST) u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */ #endif @@ -20140,6 +20238,11 @@ struct Sqlite3Config { #endif #ifndef SQLITE_UNTESTABLE int (*xTestCallback)(int); /* Invoked by sqlite3FaultSim() */ +#endif +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + u32 mNoVisibleRowid; /* TF_NoVisibleRowid if the ROWID_IN_VIEW + ** feature is disabled. 0 if rowids can + ** occur in views. */ #endif int bLocaltimeFault; /* True to fail localtime() calls */ int (*xAltLocaltime)(const void*,void*); /* Alternative localtime() routine */ @@ -20377,6 +20480,9 @@ struct Window { ** due to the SQLITE_SUBTYPE flag */ }; +SQLITE_PRIVATE Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow); +SQLITE_PRIVATE void sqlite3MultiValuesEnd(Parse *pParse, Select *pVal); + #ifndef SQLITE_OMIT_WINDOWFUNC SQLITE_PRIVATE void sqlite3WindowDelete(sqlite3*, Window*); SQLITE_PRIVATE void sqlite3WindowUnlinkFromSelect(Window*); @@ -20596,10 +20702,13 @@ SQLITE_PRIVATE void sqlite3MutexWarnOnContention(sqlite3_mutex*); # define EXP754 (((u64)0x7ff)<<52) # define MAN754 ((((u64)1)<<52)-1) # define IsNaN(X) (((X)&EXP754)==EXP754 && ((X)&MAN754)!=0) +# define IsOvfl(X) (((X)&EXP754)==EXP754) SQLITE_PRIVATE int sqlite3IsNaN(double); +SQLITE_PRIVATE int sqlite3IsOverflow(double); #else -# define IsNaN(X) 0 -# define sqlite3IsNaN(X) 0 +# define IsNaN(X) 0 +# define sqlite3IsNaN(X) 0 +# define sqlite3IsOVerflow(X) 0 #endif /* @@ -20691,6 +20800,7 @@ SQLITE_PRIVATE int sqlite3ErrorToParser(sqlite3*,int); SQLITE_PRIVATE void sqlite3Dequote(char*); SQLITE_PRIVATE void sqlite3DequoteExpr(Expr*); SQLITE_PRIVATE void sqlite3DequoteToken(Token*); +SQLITE_PRIVATE void sqlite3DequoteNumber(Parse*, Expr*); SQLITE_PRIVATE void sqlite3TokenInit(Token*,char*); SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char*, int); SQLITE_PRIVATE int sqlite3RunParser(Parse*, const char*); @@ -20721,7 +20831,7 @@ SQLITE_PRIVATE void sqlite3ExprFunctionUsable(Parse*,const Expr*,const FuncDef*) SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32); SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*); SQLITE_PRIVATE void sqlite3ExprDeleteGeneric(sqlite3*,void*); -SQLITE_PRIVATE void sqlite3ExprDeferredDelete(Parse*, Expr*); +SQLITE_PRIVATE int sqlite3ExprDeferredDelete(Parse*, Expr*); SQLITE_PRIVATE void sqlite3ExprUnmapAndDelete(Parse*, Expr*); SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*); SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*); @@ -20944,12 +21054,10 @@ SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3*); SQLITE_PRIVATE u32 sqlite3IsTrueOrFalse(const char*); SQLITE_PRIVATE int sqlite3ExprIdToTrueFalse(Expr*); SQLITE_PRIVATE int sqlite3ExprTruthValue(const Expr*); -SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*); -SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*); +SQLITE_PRIVATE int sqlite3ExprIsConstant(Parse*,Expr*); SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*, u8); SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse*, Expr*, ExprList*); -SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr*,int); -SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(Expr*,const SrcList*,int); +SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(Expr*,const SrcList*,int,int); #ifdef SQLITE_ENABLE_CURSOR_HINTS SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr*); #endif @@ -21134,7 +21242,9 @@ SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3*, int, const char*,...); SQLITE_PRIVATE void sqlite3Error(sqlite3*,int); SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3*); SQLITE_PRIVATE void sqlite3SystemError(sqlite3*,int); +#if !defined(SQLITE_OMIT_BLOB_LITERAL) SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n); +#endif SQLITE_PRIVATE u8 sqlite3HexToInt(int h); SQLITE_PRIVATE int sqlite3TwoPartName(Parse *, Token *, Token *, Token **); @@ -21445,7 +21555,7 @@ SQLITE_PRIVATE With *sqlite3WithPush(Parse*, With*, u8); SQLITE_PRIVATE Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*,Upsert*); SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3*,Upsert*); SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3*,Upsert*); -SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget(Parse*,SrcList*,Upsert*); +SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget(Parse*,SrcList*,Upsert*,Upsert*); SQLITE_PRIVATE void sqlite3UpsertDoUpdate(Parse*,Upsert*,Table*,Index*,int); SQLITE_PRIVATE Upsert *sqlite3UpsertOfIndex(Upsert*,Index*); SQLITE_PRIVATE int sqlite3UpsertNextIsIPK(Upsert*); @@ -21835,6 +21945,9 @@ static const char * const sqlite3azCompileOpt[] = { "ALLOW_COVERING_INDEX_SCAN=" CTIMEOPT_VAL(SQLITE_ALLOW_COVERING_INDEX_SCAN), # endif #endif +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + "ALLOW_ROWID_IN_VIEW", +#endif #ifdef SQLITE_ALLOW_URI_AUTHORITY "ALLOW_URI_AUTHORITY", #endif @@ -22854,6 +22967,9 @@ SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = { #endif #ifndef SQLITE_UNTESTABLE 0, /* xTestCallback */ +#endif +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + 0, /* mNoVisibleRowid. 0 == allow rowid-in-view */ #endif 0, /* bLocaltimeFault */ 0, /* xAltLocaltime */ @@ -24175,13 +24291,14 @@ struct DateTime { int tz; /* Timezone offset in minutes */ double s; /* Seconds */ char validJD; /* True (1) if iJD is valid */ - char rawS; /* Raw numeric value stored in s */ char validYMD; /* True (1) if Y,M,D are valid */ char validHMS; /* True (1) if h,m,s are valid */ - char validTZ; /* True (1) if tz is valid */ - char tzSet; /* Timezone was set explicitly */ - char isError; /* An overflow has occurred */ - char useSubsec; /* Display subsecond precision */ + char nFloor; /* Days to implement "floor" */ + unsigned rawS : 1; /* Raw numeric value stored in s */ + unsigned isError : 1; /* An overflow has occurred */ + unsigned useSubsec : 1; /* Display subsecond precision */ + unsigned isUtc : 1; /* Time is known to be UTC */ + unsigned isLocal : 1; /* Time is known to be localtime */ }; @@ -24279,6 +24396,8 @@ static int parseTimezone(const char *zDate, DateTime *p){ sgn = +1; }else if( c=='Z' || c=='z' ){ zDate++; + p->isLocal = 0; + p->isUtc = 1; goto zulu_time; }else{ return c!=0; @@ -24291,7 +24410,6 @@ static int parseTimezone(const char *zDate, DateTime *p){ p->tz = sgn*(nMn + nHr*60); zulu_time: while( sqlite3Isspace(*zDate) ){ zDate++; } - p->tzSet = 1; return *zDate!=0; } @@ -24335,7 +24453,6 @@ static int parseHhMmSs(const char *zDate, DateTime *p){ p->m = m; p->s = s + ms; if( parseTimezone(zDate, p) ) return 1; - p->validTZ = (p->tz!=0)?1:0; return 0; } @@ -24382,15 +24499,40 @@ static void computeJD(DateTime *p){ p->validJD = 1; if( p->validHMS ){ p->iJD += p->h*3600000 + p->m*60000 + (sqlite3_int64)(p->s*1000 + 0.5); - if( p->validTZ ){ + if( p->tz ){ p->iJD -= p->tz*60000; p->validYMD = 0; p->validHMS = 0; - p->validTZ = 0; + p->tz = 0; + p->isUtc = 1; + p->isLocal = 0; } } } +/* +** Given the YYYY-MM-DD information current in p, determine if there +** is day-of-month overflow and set nFloor to the number of days that +** would need to be subtracted from the date in order to bring the +** date back to the end of the month. +*/ +static void computeFloor(DateTime *p){ + assert( p->validYMD || p->isError ); + assert( p->D>=0 && p->D<=31 ); + assert( p->M>=0 && p->M<=12 ); + if( p->D<=28 ){ + p->nFloor = 0; + }else if( (1<M) & 0x15aa ){ + p->nFloor = 0; + }else if( p->M!=2 ){ + p->nFloor = (p->D==31); + }else if( p->Y%4!=0 || (p->Y%100==0 && p->Y%400!=0) ){ + p->nFloor = p->D - 28; + }else{ + p->nFloor = p->D - 29; + } +} + /* ** Parse dates of the form ** @@ -24429,12 +24571,16 @@ static int parseYyyyMmDd(const char *zDate, DateTime *p){ p->Y = neg ? -Y : Y; p->M = M; p->D = D; - if( p->validTZ ){ + computeFloor(p); + if( p->tz ){ computeJD(p); } return 0; } + +static void clearYMD_HMS_TZ(DateTime *p); /* Forward declaration */ + /* ** Set the time to the current time reported by the VFS. ** @@ -24444,6 +24590,9 @@ static int setDateTimeToCurrent(sqlite3_context *context, DateTime *p){ p->iJD = sqlite3StmtCurrentTime(context); if( p->iJD>0 ){ p->validJD = 1; + p->isUtc = 1; + p->isLocal = 0; + clearYMD_HMS_TZ(p); return 0; }else{ return 1; @@ -24582,7 +24731,7 @@ static void computeYMD_HMS(DateTime *p){ static void clearYMD_HMS_TZ(DateTime *p){ p->validYMD = 0; p->validHMS = 0; - p->validTZ = 0; + p->tz = 0; } #ifndef SQLITE_OMIT_LOCALTIME @@ -24714,7 +24863,7 @@ static int toLocaltime( p->validHMS = 1; p->validJD = 0; p->rawS = 0; - p->validTZ = 0; + p->tz = 0; p->isError = 0; return SQLITE_OK; } @@ -24734,12 +24883,12 @@ static const struct { float rLimit; /* Maximum NNN value for this transform */ float rXform; /* Constant used for this transform */ } aXformType[] = { - { 6, "second", 4.6427e+14, 1.0 }, - { 6, "minute", 7.7379e+12, 60.0 }, - { 4, "hour", 1.2897e+11, 3600.0 }, - { 3, "day", 5373485.0, 86400.0 }, - { 5, "month", 176546.0, 2592000.0 }, - { 4, "year", 14713.0, 31536000.0 }, + /* 0 */ { 6, "second", 4.6427e+14, 1.0 }, + /* 1 */ { 6, "minute", 7.7379e+12, 60.0 }, + /* 2 */ { 4, "hour", 1.2897e+11, 3600.0 }, + /* 3 */ { 3, "day", 5373485.0, 86400.0 }, + /* 4 */ { 5, "month", 176546.0, 30.0*86400.0 }, + /* 5 */ { 4, "year", 14713.0, 365.0*86400.0 }, }; /* @@ -24771,14 +24920,20 @@ static void autoAdjustDate(DateTime *p){ ** NNN.NNNN seconds ** NNN months ** NNN years +** +/-YYYY-MM-DD HH:MM:SS.SSS +** ceiling +** floor ** start of month ** start of year ** start of week ** start of day ** weekday N ** unixepoch +** auto ** localtime ** utc +** subsec +** subsecond ** ** Return 0 on success and 1 if there is any kind of error. If the error ** is in a system call (i.e. localtime()), then an error message is written @@ -24809,6 +24964,37 @@ static int parseModifier( } break; } + case 'c': { + /* + ** ceiling + ** + ** Resolve day-of-month overflow by rolling forward into the next + ** month. As this is the default action, this modifier is really + ** a no-op that is only included for symmetry. See "floor". + */ + if( sqlite3_stricmp(z, "ceiling")==0 ){ + computeJD(p); + clearYMD_HMS_TZ(p); + rc = 0; + p->nFloor = 0; + } + break; + } + case 'f': { + /* + ** floor + ** + ** Resolve day-of-month overflow by rolling back to the end of the + ** previous month. + */ + if( sqlite3_stricmp(z, "floor")==0 ){ + computeJD(p); + p->iJD -= p->nFloor*86400000; + clearYMD_HMS_TZ(p); + rc = 0; + } + break; + } case 'j': { /* ** julianday @@ -24835,7 +25021,9 @@ static int parseModifier( ** show local time. */ if( sqlite3_stricmp(z, "localtime")==0 && sqlite3NotPureFunc(pCtx) ){ - rc = toLocaltime(p, pCtx); + rc = p->isLocal ? SQLITE_OK : toLocaltime(p, pCtx); + p->isUtc = 0; + p->isLocal = 1; } break; } @@ -24860,7 +25048,7 @@ static int parseModifier( } #ifndef SQLITE_OMIT_LOCALTIME else if( sqlite3_stricmp(z, "utc")==0 && sqlite3NotPureFunc(pCtx) ){ - if( p->tzSet==0 ){ + if( p->isUtc==0 ){ i64 iOrigJD; /* Original localtime */ i64 iGuess; /* Guess at the corresponding utc time */ int cnt = 0; /* Safety to prevent infinite loop */ @@ -24883,7 +25071,8 @@ static int parseModifier( memset(p, 0, sizeof(*p)); p->iJD = iGuess; p->validJD = 1; - p->tzSet = 1; + p->isUtc = 1; + p->isLocal = 0; } rc = SQLITE_OK; } @@ -24903,7 +25092,7 @@ static int parseModifier( && r>=0.0 && r<7.0 && (n=(int)r)==r ){ sqlite3_int64 Z; computeYMD_HMS(p); - p->validTZ = 0; + p->tz = 0; p->validJD = 0; computeJD(p); Z = ((p->iJD + 129600000)/86400000) % 7; @@ -24943,7 +25132,7 @@ static int parseModifier( p->h = p->m = 0; p->s = 0.0; p->rawS = 0; - p->validTZ = 0; + p->tz = 0; p->validJD = 0; if( sqlite3_stricmp(z,"month")==0 ){ p->D = 1; @@ -25014,6 +25203,7 @@ static int parseModifier( x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12; p->Y += x; p->M -= x*12; + computeFloor(p); computeJD(p); p->validHMS = 0; p->validYMD = 0; @@ -25060,11 +25250,12 @@ static int parseModifier( z += n; while( sqlite3Isspace(*z) ) z++; n = sqlite3Strlen30(z); - if( n>10 || n<3 ) break; + if( n<3 || n>10 ) break; if( sqlite3UpperToLower[(u8)z[n-1]]=='s' ) n--; computeJD(p); assert( rc==1 ); rRounder = r<0 ? -0.5 : +0.5; + p->nFloor = 0; for(i=0; iM += (int)r; x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12; p->Y += x; p->M -= x*12; + computeFloor(p); p->validJD = 0; r -= (int)r; break; } case 5: { /* Special processing to add years */ int y = (int)r; - assert( strcmp(aXformType[i].zName,"year")==0 ); + assert( strcmp(aXformType[5].zName,"year")==0 ); computeYMD_HMS(p); + assert( p->M>=0 && p->M<=12 ); p->Y += y; + computeFloor(p); p->validJD = 0; r -= (int)r; break; @@ -25340,22 +25534,83 @@ static void dateFunc( } } +/* +** Compute the number of days after the most recent January 1. +** +** In other words, compute the zero-based day number for the +** current year: +** +** Jan01 = 0, Jan02 = 1, ..., Jan31 = 30, Feb01 = 31, ... +** Dec31 = 364 or 365. +*/ +static int daysAfterJan01(DateTime *pDate){ + DateTime jan01 = *pDate; + assert( jan01.validYMD ); + assert( jan01.validHMS ); + assert( pDate->validJD ); + jan01.validJD = 0; + jan01.M = 1; + jan01.D = 1; + computeJD(&jan01); + return (int)((pDate->iJD-jan01.iJD+43200000)/86400000); +} + +/* +** Return the number of days after the most recent Monday. +** +** In other words, return the day of the week according +** to this code: +** +** 0=Monday, 1=Tuesday, 2=Wednesday, ..., 6=Sunday. +*/ +static int daysAfterMonday(DateTime *pDate){ + assert( pDate->validJD ); + return (int)((pDate->iJD+43200000)/86400000) % 7; +} + +/* +** Return the number of days after the most recent Sunday. +** +** In other words, return the day of the week according +** to this code: +** +** 0=Sunday, 1=Monday, 2=Tues, ..., 6=Saturday +*/ +static int daysAfterSunday(DateTime *pDate){ + assert( pDate->validJD ); + return (int)((pDate->iJD+129600000)/86400000) % 7; +} + /* ** strftime( FORMAT, TIMESTRING, MOD, MOD, ...) ** ** Return a string described by FORMAT. Conversions as follows: ** -** %d day of month +** %d day of month 01-31 +** %e day of month 1-31 ** %f ** fractional seconds SS.SSS +** %F ISO date. YYYY-MM-DD +** %G ISO year corresponding to %V 0000-9999. +** %g 2-digit ISO year corresponding to %V 00-99 ** %H hour 00-24 -** %j day of year 000-366 +** %k hour 0-24 (leading zero converted to space) +** %I hour 01-12 +** %j day of year 001-366 ** %J ** julian day number +** %l hour 1-12 (leading zero converted to space) ** %m month 01-12 ** %M minute 00-59 +** %p "am" or "pm" +** %P "AM" or "PM" +** %R time as HH:MM ** %s seconds since 1970-01-01 ** %S seconds 00-59 -** %w day of week 0-6 Sunday==0 -** %W week of year 00-53 +** %T time as HH:MM:SS +** %u day of week 1-7 Monday==1, Sunday==7 +** %w day of week 0-6 Sunday==0, Monday==1 +** %U week of year 00-53 (First Sunday is start of week 01) +** %V week of year 01-53 (First week containing Thursday is week 01) +** %W week of year 00-53 (First Monday is start of week 01) ** %Y year 0000-9999 ** %% % */ @@ -25392,7 +25647,7 @@ static void strftimeFunc( sqlite3_str_appendf(&sRes, cf=='d' ? "%02d" : "%2d", x.D); break; } - case 'f': { + case 'f': { /* Fractional seconds. (Non-standard) */ double s = x.s; if( s>59.999 ) s = 59.999; sqlite3_str_appendf(&sRes, "%06.3f", s); @@ -25402,6 +25657,21 @@ static void strftimeFunc( sqlite3_str_appendf(&sRes, "%04d-%02d-%02d", x.Y, x.M, x.D); break; } + case 'G': /* Fall thru */ + case 'g': { + DateTime y = x; + assert( y.validJD ); + /* Move y so that it is the Thursday in the same week as x */ + y.iJD += (3 - daysAfterMonday(&x))*86400000; + y.validYMD = 0; + computeYMD(&y); + if( cf=='g' ){ + sqlite3_str_appendf(&sRes, "%02d", y.Y%100); + }else{ + sqlite3_str_appendf(&sRes, "%04d", y.Y); + } + break; + } case 'H': case 'k': { sqlite3_str_appendf(&sRes, cf=='H' ? "%02d" : "%2d", x.h); @@ -25415,25 +25685,11 @@ static void strftimeFunc( sqlite3_str_appendf(&sRes, cf=='I' ? "%02d" : "%2d", h); break; } - case 'W': /* Fall thru */ - case 'j': { - int nDay; /* Number of days since 1st day of year */ - DateTime y = x; - y.validJD = 0; - y.M = 1; - y.D = 1; - computeJD(&y); - nDay = (int)((x.iJD-y.iJD+43200000)/86400000); - if( cf=='W' ){ - int wd; /* 0=Monday, 1=Tuesday, ... 6=Sunday */ - wd = (int)(((x.iJD+43200000)/86400000)%7); - sqlite3_str_appendf(&sRes,"%02d",(nDay+7-wd)/7); - }else{ - sqlite3_str_appendf(&sRes,"%03d",nDay+1); - } + case 'j': { /* Day of year. Jan01==1, Jan02==2, and so forth */ + sqlite3_str_appendf(&sRes,"%03d",daysAfterJan01(&x)+1); break; } - case 'J': { + case 'J': { /* Julian day number. (Non-standard) */ sqlite3_str_appendf(&sRes,"%.16g",x.iJD/86400000.0); break; } @@ -25476,13 +25732,33 @@ static void strftimeFunc( sqlite3_str_appendf(&sRes,"%02d:%02d:%02d", x.h, x.m, (int)x.s); break; } - case 'u': /* Fall thru */ - case 'w': { - char c = (char)(((x.iJD+129600000)/86400000) % 7) + '0'; + case 'u': /* Day of week. 1 to 7. Monday==1, Sunday==7 */ + case 'w': { /* Day of week. 0 to 6. Sunday==0, Monday==1 */ + char c = (char)daysAfterSunday(&x) + '0'; if( c=='0' && cf=='u' ) c = '7'; sqlite3_str_appendchar(&sRes, 1, c); break; } + case 'U': { /* Week num. 00-53. First Sun of the year is week 01 */ + sqlite3_str_appendf(&sRes,"%02d", + (daysAfterJan01(&x)-daysAfterSunday(&x)+7)/7); + break; + } + case 'V': { /* Week num. 01-53. First week with a Thur is week 01 */ + DateTime y = x; + /* Adjust y so that is the Thursday in the same week as x */ + assert( y.validJD ); + y.iJD += (3 - daysAfterMonday(&x))*86400000; + y.validYMD = 0; + computeYMD(&y); + sqlite3_str_appendf(&sRes,"%02d", daysAfterJan01(&y)/7+1); + break; + } + case 'W': { /* Week num. 00-53. First Mon of the year is week 01 */ + sqlite3_str_appendf(&sRes,"%02d", + (daysAfterJan01(&x)-daysAfterMonday(&x)+7)/7); + break; + } case 'Y': { sqlite3_str_appendf(&sRes,"%04d",x.Y); break; @@ -25629,9 +25905,7 @@ static void timediffFunc( d1.iJD = d2.iJD - d1.iJD; d1.iJD += (u64)1486995408 * (u64)100000; } - d1.validYMD = 0; - d1.validHMS = 0; - d1.validTZ = 0; + clearYMD_HMS_TZ(&d1); computeYMD_HMS(&d1); sqlite3StrAccumInit(&sRes, 0, 0, 0, 100); sqlite3_str_appendf(&sRes, "%c%04d-%02d-%02d %02d:%02d:%06.3f", @@ -25700,6 +25974,36 @@ static void currentTimeFunc( } #endif +#if !defined(SQLITE_OMIT_DATETIME_FUNCS) && defined(SQLITE_DEBUG) +/* +** datedebug(...) +** +** This routine returns JSON that describes the internal DateTime object. +** Used for debugging and testing only. Subject to change. +*/ +static void datedebugFunc( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + DateTime x; + if( isDate(context, argc, argv, &x)==0 ){ + char *zJson; + zJson = sqlite3_mprintf( + "{iJD:%lld,Y:%d,M:%d,D:%d,h:%d,m:%d,tz:%d," + "s:%.3f,validJD:%d,validYMS:%d,validHMS:%d," + "nFloor:%d,rawS:%d,isError:%d,useSubsec:%d," + "isUtc:%d,isLocal:%d}", + x.iJD, x.Y, x.M, x.D, x.h, x.m, x.tz, + x.s, x.validJD, x.validYMD, x.validHMS, + x.nFloor, x.rawS, x.isError, x.useSubsec, + x.isUtc, x.isLocal); + sqlite3_result_text(context, zJson, -1, sqlite3_free); + } +} +#endif /* !SQLITE_OMIT_DATETIME_FUNCS && SQLITE_DEBUG */ + + /* ** This function registered all of the above C functions as SQL ** functions. This should be the only routine in this file with @@ -25715,6 +26019,9 @@ SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void){ PURE_DATE(datetime, -1, 0, 0, datetimeFunc ), PURE_DATE(strftime, -1, 0, 0, strftimeFunc ), PURE_DATE(timediff, 2, 0, 0, timediffFunc ), +#ifdef SQLITE_DEBUG + PURE_DATE(datedebug, -1, 0, 0, datedebugFunc ), +#endif DFUNCTION(current_time, 0, 0, 0, ctimeFunc ), DFUNCTION(current_timestamp, 0, 0, 0, ctimestampFunc), DFUNCTION(current_date, 0, 0, 0, cdateFunc ), @@ -30130,6 +30437,24 @@ static void sqlite3MallocAlarm(int nByte){ sqlite3_mutex_enter(mem0.mutex); } +#ifdef SQLITE_DEBUG +/* +** This routine is called whenever an out-of-memory condition is seen, +** It's only purpose to to serve as a breakpoint for gdb or similar +** code debuggers when working on out-of-memory conditions, for example +** caused by PRAGMA hard_heap_limit=N. +*/ +static SQLITE_NOINLINE void test_oom_breakpoint(u64 n){ + static u64 nOomFault = 0; + nOomFault += n; + /* The assert() is never reached in a human lifetime. It is here mostly + ** to prevent code optimizers from optimizing out this function. */ + assert( (nOomFault>>32) < 0xffffffff ); +} +#else +# define test_oom_breakpoint(X) /* No-op for production builds */ +#endif + /* ** Do a memory allocation with statistics and alarms. Assume the ** lock is already held. @@ -30156,6 +30481,7 @@ static void mallocWithAlarm(int n, void **pp){ if( mem0.hardLimit ){ nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED); if( nUsed >= mem0.hardLimit - nFull ){ + test_oom_breakpoint(1); *pp = 0; return; } @@ -30444,6 +30770,7 @@ SQLITE_PRIVATE void *sqlite3Realloc(void *pOld, u64 nBytes){ sqlite3MallocAlarm(nDiff); if( mem0.hardLimit>0 && nUsed >= mem0.hardLimit - nDiff ){ sqlite3_mutex_leave(mem0.mutex); + test_oom_breakpoint(1); return 0; } } @@ -31310,6 +31637,7 @@ SQLITE_API void sqlite3_str_vappendf( if( xtype==etFLOAT ){ iRound = -precision; }else if( xtype==etGENERIC ){ + if( precision==0 ) precision = 1; iRound = precision; }else{ iRound = precision+1; @@ -31345,13 +31673,14 @@ SQLITE_API void sqlite3_str_vappendf( } exp = s.iDP-1; - if( xtype==etGENERIC && precision>0 ) precision--; /* ** If the field type is etGENERIC, then convert to either etEXP ** or etFLOAT, as appropriate. */ if( xtype==etGENERIC ){ + assert( precision>0 ); + precision--; flag_rtz = !flag_alternateform; if( exp<-4 || exp>precision ){ xtype = etEXP; @@ -31667,9 +31996,13 @@ SQLITE_API void sqlite3_str_vappendf( sqlite3_str_appendall(pAccum, pItem->zAlias); }else{ Select *pSel = pItem->pSelect; - assert( pSel!=0 ); + assert( pSel!=0 ); /* Because of tag-20240424-1 */ if( pSel->selFlags & SF_NestedFrom ){ sqlite3_str_appendf(pAccum, "(join-%u)", pSel->selId); + }else if( pSel->selFlags & SF_MultiValue ){ + assert( !pItem->fg.isTabFunc && !pItem->fg.isIndexedBy ); + sqlite3_str_appendf(pAccum, "%u-ROW VALUES CLAUSE", + pItem->u1.nRow); }else{ sqlite3_str_appendf(pAccum, "(subquery-%u)", pSel->selId); } @@ -32446,8 +32779,10 @@ SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc) x.printfFlags |= SQLITE_PRINTF_INTERNAL; sqlite3_str_appendf(&x, "{%d:*} %!S", pItem->iCursor, pItem); if( pItem->pTab ){ - sqlite3_str_appendf(&x, " tab=%Q nCol=%d ptr=%p used=%llx", - pItem->pTab->zName, pItem->pTab->nCol, pItem->pTab, pItem->colUsed); + sqlite3_str_appendf(&x, " tab=%Q nCol=%d ptr=%p used=%llx%s", + pItem->pTab->zName, pItem->pTab->nCol, pItem->pTab, + pItem->colUsed, + pItem->fg.rowidUsed ? "+rowid" : ""); } if( (pItem->fg.jointype & (JT_LEFT|JT_RIGHT))==(JT_LEFT|JT_RIGHT) ){ sqlite3_str_appendf(&x, " FULL-OUTER-JOIN"); @@ -32487,12 +32822,14 @@ SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc) sqlite3TreeViewIdList(pView, pItem->u3.pUsing, (--n)>0, "USING"); } if( pItem->pSelect ){ + sqlite3TreeViewPush(&pView, i+1nSrc); if( pItem->pTab ){ Table *pTab = pItem->pTab; sqlite3TreeViewColumnList(pView, pTab->aCol, pTab->nCol, 1); } assert( (int)pItem->fg.isNestedFrom == IsNestedFrom(pItem->pSelect) ); sqlite3TreeViewSelect(pView, pItem->pSelect, (--n)>0); + sqlite3TreeViewPop(&pView); } if( pItem->fg.isTabFunc ){ sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:"); @@ -32596,7 +32933,7 @@ SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 m sqlite3TreeViewItem(pView, "LIMIT", (n--)>0); sqlite3TreeViewExpr(pView, p->pLimit->pLeft, p->pLimit->pRight!=0); if( p->pLimit->pRight ){ - sqlite3TreeViewItem(pView, "OFFSET", (n--)>0); + sqlite3TreeViewItem(pView, "OFFSET", 0); sqlite3TreeViewExpr(pView, p->pLimit->pRight, 0); sqlite3TreeViewPop(&pView); } @@ -34641,6 +34978,19 @@ SQLITE_PRIVATE int sqlite3IsNaN(double x){ } #endif /* SQLITE_OMIT_FLOATING_POINT */ +#ifndef SQLITE_OMIT_FLOATING_POINT +/* +** Return true if the floating point value is NaN or +Inf or -Inf. +*/ +SQLITE_PRIVATE int sqlite3IsOverflow(double x){ + int rc; /* The value return */ + u64 y; + memcpy(&y,&x,sizeof(y)); + rc = IsOvfl(y); + return rc; +} +#endif /* SQLITE_OMIT_FLOATING_POINT */ + /* ** Compute a string length that is limited to what can be stored in ** lower 30 bits of a 32-bit signed integer. @@ -34884,6 +35234,44 @@ SQLITE_PRIVATE void sqlite3DequoteExpr(Expr *p){ sqlite3Dequote(p->u.zToken); } +/* +** Expression p is a QNUMBER (quoted number). Dequote the value in p->u.zToken +** and set the type to INTEGER or FLOAT. "Quoted" integers or floats are those +** that contain '_' characters that must be removed before further processing. +*/ +SQLITE_PRIVATE void sqlite3DequoteNumber(Parse *pParse, Expr *p){ + assert( p!=0 || pParse->db->mallocFailed ); + if( p ){ + const char *pIn = p->u.zToken; + char *pOut = p->u.zToken; + int bHex = (pIn[0]=='0' && (pIn[1]=='x' || pIn[1]=='X')); + int iValue; + assert( p->op==TK_QNUMBER ); + p->op = TK_INTEGER; + do { + if( *pIn!=SQLITE_DIGIT_SEPARATOR ){ + *pOut++ = *pIn; + if( *pIn=='e' || *pIn=='E' || *pIn=='.' ) p->op = TK_FLOAT; + }else{ + if( (bHex==0 && (!sqlite3Isdigit(pIn[-1]) || !sqlite3Isdigit(pIn[1]))) + || (bHex==1 && (!sqlite3Isxdigit(pIn[-1]) || !sqlite3Isxdigit(pIn[1]))) + ){ + sqlite3ErrorMsg(pParse, "unrecognized token: \"%s\"", p->u.zToken); + } + } + }while( *pIn++ ); + if( bHex ) p->op = TK_INTEGER; + + /* tag-20240227-a: If after dequoting, the number is an integer that + ** fits in 32 bits, then it must be converted into EP_IntValue. Other + ** parts of the code expect this. See also tag-20240227-b. */ + if( p->op==TK_INTEGER && sqlite3GetInt32(p->u.zToken, &iValue) ){ + p->u.iValue = iValue; + p->flags |= EP_IntValue; + } + } +} + /* ** If the input token p is quoted, try to adjust the token to remove ** the quotes. This is not always possible: @@ -35200,6 +35588,9 @@ do_atof_calc: u64 s2; rr[0] = (double)s; s2 = (u64)rr[0]; +#if defined(_MSC_VER) && _MSC_VER<1700 + if( s2==0x8000000000000000LL ){ s2 = 2*(u64)(0.5*rr[0]); } +#endif rr[1] = s>=s2 ? (double)(s - s2) : -(double)(s2 - s); if( e>0 ){ while( e>=100 ){ @@ -35642,7 +36033,7 @@ SQLITE_PRIVATE void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRou assert( p->n>0 ); assert( p->nzBuf) ); p->iDP = p->n + exp; - if( iRound<0 ){ + if( iRound<=0 ){ iRound = p->iDP - iRound; if( iRound==0 && p->zBuf[i+1]>='5' ){ iRound = 1; @@ -36820,7 +37211,7 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ /* 30 */ "SeekRowid" OpHelp("intkey=r[P3]"), /* 31 */ "NotExists" OpHelp("intkey=r[P3]"), /* 32 */ "Last" OpHelp(""), - /* 33 */ "IfSmaller" OpHelp(""), + /* 33 */ "IfSizeBetween" OpHelp(""), /* 34 */ "SorterSort" OpHelp(""), /* 35 */ "Sort" OpHelp(""), /* 36 */ "Rewind" OpHelp(""), @@ -36865,7 +37256,7 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ /* 75 */ "Null" OpHelp("r[P2..P3]=NULL"), /* 76 */ "SoftNull" OpHelp("r[P1]=NULL"), /* 77 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), - /* 78 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), + /* 78 */ "Variable" OpHelp("r[P2]=parameter(P1)"), /* 79 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), /* 80 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), /* 81 */ "SCopy" OpHelp("r[P2]=r[P1]"), @@ -39263,8 +39654,12 @@ static int unixLogErrorAtLine( ** available, the error message will often be an empty string. Not a ** huge problem. Incorrectly concluding that the GNU version is available ** could lead to a segfault though. + ** + ** Forum post 3f13857fa4062301 reports that the Android SDK may use + ** int-type return, depending on its version. */ -#if defined(STRERROR_R_CHAR_P) || defined(__USE_GNU) +#if (defined(STRERROR_R_CHAR_P) || defined(__USE_GNU)) \ + && !defined(ANDROID) && !defined(__ANDROID__) zErr = # endif strerror_r(iErrno, aErr, sizeof(aErr)-1); @@ -44362,12 +44757,19 @@ static int unixOpen( rc = SQLITE_READONLY_DIRECTORY; }else if( errno!=EISDIR && isReadWrite ){ /* Failed to open the file for read/write access. Try read-only. */ + UnixUnusedFd *pReadonly = 0; flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE); openFlags &= ~(O_RDWR|O_CREAT); flags |= SQLITE_OPEN_READONLY; openFlags |= O_RDONLY; isReadonly = 1; - fd = robust_open(zName, openFlags, openMode); + pReadonly = findReusableFd(zName, flags); + if( pReadonly ){ + fd = pReadonly->fd; + sqlite3_free(pReadonly); + }else{ + fd = robust_open(zName, openFlags, openMode); + } } } if( fd<0 ){ @@ -53263,6 +53665,14 @@ SQLITE_API unsigned char *sqlite3_serialize( pOut = 0; }else{ sz = sqlite3_column_int64(pStmt, 0)*szPage; + if( sz==0 ){ + sqlite3_reset(pStmt); + sqlite3_exec(db, "BEGIN IMMEDIATE; COMMIT;", 0, 0, 0); + rc = sqlite3_step(pStmt); + if( rc==SQLITE_ROW ){ + sz = sqlite3_column_int64(pStmt, 0)*szPage; + } + } if( piSize ) *piSize = sz; if( mFlags & SQLITE_SERIALIZE_NOCOPY ){ pOut = 0; @@ -63786,7 +64196,7 @@ SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager *pPager){ ** This will be either the rollback journal or the WAL file. */ SQLITE_PRIVATE sqlite3_file *sqlite3PagerJrnlFile(Pager *pPager){ -#if SQLITE_OMIT_WAL +#ifdef SQLITE_OMIT_WAL return pPager->jfd; #else return pPager->pWal ? sqlite3WalFile(pPager->pWal) : pPager->jfd; @@ -69810,6 +70220,7 @@ struct IntegrityCk { StrAccum errMsg; /* Accumulate the error message text here */ u32 *heap; /* Min-heap used for analyzing cell coverage */ sqlite3 *db; /* Database connection running the check */ + i64 nRow; /* Number of rows visited in current tree */ }; /* @@ -70284,8 +70695,47 @@ int corruptPageError(int lineno, MemPage *p){ # define SQLITE_CORRUPT_PAGE(pMemPage) SQLITE_CORRUPT_PGNO(pMemPage->pgno) #endif +/* Default value for SHARED_LOCK_TRACE macro if shared-cache is disabled +** or if the lock tracking is disabled. This is always the value for +** release builds. +*/ +#define SHARED_LOCK_TRACE(X,MSG,TAB,TYPE) /*no-op*/ + #ifndef SQLITE_OMIT_SHARED_CACHE +#if 0 +/* ^---- Change to 1 and recompile to enable shared-lock tracing +** for debugging purposes. +** +** Print all shared-cache locks on a BtShared. Debugging use only. +*/ +static void sharedLockTrace( + BtShared *pBt, + const char *zMsg, + int iRoot, + int eLockType +){ + BtLock *pLock; + if( iRoot>0 ){ + printf("%s-%p %u%s:", zMsg, pBt, iRoot, eLockType==READ_LOCK?"R":"W"); + }else{ + printf("%s-%p:", zMsg, pBt); + } + for(pLock=pBt->pLock; pLock; pLock=pLock->pNext){ + printf(" %p/%u%s", pLock->pBtree, pLock->iTable, + pLock->eLock==READ_LOCK ? "R" : "W"); + while( pLock->pNext && pLock->pBtree==pLock->pNext->pBtree ){ + pLock = pLock->pNext; + printf(",%u%s", pLock->iTable, pLock->eLock==READ_LOCK ? "R" : "W"); + } + } + printf("\n"); + fflush(stdout); +} +#undef SHARED_LOCK_TRACE +#define SHARED_LOCK_TRACE(X,MSG,TAB,TYPE) sharedLockTrace(X,MSG,TAB,TYPE) +#endif /* Shared-lock tracing */ + #ifdef SQLITE_DEBUG /* **** This function is only used as part of an assert() statement. *** @@ -70362,6 +70812,8 @@ static int hasSharedCacheTableLock( iTab = iRoot; } + SHARED_LOCK_TRACE(pBtree->pBt,"hasLock",iRoot,eLockType); + /* Search for the required lock. Either a write-lock on root-page iTab, a ** write-lock on the schema table, or (if the client is reading) a ** read-lock on iTab will suffice. Return 1 if any of these are found. */ @@ -70495,6 +70947,8 @@ static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){ BtLock *pLock = 0; BtLock *pIter; + SHARED_LOCK_TRACE(pBt,"setLock", iTable, eLock); + assert( sqlite3BtreeHoldsMutex(p) ); assert( eLock==READ_LOCK || eLock==WRITE_LOCK ); assert( p->db!=0 ); @@ -70562,6 +71016,8 @@ static void clearAllSharedCacheTableLocks(Btree *p){ assert( p->sharable || 0==*ppIter ); assert( p->inTrans>0 ); + SHARED_LOCK_TRACE(pBt, "clearAllLocks", 0, 0); + while( *ppIter ){ BtLock *pLock = *ppIter; assert( (pBt->btsFlags & BTS_EXCLUSIVE)==0 || pBt->pWriter==pLock->pBtree ); @@ -70600,6 +71056,9 @@ static void clearAllSharedCacheTableLocks(Btree *p){ */ static void downgradeAllSharedCacheTableLocks(Btree *p){ BtShared *pBt = p->pBt; + + SHARED_LOCK_TRACE(pBt, "downgradeLocks", 0, 0); + if( pBt->pWriter==p ){ BtLock *pLock; pBt->pWriter = 0; @@ -75213,9 +75672,12 @@ static int accessPayload( if( pCur->aOverflow==0 || nOvfl*(int)sizeof(Pgno) > sqlite3MallocSize(pCur->aOverflow) ){ - Pgno *aNew = (Pgno*)sqlite3Realloc( - pCur->aOverflow, nOvfl*2*sizeof(Pgno) - ); + Pgno *aNew; + if( sqlite3FaultSim(413) ){ + aNew = 0; + }else{ + aNew = (Pgno*)sqlite3Realloc(pCur->aOverflow, nOvfl*2*sizeof(Pgno)); + } if( aNew==0 ){ return SQLITE_NOMEM_BKPT; }else{ @@ -75225,6 +75687,12 @@ static int accessPayload( memset(pCur->aOverflow, 0, nOvfl*sizeof(Pgno)); pCur->curFlags |= BTCF_ValidOvfl; }else{ + /* Sanity check the validity of the overflow page cache */ + assert( pCur->aOverflow[0]==nextPage + || pCur->aOverflow[0]==0 + || CORRUPT_DB ); + assert( pCur->aOverflow[0]!=0 || pCur->aOverflow[offset/ovflSize]==0 ); + /* If the overflow page-list cache has been allocated and the ** entry for the first required overflow page is valid, skip ** directly to it. @@ -75706,6 +76174,23 @@ SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor *pCur, int *pRes){ return rc; } +#ifdef SQLITE_DEBUG +/* The cursors is CURSOR_VALID and has BTCF_AtLast set. Verify that +** this flags are true for a consistent database. +** +** This routine is is called from within assert() statements only. +** It is an internal verification routine and does not appear in production +** builds. +*/ +static int cursorIsAtLastEntry(BtCursor *pCur){ + int ii; + for(ii=0; iiiPage; ii++){ + if( pCur->aiIdx[ii]!=pCur->apPage[ii]->nCell ) return 0; + } + return pCur->ix==pCur->pPage->nCell-1 && pCur->pPage->leaf!=0; +} +#endif + /* Move the cursor to the last entry in the table. Return SQLITE_OK ** on success. Set *pRes to 0 if the cursor actually points to something ** or set *pRes to 1 if the table is empty. @@ -75734,18 +76219,7 @@ SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor *pCur, int *pRes){ /* If the cursor already points to the last entry, this is a no-op. */ if( CURSOR_VALID==pCur->eState && (pCur->curFlags & BTCF_AtLast)!=0 ){ -#ifdef SQLITE_DEBUG - /* This block serves to assert() that the cursor really does point - ** to the last entry in the b-tree. */ - int ii; - for(ii=0; iiiPage; ii++){ - assert( pCur->aiIdx[ii]==pCur->apPage[ii]->nCell ); - } - assert( pCur->ix==pCur->pPage->nCell-1 || CORRUPT_DB ); - testcase( pCur->ix!=pCur->pPage->nCell-1 ); - /* ^-- dbsqlfuzz b92b72e4de80b5140c30ab71372ca719b8feb618 */ - assert( pCur->pPage->leaf ); -#endif + assert( cursorIsAtLastEntry(pCur) || CORRUPT_DB ); *pRes = 0; return SQLITE_OK; } @@ -75798,6 +76272,7 @@ SQLITE_PRIVATE int sqlite3BtreeTableMoveto( } if( pCur->info.nKeycurFlags & BTCF_AtLast)!=0 ){ + assert( cursorIsAtLastEntry(pCur) || CORRUPT_DB ); *pRes = -1; return SQLITE_OK; } @@ -76264,10 +76739,10 @@ SQLITE_PRIVATE i64 sqlite3BtreeRowCountEst(BtCursor *pCur){ assert( cursorOwnsBtShared(pCur) ); assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); - /* Currently this interface is only called by the OP_IfSmaller - ** opcode, and it that case the cursor will always be valid and - ** will always point to a leaf node. */ - if( NEVER(pCur->eState!=CURSOR_VALID) ) return -1; + /* Currently this interface is only called by the OP_IfSizeBetween + ** opcode and the OP_Count opcode with P3=1. In either case, + ** the cursor will always be valid unless the btree is empty. */ + if( pCur->eState!=CURSOR_VALID ) return 0; if( NEVER(pCur->pPage->leaf==0) ) return -1; n = pCur->pPage->nCell; @@ -77089,7 +77564,10 @@ static int fillInCell( n = nHeader + nPayload; testcase( n==3 ); testcase( n==4 ); - if( n<4 ) n = 4; + if( n<4 ){ + n = 4; + pPayload[nPayload] = 0; + } *pnSize = n; assert( nSrc<=nPayload ); testcase( nSrcaData[0]!=apOld[0]->aData[0] ){ - rc = SQLITE_CORRUPT_BKPT; + rc = SQLITE_CORRUPT_PAGE(pOld); goto balance_cleanup; } @@ -78419,7 +78897,7 @@ static int balance_nonroot( memset(&b.szCell[b.nCell], 0, sizeof(b.szCell[0])*(limit+pOld->nOverflow)); if( pOld->nOverflow>0 ){ if( NEVER(limitaiOvfl[0]) ){ - rc = SQLITE_CORRUPT_BKPT; + rc = SQLITE_CORRUPT_PAGE(pOld); goto balance_cleanup; } limit = pOld->aiOvfl[0]; @@ -79062,7 +79540,7 @@ static int anotherValidCursor(BtCursor *pCur){ && pOther->eState==CURSOR_VALID && pOther->pPage==pCur->pPage ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pCur->pPage); } } return SQLITE_OK; @@ -79122,7 +79600,7 @@ static int balance(BtCursor *pCur){ /* The page being written is not a root page, and there is currently ** more than one reference to it. This only happens if the page is one ** of its own ancestor pages. Corruption. */ - rc = SQLITE_CORRUPT_BKPT; + rc = SQLITE_CORRUPT_PAGE(pPage); }else{ MemPage * const pParent = pCur->apPage[iPage-1]; int const iIdx = pCur->aiIdx[iPage-1]; @@ -79286,7 +79764,7 @@ static SQLITE_NOINLINE int btreeOverwriteOverflowCell( rc = btreeGetPage(pBt, ovflPgno, &pPage, 0); if( rc ) return rc; if( sqlite3PagerPageRefcount(pPage->pDbPage)!=1 || pPage->isInit ){ - rc = SQLITE_CORRUPT_BKPT; + rc = SQLITE_CORRUPT_PAGE(pPage); }else{ if( iOffset+ovflPageSize<(u32)nTotal ){ ovflPgno = get4byte(pPage->aData); @@ -79314,7 +79792,7 @@ static int btreeOverwriteCell(BtCursor *pCur, const BtreePayload *pX){ if( pCur->info.pPayload + pCur->info.nLocal > pPage->aDataEnd || pCur->info.pPayload < pPage->aData + pPage->cellOffset ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pPage); } if( pCur->info.nLocal==nTotal ){ /* The entire cell is local */ @@ -79395,7 +79873,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( ** Which can only happen if the SQLITE_NoSchemaError flag was set when ** the schema was loaded. This cannot be asserted though, as a user might ** set the flag, load the schema, and then unset the flag. */ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PGNO(pCur->pgnoRoot); } } @@ -79518,7 +79996,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( if( pPage->nFree<0 ){ if( NEVER(pCur->eState>CURSOR_INVALID) ){ /* ^^^^^--- due to the moveToRoot() call above */ - rc = SQLITE_CORRUPT_BKPT; + rc = SQLITE_CORRUPT_PAGE(pPage); }else{ rc = btreeComputeFreeSpace(pPage); } @@ -79535,7 +80013,10 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( if( flags & BTREE_PREFORMAT ){ rc = SQLITE_OK; szNew = p->pBt->nPreformatSize; - if( szNew<4 ) szNew = 4; + if( szNew<4 ){ + szNew = 4; + newCell[3] = 0; + } if( ISAUTOVACUUM(p->pBt) && szNew>pPage->maxLocal ){ CellInfo info; pPage->xParseCell(pPage, newCell, &info); @@ -79557,7 +80038,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( CellInfo info; assert( idx>=0 ); if( idx>=pPage->nCell ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pPage); } rc = sqlite3PagerWrite(pPage->pDbPage); if( rc ){ @@ -79584,10 +80065,10 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( ** necessary to add the PTRMAP_OVERFLOW1 pointer-map entry. */ assert( rc==SQLITE_OK ); /* clearCell never fails when nLocal==nPayload */ if( oldCell < pPage->aData+pPage->hdrOffset+10 ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pPage); } if( oldCell+szNew > pPage->aDataEnd ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pPage); } memcpy(oldCell, newCell, szNew); return SQLITE_OK; @@ -79597,7 +80078,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( }else if( loc<0 && pPage->nCell>0 ){ assert( pPage->leaf ); idx = ++pCur->ix; - pCur->curFlags &= ~BTCF_ValidNKey; + pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl); }else{ assert( pPage->leaf ); } @@ -79627,7 +80108,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( */ if( pPage->nOverflow ){ assert( rc==SQLITE_OK ); - pCur->curFlags &= ~(BTCF_ValidNKey); + pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl); rc = balance(pCur); /* Must make sure nOverflow is reset to zero even if the balance() @@ -79689,7 +80170,7 @@ SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 nIn = pSrc->info.nLocal; aIn = pSrc->info.pPayload; if( aIn+nIn>pSrc->pPage->aDataEnd ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pSrc->pPage); } nRem = pSrc->info.nPayload; if( nIn==nRem && nInpPage->maxLocal ){ @@ -79714,7 +80195,7 @@ SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 if( nRem>nIn ){ if( aIn+nIn+4>pSrc->pPage->aDataEnd ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pSrc->pPage); } ovflIn = get4byte(&pSrc->info.pPayload[nIn]); } @@ -79810,7 +80291,7 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ assert( rc!=SQLITE_OK || CORRUPT_DB || pCur->eState==CURSOR_VALID ); if( rc || pCur->eState!=CURSOR_VALID ) return rc; }else{ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PGNO(pCur->pgnoRoot); } } assert( pCur->eState==CURSOR_VALID ); @@ -79819,14 +80300,14 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ iCellIdx = pCur->ix; pPage = pCur->pPage; if( pPage->nCell<=iCellIdx ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pPage); } pCell = findCell(pPage, iCellIdx); if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pPage); } if( pCell<&pPage->aCellIdx[pPage->nCell] ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pPage); } /* If the BTREE_SAVEPOSITION bit is on, then the cursor position must @@ -79917,7 +80398,7 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ n = pCur->pPage->pgno; } pCell = findCell(pLeaf, pLeaf->nCell-1); - if( pCell<&pLeaf->aData[4] ) return SQLITE_CORRUPT_BKPT; + if( pCell<&pLeaf->aData[4] ) return SQLITE_CORRUPT_PAGE(pLeaf); nCell = pLeaf->xCellSize(pLeaf, pCell); assert( MX_CELL_SIZE(pBt) >= nCell ); pTmp = pBt->pTmpSpace; @@ -80033,7 +80514,7 @@ static int btreeCreateTable(Btree *p, Pgno *piTable, int createTabFlags){ */ sqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &pgnoRoot); if( pgnoRoot>btreePagecount(pBt) ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PGNO(pgnoRoot); } pgnoRoot++; @@ -80081,7 +80562,7 @@ static int btreeCreateTable(Btree *p, Pgno *piTable, int createTabFlags){ } rc = ptrmapGet(pBt, pgnoRoot, &eType, &iPtrPage); if( eType==PTRMAP_ROOTPAGE || eType==PTRMAP_FREEPAGE ){ - rc = SQLITE_CORRUPT_BKPT; + rc = SQLITE_CORRUPT_PGNO(pgnoRoot); } if( rc!=SQLITE_OK ){ releasePage(pRoot); @@ -80171,14 +80652,14 @@ static int clearDatabasePage( assert( sqlite3_mutex_held(pBt->mutex) ); if( pgno>btreePagecount(pBt) ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PGNO(pgno); } rc = getAndInitPage(pBt, pgno, &pPage, 0); if( rc ) return rc; if( (pBt->openFlags & BTREE_SINGLE)==0 && sqlite3PagerPageRefcount(pPage->pDbPage) != (1 + (pgno==1)) ){ - rc = SQLITE_CORRUPT_BKPT; + rc = SQLITE_CORRUPT_PAGE(pPage); goto cleardatabasepage_out; } hdr = pPage->hdrOffset; @@ -80282,7 +80763,7 @@ static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){ assert( p->inTrans==TRANS_WRITE ); assert( iTable>=2 ); if( iTable>btreePagecount(pBt) ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PGNO(iTable); } rc = sqlite3BtreeClearTable(p, iTable, 0); @@ -80876,6 +81357,9 @@ static int checkTreePage( ** number of cells on the page. */ nCell = get2byte(&data[hdr+3]); assert( pPage->nCell==nCell ); + if( pPage->leaf || pPage->intKey==0 ){ + pCheck->nRow += nCell; + } /* EVIDENCE-OF: R-23882-45353 The cell pointer array of a b-tree page ** immediately follows the b-tree page header. */ @@ -80987,6 +81471,7 @@ static int checkTreePage( btreeHeapInsert(heap, (pc<<16)|(pc+size-1)); } } + assert( heap!=0 ); /* Add the freeblocks to the min-heap ** ** EVIDENCE-OF: R-20690-50594 The second field of the b-tree page header @@ -81086,6 +81571,7 @@ SQLITE_PRIVATE int sqlite3BtreeIntegrityCheck( sqlite3 *db, /* Database connection that is running the check */ Btree *p, /* The btree to be checked */ Pgno *aRoot, /* An array of root pages numbers for individual trees */ + Mem *aCnt, /* Memory cells to write counts for each tree to */ int nRoot, /* Number of entries in aRoot[] */ int mxErr, /* Stop reporting errors after this many */ int *pnErr, /* OUT: Write number of errors seen to this variable */ @@ -81099,7 +81585,9 @@ SQLITE_PRIVATE int sqlite3BtreeIntegrityCheck( int bPartial = 0; /* True if not checking all btrees */ int bCkFreelist = 1; /* True to scan the freelist */ VVA_ONLY( int nRef ); + assert( nRoot>0 ); + assert( aCnt!=0 ); /* aRoot[0]==0 means this is a partial check */ if( aRoot[0]==0 ){ @@ -81172,15 +81660,18 @@ SQLITE_PRIVATE int sqlite3BtreeIntegrityCheck( testcase( pBt->db->flags & SQLITE_CellSizeCk ); pBt->db->flags &= ~(u64)SQLITE_CellSizeCk; for(i=0; (int)iautoVacuum && aRoot[i]>1 && !bPartial ){ - checkPtrmap(&sCheck, aRoot[i], PTRMAP_ROOTPAGE, 0); - } + if( pBt->autoVacuum && aRoot[i]>1 && !bPartial ){ + checkPtrmap(&sCheck, aRoot[i], PTRMAP_ROOTPAGE, 0); + } #endif - sCheck.v0 = aRoot[i]; - checkTreePage(&sCheck, aRoot[i], ¬Used, LARGEST_INT64); + sCheck.v0 = aRoot[i]; + checkTreePage(&sCheck, aRoot[i], ¬Used, LARGEST_INT64); + } + sqlite3MemSetArrayInt64(aCnt, i, sCheck.nRow); } pBt->db->flags = savedDbFlags; @@ -83235,6 +83726,13 @@ SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){ } } +/* +** Set the iIdx'th entry of array aMem[] to contain integer value val. +*/ +SQLITE_PRIVATE void sqlite3MemSetArrayInt64(sqlite3_value *aMem, int iIdx, i64 val){ + sqlite3VdbeMemSetInt64(&aMem[iIdx], val); +} + /* A no-op destructor */ SQLITE_PRIVATE void sqlite3NoopDestructor(void *p){ UNUSED_PARAMETER(p); } @@ -83923,14 +84421,20 @@ static int valueFromExpr( } /* Handle negative integers in a single step. This is needed in the - ** case when the value is -9223372036854775808. - */ - if( op==TK_UMINUS - && (pExpr->pLeft->op==TK_INTEGER || pExpr->pLeft->op==TK_FLOAT) ){ - pExpr = pExpr->pLeft; - op = pExpr->op; - negInt = -1; - zNeg = "-"; + ** case when the value is -9223372036854775808. Except - do not do this + ** for hexadecimal literals. */ + if( op==TK_UMINUS ){ + Expr *pLeft = pExpr->pLeft; + if( (pLeft->op==TK_INTEGER || pLeft->op==TK_FLOAT) ){ + if( ExprHasProperty(pLeft, EP_IntValue) + || pLeft->u.zToken[0]!='0' || (pLeft->u.zToken[1] & ~0x20)!='X' + ){ + pExpr = pLeft; + op = pExpr->op; + negInt = -1; + zNeg = "-"; + } + } } if( op==TK_STRING || op==TK_FLOAT || op==TK_INTEGER ){ @@ -83939,12 +84443,26 @@ static int valueFromExpr( if( ExprHasProperty(pExpr, EP_IntValue) ){ sqlite3VdbeMemSetInt64(pVal, (i64)pExpr->u.iValue*negInt); }else{ - zVal = sqlite3MPrintf(db, "%s%s", zNeg, pExpr->u.zToken); - if( zVal==0 ) goto no_mem; - sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC); + i64 iVal; + if( op==TK_INTEGER && 0==sqlite3DecOrHexToI64(pExpr->u.zToken, &iVal) ){ + sqlite3VdbeMemSetInt64(pVal, iVal*negInt); + }else{ + zVal = sqlite3MPrintf(db, "%s%s", zNeg, pExpr->u.zToken); + if( zVal==0 ) goto no_mem; + sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC); + } } - if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_BLOB ){ - sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8); + if( affinity==SQLITE_AFF_BLOB ){ + if( op==TK_FLOAT ){ + assert( pVal && pVal->z && pVal->flags==(MEM_Str|MEM_Term) ); + sqlite3AtoF(pVal->z, &pVal->u.r, pVal->n, SQLITE_UTF8); + pVal->flags = MEM_Real; + }else if( op==TK_INTEGER ){ + /* This case is required by -9223372036854775808 and other strings + ** that look like integers but cannot be handled by the + ** sqlite3DecOrHexToI64() call above. */ + sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8); + } }else{ sqlite3ValueApplyAffinity(pVal, affinity, SQLITE_UTF8); } @@ -84214,17 +84732,17 @@ SQLITE_PRIVATE int sqlite3Stat4Column( sqlite3_value **ppVal /* OUT: Extracted value */ ){ u32 t = 0; /* a column type code */ - int nHdr; /* Size of the header in the record */ - int iHdr; /* Next unread header byte */ - int iField; /* Next unread data byte */ - int szField = 0; /* Size of the current data field */ + u32 nHdr; /* Size of the header in the record */ + u32 iHdr; /* Next unread header byte */ + i64 iField; /* Next unread data byte */ + u32 szField = 0; /* Size of the current data field */ int i; /* Column index */ u8 *a = (u8*)pRec; /* Typecast byte array */ Mem *pMem = *ppVal; /* Write result into this Mem object */ assert( iCol>0 ); iHdr = getVarint32(a, nHdr); - if( nHdr>nRec || iHdr>=nHdr ) return SQLITE_CORRUPT_BKPT; + if( nHdr>(u32)nRec || iHdr>=nHdr ) return SQLITE_CORRUPT_BKPT; iField = nHdr; for(i=0; i<=iCol; i++){ iHdr += getVarint32(&a[iHdr], t); @@ -85259,6 +85777,15 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){ assert( aLabel!=0 ); /* True because of tag-20230419-1 */ pOp->p2 = aLabel[ADDR(pOp->p2)]; } + + /* OPFLG_JUMP opcodes never have P2==0, though OPFLG_JUMP0 opcodes + ** might */ + assert( pOp->p2>0 + || (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP0)!=0 ); + + /* Jumps never go off the end of the bytecode array */ + assert( pOp->p2nOp + || (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP)==0 ); break; } } @@ -87666,7 +88193,7 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ /* Check for immediate foreign key violations. */ if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){ - sqlite3VdbeCheckFk(p, 0); + (void)sqlite3VdbeCheckFk(p, 0); } /* If the auto-commit flag is set and this is the only active writer @@ -88380,6 +88907,23 @@ static void serialGet( pMem->flags = IsNaN(x) ? MEM_Null : MEM_Real; } } +static int serialGet7( + const unsigned char *buf, /* Buffer to deserialize from */ + Mem *pMem /* Memory cell to write value into */ +){ + u64 x = FOUR_BYTE_UINT(buf); + u32 y = FOUR_BYTE_UINT(buf+4); + x = (x<<32) + y; + assert( sizeof(x)==8 && sizeof(pMem->u.r)==8 ); + swapMixedEndianFloat(x); + memcpy(&pMem->u.r, &x, sizeof(x)); + if( IsNaN(x) ){ + pMem->flags = MEM_Null; + return 1; + } + pMem->flags = MEM_Real; + return 0; +} SQLITE_PRIVATE void sqlite3VdbeSerialGet( const unsigned char *buf, /* Buffer to deserialize from */ u32 serial_type, /* Serial type to deserialize */ @@ -88819,17 +89363,15 @@ SQLITE_PRIVATE int sqlite3IntFloatCompare(i64 i, double r){ return (xr); }else{ i64 y; - double s; if( r<-9223372036854775808.0 ) return +1; if( r>=9223372036854775808.0 ) return -1; y = (i64)r; if( iy ) return +1; - s = (double)i; - testcase( doubleLt(s,r) ); - testcase( doubleLt(r,s) ); - testcase( doubleEq(r,s) ); - return (sr); + testcase( doubleLt(((double)i),r) ); + testcase( doubleLt(r,((double)i)) ); + testcase( doubleEq(r,((double)i)) ); + return (((double)i)r); } } @@ -89059,7 +89601,7 @@ SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip( }else if( serial_type==0 ){ rc = -1; }else if( serial_type==7 ){ - sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1); + serialGet7(&aKey1[d1], &mem1); rc = -sqlite3IntFloatCompare(pRhs->u.i, mem1.u.r); }else{ i64 lhs = vdbeRecordDecodeInt(serial_type, &aKey1[d1]); @@ -89084,14 +89626,18 @@ SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip( }else if( serial_type==0 ){ rc = -1; }else{ - sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1); if( serial_type==7 ){ - if( mem1.u.ru.r ){ + if( serialGet7(&aKey1[d1], &mem1) ){ + rc = -1; /* mem1 is a NaN */ + }else if( mem1.u.ru.r ){ rc = -1; }else if( mem1.u.r>pRhs->u.r ){ rc = +1; + }else{ + assert( rc==0 ); } }else{ + sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1); rc = sqlite3IntFloatCompare(mem1.u.i, pRhs->u.r); } } @@ -89161,7 +89707,14 @@ SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip( /* RHS is null */ else{ serial_type = aKey1[idx1]; - rc = (serial_type!=0 && serial_type!=10); + if( serial_type==0 + || serial_type==10 + || (serial_type==7 && serialGet7(&aKey1[d1], &mem1)!=0) + ){ + assert( rc==0 ); + }else{ + rc = 1; + } } if( rc!=0 ){ @@ -89621,7 +90174,8 @@ SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe *v, int iVar, u8 aff assert( iVar>0 ); if( v ){ Mem *pMem = &v->aVar[iVar-1]; - assert( (v->db->flags & SQLITE_EnableQPSG)==0 ); + assert( (v->db->flags & SQLITE_EnableQPSG)==0 + || (v->db->mDbFlags & DBFLAG_InternalFunc)!=0 ); if( 0==(pMem->flags & MEM_Null) ){ sqlite3_value *pRet = sqlite3ValueNew(v->db); if( pRet ){ @@ -89641,7 +90195,8 @@ SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe *v, int iVar, u8 aff */ SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe *v, int iVar){ assert( iVar>0 ); - assert( (v->db->flags & SQLITE_EnableQPSG)==0 ); + assert( (v->db->flags & SQLITE_EnableQPSG)==0 + || (v->db->mDbFlags & DBFLAG_InternalFunc)!=0 ); if( iVar>=32 ){ v->expmask |= 0x80000000; }else{ @@ -92226,7 +92781,6 @@ SQLITE_API int sqlite3_stmt_scanstatus_v2( } if( flags & SQLITE_SCANSTAT_COMPLEX ){ idx = iScan; - pScan = &p->aScan[idx]; }else{ /* If the COMPLEX flag is clear, then this function must ignore any ** ScanStatus structures with ScanStatus.addrLoop set to 0. */ @@ -92239,6 +92793,8 @@ SQLITE_API int sqlite3_stmt_scanstatus_v2( } } if( idx>=p->nScan ) return 1; + assert( pScan==0 || pScan==&p->aScan[idx] ); + pScan = &p->aScan[idx]; switch( iScanStatusOp ){ case SQLITE_SCANSTAT_NLOOP: { @@ -93687,7 +94243,7 @@ case OP_Return: { /* in1 */ ** ** See also: EndCoroutine */ -case OP_InitCoroutine: { /* jump */ +case OP_InitCoroutine: { /* jump0 */ assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) ); assert( pOp->p2>=0 && pOp->p2nOp ); assert( pOp->p3>=0 && pOp->p3nOp ); @@ -93710,7 +94266,9 @@ jump_to_p2: ** ** The instruction at the address in register P1 is a Yield. ** Jump to the P2 parameter of that Yield. -** After the jump, register P1 becomes undefined. +** After the jump, the value register P1 is left with a value +** such that subsequent OP_Yields go back to the this same +** OP_EndCoroutine instruction. ** ** See also: InitCoroutine */ @@ -93722,8 +94280,8 @@ case OP_EndCoroutine: { /* in1 */ pCaller = &aOp[pIn1->u.i]; assert( pCaller->opcode==OP_Yield ); assert( pCaller->p2>=0 && pCaller->p2nOp ); + pIn1->u.i = (int)(pOp - p->aOp) - 1; pOp = &aOp[pCaller->p2 - 1]; - pIn1->flags = MEM_Undefined; break; } @@ -93740,7 +94298,7 @@ case OP_EndCoroutine: { /* in1 */ ** ** See also: InitCoroutine */ -case OP_Yield: { /* in1, jump */ +case OP_Yield: { /* in1, jump0 */ int pcDest; pIn1 = &aMem[pOp->p1]; assert( VdbeMemDynamic(pIn1)==0 ); @@ -94070,19 +94628,15 @@ case OP_Blob: { /* out2 */ break; } -/* Opcode: Variable P1 P2 * P4 * -** Synopsis: r[P2]=parameter(P1,P4) +/* Opcode: Variable P1 P2 * * * +** Synopsis: r[P2]=parameter(P1) ** ** Transfer the values of bound parameter P1 into register P2 -** -** If the parameter is named, then its name appears in P4. -** The P4 value is used by sqlite3_bind_parameter_name(). */ case OP_Variable: { /* out2 */ Mem *pVar; /* Value being transferred */ assert( pOp->p1>0 && pOp->p1<=p->nVar ); - assert( pOp->p4.z==0 || pOp->p4.z==sqlite3VListNumToName(p->pVList,pOp->p1) ); pVar = &p->aVar[pOp->p1 - 1]; if( sqlite3VdbeMemTooBig(pVar) ){ goto too_big; @@ -94603,7 +95157,7 @@ case OP_AddImm: { /* in1 */ ** without data loss, then jump immediately to P2, or if P2==0 ** raise an SQLITE_MISMATCH exception. */ -case OP_MustBeInt: { /* jump, in1 */ +case OP_MustBeInt: { /* jump0, in1 */ pIn1 = &aMem[pOp->p1]; if( (pIn1->flags & MEM_Int)==0 ){ applyAffinity(pIn1, SQLITE_AFF_NUMERIC, encoding); @@ -94644,7 +95198,7 @@ case OP_RealAffinity: { /* in1 */ } #endif -#ifndef SQLITE_OMIT_CAST +#if !defined(SQLITE_OMIT_CAST) && !defined(SQLITE_OMIT_ANALYZE) /* Opcode: Cast P1 P2 * * * ** Synopsis: affinity(r[P1]) ** @@ -94859,7 +95413,9 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */ } } }else if( affinity==SQLITE_AFF_TEXT && ((flags1 | flags3) & MEM_Str)!=0 ){ - if( (flags1 & MEM_Str)==0 && (flags1&(MEM_Int|MEM_Real|MEM_IntReal))!=0 ){ + if( (flags1 & MEM_Str)!=0 ){ + pIn1->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal); + }else if( (flags1&(MEM_Int|MEM_Real|MEM_IntReal))!=0 ){ testcase( pIn1->flags & MEM_Int ); testcase( pIn1->flags & MEM_Real ); testcase( pIn1->flags & MEM_IntReal ); @@ -94868,7 +95424,9 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */ flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask); if( NEVER(pIn1==pIn3) ) flags3 = flags1 | MEM_Str; } - if( (flags3 & MEM_Str)==0 && (flags3&(MEM_Int|MEM_Real|MEM_IntReal))!=0 ){ + if( (flags3 & MEM_Str)!=0 ){ + pIn3->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal); + }else if( (flags3&(MEM_Int|MEM_Real|MEM_IntReal))!=0 ){ testcase( pIn3->flags & MEM_Int ); testcase( pIn3->flags & MEM_Real ); testcase( pIn3->flags & MEM_IntReal ); @@ -96212,11 +96770,16 @@ case OP_MakeRecord: { switch( len ){ default: zPayload[7] = (u8)(v&0xff); v >>= 8; zPayload[6] = (u8)(v&0xff); v >>= 8; + /* no break */ deliberate_fall_through case 6: zPayload[5] = (u8)(v&0xff); v >>= 8; zPayload[4] = (u8)(v&0xff); v >>= 8; + /* no break */ deliberate_fall_through case 4: zPayload[3] = (u8)(v&0xff); v >>= 8; + /* no break */ deliberate_fall_through case 3: zPayload[2] = (u8)(v&0xff); v >>= 8; + /* no break */ deliberate_fall_through case 2: zPayload[1] = (u8)(v&0xff); v >>= 8; + /* no break */ deliberate_fall_through case 1: zPayload[0] = (u8)(v&0xff); } zPayload += len; @@ -97135,7 +97698,8 @@ case OP_SequenceTest: { ** is the only cursor opcode that works with a pseudo-table. ** ** P3 is the number of fields in the records that will be stored by -** the pseudo-table. +** the pseudo-table. If P2 is 0 or negative then the pseudo-cursor +** will return NULL for every column. */ case OP_OpenPseudo: { VdbeCursor *pCx; @@ -97278,10 +97842,10 @@ case OP_ColumnsUsed: { ** ** See also: Found, NotFound, SeekGt, SeekGe, SeekLt */ -case OP_SeekLT: /* jump, in3, group, ncycle */ -case OP_SeekLE: /* jump, in3, group, ncycle */ -case OP_SeekGE: /* jump, in3, group, ncycle */ -case OP_SeekGT: { /* jump, in3, group, ncycle */ +case OP_SeekLT: /* jump0, in3, group, ncycle */ +case OP_SeekLE: /* jump0, in3, group, ncycle */ +case OP_SeekGE: /* jump0, in3, group, ncycle */ +case OP_SeekGT: { /* jump0, in3, group, ncycle */ int res; /* Comparison result */ int oc; /* Opcode */ VdbeCursor *pC; /* The cursor to seek */ @@ -97948,7 +98512,7 @@ case OP_Found: { /* jump, in3, ncycle */ ** ** See also: Found, NotFound, NoConflict, SeekRowid */ -case OP_SeekRowid: { /* jump, in3, ncycle */ +case OP_SeekRowid: { /* jump0, in3, ncycle */ VdbeCursor *pC; BtCursor *pCrsr; int res; @@ -98707,7 +99271,7 @@ case OP_NullRow: { ** configured to use Prev, not Next. */ case OP_SeekEnd: /* ncycle */ -case OP_Last: { /* jump, ncycle */ +case OP_Last: { /* jump0, ncycle */ VdbeCursor *pC; BtCursor *pCrsr; int res; @@ -98741,28 +99305,38 @@ case OP_Last: { /* jump, ncycle */ break; } -/* Opcode: IfSmaller P1 P2 P3 * * +/* Opcode: IfSizeBetween P1 P2 P3 P4 * ** -** Estimate the number of rows in the table P1. Jump to P2 if that -** estimate is less than approximately 2**(0.1*P3). +** Let N be the approximate number of rows in the table or index +** with cursor P1 and let X be 10*log2(N) if N is positive or -1 +** if N is zero. +** +** Jump to P2 if X is in between P3 and P4, inclusive. */ -case OP_IfSmaller: { /* jump */ +case OP_IfSizeBetween: { /* jump */ VdbeCursor *pC; BtCursor *pCrsr; int res; i64 sz; assert( pOp->p1>=0 && pOp->p1nCursor ); + assert( pOp->p4type==P4_INT32 ); + assert( pOp->p3>=-1 && pOp->p3<=640*2 ); + assert( pOp->p4.i>=-1 && pOp->p4.i<=640*2 ); pC = p->apCsr[pOp->p1]; assert( pC!=0 ); pCrsr = pC->uc.pCursor; assert( pCrsr ); rc = sqlite3BtreeFirst(pCrsr, &res); if( rc ) goto abort_due_to_error; - if( res==0 ){ + if( res!=0 ){ + sz = -1; /* -Infinity encoding */ + }else{ sz = sqlite3BtreeRowCountEst(pCrsr); - if( ALWAYS(sz>=0) && sqlite3LogEst((u64)sz)p3 ) res = 1; + assert( sz>0 ); + sz = sqlite3LogEst((u64)sz); } + res = sz>=pOp->p3 && sz<=pOp->p4.i; VdbeBranchTaken(res!=0,2); if( res ) goto jump_to_p2; break; @@ -98815,7 +99389,7 @@ case OP_Sort: { /* jump ncycle */ ** from the beginning toward the end. In other words, the cursor is ** configured to use Next, not Prev. */ -case OP_Rewind: { /* jump, ncycle */ +case OP_Rewind: { /* jump0, ncycle */ VdbeCursor *pC; BtCursor *pCrsr; int res; @@ -99462,11 +100036,18 @@ case OP_CreateBtree: { /* out2 */ break; } -/* Opcode: SqlExec * * * P4 * +/* Opcode: SqlExec P1 P2 * P4 * ** ** Run the SQL statement or statements specified in the P4 string. -** Disable Auth and Trace callbacks while those statements are running if -** P1 is true. +** +** The P1 parameter is a bitmask of options: +** +** 0x0001 Disable Auth and Trace callbacks while the statements +** in P4 are running. +** +** 0x0002 Set db->nAnalysisLimit to P2 while the statements in +** P4 are running. +** */ case OP_SqlExec: { char *zErr; @@ -99474,6 +100055,7 @@ case OP_SqlExec: { sqlite3_xauth xAuth; #endif u8 mTrace; + int savedAnalysisLimit; sqlite3VdbeIncrWriteCounter(p, 0); db->nSqlExec++; @@ -99482,18 +100064,23 @@ case OP_SqlExec: { xAuth = db->xAuth; #endif mTrace = db->mTrace; - if( pOp->p1 ){ + savedAnalysisLimit = db->nAnalysisLimit; + if( pOp->p1 & 0x0001 ){ #ifndef SQLITE_OMIT_AUTHORIZATION db->xAuth = 0; #endif db->mTrace = 0; } + if( pOp->p1 & 0x0002 ){ + db->nAnalysisLimit = pOp->p2; + } rc = sqlite3_exec(db, pOp->p4.z, 0, 0, &zErr); db->nSqlExec--; #ifndef SQLITE_OMIT_AUTHORIZATION db->xAuth = xAuth; #endif db->mTrace = mTrace; + db->nAnalysisLimit = savedAnalysisLimit; if( zErr || rc ){ sqlite3VdbeError(p, "%s", zErr); sqlite3_free(zErr); @@ -99645,11 +100232,11 @@ case OP_DropTrigger: { /* Opcode: IntegrityCk P1 P2 P3 P4 P5 ** ** Do an analysis of the currently open database. Store in -** register P1 the text of an error message describing any problems. -** If no problems are found, store a NULL in register P1. +** register (P1+1) the text of an error message describing any problems. +** If no problems are found, store a NULL in register (P1+1). ** -** The register P3 contains one less than the maximum number of allowed errors. -** At most reg(P3) errors will be reported. +** The register (P1) contains one less than the maximum number of allowed +** errors. At most reg(P1) errors will be reported. ** In other words, the analysis stops as soon as reg(P1) errors are ** seen. Reg(P1) is updated with the number of errors remaining. ** @@ -99669,19 +100256,21 @@ case OP_IntegrityCk: { Mem *pnErr; /* Register keeping track of errors remaining */ assert( p->bIsReader ); + assert( pOp->p4type==P4_INTARRAY ); nRoot = pOp->p2; aRoot = pOp->p4.ai; assert( nRoot>0 ); + assert( aRoot!=0 ); assert( aRoot[0]==(Pgno)nRoot ); - assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) ); - pnErr = &aMem[pOp->p3]; + assert( pOp->p1>0 && (pOp->p1+1)<=(p->nMem+1 - p->nCursor) ); + pnErr = &aMem[pOp->p1]; assert( (pnErr->flags & MEM_Int)!=0 ); assert( (pnErr->flags & (MEM_Str|MEM_Blob))==0 ); - pIn1 = &aMem[pOp->p1]; + pIn1 = &aMem[pOp->p1+1]; assert( pOp->p5nDb ); assert( DbMaskTest(p->btreeMask, pOp->p5) ); - rc = sqlite3BtreeIntegrityCheck(db, db->aDb[pOp->p5].pBt, &aRoot[1], nRoot, - (int)pnErr->u.i+1, &nErr, &z); + rc = sqlite3BtreeIntegrityCheck(db, db->aDb[pOp->p5].pBt, &aRoot[1], + &aMem[pOp->p3], nRoot, (int)pnErr->u.i+1, &nErr, &z); sqlite3VdbeMemSetNull(pIn1); if( nErr==0 ){ assert( z==0 ); @@ -99808,7 +100397,9 @@ case OP_RowSetTest: { /* jump, in1, in3 */ ** P1 contains the address of the memory cell that contains the first memory ** cell in an array of values used as arguments to the sub-program. P2 ** contains the address to jump to if the sub-program throws an IGNORE -** exception using the RAISE() function. Register P3 contains the address +** exception using the RAISE() function. P2 might be zero, if there is +** no possibility that an IGNORE exception will be raised. +** Register P3 contains the address ** of a memory cell in this (the parent) VM that is used to allocate the ** memory required by the sub-vdbe at runtime. ** @@ -99816,7 +100407,7 @@ case OP_RowSetTest: { /* jump, in1, in3 */ ** ** If P5 is non-zero, then recursive program invocation is enabled. */ -case OP_Program: { /* jump */ +case OP_Program: { /* jump0 */ int nMem; /* Number of memory registers for sub-program */ int nByte; /* Bytes of runtime space required for sub-program */ Mem *pRt; /* Register to allocate runtime space */ @@ -101365,7 +101956,7 @@ case OP_Filter: { /* jump */ ** error is encountered. */ case OP_Trace: -case OP_Init: { /* jump */ +case OP_Init: { /* jump0 */ int i; #ifndef SQLITE_OMIT_TRACE char *zTrace; @@ -105266,10 +105857,10 @@ static int bytecodevtabColumn( #ifdef SQLITE_ENABLE_STMT_SCANSTATUS case 9: /* nexec */ - sqlite3_result_int(ctx, pOp->nExec); + sqlite3_result_int64(ctx, pOp->nExec); break; case 10: /* ncycle */ - sqlite3_result_int(ctx, pOp->nCycle); + sqlite3_result_int64(ctx, pOp->nCycle); break; #else case 9: /* nexec */ @@ -106213,6 +106804,8 @@ static void resolveAlias( assert( iCol>=0 && iColnExpr ); pOrig = pEList->a[iCol].pExpr; assert( pOrig!=0 ); + assert( !ExprHasProperty(pExpr, EP_Reduced|EP_TokenOnly) ); + if( pExpr->pAggInfo ) return; db = pParse->db; pDup = sqlite3ExprDup(db, pOrig, 0); if( db->mallocFailed ){ @@ -106360,7 +106953,7 @@ static void extendFJMatch( static SQLITE_NOINLINE int isValidSchemaTableName( const char *zTab, /* Name as it appears in the SQL */ Table *pTab, /* The schema table we are trying to match */ - Schema *pSchema /* non-NULL if a database qualifier is present */ + const char *zDb /* non-NULL if a database qualifier is present */ ){ const char *zLegacy; assert( pTab!=0 ); @@ -106371,7 +106964,7 @@ static SQLITE_NOINLINE int isValidSchemaTableName( if( sqlite3StrICmp(zTab+7, &PREFERRED_TEMP_SCHEMA_TABLE[7])==0 ){ return 1; } - if( pSchema==0 ) return 0; + if( zDb==0 ) return 0; if( sqlite3StrICmp(zTab+7, &LEGACY_SCHEMA_TABLE[7])==0 ) return 1; if( sqlite3StrICmp(zTab+7, &PREFERRED_SCHEMA_TABLE[7])==0 ) return 1; }else{ @@ -106411,7 +107004,7 @@ static int lookupName( Parse *pParse, /* The parsing context */ const char *zDb, /* Name of the database containing table, or NULL */ const char *zTab, /* Name of table containing column, or NULL */ - const char *zCol, /* Name of the column. */ + const Expr *pRight, /* Name of the column. */ NameContext *pNC, /* The name context used to resolve the name */ Expr *pExpr /* Make this EXPR node point to the selected column */ ){ @@ -106428,6 +107021,7 @@ static int lookupName( Table *pTab = 0; /* Table holding the row */ Column *pCol; /* A column of pTab */ ExprList *pFJMatch = 0; /* Matches for FULL JOIN .. USING */ + const char *zCol = pRight->u.zToken; assert( pNC ); /* the name context cannot be NULL. */ assert( zCol ); /* The Z in X.Y.Z cannot be NULL */ @@ -106553,7 +107147,7 @@ static int lookupName( } }else if( sqlite3StrICmp(zTab, pTab->zName)!=0 ){ if( pTab->tnum!=1 ) continue; - if( !isValidSchemaTableName(zTab, pTab, pSchema) ) continue; + if( !isValidSchemaTableName(zTab, pTab, zDb) ) continue; } assert( ExprUseYTab(pExpr) ); if( IN_RENAME_OBJECT && pItem->zAlias ){ @@ -106600,8 +107194,37 @@ static int lookupName( } } if( 0==cnt && VisibleRowid(pTab) ){ + /* pTab is a potential ROWID match. Keep track of it and match + ** the ROWID later if that seems appropriate. (Search for "cntTab" + ** to find related code.) Only allow a ROWID match if there is + ** a single ROWID match candidate. + */ +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + /* In SQLITE_ALLOW_ROWID_IN_VIEW mode, allow a ROWID match + ** if there is a single VIEW candidate or if there is a single + ** non-VIEW candidate plus multiple VIEW candidates. In other + ** words non-VIEW candidate terms take precedence over VIEWs. + */ + if( cntTab==0 + || (cntTab==1 + && ALWAYS(pMatch!=0) + && ALWAYS(pMatch->pTab!=0) + && (pMatch->pTab->tabFlags & TF_Ephemeral)!=0 + && (pTab->tabFlags & TF_Ephemeral)==0) + ){ + cntTab = 1; + pMatch = pItem; + }else{ + cntTab++; + } +#else + /* The (much more common) non-SQLITE_ALLOW_ROWID_IN_VIEW case is + ** simpler since we require exactly one candidate, which will + ** always be a non-VIEW + */ cntTab++; pMatch = pItem; +#endif } } if( pMatch ){ @@ -106630,7 +107253,8 @@ static int lookupName( if( pParse->bReturning ){ if( (pNC->ncFlags & NC_UBaseReg)!=0 && ALWAYS(zTab==0 - || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0) + || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0 + || isValidSchemaTableName(zTab, pParse->pTriggerTab, 0)) ){ pExpr->iTable = op!=TK_DELETE; pTab = pParse->pTriggerTab; @@ -106727,13 +107351,18 @@ static int lookupName( ** Perhaps the name is a reference to the ROWID */ if( cnt==0 - && cntTab==1 + && cntTab>=1 && pMatch && (pNC->ncFlags & (NC_IdxExpr|NC_GenCol))==0 && sqlite3IsRowid(zCol) && ALWAYS(VisibleRowid(pMatch->pTab) || pMatch->fg.isNestedFrom) ){ - cnt = 1; + cnt = cntTab; +#if SQLITE_ALLOW_ROWID_IN_VIEW+0==2 + if( pMatch->pTab!=0 && IsView(pMatch->pTab) ){ + eNewExprOp = TK_NULL; + } +#endif if( pMatch->fg.isNestedFrom==0 ) pExpr->iColumn = -1; pExpr->affExpr = SQLITE_AFF_INTEGER; } @@ -106887,6 +107516,10 @@ static int lookupName( sqlite3ErrorMsg(pParse, "%s: %s.%s.%s", zErr, zDb, zTab, zCol); }else if( zTab ){ sqlite3ErrorMsg(pParse, "%s: %s.%s", zErr, zTab, zCol); + }else if( cnt==0 && ExprHasProperty(pRight,EP_DblQuoted) ){ + sqlite3ErrorMsg(pParse, "%s: \"%s\" - should this be a" + " string literal in single-quotes?", + zErr, zCol); }else{ sqlite3ErrorMsg(pParse, "%s: %s", zErr, zCol); } @@ -106920,8 +107553,12 @@ static int lookupName( ** If a generated column is referenced, set bits for every column ** of the table. */ - if( pExpr->iColumn>=0 && cnt==1 && pMatch!=0 ){ - pMatch->colUsed |= sqlite3ExprColUsed(pExpr); + if( pMatch ){ + if( pExpr->iColumn>=0 ){ + pMatch->colUsed |= sqlite3ExprColUsed(pExpr); + }else{ + pMatch->fg.rowidUsed = 1; + } } pExpr->op = eNewExprOp; @@ -107098,6 +107735,19 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ ** resolved. This prevents "column" from being counted as having been ** referenced, which might prevent a SELECT from being erroneously ** marked as correlated. + ** + ** 2024-03-28: Beware of aggregates. A bare column of aggregated table + ** can still evaluate to NULL even though it is marked as NOT NULL. + ** Example: + ** + ** CREATE TABLE t1(a INT NOT NULL); + ** SELECT a, a IS NULL, a IS NOT NULL, count(*) FROM t1; + ** + ** The "a IS NULL" and "a IS NOT NULL" expressions cannot be optimized + ** here because at the time this case is hit, we do not yet know whether + ** or not t1 is being aggregated. We have to assume the worst and omit + ** the optimization. The only time it is safe to apply this optimization + ** is within the WHERE clause. */ case TK_NOTNULL: case TK_ISNULL: { @@ -107108,19 +107758,36 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ anRef[i] = p->nRef; } sqlite3WalkExpr(pWalker, pExpr->pLeft); - if( 0==sqlite3ExprCanBeNull(pExpr->pLeft) && !IN_RENAME_OBJECT ){ - testcase( ExprHasProperty(pExpr, EP_OuterON) ); - assert( !ExprHasProperty(pExpr, EP_IntValue) ); - pExpr->u.iValue = (pExpr->op==TK_NOTNULL); - pExpr->flags |= EP_IntValue; - pExpr->op = TK_INTEGER; - - for(i=0, p=pNC; p && ipNext, i++){ - p->nRef = anRef[i]; - } - sqlite3ExprDelete(pParse->db, pExpr->pLeft); - pExpr->pLeft = 0; + if( IN_RENAME_OBJECT ) return WRC_Prune; + if( sqlite3ExprCanBeNull(pExpr->pLeft) ){ + /* The expression can be NULL. So the optimization does not apply */ + return WRC_Prune; } + + for(i=0, p=pNC; p; p=p->pNext, i++){ + if( (p->ncFlags & NC_Where)==0 ){ + return WRC_Prune; /* Not in a WHERE clause. Unsafe to optimize. */ + } + } + testcase( ExprHasProperty(pExpr, EP_OuterON) ); + assert( !ExprHasProperty(pExpr, EP_IntValue) ); +#if TREETRACE_ENABLED + if( sqlite3TreeTrace & 0x80000 ){ + sqlite3DebugPrintf( + "NOT NULL strength reduction converts the following to %d:\n", + pExpr->op==TK_NOTNULL + ); + sqlite3ShowExpr(pExpr); + } +#endif /* TREETRACE_ENABLED */ + pExpr->u.iValue = (pExpr->op==TK_NOTNULL); + pExpr->flags |= EP_IntValue; + pExpr->op = TK_INTEGER; + for(i=0, p=pNC; p && ipNext, i++){ + p->nRef = anRef[i]; + } + sqlite3ExprDelete(pParse->db, pExpr->pLeft); + pExpr->pLeft = 0; return WRC_Prune; } @@ -107134,7 +107801,6 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ */ case TK_ID: case TK_DOT: { - const char *zColumn; const char *zTable; const char *zDb; Expr *pRight; @@ -107143,7 +107809,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ zDb = 0; zTable = 0; assert( !ExprHasProperty(pExpr, EP_IntValue) ); - zColumn = pExpr->u.zToken; + pRight = pExpr; }else{ Expr *pLeft = pExpr->pLeft; testcase( pNC->ncFlags & NC_IdxExpr ); @@ -107162,14 +107828,13 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ } assert( ExprUseUToken(pLeft) && ExprUseUToken(pRight) ); zTable = pLeft->u.zToken; - zColumn = pRight->u.zToken; assert( ExprUseYTab(pExpr) ); if( IN_RENAME_OBJECT ){ sqlite3RenameTokenRemap(pParse, (void*)pExpr, (void*)pRight); sqlite3RenameTokenRemap(pParse, (void*)&pExpr->y.pTab, (void*)pLeft); } } - return lookupName(pParse, zDb, zTable, zColumn, pNC, pExpr); + return lookupName(pParse, zDb, zTable, pRight, pNC, pExpr); } /* Resolve function names @@ -107345,11 +108010,9 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ #endif } } -#ifndef SQLITE_OMIT_WINDOWFUNC - else if( ExprHasProperty(pExpr, EP_WinFunc) ){ + else if( ExprHasProperty(pExpr, EP_WinFunc) || pExpr->pLeft ){ is_agg = 1; } -#endif sqlite3WalkExprList(pWalker, pList); if( is_agg ){ if( pExpr->pLeft ){ @@ -107419,6 +108082,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ testcase( pNC->ncFlags & NC_PartIdx ); testcase( pNC->ncFlags & NC_IdxExpr ); testcase( pNC->ncFlags & NC_GenCol ); + assert( pExpr->x.pSelect ); if( pNC->ncFlags & NC_SelfRef ){ notValidImpl(pParse, pNC, "subqueries", pExpr, pExpr); }else{ @@ -107427,6 +108091,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ assert( pNC->nRef>=nRef ); if( nRef!=pNC->nRef ){ ExprSetProperty(pExpr, EP_VarSelect); + pExpr->x.pSelect->selFlags |= SF_Correlated; } pNC->ncFlags |= NC_Subquery; } @@ -107952,6 +108617,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ if( pOuterNC ) pOuterNC->nNestedSelect++; for(i=0; ipSrc->nSrc; i++){ SrcItem *pItem = &p->pSrc->a[i]; + assert( pItem->zName!=0 || pItem->pSelect!=0 );/* Test of tag-20240424-1*/ if( pItem->pSelect && (pItem->pSelect->selFlags & SF_Resolved)==0 ){ int nRef = pOuterNC ? pOuterNC->nRef : 0; const char *zSavedContext = pParse->zAuthContext; @@ -108020,7 +108686,9 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ } if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort; } + sNC.ncFlags |= NC_Where; if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort; + sNC.ncFlags &= ~NC_Where; /* Resolve names in table-valued-function arguments */ for(i=0; ipSrc->nSrc; i++){ @@ -108211,6 +108879,9 @@ SQLITE_PRIVATE int sqlite3ResolveExprNames( ** Resolve all names for all expression in an expression list. This is ** just like sqlite3ResolveExprNames() except that it works for an expression ** list rather than a single expression. +** +** The return value is SQLITE_OK (0) for success or SQLITE_ERROR (1) for a +** failure. */ SQLITE_PRIVATE int sqlite3ResolveExprListNames( NameContext *pNC, /* Namespace to resolve expressions in. */ @@ -108219,7 +108890,7 @@ SQLITE_PRIVATE int sqlite3ResolveExprListNames( int i; int savedHasAgg = 0; Walker w; - if( pList==0 ) return WRC_Continue; + if( pList==0 ) return SQLITE_OK; w.pParse = pNC->pParse; w.xExprCallback = resolveExprStep; w.xSelectCallback = resolveSelectStep; @@ -108233,7 +108904,7 @@ SQLITE_PRIVATE int sqlite3ResolveExprListNames( #if SQLITE_MAX_EXPR_DEPTH>0 w.pParse->nHeight += pExpr->nHeight; if( sqlite3ExprCheckHeight(w.pParse, w.pParse->nHeight) ){ - return WRC_Abort; + return SQLITE_ERROR; } #endif sqlite3WalkExprNN(&w, pExpr); @@ -108250,10 +108921,10 @@ SQLITE_PRIVATE int sqlite3ResolveExprListNames( (NC_HasAgg|NC_MinMaxAgg|NC_HasWin|NC_OrderAgg); pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg|NC_HasWin|NC_OrderAgg); } - if( w.pParse->nErr>0 ) return WRC_Abort; + if( w.pParse->nErr>0 ) return SQLITE_ERROR; } pNC->ncFlags |= savedHasAgg; - return WRC_Continue; + return SQLITE_OK; } /* @@ -108559,9 +109230,10 @@ SQLITE_PRIVATE Expr *sqlite3ExprSkipCollateAndLikely(Expr *pExpr){ assert( pExpr->x.pList->nExpr>0 ); assert( pExpr->op==TK_FUNCTION ); pExpr = pExpr->x.pList->a[0].pExpr; - }else{ - assert( pExpr->op==TK_COLLATE ); + }else if( pExpr->op==TK_COLLATE ){ pExpr = pExpr->pLeft; + }else{ + break; } } return pExpr; @@ -109255,11 +109927,12 @@ SQLITE_PRIVATE void sqlite3ExprSetErrorOffset(Expr *pExpr, int iOfst){ ** appear to be quoted. If the quotes were of the form "..." (double-quotes) ** then the EP_DblQuoted flag is set on the expression node. ** -** Special case: If op==TK_INTEGER and pToken points to a string that -** can be translated into a 32-bit integer, then the token is not -** stored in u.zToken. Instead, the integer values is written -** into u.iValue and the EP_IntValue flag is set. No extra storage +** Special case (tag-20240227-a): If op==TK_INTEGER and pToken points to +** a string that can be translated into a 32-bit integer, then the token is +** not stored in u.zToken. Instead, the integer values is written +** into u.iValue and the EP_IntValue flag is set. No extra storage ** is allocated to hold the integer text and the dequote flag is ignored. +** See also tag-20240227-b. */ SQLITE_PRIVATE Expr *sqlite3ExprAlloc( sqlite3 *db, /* Handle for sqlite3DbMallocRawNN() */ @@ -109275,7 +109948,7 @@ SQLITE_PRIVATE Expr *sqlite3ExprAlloc( if( pToken ){ if( op!=TK_INTEGER || pToken->z==0 || sqlite3GetInt32(pToken->z, &iValue)==0 ){ - nExtra = pToken->n+1; + nExtra = pToken->n+1; /* tag-20240227-a */ assert( iValue>=0 ); } } @@ -109707,6 +110380,7 @@ SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){ assert( p!=0 ); assert( db!=0 ); +exprDeleteRestart: assert( !ExprUseUValue(p) || p->u.iValue>=0 ); assert( !ExprUseYWin(p) || !ExprUseYSub(p) ); assert( !ExprUseYWin(p) || p->y.pWin!=0 || db->mallocFailed ); @@ -109722,7 +110396,6 @@ static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){ if( !ExprHasProperty(p, (EP_TokenOnly|EP_Leaf)) ){ /* The Expr.x union is never used at the same time as Expr.pRight */ assert( (ExprUseXList(p) && p->x.pList==0) || p->pRight==0 ); - if( p->pLeft && p->op!=TK_SELECT_COLUMN ) sqlite3ExprDeleteNN(db, p->pLeft); if( p->pRight ){ assert( !ExprHasProperty(p, EP_WinFunc) ); sqlite3ExprDeleteNN(db, p->pRight); @@ -109737,6 +110410,19 @@ static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){ } #endif } + if( p->pLeft && p->op!=TK_SELECT_COLUMN ){ + Expr *pLeft = p->pLeft; + if( !ExprHasProperty(p, EP_Static) + && !ExprHasProperty(pLeft, EP_Static) + ){ + /* Avoid unnecessary recursion on unary operators */ + sqlite3DbNNFreeNN(db, p); + p = pLeft; + goto exprDeleteRestart; + }else{ + sqlite3ExprDeleteNN(db, pLeft); + } + } } if( !ExprHasProperty(p, EP_Static) ){ sqlite3DbNNFreeNN(db, p); @@ -109769,11 +110455,11 @@ SQLITE_PRIVATE void sqlite3ClearOnOrUsing(sqlite3 *db, OnOrUsing *p){ ** ** The pExpr might be deleted immediately on an OOM error. ** -** The deferred delete is (currently) implemented by adding the -** pExpr to the pParse->pConstExpr list with a register number of 0. +** Return 0 if the delete was successfully deferred. Return non-zero +** if the delete happened immediately because of an OOM. */ -SQLITE_PRIVATE void sqlite3ExprDeferredDelete(Parse *pParse, Expr *pExpr){ - sqlite3ParserAddCleanup(pParse, sqlite3ExprDeleteGeneric, pExpr); +SQLITE_PRIVATE int sqlite3ExprDeferredDelete(Parse *pParse, Expr *pExpr){ + return 0==sqlite3ParserAddCleanup(pParse, sqlite3ExprDeleteGeneric, pExpr); } /* Invoke sqlite3RenameExprUnmap() and sqlite3ExprDelete() on the @@ -110209,17 +110895,19 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3 *db, const SrcList *p, int fla pNewItem->iCursor = pOldItem->iCursor; pNewItem->addrFillSub = pOldItem->addrFillSub; pNewItem->regReturn = pOldItem->regReturn; + pNewItem->regResult = pOldItem->regResult; if( pNewItem->fg.isIndexedBy ){ pNewItem->u1.zIndexedBy = sqlite3DbStrDup(db, pOldItem->u1.zIndexedBy); + }else if( pNewItem->fg.isTabFunc ){ + pNewItem->u1.pFuncArg = + sqlite3ExprListDup(db, pOldItem->u1.pFuncArg, flags); + }else{ + pNewItem->u1.nRow = pOldItem->u1.nRow; } pNewItem->u2 = pOldItem->u2; if( pNewItem->fg.isCte ){ pNewItem->u2.pCteUse->nUse++; } - if( pNewItem->fg.isTabFunc ){ - pNewItem->u1.pFuncArg = - sqlite3ExprListDup(db, pOldItem->u1.pFuncArg, flags); - } pTab = pNewItem->pTab = pOldItem->pTab; if( pTab ){ pTab->nTabRef++; @@ -110685,6 +111373,54 @@ SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr *pExpr){ return pExpr; } +/* +** pExpr is a TK_FUNCTION node. Try to determine whether or not the +** function is a constant function. A function is constant if all of +** the following are true: +** +** (1) It is a scalar function (not an aggregate or window function) +** (2) It has either the SQLITE_FUNC_CONSTANT or SQLITE_FUNC_SLOCHNG +** property. +** (3) All of its arguments are constants +** +** This routine sets pWalker->eCode to 0 if pExpr is not a constant. +** It makes no changes to pWalker->eCode if pExpr is constant. In +** every case, it returns WRC_Abort. +** +** Called as a service subroutine from exprNodeIsConstant(). +*/ +static SQLITE_NOINLINE int exprNodeIsConstantFunction( + Walker *pWalker, + Expr *pExpr +){ + int n; /* Number of arguments */ + ExprList *pList; /* List of arguments */ + FuncDef *pDef; /* The function */ + sqlite3 *db; /* The database */ + + assert( pExpr->op==TK_FUNCTION ); + if( ExprHasProperty(pExpr, EP_TokenOnly) + || (pList = pExpr->x.pList)==0 + ){; + n = 0; + }else{ + n = pList->nExpr; + sqlite3WalkExprList(pWalker, pList); + if( pWalker->eCode==0 ) return WRC_Abort; + } + db = pWalker->pParse->db; + pDef = sqlite3FindFunction(db, pExpr->u.zToken, n, ENC(db), 0); + if( pDef==0 + || pDef->xFinalize!=0 + || (pDef->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG))==0 + || ExprHasProperty(pExpr, EP_WinFunc) + ){ + pWalker->eCode = 0; + return WRC_Abort; + } + return WRC_Prune; +} + /* ** These routines are Walker callbacks used to check expressions to @@ -110713,6 +111449,7 @@ SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr *pExpr){ ** malformed schema error. */ static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){ + assert( pWalker->eCode>0 ); /* If pWalker->eCode is 2 then any term of the expression that comes from ** the ON or USING clauses of an outer join disqualifies the expression @@ -110732,6 +111469,8 @@ static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){ ){ if( pWalker->eCode==5 ) ExprSetProperty(pExpr, EP_FromDDL); return WRC_Continue; + }else if( pWalker->pParse ){ + return exprNodeIsConstantFunction(pWalker, pExpr); }else{ pWalker->eCode = 0; return WRC_Abort; @@ -110760,9 +111499,11 @@ static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){ case TK_IF_NULL_ROW: case TK_REGISTER: case TK_DOT: + case TK_RAISE: testcase( pExpr->op==TK_REGISTER ); testcase( pExpr->op==TK_IF_NULL_ROW ); testcase( pExpr->op==TK_DOT ); + testcase( pExpr->op==TK_RAISE ); pWalker->eCode = 0; return WRC_Abort; case TK_VARIABLE: @@ -110784,15 +111525,15 @@ static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){ return WRC_Continue; } } -static int exprIsConst(Expr *p, int initFlag, int iCur){ +static int exprIsConst(Parse *pParse, Expr *p, int initFlag){ Walker w; w.eCode = initFlag; + w.pParse = pParse; w.xExprCallback = exprNodeIsConstant; w.xSelectCallback = sqlite3SelectWalkFail; #ifdef SQLITE_DEBUG w.xSelectCallback2 = sqlite3SelectWalkAssert2; #endif - w.u.iCur = iCur; sqlite3WalkExpr(&w, p); return w.eCode; } @@ -110804,9 +111545,15 @@ static int exprIsConst(Expr *p, int initFlag, int iCur){ ** For the purposes of this function, a double-quoted string (ex: "abc") ** is considered a variable but a single-quoted string (ex: 'abc') is ** a constant. +** +** The pParse parameter may be NULL. But if it is NULL, there is no way +** to determine if function calls are constant or not, and hence all +** function calls will be considered to be non-constant. If pParse is +** not NULL, then a function call might be constant, depending on the +** function and on its parameters. */ -SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){ - return exprIsConst(p, 1, 0); +SQLITE_PRIVATE int sqlite3ExprIsConstant(Parse *pParse, Expr *p){ + return exprIsConst(pParse, p, 1); } /* @@ -110822,8 +111569,24 @@ SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){ ** can be added to the pParse->pConstExpr list and evaluated once when ** the prepared statement starts up. See sqlite3ExprCodeRunJustOnce(). */ -SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){ - return exprIsConst(p, 2, 0); +static int sqlite3ExprIsConstantNotJoin(Parse *pParse, Expr *p){ + return exprIsConst(pParse, p, 2); +} + +/* +** This routine examines sub-SELECT statements as an expression is being +** walked as part of sqlite3ExprIsTableConstant(). Sub-SELECTs are considered +** constant as long as they are uncorrelated - meaning that they do not +** contain any terms from outer contexts. +*/ +static int exprSelectWalkTableConstant(Walker *pWalker, Select *pSelect){ + assert( pSelect!=0 ); + assert( pWalker->eCode==3 || pWalker->eCode==0 ); + if( (pSelect->selFlags & SF_Correlated)!=0 ){ + pWalker->eCode = 0; + return WRC_Abort; + } + return WRC_Prune; } /* @@ -110831,9 +111594,26 @@ SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){ ** for any single row of the table with cursor iCur. In other words, the ** expression must not refer to any non-deterministic function nor any ** table other than iCur. +** +** Consider uncorrelated subqueries to be constants if the bAllowSubq +** parameter is true. */ -SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){ - return exprIsConst(p, 3, iCur); +static int sqlite3ExprIsTableConstant(Expr *p, int iCur, int bAllowSubq){ + Walker w; + w.eCode = 3; + w.pParse = 0; + w.xExprCallback = exprNodeIsConstant; + if( bAllowSubq ){ + w.xSelectCallback = exprSelectWalkTableConstant; + }else{ + w.xSelectCallback = sqlite3SelectWalkFail; +#ifdef SQLITE_DEBUG + w.xSelectCallback2 = sqlite3SelectWalkAssert2; +#endif + } + w.u.iCur = iCur; + sqlite3WalkExpr(&w, p); + return w.eCode; } /* @@ -110851,7 +111631,10 @@ SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){ ** ** (1) pExpr cannot refer to any table other than pSrc->iCursor. ** -** (2) pExpr cannot use subqueries or non-deterministic functions. +** (2a) pExpr cannot use subqueries unless the bAllowSubq parameter is +** true and the subquery is non-correlated +** +** (2b) pExpr cannot use non-deterministic functions. ** ** (3) pSrc cannot be part of the left operand for a RIGHT JOIN. ** (Is there some way to relax this constraint?) @@ -110880,7 +111663,8 @@ SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){ SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint( Expr *pExpr, /* The constraint */ const SrcList *pSrcList, /* Complete FROM clause */ - int iSrc /* Which element of pSrcList to use */ + int iSrc, /* Which element of pSrcList to use */ + int bAllowSubq /* Allow non-correlated subqueries */ ){ const SrcItem *pSrc = &pSrcList->a[iSrc]; if( pSrc->fg.jointype & JT_LTORJ ){ @@ -110905,7 +111689,8 @@ SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint( } } } - return sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor); /* rules (1), (2) */ + /* Rules (1), (2a), and (2b) handled by the following: */ + return sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor, bAllowSubq); } @@ -110990,7 +111775,7 @@ SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse *pParse, Expr *p, ExprLi */ SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr *p, u8 isInit){ assert( isInit==0 || isInit==1 ); - return exprIsConst(p, 4+isInit, 0); + return exprIsConst(0, p, 4+isInit); } #ifdef SQLITE_ENABLE_CURSOR_HINTS @@ -111080,9 +111865,12 @@ SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr *p){ return 0; case TK_COLUMN: assert( ExprUseYTab(p) ); - return ExprHasProperty(p, EP_CanBeNull) || - NEVER(p->y.pTab==0) || /* Reference to column of index on expr */ - (p->iColumn>=0 + return ExprHasProperty(p, EP_CanBeNull) + || NEVER(p->y.pTab==0) /* Reference to column of index on expr */ +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + || (p->iColumn==XN_ROWID && IsView(p->y.pTab)) +#endif + || (p->iColumn>=0 && p->y.pTab->aCol!=0 /* Possible due to prior error */ && ALWAYS(p->iColumny.pTab->nCol) && p->y.pTab->aCol[p->iColumn].notNull==0); @@ -111235,13 +112023,13 @@ static void sqlite3SetHasNullFlag(Vdbe *v, int iCur, int regHasNull){ ** The argument is an IN operator with a list (not a subquery) on the ** right-hand side. Return TRUE if that list is constant. */ -static int sqlite3InRhsIsConstant(Expr *pIn){ +static int sqlite3InRhsIsConstant(Parse *pParse, Expr *pIn){ Expr *pLHS; int res; assert( !ExprHasProperty(pIn, EP_xIsSelect) ); pLHS = pIn->pLeft; pIn->pLeft = 0; - res = sqlite3ExprIsConstant(pIn); + res = sqlite3ExprIsConstant(pParse, pIn); pIn->pLeft = pLHS; return res; } @@ -111510,7 +112298,7 @@ SQLITE_PRIVATE int sqlite3FindInIndex( if( eType==0 && (inFlags & IN_INDEX_NOOP_OK) && ExprUseXList(pX) - && (!sqlite3InRhsIsConstant(pX) || pX->x.pList->nExpr<=2) + && (!sqlite3InRhsIsConstant(pParse,pX) || pX->x.pList->nExpr<=2) ){ pParse->nTab--; /* Back out the allocation of the unused cursor */ iTab = -1; /* Cursor is not allocated */ @@ -111793,7 +112581,7 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN( ** this code only executes once. Because for a non-constant ** expression we need to rerun this code each time. */ - if( addrOnce && !sqlite3ExprIsConstant(pE2) ){ + if( addrOnce && !sqlite3ExprIsConstant(pParse, pE2) ){ sqlite3VdbeChangeToNoop(v, addrOnce-1); sqlite3VdbeChangeToNoop(v, addrOnce); ExprClearProperty(pExpr, EP_Subrtn); @@ -112957,12 +113745,6 @@ expr_code_doover: assert( pExpr->u.zToken!=0 ); assert( pExpr->u.zToken[0]!=0 ); sqlite3VdbeAddOp2(v, OP_Variable, pExpr->iColumn, target); - if( pExpr->u.zToken[1]!=0 ){ - const char *z = sqlite3VListNumToName(pParse->pVList, pExpr->iColumn); - assert( pExpr->u.zToken[0]=='?' || (z && !strcmp(pExpr->u.zToken, z)) ); - pParse->pVList[0] = 0; /* Indicate VList may no longer be enlarged */ - sqlite3VdbeAppendP4(v, (char*)z, P4_STATIC); - } return target; } case TK_REGISTER: { @@ -113136,7 +113918,9 @@ expr_code_doover: } #endif - if( ConstFactorOk(pParse) && sqlite3ExprIsConstantNotJoin(pExpr) ){ + if( ConstFactorOk(pParse) + && sqlite3ExprIsConstantNotJoin(pParse,pExpr) + ){ /* SQL functions can be expensive. So try to avoid running them ** multiple times if we know they always give the same result */ return sqlite3ExprCodeRunJustOnce(pParse, pExpr, -1); @@ -113167,7 +113951,7 @@ expr_code_doover: } for(i=0; ia[i].pExpr) ){ + if( i<32 && sqlite3ExprIsConstant(pParse, pFarg->a[i].pExpr) ){ testcase( i==31 ); constMask |= MASKBIT32(i); } @@ -113309,8 +114093,9 @@ expr_code_doover: if( !ExprHasProperty(pExpr, EP_Collate) ){ /* A TK_COLLATE Expr node without the EP_Collate tag is a so-called ** "SOFT-COLLATE" that is added to constraints that are pushed down - ** from outer queries into sub-queries by the push-down optimization. - ** Clear subtypes as subtypes may not cross a subquery boundary. + ** from outer queries into sub-queries by the WHERE-clause push-down + ** optimization. Clear subtypes as subtypes may not cross a subquery + ** boundary. */ assert( pExpr->pLeft ); sqlite3ExprCode(pParse, pExpr->pLeft, target); @@ -113634,7 +114419,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse *pParse, Expr *pExpr, int *pReg){ if( ConstFactorOk(pParse) && ALWAYS(pExpr!=0) && pExpr->op!=TK_REGISTER - && sqlite3ExprIsConstantNotJoin(pExpr) + && sqlite3ExprIsConstantNotJoin(pParse, pExpr) ){ *pReg = 0; r2 = sqlite3ExprCodeRunJustOnce(pParse, pExpr, -1); @@ -113698,7 +114483,7 @@ SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse *pParse, Expr *pExpr, int target){ ** might choose to code the expression at initialization time. */ SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse *pParse, Expr *pExpr, int target){ - if( pParse->okConstFactor && sqlite3ExprIsConstantNotJoin(pExpr) ){ + if( pParse->okConstFactor && sqlite3ExprIsConstantNotJoin(pParse,pExpr) ){ sqlite3ExprCodeRunJustOnce(pParse, pExpr, target); }else{ sqlite3ExprCodeCopy(pParse, pExpr, target); @@ -113757,7 +114542,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeExprList( sqlite3VdbeAddOp2(v, copyOp, j+srcReg-1, target+i); } }else if( (flags & SQLITE_ECEL_FACTOR)!=0 - && sqlite3ExprIsConstantNotJoin(pExpr) + && sqlite3ExprIsConstantNotJoin(pParse,pExpr) ){ sqlite3ExprCodeRunJustOnce(pParse, pExpr, target+i); }else{ @@ -114908,9 +115693,8 @@ static int agginfoPersistExprCb(Walker *pWalker, Expr *pExpr){ && pAggInfo->aCol[iAgg].pCExpr==pExpr ){ pExpr = sqlite3ExprDup(db, pExpr, 0); - if( pExpr ){ + if( pExpr && !sqlite3ExprDeferredDelete(pParse, pExpr) ){ pAggInfo->aCol[iAgg].pCExpr = pExpr; - sqlite3ExprDeferredDelete(pParse, pExpr); } } }else{ @@ -114919,9 +115703,8 @@ static int agginfoPersistExprCb(Walker *pWalker, Expr *pExpr){ && pAggInfo->aFunc[iAgg].pFExpr==pExpr ){ pExpr = sqlite3ExprDup(db, pExpr, 0); - if( pExpr ){ + if( pExpr && !sqlite3ExprDeferredDelete(pParse, pExpr) ){ pAggInfo->aFunc[iAgg].pFExpr = pExpr; - sqlite3ExprDeferredDelete(pParse, pExpr); } } } @@ -116680,7 +117463,7 @@ static int renameResolveTrigger(Parse *pParse){ /* ALWAYS() because if the table of the trigger does not exist, the ** error would have been hit before this point */ if( ALWAYS(pParse->pTriggerTab) ){ - rc = sqlite3ViewGetColumnNames(pParse, pParse->pTriggerTab); + rc = sqlite3ViewGetColumnNames(pParse, pParse->pTriggerTab)!=0; } /* Resolve symbols in WHEN clause */ @@ -117622,7 +118405,12 @@ SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, const T if( i==pTab->iPKey ){ sqlite3VdbeAddOp2(v, OP_Null, 0, regOut); }else{ + char aff = pTab->aCol[i].affinity; + if( aff==SQLITE_AFF_REAL ){ + pTab->aCol[i].affinity = SQLITE_AFF_NUMERIC; + } sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, i, regOut); + pTab->aCol[i].affinity = aff; } nField++; } @@ -118541,7 +119329,7 @@ static void statGet( if( iVal==2 && p->nRow*10 <= nDistinct*11 ) iVal = 1; sqlite3_str_appendf(&sStat, " %llu", iVal); #ifdef SQLITE_ENABLE_STAT4 - assert( p->current.anEq[i] ); + assert( p->current.anEq[i] || p->nRow==0 ); #endif } sqlite3ResultStrAccum(context, &sStat); @@ -118726,7 +119514,7 @@ static void analyzeOneTable( for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ int nCol; /* Number of columns in pIdx. "N" */ - int addrRewind; /* Address of "OP_Rewind iIdxCur" */ + int addrGotoEnd; /* Address of "OP_Rewind iIdxCur" */ int addrNextRow; /* Address of "next_row:" */ const char *zIdxName; /* Name of the index */ int nColTest; /* Number of columns to test for changes */ @@ -118750,9 +119538,14 @@ static void analyzeOneTable( /* ** Pseudo-code for loop that calls stat_push(): ** - ** Rewind csr - ** if eof(csr) goto end_of_scan; ** regChng = 0 + ** Rewind csr + ** if eof(csr){ + ** stat_init() with count = 0; + ** goto end_of_scan; + ** } + ** count() + ** stat_init() ** goto chng_addr_0; ** ** next_row: @@ -118791,41 +119584,36 @@ static void analyzeOneTable( sqlite3VdbeSetP4KeyInfo(pParse, pIdx); VdbeComment((v, "%s", pIdx->zName)); - /* Invoke the stat_init() function. The arguments are: + /* Implementation of the following: ** + ** regChng = 0 + ** Rewind csr + ** if eof(csr){ + ** stat_init() with count = 0; + ** goto end_of_scan; + ** } + ** count() + ** stat_init() + ** goto chng_addr_0; + */ + assert( regTemp2==regStat+4 ); + sqlite3VdbeAddOp2(v, OP_Integer, db->nAnalysisLimit, regTemp2); + + /* Arguments to stat_init(): ** (1) the number of columns in the index including the rowid ** (or for a WITHOUT ROWID table, the number of PK columns), ** (2) the number of columns in the key without the rowid/pk - ** (3) estimated number of rows in the index, - */ + ** (3) estimated number of rows in the index. */ sqlite3VdbeAddOp2(v, OP_Integer, nCol, regStat+1); assert( regRowid==regStat+2 ); sqlite3VdbeAddOp2(v, OP_Integer, pIdx->nKeyCol, regRowid); -#ifdef SQLITE_ENABLE_STAT4 - if( OptimizationEnabled(db, SQLITE_Stat4) ){ - sqlite3VdbeAddOp2(v, OP_Count, iIdxCur, regTemp); - addrRewind = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur); - VdbeCoverage(v); - }else -#endif - { - addrRewind = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur); - VdbeCoverage(v); - sqlite3VdbeAddOp3(v, OP_Count, iIdxCur, regTemp, 1); - } - assert( regTemp2==regStat+4 ); - sqlite3VdbeAddOp2(v, OP_Integer, db->nAnalysisLimit, regTemp2); + sqlite3VdbeAddOp3(v, OP_Count, iIdxCur, regTemp, + OptimizationDisabled(db, SQLITE_Stat4)); sqlite3VdbeAddFunctionCall(pParse, 0, regStat+1, regStat, 4, &statInitFuncdef, 0); + addrGotoEnd = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur); + VdbeCoverage(v); - /* Implementation of the following: - ** - ** Rewind csr - ** if eof(csr) goto end_of_scan; - ** regChng = 0 - ** goto next_push_0; - ** - */ sqlite3VdbeAddOp2(v, OP_Integer, 0, regChng); addrNextRow = sqlite3VdbeCurrentAddr(v); @@ -118932,6 +119720,12 @@ static void analyzeOneTable( } /* Add the entry to the stat1 table. */ + if( pIdx->pPartIdxWhere ){ + /* Partial indexes might get a zero-entry in sqlite_stat1. But + ** an empty table is omitted from sqlite_stat1. */ + sqlite3VdbeJumpHere(v, addrGotoEnd); + addrGotoEnd = 0; + } callStatGet(pParse, regStat, STAT_GET_STAT1, regStat1); assert( "BBB"[0]==SQLITE_AFF_TEXT ); sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regTemp, "BBB", 0); @@ -118955,6 +119749,13 @@ static void analyzeOneTable( int addrIsNull; u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound; + /* No STAT4 data is generated if the number of rows is zero */ + if( addrGotoEnd==0 ){ + sqlite3VdbeAddOp2(v, OP_Cast, regStat1, SQLITE_AFF_INTEGER); + addrGotoEnd = sqlite3VdbeAddOp1(v, OP_IfNot, regStat1); + VdbeCoverage(v); + } + if( doOnce ){ int mxCol = nCol; Index *pX; @@ -119007,7 +119808,7 @@ static void analyzeOneTable( #endif /* SQLITE_ENABLE_STAT4 */ /* End of analysis */ - sqlite3VdbeJumpHere(v, addrRewind); + if( addrGotoEnd ) sqlite3VdbeJumpHere(v, addrGotoEnd); } @@ -120756,7 +121557,7 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ } sqlite3VdbeAddOp0(v, OP_Halt); -#if SQLITE_USER_AUTHENTICATION +#if SQLITE_USER_AUTHENTICATION && !defined(SQLITE_OMIT_SHARED_CACHE) if( pParse->nTableLock>0 && db->init.busy==0 ){ sqlite3UserAuthInit(db); if( db->auth.authLevelrc = SQLITE_ERROR; pParse->nErr++; return; } + iCsr = pParse->nTab++; regYield = ++pParse->nMem; regRec = ++pParse->nMem; regRowid = ++pParse->nMem; - assert(pParse->nTab==1); sqlite3MayAbort(pParse); - sqlite3VdbeAddOp3(v, OP_OpenWrite, 1, pParse->regRoot, iDb); + sqlite3VdbeAddOp3(v, OP_OpenWrite, iCsr, pParse->regRoot, iDb); sqlite3VdbeChangeP5(v, OPFLAG_P2ISREG); - pParse->nTab = 2; addrTop = sqlite3VdbeCurrentAddr(v) + 1; sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop); if( pParse->nErr ) return; @@ -123429,11 +124230,11 @@ SQLITE_PRIVATE void sqlite3EndTable( VdbeCoverage(v); sqlite3VdbeAddOp3(v, OP_MakeRecord, dest.iSdst, dest.nSdst, regRec); sqlite3TableAffinity(v, p, 0); - sqlite3VdbeAddOp2(v, OP_NewRowid, 1, regRowid); - sqlite3VdbeAddOp3(v, OP_Insert, 1, regRec, regRowid); + sqlite3VdbeAddOp2(v, OP_NewRowid, iCsr, regRowid); + sqlite3VdbeAddOp3(v, OP_Insert, iCsr, regRec, regRowid); sqlite3VdbeGoto(v, addrInsLoop); sqlite3VdbeJumpHere(v, addrInsLoop); - sqlite3VdbeAddOp1(v, OP_Close, 1); + sqlite3VdbeAddOp1(v, OP_Close, iCsr); } /* Compute the complete text of the CREATE statement */ @@ -123490,13 +124291,10 @@ SQLITE_PRIVATE void sqlite3EndTable( /* Test for cycles in generated columns and illegal expressions ** in CHECK constraints and in DEFAULT clauses. */ if( p->tabFlags & TF_HasGenerated ){ - sqlite3VdbeAddOp4(v, OP_SqlExec, 1, 0, 0, + sqlite3VdbeAddOp4(v, OP_SqlExec, 0x0001, 0, 0, sqlite3MPrintf(db, "SELECT*FROM\"%w\".\"%w\"", db->aDb[iDb].zDbSName, p->zName), P4_DYNAMIC); } - sqlite3VdbeAddOp4(v, OP_SqlExec, 1, 0, 0, - sqlite3MPrintf(db, "PRAGMA \"%w\".integrity_check(%Q)", - db->aDb[iDb].zDbSName, p->zName), P4_DYNAMIC); } /* Add the table to the in-memory representation of the database. @@ -123573,9 +124371,12 @@ SQLITE_PRIVATE void sqlite3CreateView( ** on a view, even though views do not have rowids. The following flag ** setting fixes this problem. But the fix can be disabled by compiling ** with -DSQLITE_ALLOW_ROWID_IN_VIEW in case there are legacy apps that - ** depend upon the old buggy behavior. */ -#ifndef SQLITE_ALLOW_ROWID_IN_VIEW - p->tabFlags |= TF_NoVisibleRowid; + ** depend upon the old buggy behavior. The ability can also be toggled + ** using sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW,...) */ +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + p->tabFlags |= sqlite3Config.mNoVisibleRowid; /* Optional. Allow by default */ +#else + p->tabFlags |= TF_NoVisibleRowid; /* Never allow rowid in view */ #endif sqlite3TwoPartName(pParse, pName1, pName2, &pName); @@ -123631,8 +124432,9 @@ create_view_fail: #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) /* ** The Table structure pTable is really a VIEW. Fill in the names of -** the columns of the view in the pTable structure. Return the number -** of errors. If an error is seen leave an error message in pParse->zErrMsg. +** the columns of the view in the pTable structure. Return non-zero if +** there are errors. If an error is seen an error message is left +** in pParse->zErrMsg. */ static SQLITE_NOINLINE int viewGetColumnNames(Parse *pParse, Table *pTable){ Table *pSelTab; /* A fake table from which we get the result set */ @@ -123755,7 +124557,7 @@ static SQLITE_NOINLINE int viewGetColumnNames(Parse *pParse, Table *pTable){ sqlite3DeleteColumnNames(db, pTable); } #endif /* SQLITE_OMIT_VIEW */ - return nErr; + return nErr + pParse->nErr; } SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ assert( pTable!=0 ); @@ -128948,13 +129750,13 @@ SQLITE_PRIVATE void sqlite3QuoteValue(StrAccum *pStr, sqlite3_value *pValue){ double r1, r2; const char *zVal; r1 = sqlite3_value_double(pValue); - sqlite3_str_appendf(pStr, "%!.15g", r1); + sqlite3_str_appendf(pStr, "%!0.15g", r1); zVal = sqlite3_str_value(pStr); if( zVal ){ sqlite3AtoF(zVal, &r2, pStr->nChar, SQLITE_UTF8); if( r1!=r2 ){ sqlite3_str_reset(pStr); - sqlite3_str_appendf(pStr, "%!.20e", r1); + sqlite3_str_appendf(pStr, "%!0.20e", r1); } } break; @@ -129256,7 +130058,7 @@ static void replaceFunc( } if( zPattern[0]==0 ){ assert( sqlite3_value_type(argv[1])!=SQLITE_NULL ); - sqlite3_result_value(context, argv[0]); + sqlite3_result_text(context, (const char*)zStr, nStr, SQLITE_TRANSIENT); return; } nPattern = sqlite3_value_bytes(argv[1]); @@ -129739,7 +130541,7 @@ static void sumFinalize(sqlite3_context *context){ if( p->approx ){ if( p->ovrfl ){ sqlite3_result_error(context,"integer overflow",-1); - }else if( !sqlite3IsNaN(p->rErr) ){ + }else if( !sqlite3IsOverflow(p->rErr) ){ sqlite3_result_double(context, p->rSum+p->rErr); }else{ sqlite3_result_double(context, p->rSum); @@ -129756,7 +130558,7 @@ static void avgFinalize(sqlite3_context *context){ double r; if( p->approx ){ r = p->rSum; - if( !sqlite3IsNaN(p->rErr) ) r += p->rErr; + if( !sqlite3IsOverflow(p->rErr) ) r += p->rErr; }else{ r = (double)(p->iSum); } @@ -129770,7 +130572,7 @@ static void totalFinalize(sqlite3_context *context){ if( p ){ if( p->approx ){ r = p->rSum; - if( !sqlite3IsNaN(p->rErr) ) r += p->rErr; + if( !sqlite3IsOverflow(p->rErr) ) r += p->rErr; }else{ r = (double)(p->iSum); } @@ -130053,6 +130855,8 @@ static void groupConcatValue(sqlite3_context *context){ sqlite3_result_error_toobig(context); }else if( pAccum->accError==SQLITE_NOMEM ){ sqlite3_result_error_nomem(context); + }else if( pGCC->nAccum>0 && pAccum->nChar==0 ){ + sqlite3_result_text(context, "", 1, SQLITE_STATIC); }else{ const char *zText = sqlite3_str_value(pAccum); sqlite3_result_text(context, zText, pAccum->nChar, SQLITE_TRANSIENT); @@ -132667,6 +133471,196 @@ SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse){ # define autoIncStep(A,B,C) #endif /* SQLITE_OMIT_AUTOINCREMENT */ +/* +** If argument pVal is a Select object returned by an sqlite3MultiValues() +** that was able to use the co-routine optimization, finish coding the +** co-routine. +*/ +SQLITE_PRIVATE void sqlite3MultiValuesEnd(Parse *pParse, Select *pVal){ + if( ALWAYS(pVal) && pVal->pSrc->nSrc>0 ){ + SrcItem *pItem = &pVal->pSrc->a[0]; + sqlite3VdbeEndCoroutine(pParse->pVdbe, pItem->regReturn); + sqlite3VdbeJumpHere(pParse->pVdbe, pItem->addrFillSub - 1); + } +} + +/* +** Return true if all expressions in the expression-list passed as the +** only argument are constant. +*/ +static int exprListIsConstant(Parse *pParse, ExprList *pRow){ + int ii; + for(ii=0; iinExpr; ii++){ + if( 0==sqlite3ExprIsConstant(pParse, pRow->a[ii].pExpr) ) return 0; + } + return 1; +} + +/* +** Return true if all expressions in the expression-list passed as the +** only argument are both constant and have no affinity. +*/ +static int exprListIsNoAffinity(Parse *pParse, ExprList *pRow){ + int ii; + if( exprListIsConstant(pParse,pRow)==0 ) return 0; + for(ii=0; iinExpr; ii++){ + Expr *pExpr = pRow->a[ii].pExpr; + assert( pExpr->op!=TK_RAISE ); + assert( pExpr->affExpr==0 ); + if( 0!=sqlite3ExprAffinity(pExpr) ) return 0; + } + return 1; + +} + +/* +** This function is called by the parser for the second and subsequent +** rows of a multi-row VALUES clause. Argument pLeft is the part of +** the VALUES clause already parsed, argument pRow is the vector of values +** for the new row. The Select object returned represents the complete +** VALUES clause, including the new row. +** +** There are two ways in which this may be achieved - by incremental +** coding of a co-routine (the "co-routine" method) or by returning a +** Select object equivalent to the following (the "UNION ALL" method): +** +** "pLeft UNION ALL SELECT pRow" +** +** If the VALUES clause contains a lot of rows, this compound Select +** object may consume a lot of memory. +** +** When the co-routine method is used, each row that will be returned +** by the VALUES clause is coded into part of a co-routine as it is +** passed to this function. The returned Select object is equivalent to: +** +** SELECT * FROM ( +** Select object to read co-routine +** ) +** +** The co-routine method is used in most cases. Exceptions are: +** +** a) If the current statement has a WITH clause. This is to avoid +** statements like: +** +** WITH cte AS ( VALUES('x'), ('y') ... ) +** SELECT * FROM cte AS a, cte AS b; +** +** This will not work, as the co-routine uses a hard-coded register +** for its OP_Yield instructions, and so it is not possible for two +** cursors to iterate through it concurrently. +** +** b) The schema is currently being parsed (i.e. the VALUES clause is part +** of a schema item like a VIEW or TRIGGER). In this case there is no VM +** being generated when parsing is taking place, and so generating +** a co-routine is not possible. +** +** c) There are non-constant expressions in the VALUES clause (e.g. +** the VALUES clause is part of a correlated sub-query). +** +** d) One or more of the values in the first row of the VALUES clause +** has an affinity (i.e. is a CAST expression). This causes problems +** because the complex rules SQLite uses (see function +** sqlite3SubqueryColumnTypes() in select.c) to determine the effective +** affinity of such a column for all rows require access to all values in +** the column simultaneously. +*/ +SQLITE_PRIVATE Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow){ + + if( pParse->bHasWith /* condition (a) above */ + || pParse->db->init.busy /* condition (b) above */ + || exprListIsConstant(pParse,pRow)==0 /* condition (c) above */ + || (pLeft->pSrc->nSrc==0 && + exprListIsNoAffinity(pParse,pLeft->pEList)==0) /* condition (d) above */ + || IN_SPECIAL_PARSE + ){ + /* The co-routine method cannot be used. Fall back to UNION ALL. */ + Select *pSelect = 0; + int f = SF_Values | SF_MultiValue; + if( pLeft->pSrc->nSrc ){ + sqlite3MultiValuesEnd(pParse, pLeft); + f = SF_Values; + }else if( pLeft->pPrior ){ + /* In this case set the SF_MultiValue flag only if it was set on pLeft */ + f = (f & pLeft->selFlags); + } + pSelect = sqlite3SelectNew(pParse, pRow, 0, 0, 0, 0, 0, f, 0); + pLeft->selFlags &= ~SF_MultiValue; + if( pSelect ){ + pSelect->op = TK_ALL; + pSelect->pPrior = pLeft; + pLeft = pSelect; + } + }else{ + SrcItem *p = 0; /* SrcItem that reads from co-routine */ + + if( pLeft->pSrc->nSrc==0 ){ + /* Co-routine has not yet been started and the special Select object + ** that accesses the co-routine has not yet been created. This block + ** does both those things. */ + Vdbe *v = sqlite3GetVdbe(pParse); + Select *pRet = sqlite3SelectNew(pParse, 0, 0, 0, 0, 0, 0, 0, 0); + + /* Ensure the database schema has been read. This is to ensure we have + ** the correct text encoding. */ + if( (pParse->db->mDbFlags & DBFLAG_SchemaKnownOk)==0 ){ + sqlite3ReadSchema(pParse); + } + + if( pRet ){ + SelectDest dest; + pRet->pSrc->nSrc = 1; + pRet->pPrior = pLeft->pPrior; + pRet->op = pLeft->op; + if( pRet->pPrior ) pRet->selFlags |= SF_Values; + pLeft->pPrior = 0; + pLeft->op = TK_SELECT; + assert( pLeft->pNext==0 ); + assert( pRet->pNext==0 ); + p = &pRet->pSrc->a[0]; + p->pSelect = pLeft; + p->fg.viaCoroutine = 1; + p->addrFillSub = sqlite3VdbeCurrentAddr(v) + 1; + p->regReturn = ++pParse->nMem; + p->iCursor = -1; + p->u1.nRow = 2; + sqlite3VdbeAddOp3(v,OP_InitCoroutine,p->regReturn,0,p->addrFillSub); + sqlite3SelectDestInit(&dest, SRT_Coroutine, p->regReturn); + + /* Allocate registers for the output of the co-routine. Do so so + ** that there are two unused registers immediately before those + ** used by the co-routine. This allows the code in sqlite3Insert() + ** to use these registers directly, instead of copying the output + ** of the co-routine to a separate array for processing. */ + dest.iSdst = pParse->nMem + 3; + dest.nSdst = pLeft->pEList->nExpr; + pParse->nMem += 2 + dest.nSdst; + + pLeft->selFlags |= SF_MultiValue; + sqlite3Select(pParse, pLeft, &dest); + p->regResult = dest.iSdst; + assert( pParse->nErr || dest.iSdst>0 ); + pLeft = pRet; + } + }else{ + p = &pLeft->pSrc->a[0]; + assert( !p->fg.isTabFunc && !p->fg.isIndexedBy ); + p->u1.nRow++; + } + + if( pParse->nErr==0 ){ + assert( p!=0 ); + if( p->pSelect->pEList->nExpr!=pRow->nExpr ){ + sqlite3SelectWrongNumTermsError(pParse, p->pSelect); + }else{ + sqlite3ExprCodeExprList(pParse, pRow, p->regResult, 0, 0); + sqlite3VdbeAddOp1(pParse->pVdbe, OP_Yield, p->regReturn); + } + } + sqlite3ExprListDelete(pParse->db, pRow); + } + + return pLeft; +} /* Forward declaration */ static int xferOptimization( @@ -133003,25 +133997,40 @@ SQLITE_PRIVATE void sqlite3Insert( if( pSelect ){ /* Data is coming from a SELECT or from a multi-row VALUES clause. ** Generate a co-routine to run the SELECT. */ - int regYield; /* Register holding co-routine entry-point */ - int addrTop; /* Top of the co-routine */ int rc; /* Result code */ - regYield = ++pParse->nMem; - addrTop = sqlite3VdbeCurrentAddr(v) + 1; - sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop); - sqlite3SelectDestInit(&dest, SRT_Coroutine, regYield); - dest.iSdst = bIdListInOrder ? regData : 0; - dest.nSdst = pTab->nCol; - rc = sqlite3Select(pParse, pSelect, &dest); - regFromSelect = dest.iSdst; - assert( db->pParse==pParse ); - if( rc || pParse->nErr ) goto insert_cleanup; - assert( db->mallocFailed==0 ); - sqlite3VdbeEndCoroutine(v, regYield); - sqlite3VdbeJumpHere(v, addrTop - 1); /* label B: */ - assert( pSelect->pEList ); - nColumn = pSelect->pEList->nExpr; + if( pSelect->pSrc->nSrc==1 + && pSelect->pSrc->a[0].fg.viaCoroutine + && pSelect->pPrior==0 + ){ + SrcItem *pItem = &pSelect->pSrc->a[0]; + dest.iSDParm = pItem->regReturn; + regFromSelect = pItem->regResult; + nColumn = pItem->pSelect->pEList->nExpr; + ExplainQueryPlan((pParse, 0, "SCAN %S", pItem)); + if( bIdListInOrder && nColumn==pTab->nCol ){ + regData = regFromSelect; + regRowid = regData - 1; + regIns = regRowid - (IsVirtual(pTab) ? 1 : 0); + } + }else{ + int addrTop; /* Top of the co-routine */ + int regYield = ++pParse->nMem; + addrTop = sqlite3VdbeCurrentAddr(v) + 1; + sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop); + sqlite3SelectDestInit(&dest, SRT_Coroutine, regYield); + dest.iSdst = bIdListInOrder ? regData : 0; + dest.nSdst = pTab->nCol; + rc = sqlite3Select(pParse, pSelect, &dest); + regFromSelect = dest.iSdst; + assert( db->pParse==pParse ); + if( rc || pParse->nErr ) goto insert_cleanup; + assert( db->mallocFailed==0 ); + sqlite3VdbeEndCoroutine(v, regYield); + sqlite3VdbeJumpHere(v, addrTop - 1); /* label B: */ + assert( pSelect->pEList ); + nColumn = pSelect->pEList->nExpr; + } /* Set useTempTable to TRUE if the result of the SELECT statement ** should be written into a temporary table (template 4). Set to @@ -133176,7 +134185,7 @@ SQLITE_PRIVATE void sqlite3Insert( pNx->iDataCur = iDataCur; pNx->iIdxCur = iIdxCur; if( pNx->pUpsertTarget ){ - if( sqlite3UpsertAnalyzeTarget(pParse, pTabList, pNx) ){ + if( sqlite3UpsertAnalyzeTarget(pParse, pTabList, pNx, pUpsert) ){ goto insert_cleanup; } } @@ -135068,7 +136077,10 @@ static int xferOptimization( } } #ifndef SQLITE_OMIT_CHECK - if( pDest->pCheck && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) ){ + if( pDest->pCheck + && (db->mDbFlags & DBFLAG_Vacuum)==0 + && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) + ){ return 0; /* Tables have different CHECK constraints. Ticket #2252 */ } #endif @@ -137743,6 +138755,34 @@ static const PragmaName aPragmaName[] = { /************** End of pragma.h **********************************************/ /************** Continuing where we left off in pragma.c *********************/ +/* +** When the 0x10 bit of PRAGMA optimize is set, any ANALYZE commands +** will be run with an analysis_limit set to the lessor of the value of +** the following macro or to the actual analysis_limit if it is non-zero, +** in order to prevent PRAGMA optimize from running for too long. +** +** The value of 2000 is chosen emperically so that the worst-case run-time +** for PRAGMA optimize does not exceed 100 milliseconds against a variety +** of test databases on a RaspberryPI-4 compiled using -Os and without +** -DSQLITE_DEBUG. Of course, your mileage may vary. For the purpose of +** this paragraph, "worst-case" means that ANALYZE ends up being +** run on every table in the database. The worst case typically only +** happens if PRAGMA optimize is run on a database file for which ANALYZE +** has not been previously run and the 0x10000 flag is included so that +** all tables are analyzed. The usual case for PRAGMA optimize is that +** no ANALYZE commands will be run at all, or if any ANALYZE happens it +** will be against a single table, so that expected timing for PRAGMA +** optimize on a PI-4 is more like 1 millisecond or less with the 0x10000 +** flag or less than 100 microseconds without the 0x10000 flag. +** +** An analysis limit of 2000 is almost always sufficient for the query +** planner to fully characterize an index. The additional accuracy from +** a larger analysis is not usually helpful. +*/ +#ifndef SQLITE_DEFAULT_OPTIMIZE_LIMIT +# define SQLITE_DEFAULT_OPTIMIZE_LIMIT 2000 +#endif + /* ** Interpret the given string as a safety level. Return 0 for OFF, ** 1 for ON or NORMAL, 2 for FULL, and 3 for EXTRA. Return 1 for an empty or @@ -139388,7 +140428,7 @@ SQLITE_PRIVATE void sqlite3Pragma( /* Set the maximum error count */ mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX; if( zRight ){ - if( sqlite3GetInt32(zRight, &mxErr) ){ + if( sqlite3GetInt32(pValue->z, &mxErr) ){ if( mxErr<=0 ){ mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX; } @@ -139405,7 +140445,6 @@ SQLITE_PRIVATE void sqlite3Pragma( Hash *pTbls; /* Set of all tables in the schema */ int *aRoot; /* Array of root page numbers of all btrees */ int cnt = 0; /* Number of entries in aRoot[] */ - int mxIdx = 0; /* Maximum number of indexes for any table */ if( OMIT_TEMPDB && i==1 ) continue; if( iDb>=0 && i!=iDb ) continue; @@ -139427,7 +140466,6 @@ SQLITE_PRIVATE void sqlite3Pragma( if( pObjTab && pObjTab!=pTab ) continue; if( HasRowid(pTab) ) cnt++; for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ cnt++; } - if( nIdx>mxIdx ) mxIdx = nIdx; } if( cnt==0 ) continue; if( pObjTab ) cnt++; @@ -139447,11 +140485,11 @@ SQLITE_PRIVATE void sqlite3Pragma( aRoot[0] = cnt; /* Make sure sufficient number of registers have been allocated */ - sqlite3TouchRegister(pParse, 8+mxIdx); + sqlite3TouchRegister(pParse, 8+cnt); sqlite3ClearTempRegCache(pParse); /* Do the b-tree integrity checks */ - sqlite3VdbeAddOp4(v, OP_IntegrityCk, 2, cnt, 1, (char*)aRoot,P4_INTARRAY); + sqlite3VdbeAddOp4(v, OP_IntegrityCk, 1, cnt, 8, (char*)aRoot,P4_INTARRAY); sqlite3VdbeChangeP5(v, (u8)i); addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2); VdbeCoverage(v); sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, @@ -139461,6 +140499,36 @@ SQLITE_PRIVATE void sqlite3Pragma( integrityCheckResultRow(v); sqlite3VdbeJumpHere(v, addr); + /* Check that the indexes all have the right number of rows */ + cnt = pObjTab ? 1 : 0; + sqlite3VdbeLoadString(v, 2, "wrong # of entries in index "); + for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){ + int iTab = 0; + Table *pTab = sqliteHashData(x); + Index *pIdx; + if( pObjTab && pObjTab!=pTab ) continue; + if( HasRowid(pTab) ){ + iTab = cnt++; + }else{ + iTab = cnt; + for(pIdx=pTab->pIndex; ALWAYS(pIdx); pIdx=pIdx->pNext){ + if( IsPrimaryKeyIndex(pIdx) ) break; + iTab++; + } + } + for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ + if( pIdx->pPartIdxWhere==0 ){ + addr = sqlite3VdbeAddOp3(v, OP_Eq, 8+cnt, 0, 8+iTab); + VdbeCoverageNeverNull(v); + sqlite3VdbeLoadString(v, 4, pIdx->zName); + sqlite3VdbeAddOp3(v, OP_Concat, 4, 2, 3); + integrityCheckResultRow(v); + sqlite3VdbeJumpHere(v, addr); + } + cnt++; + } + } + /* Make sure all the indices are constructed correctly. */ for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){ @@ -139475,31 +140543,7 @@ SQLITE_PRIVATE void sqlite3Pragma( int mxCol; /* Maximum non-virtual column number */ if( pObjTab && pObjTab!=pTab ) continue; - if( !IsOrdinaryTable(pTab) ){ -#ifndef SQLITE_OMIT_VIRTUALTABLE - sqlite3_vtab *pVTab; - int a1; - if( !IsVirtual(pTab) ) continue; - if( pTab->nCol<=0 ){ - const char *zMod = pTab->u.vtab.azArg[0]; - if( sqlite3HashFind(&db->aModule, zMod)==0 ) continue; - } - sqlite3ViewGetColumnNames(pParse, pTab); - if( pTab->u.vtab.p==0 ) continue; - pVTab = pTab->u.vtab.p->pVtab; - if( NEVER(pVTab==0) ) continue; - if( NEVER(pVTab->pModule==0) ) continue; - if( pVTab->pModule->iVersion<4 ) continue; - if( pVTab->pModule->xIntegrity==0 ) continue; - sqlite3VdbeAddOp3(v, OP_VCheck, i, 3, isQuick); - pTab->nTabRef++; - sqlite3VdbeAppendP4(v, pTab, P4_TABLEREF); - a1 = sqlite3VdbeAddOp1(v, OP_IsNull, 3); VdbeCoverage(v); - integrityCheckResultRow(v); - sqlite3VdbeJumpHere(v, a1); -#endif - continue; - } + if( !IsOrdinaryTable(pTab) ) continue; if( isQuick || HasRowid(pTab) ){ pPk = 0; r2 = 0; @@ -139634,6 +140678,7 @@ SQLITE_PRIVATE void sqlite3Pragma( ** is REAL, we have to load the actual data using OP_Column ** to reliably determine if the value is a NULL. */ sqlite3VdbeAddOp3(v, OP_Column, p1, p3, 3); + sqlite3ColumnDefault(v, pTab, j, 3); jmp3 = sqlite3VdbeAddOp2(v, OP_NotNull, 3, labelOk); VdbeCoverage(v); } @@ -139807,23 +140852,43 @@ SQLITE_PRIVATE void sqlite3Pragma( } sqlite3VdbeAddOp2(v, OP_Next, iDataCur, loopTop); VdbeCoverage(v); sqlite3VdbeJumpHere(v, loopTop-1); - if( !isQuick ){ - sqlite3VdbeLoadString(v, 2, "wrong # of entries in index "); - for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){ - if( pPk==pIdx ) continue; - sqlite3VdbeAddOp2(v, OP_Count, iIdxCur+j, 3); - addr = sqlite3VdbeAddOp3(v, OP_Eq, 8+j, 0, 3); VdbeCoverage(v); - sqlite3VdbeChangeP5(v, SQLITE_NOTNULL); - sqlite3VdbeLoadString(v, 4, pIdx->zName); - sqlite3VdbeAddOp3(v, OP_Concat, 4, 2, 3); - integrityCheckResultRow(v); - sqlite3VdbeJumpHere(v, addr); - } - if( pPk ){ - sqlite3ReleaseTempRange(pParse, r2, pPk->nKeyCol); - } + if( pPk ){ + assert( !isQuick ); + sqlite3ReleaseTempRange(pParse, r2, pPk->nKeyCol); } } + +#ifndef SQLITE_OMIT_VIRTUALTABLE + /* Second pass to invoke the xIntegrity method on all virtual + ** tables. + */ + for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){ + Table *pTab = sqliteHashData(x); + sqlite3_vtab *pVTab; + int a1; + if( pObjTab && pObjTab!=pTab ) continue; + if( IsOrdinaryTable(pTab) ) continue; + if( !IsVirtual(pTab) ) continue; + if( pTab->nCol<=0 ){ + const char *zMod = pTab->u.vtab.azArg[0]; + if( sqlite3HashFind(&db->aModule, zMod)==0 ) continue; + } + sqlite3ViewGetColumnNames(pParse, pTab); + if( pTab->u.vtab.p==0 ) continue; + pVTab = pTab->u.vtab.p->pVtab; + if( NEVER(pVTab==0) ) continue; + if( NEVER(pVTab->pModule==0) ) continue; + if( pVTab->pModule->iVersion<4 ) continue; + if( pVTab->pModule->xIntegrity==0 ) continue; + sqlite3VdbeAddOp3(v, OP_VCheck, i, 3, isQuick); + pTab->nTabRef++; + sqlite3VdbeAppendP4(v, pTab, P4_TABLEREF); + a1 = sqlite3VdbeAddOp1(v, OP_IsNull, 3); VdbeCoverage(v); + integrityCheckResultRow(v); + sqlite3VdbeJumpHere(v, a1); + continue; + } +#endif } { static const int iLn = VDBE_OFFSET_LINENO(2); @@ -140087,44 +141152,63 @@ SQLITE_PRIVATE void sqlite3Pragma( ** ** The optional argument is a bitmask of optimizations to perform: ** - ** 0x0001 Debugging mode. Do not actually perform any optimizations - ** but instead return one line of text for each optimization - ** that would have been done. Off by default. + ** 0x00001 Debugging mode. Do not actually perform any optimizations + ** but instead return one line of text for each optimization + ** that would have been done. Off by default. ** - ** 0x0002 Run ANALYZE on tables that might benefit. On by default. - ** See below for additional information. + ** 0x00002 Run ANALYZE on tables that might benefit. On by default. + ** See below for additional information. ** - ** 0x0004 (Not yet implemented) Record usage and performance - ** information from the current session in the - ** database file so that it will be available to "optimize" - ** pragmas run by future database connections. + ** 0x00010 Run all ANALYZE operations using an analysis_limit that + ** is the lessor of the current analysis_limit and the + ** SQLITE_DEFAULT_OPTIMIZE_LIMIT compile-time option. + ** The default value of SQLITE_DEFAULT_OPTIMIZE_LIMIT is + ** currently (2024-02-19) set to 2000, which is such that + ** the worst case run-time for PRAGMA optimize on a 100MB + ** database will usually be less than 100 milliseconds on + ** a RaspberryPI-4 class machine. On by default. ** - ** 0x0008 (Not yet implemented) Create indexes that might have - ** been helpful to recent queries + ** 0x10000 Look at tables to see if they need to be reanalyzed + ** due to growth or shrinkage even if they have not been + ** queried during the current connection. Off by default. ** - ** The default MASK is and always shall be 0xfffe. 0xfffe means perform all - ** of the optimizations listed above except Debug Mode, including new - ** optimizations that have not yet been invented. If new optimizations are - ** ever added that should be off by default, those off-by-default - ** optimizations will have bitmasks of 0x10000 or larger. + ** The default MASK is and always shall be 0x0fffe. In the current + ** implementation, the default mask only covers the 0x00002 optimization, + ** though additional optimizations that are covered by 0x0fffe might be + ** added in the future. Optimizations that are off by default and must + ** be explicitly requested have masks of 0x10000 or greater. ** ** DETERMINATION OF WHEN TO RUN ANALYZE ** ** In the current implementation, a table is analyzed if only if all of ** the following are true: ** - ** (1) MASK bit 0x02 is set. + ** (1) MASK bit 0x00002 is set. ** - ** (2) The query planner used sqlite_stat1-style statistics for one or - ** more indexes of the table at some point during the lifetime of - ** the current connection. + ** (2) The table is an ordinary table, not a virtual table or view. ** - ** (3) One or more indexes of the table are currently unanalyzed OR - ** the number of rows in the table has increased by 25 times or more - ** since the last time ANALYZE was run. + ** (3) The table name does not begin with "sqlite_". + ** + ** (4) One or more of the following is true: + ** (4a) The 0x10000 MASK bit is set. + ** (4b) One or more indexes on the table lacks an entry + ** in the sqlite_stat1 table. + ** (4c) The query planner used sqlite_stat1-style statistics for one + ** or more indexes of the table at some point during the lifetime + ** of the current connection. + ** + ** (5) One or more of the following is true: + ** (5a) One or more indexes on the table lacks an entry + ** in the sqlite_stat1 table. (Same as 4a) + ** (5b) The number of rows in the table has increased or decreased by + ** 10-fold. In other words, the current size of the table is + ** 10 times larger than the size in sqlite_stat1 or else the + ** current size is less than 1/10th the size in sqlite_stat1. ** ** The rules for when tables are analyzed are likely to change in - ** future releases. + ** future releases. Future versions of SQLite might accept a string + ** literal argument to this pragma that contains a mnemonic description + ** of the options rather than a bitmap. */ case PragTyp_OPTIMIZE: { int iDbLast; /* Loop termination point for the schema loop */ @@ -140136,6 +141220,10 @@ SQLITE_PRIVATE void sqlite3Pragma( LogEst szThreshold; /* Size threshold above which reanalysis needed */ char *zSubSql; /* SQL statement for the OP_SqlExec opcode */ u32 opMask; /* Mask of operations to perform */ + int nLimit; /* Analysis limit to use */ + int nCheck = 0; /* Number of tables to be optimized */ + int nBtree = 0; /* Number of btrees to scan */ + int nIndex; /* Number of indexes on the current table */ if( zRight ){ opMask = (u32)sqlite3Atoi(zRight); @@ -140143,6 +141231,14 @@ SQLITE_PRIVATE void sqlite3Pragma( }else{ opMask = 0xfffe; } + if( (opMask & 0x10)==0 ){ + nLimit = 0; + }else if( db->nAnalysisLimit>0 + && db->nAnalysisLimitnTab++; for(iDbLast = zDb?iDb:db->nDb-1; iDb<=iDbLast; iDb++){ if( iDb==1 ) continue; @@ -140151,23 +141247,61 @@ SQLITE_PRIVATE void sqlite3Pragma( for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){ pTab = (Table*)sqliteHashData(k); - /* If table pTab has not been used in a way that would benefit from - ** having analysis statistics during the current session, then skip it. - ** This also has the effect of skipping virtual tables and views */ - if( (pTab->tabFlags & TF_StatsUsed)==0 ) continue; + /* This only works for ordinary tables */ + if( !IsOrdinaryTable(pTab) ) continue; - /* Reanalyze if the table is 25 times larger than the last analysis */ - szThreshold = pTab->nRowLogEst + 46; assert( sqlite3LogEst(25)==46 ); + /* Do not scan system tables */ + if( 0==sqlite3StrNICmp(pTab->zName, "sqlite_", 7) ) continue; + + /* Find the size of the table as last recorded in sqlite_stat1. + ** If any index is unanalyzed, then the threshold is -1 to + ** indicate a new, unanalyzed index + */ + szThreshold = pTab->nRowLogEst; + nIndex = 0; for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ + nIndex++; if( !pIdx->hasStat1 ){ - szThreshold = 0; /* Always analyze if any index lacks statistics */ - break; + szThreshold = -1; /* Always analyze if any index lacks statistics */ } } - if( szThreshold ){ - sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead); - sqlite3VdbeAddOp3(v, OP_IfSmaller, iTabCur, - sqlite3VdbeCurrentAddr(v)+2+(opMask&1), szThreshold); + + /* If table pTab has not been used in a way that would benefit from + ** having analysis statistics during the current session, then skip it, + ** unless the 0x10000 MASK bit is set. */ + if( (pTab->tabFlags & TF_MaybeReanalyze)!=0 ){ + /* Check for size change if stat1 has been used for a query */ + }else if( opMask & 0x10000 ){ + /* Check for size change if 0x10000 is set */ + }else if( pTab->pIndex!=0 && szThreshold<0 ){ + /* Do analysis if unanalyzed indexes exists */ + }else{ + /* Otherwise, we can skip this table */ + continue; + } + + nCheck++; + if( nCheck==2 ){ + /* If ANALYZE might be invoked two or more times, hold a write + ** transaction for efficiency */ + sqlite3BeginWriteOperation(pParse, 0, iDb); + } + nBtree += nIndex+1; + + /* Reanalyze if the table is 10 times larger or smaller than + ** the last analysis. Unconditional reanalysis if there are + ** unanalyzed indexes. */ + sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead); + if( szThreshold>=0 ){ + const LogEst iRange = 33; /* 10x size change */ + sqlite3VdbeAddOp4Int(v, OP_IfSizeBetween, iTabCur, + sqlite3VdbeCurrentAddr(v)+2+(opMask&1), + szThreshold>=iRange ? szThreshold-iRange : -1, + szThreshold+iRange); + VdbeCoverage(v); + }else{ + sqlite3VdbeAddOp2(v, OP_Rewind, iTabCur, + sqlite3VdbeCurrentAddr(v)+2+(opMask&1)); VdbeCoverage(v); } zSubSql = sqlite3MPrintf(db, "ANALYZE \"%w\".\"%w\"", @@ -140177,11 +141311,27 @@ SQLITE_PRIVATE void sqlite3Pragma( sqlite3VdbeAddOp4(v, OP_String8, 0, r1, 0, zSubSql, P4_DYNAMIC); sqlite3VdbeAddOp2(v, OP_ResultRow, r1, 1); }else{ - sqlite3VdbeAddOp4(v, OP_SqlExec, 0, 0, 0, zSubSql, P4_DYNAMIC); + sqlite3VdbeAddOp4(v, OP_SqlExec, nLimit ? 0x02 : 00, nLimit, 0, + zSubSql, P4_DYNAMIC); } } } sqlite3VdbeAddOp0(v, OP_Expire); + + /* In a schema with a large number of tables and indexes, scale back + ** the analysis_limit to avoid excess run-time in the worst case. + */ + if( !db->mallocFailed && nLimit>0 && nBtree>100 ){ + int iAddr, iEnd; + VdbeOp *aOp; + nLimit = 100*nLimit/nBtree; + if( nLimit<100 ) nLimit = 100; + aOp = sqlite3VdbeGetOp(v, 0); + iEnd = sqlite3VdbeCurrentAddr(v); + for(iAddr=0; iAddrnConstraint; i++, pConstraint++){ - if( pConstraint->usable==0 ) continue; - if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue; if( pConstraint->iColumn < pTab->iHidden ) continue; + if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue; + if( pConstraint->usable==0 ) return SQLITE_CONSTRAINT; j = pConstraint->iColumn - pTab->iHidden; assert( j < 2 ); seen[j] = i+1; @@ -140460,12 +141610,13 @@ static int pragmaVtabBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ j = seen[0]-1; pIdxInfo->aConstraintUsage[j].argvIndex = 1; pIdxInfo->aConstraintUsage[j].omit = 1; - if( seen[1]==0 ) return SQLITE_OK; pIdxInfo->estimatedCost = (double)20; pIdxInfo->estimatedRows = 20; - j = seen[1]-1; - pIdxInfo->aConstraintUsage[j].argvIndex = 2; - pIdxInfo->aConstraintUsage[j].omit = 1; + if( seen[1] ){ + j = seen[1]-1; + pIdxInfo->aConstraintUsage[j].argvIndex = 2; + pIdxInfo->aConstraintUsage[j].omit = 1; + } return SQLITE_OK; } @@ -140485,6 +141636,7 @@ static void pragmaVtabCursorClear(PragmaVtabCursor *pCsr){ int i; sqlite3_finalize(pCsr->pPragma); pCsr->pPragma = 0; + pCsr->iRowid = 0; for(i=0; iazArg); i++){ sqlite3_free(pCsr->azArg[i]); pCsr->azArg[i] = 0; @@ -141285,7 +142437,13 @@ SQLITE_PRIVATE void *sqlite3ParserAddCleanup( void (*xCleanup)(sqlite3*,void*), /* The cleanup routine */ void *pPtr /* Pointer to object to be cleaned up */ ){ - ParseCleanup *pCleanup = sqlite3DbMallocRaw(pParse->db, sizeof(*pCleanup)); + ParseCleanup *pCleanup; + if( sqlite3FaultSim(300) ){ + pCleanup = 0; + sqlite3OomFault(pParse->db); + }else{ + pCleanup = sqlite3DbMallocRaw(pParse->db, sizeof(*pCleanup)); + } if( pCleanup ){ pCleanup->pNext = pParse->pCleanup; pParse->pCleanup = pCleanup; @@ -143407,9 +144565,16 @@ static void generateSortTail( int addrExplain; /* Address of OP_Explain instruction */ #endif - ExplainQueryPlan2(addrExplain, (pParse, 0, - "USE TEMP B-TREE FOR %sORDER BY", pSort->nOBSat>0?"RIGHT PART OF ":"") - ); + nKey = pOrderBy->nExpr - pSort->nOBSat; + if( pSort->nOBSat==0 || nKey==1 ){ + ExplainQueryPlan2(addrExplain, (pParse, 0, + "USE TEMP B-TREE FOR %sORDER BY", pSort->nOBSat?"LAST TERM OF ":"" + )); + }else{ + ExplainQueryPlan2(addrExplain, (pParse, 0, + "USE TEMP B-TREE FOR LAST %d TERMS OF ORDER BY", nKey + )); + } sqlite3VdbeScanStatusRange(v, addrExplain,pSort->addrPush,pSort->addrPushEnd); sqlite3VdbeScanStatusCounters(v, addrExplain, addrExplain, pSort->addrPush); @@ -143447,7 +144612,6 @@ static void generateSortTail( regRow = sqlite3GetTempRange(pParse, nColumn); } } - nKey = pOrderBy->nExpr - pSort->nOBSat; if( pSort->sortFlags & SORTFLAG_UseSorter ){ int regSortOut = ++pParse->nMem; iSortTab = pParse->nTab++; @@ -143687,11 +144851,7 @@ static const char *columnTypeImpl( ** data for the result-set column of the sub-select. */ if( iColpEList->nExpr -#ifdef SQLITE_ALLOW_ROWID_IN_VIEW - && iCol>=0 -#else - && ALWAYS(iCol>=0) -#endif + && (!ViewCanHaveRowid || iCol>=0) ){ /* If iCol is less than zero, then the expression requests the ** rowid of the sub-select or view. This expression is legal (see @@ -144056,8 +145216,7 @@ SQLITE_PRIVATE void sqlite3SubqueryColumnTypes( NameContext sNC; assert( pSelect!=0 ); - testcase( (pSelect->selFlags & SF_Resolved)==0 ); - assert( (pSelect->selFlags & SF_Resolved)!=0 || IN_RENAME_OBJECT ); + assert( (pSelect->selFlags & SF_Resolved)!=0 ); assert( pTab->nCol==pSelect->pEList->nExpr || pParse->nErr>0 ); assert( aff==SQLITE_AFF_NONE || aff==SQLITE_AFF_BLOB ); if( db->mallocFailed || IN_RENAME_OBJECT ) return; @@ -144068,17 +145227,22 @@ SQLITE_PRIVATE void sqlite3SubqueryColumnTypes( for(i=0, pCol=pTab->aCol; inCol; i++, pCol++){ const char *zType; i64 n; + int m = 0; + Select *pS2 = pSelect; pTab->tabFlags |= (pCol->colFlags & COLFLAG_NOINSERT); p = a[i].pExpr; /* pCol->szEst = ... // Column size est for SELECT tables never used */ pCol->affinity = sqlite3ExprAffinity(p); + while( pCol->affinity<=SQLITE_AFF_NONE && pS2->pNext!=0 ){ + m |= sqlite3ExprDataType(pS2->pEList->a[i].pExpr); + pS2 = pS2->pNext; + pCol->affinity = sqlite3ExprAffinity(pS2->pEList->a[i].pExpr); + } if( pCol->affinity<=SQLITE_AFF_NONE ){ pCol->affinity = aff; } - if( pCol->affinity>=SQLITE_AFF_TEXT && pSelect->pNext ){ - int m = 0; - Select *pS2; - for(m=0, pS2=pSelect->pNext; pS2; pS2=pS2->pNext){ + if( pCol->affinity>=SQLITE_AFF_TEXT && (pS2->pNext || pS2!=pSelect) ){ + for(pS2=pS2->pNext; pS2; pS2=pS2->pNext){ m |= sqlite3ExprDataType(pS2->pEList->a[i].pExpr); } if( pCol->affinity==SQLITE_AFF_TEXT && (m&0x01)!=0 ){ @@ -144108,12 +145272,12 @@ SQLITE_PRIVATE void sqlite3SubqueryColumnTypes( } } if( zType ){ - i64 m = sqlite3Strlen30(zType); + const i64 k = sqlite3Strlen30(zType); n = sqlite3Strlen30(pCol->zCnName); - pCol->zCnName = sqlite3DbReallocOrFree(db, pCol->zCnName, n+m+2); + pCol->zCnName = sqlite3DbReallocOrFree(db, pCol->zCnName, n+k+2); pCol->colFlags &= ~(COLFLAG_HASTYPE|COLFLAG_HASCOLL); if( pCol->zCnName ){ - memcpy(&pCol->zCnName[n+1], zType, m+1); + memcpy(&pCol->zCnName[n+1], zType, k+1); pCol->colFlags |= COLFLAG_HASTYPE; } } @@ -146510,7 +147674,7 @@ static void constInsert( ){ int i; assert( pColumn->op==TK_COLUMN ); - assert( sqlite3ExprIsConstant(pValue) ); + assert( sqlite3ExprIsConstant(pConst->pParse, pValue) ); if( ExprHasProperty(pColumn, EP_FixedCol) ) return; if( sqlite3ExprAffinity(pValue)!=0 ) return; @@ -146568,10 +147732,10 @@ static void findConstInWhere(WhereConst *pConst, Expr *pExpr){ pLeft = pExpr->pLeft; assert( pRight!=0 ); assert( pLeft!=0 ); - if( pRight->op==TK_COLUMN && sqlite3ExprIsConstant(pLeft) ){ + if( pRight->op==TK_COLUMN && sqlite3ExprIsConstant(pConst->pParse, pLeft) ){ constInsert(pConst,pRight,pLeft,pExpr); } - if( pLeft->op==TK_COLUMN && sqlite3ExprIsConstant(pRight) ){ + if( pLeft->op==TK_COLUMN && sqlite3ExprIsConstant(pConst->pParse, pRight) ){ constInsert(pConst,pLeft,pRight,pExpr); } } @@ -146792,6 +147956,18 @@ static int pushDownWindowCheck(Parse *pParse, Select *pSubq, Expr *pExpr){ ** The hope is that the terms added to the inner query will make it more ** efficient. ** +** NAME AMBIGUITY +** +** This optimization is called the "WHERE-clause push-down optimization". +** +** Do not confuse this optimization with another unrelated optimization +** with a similar name: The "MySQL push-down optimization" causes WHERE +** clause terms that can be evaluated using only the index and without +** reference to the table are run first, so that if they are false, +** unnecessary table seeks are avoided. +** +** RULES +** ** Do not attempt this optimization if: ** ** (1) (** This restriction was removed on 2017-09-29. We used to @@ -146857,15 +148033,19 @@ static int pushDownWindowCheck(Parse *pParse, Select *pSubq, Expr *pExpr){ ** (9c) There is a RIGHT JOIN (or FULL JOIN) in between the ON/USING ** clause and the subquery. ** -** Without this restriction, the push-down optimization might move -** the ON/USING filter expression from the left side of a RIGHT JOIN -** over to the right side, which leads to incorrect answers. See -** also restriction (6) in sqlite3ExprIsSingleTableConstraint(). +** Without this restriction, the WHERE-clause push-down optimization +** might move the ON/USING filter expression from the left side of a +** RIGHT JOIN over to the right side, which leads to incorrect answers. +** See also restriction (6) in sqlite3ExprIsSingleTableConstraint(). ** ** (10) The inner query is not the right-hand table of a RIGHT JOIN. ** ** (11) The subquery is not a VALUES clause ** +** (12) The WHERE clause is not "rowid ISNULL" or the equivalent. This +** case only comes up if SQLite is compiled using +** SQLITE_ALLOW_ROWID_IN_VIEW. +** ** Return 0 if no changes are made and non-zero if one or more WHERE clause ** terms are duplicated into the subquery. */ @@ -146976,7 +148156,19 @@ static int pushDownWhereTerms( } #endif - if( sqlite3ExprIsSingleTableConstraint(pWhere, pSrcList, iSrc) ){ +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + if( ViewCanHaveRowid && (pWhere->op==TK_ISNULL || pWhere->op==TK_NOTNULL) ){ + Expr *pLeft = pWhere->pLeft; + if( ALWAYS(pLeft) + && pLeft->op==TK_COLUMN + && pLeft->iColumn < 0 + ){ + return 0; /* Restriction (12) */ + } + } +#endif + + if( sqlite3ExprIsSingleTableConstraint(pWhere, pSrcList, iSrc, 1) ){ nChng++; pSubq->selFlags |= SF_PushDown; while( pSubq ){ @@ -147603,12 +148795,14 @@ SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse *pParse, SrcItem *pFrom){ while( pSel->pPrior ){ pSel = pSel->pPrior; } sqlite3ColumnsFromExprList(pParse, pSel->pEList,&pTab->nCol,&pTab->aCol); pTab->iPKey = -1; + pTab->eTabType = TABTYP_VIEW; pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) ); #ifndef SQLITE_ALLOW_ROWID_IN_VIEW /* The usual case - do not allow ROWID on a subquery */ pTab->tabFlags |= TF_Ephemeral | TF_NoVisibleRowid; #else - pTab->tabFlags |= TF_Ephemeral; /* Legacy compatibility mode */ + /* Legacy compatibility mode */ + pTab->tabFlags |= TF_Ephemeral | sqlite3Config.mNoVisibleRowid; #endif return pParse->nErr ? SQLITE_ERROR : SQLITE_OK; } @@ -147876,7 +149070,7 @@ static int selectExpander(Walker *pWalker, Select *p){ pNestedFrom = pFrom->pSelect->pEList; assert( pNestedFrom!=0 ); assert( pNestedFrom->nExpr==pTab->nCol ); - assert( VisibleRowid(pTab)==0 ); + assert( VisibleRowid(pTab)==0 || ViewCanHaveRowid ); }else{ if( zTName && sqlite3StrICmp(zTName, zTabName)!=0 ){ continue; @@ -147908,7 +149102,8 @@ static int selectExpander(Walker *pWalker, Select *p){ pUsing = 0; } - nAdd = pTab->nCol + (VisibleRowid(pTab) && (selFlags&SF_NestedFrom)); + nAdd = pTab->nCol; + if( VisibleRowid(pTab) && (selFlags & SF_NestedFrom)!=0 ) nAdd++; for(j=0; ja[pNew->nExpr-1]; assert( pX->zEName==0 ); if( (selFlags & SF_NestedFrom)!=0 && !IN_RENAME_OBJECT ){ - if( pNestedFrom ){ + if( pNestedFrom && (!ViewCanHaveRowid || jnExpr) ){ + assert( jnExpr ); pX->zEName = sqlite3DbStrDup(db, pNestedFrom->a[j].zEName); testcase( pX->zEName==0 ); }else{ @@ -148107,8 +149303,7 @@ static void selectAddSubqueryTypeInfo(Walker *pWalker, Select *p){ if( p->selFlags & SF_HasTypeInfo ) return; p->selFlags |= SF_HasTypeInfo; pParse = pWalker->pParse; - testcase( (p->selFlags & SF_Resolved)==0 ); - assert( (p->selFlags & SF_Resolved) || IN_RENAME_OBJECT ); + assert( (p->selFlags & SF_Resolved) ); pTabList = p->pSrc; for(i=0, pFrom=pTabList->a; inSrc; i++, pFrom++){ Table *pTab = pFrom->pTab; @@ -148178,6 +149373,8 @@ SQLITE_PRIVATE void sqlite3SelectPrep( */ static void printAggInfo(AggInfo *pAggInfo){ int ii; + sqlite3DebugPrintf("AggInfo %d/%p:\n", + pAggInfo->selId, pAggInfo); for(ii=0; iinColumn; ii++){ struct AggInfo_col *pCol = &pAggInfo->aCol[ii]; sqlite3DebugPrintf( @@ -149368,7 +150565,7 @@ SQLITE_PRIVATE int sqlite3Select( /* Generate code for all sub-queries in the FROM clause */ pSub = pItem->pSelect; - if( pSub==0 ) continue; + if( pSub==0 || pItem->addrFillSub!=0 ) continue; /* The code for a subquery should only be generated once. */ assert( pItem->addrFillSub==0 ); @@ -149399,7 +150596,7 @@ SQLITE_PRIVATE int sqlite3Select( #endif assert( pItem->pSelect && (pItem->pSelect->selFlags & SF_PushDown)!=0 ); }else{ - TREETRACE(0x4000,pParse,p,("Push-down not possible\n")); + TREETRACE(0x4000,pParse,p,("WHERE-lcause push-down not possible\n")); } /* Convert unused result columns of the subquery into simple NULL @@ -150280,6 +151477,12 @@ select_end: sqlite3ExprListDelete(db, pMinMaxOrderBy); #ifdef SQLITE_DEBUG if( pAggInfo && !db->mallocFailed ){ +#if TREETRACE_ENABLED + if( sqlite3TreeTrace & 0x20 ){ + TREETRACE(0x20,pParse,p,("Finished with AggInfo\n")); + printAggInfo(pAggInfo); + } +#endif for(i=0; inColumn; i++){ Expr *pExpr = pAggInfo->aCol[i].pCExpr; if( pExpr==0 ) continue; @@ -151461,6 +152664,72 @@ static ExprList *sqlite3ExpandReturning( return pNew; } +/* If the Expr node is a subquery or an EXISTS operator or an IN operator that +** uses a subquery, and if the subquery is SF_Correlated, then mark the +** expression as EP_VarSelect. +*/ +static int sqlite3ReturningSubqueryVarSelect(Walker *NotUsed, Expr *pExpr){ + UNUSED_PARAMETER(NotUsed); + if( ExprUseXSelect(pExpr) + && (pExpr->x.pSelect->selFlags & SF_Correlated)!=0 + ){ + testcase( ExprHasProperty(pExpr, EP_VarSelect) ); + ExprSetProperty(pExpr, EP_VarSelect); + } + return WRC_Continue; +} + + +/* +** If the SELECT references the table pWalker->u.pTab, then do two things: +** +** (1) Mark the SELECT as as SF_Correlated. +** (2) Set pWalker->eCode to non-zero so that the caller will know +** that (1) has happened. +*/ +static int sqlite3ReturningSubqueryCorrelated(Walker *pWalker, Select *pSelect){ + int i; + SrcList *pSrc; + assert( pSelect!=0 ); + pSrc = pSelect->pSrc; + assert( pSrc!=0 ); + for(i=0; inSrc; i++){ + if( pSrc->a[i].pTab==pWalker->u.pTab ){ + testcase( pSelect->selFlags & SF_Correlated ); + pSelect->selFlags |= SF_Correlated; + pWalker->eCode = 1; + break; + } + } + return WRC_Continue; +} + +/* +** Scan the expression list that is the argument to RETURNING looking +** for subqueries that depend on the table which is being modified in the +** statement that is hosting the RETURNING clause (pTab). Mark all such +** subqueries as SF_Correlated. If the subqueries are part of an +** expression, mark the expression as EP_VarSelect. +** +** https://sqlite.org/forum/forumpost/2c83569ce8945d39 +*/ +static void sqlite3ProcessReturningSubqueries( + ExprList *pEList, + Table *pTab +){ + Walker w; + memset(&w, 0, sizeof(w)); + w.xExprCallback = sqlite3ExprWalkNoop; + w.xSelectCallback = sqlite3ReturningSubqueryCorrelated; + w.u.pTab = pTab; + sqlite3WalkExprList(&w, pEList); + if( w.eCode ){ + w.xExprCallback = sqlite3ReturningSubqueryVarSelect; + w.xSelectCallback = sqlite3SelectWalkNoop; + sqlite3WalkExprList(&w, pEList); + } +} + /* ** Generate code for the RETURNING trigger. Unlike other triggers ** that invoke a subprogram in the bytecode, the code for RETURNING @@ -151497,6 +152766,7 @@ static void codeReturningTrigger( sSelect.pSrc = &sFrom; sFrom.nSrc = 1; sFrom.a[0].pTab = pTab; + sFrom.a[0].zName = pTab->zName; /* tag-20240424-1 */ sFrom.a[0].iCursor = -1; sqlite3SelectPrep(pParse, &sSelect, 0); if( pParse->nErr==0 ){ @@ -151523,6 +152793,7 @@ static void codeReturningTrigger( int i; int nCol = pNew->nExpr; int reg = pParse->nMem+1; + sqlite3ProcessReturningSubqueries(pNew, pTab); pParse->nMem += nCol+2; pReturning->iRetReg = reg; for(i=0; ipUpsertIdx = pIdx; + if( sqlite3UpsertOfIndex(pAll,pIdx)!=pUpsert ){ + /* Really this should be an error. The isDup ON CONFLICT clause will + ** never fire. But this problem was not discovered until three years + ** after multi-CONFLICT upsert was added, and so we silently ignore + ** the problem to prevent breaking applications that might actually + ** have redundant ON CONFLICT clauses. */ + pUpsert->isDup = 1; + } break; } if( pUpsert->pUpsertIdx==0 ){ @@ -153590,9 +154873,13 @@ SQLITE_PRIVATE int sqlite3UpsertNextIsIPK(Upsert *pUpsert){ Upsert *pNext; if( NEVER(pUpsert==0) ) return 0; pNext = pUpsert->pNextUpsert; - if( pNext==0 ) return 1; - if( pNext->pUpsertTarget==0 ) return 1; - if( pNext->pUpsertIdx==0 ) return 1; + while( 1 /*exit-by-return*/ ){ + if( pNext==0 ) return 1; + if( pNext->pUpsertTarget==0 ) return 1; + if( pNext->pUpsertIdx==0 ) return 1; + if( !pNext->isDup ) return 0; + pNext = pNext->pNextUpsert; + } return 0; } @@ -154717,6 +156004,8 @@ static int vtabCallConstructor( db->pVtabCtx = &sCtx; pTab->nTabRef++; rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr); + assert( pTab!=0 ); + assert( pTab->nTabRef>1 || rc!=SQLITE_OK ); sqlite3DeleteTable(db, pTab); db->pVtabCtx = sCtx.pPrior; if( rc==SQLITE_NOMEM ) sqlite3OomFault(db); @@ -154739,7 +156028,7 @@ static int vtabCallConstructor( pVTable->nRef = 1; if( sCtx.bDeclared==0 ){ const char *zFormat = "vtable constructor did not declare schema: %s"; - *pzErr = sqlite3MPrintf(db, zFormat, pTab->zName); + *pzErr = sqlite3MPrintf(db, zFormat, zModuleName); sqlite3VtabUnlock(pVTable); rc = SQLITE_ERROR; }else{ @@ -154917,12 +156206,30 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ Table *pTab; Parse sParse; int initBusy; + int i; + const unsigned char *z; + static const u8 aKeyword[] = { TK_CREATE, TK_TABLE, 0 }; #ifdef SQLITE_ENABLE_API_ARMOR if( !sqlite3SafetyCheckOk(db) || zCreateTable==0 ){ return SQLITE_MISUSE_BKPT; } #endif + + /* Verify that the first two keywords in the CREATE TABLE statement + ** really are "CREATE" and "TABLE". If this is not the case, then + ** sqlite3_declare_vtab() is being misused. + */ + z = (const unsigned char*)zCreateTable; + for(i=0; aKeyword[i]; i++){ + int tokenType = 0; + do{ z += sqlite3GetToken(z, &tokenType); }while( tokenType==TK_SPACE ); + if( tokenType!=aKeyword[i] ){ + sqlite3ErrorWithMsg(db, SQLITE_ERROR, "syntax error"); + return SQLITE_ERROR; + } + } + sqlite3_mutex_enter(db->mutex); pCtx = db->pVtabCtx; if( !pCtx || pCtx->bDeclared ){ @@ -154930,6 +156237,7 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ sqlite3_mutex_leave(db->mutex); return SQLITE_MISUSE_BKPT; } + pTab = pCtx->pTab; assert( IsVirtual(pTab) ); @@ -154943,11 +156251,10 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ initBusy = db->init.busy; db->init.busy = 0; sParse.nQueryLoop = 1; - if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable) - && ALWAYS(sParse.pNewTable!=0) - && ALWAYS(!db->mallocFailed) - && IsOrdinaryTable(sParse.pNewTable) - ){ + if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable) ){ + assert( sParse.pNewTable!=0 ); + assert( !db->mallocFailed ); + assert( IsOrdinaryTable(sParse.pNewTable) ); assert( sParse.zErrMsg==0 ); if( !pTab->aCol ){ Table *pNew = sParse.pNewTable; @@ -157442,6 +158749,27 @@ static SQLITE_NOINLINE void filterPullDown( } } +/* +** Loop pLoop is a WHERE_INDEXED level that uses at least one IN(...) +** operator. Return true if level pLoop is guaranteed to visit only one +** row for each key generated for the index. +*/ +static int whereLoopIsOneRow(WhereLoop *pLoop){ + if( pLoop->u.btree.pIndex->onError + && pLoop->nSkip==0 + && pLoop->u.btree.nEq==pLoop->u.btree.pIndex->nKeyCol + ){ + int ii; + for(ii=0; iiu.btree.nEq; ii++){ + if( pLoop->aLTerm[ii]->eOperator & (WO_IS|WO_ISNULL) ){ + return 0; + } + } + return 1; + } + return 0; +} + /* ** Generate code for the start of the iLevel-th loop in the WHERE clause ** implementation described by pWInfo. @@ -157520,7 +158848,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( if( pLevel->iFrom>0 && (pTabItem[0].fg.jointype & JT_LEFT)!=0 ){ pLevel->iLeftJoin = ++pParse->nMem; sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin); - VdbeComment((v, "init LEFT JOIN no-match flag")); + VdbeComment((v, "init LEFT JOIN match flag")); } /* Compute a safe address to jump to if we discover that the table for @@ -158189,7 +159517,9 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( } /* Record the instruction used to terminate the loop. */ - if( pLoop->wsFlags & WHERE_ONEROW ){ + if( (pLoop->wsFlags & WHERE_ONEROW) + || (pLevel->u.in.nIn && regBignull==0 && whereLoopIsOneRow(pLoop)) + ){ pLevel->op = OP_Noop; }else if( bRev ){ pLevel->op = OP_Prev; @@ -158579,6 +159909,12 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ** iLoop==3: Code all remaining expressions. ** ** An effort is made to skip unnecessary iterations of the loop. + ** + ** This optimization of causing simple query restrictions to occur before + ** more complex one is call the "push-down" optimization in MySQL. Here + ** in SQLite, the name is "MySQL push-down", since there is also another + ** totally unrelated optimization called "WHERE-clause push-down". + ** Sometimes the qualifier is omitted, resulting in an ambiguity, so beware. */ iLoop = (pIdx ? 1 : 2); do{ @@ -158829,7 +160165,16 @@ SQLITE_PRIVATE SQLITE_NOINLINE void sqlite3WhereRightJoinLoop( pRJ->regReturn); for(k=0; ka[k].pWLoop->iTab == pWInfo->a[k].iFrom ); + pRight = &pWInfo->pTabList->a[pWInfo->a[k].iFrom]; mAll |= pWInfo->a[k].pWLoop->maskSelf; + if( pRight->fg.viaCoroutine ){ + sqlite3VdbeAddOp3( + v, OP_Null, 0, pRight->regResult, + pRight->regResult + pRight->pSelect->pEList->nExpr-1 + ); + } sqlite3VdbeAddOp1(v, OP_NullRow, pWInfo->a[k].iTabCur); iIdxCur = pWInfo->a[k].iIdxCur; if( iIdxCur ){ @@ -159886,7 +161231,7 @@ static SQLITE_NOINLINE int exprMightBeIndexed2( if( pIdx->aiColumn[i]!=XN_EXPR ) continue; assert( pIdx->bHasExpr ); if( sqlite3ExprCompareSkip(pExpr,pIdx->aColExpr->a[i].pExpr,iCur)==0 - && pExpr->op!=TK_STRING + && !sqlite3ExprIsConstant(0,pIdx->aColExpr->a[i].pExpr) ){ aiCurCol[0] = iCur; aiCurCol[1] = XN_EXPR; @@ -160535,6 +161880,7 @@ SQLITE_PRIVATE void SQLITE_NOINLINE sqlite3WhereAddLimit(WhereClause *pWC, Selec continue; } if( pWC->a[ii].leftCursor!=iCsr ) return; + if( pWC->a[ii].prereqRight!=0 ) return; } /* Check condition (5). Return early if it is not met. */ @@ -160549,12 +161895,14 @@ SQLITE_PRIVATE void SQLITE_NOINLINE sqlite3WhereAddLimit(WhereClause *pWC, Selec /* All conditions are met. Add the terms to the where-clause object. */ assert( p->pLimit->op==TK_LIMIT ); - whereAddLimitExpr(pWC, p->iLimit, p->pLimit->pLeft, - iCsr, SQLITE_INDEX_CONSTRAINT_LIMIT); - if( p->iOffset>0 ){ + if( p->iOffset!=0 && (p->selFlags & SF_Compound)==0 ){ whereAddLimitExpr(pWC, p->iOffset, p->pLimit->pRight, iCsr, SQLITE_INDEX_CONSTRAINT_OFFSET); } + if( p->iOffset==0 || (p->selFlags & SF_Compound)==0 ){ + whereAddLimitExpr(pWC, p->iLimit, p->pLimit->pLeft, + iCsr, SQLITE_INDEX_CONSTRAINT_LIMIT); + } } } @@ -161072,6 +162420,42 @@ static Expr *whereRightSubexprIsColumn(Expr *p){ return 0; } +/* +** Term pTerm is guaranteed to be a WO_IN term. It may be a component term +** of a vector IN expression of the form "(x, y, ...) IN (SELECT ...)". +** This function checks to see if the term is compatible with an index +** column with affinity idxaff (one of the SQLITE_AFF_XYZ values). If so, +** it returns a pointer to the name of the collation sequence (e.g. "BINARY" +** or "NOCASE") used by the comparison in pTerm. If it is not compatible +** with affinity idxaff, NULL is returned. +*/ +static SQLITE_NOINLINE const char *indexInAffinityOk( + Parse *pParse, + WhereTerm *pTerm, + u8 idxaff +){ + Expr *pX = pTerm->pExpr; + Expr inexpr; + + assert( pTerm->eOperator & WO_IN ); + + if( sqlite3ExprIsVector(pX->pLeft) ){ + int iField = pTerm->u.x.iField - 1; + inexpr.flags = 0; + inexpr.op = TK_EQ; + inexpr.pLeft = pX->pLeft->x.pList->a[iField].pExpr; + assert( ExprUseXSelect(pX) ); + inexpr.pRight = pX->x.pSelect->pEList->a[iField].pExpr; + pX = &inexpr; + } + + if( sqlite3IndexAffinityOk(pX, idxaff) ){ + CollSeq *pRet = sqlite3ExprCompareCollSeq(pParse, pX); + return pRet ? pRet->zName : sqlite3StrBINARY; + } + return 0; +} + /* ** Advance to the next WhereTerm that matches according to the criteria ** established when the pScan object was initialized by whereScanInit(). @@ -161122,16 +162506,24 @@ static WhereTerm *whereScanNext(WhereScan *pScan){ if( (pTerm->eOperator & pScan->opMask)!=0 ){ /* Verify the affinity and collating sequence match */ if( pScan->zCollName && (pTerm->eOperator & WO_ISNULL)==0 ){ - CollSeq *pColl; + const char *zCollName; Parse *pParse = pWC->pWInfo->pParse; pX = pTerm->pExpr; - if( !sqlite3IndexAffinityOk(pX, pScan->idxaff) ){ - continue; + + if( (pTerm->eOperator & WO_IN) ){ + zCollName = indexInAffinityOk(pParse, pTerm, pScan->idxaff); + if( !zCollName ) continue; + }else{ + CollSeq *pColl; + if( !sqlite3IndexAffinityOk(pX, pScan->idxaff) ){ + continue; + } + assert(pX->pLeft); + pColl = sqlite3ExprCompareCollSeq(pParse, pX); + zCollName = pColl ? pColl->zName : sqlite3StrBINARY; } - assert(pX->pLeft); - pColl = sqlite3ExprCompareCollSeq(pParse, pX); - if( pColl==0 ) pColl = pParse->db->pDfltColl; - if( sqlite3StrICmp(pColl->zName, pScan->zCollName) ){ + + if( sqlite3StrICmp(zCollName, pScan->zCollName) ){ continue; } } @@ -161483,9 +162875,13 @@ static void translateColumnToCopy( ** are no-ops. */ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(WHERETRACE_ENABLED) -static void whereTraceIndexInfoInputs(sqlite3_index_info *p){ +static void whereTraceIndexInfoInputs( + sqlite3_index_info *p, /* The IndexInfo object */ + Table *pTab /* The TABLE that is the virtual table */ +){ int i; if( (sqlite3WhereTrace & 0x10)==0 ) return; + sqlite3DebugPrintf("sqlite3_index_info inputs for %s:\n", pTab->zName); for(i=0; inConstraint; i++){ sqlite3DebugPrintf( " constraint[%d]: col=%d termid=%d op=%d usabled=%d collseq=%s\n", @@ -161503,9 +162899,13 @@ static void whereTraceIndexInfoInputs(sqlite3_index_info *p){ p->aOrderBy[i].desc); } } -static void whereTraceIndexInfoOutputs(sqlite3_index_info *p){ +static void whereTraceIndexInfoOutputs( + sqlite3_index_info *p, /* The IndexInfo object */ + Table *pTab /* The TABLE that is the virtual table */ +){ int i; if( (sqlite3WhereTrace & 0x10)==0 ) return; + sqlite3DebugPrintf("sqlite3_index_info outputs for %s:\n", pTab->zName); for(i=0; inConstraint; i++){ sqlite3DebugPrintf(" usage[%d]: argvIdx=%d omit=%d\n", i, @@ -161519,8 +162919,8 @@ static void whereTraceIndexInfoOutputs(sqlite3_index_info *p){ sqlite3DebugPrintf(" estimatedRows=%lld\n", p->estimatedRows); } #else -#define whereTraceIndexInfoInputs(A) -#define whereTraceIndexInfoOutputs(A) +#define whereTraceIndexInfoInputs(A,B) +#define whereTraceIndexInfoOutputs(A,B) #endif /* @@ -161704,7 +163104,7 @@ static SQLITE_NOINLINE void constructAutomaticIndex( ** WHERE clause (or the ON clause of a LEFT join) that constrain which ** rows of the target table (pSrc) that can be used. */ if( (pTerm->wtFlags & TERM_VIRTUAL)==0 - && sqlite3ExprIsSingleTableConstraint(pExpr, pTabList, pLevel->iFrom) + && sqlite3ExprIsSingleTableConstraint(pExpr, pTabList, pLevel->iFrom, 0) ){ pPartial = sqlite3ExprAnd(pParse, pPartial, sqlite3ExprDup(pParse->db, pExpr, 0)); @@ -161746,7 +163146,7 @@ static SQLITE_NOINLINE void constructAutomaticIndex( ** if they go out of sync. */ if( IsView(pTable) ){ - extraCols = ALLBITS; + extraCols = ALLBITS & ~idxCols; }else{ extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1)); } @@ -161973,7 +163373,7 @@ static SQLITE_NOINLINE void sqlite3ConstructBloomFilter( for(pTerm=pWInfo->sWC.a; pTermpExpr; if( (pTerm->wtFlags & TERM_VIRTUAL)==0 - && sqlite3ExprIsSingleTableConstraint(pExpr, pTabList, iSrc) + && sqlite3ExprIsSingleTableConstraint(pExpr, pTabList, iSrc, 0) ){ sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL); } @@ -162099,7 +163499,7 @@ static sqlite3_index_info *allocateIndexInfo( Expr *pE2; /* Skip over constant terms in the ORDER BY clause */ - if( sqlite3ExprIsConstant(pExpr) ){ + if( sqlite3ExprIsConstant(0, pExpr) ){ continue; } @@ -162134,7 +163534,7 @@ static sqlite3_index_info *allocateIndexInfo( } if( i==n ){ nOrderBy = n; - if( (pWInfo->wctrlFlags & WHERE_DISTINCTBY) ){ + if( (pWInfo->wctrlFlags & WHERE_DISTINCTBY) && !pSrc->fg.rowidUsed ){ eDistinct = 2 + ((pWInfo->wctrlFlags & WHERE_SORTBYGROUP)!=0); }else if( pWInfo->wctrlFlags & WHERE_GROUPBY ){ eDistinct = 1; @@ -162211,7 +163611,7 @@ static sqlite3_index_info *allocateIndexInfo( pIdxInfo->nConstraint = j; for(i=j=0; ia[i].pExpr; - if( sqlite3ExprIsConstant(pExpr) ) continue; + if( sqlite3ExprIsConstant(0, pExpr) ) continue; assert( pExpr->op==TK_COLUMN || (pExpr->op==TK_COLLATE && pExpr->pLeft->op==TK_COLUMN && pExpr->iColumn==pExpr->pLeft->iColumn) ); @@ -162263,11 +163663,11 @@ static int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){ sqlite3_vtab *pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab; int rc; - whereTraceIndexInfoInputs(p); + whereTraceIndexInfoInputs(p, pTab); pParse->db->nSchemaLock++; rc = pVtab->pModule->xBestIndex(pVtab, p); pParse->db->nSchemaLock--; - whereTraceIndexInfoOutputs(p); + whereTraceIndexInfoOutputs(p, pTab); if( rc!=SQLITE_OK && rc!=SQLITE_CONSTRAINT ){ if( rc==SQLITE_NOMEM ){ @@ -163745,7 +165145,9 @@ static int whereLoopAddBtreeIndex( } if( pProbe->bUnordered || pProbe->bLowQual ){ if( pProbe->bUnordered ) opMask &= ~(WO_GT|WO_GE|WO_LT|WO_LE); - if( pProbe->bLowQual ) opMask &= ~(WO_EQ|WO_IN|WO_IS); + if( pProbe->bLowQual && pSrc->fg.isIndexedBy==0 ){ + opMask &= ~(WO_EQ|WO_IN|WO_IS); + } } assert( pNew->u.btree.nEqnColumn ); @@ -164012,10 +165414,13 @@ static int whereLoopAddBtreeIndex( } } - /* Set rCostIdx to the cost of visiting selected rows in index. Add - ** it to pNew->rRun, which is currently set to the cost of the index - ** seek only. Then, if this is a non-covering index, add the cost of - ** visiting the rows in the main table. */ + /* Set rCostIdx to the estimated cost of visiting selected rows in the + ** index. The estimate is the sum of two values: + ** 1. The cost of doing one search-by-key to find the first matching + ** entry + ** 2. Stepping forward in the index pNew->nOut times to find all + ** additional matching entries. + */ assert( pSrc->pTab->szTabRow>0 ); if( pProbe->idxType==SQLITE_IDXTYPE_IPK ){ /* The pProbe->szIdxRow is low for an IPK table since the interior @@ -164026,7 +165431,15 @@ static int whereLoopAddBtreeIndex( }else{ rCostIdx = pNew->nOut + 1 + (15*pProbe->szIdxRow)/pSrc->pTab->szTabRow; } - pNew->rRun = sqlite3LogEstAdd(rLogSize, rCostIdx); + rCostIdx = sqlite3LogEstAdd(rLogSize, rCostIdx); + + /* Estimate the cost of running the loop. If all data is coming + ** from the index, then this is just the cost of doing the index + ** lookup and scan. But if some data is coming out of the main table, + ** we also have to add in the cost of doing pNew->nOut searches to + ** locate the row in the main table that corresponds to the index entry. + */ + pNew->rRun = rCostIdx; if( (pNew->wsFlags & (WHERE_IDX_ONLY|WHERE_IPK|WHERE_EXPRIDX))==0 ){ pNew->rRun = sqlite3LogEstAdd(pNew->rRun, pNew->nOut + 16); } @@ -164132,7 +165545,9 @@ static int indexMightHelpWithOrderBy( for(ii=0; iinExpr; ii++){ Expr *pExpr = sqlite3ExprSkipCollateAndLikely(pOB->a[ii].pExpr); if( NEVER(pExpr==0) ) continue; - if( pExpr->op==TK_COLUMN && pExpr->iTable==iCursor ){ + if( (pExpr->op==TK_COLUMN || pExpr->op==TK_AGG_COLUMN) + && pExpr->iTable==iCursor + ){ if( pExpr->iColumn<0 ) return 1; for(jj=0; jjnKeyCol; jj++){ if( pExpr->iColumn==pIndex->aiColumn[jj] ) return 1; @@ -164389,7 +165804,7 @@ static void wherePartIdxExpr( u8 aff; if( pLeft->op!=TK_COLUMN ) return; - if( !sqlite3ExprIsConstant(pRight) ) return; + if( !sqlite3ExprIsConstant(0, pRight) ) return; if( !sqlite3IsBinary(sqlite3ExprCompareCollSeq(pParse, pPart)) ) return; if( pLeft->iColumn<0 ) return; aff = pIdx->pTable->aCol[pLeft->iColumn].affinity; @@ -164662,7 +166077,9 @@ static int whereLoopAddBtree( " according to whereIsCoveringIndex()\n", pProbe->zName)); } } - }else if( m==0 ){ + }else if( m==0 + && (HasRowid(pTab) || pWInfo->pSelect!=0 || sqlite3FaultSim(700)) + ){ WHERETRACE(0x200, ("-> %s a covering index according to bitmasks\n", pProbe->zName, m==0 ? "is" : "is not")); @@ -164738,7 +166155,7 @@ static int whereLoopAddBtree( ** unique index is used (making the index functionally non-unique) ** then the sqlite_stat1 data becomes important for scoring the ** plan */ - pTab->tabFlags |= TF_StatsUsed; + pTab->tabFlags |= TF_MaybeReanalyze; } #ifdef SQLITE_ENABLE_STAT4 sqlite3Stat4ProbeFree(pBuilder->pRec); @@ -164760,6 +166177,21 @@ static int isLimitTerm(WhereTerm *pTerm){ && pTerm->eMatchOp<=SQLITE_INDEX_CONSTRAINT_OFFSET; } +/* +** Return true if the first nCons constraints in the pUsage array are +** marked as in-use (have argvIndex>0). False otherwise. +*/ +static int allConstraintsUsed( + struct sqlite3_index_constraint_usage *aUsage, + int nCons +){ + int ii; + for(ii=0; iipNew->iTab. This @@ -164900,13 +166332,20 @@ static int whereLoopAddVirtualOne( *pbIn = 1; assert( (mExclude & WO_IN)==0 ); } + /* Unless pbRetryLimit is non-NULL, there should be no LIMIT/OFFSET + ** terms. And if there are any, they should follow all other terms. */ assert( pbRetryLimit || !isLimitTerm(pTerm) ); - if( isLimitTerm(pTerm) && *pbIn ){ + assert( !isLimitTerm(pTerm) || i>=nConstraint-2 ); + assert( !isLimitTerm(pTerm) || i==nConstraint-1 || isLimitTerm(pTerm+1) ); + + if( isLimitTerm(pTerm) && (*pbIn || !allConstraintsUsed(pUsage, i)) ){ /* If there is an IN(...) term handled as an == (separate call to ** xFilter for each value on the RHS of the IN) and a LIMIT or - ** OFFSET term handled as well, the plan is unusable. Set output - ** variable *pbRetryLimit to true to tell the caller to retry with - ** LIMIT and OFFSET disabled. */ + ** OFFSET term handled as well, the plan is unusable. Similarly, + ** if there is a LIMIT/OFFSET and there are other unused terms, + ** the plan cannot be used. In these cases set variable *pbRetryLimit + ** to true to tell the caller to retry with LIMIT and OFFSET + ** disabled. */ if( pIdxInfo->needToFreeIdxStr ){ sqlite3_free(pIdxInfo->idxStr); pIdxInfo->idxStr = 0; @@ -165763,7 +167202,7 @@ static i8 wherePathSatisfiesOrderBy( if( MASKBIT(i) & obSat ) continue; p = pOrderBy->a[i].pExpr; mTerm = sqlite3WhereExprUsage(&pWInfo->sMaskSet,p); - if( mTerm==0 && !sqlite3ExprIsConstant(p) ) continue; + if( mTerm==0 && !sqlite3ExprIsConstant(0,p) ) continue; if( (mTerm&~orderDistinctMask)==0 ){ obSat |= MASKBIT(i); } @@ -166232,10 +167671,9 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){ pWInfo->eDistinct = WHERE_DISTINCT_ORDERED; } - if( pWInfo->pSelect->pOrderBy - && pWInfo->nOBSat > pWInfo->pSelect->pOrderBy->nExpr ){ - pWInfo->nOBSat = pWInfo->pSelect->pOrderBy->nExpr; - } + /* vvv--- See check-in [12ad822d9b827777] on 2023-03-16 ---vvv */ + assert( pWInfo->pSelect->pOrderBy==0 + || pWInfo->nOBSat <= pWInfo->pSelect->pOrderBy->nExpr ); }else{ pWInfo->revMask = pFrom->revLoop; if( pWInfo->nOBSat<=0 ){ @@ -166278,7 +167716,6 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ } } - pWInfo->nRowOut = pFrom->nRow; /* Free temporary memory and return success */ @@ -166286,6 +167723,83 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ return SQLITE_OK; } +/* +** This routine implements a heuristic designed to improve query planning. +** This routine is called in between the first and second call to +** wherePathSolver(). Hence the name "Interstage" "Heuristic". +** +** The first call to wherePathSolver() (hereafter just "solver()") computes +** the best path without regard to the order of the outputs. The second call +** to the solver() builds upon the first call to try to find an alternative +** path that satisfies the ORDER BY clause. +** +** This routine looks at the results of the first solver() run, and for +** every FROM clause term in the resulting query plan that uses an equality +** constraint against an index, disable other WhereLoops for that same +** FROM clause term that would try to do a full-table scan. This prevents +** an index search from being converted into a full-table scan in order to +** satisfy an ORDER BY clause, since even though we might get slightly better +** performance using the full-scan without sorting if the output size +** estimates are very precise, we might also get severe performance +** degradation using the full-scan if the output size estimate is too large. +** It is better to err on the side of caution. +** +** Except, if the first solver() call generated a full-table scan in an outer +** loop then stop this analysis at the first full-scan, since the second +** solver() run might try to swap that full-scan for another in order to +** get the output into the correct order. In other words, we allow a +** rewrite like this: +** +** First Solver() Second Solver() +** |-- SCAN t1 |-- SCAN t2 +** |-- SEARCH t2 `-- SEARCH t1 +** `-- SORT USING B-TREE +** +** The purpose of this routine is to disallow rewrites such as: +** +** First Solver() Second Solver() +** |-- SEARCH t1 |-- SCAN t2 <--- bad! +** |-- SEARCH t2 `-- SEARCH t1 +** `-- SORT USING B-TREE +** +** See test cases in test/whereN.test for the real-world query that +** originally provoked this heuristic. +*/ +static SQLITE_NOINLINE void whereInterstageHeuristic(WhereInfo *pWInfo){ + int i; +#ifdef WHERETRACE_ENABLED + int once = 0; +#endif + for(i=0; inLevel; i++){ + WhereLoop *p = pWInfo->a[i].pWLoop; + if( p==0 ) break; + if( (p->wsFlags & WHERE_VIRTUALTABLE)!=0 ) continue; + if( (p->wsFlags & (WHERE_COLUMN_EQ|WHERE_COLUMN_NULL|WHERE_COLUMN_IN))!=0 ){ + u8 iTab = p->iTab; + WhereLoop *pLoop; + for(pLoop=pWInfo->pLoops; pLoop; pLoop=pLoop->pNextLoop){ + if( pLoop->iTab!=iTab ) continue; + if( (pLoop->wsFlags & (WHERE_CONSTRAINT|WHERE_AUTO_INDEX))!=0 ){ + /* Auto-index and index-constrained loops allowed to remain */ + continue; + } +#ifdef WHERETRACE_ENABLED + if( sqlite3WhereTrace & 0x80 ){ + if( once==0 ){ + sqlite3DebugPrintf("Loops disabled by interstage heuristic:\n"); + once = 1; + } + sqlite3WhereLoopPrint(pLoop, &pWInfo->sWC); + } +#endif /* WHERETRACE_ENABLED */ + pLoop->prereq = ALLBITS; /* Prevent 2nd solver() from using this one */ + } + }else{ + break; + } + } +} + /* ** Most queries use only a single table (they are not joins) and have ** simple == constraints against indexed fields. This routine attempts @@ -166454,6 +167968,10 @@ static void showAllWhereLoops(WhereInfo *pWInfo, WhereClause *pWC){ ** the right-most table of a subquery that was flattened into the ** main query and that subquery was the right-hand operand of an ** inner join that held an ON or USING clause. +** 6) The ORDER BY clause has 63 or fewer terms +** 7) The omit-noop-join optimization is enabled. +** +** Items (1), (6), and (7) are checked by the caller. ** ** For example, given: ** @@ -166574,7 +168092,7 @@ static SQLITE_NOINLINE void whereCheckIfBloomFilterIsUseful( SrcItem *pItem = &pWInfo->pTabList->a[pLoop->iTab]; Table *pTab = pItem->pTab; if( (pTab->tabFlags & TF_HasStat1)==0 ) break; - pTab->tabFlags |= TF_StatsUsed; + pTab->tabFlags |= TF_MaybeReanalyze; if( i>=1 && (pLoop->wsFlags & reqFlags)==reqFlags /* vvvvvv--- Always the case if WHERE_COLUMN_EQ is defined */ @@ -166595,6 +168113,58 @@ static SQLITE_NOINLINE void whereCheckIfBloomFilterIsUseful( } } +/* +** Expression Node callback for sqlite3ExprCanReturnSubtype(). +** +** Only a function call is able to return a subtype. So if the node +** is not a function call, return WRC_Prune immediately. +** +** A function call is able to return a subtype if it has the +** SQLITE_RESULT_SUBTYPE property. +** +** Assume that every function is able to pass-through a subtype from +** one of its argument (using sqlite3_result_value()). Most functions +** are not this way, but we don't have a mechanism to distinguish those +** that are from those that are not, so assume they all work this way. +** That means that if one of its arguments is another function and that +** other function is able to return a subtype, then this function is +** able to return a subtype. +*/ +static int exprNodeCanReturnSubtype(Walker *pWalker, Expr *pExpr){ + int n; + FuncDef *pDef; + sqlite3 *db; + if( pExpr->op!=TK_FUNCTION ){ + return WRC_Prune; + } + assert( ExprUseXList(pExpr) ); + db = pWalker->pParse->db; + n = pExpr->x.pList ? pExpr->x.pList->nExpr : 0; + pDef = sqlite3FindFunction(db, pExpr->u.zToken, n, ENC(db), 0); + if( pDef==0 || (pDef->funcFlags & SQLITE_RESULT_SUBTYPE)!=0 ){ + pWalker->eCode = 1; + return WRC_Prune; + } + return WRC_Continue; +} + +/* +** Return TRUE if expression pExpr is able to return a subtype. +** +** A TRUE return does not guarantee that a subtype will be returned. +** It only indicates that a subtype return is possible. False positives +** are acceptable as they only disable an optimization. False negatives, +** on the other hand, can lead to incorrect answers. +*/ +static int sqlite3ExprCanReturnSubtype(Parse *pParse, Expr *pExpr){ + Walker w; + memset(&w, 0, sizeof(w)); + w.pParse = pParse; + w.xExprCallback = exprNodeCanReturnSubtype; + sqlite3WalkExpr(&w, pExpr); + return w.eCode; +} + /* ** The index pIdx is used by a query and contains one or more expressions. ** In other words pIdx is an index on an expression. iIdxCur is the cursor @@ -166620,33 +168190,19 @@ static SQLITE_NOINLINE void whereAddIndexedExpr( for(i=0; inColumn; i++){ Expr *pExpr; int j = pIdx->aiColumn[i]; - int bMaybeNullRow; if( j==XN_EXPR ){ pExpr = pIdx->aColExpr->a[i].pExpr; - testcase( pTabItem->fg.jointype & JT_LEFT ); - testcase( pTabItem->fg.jointype & JT_RIGHT ); - testcase( pTabItem->fg.jointype & JT_LTORJ ); - bMaybeNullRow = (pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0; }else if( j>=0 && (pTab->aCol[j].colFlags & COLFLAG_VIRTUAL)!=0 ){ pExpr = sqlite3ColumnExpr(pTab, &pTab->aCol[j]); - bMaybeNullRow = 0; }else{ continue; } - if( sqlite3ExprIsConstant(pExpr) ) continue; - if( pExpr->op==TK_FUNCTION ){ + if( sqlite3ExprIsConstant(0,pExpr) ) continue; + if( pExpr->op==TK_FUNCTION && sqlite3ExprCanReturnSubtype(pParse,pExpr) ){ /* Functions that might set a subtype should not be replaced by the ** value taken from an expression index since the index omits the ** subtype. https://sqlite.org/forum/forumpost/68d284c86b082c3e */ - int n; - FuncDef *pDef; - sqlite3 *db = pParse->db; - assert( ExprUseXList(pExpr) ); - n = pExpr->x.pList ? pExpr->x.pList->nExpr : 0; - pDef = sqlite3FindFunction(db, pExpr->u.zToken, n, ENC(db), 0); - if( pDef==0 || (pDef->funcFlags & SQLITE_RESULT_SUBTYPE)!=0 ){ - continue; - } + continue; } p = sqlite3DbMallocRaw(pParse->db, sizeof(IndexedExpr)); if( p==0 ) break; @@ -166661,7 +168217,7 @@ static SQLITE_NOINLINE void whereAddIndexedExpr( p->iDataCur = pTabItem->iCursor; p->iIdxCur = iIdxCur; p->iIdxCol = i; - p->bMaybeNullRow = bMaybeNullRow; + p->bMaybeNullRow = (pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0; if( sqlite3IndexAffinityStr(pParse->db, pIdx) ){ p->aff = pIdx->zColAff[i]; } @@ -166829,6 +168385,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( if( pOrderBy && pOrderBy->nExpr>=BMS ){ pOrderBy = 0; wctrlFlags &= ~WHERE_WANT_DISTINCT; + wctrlFlags |= WHERE_KEEP_ALL_JOINS; /* Disable omit-noop-join opt */ } /* The number of tables in the FROM clause is limited by the number of @@ -166911,7 +168468,11 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( ){ pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE; } - ExplainQueryPlan((pParse, 0, "SCAN CONSTANT ROW")); + if( ALWAYS(pWInfo->pSelect) + && (pWInfo->pSelect->selFlags & SF_MultiValue)==0 + ){ + ExplainQueryPlan((pParse, 0, "SCAN CONSTANT ROW")); + } }else{ /* Assign a bit from the bitmask to every term in the FROM clause. ** @@ -167064,6 +168625,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( wherePathSolver(pWInfo, 0); if( db->mallocFailed ) goto whereBeginError; if( pWInfo->pOrderBy ){ + whereInterstageHeuristic(pWInfo); wherePathSolver(pWInfo, pWInfo->nRowOut+1); if( db->mallocFailed ) goto whereBeginError; } @@ -167124,10 +168686,10 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( ** in-line sqlite3WhereCodeOneLoopStart() for performance reasons. */ notReady = ~(Bitmask)0; - if( pWInfo->nLevel>=2 - && pResultSet!=0 /* these two combine to guarantee */ - && 0==(wctrlFlags & WHERE_AGG_DISTINCT) /* condition (1) above */ - && OptimizationEnabled(db, SQLITE_OmitNoopJoin) + if( pWInfo->nLevel>=2 /* Must be a join, or this opt8n is pointless */ + && pResultSet!=0 /* Condition (1) */ + && 0==(wctrlFlags & (WHERE_AGG_DISTINCT|WHERE_KEEP_ALL_JOINS)) /* (1),(6) */ + && OptimizationEnabled(db, SQLITE_OmitNoopJoin) /* (7) */ ){ notReady = whereOmitNoopJoin(pWInfo, notReady); nTabList = pWInfo->nLevel; @@ -167447,26 +169009,6 @@ whereBeginError: } #endif -#ifdef SQLITE_DEBUG -/* -** Return true if cursor iCur is opened by instruction k of the -** bytecode. Used inside of assert() only. -*/ -static int cursorIsOpen(Vdbe *v, int iCur, int k){ - while( k>=0 ){ - VdbeOp *pOp = sqlite3VdbeGetOp(v,k--); - if( pOp->p1!=iCur ) continue; - if( pOp->opcode==OP_Close ) return 0; - if( pOp->opcode==OP_OpenRead ) return 1; - if( pOp->opcode==OP_OpenWrite ) return 1; - if( pOp->opcode==OP_OpenDup ) return 1; - if( pOp->opcode==OP_OpenAutoindex ) return 1; - if( pOp->opcode==OP_OpenEphemeral ) return 1; - } - return 0; -} -#endif /* SQLITE_DEBUG */ - /* ** Generate the end of the WHERE loop. See comments on ** sqlite3WhereBegin() for additional information. @@ -167613,7 +169155,15 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin); VdbeCoverage(v); assert( (ws & WHERE_IDX_ONLY)==0 || (ws & WHERE_INDEXED)!=0 ); if( (ws & WHERE_IDX_ONLY)==0 ){ - assert( pLevel->iTabCur==pTabList->a[pLevel->iFrom].iCursor ); + SrcItem *pSrc = &pTabList->a[pLevel->iFrom]; + assert( pLevel->iTabCur==pSrc->iCursor ); + if( pSrc->fg.viaCoroutine ){ + int m, n; + n = pSrc->regResult; + assert( pSrc->pTab!=0 ); + m = pSrc->pTab->nCol; + sqlite3VdbeAddOp3(v, OP_Null, 0, n, n+m-1); + } sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iTabCur); } if( (ws & WHERE_INDEXED) @@ -167663,6 +169213,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ */ if( pTabItem->fg.viaCoroutine ){ testcase( pParse->db->mallocFailed ); + assert( pTabItem->regResult>=0 ); translateColumnToCopy(pParse, pLevel->addrBody, pLevel->iTabCur, pTabItem->regResult, 0); continue; @@ -167757,16 +169308,10 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ ** reference. Verify that this is harmless - that the ** table being referenced really is open. */ -#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC - assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 - || cursorIsOpen(v,pOp->p1,k) - || pOp->opcode==OP_Offset - ); -#else - assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 - || cursorIsOpen(v,pOp->p1,k) - ); -#endif + if( pLoop->wsFlags & WHERE_IDX_ONLY ){ + sqlite3ErrorMsg(pParse, "internal query planner error"); + pParse->rc = SQLITE_INTERNAL; + } } }else if( pOp->opcode==OP_Rowid ){ pOp->p1 = pLevel->iIdxCur; @@ -168967,7 +170512,7 @@ SQLITE_PRIVATE void sqlite3WindowListDelete(sqlite3 *db, Window *p){ ** variable values in the expression tree. */ static Expr *sqlite3WindowOffsetExpr(Parse *pParse, Expr *pExpr){ - if( 0==sqlite3ExprIsConstant(pExpr) ){ + if( 0==sqlite3ExprIsConstant(0,pExpr) ){ if( IN_RENAME_OBJECT ) sqlite3RenameExprUnmap(pParse, pExpr); sqlite3ExprDelete(pParse->db, pExpr); pExpr = sqlite3ExprAlloc(pParse->db, TK_NULL, 0, 0); @@ -171037,9 +172582,9 @@ static void updateDeleteLimitError( break; } } - if( (p->selFlags & SF_MultiValue)==0 && - (mxSelect = pParse->db->aLimit[SQLITE_LIMIT_COMPOUND_SELECT])>0 && - cnt>mxSelect + if( (p->selFlags & (SF_MultiValue|SF_Values))==0 + && (mxSelect = pParse->db->aLimit[SQLITE_LIMIT_COMPOUND_SELECT])>0 + && cnt>mxSelect ){ sqlite3ErrorMsg(pParse, "too many terms in compound SELECT"); } @@ -171059,6 +172604,14 @@ static void updateDeleteLimitError( return pSelect; } + /* Memory allocator for parser stack resizing. This is a thin wrapper around + ** sqlite3_realloc() that includes a call to sqlite3FaultSim() to facilitate + ** testing. + */ + static void *parserStackRealloc(void *pOld, sqlite3_uint64 newSize){ + return sqlite3FaultSim(700) ? 0 : sqlite3_realloc(pOld, newSize); + } + /* Construct a new Expr object from a single token */ static Expr *tokenExpr(Parse *pParse, int op, Token t){ @@ -171308,8 +172861,8 @@ static void updateDeleteLimitError( #define TK_TRUEFALSE 170 #define TK_ISNOT 171 #define TK_FUNCTION 172 -#define TK_UMINUS 173 -#define TK_UPLUS 174 +#define TK_UPLUS 173 +#define TK_UMINUS 174 #define TK_TRUTH 175 #define TK_REGISTER 176 #define TK_VECTOR 177 @@ -171318,8 +172871,9 @@ static void updateDeleteLimitError( #define TK_ASTERISK 180 #define TK_SPAN 181 #define TK_ERROR 182 -#define TK_SPACE 183 -#define TK_ILLEGAL 184 +#define TK_QNUMBER 183 +#define TK_SPACE 184 +#define TK_ILLEGAL 185 #endif /**************** End token definitions ***************************************/ @@ -171360,6 +172914,9 @@ static void updateDeleteLimitError( ** sqlite3ParserARG_STORE Code to store %extra_argument into yypParser ** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser ** sqlite3ParserCTX_* As sqlite3ParserARG_ except for %extra_context +** YYREALLOC Name of the realloc() function to use +** YYFREE Name of the free() function to use +** YYDYNSTACK True if stack space should be extended on heap ** YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** YYNSTATE the combined number of states. @@ -171373,37 +172930,39 @@ static void updateDeleteLimitError( ** YY_NO_ACTION The yy_action[] code for no-op ** YY_MIN_REDUCE Minimum value for reduce actions ** YY_MAX_REDUCE Maximum value for reduce actions +** YY_MIN_DSTRCTR Minimum symbol value that has a destructor +** YY_MAX_DSTRCTR Maximum symbol value that has a destructor */ #ifndef INTERFACE # define INTERFACE 1 #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 319 +#define YYNOCODE 322 #define YYACTIONTYPE unsigned short int #define YYWILDCARD 101 #define sqlite3ParserTOKENTYPE Token typedef union { int yyinit; sqlite3ParserTOKENTYPE yy0; - TriggerStep* yy33; - Window* yy41; - Select* yy47; - SrcList* yy131; - struct TrigEvent yy180; - struct {int value; int mask;} yy231; - IdList* yy254; - u32 yy285; - ExprList* yy322; - Cte* yy385; - int yy394; - Upsert* yy444; - u8 yy516; - With* yy521; - const char* yy522; - Expr* yy528; - OnOrUsing yy561; - struct FrameBound yy595; + ExprList* yy14; + With* yy59; + Cte* yy67; + Upsert* yy122; + IdList* yy132; + int yy144; + const char* yy168; + SrcList* yy203; + Window* yy211; + OnOrUsing yy269; + struct TrigEvent yy286; + struct {int value; int mask;} yy383; + u32 yy391; + TriggerStep* yy427; + Expr* yy454; + u8 yy462; + struct FrameBound yy509; + Select* yy555; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -171413,24 +172972,29 @@ typedef union { #define sqlite3ParserARG_PARAM #define sqlite3ParserARG_FETCH #define sqlite3ParserARG_STORE +#define YYREALLOC parserStackRealloc +#define YYFREE sqlite3_free +#define YYDYNSTACK 1 #define sqlite3ParserCTX_SDECL Parse *pParse; #define sqlite3ParserCTX_PDECL ,Parse *pParse #define sqlite3ParserCTX_PARAM ,pParse #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; #define sqlite3ParserCTX_STORE yypParser->pParse=pParse; #define YYFALLBACK 1 -#define YYNSTATE 579 -#define YYNRULE 405 -#define YYNRULE_WITH_ACTION 340 -#define YYNTOKEN 185 -#define YY_MAX_SHIFT 578 -#define YY_MIN_SHIFTREDUCE 838 -#define YY_MAX_SHIFTREDUCE 1242 -#define YY_ERROR_ACTION 1243 -#define YY_ACCEPT_ACTION 1244 -#define YY_NO_ACTION 1245 -#define YY_MIN_REDUCE 1246 -#define YY_MAX_REDUCE 1650 +#define YYNSTATE 583 +#define YYNRULE 409 +#define YYNRULE_WITH_ACTION 344 +#define YYNTOKEN 186 +#define YY_MAX_SHIFT 582 +#define YY_MIN_SHIFTREDUCE 845 +#define YY_MAX_SHIFTREDUCE 1253 +#define YY_ERROR_ACTION 1254 +#define YY_ACCEPT_ACTION 1255 +#define YY_NO_ACTION 1256 +#define YY_MIN_REDUCE 1257 +#define YY_MAX_REDUCE 1665 +#define YY_MIN_DSTRCTR 205 +#define YY_MAX_DSTRCTR 319 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -171446,6 +173010,22 @@ typedef union { # define yytestcase(X) #endif +/* Macro to determine if stack space has the ability to grow using +** heap memory. +*/ +#if YYSTACKDEPTH<=0 || YYDYNSTACK +# define YYGROWABLESTACK 1 +#else +# define YYGROWABLESTACK 0 +#endif + +/* Guarantee a minimum number of initial stack slots. +*/ +#if YYSTACKDEPTH<=0 +# undef YYSTACKDEPTH +# define YYSTACKDEPTH 2 /* Need a minimum stack size */ +#endif + /* Next are the tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement @@ -171497,619 +173077,630 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2100) +#define YY_ACTTAB_COUNT (2142) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 572, 210, 572, 119, 116, 231, 572, 119, 116, 231, - /* 10 */ 572, 1317, 379, 1296, 410, 566, 566, 566, 572, 411, - /* 20 */ 380, 1317, 1279, 42, 42, 42, 42, 210, 1529, 72, - /* 30 */ 72, 974, 421, 42, 42, 495, 305, 281, 305, 975, - /* 40 */ 399, 72, 72, 126, 127, 81, 1217, 1217, 1054, 1057, - /* 50 */ 1044, 1044, 124, 124, 125, 125, 125, 125, 480, 411, - /* 60 */ 1244, 1, 1, 578, 2, 1248, 554, 119, 116, 231, - /* 70 */ 319, 484, 147, 484, 528, 119, 116, 231, 533, 1330, - /* 80 */ 419, 527, 143, 126, 127, 81, 1217, 1217, 1054, 1057, - /* 90 */ 1044, 1044, 124, 124, 125, 125, 125, 125, 119, 116, - /* 100 */ 231, 329, 123, 123, 123, 123, 122, 122, 121, 121, - /* 110 */ 121, 120, 117, 448, 286, 286, 286, 286, 446, 446, - /* 120 */ 446, 1568, 378, 1570, 1193, 377, 1164, 569, 1164, 569, - /* 130 */ 411, 1568, 541, 261, 228, 448, 102, 146, 453, 318, - /* 140 */ 563, 242, 123, 123, 123, 123, 122, 122, 121, 121, - /* 150 */ 121, 120, 117, 448, 126, 127, 81, 1217, 1217, 1054, - /* 160 */ 1057, 1044, 1044, 124, 124, 125, 125, 125, 125, 143, - /* 170 */ 296, 1193, 341, 452, 121, 121, 121, 120, 117, 448, - /* 180 */ 128, 1193, 1194, 1193, 149, 445, 444, 572, 120, 117, - /* 190 */ 448, 125, 125, 125, 125, 118, 123, 123, 123, 123, - /* 200 */ 122, 122, 121, 121, 121, 120, 117, 448, 458, 114, - /* 210 */ 13, 13, 550, 123, 123, 123, 123, 122, 122, 121, - /* 220 */ 121, 121, 120, 117, 448, 424, 318, 563, 1193, 1194, - /* 230 */ 1193, 150, 1225, 411, 1225, 125, 125, 125, 125, 123, - /* 240 */ 123, 123, 123, 122, 122, 121, 121, 121, 120, 117, - /* 250 */ 448, 469, 344, 1041, 1041, 1055, 1058, 126, 127, 81, - /* 260 */ 1217, 1217, 1054, 1057, 1044, 1044, 124, 124, 125, 125, - /* 270 */ 125, 125, 1282, 526, 224, 1193, 572, 411, 226, 519, - /* 280 */ 177, 83, 84, 123, 123, 123, 123, 122, 122, 121, - /* 290 */ 121, 121, 120, 117, 448, 1010, 16, 16, 1193, 134, - /* 300 */ 134, 126, 127, 81, 1217, 1217, 1054, 1057, 1044, 1044, - /* 310 */ 124, 124, 125, 125, 125, 125, 123, 123, 123, 123, - /* 320 */ 122, 122, 121, 121, 121, 120, 117, 448, 1045, 550, - /* 330 */ 1193, 375, 1193, 1194, 1193, 254, 1438, 401, 508, 505, - /* 340 */ 504, 112, 564, 570, 4, 929, 929, 435, 503, 342, - /* 350 */ 464, 330, 362, 396, 1238, 1193, 1194, 1193, 567, 572, - /* 360 */ 123, 123, 123, 123, 122, 122, 121, 121, 121, 120, - /* 370 */ 117, 448, 286, 286, 371, 1581, 1607, 445, 444, 155, - /* 380 */ 411, 449, 72, 72, 1289, 569, 1222, 1193, 1194, 1193, - /* 390 */ 86, 1224, 273, 561, 547, 520, 520, 572, 99, 1223, - /* 400 */ 6, 1281, 476, 143, 126, 127, 81, 1217, 1217, 1054, - /* 410 */ 1057, 1044, 1044, 124, 124, 125, 125, 125, 125, 554, - /* 420 */ 13, 13, 1031, 511, 1225, 1193, 1225, 553, 110, 110, - /* 430 */ 224, 572, 1239, 177, 572, 429, 111, 199, 449, 573, - /* 440 */ 449, 432, 1555, 1019, 327, 555, 1193, 272, 289, 370, - /* 450 */ 514, 365, 513, 259, 72, 72, 547, 72, 72, 361, - /* 460 */ 318, 563, 1613, 123, 123, 123, 123, 122, 122, 121, - /* 470 */ 121, 121, 120, 117, 448, 1019, 1019, 1021, 1022, 28, - /* 480 */ 286, 286, 1193, 1194, 1193, 1159, 572, 1612, 411, 904, - /* 490 */ 192, 554, 358, 569, 554, 940, 537, 521, 1159, 437, - /* 500 */ 415, 1159, 556, 1193, 1194, 1193, 572, 548, 548, 52, - /* 510 */ 52, 216, 126, 127, 81, 1217, 1217, 1054, 1057, 1044, - /* 520 */ 1044, 124, 124, 125, 125, 125, 125, 1193, 478, 136, - /* 530 */ 136, 411, 286, 286, 1493, 509, 122, 122, 121, 121, - /* 540 */ 121, 120, 117, 448, 1010, 569, 522, 219, 545, 545, - /* 550 */ 318, 563, 143, 6, 536, 126, 127, 81, 1217, 1217, - /* 560 */ 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125, 125, - /* 570 */ 1557, 123, 123, 123, 123, 122, 122, 121, 121, 121, - /* 580 */ 120, 117, 448, 489, 1193, 1194, 1193, 486, 283, 1270, - /* 590 */ 960, 254, 1193, 375, 508, 505, 504, 1193, 342, 574, - /* 600 */ 1193, 574, 411, 294, 503, 960, 879, 193, 484, 318, - /* 610 */ 563, 386, 292, 382, 123, 123, 123, 123, 122, 122, - /* 620 */ 121, 121, 121, 120, 117, 448, 126, 127, 81, 1217, - /* 630 */ 1217, 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125, - /* 640 */ 125, 411, 396, 1139, 1193, 872, 101, 286, 286, 1193, - /* 650 */ 1194, 1193, 375, 1096, 1193, 1194, 1193, 1193, 1194, 1193, - /* 660 */ 569, 459, 33, 375, 235, 126, 127, 81, 1217, 1217, - /* 670 */ 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125, 125, - /* 680 */ 1437, 962, 572, 230, 961, 123, 123, 123, 123, 122, - /* 690 */ 122, 121, 121, 121, 120, 117, 448, 1159, 230, 1193, - /* 700 */ 158, 1193, 1194, 1193, 1556, 13, 13, 303, 960, 1233, - /* 710 */ 1159, 154, 411, 1159, 375, 1584, 1177, 5, 371, 1581, - /* 720 */ 431, 1239, 3, 960, 123, 123, 123, 123, 122, 122, - /* 730 */ 121, 121, 121, 120, 117, 448, 126, 127, 81, 1217, - /* 740 */ 1217, 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125, - /* 750 */ 125, 411, 210, 571, 1193, 1032, 1193, 1194, 1193, 1193, - /* 760 */ 390, 855, 156, 1555, 376, 404, 1101, 1101, 492, 572, - /* 770 */ 469, 344, 1322, 1322, 1555, 126, 127, 81, 1217, 1217, - /* 780 */ 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125, 125, - /* 790 */ 130, 572, 13, 13, 532, 123, 123, 123, 123, 122, - /* 800 */ 122, 121, 121, 121, 120, 117, 448, 304, 572, 457, - /* 810 */ 229, 1193, 1194, 1193, 13, 13, 1193, 1194, 1193, 1300, - /* 820 */ 467, 1270, 411, 1320, 1320, 1555, 1015, 457, 456, 436, - /* 830 */ 301, 72, 72, 1268, 123, 123, 123, 123, 122, 122, - /* 840 */ 121, 121, 121, 120, 117, 448, 126, 127, 81, 1217, - /* 850 */ 1217, 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125, - /* 860 */ 125, 411, 384, 1076, 1159, 286, 286, 421, 314, 280, - /* 870 */ 280, 287, 287, 461, 408, 407, 1539, 1159, 569, 572, - /* 880 */ 1159, 1196, 569, 409, 569, 126, 127, 81, 1217, 1217, - /* 890 */ 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125, 125, - /* 900 */ 457, 1485, 13, 13, 1541, 123, 123, 123, 123, 122, - /* 910 */ 122, 121, 121, 121, 120, 117, 448, 202, 572, 462, - /* 920 */ 1587, 578, 2, 1248, 843, 844, 845, 1563, 319, 409, - /* 930 */ 147, 6, 411, 257, 256, 255, 208, 1330, 9, 1196, - /* 940 */ 264, 72, 72, 1436, 123, 123, 123, 123, 122, 122, - /* 950 */ 121, 121, 121, 120, 117, 448, 126, 127, 81, 1217, - /* 960 */ 1217, 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125, - /* 970 */ 125, 572, 286, 286, 572, 1213, 411, 577, 315, 1248, - /* 980 */ 421, 371, 1581, 356, 319, 569, 147, 495, 529, 1644, - /* 990 */ 397, 935, 495, 1330, 71, 71, 934, 72, 72, 242, - /* 1000 */ 1328, 105, 81, 1217, 1217, 1054, 1057, 1044, 1044, 124, - /* 1010 */ 124, 125, 125, 125, 125, 123, 123, 123, 123, 122, - /* 1020 */ 122, 121, 121, 121, 120, 117, 448, 1117, 286, 286, - /* 1030 */ 1422, 452, 1528, 1213, 443, 286, 286, 1492, 1355, 313, - /* 1040 */ 478, 569, 1118, 454, 351, 495, 354, 1266, 569, 209, - /* 1050 */ 572, 418, 179, 572, 1031, 242, 385, 1119, 523, 123, - /* 1060 */ 123, 123, 123, 122, 122, 121, 121, 121, 120, 117, - /* 1070 */ 448, 1020, 108, 72, 72, 1019, 13, 13, 915, 572, - /* 1080 */ 1498, 572, 286, 286, 98, 530, 1537, 452, 916, 1334, - /* 1090 */ 1329, 203, 411, 286, 286, 569, 152, 211, 1498, 1500, - /* 1100 */ 426, 569, 56, 56, 57, 57, 569, 1019, 1019, 1021, - /* 1110 */ 447, 572, 411, 531, 12, 297, 126, 127, 81, 1217, - /* 1120 */ 1217, 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125, - /* 1130 */ 125, 572, 411, 867, 15, 15, 126, 127, 81, 1217, - /* 1140 */ 1217, 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125, - /* 1150 */ 125, 373, 529, 264, 44, 44, 126, 115, 81, 1217, - /* 1160 */ 1217, 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125, - /* 1170 */ 125, 1498, 478, 1271, 417, 123, 123, 123, 123, 122, - /* 1180 */ 122, 121, 121, 121, 120, 117, 448, 205, 1213, 495, - /* 1190 */ 430, 867, 468, 322, 495, 123, 123, 123, 123, 122, - /* 1200 */ 122, 121, 121, 121, 120, 117, 448, 572, 557, 1140, - /* 1210 */ 1642, 1422, 1642, 543, 572, 123, 123, 123, 123, 122, - /* 1220 */ 122, 121, 121, 121, 120, 117, 448, 572, 1422, 572, - /* 1230 */ 13, 13, 542, 323, 1325, 411, 334, 58, 58, 349, - /* 1240 */ 1422, 1170, 326, 286, 286, 549, 1213, 300, 895, 530, - /* 1250 */ 45, 45, 59, 59, 1140, 1643, 569, 1643, 565, 417, - /* 1260 */ 127, 81, 1217, 1217, 1054, 1057, 1044, 1044, 124, 124, - /* 1270 */ 125, 125, 125, 125, 1367, 373, 500, 290, 1193, 512, - /* 1280 */ 1366, 427, 394, 394, 393, 275, 391, 896, 1138, 852, - /* 1290 */ 478, 258, 1422, 1170, 463, 1159, 12, 331, 428, 333, - /* 1300 */ 1117, 460, 236, 258, 325, 460, 544, 1544, 1159, 1098, - /* 1310 */ 491, 1159, 324, 1098, 440, 1118, 335, 516, 123, 123, - /* 1320 */ 123, 123, 122, 122, 121, 121, 121, 120, 117, 448, - /* 1330 */ 1119, 318, 563, 1138, 572, 1193, 1194, 1193, 112, 564, - /* 1340 */ 201, 4, 238, 433, 935, 490, 285, 228, 1517, 934, - /* 1350 */ 170, 560, 572, 142, 1516, 567, 572, 60, 60, 572, - /* 1360 */ 416, 572, 441, 572, 535, 302, 875, 8, 487, 572, - /* 1370 */ 237, 572, 416, 572, 485, 61, 61, 572, 449, 62, - /* 1380 */ 62, 332, 63, 63, 46, 46, 47, 47, 361, 572, - /* 1390 */ 561, 572, 48, 48, 50, 50, 51, 51, 572, 295, - /* 1400 */ 64, 64, 482, 295, 539, 412, 471, 1031, 572, 538, - /* 1410 */ 318, 563, 65, 65, 66, 66, 409, 475, 572, 1031, - /* 1420 */ 572, 14, 14, 875, 1020, 110, 110, 409, 1019, 572, - /* 1430 */ 474, 67, 67, 111, 455, 449, 573, 449, 98, 317, - /* 1440 */ 1019, 132, 132, 133, 133, 572, 1561, 572, 974, 409, - /* 1450 */ 6, 1562, 68, 68, 1560, 6, 975, 572, 6, 1559, - /* 1460 */ 1019, 1019, 1021, 6, 346, 218, 101, 531, 53, 53, - /* 1470 */ 69, 69, 1019, 1019, 1021, 1022, 28, 1586, 1181, 451, - /* 1480 */ 70, 70, 290, 87, 215, 31, 1363, 394, 394, 393, - /* 1490 */ 275, 391, 350, 109, 852, 107, 572, 112, 564, 483, - /* 1500 */ 4, 1212, 572, 239, 153, 572, 39, 236, 1299, 325, - /* 1510 */ 112, 564, 1298, 4, 567, 572, 32, 324, 572, 54, - /* 1520 */ 54, 572, 1135, 353, 398, 165, 165, 567, 166, 166, - /* 1530 */ 572, 291, 355, 572, 17, 357, 572, 449, 77, 77, - /* 1540 */ 1313, 55, 55, 1297, 73, 73, 572, 238, 470, 561, - /* 1550 */ 449, 472, 364, 135, 135, 170, 74, 74, 142, 163, - /* 1560 */ 163, 374, 561, 539, 572, 321, 572, 886, 540, 137, - /* 1570 */ 137, 339, 1353, 422, 298, 237, 539, 572, 1031, 572, - /* 1580 */ 340, 538, 101, 369, 110, 110, 162, 131, 131, 164, - /* 1590 */ 164, 1031, 111, 368, 449, 573, 449, 110, 110, 1019, - /* 1600 */ 157, 157, 141, 141, 572, 111, 572, 449, 573, 449, - /* 1610 */ 412, 288, 1019, 572, 882, 318, 563, 572, 219, 572, - /* 1620 */ 241, 1012, 477, 263, 263, 894, 893, 140, 140, 138, - /* 1630 */ 138, 1019, 1019, 1021, 1022, 28, 139, 139, 525, 455, - /* 1640 */ 76, 76, 78, 78, 1019, 1019, 1021, 1022, 28, 1181, - /* 1650 */ 451, 572, 1083, 290, 112, 564, 1575, 4, 394, 394, - /* 1660 */ 393, 275, 391, 572, 1023, 852, 572, 479, 345, 263, - /* 1670 */ 101, 567, 882, 1376, 75, 75, 1421, 501, 236, 260, - /* 1680 */ 325, 112, 564, 359, 4, 101, 43, 43, 324, 49, - /* 1690 */ 49, 901, 902, 161, 449, 101, 977, 978, 567, 1079, - /* 1700 */ 1349, 260, 965, 932, 263, 114, 561, 1095, 517, 1095, - /* 1710 */ 1083, 1094, 865, 1094, 151, 933, 1144, 114, 238, 1361, - /* 1720 */ 558, 449, 1023, 559, 1426, 1278, 170, 1269, 1257, 142, - /* 1730 */ 1601, 1256, 1258, 561, 1594, 1031, 496, 278, 213, 1346, - /* 1740 */ 310, 110, 110, 939, 311, 312, 237, 11, 234, 111, - /* 1750 */ 221, 449, 573, 449, 293, 395, 1019, 1408, 337, 1403, - /* 1760 */ 1396, 338, 1031, 299, 343, 1413, 1412, 481, 110, 110, - /* 1770 */ 506, 402, 225, 1296, 206, 367, 111, 1358, 449, 573, - /* 1780 */ 449, 412, 1359, 1019, 1489, 1488, 318, 563, 1019, 1019, - /* 1790 */ 1021, 1022, 28, 562, 207, 220, 80, 564, 389, 4, - /* 1800 */ 1597, 1357, 552, 1356, 1233, 181, 267, 232, 1536, 1534, - /* 1810 */ 455, 1230, 420, 567, 82, 1019, 1019, 1021, 1022, 28, - /* 1820 */ 86, 217, 85, 1494, 190, 175, 183, 465, 185, 466, - /* 1830 */ 36, 1409, 186, 187, 188, 499, 449, 244, 37, 99, - /* 1840 */ 400, 1415, 1414, 488, 1417, 194, 473, 403, 561, 1483, - /* 1850 */ 248, 92, 1505, 494, 198, 279, 112, 564, 250, 4, - /* 1860 */ 348, 497, 405, 352, 1259, 251, 252, 515, 1316, 434, - /* 1870 */ 1315, 1314, 94, 567, 1307, 886, 1306, 1031, 226, 406, - /* 1880 */ 1611, 1610, 438, 110, 110, 1580, 1286, 524, 439, 308, - /* 1890 */ 266, 111, 1285, 449, 573, 449, 449, 309, 1019, 366, - /* 1900 */ 1284, 1609, 265, 1566, 1565, 442, 372, 1381, 561, 129, - /* 1910 */ 550, 1380, 10, 1470, 383, 106, 316, 551, 100, 35, - /* 1920 */ 534, 575, 212, 1339, 381, 387, 1187, 1338, 274, 276, - /* 1930 */ 1019, 1019, 1021, 1022, 28, 277, 413, 1031, 576, 1254, - /* 1940 */ 388, 1521, 1249, 110, 110, 167, 1522, 168, 148, 1520, - /* 1950 */ 1519, 111, 306, 449, 573, 449, 222, 223, 1019, 839, - /* 1960 */ 169, 79, 450, 214, 414, 233, 320, 145, 1093, 1091, - /* 1970 */ 328, 182, 171, 1212, 918, 184, 240, 336, 243, 1107, - /* 1980 */ 189, 172, 173, 423, 425, 88, 180, 191, 89, 90, - /* 1990 */ 1019, 1019, 1021, 1022, 28, 91, 174, 1110, 245, 1106, - /* 2000 */ 246, 159, 18, 247, 347, 1099, 263, 195, 1227, 493, - /* 2010 */ 249, 196, 38, 854, 498, 368, 253, 360, 897, 197, - /* 2020 */ 502, 93, 19, 20, 507, 884, 363, 510, 95, 307, - /* 2030 */ 160, 96, 518, 97, 1175, 1060, 1146, 40, 21, 227, - /* 2040 */ 176, 1145, 282, 284, 969, 200, 963, 114, 262, 1165, - /* 2050 */ 22, 23, 24, 1161, 1169, 25, 1163, 1150, 34, 26, - /* 2060 */ 1168, 546, 27, 204, 101, 103, 104, 1074, 7, 1061, - /* 2070 */ 1059, 1063, 1116, 1064, 1115, 268, 269, 29, 41, 270, - /* 2080 */ 1024, 866, 113, 30, 568, 392, 1183, 144, 178, 1182, - /* 2090 */ 271, 928, 1245, 1245, 1245, 1245, 1245, 1245, 1245, 1602, + /* 0 */ 576, 128, 125, 232, 1622, 549, 576, 1290, 1281, 576, + /* 10 */ 328, 576, 1300, 212, 576, 128, 125, 232, 578, 412, + /* 20 */ 578, 391, 1542, 51, 51, 523, 405, 1293, 529, 51, + /* 30 */ 51, 983, 51, 51, 81, 81, 1107, 61, 61, 984, + /* 40 */ 1107, 1292, 380, 135, 136, 90, 1228, 1228, 1063, 1066, + /* 50 */ 1053, 1053, 133, 133, 134, 134, 134, 134, 1577, 412, + /* 60 */ 287, 287, 7, 287, 287, 422, 1050, 1050, 1064, 1067, + /* 70 */ 289, 556, 492, 573, 524, 561, 573, 497, 561, 482, + /* 80 */ 530, 262, 229, 135, 136, 90, 1228, 1228, 1063, 1066, + /* 90 */ 1053, 1053, 133, 133, 134, 134, 134, 134, 128, 125, + /* 100 */ 232, 1506, 132, 132, 132, 132, 131, 131, 130, 130, + /* 110 */ 130, 129, 126, 450, 1204, 1255, 1, 1, 582, 2, + /* 120 */ 1259, 1571, 420, 1582, 379, 320, 1174, 153, 1174, 1584, + /* 130 */ 412, 378, 1582, 543, 1341, 330, 111, 570, 570, 570, + /* 140 */ 293, 1054, 132, 132, 132, 132, 131, 131, 130, 130, + /* 150 */ 130, 129, 126, 450, 135, 136, 90, 1228, 1228, 1063, + /* 160 */ 1066, 1053, 1053, 133, 133, 134, 134, 134, 134, 287, + /* 170 */ 287, 1204, 1205, 1204, 255, 287, 287, 510, 507, 506, + /* 180 */ 137, 455, 573, 212, 561, 447, 446, 505, 573, 1616, + /* 190 */ 561, 134, 134, 134, 134, 127, 400, 243, 132, 132, + /* 200 */ 132, 132, 131, 131, 130, 130, 130, 129, 126, 450, + /* 210 */ 282, 471, 345, 132, 132, 132, 132, 131, 131, 130, + /* 220 */ 130, 130, 129, 126, 450, 574, 155, 936, 936, 454, + /* 230 */ 227, 521, 1236, 412, 1236, 134, 134, 134, 134, 132, + /* 240 */ 132, 132, 132, 131, 131, 130, 130, 130, 129, 126, + /* 250 */ 450, 130, 130, 130, 129, 126, 450, 135, 136, 90, + /* 260 */ 1228, 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, + /* 270 */ 134, 134, 128, 125, 232, 450, 576, 412, 397, 1249, + /* 280 */ 180, 92, 93, 132, 132, 132, 132, 131, 131, 130, + /* 290 */ 130, 130, 129, 126, 450, 381, 387, 1204, 383, 81, + /* 300 */ 81, 135, 136, 90, 1228, 1228, 1063, 1066, 1053, 1053, + /* 310 */ 133, 133, 134, 134, 134, 134, 132, 132, 132, 132, + /* 320 */ 131, 131, 130, 130, 130, 129, 126, 450, 131, 131, + /* 330 */ 130, 130, 130, 129, 126, 450, 556, 1204, 302, 319, + /* 340 */ 567, 121, 568, 480, 4, 555, 1149, 1657, 1628, 1657, + /* 350 */ 45, 128, 125, 232, 1204, 1205, 1204, 1250, 571, 1169, + /* 360 */ 132, 132, 132, 132, 131, 131, 130, 130, 130, 129, + /* 370 */ 126, 450, 1169, 287, 287, 1169, 1019, 576, 422, 1019, + /* 380 */ 412, 451, 1602, 582, 2, 1259, 573, 44, 561, 95, + /* 390 */ 320, 110, 153, 565, 1204, 1205, 1204, 522, 522, 1341, + /* 400 */ 81, 81, 7, 44, 135, 136, 90, 1228, 1228, 1063, + /* 410 */ 1066, 1053, 1053, 133, 133, 134, 134, 134, 134, 295, + /* 420 */ 1149, 1658, 1040, 1658, 1204, 1147, 319, 567, 119, 119, + /* 430 */ 343, 466, 331, 343, 287, 287, 120, 556, 451, 577, + /* 440 */ 451, 1169, 1169, 1028, 319, 567, 438, 573, 210, 561, + /* 450 */ 1339, 1451, 546, 531, 1169, 1169, 1598, 1169, 1169, 416, + /* 460 */ 319, 567, 243, 132, 132, 132, 132, 131, 131, 130, + /* 470 */ 130, 130, 129, 126, 450, 1028, 1028, 1030, 1031, 35, + /* 480 */ 44, 1204, 1205, 1204, 472, 287, 287, 1328, 412, 1307, + /* 490 */ 372, 1595, 359, 225, 454, 1204, 195, 1328, 573, 1147, + /* 500 */ 561, 1333, 1333, 274, 576, 1188, 576, 340, 46, 196, + /* 510 */ 537, 217, 135, 136, 90, 1228, 1228, 1063, 1066, 1053, + /* 520 */ 1053, 133, 133, 134, 134, 134, 134, 19, 19, 19, + /* 530 */ 19, 412, 581, 1204, 1259, 511, 1204, 319, 567, 320, + /* 540 */ 944, 153, 425, 491, 430, 943, 1204, 488, 1341, 1450, + /* 550 */ 532, 1277, 1204, 1205, 1204, 135, 136, 90, 1228, 1228, + /* 560 */ 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, 134, + /* 570 */ 575, 132, 132, 132, 132, 131, 131, 130, 130, 130, + /* 580 */ 129, 126, 450, 287, 287, 528, 287, 287, 372, 1595, + /* 590 */ 1204, 1205, 1204, 1204, 1205, 1204, 573, 486, 561, 573, + /* 600 */ 889, 561, 412, 1204, 1205, 1204, 886, 40, 22, 22, + /* 610 */ 220, 243, 525, 1449, 132, 132, 132, 132, 131, 131, + /* 620 */ 130, 130, 130, 129, 126, 450, 135, 136, 90, 1228, + /* 630 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, + /* 640 */ 134, 412, 180, 454, 1204, 879, 255, 287, 287, 510, + /* 650 */ 507, 506, 372, 1595, 1568, 1331, 1331, 576, 889, 505, + /* 660 */ 573, 44, 561, 559, 1207, 135, 136, 90, 1228, 1228, + /* 670 */ 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, 134, + /* 680 */ 81, 81, 422, 576, 377, 132, 132, 132, 132, 131, + /* 690 */ 131, 130, 130, 130, 129, 126, 450, 297, 287, 287, + /* 700 */ 460, 1204, 1205, 1204, 1204, 534, 19, 19, 448, 448, + /* 710 */ 448, 573, 412, 561, 230, 436, 1187, 535, 319, 567, + /* 720 */ 363, 432, 1207, 1435, 132, 132, 132, 132, 131, 131, + /* 730 */ 130, 130, 130, 129, 126, 450, 135, 136, 90, 1228, + /* 740 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, + /* 750 */ 134, 412, 211, 949, 1169, 1041, 1110, 1110, 494, 547, + /* 760 */ 547, 1204, 1205, 1204, 7, 539, 1570, 1169, 376, 576, + /* 770 */ 1169, 5, 1204, 486, 3, 135, 136, 90, 1228, 1228, + /* 780 */ 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, 134, + /* 790 */ 576, 513, 19, 19, 427, 132, 132, 132, 132, 131, + /* 800 */ 131, 130, 130, 130, 129, 126, 450, 305, 1204, 433, + /* 810 */ 225, 1204, 385, 19, 19, 273, 290, 371, 516, 366, + /* 820 */ 515, 260, 412, 538, 1568, 549, 1024, 362, 437, 1204, + /* 830 */ 1205, 1204, 902, 1552, 132, 132, 132, 132, 131, 131, + /* 840 */ 130, 130, 130, 129, 126, 450, 135, 136, 90, 1228, + /* 850 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, + /* 860 */ 134, 412, 1435, 514, 1281, 1204, 1205, 1204, 1204, 1205, + /* 870 */ 1204, 903, 48, 342, 1568, 1568, 1279, 1627, 1568, 911, + /* 880 */ 576, 129, 126, 450, 110, 135, 136, 90, 1228, 1228, + /* 890 */ 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, 134, + /* 900 */ 265, 576, 459, 19, 19, 132, 132, 132, 132, 131, + /* 910 */ 131, 130, 130, 130, 129, 126, 450, 1345, 204, 576, + /* 920 */ 459, 458, 50, 47, 19, 19, 49, 434, 1105, 573, + /* 930 */ 497, 561, 412, 428, 108, 1224, 1569, 1554, 376, 205, + /* 940 */ 550, 550, 81, 81, 132, 132, 132, 132, 131, 131, + /* 950 */ 130, 130, 130, 129, 126, 450, 135, 136, 90, 1228, + /* 960 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, + /* 970 */ 134, 480, 576, 1204, 576, 1541, 412, 1435, 969, 315, + /* 980 */ 1659, 398, 284, 497, 969, 893, 1569, 1569, 376, 376, + /* 990 */ 1569, 461, 376, 1224, 459, 80, 80, 81, 81, 497, + /* 1000 */ 374, 114, 90, 1228, 1228, 1063, 1066, 1053, 1053, 133, + /* 1010 */ 133, 134, 134, 134, 134, 132, 132, 132, 132, 131, + /* 1020 */ 131, 130, 130, 130, 129, 126, 450, 1204, 1505, 576, + /* 1030 */ 1204, 1205, 1204, 1366, 316, 486, 281, 281, 497, 431, + /* 1040 */ 557, 288, 288, 402, 1340, 471, 345, 298, 429, 573, + /* 1050 */ 576, 561, 81, 81, 573, 374, 561, 971, 386, 132, + /* 1060 */ 132, 132, 132, 131, 131, 130, 130, 130, 129, 126, + /* 1070 */ 450, 231, 117, 81, 81, 287, 287, 231, 287, 287, + /* 1080 */ 576, 1511, 576, 1336, 1204, 1205, 1204, 139, 573, 556, + /* 1090 */ 561, 573, 412, 561, 441, 456, 969, 213, 558, 1511, + /* 1100 */ 1513, 1550, 969, 143, 143, 145, 145, 1368, 314, 478, + /* 1110 */ 444, 970, 412, 850, 851, 852, 135, 136, 90, 1228, + /* 1120 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, + /* 1130 */ 134, 357, 412, 397, 1148, 304, 135, 136, 90, 1228, + /* 1140 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, + /* 1150 */ 134, 1575, 323, 6, 862, 7, 135, 124, 90, 1228, + /* 1160 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, + /* 1170 */ 134, 409, 408, 1511, 212, 132, 132, 132, 132, 131, + /* 1180 */ 131, 130, 130, 130, 129, 126, 450, 411, 118, 1204, + /* 1190 */ 116, 10, 352, 265, 355, 132, 132, 132, 132, 131, + /* 1200 */ 131, 130, 130, 130, 129, 126, 450, 576, 324, 306, + /* 1210 */ 576, 306, 1250, 469, 158, 132, 132, 132, 132, 131, + /* 1220 */ 131, 130, 130, 130, 129, 126, 450, 207, 1224, 1126, + /* 1230 */ 65, 65, 470, 66, 66, 412, 447, 446, 882, 531, + /* 1240 */ 335, 258, 257, 256, 1127, 1233, 1204, 1205, 1204, 327, + /* 1250 */ 1235, 874, 159, 576, 16, 480, 1085, 1040, 1234, 1128, + /* 1260 */ 136, 90, 1228, 1228, 1063, 1066, 1053, 1053, 133, 133, + /* 1270 */ 134, 134, 134, 134, 1029, 576, 81, 81, 1028, 1040, + /* 1280 */ 922, 576, 463, 1236, 576, 1236, 1224, 502, 107, 1435, + /* 1290 */ 923, 6, 576, 410, 1498, 882, 1029, 480, 21, 21, + /* 1300 */ 1028, 332, 1380, 334, 53, 53, 497, 81, 81, 874, + /* 1310 */ 1028, 1028, 1030, 445, 259, 19, 19, 533, 132, 132, + /* 1320 */ 132, 132, 131, 131, 130, 130, 130, 129, 126, 450, + /* 1330 */ 551, 301, 1028, 1028, 1030, 107, 532, 545, 121, 568, + /* 1340 */ 1188, 4, 1126, 1576, 449, 576, 462, 7, 1282, 418, + /* 1350 */ 462, 350, 1435, 576, 518, 571, 544, 1127, 121, 568, + /* 1360 */ 442, 4, 1188, 464, 533, 1180, 1223, 9, 67, 67, + /* 1370 */ 487, 576, 1128, 303, 410, 571, 54, 54, 451, 576, + /* 1380 */ 123, 944, 576, 417, 576, 333, 943, 1379, 576, 236, + /* 1390 */ 565, 576, 1574, 564, 68, 68, 7, 576, 451, 362, + /* 1400 */ 419, 182, 69, 69, 541, 70, 70, 71, 71, 540, + /* 1410 */ 565, 72, 72, 484, 55, 55, 473, 1180, 296, 1040, + /* 1420 */ 56, 56, 296, 493, 541, 119, 119, 410, 1573, 542, + /* 1430 */ 569, 418, 7, 120, 1244, 451, 577, 451, 465, 1040, + /* 1440 */ 1028, 576, 1557, 552, 476, 119, 119, 527, 259, 121, + /* 1450 */ 568, 240, 4, 120, 576, 451, 577, 451, 576, 477, + /* 1460 */ 1028, 576, 156, 576, 57, 57, 571, 576, 286, 229, + /* 1470 */ 410, 336, 1028, 1028, 1030, 1031, 35, 59, 59, 219, + /* 1480 */ 983, 60, 60, 220, 73, 73, 74, 74, 984, 451, + /* 1490 */ 75, 75, 1028, 1028, 1030, 1031, 35, 96, 216, 291, + /* 1500 */ 552, 565, 1188, 318, 395, 395, 394, 276, 392, 576, + /* 1510 */ 485, 859, 474, 1311, 410, 541, 576, 417, 1530, 1144, + /* 1520 */ 540, 399, 1188, 292, 237, 1153, 326, 38, 23, 576, + /* 1530 */ 1040, 576, 20, 20, 325, 299, 119, 119, 164, 76, + /* 1540 */ 76, 1529, 121, 568, 120, 4, 451, 577, 451, 203, + /* 1550 */ 576, 1028, 141, 141, 142, 142, 576, 322, 39, 571, + /* 1560 */ 341, 1021, 110, 264, 239, 901, 900, 423, 242, 908, + /* 1570 */ 909, 370, 173, 77, 77, 43, 479, 1310, 264, 62, + /* 1580 */ 62, 369, 451, 1028, 1028, 1030, 1031, 35, 1601, 1192, + /* 1590 */ 453, 1092, 238, 291, 565, 163, 1309, 110, 395, 395, + /* 1600 */ 394, 276, 392, 986, 987, 859, 481, 346, 264, 110, + /* 1610 */ 1032, 489, 576, 1188, 503, 1088, 261, 261, 237, 576, + /* 1620 */ 326, 121, 568, 1040, 4, 347, 1376, 413, 325, 119, + /* 1630 */ 119, 948, 319, 567, 351, 78, 78, 120, 571, 451, + /* 1640 */ 577, 451, 79, 79, 1028, 354, 356, 576, 360, 1092, + /* 1650 */ 110, 576, 974, 942, 264, 123, 457, 358, 239, 576, + /* 1660 */ 519, 451, 939, 1104, 123, 1104, 173, 576, 1032, 43, + /* 1670 */ 63, 63, 1324, 565, 168, 168, 1028, 1028, 1030, 1031, + /* 1680 */ 35, 576, 169, 169, 1308, 872, 238, 157, 1589, 576, + /* 1690 */ 86, 86, 365, 89, 568, 375, 4, 1103, 941, 1103, + /* 1700 */ 123, 576, 1040, 1389, 64, 64, 1188, 1434, 119, 119, + /* 1710 */ 571, 576, 82, 82, 563, 576, 120, 165, 451, 577, + /* 1720 */ 451, 413, 1362, 1028, 144, 144, 319, 567, 576, 1374, + /* 1730 */ 562, 498, 279, 451, 83, 83, 1439, 576, 166, 166, + /* 1740 */ 576, 1289, 554, 576, 1280, 565, 576, 12, 576, 1268, + /* 1750 */ 457, 146, 146, 1267, 576, 1028, 1028, 1030, 1031, 35, + /* 1760 */ 140, 140, 1269, 167, 167, 1609, 160, 160, 1359, 150, + /* 1770 */ 150, 149, 149, 311, 1040, 576, 312, 147, 147, 313, + /* 1780 */ 119, 119, 222, 235, 576, 1188, 396, 576, 120, 576, + /* 1790 */ 451, 577, 451, 1192, 453, 1028, 508, 291, 148, 148, + /* 1800 */ 1421, 1612, 395, 395, 394, 276, 392, 85, 85, 859, + /* 1810 */ 87, 87, 84, 84, 553, 576, 294, 576, 1426, 338, + /* 1820 */ 339, 1425, 237, 300, 326, 1416, 1409, 1028, 1028, 1030, + /* 1830 */ 1031, 35, 325, 344, 403, 483, 226, 1307, 52, 52, + /* 1840 */ 58, 58, 368, 1371, 1502, 566, 1501, 121, 568, 221, + /* 1850 */ 4, 208, 268, 209, 390, 1244, 1549, 1188, 1372, 1370, + /* 1860 */ 1369, 1547, 239, 184, 571, 233, 421, 1241, 95, 218, + /* 1870 */ 173, 1507, 193, 43, 91, 94, 178, 186, 467, 188, + /* 1880 */ 468, 1422, 13, 189, 190, 191, 501, 451, 245, 108, + /* 1890 */ 238, 401, 1428, 1427, 1430, 475, 404, 1496, 197, 565, + /* 1900 */ 14, 490, 249, 101, 1518, 496, 349, 280, 251, 201, + /* 1910 */ 353, 499, 252, 406, 1270, 253, 517, 1327, 1326, 435, + /* 1920 */ 1325, 1318, 103, 893, 1296, 413, 227, 407, 1040, 1626, + /* 1930 */ 319, 567, 1625, 1297, 119, 119, 439, 367, 1317, 1295, + /* 1940 */ 1624, 526, 120, 440, 451, 577, 451, 1594, 309, 1028, + /* 1950 */ 310, 373, 266, 267, 457, 1580, 1579, 443, 138, 1394, + /* 1960 */ 552, 1393, 11, 1483, 384, 115, 317, 1350, 109, 536, + /* 1970 */ 42, 579, 382, 214, 1349, 388, 1198, 389, 275, 277, + /* 1980 */ 278, 1028, 1028, 1030, 1031, 35, 580, 1265, 414, 1260, + /* 1990 */ 170, 415, 183, 1534, 1535, 1533, 171, 154, 307, 1532, + /* 2000 */ 846, 223, 224, 88, 452, 215, 172, 321, 234, 1102, + /* 2010 */ 152, 1188, 1100, 329, 185, 174, 1223, 925, 187, 241, + /* 2020 */ 337, 244, 1116, 192, 175, 176, 424, 426, 97, 194, + /* 2030 */ 98, 99, 100, 177, 1119, 1115, 246, 247, 161, 24, + /* 2040 */ 248, 348, 1238, 264, 1108, 250, 495, 199, 198, 15, + /* 2050 */ 861, 500, 369, 254, 504, 509, 512, 200, 102, 25, + /* 2060 */ 179, 361, 26, 364, 104, 891, 308, 162, 105, 904, + /* 2070 */ 520, 106, 1185, 1069, 1155, 17, 228, 27, 1154, 283, + /* 2080 */ 285, 263, 978, 202, 972, 123, 28, 1175, 29, 30, + /* 2090 */ 1179, 1171, 31, 1173, 1160, 41, 32, 206, 548, 33, + /* 2100 */ 110, 1178, 1083, 8, 112, 1070, 113, 1068, 1072, 34, + /* 2110 */ 1073, 560, 1125, 269, 1124, 270, 36, 18, 1194, 1033, + /* 2120 */ 873, 151, 122, 37, 393, 271, 272, 572, 181, 1193, + /* 2130 */ 1256, 1256, 1256, 935, 1256, 1256, 1256, 1256, 1256, 1256, + /* 2140 */ 1256, 1617, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 193, 193, 193, 274, 275, 276, 193, 274, 275, 276, - /* 10 */ 193, 223, 219, 225, 206, 210, 211, 212, 193, 19, - /* 20 */ 219, 233, 216, 216, 217, 216, 217, 193, 295, 216, - /* 30 */ 217, 31, 193, 216, 217, 193, 228, 213, 230, 39, - /* 40 */ 206, 216, 217, 43, 44, 45, 46, 47, 48, 49, - /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 193, 19, - /* 60 */ 185, 186, 187, 188, 189, 190, 253, 274, 275, 276, - /* 70 */ 195, 193, 197, 193, 261, 274, 275, 276, 253, 204, - /* 80 */ 238, 204, 81, 43, 44, 45, 46, 47, 48, 49, - /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 274, 275, - /* 100 */ 276, 262, 102, 103, 104, 105, 106, 107, 108, 109, - /* 110 */ 110, 111, 112, 113, 239, 240, 239, 240, 210, 211, - /* 120 */ 212, 314, 315, 314, 59, 316, 86, 252, 88, 252, - /* 130 */ 19, 314, 315, 256, 257, 113, 25, 72, 296, 138, - /* 140 */ 139, 266, 102, 103, 104, 105, 106, 107, 108, 109, + /* 0 */ 194, 276, 277, 278, 216, 194, 194, 217, 194, 194, + /* 10 */ 194, 194, 224, 194, 194, 276, 277, 278, 204, 19, + /* 20 */ 206, 202, 297, 217, 218, 205, 207, 217, 205, 217, + /* 30 */ 218, 31, 217, 218, 217, 218, 29, 217, 218, 39, + /* 40 */ 33, 217, 220, 43, 44, 45, 46, 47, 48, 49, + /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 312, 19, + /* 60 */ 240, 241, 316, 240, 241, 194, 46, 47, 48, 49, + /* 70 */ 22, 254, 65, 253, 254, 255, 253, 194, 255, 194, + /* 80 */ 263, 258, 259, 43, 44, 45, 46, 47, 48, 49, + /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 276, 277, + /* 100 */ 278, 285, 102, 103, 104, 105, 106, 107, 108, 109, + /* 110 */ 110, 111, 112, 113, 59, 186, 187, 188, 189, 190, + /* 120 */ 191, 310, 239, 317, 318, 196, 86, 198, 88, 317, + /* 130 */ 19, 319, 317, 318, 205, 264, 25, 211, 212, 213, + /* 140 */ 205, 121, 102, 103, 104, 105, 106, 107, 108, 109, /* 150 */ 110, 111, 112, 113, 43, 44, 45, 46, 47, 48, - /* 160 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 81, - /* 170 */ 292, 59, 292, 298, 108, 109, 110, 111, 112, 113, - /* 180 */ 69, 116, 117, 118, 72, 106, 107, 193, 111, 112, - /* 190 */ 113, 54, 55, 56, 57, 58, 102, 103, 104, 105, - /* 200 */ 106, 107, 108, 109, 110, 111, 112, 113, 120, 25, - /* 210 */ 216, 217, 145, 102, 103, 104, 105, 106, 107, 108, - /* 220 */ 109, 110, 111, 112, 113, 231, 138, 139, 116, 117, - /* 230 */ 118, 164, 153, 19, 155, 54, 55, 56, 57, 102, + /* 160 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 240, + /* 170 */ 241, 116, 117, 118, 119, 240, 241, 122, 123, 124, + /* 180 */ 69, 298, 253, 194, 255, 106, 107, 132, 253, 141, + /* 190 */ 255, 54, 55, 56, 57, 58, 207, 268, 102, 103, + /* 200 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + /* 210 */ 214, 128, 129, 102, 103, 104, 105, 106, 107, 108, + /* 220 */ 109, 110, 111, 112, 113, 134, 25, 136, 137, 300, + /* 230 */ 165, 166, 153, 19, 155, 54, 55, 56, 57, 102, /* 240 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - /* 250 */ 113, 128, 129, 46, 47, 48, 49, 43, 44, 45, + /* 250 */ 113, 108, 109, 110, 111, 112, 113, 43, 44, 45, /* 260 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - /* 270 */ 56, 57, 216, 193, 25, 59, 193, 19, 165, 166, - /* 280 */ 193, 67, 24, 102, 103, 104, 105, 106, 107, 108, - /* 290 */ 109, 110, 111, 112, 113, 73, 216, 217, 59, 216, - /* 300 */ 217, 43, 44, 45, 46, 47, 48, 49, 50, 51, + /* 270 */ 56, 57, 276, 277, 278, 113, 194, 19, 22, 23, + /* 280 */ 194, 67, 24, 102, 103, 104, 105, 106, 107, 108, + /* 290 */ 109, 110, 111, 112, 113, 220, 250, 59, 252, 217, + /* 300 */ 218, 43, 44, 45, 46, 47, 48, 49, 50, 51, /* 310 */ 52, 53, 54, 55, 56, 57, 102, 103, 104, 105, - /* 320 */ 106, 107, 108, 109, 110, 111, 112, 113, 121, 145, - /* 330 */ 59, 193, 116, 117, 118, 119, 273, 204, 122, 123, - /* 340 */ 124, 19, 20, 134, 22, 136, 137, 19, 132, 127, - /* 350 */ 128, 129, 24, 22, 23, 116, 117, 118, 36, 193, + /* 320 */ 106, 107, 108, 109, 110, 111, 112, 113, 106, 107, + /* 330 */ 108, 109, 110, 111, 112, 113, 254, 59, 205, 138, + /* 340 */ 139, 19, 20, 194, 22, 263, 22, 23, 231, 25, + /* 350 */ 72, 276, 277, 278, 116, 117, 118, 101, 36, 76, /* 360 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - /* 370 */ 112, 113, 239, 240, 311, 312, 215, 106, 107, 241, - /* 380 */ 19, 59, 216, 217, 223, 252, 115, 116, 117, 118, - /* 390 */ 151, 120, 26, 71, 193, 308, 309, 193, 149, 128, - /* 400 */ 313, 216, 269, 81, 43, 44, 45, 46, 47, 48, - /* 410 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 253, - /* 420 */ 216, 217, 100, 95, 153, 59, 155, 261, 106, 107, - /* 430 */ 25, 193, 101, 193, 193, 231, 114, 25, 116, 117, - /* 440 */ 118, 113, 304, 121, 193, 204, 59, 119, 120, 121, - /* 450 */ 122, 123, 124, 125, 216, 217, 193, 216, 217, 131, - /* 460 */ 138, 139, 230, 102, 103, 104, 105, 106, 107, 108, + /* 370 */ 112, 113, 89, 240, 241, 92, 73, 194, 194, 73, + /* 380 */ 19, 59, 188, 189, 190, 191, 253, 81, 255, 151, + /* 390 */ 196, 25, 198, 71, 116, 117, 118, 311, 312, 205, + /* 400 */ 217, 218, 316, 81, 43, 44, 45, 46, 47, 48, + /* 410 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 270, + /* 420 */ 22, 23, 100, 25, 59, 101, 138, 139, 106, 107, + /* 430 */ 127, 128, 129, 127, 240, 241, 114, 254, 116, 117, + /* 440 */ 118, 76, 76, 121, 138, 139, 263, 253, 264, 255, + /* 450 */ 205, 275, 87, 19, 89, 89, 194, 92, 92, 199, + /* 460 */ 138, 139, 268, 102, 103, 104, 105, 106, 107, 108, /* 470 */ 109, 110, 111, 112, 113, 153, 154, 155, 156, 157, - /* 480 */ 239, 240, 116, 117, 118, 76, 193, 23, 19, 25, - /* 490 */ 22, 253, 23, 252, 253, 108, 87, 204, 89, 261, - /* 500 */ 198, 92, 261, 116, 117, 118, 193, 306, 307, 216, - /* 510 */ 217, 150, 43, 44, 45, 46, 47, 48, 49, 50, - /* 520 */ 51, 52, 53, 54, 55, 56, 57, 59, 193, 216, - /* 530 */ 217, 19, 239, 240, 283, 23, 106, 107, 108, 109, - /* 540 */ 110, 111, 112, 113, 73, 252, 253, 142, 308, 309, - /* 550 */ 138, 139, 81, 313, 145, 43, 44, 45, 46, 47, + /* 480 */ 81, 116, 117, 118, 129, 240, 241, 224, 19, 226, + /* 490 */ 314, 315, 23, 25, 300, 59, 22, 234, 253, 101, + /* 500 */ 255, 236, 237, 26, 194, 183, 194, 152, 72, 22, + /* 510 */ 145, 150, 43, 44, 45, 46, 47, 48, 49, 50, + /* 520 */ 51, 52, 53, 54, 55, 56, 57, 217, 218, 217, + /* 530 */ 218, 19, 189, 59, 191, 23, 59, 138, 139, 196, + /* 540 */ 135, 198, 232, 283, 232, 140, 59, 287, 205, 275, + /* 550 */ 116, 205, 116, 117, 118, 43, 44, 45, 46, 47, /* 560 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 570 */ 307, 102, 103, 104, 105, 106, 107, 108, 109, 110, - /* 580 */ 111, 112, 113, 281, 116, 117, 118, 285, 23, 193, - /* 590 */ 25, 119, 59, 193, 122, 123, 124, 59, 127, 203, - /* 600 */ 59, 205, 19, 268, 132, 25, 23, 22, 193, 138, - /* 610 */ 139, 249, 204, 251, 102, 103, 104, 105, 106, 107, + /* 570 */ 194, 102, 103, 104, 105, 106, 107, 108, 109, 110, + /* 580 */ 111, 112, 113, 240, 241, 194, 240, 241, 314, 315, + /* 590 */ 116, 117, 118, 116, 117, 118, 253, 194, 255, 253, + /* 600 */ 59, 255, 19, 116, 117, 118, 23, 22, 217, 218, + /* 610 */ 142, 268, 205, 275, 102, 103, 104, 105, 106, 107, /* 620 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46, /* 630 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - /* 640 */ 57, 19, 22, 23, 59, 23, 25, 239, 240, 116, - /* 650 */ 117, 118, 193, 11, 116, 117, 118, 116, 117, 118, - /* 660 */ 252, 269, 22, 193, 15, 43, 44, 45, 46, 47, + /* 640 */ 57, 19, 194, 300, 59, 23, 119, 240, 241, 122, + /* 650 */ 123, 124, 314, 315, 194, 236, 237, 194, 117, 132, + /* 660 */ 253, 81, 255, 205, 59, 43, 44, 45, 46, 47, /* 670 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 680 */ 273, 143, 193, 118, 143, 102, 103, 104, 105, 106, - /* 690 */ 107, 108, 109, 110, 111, 112, 113, 76, 118, 59, - /* 700 */ 241, 116, 117, 118, 304, 216, 217, 292, 143, 60, - /* 710 */ 89, 241, 19, 92, 193, 193, 23, 22, 311, 312, - /* 720 */ 231, 101, 22, 143, 102, 103, 104, 105, 106, 107, + /* 680 */ 217, 218, 194, 194, 194, 102, 103, 104, 105, 106, + /* 690 */ 107, 108, 109, 110, 111, 112, 113, 294, 240, 241, + /* 700 */ 120, 116, 117, 118, 59, 194, 217, 218, 211, 212, + /* 710 */ 213, 253, 19, 255, 194, 19, 23, 254, 138, 139, + /* 720 */ 24, 232, 117, 194, 102, 103, 104, 105, 106, 107, /* 730 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46, /* 740 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - /* 750 */ 57, 19, 193, 193, 59, 23, 116, 117, 118, 59, - /* 760 */ 201, 21, 241, 304, 193, 206, 127, 128, 129, 193, - /* 770 */ 128, 129, 235, 236, 304, 43, 44, 45, 46, 47, + /* 750 */ 57, 19, 264, 108, 76, 23, 127, 128, 129, 311, + /* 760 */ 312, 116, 117, 118, 316, 87, 306, 89, 308, 194, + /* 770 */ 92, 22, 59, 194, 22, 43, 44, 45, 46, 47, /* 780 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 790 */ 22, 193, 216, 217, 193, 102, 103, 104, 105, 106, - /* 800 */ 107, 108, 109, 110, 111, 112, 113, 231, 193, 193, - /* 810 */ 193, 116, 117, 118, 216, 217, 116, 117, 118, 226, - /* 820 */ 80, 193, 19, 235, 236, 304, 23, 211, 212, 231, - /* 830 */ 204, 216, 217, 205, 102, 103, 104, 105, 106, 107, + /* 790 */ 194, 95, 217, 218, 265, 102, 103, 104, 105, 106, + /* 800 */ 107, 108, 109, 110, 111, 112, 113, 232, 59, 113, + /* 810 */ 25, 59, 194, 217, 218, 119, 120, 121, 122, 123, + /* 820 */ 124, 125, 19, 145, 194, 194, 23, 131, 232, 116, + /* 830 */ 117, 118, 35, 194, 102, 103, 104, 105, 106, 107, /* 840 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46, /* 850 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - /* 860 */ 57, 19, 193, 123, 76, 239, 240, 193, 253, 239, - /* 870 */ 240, 239, 240, 244, 106, 107, 193, 89, 252, 193, - /* 880 */ 92, 59, 252, 254, 252, 43, 44, 45, 46, 47, + /* 860 */ 57, 19, 194, 66, 194, 116, 117, 118, 116, 117, + /* 870 */ 118, 74, 242, 294, 194, 194, 206, 23, 194, 25, + /* 880 */ 194, 111, 112, 113, 25, 43, 44, 45, 46, 47, /* 890 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 900 */ 284, 161, 216, 217, 193, 102, 103, 104, 105, 106, - /* 910 */ 107, 108, 109, 110, 111, 112, 113, 231, 193, 244, - /* 920 */ 187, 188, 189, 190, 7, 8, 9, 309, 195, 254, - /* 930 */ 197, 313, 19, 127, 128, 129, 262, 204, 22, 117, - /* 940 */ 24, 216, 217, 273, 102, 103, 104, 105, 106, 107, + /* 900 */ 24, 194, 194, 217, 218, 102, 103, 104, 105, 106, + /* 910 */ 107, 108, 109, 110, 111, 112, 113, 241, 232, 194, + /* 920 */ 212, 213, 242, 242, 217, 218, 242, 130, 11, 253, + /* 930 */ 194, 255, 19, 265, 149, 59, 306, 194, 308, 232, + /* 940 */ 309, 310, 217, 218, 102, 103, 104, 105, 106, 107, /* 950 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46, /* 960 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - /* 970 */ 57, 193, 239, 240, 193, 59, 19, 188, 253, 190, - /* 980 */ 193, 311, 312, 16, 195, 252, 197, 193, 19, 301, - /* 990 */ 302, 135, 193, 204, 216, 217, 140, 216, 217, 266, - /* 1000 */ 204, 159, 45, 46, 47, 48, 49, 50, 51, 52, + /* 970 */ 57, 194, 194, 59, 194, 239, 19, 194, 25, 254, + /* 980 */ 303, 304, 23, 194, 25, 126, 306, 306, 308, 308, + /* 990 */ 306, 271, 308, 117, 286, 217, 218, 217, 218, 194, + /* 1000 */ 194, 159, 45, 46, 47, 48, 49, 50, 51, 52, /* 1010 */ 53, 54, 55, 56, 57, 102, 103, 104, 105, 106, - /* 1020 */ 107, 108, 109, 110, 111, 112, 113, 12, 239, 240, - /* 1030 */ 193, 298, 238, 117, 253, 239, 240, 238, 259, 260, - /* 1040 */ 193, 252, 27, 193, 77, 193, 79, 204, 252, 262, - /* 1050 */ 193, 299, 300, 193, 100, 266, 278, 42, 204, 102, + /* 1020 */ 107, 108, 109, 110, 111, 112, 113, 59, 239, 194, + /* 1030 */ 116, 117, 118, 260, 254, 194, 240, 241, 194, 233, + /* 1040 */ 205, 240, 241, 205, 239, 128, 129, 270, 265, 253, + /* 1050 */ 194, 255, 217, 218, 253, 194, 255, 143, 280, 102, /* 1060 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - /* 1070 */ 113, 117, 159, 216, 217, 121, 216, 217, 63, 193, - /* 1080 */ 193, 193, 239, 240, 115, 116, 193, 298, 73, 240, - /* 1090 */ 238, 231, 19, 239, 240, 252, 22, 24, 211, 212, - /* 1100 */ 263, 252, 216, 217, 216, 217, 252, 153, 154, 155, - /* 1110 */ 253, 193, 19, 144, 213, 268, 43, 44, 45, 46, + /* 1070 */ 113, 118, 159, 217, 218, 240, 241, 118, 240, 241, + /* 1080 */ 194, 194, 194, 239, 116, 117, 118, 22, 253, 254, + /* 1090 */ 255, 253, 19, 255, 233, 194, 143, 24, 263, 212, + /* 1100 */ 213, 194, 143, 217, 218, 217, 218, 261, 262, 271, + /* 1110 */ 254, 143, 19, 7, 8, 9, 43, 44, 45, 46, /* 1120 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - /* 1130 */ 57, 193, 19, 59, 216, 217, 43, 44, 45, 46, + /* 1130 */ 57, 16, 19, 22, 23, 294, 43, 44, 45, 46, /* 1140 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - /* 1150 */ 57, 193, 19, 24, 216, 217, 43, 44, 45, 46, + /* 1150 */ 57, 312, 194, 214, 21, 316, 43, 44, 45, 46, /* 1160 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - /* 1170 */ 57, 284, 193, 208, 209, 102, 103, 104, 105, 106, - /* 1180 */ 107, 108, 109, 110, 111, 112, 113, 286, 59, 193, - /* 1190 */ 232, 117, 291, 193, 193, 102, 103, 104, 105, 106, - /* 1200 */ 107, 108, 109, 110, 111, 112, 113, 193, 204, 22, - /* 1210 */ 23, 193, 25, 66, 193, 102, 103, 104, 105, 106, - /* 1220 */ 107, 108, 109, 110, 111, 112, 113, 193, 193, 193, - /* 1230 */ 216, 217, 85, 193, 238, 19, 16, 216, 217, 238, - /* 1240 */ 193, 94, 193, 239, 240, 231, 117, 268, 35, 116, - /* 1250 */ 216, 217, 216, 217, 22, 23, 252, 25, 208, 209, + /* 1170 */ 57, 106, 107, 286, 194, 102, 103, 104, 105, 106, + /* 1180 */ 107, 108, 109, 110, 111, 112, 113, 207, 158, 59, + /* 1190 */ 160, 22, 77, 24, 79, 102, 103, 104, 105, 106, + /* 1200 */ 107, 108, 109, 110, 111, 112, 113, 194, 194, 229, + /* 1210 */ 194, 231, 101, 80, 22, 102, 103, 104, 105, 106, + /* 1220 */ 107, 108, 109, 110, 111, 112, 113, 288, 59, 12, + /* 1230 */ 217, 218, 293, 217, 218, 19, 106, 107, 59, 19, + /* 1240 */ 16, 127, 128, 129, 27, 115, 116, 117, 118, 194, + /* 1250 */ 120, 59, 22, 194, 24, 194, 123, 100, 128, 42, /* 1260 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - /* 1270 */ 54, 55, 56, 57, 193, 193, 19, 5, 59, 66, - /* 1280 */ 193, 263, 10, 11, 12, 13, 14, 74, 101, 17, - /* 1290 */ 193, 46, 193, 146, 193, 76, 213, 77, 263, 79, - /* 1300 */ 12, 260, 30, 46, 32, 264, 87, 193, 89, 29, - /* 1310 */ 263, 92, 40, 33, 232, 27, 193, 108, 102, 103, + /* 1270 */ 54, 55, 56, 57, 117, 194, 217, 218, 121, 100, + /* 1280 */ 63, 194, 245, 153, 194, 155, 117, 19, 115, 194, + /* 1290 */ 73, 214, 194, 256, 161, 116, 117, 194, 217, 218, + /* 1300 */ 121, 77, 194, 79, 217, 218, 194, 217, 218, 117, + /* 1310 */ 153, 154, 155, 254, 46, 217, 218, 144, 102, 103, /* 1320 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - /* 1330 */ 42, 138, 139, 101, 193, 116, 117, 118, 19, 20, - /* 1340 */ 255, 22, 70, 130, 135, 65, 256, 257, 193, 140, - /* 1350 */ 78, 63, 193, 81, 193, 36, 193, 216, 217, 193, - /* 1360 */ 115, 193, 263, 193, 145, 268, 59, 48, 193, 193, - /* 1370 */ 98, 193, 115, 193, 291, 216, 217, 193, 59, 216, - /* 1380 */ 217, 161, 216, 217, 216, 217, 216, 217, 131, 193, - /* 1390 */ 71, 193, 216, 217, 216, 217, 216, 217, 193, 260, - /* 1400 */ 216, 217, 19, 264, 85, 133, 244, 100, 193, 90, - /* 1410 */ 138, 139, 216, 217, 216, 217, 254, 244, 193, 100, - /* 1420 */ 193, 216, 217, 116, 117, 106, 107, 254, 121, 193, - /* 1430 */ 115, 216, 217, 114, 162, 116, 117, 118, 115, 244, - /* 1440 */ 121, 216, 217, 216, 217, 193, 309, 193, 31, 254, - /* 1450 */ 313, 309, 216, 217, 309, 313, 39, 193, 313, 309, - /* 1460 */ 153, 154, 155, 313, 193, 150, 25, 144, 216, 217, - /* 1470 */ 216, 217, 153, 154, 155, 156, 157, 0, 1, 2, - /* 1480 */ 216, 217, 5, 149, 150, 22, 193, 10, 11, 12, - /* 1490 */ 13, 14, 193, 158, 17, 160, 193, 19, 20, 116, - /* 1500 */ 22, 25, 193, 24, 22, 193, 24, 30, 226, 32, - /* 1510 */ 19, 20, 226, 22, 36, 193, 53, 40, 193, 216, - /* 1520 */ 217, 193, 23, 193, 25, 216, 217, 36, 216, 217, - /* 1530 */ 193, 99, 193, 193, 22, 193, 193, 59, 216, 217, - /* 1540 */ 193, 216, 217, 193, 216, 217, 193, 70, 129, 71, - /* 1550 */ 59, 129, 193, 216, 217, 78, 216, 217, 81, 216, - /* 1560 */ 217, 193, 71, 85, 193, 133, 193, 126, 90, 216, - /* 1570 */ 217, 152, 258, 61, 152, 98, 85, 193, 100, 193, - /* 1580 */ 23, 90, 25, 121, 106, 107, 23, 216, 217, 216, - /* 1590 */ 217, 100, 114, 131, 116, 117, 118, 106, 107, 121, - /* 1600 */ 216, 217, 216, 217, 193, 114, 193, 116, 117, 118, - /* 1610 */ 133, 22, 121, 193, 59, 138, 139, 193, 142, 193, - /* 1620 */ 141, 23, 23, 25, 25, 120, 121, 216, 217, 216, - /* 1630 */ 217, 153, 154, 155, 156, 157, 216, 217, 19, 162, - /* 1640 */ 216, 217, 216, 217, 153, 154, 155, 156, 157, 1, - /* 1650 */ 2, 193, 59, 5, 19, 20, 318, 22, 10, 11, - /* 1660 */ 12, 13, 14, 193, 59, 17, 193, 23, 23, 25, - /* 1670 */ 25, 36, 117, 193, 216, 217, 193, 23, 30, 25, - /* 1680 */ 32, 19, 20, 23, 22, 25, 216, 217, 40, 216, - /* 1690 */ 217, 7, 8, 23, 59, 25, 83, 84, 36, 23, - /* 1700 */ 193, 25, 23, 23, 25, 25, 71, 153, 145, 155, - /* 1710 */ 117, 153, 23, 155, 25, 23, 97, 25, 70, 193, - /* 1720 */ 193, 59, 117, 236, 193, 193, 78, 193, 193, 81, - /* 1730 */ 141, 193, 193, 71, 193, 100, 288, 287, 242, 255, - /* 1740 */ 255, 106, 107, 108, 255, 255, 98, 243, 297, 114, - /* 1750 */ 214, 116, 117, 118, 245, 191, 121, 271, 293, 267, - /* 1760 */ 267, 246, 100, 246, 245, 271, 271, 293, 106, 107, - /* 1770 */ 220, 271, 229, 225, 249, 219, 114, 259, 116, 117, - /* 1780 */ 118, 133, 259, 121, 219, 219, 138, 139, 153, 154, - /* 1790 */ 155, 156, 157, 280, 249, 243, 19, 20, 245, 22, - /* 1800 */ 196, 259, 140, 259, 60, 297, 141, 297, 200, 200, - /* 1810 */ 162, 38, 200, 36, 294, 153, 154, 155, 156, 157, - /* 1820 */ 151, 150, 294, 283, 22, 43, 234, 18, 237, 200, - /* 1830 */ 270, 272, 237, 237, 237, 18, 59, 199, 270, 149, - /* 1840 */ 246, 272, 272, 200, 234, 234, 246, 246, 71, 246, - /* 1850 */ 199, 158, 290, 62, 22, 200, 19, 20, 199, 22, - /* 1860 */ 289, 221, 221, 200, 200, 199, 199, 115, 218, 64, - /* 1870 */ 218, 218, 22, 36, 227, 126, 227, 100, 165, 221, - /* 1880 */ 224, 224, 24, 106, 107, 312, 218, 305, 113, 282, - /* 1890 */ 91, 114, 220, 116, 117, 118, 59, 282, 121, 218, - /* 1900 */ 218, 218, 200, 317, 317, 82, 221, 265, 71, 148, - /* 1910 */ 145, 265, 22, 277, 200, 158, 279, 140, 147, 25, - /* 1920 */ 146, 202, 248, 250, 249, 247, 13, 250, 194, 194, - /* 1930 */ 153, 154, 155, 156, 157, 6, 303, 100, 192, 192, - /* 1940 */ 246, 213, 192, 106, 107, 207, 213, 207, 222, 213, - /* 1950 */ 213, 114, 222, 116, 117, 118, 214, 214, 121, 4, - /* 1960 */ 207, 213, 3, 22, 303, 15, 163, 16, 23, 23, - /* 1970 */ 139, 151, 130, 25, 20, 142, 24, 16, 144, 1, - /* 1980 */ 142, 130, 130, 61, 37, 53, 300, 151, 53, 53, - /* 1990 */ 153, 154, 155, 156, 157, 53, 130, 116, 34, 1, - /* 2000 */ 141, 5, 22, 115, 161, 68, 25, 68, 75, 41, - /* 2010 */ 141, 115, 24, 20, 19, 131, 125, 23, 28, 22, - /* 2020 */ 67, 22, 22, 22, 67, 59, 24, 96, 22, 67, - /* 2030 */ 23, 149, 22, 25, 23, 23, 23, 22, 34, 141, - /* 2040 */ 37, 97, 23, 23, 116, 22, 143, 25, 34, 75, - /* 2050 */ 34, 34, 34, 88, 75, 34, 86, 23, 22, 34, - /* 2060 */ 93, 24, 34, 25, 25, 142, 142, 23, 44, 23, - /* 2070 */ 23, 23, 23, 11, 23, 25, 22, 22, 22, 141, - /* 2080 */ 23, 23, 22, 22, 25, 15, 1, 23, 25, 1, - /* 2090 */ 141, 135, 319, 319, 319, 319, 319, 319, 319, 141, - /* 2100 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2110 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2120 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2130 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2140 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2150 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2160 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2170 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2180 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2190 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2200 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2210 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2220 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2230 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2250 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2260 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2270 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2280 */ 319, 319, 319, 319, 319, + /* 1330 */ 232, 270, 153, 154, 155, 115, 116, 66, 19, 20, + /* 1340 */ 183, 22, 12, 312, 254, 194, 262, 316, 209, 210, + /* 1350 */ 266, 239, 194, 194, 108, 36, 85, 27, 19, 20, + /* 1360 */ 265, 22, 183, 245, 144, 94, 25, 48, 217, 218, + /* 1370 */ 293, 194, 42, 270, 256, 36, 217, 218, 59, 194, + /* 1380 */ 25, 135, 194, 115, 194, 161, 140, 194, 194, 15, + /* 1390 */ 71, 194, 312, 63, 217, 218, 316, 194, 59, 131, + /* 1400 */ 301, 302, 217, 218, 85, 217, 218, 217, 218, 90, + /* 1410 */ 71, 217, 218, 19, 217, 218, 245, 146, 262, 100, + /* 1420 */ 217, 218, 266, 265, 85, 106, 107, 256, 312, 90, + /* 1430 */ 209, 210, 316, 114, 60, 116, 117, 118, 194, 100, + /* 1440 */ 121, 194, 194, 145, 115, 106, 107, 19, 46, 19, + /* 1450 */ 20, 24, 22, 114, 194, 116, 117, 118, 194, 245, + /* 1460 */ 121, 194, 164, 194, 217, 218, 36, 194, 258, 259, + /* 1470 */ 256, 194, 153, 154, 155, 156, 157, 217, 218, 150, + /* 1480 */ 31, 217, 218, 142, 217, 218, 217, 218, 39, 59, + /* 1490 */ 217, 218, 153, 154, 155, 156, 157, 149, 150, 5, + /* 1500 */ 145, 71, 183, 245, 10, 11, 12, 13, 14, 194, + /* 1510 */ 116, 17, 129, 227, 256, 85, 194, 115, 194, 23, + /* 1520 */ 90, 25, 183, 99, 30, 97, 32, 22, 22, 194, + /* 1530 */ 100, 194, 217, 218, 40, 152, 106, 107, 23, 217, + /* 1540 */ 218, 194, 19, 20, 114, 22, 116, 117, 118, 257, + /* 1550 */ 194, 121, 217, 218, 217, 218, 194, 133, 53, 36, + /* 1560 */ 23, 23, 25, 25, 70, 120, 121, 61, 141, 7, + /* 1570 */ 8, 121, 78, 217, 218, 81, 23, 227, 25, 217, + /* 1580 */ 218, 131, 59, 153, 154, 155, 156, 157, 0, 1, + /* 1590 */ 2, 59, 98, 5, 71, 23, 227, 25, 10, 11, + /* 1600 */ 12, 13, 14, 83, 84, 17, 23, 23, 25, 25, + /* 1610 */ 59, 194, 194, 183, 23, 23, 25, 25, 30, 194, + /* 1620 */ 32, 19, 20, 100, 22, 194, 194, 133, 40, 106, + /* 1630 */ 107, 108, 138, 139, 194, 217, 218, 114, 36, 116, + /* 1640 */ 117, 118, 217, 218, 121, 194, 194, 194, 23, 117, + /* 1650 */ 25, 194, 23, 23, 25, 25, 162, 194, 70, 194, + /* 1660 */ 145, 59, 23, 153, 25, 155, 78, 194, 117, 81, + /* 1670 */ 217, 218, 194, 71, 217, 218, 153, 154, 155, 156, + /* 1680 */ 157, 194, 217, 218, 194, 23, 98, 25, 321, 194, + /* 1690 */ 217, 218, 194, 19, 20, 194, 22, 153, 23, 155, + /* 1700 */ 25, 194, 100, 194, 217, 218, 183, 194, 106, 107, + /* 1710 */ 36, 194, 217, 218, 237, 194, 114, 243, 116, 117, + /* 1720 */ 118, 133, 194, 121, 217, 218, 138, 139, 194, 194, + /* 1730 */ 194, 290, 289, 59, 217, 218, 194, 194, 217, 218, + /* 1740 */ 194, 194, 140, 194, 194, 71, 194, 244, 194, 194, + /* 1750 */ 162, 217, 218, 194, 194, 153, 154, 155, 156, 157, + /* 1760 */ 217, 218, 194, 217, 218, 194, 217, 218, 257, 217, + /* 1770 */ 218, 217, 218, 257, 100, 194, 257, 217, 218, 257, + /* 1780 */ 106, 107, 215, 299, 194, 183, 192, 194, 114, 194, + /* 1790 */ 116, 117, 118, 1, 2, 121, 221, 5, 217, 218, + /* 1800 */ 273, 197, 10, 11, 12, 13, 14, 217, 218, 17, + /* 1810 */ 217, 218, 217, 218, 140, 194, 246, 194, 273, 295, + /* 1820 */ 247, 273, 30, 247, 32, 269, 269, 153, 154, 155, + /* 1830 */ 156, 157, 40, 246, 273, 295, 230, 226, 217, 218, + /* 1840 */ 217, 218, 220, 261, 220, 282, 220, 19, 20, 244, + /* 1850 */ 22, 250, 141, 250, 246, 60, 201, 183, 261, 261, + /* 1860 */ 261, 201, 70, 299, 36, 299, 201, 38, 151, 150, + /* 1870 */ 78, 285, 22, 81, 296, 296, 43, 235, 18, 238, + /* 1880 */ 201, 274, 272, 238, 238, 238, 18, 59, 200, 149, + /* 1890 */ 98, 247, 274, 274, 235, 247, 247, 247, 235, 71, + /* 1900 */ 272, 201, 200, 158, 292, 62, 291, 201, 200, 22, + /* 1910 */ 201, 222, 200, 222, 201, 200, 115, 219, 219, 64, + /* 1920 */ 219, 228, 22, 126, 221, 133, 165, 222, 100, 225, + /* 1930 */ 138, 139, 225, 219, 106, 107, 24, 219, 228, 219, + /* 1940 */ 219, 307, 114, 113, 116, 117, 118, 315, 284, 121, + /* 1950 */ 284, 222, 201, 91, 162, 320, 320, 82, 148, 267, + /* 1960 */ 145, 267, 22, 279, 201, 158, 281, 251, 147, 146, + /* 1970 */ 25, 203, 250, 249, 251, 248, 13, 247, 195, 195, + /* 1980 */ 6, 153, 154, 155, 156, 157, 193, 193, 305, 193, + /* 1990 */ 208, 305, 302, 214, 214, 214, 208, 223, 223, 214, + /* 2000 */ 4, 215, 215, 214, 3, 22, 208, 163, 15, 23, + /* 2010 */ 16, 183, 23, 139, 151, 130, 25, 20, 142, 24, + /* 2020 */ 16, 144, 1, 142, 130, 130, 61, 37, 53, 151, + /* 2030 */ 53, 53, 53, 130, 116, 1, 34, 141, 5, 22, + /* 2040 */ 115, 161, 75, 25, 68, 141, 41, 115, 68, 24, + /* 2050 */ 20, 19, 131, 125, 67, 67, 96, 22, 22, 22, + /* 2060 */ 37, 23, 22, 24, 22, 59, 67, 23, 149, 28, + /* 2070 */ 22, 25, 23, 23, 23, 22, 141, 34, 97, 23, + /* 2080 */ 23, 34, 116, 22, 143, 25, 34, 75, 34, 34, + /* 2090 */ 75, 88, 34, 86, 23, 22, 34, 25, 24, 34, + /* 2100 */ 25, 93, 23, 44, 142, 23, 142, 23, 23, 22, + /* 2110 */ 11, 25, 23, 25, 23, 22, 22, 22, 1, 23, + /* 2120 */ 23, 23, 22, 22, 15, 141, 141, 25, 25, 1, + /* 2130 */ 322, 322, 322, 135, 322, 322, 322, 322, 322, 322, + /* 2140 */ 322, 141, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2150 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2160 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2170 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2180 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2190 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2200 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2210 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2220 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2230 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2240 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2250 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2260 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2270 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2280 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2290 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2300 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2310 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2320 */ 322, 322, 322, 322, 322, 322, 322, 322, }; -#define YY_SHIFT_COUNT (578) +#define YY_SHIFT_COUNT (582) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2088) +#define YY_SHIFT_MAX (2128) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 1648, 1477, 1272, 322, 322, 1, 1319, 1478, 1491, 1837, - /* 10 */ 1837, 1837, 471, 0, 0, 214, 1093, 1837, 1837, 1837, - /* 20 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, - /* 30 */ 1837, 271, 271, 1219, 1219, 216, 88, 1, 1, 1, - /* 40 */ 1, 1, 40, 111, 258, 361, 469, 512, 583, 622, - /* 50 */ 693, 732, 803, 842, 913, 1073, 1093, 1093, 1093, 1093, - /* 60 */ 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, - /* 70 */ 1093, 1093, 1093, 1093, 1113, 1093, 1216, 957, 957, 1635, - /* 80 */ 1662, 1777, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, - /* 90 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, - /* 100 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, - /* 110 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, - /* 120 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, - /* 130 */ 1837, 137, 181, 181, 181, 181, 181, 181, 181, 94, - /* 140 */ 430, 66, 65, 112, 366, 533, 533, 740, 1257, 533, - /* 150 */ 533, 79, 79, 533, 412, 412, 412, 77, 412, 123, - /* 160 */ 113, 113, 113, 22, 22, 2100, 2100, 328, 328, 328, - /* 170 */ 239, 468, 468, 468, 468, 1015, 1015, 409, 366, 1187, - /* 180 */ 1232, 533, 533, 533, 533, 533, 533, 533, 533, 533, - /* 190 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533, - /* 200 */ 533, 969, 621, 621, 533, 642, 788, 788, 1133, 1133, - /* 210 */ 822, 822, 67, 1193, 2100, 2100, 2100, 2100, 2100, 2100, - /* 220 */ 2100, 1307, 954, 954, 585, 472, 640, 387, 695, 538, - /* 230 */ 541, 700, 533, 533, 533, 533, 533, 533, 533, 533, - /* 240 */ 533, 533, 222, 533, 533, 533, 533, 533, 533, 533, - /* 250 */ 533, 533, 533, 533, 533, 1213, 1213, 1213, 533, 533, - /* 260 */ 533, 565, 533, 533, 533, 916, 1147, 533, 533, 1288, - /* 270 */ 533, 533, 533, 533, 533, 533, 533, 533, 639, 1280, - /* 280 */ 209, 1129, 1129, 1129, 1129, 580, 209, 209, 1209, 768, - /* 290 */ 917, 649, 1315, 1334, 405, 1334, 1383, 249, 1315, 1315, - /* 300 */ 249, 1315, 405, 1383, 1441, 464, 1245, 1417, 1417, 1417, - /* 310 */ 1323, 1323, 1323, 1323, 184, 184, 1335, 1476, 856, 1482, - /* 320 */ 1744, 1744, 1665, 1665, 1773, 1773, 1665, 1669, 1671, 1802, - /* 330 */ 1782, 1809, 1809, 1809, 1809, 1665, 1817, 1690, 1671, 1671, - /* 340 */ 1690, 1802, 1782, 1690, 1782, 1690, 1665, 1817, 1693, 1791, - /* 350 */ 1665, 1817, 1832, 1665, 1817, 1665, 1817, 1832, 1752, 1752, - /* 360 */ 1752, 1805, 1850, 1850, 1832, 1752, 1749, 1752, 1805, 1752, - /* 370 */ 1752, 1713, 1858, 1775, 1775, 1832, 1665, 1799, 1799, 1823, - /* 380 */ 1823, 1761, 1765, 1890, 1665, 1757, 1761, 1771, 1774, 1690, - /* 390 */ 1894, 1913, 1913, 1929, 1929, 1929, 2100, 2100, 2100, 2100, - /* 400 */ 2100, 2100, 2100, 2100, 2100, 2100, 2100, 2100, 2100, 2100, - /* 410 */ 2100, 207, 1220, 331, 620, 967, 806, 1074, 1499, 1432, - /* 420 */ 1463, 1479, 1419, 1422, 1557, 1512, 1598, 1599, 1644, 1645, - /* 430 */ 1654, 1660, 1555, 1505, 1684, 1462, 1670, 1563, 1619, 1593, - /* 440 */ 1676, 1679, 1613, 1680, 1554, 1558, 1689, 1692, 1605, 1589, - /* 450 */ 1955, 1959, 1941, 1803, 1950, 1951, 1945, 1946, 1831, 1820, - /* 460 */ 1842, 1948, 1948, 1952, 1833, 1954, 1834, 1961, 1978, 1838, - /* 470 */ 1851, 1948, 1852, 1922, 1947, 1948, 1836, 1932, 1935, 1936, - /* 480 */ 1942, 1866, 1881, 1964, 1859, 1998, 1996, 1980, 1888, 1843, - /* 490 */ 1937, 1981, 1939, 1933, 1968, 1869, 1896, 1988, 1993, 1995, - /* 500 */ 1884, 1891, 1997, 1953, 1999, 2000, 1994, 2001, 1957, 1966, - /* 510 */ 2002, 1931, 1990, 2006, 1962, 2003, 2007, 2004, 1882, 2010, - /* 520 */ 2011, 2012, 2008, 2013, 2015, 1944, 1898, 2019, 2020, 1928, - /* 530 */ 2014, 2023, 1903, 2022, 2016, 2017, 2018, 2021, 1965, 1974, - /* 540 */ 1970, 2024, 1979, 1967, 2025, 2034, 2036, 2037, 2038, 2039, - /* 550 */ 2028, 1923, 1924, 2044, 2022, 2046, 2047, 2048, 2049, 2050, - /* 560 */ 2051, 2054, 2062, 2055, 2056, 2057, 2058, 2060, 2061, 2059, - /* 570 */ 1956, 1938, 1949, 1958, 2063, 2064, 2070, 2085, 2088, + /* 0 */ 1792, 1588, 1494, 322, 322, 399, 306, 1319, 1339, 1430, + /* 10 */ 1828, 1828, 1828, 580, 399, 399, 399, 399, 399, 0, + /* 20 */ 0, 214, 1093, 1828, 1828, 1828, 1828, 1828, 1828, 1828, + /* 30 */ 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1130, 1130, + /* 40 */ 365, 365, 55, 278, 436, 713, 713, 201, 201, 201, + /* 50 */ 201, 40, 111, 258, 361, 469, 512, 583, 622, 693, + /* 60 */ 732, 803, 842, 913, 1073, 1093, 1093, 1093, 1093, 1093, + /* 70 */ 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, + /* 80 */ 1093, 1093, 1093, 1113, 1093, 1216, 957, 957, 1523, 1602, + /* 90 */ 1674, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, + /* 100 */ 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, + /* 110 */ 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, + /* 120 */ 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, + /* 130 */ 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, + /* 140 */ 137, 181, 181, 181, 181, 181, 181, 181, 96, 222, + /* 150 */ 143, 477, 713, 1133, 1268, 713, 713, 79, 79, 713, + /* 160 */ 770, 83, 65, 65, 65, 288, 162, 162, 2142, 2142, + /* 170 */ 696, 696, 696, 238, 474, 474, 474, 474, 1217, 1217, + /* 180 */ 678, 477, 324, 398, 713, 713, 713, 713, 713, 713, + /* 190 */ 713, 713, 713, 713, 713, 713, 713, 713, 713, 713, + /* 200 */ 713, 713, 713, 1220, 366, 366, 713, 917, 283, 283, + /* 210 */ 434, 434, 605, 605, 1298, 2142, 2142, 2142, 2142, 2142, + /* 220 */ 2142, 2142, 1179, 1157, 1157, 487, 527, 585, 645, 749, + /* 230 */ 914, 968, 752, 713, 713, 713, 713, 713, 713, 713, + /* 240 */ 713, 713, 713, 303, 713, 713, 713, 713, 713, 713, + /* 250 */ 713, 713, 713, 713, 713, 713, 797, 797, 797, 713, + /* 260 */ 713, 713, 959, 713, 713, 713, 1169, 1271, 713, 713, + /* 270 */ 1330, 713, 713, 713, 713, 713, 713, 713, 713, 629, + /* 280 */ 7, 91, 876, 876, 876, 876, 953, 91, 91, 1246, + /* 290 */ 1065, 1106, 1374, 1329, 1348, 468, 1348, 1394, 785, 1329, + /* 300 */ 1329, 785, 1329, 468, 1394, 859, 854, 1402, 1449, 1449, + /* 310 */ 1449, 1173, 1173, 1173, 1173, 1355, 1355, 1030, 1341, 405, + /* 320 */ 1230, 1795, 1795, 1711, 1711, 1829, 1829, 1711, 1717, 1719, + /* 330 */ 1850, 1833, 1860, 1860, 1860, 1860, 1711, 1868, 1740, 1719, + /* 340 */ 1719, 1740, 1850, 1833, 1740, 1833, 1740, 1711, 1868, 1745, + /* 350 */ 1843, 1711, 1868, 1887, 1711, 1868, 1711, 1868, 1887, 1801, + /* 360 */ 1801, 1801, 1855, 1900, 1900, 1887, 1801, 1797, 1801, 1855, + /* 370 */ 1801, 1801, 1761, 1912, 1830, 1830, 1887, 1711, 1862, 1862, + /* 380 */ 1875, 1875, 1810, 1815, 1940, 1711, 1807, 1810, 1821, 1823, + /* 390 */ 1740, 1945, 1963, 1963, 1974, 1974, 1974, 2142, 2142, 2142, + /* 400 */ 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, + /* 410 */ 2142, 2142, 20, 1224, 256, 1111, 1115, 1114, 1192, 1496, + /* 420 */ 1424, 1505, 1427, 355, 1383, 1537, 1506, 1538, 1553, 1583, + /* 430 */ 1584, 1591, 1625, 541, 1445, 1562, 1450, 1572, 1515, 1428, + /* 440 */ 1532, 1592, 1629, 1520, 1630, 1639, 1510, 1544, 1662, 1675, + /* 450 */ 1551, 48, 1996, 2001, 1983, 1844, 1993, 1994, 1986, 1989, + /* 460 */ 1874, 1863, 1885, 1991, 1991, 1995, 1876, 1997, 1877, 2004, + /* 470 */ 2021, 1881, 1894, 1991, 1895, 1965, 1990, 1991, 1878, 1975, + /* 480 */ 1977, 1978, 1979, 1903, 1918, 2002, 1896, 2034, 2033, 2017, + /* 490 */ 1925, 1880, 1976, 2018, 1980, 1967, 2005, 1904, 1932, 2025, + /* 500 */ 2030, 2032, 1921, 1928, 2035, 1987, 2036, 2037, 2038, 2040, + /* 510 */ 1988, 2006, 2039, 1960, 2041, 2042, 1999, 2023, 2044, 2043, + /* 520 */ 1919, 2048, 2049, 2050, 2046, 2051, 2053, 1981, 1935, 2056, + /* 530 */ 2057, 1966, 2047, 2061, 1941, 2060, 2052, 2054, 2055, 2058, + /* 540 */ 2003, 2012, 2007, 2059, 2015, 2008, 2062, 2071, 2073, 2074, + /* 550 */ 2072, 2075, 2065, 1962, 1964, 2079, 2060, 2082, 2084, 2085, + /* 560 */ 2087, 2086, 2089, 2088, 2091, 2093, 2099, 2094, 2095, 2096, + /* 570 */ 2097, 2100, 2101, 2102, 1998, 1984, 1985, 2000, 2103, 2098, + /* 580 */ 2109, 2117, 2128, }; -#define YY_REDUCE_COUNT (410) -#define YY_REDUCE_MIN (-271) -#define YY_REDUCE_MAX (1753) +#define YY_REDUCE_COUNT (411) +#define YY_REDUCE_MIN (-275) +#define YY_REDUCE_MAX (1798) static const short yy_reduce_ofst[] = { - /* 0 */ -125, 733, 789, 241, 293, -123, -193, -191, -183, -187, - /* 10 */ 166, 238, 133, -207, -199, -267, -176, -6, 204, 489, - /* 20 */ 576, 598, -175, 686, 860, 615, 725, 1014, 778, 781, - /* 30 */ 857, 616, 887, 87, 240, -192, 408, 626, 796, 843, - /* 40 */ 854, 1004, -271, -271, -271, -271, -271, -271, -271, -271, - /* 50 */ -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, - /* 60 */ -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, - /* 70 */ -271, -271, -271, -271, -271, -271, -271, -271, -271, 80, - /* 80 */ 83, 313, 886, 888, 918, 938, 1021, 1034, 1036, 1141, - /* 90 */ 1159, 1163, 1166, 1168, 1170, 1176, 1178, 1180, 1184, 1196, - /* 100 */ 1198, 1205, 1215, 1225, 1227, 1236, 1252, 1254, 1264, 1303, - /* 110 */ 1309, 1312, 1322, 1325, 1328, 1337, 1340, 1343, 1353, 1371, - /* 120 */ 1373, 1384, 1386, 1411, 1413, 1420, 1424, 1426, 1458, 1470, - /* 130 */ 1473, -271, -271, -271, -271, -271, -271, -271, -271, -271, - /* 140 */ -271, -271, 138, 459, 396, -158, 470, 302, -212, 521, - /* 150 */ 201, -195, -92, 559, 630, 632, 630, -271, 632, 901, - /* 160 */ 63, 407, 670, -271, -271, -271, -271, 161, 161, 161, - /* 170 */ 251, 335, 847, 979, 1097, 537, 588, 618, 628, 688, - /* 180 */ 688, -166, -161, 674, 787, 794, 799, 852, 996, -122, - /* 190 */ 837, -120, 1018, 1035, 415, 1047, 1001, 958, 1082, 400, - /* 200 */ 1099, 779, 1137, 1142, 263, 1083, 1145, 1150, 1041, 1139, - /* 210 */ 965, 1050, 362, 849, 752, 629, 675, 1162, 1173, 1090, - /* 220 */ 1195, -194, 56, 185, -135, 232, 522, 560, 571, 601, - /* 230 */ 617, 669, 683, 711, 850, 893, 1000, 1040, 1049, 1081, - /* 240 */ 1087, 1101, 392, 1114, 1123, 1155, 1161, 1175, 1271, 1293, - /* 250 */ 1299, 1330, 1339, 1342, 1347, 593, 1282, 1286, 1350, 1359, - /* 260 */ 1368, 1314, 1480, 1483, 1507, 1085, 1338, 1526, 1527, 1487, - /* 270 */ 1531, 560, 1532, 1534, 1535, 1538, 1539, 1541, 1448, 1450, - /* 280 */ 1496, 1484, 1485, 1489, 1490, 1314, 1496, 1496, 1504, 1536, - /* 290 */ 1564, 1451, 1486, 1492, 1509, 1493, 1465, 1515, 1494, 1495, - /* 300 */ 1517, 1500, 1519, 1474, 1550, 1543, 1548, 1556, 1565, 1566, - /* 310 */ 1518, 1523, 1542, 1544, 1525, 1545, 1513, 1553, 1552, 1604, - /* 320 */ 1508, 1510, 1608, 1609, 1520, 1528, 1612, 1540, 1559, 1560, - /* 330 */ 1592, 1591, 1595, 1596, 1597, 1629, 1638, 1594, 1569, 1570, - /* 340 */ 1600, 1568, 1610, 1601, 1611, 1603, 1643, 1651, 1562, 1571, - /* 350 */ 1655, 1659, 1640, 1663, 1666, 1664, 1667, 1641, 1650, 1652, - /* 360 */ 1653, 1647, 1656, 1657, 1658, 1668, 1672, 1681, 1649, 1682, - /* 370 */ 1683, 1573, 1582, 1607, 1615, 1685, 1702, 1586, 1587, 1642, - /* 380 */ 1646, 1673, 1675, 1636, 1714, 1637, 1677, 1674, 1678, 1694, - /* 390 */ 1719, 1734, 1735, 1746, 1747, 1750, 1633, 1661, 1686, 1738, - /* 400 */ 1728, 1733, 1736, 1737, 1740, 1726, 1730, 1742, 1743, 1748, - /* 410 */ 1753, + /* 0 */ -71, 194, 343, 835, -180, -177, 838, -194, -188, -185, + /* 10 */ -183, 82, 183, -65, 133, 245, 346, 407, 458, -178, + /* 20 */ 75, -275, -4, 310, 312, 489, 575, 596, 463, 686, + /* 30 */ 707, 725, 780, 1098, 856, 778, 1059, 1090, 708, 887, + /* 40 */ 86, 448, 980, 630, 680, 681, 684, 796, 801, 796, + /* 50 */ 801, -261, -261, -261, -261, -261, -261, -261, -261, -261, + /* 60 */ -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, + /* 70 */ -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, + /* 80 */ -261, -261, -261, -261, -261, -261, -261, -261, 391, 886, + /* 90 */ 888, 1013, 1016, 1081, 1087, 1151, 1159, 1177, 1185, 1188, + /* 100 */ 1190, 1194, 1197, 1203, 1247, 1260, 1264, 1267, 1269, 1273, + /* 110 */ 1315, 1322, 1335, 1337, 1356, 1362, 1418, 1425, 1453, 1457, + /* 120 */ 1465, 1473, 1487, 1495, 1507, 1517, 1521, 1534, 1543, 1546, + /* 130 */ 1549, 1552, 1554, 1560, 1581, 1590, 1593, 1595, 1621, 1623, + /* 140 */ -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, + /* 150 */ -261, -186, -117, 260, 263, 460, 631, -74, 497, -181, + /* 160 */ -261, 939, 176, 274, 338, 676, -261, -261, -261, -261, + /* 170 */ -212, -212, -212, -184, 149, 777, 1061, 1103, 265, 419, + /* 180 */ -254, 670, 677, 677, -11, -129, 184, 488, 736, 789, + /* 190 */ 805, 844, 403, 529, 579, 668, 783, 841, 1158, 1112, + /* 200 */ 806, 861, 1095, 846, 839, 1031, -189, 1077, 1080, 1116, + /* 210 */ 1084, 1156, 1139, 1221, 46, 1099, 1037, 1118, 1171, 1214, + /* 220 */ 1210, 1258, -210, -190, -176, -115, 117, 262, 376, 490, + /* 230 */ 511, 520, 618, 639, 743, 901, 907, 958, 1014, 1055, + /* 240 */ 1108, 1193, 1244, 720, 1248, 1277, 1324, 1347, 1417, 1431, + /* 250 */ 1432, 1440, 1451, 1452, 1463, 1478, 1286, 1350, 1369, 1490, + /* 260 */ 1498, 1501, 773, 1509, 1513, 1528, 1292, 1367, 1535, 1536, + /* 270 */ 1477, 1542, 376, 1547, 1550, 1555, 1559, 1568, 1571, 1441, + /* 280 */ 1443, 1474, 1511, 1516, 1519, 1522, 773, 1474, 1474, 1503, + /* 290 */ 1567, 1594, 1484, 1527, 1556, 1570, 1557, 1524, 1573, 1545, + /* 300 */ 1548, 1576, 1561, 1587, 1540, 1575, 1606, 1611, 1622, 1624, + /* 310 */ 1626, 1582, 1597, 1598, 1599, 1601, 1603, 1563, 1608, 1605, + /* 320 */ 1604, 1564, 1566, 1655, 1660, 1578, 1579, 1665, 1586, 1607, + /* 330 */ 1610, 1642, 1641, 1645, 1646, 1647, 1679, 1688, 1644, 1618, + /* 340 */ 1619, 1648, 1628, 1659, 1649, 1663, 1650, 1700, 1702, 1612, + /* 350 */ 1615, 1706, 1708, 1689, 1709, 1712, 1713, 1715, 1691, 1698, + /* 360 */ 1699, 1701, 1693, 1704, 1707, 1705, 1714, 1703, 1718, 1710, + /* 370 */ 1720, 1721, 1632, 1634, 1664, 1666, 1729, 1751, 1635, 1636, + /* 380 */ 1692, 1694, 1716, 1722, 1684, 1763, 1685, 1723, 1724, 1727, + /* 390 */ 1730, 1768, 1783, 1784, 1793, 1794, 1796, 1683, 1686, 1690, + /* 400 */ 1782, 1779, 1780, 1781, 1785, 1788, 1774, 1775, 1786, 1787, + /* 410 */ 1789, 1798, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1648, 1648, 1648, 1478, 1243, 1354, 1243, 1243, 1243, 1478, - /* 10 */ 1478, 1478, 1243, 1384, 1384, 1531, 1276, 1243, 1243, 1243, - /* 20 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1477, 1243, - /* 30 */ 1243, 1243, 1243, 1564, 1564, 1243, 1243, 1243, 1243, 1243, - /* 40 */ 1243, 1243, 1243, 1393, 1243, 1400, 1243, 1243, 1243, 1243, - /* 50 */ 1243, 1479, 1480, 1243, 1243, 1243, 1530, 1532, 1495, 1407, - /* 60 */ 1406, 1405, 1404, 1513, 1372, 1398, 1391, 1395, 1474, 1475, - /* 70 */ 1473, 1626, 1480, 1479, 1243, 1394, 1442, 1458, 1441, 1243, - /* 80 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, - /* 90 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, - /* 100 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, - /* 110 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, - /* 120 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, - /* 130 */ 1243, 1450, 1457, 1456, 1455, 1464, 1454, 1451, 1444, 1443, - /* 140 */ 1445, 1446, 1243, 1243, 1267, 1243, 1243, 1264, 1318, 1243, - /* 150 */ 1243, 1243, 1243, 1243, 1550, 1549, 1243, 1447, 1243, 1276, - /* 160 */ 1435, 1434, 1433, 1461, 1448, 1460, 1459, 1538, 1600, 1599, - /* 170 */ 1496, 1243, 1243, 1243, 1243, 1243, 1243, 1564, 1243, 1243, - /* 180 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, - /* 190 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, - /* 200 */ 1243, 1374, 1564, 1564, 1243, 1276, 1564, 1564, 1375, 1375, - /* 210 */ 1272, 1272, 1378, 1243, 1545, 1345, 1345, 1345, 1345, 1354, - /* 220 */ 1345, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, - /* 230 */ 1243, 1243, 1243, 1243, 1243, 1243, 1535, 1533, 1243, 1243, - /* 240 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, - /* 250 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, - /* 260 */ 1243, 1243, 1243, 1243, 1243, 1350, 1243, 1243, 1243, 1243, - /* 270 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1593, 1243, 1508, - /* 280 */ 1332, 1350, 1350, 1350, 1350, 1352, 1333, 1331, 1344, 1277, - /* 290 */ 1250, 1640, 1410, 1399, 1351, 1399, 1637, 1397, 1410, 1410, - /* 300 */ 1397, 1410, 1351, 1637, 1293, 1615, 1288, 1384, 1384, 1384, - /* 310 */ 1374, 1374, 1374, 1374, 1378, 1378, 1476, 1351, 1344, 1243, - /* 320 */ 1640, 1640, 1360, 1360, 1639, 1639, 1360, 1496, 1623, 1419, - /* 330 */ 1321, 1327, 1327, 1327, 1327, 1360, 1261, 1397, 1623, 1623, - /* 340 */ 1397, 1419, 1321, 1397, 1321, 1397, 1360, 1261, 1512, 1634, - /* 350 */ 1360, 1261, 1486, 1360, 1261, 1360, 1261, 1486, 1319, 1319, - /* 360 */ 1319, 1308, 1243, 1243, 1486, 1319, 1293, 1319, 1308, 1319, - /* 370 */ 1319, 1582, 1243, 1490, 1490, 1486, 1360, 1574, 1574, 1387, - /* 380 */ 1387, 1392, 1378, 1481, 1360, 1243, 1392, 1390, 1388, 1397, - /* 390 */ 1311, 1596, 1596, 1592, 1592, 1592, 1645, 1645, 1545, 1608, - /* 400 */ 1276, 1276, 1276, 1276, 1608, 1295, 1295, 1277, 1277, 1276, - /* 410 */ 1608, 1243, 1243, 1243, 1243, 1243, 1243, 1603, 1243, 1540, - /* 420 */ 1497, 1364, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, - /* 430 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1551, 1243, - /* 440 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1424, - /* 450 */ 1243, 1246, 1542, 1243, 1243, 1243, 1243, 1243, 1243, 1243, - /* 460 */ 1243, 1401, 1402, 1365, 1243, 1243, 1243, 1243, 1243, 1243, - /* 470 */ 1243, 1416, 1243, 1243, 1243, 1411, 1243, 1243, 1243, 1243, - /* 480 */ 1243, 1243, 1243, 1243, 1636, 1243, 1243, 1243, 1243, 1243, - /* 490 */ 1243, 1511, 1510, 1243, 1243, 1362, 1243, 1243, 1243, 1243, - /* 500 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1291, - /* 510 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, - /* 520 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, - /* 530 */ 1243, 1243, 1243, 1389, 1243, 1243, 1243, 1243, 1243, 1243, - /* 540 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1579, 1379, - /* 550 */ 1243, 1243, 1243, 1243, 1627, 1243, 1243, 1243, 1243, 1243, - /* 560 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1619, - /* 570 */ 1335, 1425, 1243, 1428, 1265, 1243, 1255, 1243, 1243, + /* 0 */ 1663, 1663, 1663, 1491, 1254, 1367, 1254, 1254, 1254, 1254, + /* 10 */ 1491, 1491, 1491, 1254, 1254, 1254, 1254, 1254, 1254, 1397, + /* 20 */ 1397, 1544, 1287, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 30 */ 1254, 1254, 1254, 1254, 1254, 1490, 1254, 1254, 1254, 1254, + /* 40 */ 1578, 1578, 1254, 1254, 1254, 1254, 1254, 1563, 1562, 1254, + /* 50 */ 1254, 1254, 1406, 1254, 1413, 1254, 1254, 1254, 1254, 1254, + /* 60 */ 1492, 1493, 1254, 1254, 1254, 1543, 1545, 1508, 1420, 1419, + /* 70 */ 1418, 1417, 1526, 1385, 1411, 1404, 1408, 1487, 1488, 1486, + /* 80 */ 1641, 1493, 1492, 1254, 1407, 1455, 1471, 1454, 1254, 1254, + /* 90 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 100 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 110 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 120 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 130 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 140 */ 1463, 1470, 1469, 1468, 1477, 1467, 1464, 1457, 1456, 1458, + /* 150 */ 1459, 1278, 1254, 1275, 1329, 1254, 1254, 1254, 1254, 1254, + /* 160 */ 1460, 1287, 1448, 1447, 1446, 1254, 1474, 1461, 1473, 1472, + /* 170 */ 1551, 1615, 1614, 1509, 1254, 1254, 1254, 1254, 1254, 1254, + /* 180 */ 1578, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 190 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 200 */ 1254, 1254, 1254, 1387, 1578, 1578, 1254, 1287, 1578, 1578, + /* 210 */ 1388, 1388, 1283, 1283, 1391, 1558, 1358, 1358, 1358, 1358, + /* 220 */ 1367, 1358, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 230 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1548, 1546, 1254, + /* 240 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 250 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 260 */ 1254, 1254, 1254, 1254, 1254, 1254, 1363, 1254, 1254, 1254, + /* 270 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1608, 1254, + /* 280 */ 1521, 1343, 1363, 1363, 1363, 1363, 1365, 1344, 1342, 1357, + /* 290 */ 1288, 1261, 1655, 1423, 1412, 1364, 1412, 1652, 1410, 1423, + /* 300 */ 1423, 1410, 1423, 1364, 1652, 1304, 1630, 1299, 1397, 1397, + /* 310 */ 1397, 1387, 1387, 1387, 1387, 1391, 1391, 1489, 1364, 1357, + /* 320 */ 1254, 1655, 1655, 1373, 1373, 1654, 1654, 1373, 1509, 1638, + /* 330 */ 1432, 1332, 1338, 1338, 1338, 1338, 1373, 1272, 1410, 1638, + /* 340 */ 1638, 1410, 1432, 1332, 1410, 1332, 1410, 1373, 1272, 1525, + /* 350 */ 1649, 1373, 1272, 1499, 1373, 1272, 1373, 1272, 1499, 1330, + /* 360 */ 1330, 1330, 1319, 1254, 1254, 1499, 1330, 1304, 1330, 1319, + /* 370 */ 1330, 1330, 1596, 1254, 1503, 1503, 1499, 1373, 1588, 1588, + /* 380 */ 1400, 1400, 1405, 1391, 1494, 1373, 1254, 1405, 1403, 1401, + /* 390 */ 1410, 1322, 1611, 1611, 1607, 1607, 1607, 1660, 1660, 1558, + /* 400 */ 1623, 1287, 1287, 1287, 1287, 1623, 1306, 1306, 1288, 1288, + /* 410 */ 1287, 1623, 1254, 1254, 1254, 1254, 1254, 1254, 1618, 1254, + /* 420 */ 1553, 1510, 1377, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 430 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1564, + /* 440 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 450 */ 1254, 1437, 1254, 1257, 1555, 1254, 1254, 1254, 1254, 1254, + /* 460 */ 1254, 1254, 1254, 1414, 1415, 1378, 1254, 1254, 1254, 1254, + /* 470 */ 1254, 1254, 1254, 1429, 1254, 1254, 1254, 1424, 1254, 1254, + /* 480 */ 1254, 1254, 1254, 1254, 1254, 1254, 1651, 1254, 1254, 1254, + /* 490 */ 1254, 1254, 1254, 1524, 1523, 1254, 1254, 1375, 1254, 1254, + /* 500 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 510 */ 1254, 1302, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 520 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 530 */ 1254, 1254, 1254, 1254, 1254, 1402, 1254, 1254, 1254, 1254, + /* 540 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 550 */ 1593, 1392, 1254, 1254, 1254, 1254, 1642, 1254, 1254, 1254, + /* 560 */ 1254, 1352, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 570 */ 1254, 1254, 1254, 1634, 1346, 1438, 1254, 1441, 1276, 1254, + /* 580 */ 1266, 1254, 1254, }; /********** End of lemon-generated parsing tables *****************************/ @@ -172302,8 +173893,8 @@ static const YYCODETYPE yyFallback[] = { 0, /* TRUEFALSE => nothing */ 0, /* ISNOT => nothing */ 0, /* FUNCTION => nothing */ - 0, /* UMINUS => nothing */ 0, /* UPLUS => nothing */ + 0, /* UMINUS => nothing */ 0, /* TRUTH => nothing */ 0, /* REGISTER => nothing */ 0, /* VECTOR => nothing */ @@ -172312,6 +173903,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASTERISK => nothing */ 0, /* SPAN => nothing */ 0, /* ERROR => nothing */ + 0, /* QNUMBER => nothing */ 0, /* SPACE => nothing */ 0, /* ILLEGAL => nothing */ }; @@ -172354,14 +173946,9 @@ struct yyParser { #endif sqlite3ParserARG_SDECL /* A place to hold %extra_argument */ sqlite3ParserCTX_SDECL /* A place to hold %extra_context */ -#if YYSTACKDEPTH<=0 - int yystksz; /* Current side of the stack */ - yyStackEntry *yystack; /* The parser's stack */ - yyStackEntry yystk0; /* First stack entry */ -#else - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ - yyStackEntry *yystackEnd; /* Last entry in the stack */ -#endif + yyStackEntry *yystackEnd; /* Last entry in the stack */ + yyStackEntry *yystack; /* The parser stack */ + yyStackEntry yystk0[YYSTACKDEPTH]; /* Initial stack space */ }; typedef struct yyParser yyParser; @@ -172575,8 +174162,8 @@ static const char *const yyTokenName[] = { /* 170 */ "TRUEFALSE", /* 171 */ "ISNOT", /* 172 */ "FUNCTION", - /* 173 */ "UMINUS", - /* 174 */ "UPLUS", + /* 173 */ "UPLUS", + /* 174 */ "UMINUS", /* 175 */ "TRUTH", /* 176 */ "REGISTER", /* 177 */ "VECTOR", @@ -172585,142 +174172,145 @@ static const char *const yyTokenName[] = { /* 180 */ "ASTERISK", /* 181 */ "SPAN", /* 182 */ "ERROR", - /* 183 */ "SPACE", - /* 184 */ "ILLEGAL", - /* 185 */ "input", - /* 186 */ "cmdlist", - /* 187 */ "ecmd", - /* 188 */ "cmdx", - /* 189 */ "explain", - /* 190 */ "cmd", - /* 191 */ "transtype", - /* 192 */ "trans_opt", - /* 193 */ "nm", - /* 194 */ "savepoint_opt", - /* 195 */ "create_table", - /* 196 */ "create_table_args", - /* 197 */ "createkw", - /* 198 */ "temp", - /* 199 */ "ifnotexists", - /* 200 */ "dbnm", - /* 201 */ "columnlist", - /* 202 */ "conslist_opt", - /* 203 */ "table_option_set", - /* 204 */ "select", - /* 205 */ "table_option", - /* 206 */ "columnname", - /* 207 */ "carglist", - /* 208 */ "typetoken", - /* 209 */ "typename", - /* 210 */ "signed", - /* 211 */ "plus_num", - /* 212 */ "minus_num", - /* 213 */ "scanpt", - /* 214 */ "scantok", - /* 215 */ "ccons", - /* 216 */ "term", - /* 217 */ "expr", - /* 218 */ "onconf", - /* 219 */ "sortorder", - /* 220 */ "autoinc", - /* 221 */ "eidlist_opt", - /* 222 */ "refargs", - /* 223 */ "defer_subclause", - /* 224 */ "generated", - /* 225 */ "refarg", - /* 226 */ "refact", - /* 227 */ "init_deferred_pred_opt", - /* 228 */ "conslist", - /* 229 */ "tconscomma", - /* 230 */ "tcons", - /* 231 */ "sortlist", - /* 232 */ "eidlist", - /* 233 */ "defer_subclause_opt", - /* 234 */ "orconf", - /* 235 */ "resolvetype", - /* 236 */ "raisetype", - /* 237 */ "ifexists", - /* 238 */ "fullname", - /* 239 */ "selectnowith", - /* 240 */ "oneselect", - /* 241 */ "wqlist", - /* 242 */ "multiselect_op", - /* 243 */ "distinct", - /* 244 */ "selcollist", - /* 245 */ "from", - /* 246 */ "where_opt", - /* 247 */ "groupby_opt", - /* 248 */ "having_opt", - /* 249 */ "orderby_opt", - /* 250 */ "limit_opt", - /* 251 */ "window_clause", - /* 252 */ "values", - /* 253 */ "nexprlist", - /* 254 */ "sclp", - /* 255 */ "as", - /* 256 */ "seltablist", - /* 257 */ "stl_prefix", - /* 258 */ "joinop", - /* 259 */ "on_using", - /* 260 */ "indexed_by", - /* 261 */ "exprlist", - /* 262 */ "xfullname", - /* 263 */ "idlist", - /* 264 */ "indexed_opt", - /* 265 */ "nulls", - /* 266 */ "with", - /* 267 */ "where_opt_ret", - /* 268 */ "setlist", - /* 269 */ "insert_cmd", - /* 270 */ "idlist_opt", - /* 271 */ "upsert", - /* 272 */ "returning", - /* 273 */ "filter_over", - /* 274 */ "likeop", - /* 275 */ "between_op", - /* 276 */ "in_op", - /* 277 */ "paren_exprlist", - /* 278 */ "case_operand", - /* 279 */ "case_exprlist", - /* 280 */ "case_else", - /* 281 */ "uniqueflag", - /* 282 */ "collate", - /* 283 */ "vinto", - /* 284 */ "nmnum", - /* 285 */ "trigger_decl", - /* 286 */ "trigger_cmd_list", - /* 287 */ "trigger_time", - /* 288 */ "trigger_event", - /* 289 */ "foreach_clause", - /* 290 */ "when_clause", - /* 291 */ "trigger_cmd", - /* 292 */ "trnm", - /* 293 */ "tridxby", - /* 294 */ "database_kw_opt", - /* 295 */ "key_opt", - /* 296 */ "add_column_fullname", - /* 297 */ "kwcolumn_opt", - /* 298 */ "create_vtab", - /* 299 */ "vtabarglist", - /* 300 */ "vtabarg", - /* 301 */ "vtabargtoken", - /* 302 */ "lp", - /* 303 */ "anylist", - /* 304 */ "wqitem", - /* 305 */ "wqas", - /* 306 */ "windowdefn_list", - /* 307 */ "windowdefn", - /* 308 */ "window", - /* 309 */ "frame_opt", - /* 310 */ "part_opt", - /* 311 */ "filter_clause", - /* 312 */ "over_clause", - /* 313 */ "range_or_rows", - /* 314 */ "frame_bound", - /* 315 */ "frame_bound_s", - /* 316 */ "frame_bound_e", - /* 317 */ "frame_exclude_opt", - /* 318 */ "frame_exclude", + /* 183 */ "QNUMBER", + /* 184 */ "SPACE", + /* 185 */ "ILLEGAL", + /* 186 */ "input", + /* 187 */ "cmdlist", + /* 188 */ "ecmd", + /* 189 */ "cmdx", + /* 190 */ "explain", + /* 191 */ "cmd", + /* 192 */ "transtype", + /* 193 */ "trans_opt", + /* 194 */ "nm", + /* 195 */ "savepoint_opt", + /* 196 */ "create_table", + /* 197 */ "create_table_args", + /* 198 */ "createkw", + /* 199 */ "temp", + /* 200 */ "ifnotexists", + /* 201 */ "dbnm", + /* 202 */ "columnlist", + /* 203 */ "conslist_opt", + /* 204 */ "table_option_set", + /* 205 */ "select", + /* 206 */ "table_option", + /* 207 */ "columnname", + /* 208 */ "carglist", + /* 209 */ "typetoken", + /* 210 */ "typename", + /* 211 */ "signed", + /* 212 */ "plus_num", + /* 213 */ "minus_num", + /* 214 */ "scanpt", + /* 215 */ "scantok", + /* 216 */ "ccons", + /* 217 */ "term", + /* 218 */ "expr", + /* 219 */ "onconf", + /* 220 */ "sortorder", + /* 221 */ "autoinc", + /* 222 */ "eidlist_opt", + /* 223 */ "refargs", + /* 224 */ "defer_subclause", + /* 225 */ "generated", + /* 226 */ "refarg", + /* 227 */ "refact", + /* 228 */ "init_deferred_pred_opt", + /* 229 */ "conslist", + /* 230 */ "tconscomma", + /* 231 */ "tcons", + /* 232 */ "sortlist", + /* 233 */ "eidlist", + /* 234 */ "defer_subclause_opt", + /* 235 */ "orconf", + /* 236 */ "resolvetype", + /* 237 */ "raisetype", + /* 238 */ "ifexists", + /* 239 */ "fullname", + /* 240 */ "selectnowith", + /* 241 */ "oneselect", + /* 242 */ "wqlist", + /* 243 */ "multiselect_op", + /* 244 */ "distinct", + /* 245 */ "selcollist", + /* 246 */ "from", + /* 247 */ "where_opt", + /* 248 */ "groupby_opt", + /* 249 */ "having_opt", + /* 250 */ "orderby_opt", + /* 251 */ "limit_opt", + /* 252 */ "window_clause", + /* 253 */ "values", + /* 254 */ "nexprlist", + /* 255 */ "mvalues", + /* 256 */ "sclp", + /* 257 */ "as", + /* 258 */ "seltablist", + /* 259 */ "stl_prefix", + /* 260 */ "joinop", + /* 261 */ "on_using", + /* 262 */ "indexed_by", + /* 263 */ "exprlist", + /* 264 */ "xfullname", + /* 265 */ "idlist", + /* 266 */ "indexed_opt", + /* 267 */ "nulls", + /* 268 */ "with", + /* 269 */ "where_opt_ret", + /* 270 */ "setlist", + /* 271 */ "insert_cmd", + /* 272 */ "idlist_opt", + /* 273 */ "upsert", + /* 274 */ "returning", + /* 275 */ "filter_over", + /* 276 */ "likeop", + /* 277 */ "between_op", + /* 278 */ "in_op", + /* 279 */ "paren_exprlist", + /* 280 */ "case_operand", + /* 281 */ "case_exprlist", + /* 282 */ "case_else", + /* 283 */ "uniqueflag", + /* 284 */ "collate", + /* 285 */ "vinto", + /* 286 */ "nmnum", + /* 287 */ "trigger_decl", + /* 288 */ "trigger_cmd_list", + /* 289 */ "trigger_time", + /* 290 */ "trigger_event", + /* 291 */ "foreach_clause", + /* 292 */ "when_clause", + /* 293 */ "trigger_cmd", + /* 294 */ "trnm", + /* 295 */ "tridxby", + /* 296 */ "database_kw_opt", + /* 297 */ "key_opt", + /* 298 */ "add_column_fullname", + /* 299 */ "kwcolumn_opt", + /* 300 */ "create_vtab", + /* 301 */ "vtabarglist", + /* 302 */ "vtabarg", + /* 303 */ "vtabargtoken", + /* 304 */ "lp", + /* 305 */ "anylist", + /* 306 */ "wqitem", + /* 307 */ "wqas", + /* 308 */ "withnm", + /* 309 */ "windowdefn_list", + /* 310 */ "windowdefn", + /* 311 */ "window", + /* 312 */ "frame_opt", + /* 313 */ "part_opt", + /* 314 */ "filter_clause", + /* 315 */ "over_clause", + /* 316 */ "range_or_rows", + /* 317 */ "frame_bound", + /* 318 */ "frame_bound_s", + /* 319 */ "frame_bound_e", + /* 320 */ "frame_exclude_opt", + /* 321 */ "frame_exclude", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -172823,351 +174413,363 @@ static const char *const yyRuleName[] = { /* 92 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt", /* 93 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt", /* 94 */ "values ::= VALUES LP nexprlist RP", - /* 95 */ "values ::= values COMMA LP nexprlist RP", - /* 96 */ "distinct ::= DISTINCT", - /* 97 */ "distinct ::= ALL", - /* 98 */ "distinct ::=", - /* 99 */ "sclp ::=", - /* 100 */ "selcollist ::= sclp scanpt expr scanpt as", - /* 101 */ "selcollist ::= sclp scanpt STAR", - /* 102 */ "selcollist ::= sclp scanpt nm DOT STAR", - /* 103 */ "as ::= AS nm", - /* 104 */ "as ::=", - /* 105 */ "from ::=", - /* 106 */ "from ::= FROM seltablist", - /* 107 */ "stl_prefix ::= seltablist joinop", - /* 108 */ "stl_prefix ::=", - /* 109 */ "seltablist ::= stl_prefix nm dbnm as on_using", - /* 110 */ "seltablist ::= stl_prefix nm dbnm as indexed_by on_using", - /* 111 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using", - /* 112 */ "seltablist ::= stl_prefix LP select RP as on_using", - /* 113 */ "seltablist ::= stl_prefix LP seltablist RP as on_using", - /* 114 */ "dbnm ::=", - /* 115 */ "dbnm ::= DOT nm", - /* 116 */ "fullname ::= nm", - /* 117 */ "fullname ::= nm DOT nm", - /* 118 */ "xfullname ::= nm", - /* 119 */ "xfullname ::= nm DOT nm", - /* 120 */ "xfullname ::= nm DOT nm AS nm", - /* 121 */ "xfullname ::= nm AS nm", - /* 122 */ "joinop ::= COMMA|JOIN", - /* 123 */ "joinop ::= JOIN_KW JOIN", - /* 124 */ "joinop ::= JOIN_KW nm JOIN", - /* 125 */ "joinop ::= JOIN_KW nm nm JOIN", - /* 126 */ "on_using ::= ON expr", - /* 127 */ "on_using ::= USING LP idlist RP", - /* 128 */ "on_using ::=", - /* 129 */ "indexed_opt ::=", - /* 130 */ "indexed_by ::= INDEXED BY nm", - /* 131 */ "indexed_by ::= NOT INDEXED", - /* 132 */ "orderby_opt ::=", - /* 133 */ "orderby_opt ::= ORDER BY sortlist", - /* 134 */ "sortlist ::= sortlist COMMA expr sortorder nulls", - /* 135 */ "sortlist ::= expr sortorder nulls", - /* 136 */ "sortorder ::= ASC", - /* 137 */ "sortorder ::= DESC", - /* 138 */ "sortorder ::=", - /* 139 */ "nulls ::= NULLS FIRST", - /* 140 */ "nulls ::= NULLS LAST", - /* 141 */ "nulls ::=", - /* 142 */ "groupby_opt ::=", - /* 143 */ "groupby_opt ::= GROUP BY nexprlist", - /* 144 */ "having_opt ::=", - /* 145 */ "having_opt ::= HAVING expr", - /* 146 */ "limit_opt ::=", - /* 147 */ "limit_opt ::= LIMIT expr", - /* 148 */ "limit_opt ::= LIMIT expr OFFSET expr", - /* 149 */ "limit_opt ::= LIMIT expr COMMA expr", - /* 150 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret", - /* 151 */ "where_opt ::=", - /* 152 */ "where_opt ::= WHERE expr", - /* 153 */ "where_opt_ret ::=", - /* 154 */ "where_opt_ret ::= WHERE expr", - /* 155 */ "where_opt_ret ::= RETURNING selcollist", - /* 156 */ "where_opt_ret ::= WHERE expr RETURNING selcollist", - /* 157 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret", - /* 158 */ "setlist ::= setlist COMMA nm EQ expr", - /* 159 */ "setlist ::= setlist COMMA LP idlist RP EQ expr", - /* 160 */ "setlist ::= nm EQ expr", - /* 161 */ "setlist ::= LP idlist RP EQ expr", - /* 162 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert", - /* 163 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning", - /* 164 */ "upsert ::=", - /* 165 */ "upsert ::= RETURNING selcollist", - /* 166 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert", - /* 167 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert", - /* 168 */ "upsert ::= ON CONFLICT DO NOTHING returning", - /* 169 */ "upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning", - /* 170 */ "returning ::= RETURNING selcollist", - /* 171 */ "insert_cmd ::= INSERT orconf", - /* 172 */ "insert_cmd ::= REPLACE", - /* 173 */ "idlist_opt ::=", - /* 174 */ "idlist_opt ::= LP idlist RP", - /* 175 */ "idlist ::= idlist COMMA nm", - /* 176 */ "idlist ::= nm", - /* 177 */ "expr ::= LP expr RP", - /* 178 */ "expr ::= ID|INDEXED|JOIN_KW", - /* 179 */ "expr ::= nm DOT nm", - /* 180 */ "expr ::= nm DOT nm DOT nm", - /* 181 */ "term ::= NULL|FLOAT|BLOB", - /* 182 */ "term ::= STRING", - /* 183 */ "term ::= INTEGER", - /* 184 */ "expr ::= VARIABLE", - /* 185 */ "expr ::= expr COLLATE ID|STRING", - /* 186 */ "expr ::= CAST LP expr AS typetoken RP", - /* 187 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP", - /* 188 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP", - /* 189 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP", - /* 190 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over", - /* 191 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over", - /* 192 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over", - /* 193 */ "term ::= CTIME_KW", - /* 194 */ "expr ::= LP nexprlist COMMA expr RP", - /* 195 */ "expr ::= expr AND expr", - /* 196 */ "expr ::= expr OR expr", - /* 197 */ "expr ::= expr LT|GT|GE|LE expr", - /* 198 */ "expr ::= expr EQ|NE expr", - /* 199 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", - /* 200 */ "expr ::= expr PLUS|MINUS expr", - /* 201 */ "expr ::= expr STAR|SLASH|REM expr", - /* 202 */ "expr ::= expr CONCAT expr", - /* 203 */ "likeop ::= NOT LIKE_KW|MATCH", - /* 204 */ "expr ::= expr likeop expr", - /* 205 */ "expr ::= expr likeop expr ESCAPE expr", - /* 206 */ "expr ::= expr ISNULL|NOTNULL", - /* 207 */ "expr ::= expr NOT NULL", - /* 208 */ "expr ::= expr IS expr", - /* 209 */ "expr ::= expr IS NOT expr", - /* 210 */ "expr ::= expr IS NOT DISTINCT FROM expr", - /* 211 */ "expr ::= expr IS DISTINCT FROM expr", - /* 212 */ "expr ::= NOT expr", - /* 213 */ "expr ::= BITNOT expr", - /* 214 */ "expr ::= PLUS|MINUS expr", - /* 215 */ "expr ::= expr PTR expr", - /* 216 */ "between_op ::= BETWEEN", - /* 217 */ "between_op ::= NOT BETWEEN", - /* 218 */ "expr ::= expr between_op expr AND expr", - /* 219 */ "in_op ::= IN", - /* 220 */ "in_op ::= NOT IN", - /* 221 */ "expr ::= expr in_op LP exprlist RP", - /* 222 */ "expr ::= LP select RP", - /* 223 */ "expr ::= expr in_op LP select RP", - /* 224 */ "expr ::= expr in_op nm dbnm paren_exprlist", - /* 225 */ "expr ::= EXISTS LP select RP", - /* 226 */ "expr ::= CASE case_operand case_exprlist case_else END", - /* 227 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", - /* 228 */ "case_exprlist ::= WHEN expr THEN expr", - /* 229 */ "case_else ::= ELSE expr", - /* 230 */ "case_else ::=", - /* 231 */ "case_operand ::=", - /* 232 */ "exprlist ::=", - /* 233 */ "nexprlist ::= nexprlist COMMA expr", - /* 234 */ "nexprlist ::= expr", - /* 235 */ "paren_exprlist ::=", - /* 236 */ "paren_exprlist ::= LP exprlist RP", - /* 237 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", - /* 238 */ "uniqueflag ::= UNIQUE", - /* 239 */ "uniqueflag ::=", - /* 240 */ "eidlist_opt ::=", - /* 241 */ "eidlist_opt ::= LP eidlist RP", - /* 242 */ "eidlist ::= eidlist COMMA nm collate sortorder", - /* 243 */ "eidlist ::= nm collate sortorder", - /* 244 */ "collate ::=", - /* 245 */ "collate ::= COLLATE ID|STRING", - /* 246 */ "cmd ::= DROP INDEX ifexists fullname", - /* 247 */ "cmd ::= VACUUM vinto", - /* 248 */ "cmd ::= VACUUM nm vinto", - /* 249 */ "vinto ::= INTO expr", - /* 250 */ "vinto ::=", - /* 251 */ "cmd ::= PRAGMA nm dbnm", - /* 252 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", - /* 253 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", - /* 254 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", - /* 255 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", - /* 256 */ "plus_num ::= PLUS INTEGER|FLOAT", - /* 257 */ "minus_num ::= MINUS INTEGER|FLOAT", - /* 258 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", - /* 259 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", - /* 260 */ "trigger_time ::= BEFORE|AFTER", - /* 261 */ "trigger_time ::= INSTEAD OF", - /* 262 */ "trigger_time ::=", - /* 263 */ "trigger_event ::= DELETE|INSERT", - /* 264 */ "trigger_event ::= UPDATE", - /* 265 */ "trigger_event ::= UPDATE OF idlist", - /* 266 */ "when_clause ::=", - /* 267 */ "when_clause ::= WHEN expr", - /* 268 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", - /* 269 */ "trigger_cmd_list ::= trigger_cmd SEMI", - /* 270 */ "trnm ::= nm DOT nm", - /* 271 */ "tridxby ::= INDEXED BY nm", - /* 272 */ "tridxby ::= NOT INDEXED", - /* 273 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt", - /* 274 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt", - /* 275 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt", - /* 276 */ "trigger_cmd ::= scanpt select scanpt", - /* 277 */ "expr ::= RAISE LP IGNORE RP", - /* 278 */ "expr ::= RAISE LP raisetype COMMA nm RP", - /* 279 */ "raisetype ::= ROLLBACK", - /* 280 */ "raisetype ::= ABORT", - /* 281 */ "raisetype ::= FAIL", - /* 282 */ "cmd ::= DROP TRIGGER ifexists fullname", - /* 283 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", - /* 284 */ "cmd ::= DETACH database_kw_opt expr", - /* 285 */ "key_opt ::=", - /* 286 */ "key_opt ::= KEY expr", - /* 287 */ "cmd ::= REINDEX", - /* 288 */ "cmd ::= REINDEX nm dbnm", - /* 289 */ "cmd ::= ANALYZE", - /* 290 */ "cmd ::= ANALYZE nm dbnm", - /* 291 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", - /* 292 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", - /* 293 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm", - /* 294 */ "add_column_fullname ::= fullname", - /* 295 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm", - /* 296 */ "cmd ::= create_vtab", - /* 297 */ "cmd ::= create_vtab LP vtabarglist RP", - /* 298 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", - /* 299 */ "vtabarg ::=", - /* 300 */ "vtabargtoken ::= ANY", - /* 301 */ "vtabargtoken ::= lp anylist RP", - /* 302 */ "lp ::= LP", - /* 303 */ "with ::= WITH wqlist", - /* 304 */ "with ::= WITH RECURSIVE wqlist", - /* 305 */ "wqas ::= AS", - /* 306 */ "wqas ::= AS MATERIALIZED", - /* 307 */ "wqas ::= AS NOT MATERIALIZED", - /* 308 */ "wqitem ::= nm eidlist_opt wqas LP select RP", - /* 309 */ "wqlist ::= wqitem", - /* 310 */ "wqlist ::= wqlist COMMA wqitem", - /* 311 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", - /* 312 */ "windowdefn ::= nm AS LP window RP", - /* 313 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt", - /* 314 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt", - /* 315 */ "window ::= ORDER BY sortlist frame_opt", - /* 316 */ "window ::= nm ORDER BY sortlist frame_opt", - /* 317 */ "window ::= nm frame_opt", - /* 318 */ "frame_opt ::=", - /* 319 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt", - /* 320 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt", - /* 321 */ "range_or_rows ::= RANGE|ROWS|GROUPS", - /* 322 */ "frame_bound_s ::= frame_bound", - /* 323 */ "frame_bound_s ::= UNBOUNDED PRECEDING", - /* 324 */ "frame_bound_e ::= frame_bound", - /* 325 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", - /* 326 */ "frame_bound ::= expr PRECEDING|FOLLOWING", - /* 327 */ "frame_bound ::= CURRENT ROW", - /* 328 */ "frame_exclude_opt ::=", - /* 329 */ "frame_exclude_opt ::= EXCLUDE frame_exclude", - /* 330 */ "frame_exclude ::= NO OTHERS", - /* 331 */ "frame_exclude ::= CURRENT ROW", - /* 332 */ "frame_exclude ::= GROUP|TIES", - /* 333 */ "window_clause ::= WINDOW windowdefn_list", - /* 334 */ "filter_over ::= filter_clause over_clause", - /* 335 */ "filter_over ::= over_clause", - /* 336 */ "filter_over ::= filter_clause", - /* 337 */ "over_clause ::= OVER LP window RP", - /* 338 */ "over_clause ::= OVER nm", - /* 339 */ "filter_clause ::= FILTER LP WHERE expr RP", - /* 340 */ "input ::= cmdlist", - /* 341 */ "cmdlist ::= cmdlist ecmd", - /* 342 */ "cmdlist ::= ecmd", - /* 343 */ "ecmd ::= SEMI", - /* 344 */ "ecmd ::= cmdx SEMI", - /* 345 */ "ecmd ::= explain cmdx SEMI", - /* 346 */ "trans_opt ::=", - /* 347 */ "trans_opt ::= TRANSACTION", - /* 348 */ "trans_opt ::= TRANSACTION nm", - /* 349 */ "savepoint_opt ::= SAVEPOINT", - /* 350 */ "savepoint_opt ::=", - /* 351 */ "cmd ::= create_table create_table_args", - /* 352 */ "table_option_set ::= table_option", - /* 353 */ "columnlist ::= columnlist COMMA columnname carglist", - /* 354 */ "columnlist ::= columnname carglist", - /* 355 */ "nm ::= ID|INDEXED|JOIN_KW", - /* 356 */ "nm ::= STRING", - /* 357 */ "typetoken ::= typename", - /* 358 */ "typename ::= ID|STRING", - /* 359 */ "signed ::= plus_num", - /* 360 */ "signed ::= minus_num", - /* 361 */ "carglist ::= carglist ccons", - /* 362 */ "carglist ::=", - /* 363 */ "ccons ::= NULL onconf", - /* 364 */ "ccons ::= GENERATED ALWAYS AS generated", - /* 365 */ "ccons ::= AS generated", - /* 366 */ "conslist_opt ::= COMMA conslist", - /* 367 */ "conslist ::= conslist tconscomma tcons", - /* 368 */ "conslist ::= tcons", - /* 369 */ "tconscomma ::=", - /* 370 */ "defer_subclause_opt ::= defer_subclause", - /* 371 */ "resolvetype ::= raisetype", - /* 372 */ "selectnowith ::= oneselect", - /* 373 */ "oneselect ::= values", - /* 374 */ "sclp ::= selcollist COMMA", - /* 375 */ "as ::= ID|STRING", - /* 376 */ "indexed_opt ::= indexed_by", - /* 377 */ "returning ::=", - /* 378 */ "expr ::= term", - /* 379 */ "likeop ::= LIKE_KW|MATCH", - /* 380 */ "case_operand ::= expr", - /* 381 */ "exprlist ::= nexprlist", - /* 382 */ "nmnum ::= plus_num", - /* 383 */ "nmnum ::= nm", - /* 384 */ "nmnum ::= ON", - /* 385 */ "nmnum ::= DELETE", - /* 386 */ "nmnum ::= DEFAULT", - /* 387 */ "plus_num ::= INTEGER|FLOAT", - /* 388 */ "foreach_clause ::=", - /* 389 */ "foreach_clause ::= FOR EACH ROW", - /* 390 */ "trnm ::= nm", - /* 391 */ "tridxby ::=", - /* 392 */ "database_kw_opt ::= DATABASE", - /* 393 */ "database_kw_opt ::=", - /* 394 */ "kwcolumn_opt ::=", - /* 395 */ "kwcolumn_opt ::= COLUMNKW", - /* 396 */ "vtabarglist ::= vtabarg", - /* 397 */ "vtabarglist ::= vtabarglist COMMA vtabarg", - /* 398 */ "vtabarg ::= vtabarg vtabargtoken", - /* 399 */ "anylist ::=", - /* 400 */ "anylist ::= anylist LP anylist RP", - /* 401 */ "anylist ::= anylist ANY", - /* 402 */ "with ::=", - /* 403 */ "windowdefn_list ::= windowdefn", - /* 404 */ "window ::= frame_opt", + /* 95 */ "oneselect ::= mvalues", + /* 96 */ "mvalues ::= values COMMA LP nexprlist RP", + /* 97 */ "mvalues ::= mvalues COMMA LP nexprlist RP", + /* 98 */ "distinct ::= DISTINCT", + /* 99 */ "distinct ::= ALL", + /* 100 */ "distinct ::=", + /* 101 */ "sclp ::=", + /* 102 */ "selcollist ::= sclp scanpt expr scanpt as", + /* 103 */ "selcollist ::= sclp scanpt STAR", + /* 104 */ "selcollist ::= sclp scanpt nm DOT STAR", + /* 105 */ "as ::= AS nm", + /* 106 */ "as ::=", + /* 107 */ "from ::=", + /* 108 */ "from ::= FROM seltablist", + /* 109 */ "stl_prefix ::= seltablist joinop", + /* 110 */ "stl_prefix ::=", + /* 111 */ "seltablist ::= stl_prefix nm dbnm as on_using", + /* 112 */ "seltablist ::= stl_prefix nm dbnm as indexed_by on_using", + /* 113 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using", + /* 114 */ "seltablist ::= stl_prefix LP select RP as on_using", + /* 115 */ "seltablist ::= stl_prefix LP seltablist RP as on_using", + /* 116 */ "dbnm ::=", + /* 117 */ "dbnm ::= DOT nm", + /* 118 */ "fullname ::= nm", + /* 119 */ "fullname ::= nm DOT nm", + /* 120 */ "xfullname ::= nm", + /* 121 */ "xfullname ::= nm DOT nm", + /* 122 */ "xfullname ::= nm DOT nm AS nm", + /* 123 */ "xfullname ::= nm AS nm", + /* 124 */ "joinop ::= COMMA|JOIN", + /* 125 */ "joinop ::= JOIN_KW JOIN", + /* 126 */ "joinop ::= JOIN_KW nm JOIN", + /* 127 */ "joinop ::= JOIN_KW nm nm JOIN", + /* 128 */ "on_using ::= ON expr", + /* 129 */ "on_using ::= USING LP idlist RP", + /* 130 */ "on_using ::=", + /* 131 */ "indexed_opt ::=", + /* 132 */ "indexed_by ::= INDEXED BY nm", + /* 133 */ "indexed_by ::= NOT INDEXED", + /* 134 */ "orderby_opt ::=", + /* 135 */ "orderby_opt ::= ORDER BY sortlist", + /* 136 */ "sortlist ::= sortlist COMMA expr sortorder nulls", + /* 137 */ "sortlist ::= expr sortorder nulls", + /* 138 */ "sortorder ::= ASC", + /* 139 */ "sortorder ::= DESC", + /* 140 */ "sortorder ::=", + /* 141 */ "nulls ::= NULLS FIRST", + /* 142 */ "nulls ::= NULLS LAST", + /* 143 */ "nulls ::=", + /* 144 */ "groupby_opt ::=", + /* 145 */ "groupby_opt ::= GROUP BY nexprlist", + /* 146 */ "having_opt ::=", + /* 147 */ "having_opt ::= HAVING expr", + /* 148 */ "limit_opt ::=", + /* 149 */ "limit_opt ::= LIMIT expr", + /* 150 */ "limit_opt ::= LIMIT expr OFFSET expr", + /* 151 */ "limit_opt ::= LIMIT expr COMMA expr", + /* 152 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret", + /* 153 */ "where_opt ::=", + /* 154 */ "where_opt ::= WHERE expr", + /* 155 */ "where_opt_ret ::=", + /* 156 */ "where_opt_ret ::= WHERE expr", + /* 157 */ "where_opt_ret ::= RETURNING selcollist", + /* 158 */ "where_opt_ret ::= WHERE expr RETURNING selcollist", + /* 159 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret", + /* 160 */ "setlist ::= setlist COMMA nm EQ expr", + /* 161 */ "setlist ::= setlist COMMA LP idlist RP EQ expr", + /* 162 */ "setlist ::= nm EQ expr", + /* 163 */ "setlist ::= LP idlist RP EQ expr", + /* 164 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert", + /* 165 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning", + /* 166 */ "upsert ::=", + /* 167 */ "upsert ::= RETURNING selcollist", + /* 168 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert", + /* 169 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert", + /* 170 */ "upsert ::= ON CONFLICT DO NOTHING returning", + /* 171 */ "upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning", + /* 172 */ "returning ::= RETURNING selcollist", + /* 173 */ "insert_cmd ::= INSERT orconf", + /* 174 */ "insert_cmd ::= REPLACE", + /* 175 */ "idlist_opt ::=", + /* 176 */ "idlist_opt ::= LP idlist RP", + /* 177 */ "idlist ::= idlist COMMA nm", + /* 178 */ "idlist ::= nm", + /* 179 */ "expr ::= LP expr RP", + /* 180 */ "expr ::= ID|INDEXED|JOIN_KW", + /* 181 */ "expr ::= nm DOT nm", + /* 182 */ "expr ::= nm DOT nm DOT nm", + /* 183 */ "term ::= NULL|FLOAT|BLOB", + /* 184 */ "term ::= STRING", + /* 185 */ "term ::= INTEGER", + /* 186 */ "expr ::= VARIABLE", + /* 187 */ "expr ::= expr COLLATE ID|STRING", + /* 188 */ "expr ::= CAST LP expr AS typetoken RP", + /* 189 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP", + /* 190 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP", + /* 191 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP", + /* 192 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over", + /* 193 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over", + /* 194 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over", + /* 195 */ "term ::= CTIME_KW", + /* 196 */ "expr ::= LP nexprlist COMMA expr RP", + /* 197 */ "expr ::= expr AND expr", + /* 198 */ "expr ::= expr OR expr", + /* 199 */ "expr ::= expr LT|GT|GE|LE expr", + /* 200 */ "expr ::= expr EQ|NE expr", + /* 201 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", + /* 202 */ "expr ::= expr PLUS|MINUS expr", + /* 203 */ "expr ::= expr STAR|SLASH|REM expr", + /* 204 */ "expr ::= expr CONCAT expr", + /* 205 */ "likeop ::= NOT LIKE_KW|MATCH", + /* 206 */ "expr ::= expr likeop expr", + /* 207 */ "expr ::= expr likeop expr ESCAPE expr", + /* 208 */ "expr ::= expr ISNULL|NOTNULL", + /* 209 */ "expr ::= expr NOT NULL", + /* 210 */ "expr ::= expr IS expr", + /* 211 */ "expr ::= expr IS NOT expr", + /* 212 */ "expr ::= expr IS NOT DISTINCT FROM expr", + /* 213 */ "expr ::= expr IS DISTINCT FROM expr", + /* 214 */ "expr ::= NOT expr", + /* 215 */ "expr ::= BITNOT expr", + /* 216 */ "expr ::= PLUS|MINUS expr", + /* 217 */ "expr ::= expr PTR expr", + /* 218 */ "between_op ::= BETWEEN", + /* 219 */ "between_op ::= NOT BETWEEN", + /* 220 */ "expr ::= expr between_op expr AND expr", + /* 221 */ "in_op ::= IN", + /* 222 */ "in_op ::= NOT IN", + /* 223 */ "expr ::= expr in_op LP exprlist RP", + /* 224 */ "expr ::= LP select RP", + /* 225 */ "expr ::= expr in_op LP select RP", + /* 226 */ "expr ::= expr in_op nm dbnm paren_exprlist", + /* 227 */ "expr ::= EXISTS LP select RP", + /* 228 */ "expr ::= CASE case_operand case_exprlist case_else END", + /* 229 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", + /* 230 */ "case_exprlist ::= WHEN expr THEN expr", + /* 231 */ "case_else ::= ELSE expr", + /* 232 */ "case_else ::=", + /* 233 */ "case_operand ::=", + /* 234 */ "exprlist ::=", + /* 235 */ "nexprlist ::= nexprlist COMMA expr", + /* 236 */ "nexprlist ::= expr", + /* 237 */ "paren_exprlist ::=", + /* 238 */ "paren_exprlist ::= LP exprlist RP", + /* 239 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", + /* 240 */ "uniqueflag ::= UNIQUE", + /* 241 */ "uniqueflag ::=", + /* 242 */ "eidlist_opt ::=", + /* 243 */ "eidlist_opt ::= LP eidlist RP", + /* 244 */ "eidlist ::= eidlist COMMA nm collate sortorder", + /* 245 */ "eidlist ::= nm collate sortorder", + /* 246 */ "collate ::=", + /* 247 */ "collate ::= COLLATE ID|STRING", + /* 248 */ "cmd ::= DROP INDEX ifexists fullname", + /* 249 */ "cmd ::= VACUUM vinto", + /* 250 */ "cmd ::= VACUUM nm vinto", + /* 251 */ "vinto ::= INTO expr", + /* 252 */ "vinto ::=", + /* 253 */ "cmd ::= PRAGMA nm dbnm", + /* 254 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", + /* 255 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", + /* 256 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", + /* 257 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", + /* 258 */ "plus_num ::= PLUS INTEGER|FLOAT", + /* 259 */ "minus_num ::= MINUS INTEGER|FLOAT", + /* 260 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", + /* 261 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", + /* 262 */ "trigger_time ::= BEFORE|AFTER", + /* 263 */ "trigger_time ::= INSTEAD OF", + /* 264 */ "trigger_time ::=", + /* 265 */ "trigger_event ::= DELETE|INSERT", + /* 266 */ "trigger_event ::= UPDATE", + /* 267 */ "trigger_event ::= UPDATE OF idlist", + /* 268 */ "when_clause ::=", + /* 269 */ "when_clause ::= WHEN expr", + /* 270 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", + /* 271 */ "trigger_cmd_list ::= trigger_cmd SEMI", + /* 272 */ "trnm ::= nm DOT nm", + /* 273 */ "tridxby ::= INDEXED BY nm", + /* 274 */ "tridxby ::= NOT INDEXED", + /* 275 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt", + /* 276 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt", + /* 277 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt", + /* 278 */ "trigger_cmd ::= scanpt select scanpt", + /* 279 */ "expr ::= RAISE LP IGNORE RP", + /* 280 */ "expr ::= RAISE LP raisetype COMMA nm RP", + /* 281 */ "raisetype ::= ROLLBACK", + /* 282 */ "raisetype ::= ABORT", + /* 283 */ "raisetype ::= FAIL", + /* 284 */ "cmd ::= DROP TRIGGER ifexists fullname", + /* 285 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", + /* 286 */ "cmd ::= DETACH database_kw_opt expr", + /* 287 */ "key_opt ::=", + /* 288 */ "key_opt ::= KEY expr", + /* 289 */ "cmd ::= REINDEX", + /* 290 */ "cmd ::= REINDEX nm dbnm", + /* 291 */ "cmd ::= ANALYZE", + /* 292 */ "cmd ::= ANALYZE nm dbnm", + /* 293 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", + /* 294 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", + /* 295 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm", + /* 296 */ "add_column_fullname ::= fullname", + /* 297 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm", + /* 298 */ "cmd ::= create_vtab", + /* 299 */ "cmd ::= create_vtab LP vtabarglist RP", + /* 300 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", + /* 301 */ "vtabarg ::=", + /* 302 */ "vtabargtoken ::= ANY", + /* 303 */ "vtabargtoken ::= lp anylist RP", + /* 304 */ "lp ::= LP", + /* 305 */ "with ::= WITH wqlist", + /* 306 */ "with ::= WITH RECURSIVE wqlist", + /* 307 */ "wqas ::= AS", + /* 308 */ "wqas ::= AS MATERIALIZED", + /* 309 */ "wqas ::= AS NOT MATERIALIZED", + /* 310 */ "wqitem ::= withnm eidlist_opt wqas LP select RP", + /* 311 */ "withnm ::= nm", + /* 312 */ "wqlist ::= wqitem", + /* 313 */ "wqlist ::= wqlist COMMA wqitem", + /* 314 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", + /* 315 */ "windowdefn ::= nm AS LP window RP", + /* 316 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt", + /* 317 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt", + /* 318 */ "window ::= ORDER BY sortlist frame_opt", + /* 319 */ "window ::= nm ORDER BY sortlist frame_opt", + /* 320 */ "window ::= nm frame_opt", + /* 321 */ "frame_opt ::=", + /* 322 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt", + /* 323 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt", + /* 324 */ "range_or_rows ::= RANGE|ROWS|GROUPS", + /* 325 */ "frame_bound_s ::= frame_bound", + /* 326 */ "frame_bound_s ::= UNBOUNDED PRECEDING", + /* 327 */ "frame_bound_e ::= frame_bound", + /* 328 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", + /* 329 */ "frame_bound ::= expr PRECEDING|FOLLOWING", + /* 330 */ "frame_bound ::= CURRENT ROW", + /* 331 */ "frame_exclude_opt ::=", + /* 332 */ "frame_exclude_opt ::= EXCLUDE frame_exclude", + /* 333 */ "frame_exclude ::= NO OTHERS", + /* 334 */ "frame_exclude ::= CURRENT ROW", + /* 335 */ "frame_exclude ::= GROUP|TIES", + /* 336 */ "window_clause ::= WINDOW windowdefn_list", + /* 337 */ "filter_over ::= filter_clause over_clause", + /* 338 */ "filter_over ::= over_clause", + /* 339 */ "filter_over ::= filter_clause", + /* 340 */ "over_clause ::= OVER LP window RP", + /* 341 */ "over_clause ::= OVER nm", + /* 342 */ "filter_clause ::= FILTER LP WHERE expr RP", + /* 343 */ "term ::= QNUMBER", + /* 344 */ "input ::= cmdlist", + /* 345 */ "cmdlist ::= cmdlist ecmd", + /* 346 */ "cmdlist ::= ecmd", + /* 347 */ "ecmd ::= SEMI", + /* 348 */ "ecmd ::= cmdx SEMI", + /* 349 */ "ecmd ::= explain cmdx SEMI", + /* 350 */ "trans_opt ::=", + /* 351 */ "trans_opt ::= TRANSACTION", + /* 352 */ "trans_opt ::= TRANSACTION nm", + /* 353 */ "savepoint_opt ::= SAVEPOINT", + /* 354 */ "savepoint_opt ::=", + /* 355 */ "cmd ::= create_table create_table_args", + /* 356 */ "table_option_set ::= table_option", + /* 357 */ "columnlist ::= columnlist COMMA columnname carglist", + /* 358 */ "columnlist ::= columnname carglist", + /* 359 */ "nm ::= ID|INDEXED|JOIN_KW", + /* 360 */ "nm ::= STRING", + /* 361 */ "typetoken ::= typename", + /* 362 */ "typename ::= ID|STRING", + /* 363 */ "signed ::= plus_num", + /* 364 */ "signed ::= minus_num", + /* 365 */ "carglist ::= carglist ccons", + /* 366 */ "carglist ::=", + /* 367 */ "ccons ::= NULL onconf", + /* 368 */ "ccons ::= GENERATED ALWAYS AS generated", + /* 369 */ "ccons ::= AS generated", + /* 370 */ "conslist_opt ::= COMMA conslist", + /* 371 */ "conslist ::= conslist tconscomma tcons", + /* 372 */ "conslist ::= tcons", + /* 373 */ "tconscomma ::=", + /* 374 */ "defer_subclause_opt ::= defer_subclause", + /* 375 */ "resolvetype ::= raisetype", + /* 376 */ "selectnowith ::= oneselect", + /* 377 */ "oneselect ::= values", + /* 378 */ "sclp ::= selcollist COMMA", + /* 379 */ "as ::= ID|STRING", + /* 380 */ "indexed_opt ::= indexed_by", + /* 381 */ "returning ::=", + /* 382 */ "expr ::= term", + /* 383 */ "likeop ::= LIKE_KW|MATCH", + /* 384 */ "case_operand ::= expr", + /* 385 */ "exprlist ::= nexprlist", + /* 386 */ "nmnum ::= plus_num", + /* 387 */ "nmnum ::= nm", + /* 388 */ "nmnum ::= ON", + /* 389 */ "nmnum ::= DELETE", + /* 390 */ "nmnum ::= DEFAULT", + /* 391 */ "plus_num ::= INTEGER|FLOAT", + /* 392 */ "foreach_clause ::=", + /* 393 */ "foreach_clause ::= FOR EACH ROW", + /* 394 */ "trnm ::= nm", + /* 395 */ "tridxby ::=", + /* 396 */ "database_kw_opt ::= DATABASE", + /* 397 */ "database_kw_opt ::=", + /* 398 */ "kwcolumn_opt ::=", + /* 399 */ "kwcolumn_opt ::= COLUMNKW", + /* 400 */ "vtabarglist ::= vtabarg", + /* 401 */ "vtabarglist ::= vtabarglist COMMA vtabarg", + /* 402 */ "vtabarg ::= vtabarg vtabargtoken", + /* 403 */ "anylist ::=", + /* 404 */ "anylist ::= anylist LP anylist RP", + /* 405 */ "anylist ::= anylist ANY", + /* 406 */ "with ::=", + /* 407 */ "windowdefn_list ::= windowdefn", + /* 408 */ "window ::= frame_opt", }; #endif /* NDEBUG */ -#if YYSTACKDEPTH<=0 +#if YYGROWABLESTACK /* ** Try to increase the size of the parser stack. Return the number ** of errors. Return 0 on success. */ static int yyGrowStack(yyParser *p){ + int oldSize = 1 + (int)(p->yystackEnd - p->yystack); int newSize; int idx; yyStackEntry *pNew; - newSize = p->yystksz*2 + 100; - idx = p->yytos ? (int)(p->yytos - p->yystack) : 0; - if( p->yystack==&p->yystk0 ){ - pNew = malloc(newSize*sizeof(pNew[0])); - if( pNew ) pNew[0] = p->yystk0; + newSize = oldSize*2 + 100; + idx = (int)(p->yytos - p->yystack); + if( p->yystack==p->yystk0 ){ + pNew = YYREALLOC(0, newSize*sizeof(pNew[0])); + if( pNew==0 ) return 1; + memcpy(pNew, p->yystack, oldSize*sizeof(pNew[0])); }else{ - pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); + pNew = YYREALLOC(p->yystack, newSize*sizeof(pNew[0])); + if( pNew==0 ) return 1; } - if( pNew ){ - p->yystack = pNew; - p->yytos = &p->yystack[idx]; + p->yystack = pNew; + p->yytos = &p->yystack[idx]; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", - yyTracePrompt, p->yystksz, newSize); - } -#endif - p->yystksz = newSize; + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", + yyTracePrompt, oldSize, newSize); } - return pNew==0; +#endif + p->yystackEnd = &p->yystack[newSize-1]; + return 0; } +#endif /* YYGROWABLESTACK */ + +#if !YYGROWABLESTACK +/* For builds that do no have a growable stack, yyGrowStack always +** returns an error. +*/ +# define yyGrowStack(X) 1 #endif /* Datatype of the argument to the memory allocated passed as the @@ -173187,24 +174789,14 @@ SQLITE_PRIVATE void sqlite3ParserInit(void *yypRawParser sqlite3ParserCTX_PDECL) #ifdef YYTRACKMAXSTACKDEPTH yypParser->yyhwm = 0; #endif -#if YYSTACKDEPTH<=0 - yypParser->yytos = NULL; - yypParser->yystack = NULL; - yypParser->yystksz = 0; - if( yyGrowStack(yypParser) ){ - yypParser->yystack = &yypParser->yystk0; - yypParser->yystksz = 1; - } -#endif + yypParser->yystack = yypParser->yystk0; + yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt = -1; #endif yypParser->yytos = yypParser->yystack; yypParser->yystack[0].stateno = 0; yypParser->yystack[0].major = 0; -#if YYSTACKDEPTH>0 - yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; -#endif } #ifndef sqlite3Parser_ENGINEALWAYSONSTACK @@ -173258,97 +174850,98 @@ static void yy_destructor( ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case 204: /* select */ - case 239: /* selectnowith */ - case 240: /* oneselect */ - case 252: /* values */ + case 205: /* select */ + case 240: /* selectnowith */ + case 241: /* oneselect */ + case 253: /* values */ + case 255: /* mvalues */ { -sqlite3SelectDelete(pParse->db, (yypminor->yy47)); +sqlite3SelectDelete(pParse->db, (yypminor->yy555)); } break; - case 216: /* term */ - case 217: /* expr */ - case 246: /* where_opt */ - case 248: /* having_opt */ - case 267: /* where_opt_ret */ - case 278: /* case_operand */ - case 280: /* case_else */ - case 283: /* vinto */ - case 290: /* when_clause */ - case 295: /* key_opt */ - case 311: /* filter_clause */ + case 217: /* term */ + case 218: /* expr */ + case 247: /* where_opt */ + case 249: /* having_opt */ + case 269: /* where_opt_ret */ + case 280: /* case_operand */ + case 282: /* case_else */ + case 285: /* vinto */ + case 292: /* when_clause */ + case 297: /* key_opt */ + case 314: /* filter_clause */ { -sqlite3ExprDelete(pParse->db, (yypminor->yy528)); +sqlite3ExprDelete(pParse->db, (yypminor->yy454)); } break; - case 221: /* eidlist_opt */ - case 231: /* sortlist */ - case 232: /* eidlist */ - case 244: /* selcollist */ - case 247: /* groupby_opt */ - case 249: /* orderby_opt */ - case 253: /* nexprlist */ - case 254: /* sclp */ - case 261: /* exprlist */ - case 268: /* setlist */ - case 277: /* paren_exprlist */ - case 279: /* case_exprlist */ - case 310: /* part_opt */ + case 222: /* eidlist_opt */ + case 232: /* sortlist */ + case 233: /* eidlist */ + case 245: /* selcollist */ + case 248: /* groupby_opt */ + case 250: /* orderby_opt */ + case 254: /* nexprlist */ + case 256: /* sclp */ + case 263: /* exprlist */ + case 270: /* setlist */ + case 279: /* paren_exprlist */ + case 281: /* case_exprlist */ + case 313: /* part_opt */ { -sqlite3ExprListDelete(pParse->db, (yypminor->yy322)); +sqlite3ExprListDelete(pParse->db, (yypminor->yy14)); } break; - case 238: /* fullname */ - case 245: /* from */ - case 256: /* seltablist */ - case 257: /* stl_prefix */ - case 262: /* xfullname */ + case 239: /* fullname */ + case 246: /* from */ + case 258: /* seltablist */ + case 259: /* stl_prefix */ + case 264: /* xfullname */ { -sqlite3SrcListDelete(pParse->db, (yypminor->yy131)); +sqlite3SrcListDelete(pParse->db, (yypminor->yy203)); } break; - case 241: /* wqlist */ + case 242: /* wqlist */ { -sqlite3WithDelete(pParse->db, (yypminor->yy521)); +sqlite3WithDelete(pParse->db, (yypminor->yy59)); } break; - case 251: /* window_clause */ - case 306: /* windowdefn_list */ + case 252: /* window_clause */ + case 309: /* windowdefn_list */ { -sqlite3WindowListDelete(pParse->db, (yypminor->yy41)); +sqlite3WindowListDelete(pParse->db, (yypminor->yy211)); } break; - case 263: /* idlist */ - case 270: /* idlist_opt */ + case 265: /* idlist */ + case 272: /* idlist_opt */ { -sqlite3IdListDelete(pParse->db, (yypminor->yy254)); +sqlite3IdListDelete(pParse->db, (yypminor->yy132)); } break; - case 273: /* filter_over */ - case 307: /* windowdefn */ - case 308: /* window */ - case 309: /* frame_opt */ - case 312: /* over_clause */ + case 275: /* filter_over */ + case 310: /* windowdefn */ + case 311: /* window */ + case 312: /* frame_opt */ + case 315: /* over_clause */ { -sqlite3WindowDelete(pParse->db, (yypminor->yy41)); +sqlite3WindowDelete(pParse->db, (yypminor->yy211)); } break; - case 286: /* trigger_cmd_list */ - case 291: /* trigger_cmd */ + case 288: /* trigger_cmd_list */ + case 293: /* trigger_cmd */ { -sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy33)); +sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy427)); } break; - case 288: /* trigger_event */ + case 290: /* trigger_event */ { -sqlite3IdListDelete(pParse->db, (yypminor->yy180).b); +sqlite3IdListDelete(pParse->db, (yypminor->yy286).b); } break; - case 314: /* frame_bound */ - case 315: /* frame_bound_s */ - case 316: /* frame_bound_e */ + case 317: /* frame_bound */ + case 318: /* frame_bound_s */ + case 319: /* frame_bound_e */ { -sqlite3ExprDelete(pParse->db, (yypminor->yy595).pExpr); +sqlite3ExprDelete(pParse->db, (yypminor->yy509).pExpr); } break; /********* End destructor definitions *****************************************/ @@ -173382,9 +174975,26 @@ static void yy_pop_parser_stack(yyParser *pParser){ */ SQLITE_PRIVATE void sqlite3ParserFinalize(void *p){ yyParser *pParser = (yyParser*)p; - while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser); -#if YYSTACKDEPTH<=0 - if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack); + + /* In-lined version of calling yy_pop_parser_stack() for each + ** element left in the stack */ + yyStackEntry *yytos = pParser->yytos; + while( yytos>pParser->yystack ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sPopping %s\n", + yyTracePrompt, + yyTokenName[yytos->major]); + } +#endif + if( yytos->major>=YY_MIN_DSTRCTR ){ + yy_destructor(pParser, yytos->major, &yytos->minor); + } + yytos--; + } + +#if YYGROWABLESTACK + if( pParser->yystack!=pParser->yystk0 ) YYFREE(pParser->yystack); #endif } @@ -173567,7 +175177,7 @@ static void yyStackOverflow(yyParser *yypParser){ ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - sqlite3ErrorMsg(pParse, "parser stack overflow"); + sqlite3OomFault(pParse->db); /******** End %stack_overflow code ********************************************/ sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument var */ sqlite3ParserCTX_STORE @@ -173611,25 +175221,19 @@ static void yy_shift( assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); } #endif -#if YYSTACKDEPTH>0 - if( yypParser->yytos>yypParser->yystackEnd ){ - yypParser->yytos--; - yyStackOverflow(yypParser); - return; - } -#else - if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){ + yytos = yypParser->yytos; + if( yytos>yypParser->yystackEnd ){ if( yyGrowStack(yypParser) ){ yypParser->yytos--; yyStackOverflow(yypParser); return; } + yytos = yypParser->yytos; + assert( yytos <= yypParser->yystackEnd ); } -#endif if( yyNewState > YY_MAX_SHIFT ){ yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; } - yytos = yypParser->yytos; yytos->stateno = yyNewState; yytos->major = yyMajor; yytos->minor.yy0 = yyMinor; @@ -173639,411 +175243,415 @@ static void yy_shift( /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side ** of that rule */ static const YYCODETYPE yyRuleInfoLhs[] = { - 189, /* (0) explain ::= EXPLAIN */ - 189, /* (1) explain ::= EXPLAIN QUERY PLAN */ - 188, /* (2) cmdx ::= cmd */ - 190, /* (3) cmd ::= BEGIN transtype trans_opt */ - 191, /* (4) transtype ::= */ - 191, /* (5) transtype ::= DEFERRED */ - 191, /* (6) transtype ::= IMMEDIATE */ - 191, /* (7) transtype ::= EXCLUSIVE */ - 190, /* (8) cmd ::= COMMIT|END trans_opt */ - 190, /* (9) cmd ::= ROLLBACK trans_opt */ - 190, /* (10) cmd ::= SAVEPOINT nm */ - 190, /* (11) cmd ::= RELEASE savepoint_opt nm */ - 190, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ - 195, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */ - 197, /* (14) createkw ::= CREATE */ - 199, /* (15) ifnotexists ::= */ - 199, /* (16) ifnotexists ::= IF NOT EXISTS */ - 198, /* (17) temp ::= TEMP */ - 198, /* (18) temp ::= */ - 196, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_option_set */ - 196, /* (20) create_table_args ::= AS select */ - 203, /* (21) table_option_set ::= */ - 203, /* (22) table_option_set ::= table_option_set COMMA table_option */ - 205, /* (23) table_option ::= WITHOUT nm */ - 205, /* (24) table_option ::= nm */ - 206, /* (25) columnname ::= nm typetoken */ - 208, /* (26) typetoken ::= */ - 208, /* (27) typetoken ::= typename LP signed RP */ - 208, /* (28) typetoken ::= typename LP signed COMMA signed RP */ - 209, /* (29) typename ::= typename ID|STRING */ - 213, /* (30) scanpt ::= */ - 214, /* (31) scantok ::= */ - 215, /* (32) ccons ::= CONSTRAINT nm */ - 215, /* (33) ccons ::= DEFAULT scantok term */ - 215, /* (34) ccons ::= DEFAULT LP expr RP */ - 215, /* (35) ccons ::= DEFAULT PLUS scantok term */ - 215, /* (36) ccons ::= DEFAULT MINUS scantok term */ - 215, /* (37) ccons ::= DEFAULT scantok ID|INDEXED */ - 215, /* (38) ccons ::= NOT NULL onconf */ - 215, /* (39) ccons ::= PRIMARY KEY sortorder onconf autoinc */ - 215, /* (40) ccons ::= UNIQUE onconf */ - 215, /* (41) ccons ::= CHECK LP expr RP */ - 215, /* (42) ccons ::= REFERENCES nm eidlist_opt refargs */ - 215, /* (43) ccons ::= defer_subclause */ - 215, /* (44) ccons ::= COLLATE ID|STRING */ - 224, /* (45) generated ::= LP expr RP */ - 224, /* (46) generated ::= LP expr RP ID */ - 220, /* (47) autoinc ::= */ - 220, /* (48) autoinc ::= AUTOINCR */ - 222, /* (49) refargs ::= */ - 222, /* (50) refargs ::= refargs refarg */ - 225, /* (51) refarg ::= MATCH nm */ - 225, /* (52) refarg ::= ON INSERT refact */ - 225, /* (53) refarg ::= ON DELETE refact */ - 225, /* (54) refarg ::= ON UPDATE refact */ - 226, /* (55) refact ::= SET NULL */ - 226, /* (56) refact ::= SET DEFAULT */ - 226, /* (57) refact ::= CASCADE */ - 226, /* (58) refact ::= RESTRICT */ - 226, /* (59) refact ::= NO ACTION */ - 223, /* (60) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ - 223, /* (61) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ - 227, /* (62) init_deferred_pred_opt ::= */ - 227, /* (63) init_deferred_pred_opt ::= INITIALLY DEFERRED */ - 227, /* (64) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ - 202, /* (65) conslist_opt ::= */ - 229, /* (66) tconscomma ::= COMMA */ - 230, /* (67) tcons ::= CONSTRAINT nm */ - 230, /* (68) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ - 230, /* (69) tcons ::= UNIQUE LP sortlist RP onconf */ - 230, /* (70) tcons ::= CHECK LP expr RP onconf */ - 230, /* (71) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ - 233, /* (72) defer_subclause_opt ::= */ - 218, /* (73) onconf ::= */ - 218, /* (74) onconf ::= ON CONFLICT resolvetype */ - 234, /* (75) orconf ::= */ - 234, /* (76) orconf ::= OR resolvetype */ - 235, /* (77) resolvetype ::= IGNORE */ - 235, /* (78) resolvetype ::= REPLACE */ - 190, /* (79) cmd ::= DROP TABLE ifexists fullname */ - 237, /* (80) ifexists ::= IF EXISTS */ - 237, /* (81) ifexists ::= */ - 190, /* (82) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ - 190, /* (83) cmd ::= DROP VIEW ifexists fullname */ - 190, /* (84) cmd ::= select */ - 204, /* (85) select ::= WITH wqlist selectnowith */ - 204, /* (86) select ::= WITH RECURSIVE wqlist selectnowith */ - 204, /* (87) select ::= selectnowith */ - 239, /* (88) selectnowith ::= selectnowith multiselect_op oneselect */ - 242, /* (89) multiselect_op ::= UNION */ - 242, /* (90) multiselect_op ::= UNION ALL */ - 242, /* (91) multiselect_op ::= EXCEPT|INTERSECT */ - 240, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ - 240, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ - 252, /* (94) values ::= VALUES LP nexprlist RP */ - 252, /* (95) values ::= values COMMA LP nexprlist RP */ - 243, /* (96) distinct ::= DISTINCT */ - 243, /* (97) distinct ::= ALL */ - 243, /* (98) distinct ::= */ - 254, /* (99) sclp ::= */ - 244, /* (100) selcollist ::= sclp scanpt expr scanpt as */ - 244, /* (101) selcollist ::= sclp scanpt STAR */ - 244, /* (102) selcollist ::= sclp scanpt nm DOT STAR */ - 255, /* (103) as ::= AS nm */ - 255, /* (104) as ::= */ - 245, /* (105) from ::= */ - 245, /* (106) from ::= FROM seltablist */ - 257, /* (107) stl_prefix ::= seltablist joinop */ - 257, /* (108) stl_prefix ::= */ - 256, /* (109) seltablist ::= stl_prefix nm dbnm as on_using */ - 256, /* (110) seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ - 256, /* (111) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ - 256, /* (112) seltablist ::= stl_prefix LP select RP as on_using */ - 256, /* (113) seltablist ::= stl_prefix LP seltablist RP as on_using */ - 200, /* (114) dbnm ::= */ - 200, /* (115) dbnm ::= DOT nm */ - 238, /* (116) fullname ::= nm */ - 238, /* (117) fullname ::= nm DOT nm */ - 262, /* (118) xfullname ::= nm */ - 262, /* (119) xfullname ::= nm DOT nm */ - 262, /* (120) xfullname ::= nm DOT nm AS nm */ - 262, /* (121) xfullname ::= nm AS nm */ - 258, /* (122) joinop ::= COMMA|JOIN */ - 258, /* (123) joinop ::= JOIN_KW JOIN */ - 258, /* (124) joinop ::= JOIN_KW nm JOIN */ - 258, /* (125) joinop ::= JOIN_KW nm nm JOIN */ - 259, /* (126) on_using ::= ON expr */ - 259, /* (127) on_using ::= USING LP idlist RP */ - 259, /* (128) on_using ::= */ - 264, /* (129) indexed_opt ::= */ - 260, /* (130) indexed_by ::= INDEXED BY nm */ - 260, /* (131) indexed_by ::= NOT INDEXED */ - 249, /* (132) orderby_opt ::= */ - 249, /* (133) orderby_opt ::= ORDER BY sortlist */ - 231, /* (134) sortlist ::= sortlist COMMA expr sortorder nulls */ - 231, /* (135) sortlist ::= expr sortorder nulls */ - 219, /* (136) sortorder ::= ASC */ - 219, /* (137) sortorder ::= DESC */ - 219, /* (138) sortorder ::= */ - 265, /* (139) nulls ::= NULLS FIRST */ - 265, /* (140) nulls ::= NULLS LAST */ - 265, /* (141) nulls ::= */ - 247, /* (142) groupby_opt ::= */ - 247, /* (143) groupby_opt ::= GROUP BY nexprlist */ - 248, /* (144) having_opt ::= */ - 248, /* (145) having_opt ::= HAVING expr */ - 250, /* (146) limit_opt ::= */ - 250, /* (147) limit_opt ::= LIMIT expr */ - 250, /* (148) limit_opt ::= LIMIT expr OFFSET expr */ - 250, /* (149) limit_opt ::= LIMIT expr COMMA expr */ - 190, /* (150) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ - 246, /* (151) where_opt ::= */ - 246, /* (152) where_opt ::= WHERE expr */ - 267, /* (153) where_opt_ret ::= */ - 267, /* (154) where_opt_ret ::= WHERE expr */ - 267, /* (155) where_opt_ret ::= RETURNING selcollist */ - 267, /* (156) where_opt_ret ::= WHERE expr RETURNING selcollist */ - 190, /* (157) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ - 268, /* (158) setlist ::= setlist COMMA nm EQ expr */ - 268, /* (159) setlist ::= setlist COMMA LP idlist RP EQ expr */ - 268, /* (160) setlist ::= nm EQ expr */ - 268, /* (161) setlist ::= LP idlist RP EQ expr */ - 190, /* (162) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ - 190, /* (163) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ - 271, /* (164) upsert ::= */ - 271, /* (165) upsert ::= RETURNING selcollist */ - 271, /* (166) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ - 271, /* (167) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ - 271, /* (168) upsert ::= ON CONFLICT DO NOTHING returning */ - 271, /* (169) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ - 272, /* (170) returning ::= RETURNING selcollist */ - 269, /* (171) insert_cmd ::= INSERT orconf */ - 269, /* (172) insert_cmd ::= REPLACE */ - 270, /* (173) idlist_opt ::= */ - 270, /* (174) idlist_opt ::= LP idlist RP */ - 263, /* (175) idlist ::= idlist COMMA nm */ - 263, /* (176) idlist ::= nm */ - 217, /* (177) expr ::= LP expr RP */ - 217, /* (178) expr ::= ID|INDEXED|JOIN_KW */ - 217, /* (179) expr ::= nm DOT nm */ - 217, /* (180) expr ::= nm DOT nm DOT nm */ - 216, /* (181) term ::= NULL|FLOAT|BLOB */ - 216, /* (182) term ::= STRING */ - 216, /* (183) term ::= INTEGER */ - 217, /* (184) expr ::= VARIABLE */ - 217, /* (185) expr ::= expr COLLATE ID|STRING */ - 217, /* (186) expr ::= CAST LP expr AS typetoken RP */ - 217, /* (187) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ - 217, /* (188) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ - 217, /* (189) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ - 217, /* (190) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ - 217, /* (191) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ - 217, /* (192) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ - 216, /* (193) term ::= CTIME_KW */ - 217, /* (194) expr ::= LP nexprlist COMMA expr RP */ - 217, /* (195) expr ::= expr AND expr */ - 217, /* (196) expr ::= expr OR expr */ - 217, /* (197) expr ::= expr LT|GT|GE|LE expr */ - 217, /* (198) expr ::= expr EQ|NE expr */ - 217, /* (199) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ - 217, /* (200) expr ::= expr PLUS|MINUS expr */ - 217, /* (201) expr ::= expr STAR|SLASH|REM expr */ - 217, /* (202) expr ::= expr CONCAT expr */ - 274, /* (203) likeop ::= NOT LIKE_KW|MATCH */ - 217, /* (204) expr ::= expr likeop expr */ - 217, /* (205) expr ::= expr likeop expr ESCAPE expr */ - 217, /* (206) expr ::= expr ISNULL|NOTNULL */ - 217, /* (207) expr ::= expr NOT NULL */ - 217, /* (208) expr ::= expr IS expr */ - 217, /* (209) expr ::= expr IS NOT expr */ - 217, /* (210) expr ::= expr IS NOT DISTINCT FROM expr */ - 217, /* (211) expr ::= expr IS DISTINCT FROM expr */ - 217, /* (212) expr ::= NOT expr */ - 217, /* (213) expr ::= BITNOT expr */ - 217, /* (214) expr ::= PLUS|MINUS expr */ - 217, /* (215) expr ::= expr PTR expr */ - 275, /* (216) between_op ::= BETWEEN */ - 275, /* (217) between_op ::= NOT BETWEEN */ - 217, /* (218) expr ::= expr between_op expr AND expr */ - 276, /* (219) in_op ::= IN */ - 276, /* (220) in_op ::= NOT IN */ - 217, /* (221) expr ::= expr in_op LP exprlist RP */ - 217, /* (222) expr ::= LP select RP */ - 217, /* (223) expr ::= expr in_op LP select RP */ - 217, /* (224) expr ::= expr in_op nm dbnm paren_exprlist */ - 217, /* (225) expr ::= EXISTS LP select RP */ - 217, /* (226) expr ::= CASE case_operand case_exprlist case_else END */ - 279, /* (227) case_exprlist ::= case_exprlist WHEN expr THEN expr */ - 279, /* (228) case_exprlist ::= WHEN expr THEN expr */ - 280, /* (229) case_else ::= ELSE expr */ - 280, /* (230) case_else ::= */ - 278, /* (231) case_operand ::= */ - 261, /* (232) exprlist ::= */ - 253, /* (233) nexprlist ::= nexprlist COMMA expr */ - 253, /* (234) nexprlist ::= expr */ - 277, /* (235) paren_exprlist ::= */ - 277, /* (236) paren_exprlist ::= LP exprlist RP */ - 190, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ - 281, /* (238) uniqueflag ::= UNIQUE */ - 281, /* (239) uniqueflag ::= */ - 221, /* (240) eidlist_opt ::= */ - 221, /* (241) eidlist_opt ::= LP eidlist RP */ - 232, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */ - 232, /* (243) eidlist ::= nm collate sortorder */ - 282, /* (244) collate ::= */ - 282, /* (245) collate ::= COLLATE ID|STRING */ - 190, /* (246) cmd ::= DROP INDEX ifexists fullname */ - 190, /* (247) cmd ::= VACUUM vinto */ - 190, /* (248) cmd ::= VACUUM nm vinto */ - 283, /* (249) vinto ::= INTO expr */ - 283, /* (250) vinto ::= */ - 190, /* (251) cmd ::= PRAGMA nm dbnm */ - 190, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */ - 190, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */ - 190, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */ - 190, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */ - 211, /* (256) plus_num ::= PLUS INTEGER|FLOAT */ - 212, /* (257) minus_num ::= MINUS INTEGER|FLOAT */ - 190, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ - 285, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ - 287, /* (260) trigger_time ::= BEFORE|AFTER */ - 287, /* (261) trigger_time ::= INSTEAD OF */ - 287, /* (262) trigger_time ::= */ - 288, /* (263) trigger_event ::= DELETE|INSERT */ - 288, /* (264) trigger_event ::= UPDATE */ - 288, /* (265) trigger_event ::= UPDATE OF idlist */ - 290, /* (266) when_clause ::= */ - 290, /* (267) when_clause ::= WHEN expr */ - 286, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ - 286, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */ - 292, /* (270) trnm ::= nm DOT nm */ - 293, /* (271) tridxby ::= INDEXED BY nm */ - 293, /* (272) tridxby ::= NOT INDEXED */ - 291, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ - 291, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ - 291, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ - 291, /* (276) trigger_cmd ::= scanpt select scanpt */ - 217, /* (277) expr ::= RAISE LP IGNORE RP */ - 217, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */ - 236, /* (279) raisetype ::= ROLLBACK */ - 236, /* (280) raisetype ::= ABORT */ - 236, /* (281) raisetype ::= FAIL */ - 190, /* (282) cmd ::= DROP TRIGGER ifexists fullname */ - 190, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ - 190, /* (284) cmd ::= DETACH database_kw_opt expr */ - 295, /* (285) key_opt ::= */ - 295, /* (286) key_opt ::= KEY expr */ - 190, /* (287) cmd ::= REINDEX */ - 190, /* (288) cmd ::= REINDEX nm dbnm */ - 190, /* (289) cmd ::= ANALYZE */ - 190, /* (290) cmd ::= ANALYZE nm dbnm */ - 190, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */ - 190, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ - 190, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ - 296, /* (294) add_column_fullname ::= fullname */ - 190, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ - 190, /* (296) cmd ::= create_vtab */ - 190, /* (297) cmd ::= create_vtab LP vtabarglist RP */ - 298, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ - 300, /* (299) vtabarg ::= */ - 301, /* (300) vtabargtoken ::= ANY */ - 301, /* (301) vtabargtoken ::= lp anylist RP */ - 302, /* (302) lp ::= LP */ - 266, /* (303) with ::= WITH wqlist */ - 266, /* (304) with ::= WITH RECURSIVE wqlist */ - 305, /* (305) wqas ::= AS */ - 305, /* (306) wqas ::= AS MATERIALIZED */ - 305, /* (307) wqas ::= AS NOT MATERIALIZED */ - 304, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */ - 241, /* (309) wqlist ::= wqitem */ - 241, /* (310) wqlist ::= wqlist COMMA wqitem */ - 306, /* (311) windowdefn_list ::= windowdefn_list COMMA windowdefn */ - 307, /* (312) windowdefn ::= nm AS LP window RP */ - 308, /* (313) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ - 308, /* (314) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ - 308, /* (315) window ::= ORDER BY sortlist frame_opt */ - 308, /* (316) window ::= nm ORDER BY sortlist frame_opt */ - 308, /* (317) window ::= nm frame_opt */ - 309, /* (318) frame_opt ::= */ - 309, /* (319) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ - 309, /* (320) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ - 313, /* (321) range_or_rows ::= RANGE|ROWS|GROUPS */ - 315, /* (322) frame_bound_s ::= frame_bound */ - 315, /* (323) frame_bound_s ::= UNBOUNDED PRECEDING */ - 316, /* (324) frame_bound_e ::= frame_bound */ - 316, /* (325) frame_bound_e ::= UNBOUNDED FOLLOWING */ - 314, /* (326) frame_bound ::= expr PRECEDING|FOLLOWING */ - 314, /* (327) frame_bound ::= CURRENT ROW */ - 317, /* (328) frame_exclude_opt ::= */ - 317, /* (329) frame_exclude_opt ::= EXCLUDE frame_exclude */ - 318, /* (330) frame_exclude ::= NO OTHERS */ - 318, /* (331) frame_exclude ::= CURRENT ROW */ - 318, /* (332) frame_exclude ::= GROUP|TIES */ - 251, /* (333) window_clause ::= WINDOW windowdefn_list */ - 273, /* (334) filter_over ::= filter_clause over_clause */ - 273, /* (335) filter_over ::= over_clause */ - 273, /* (336) filter_over ::= filter_clause */ - 312, /* (337) over_clause ::= OVER LP window RP */ - 312, /* (338) over_clause ::= OVER nm */ - 311, /* (339) filter_clause ::= FILTER LP WHERE expr RP */ - 185, /* (340) input ::= cmdlist */ - 186, /* (341) cmdlist ::= cmdlist ecmd */ - 186, /* (342) cmdlist ::= ecmd */ - 187, /* (343) ecmd ::= SEMI */ - 187, /* (344) ecmd ::= cmdx SEMI */ - 187, /* (345) ecmd ::= explain cmdx SEMI */ - 192, /* (346) trans_opt ::= */ - 192, /* (347) trans_opt ::= TRANSACTION */ - 192, /* (348) trans_opt ::= TRANSACTION nm */ - 194, /* (349) savepoint_opt ::= SAVEPOINT */ - 194, /* (350) savepoint_opt ::= */ - 190, /* (351) cmd ::= create_table create_table_args */ - 203, /* (352) table_option_set ::= table_option */ - 201, /* (353) columnlist ::= columnlist COMMA columnname carglist */ - 201, /* (354) columnlist ::= columnname carglist */ - 193, /* (355) nm ::= ID|INDEXED|JOIN_KW */ - 193, /* (356) nm ::= STRING */ - 208, /* (357) typetoken ::= typename */ - 209, /* (358) typename ::= ID|STRING */ - 210, /* (359) signed ::= plus_num */ - 210, /* (360) signed ::= minus_num */ - 207, /* (361) carglist ::= carglist ccons */ - 207, /* (362) carglist ::= */ - 215, /* (363) ccons ::= NULL onconf */ - 215, /* (364) ccons ::= GENERATED ALWAYS AS generated */ - 215, /* (365) ccons ::= AS generated */ - 202, /* (366) conslist_opt ::= COMMA conslist */ - 228, /* (367) conslist ::= conslist tconscomma tcons */ - 228, /* (368) conslist ::= tcons */ - 229, /* (369) tconscomma ::= */ - 233, /* (370) defer_subclause_opt ::= defer_subclause */ - 235, /* (371) resolvetype ::= raisetype */ - 239, /* (372) selectnowith ::= oneselect */ - 240, /* (373) oneselect ::= values */ - 254, /* (374) sclp ::= selcollist COMMA */ - 255, /* (375) as ::= ID|STRING */ - 264, /* (376) indexed_opt ::= indexed_by */ - 272, /* (377) returning ::= */ - 217, /* (378) expr ::= term */ - 274, /* (379) likeop ::= LIKE_KW|MATCH */ - 278, /* (380) case_operand ::= expr */ - 261, /* (381) exprlist ::= nexprlist */ - 284, /* (382) nmnum ::= plus_num */ - 284, /* (383) nmnum ::= nm */ - 284, /* (384) nmnum ::= ON */ - 284, /* (385) nmnum ::= DELETE */ - 284, /* (386) nmnum ::= DEFAULT */ - 211, /* (387) plus_num ::= INTEGER|FLOAT */ - 289, /* (388) foreach_clause ::= */ - 289, /* (389) foreach_clause ::= FOR EACH ROW */ - 292, /* (390) trnm ::= nm */ - 293, /* (391) tridxby ::= */ - 294, /* (392) database_kw_opt ::= DATABASE */ - 294, /* (393) database_kw_opt ::= */ - 297, /* (394) kwcolumn_opt ::= */ - 297, /* (395) kwcolumn_opt ::= COLUMNKW */ - 299, /* (396) vtabarglist ::= vtabarg */ - 299, /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */ - 300, /* (398) vtabarg ::= vtabarg vtabargtoken */ - 303, /* (399) anylist ::= */ - 303, /* (400) anylist ::= anylist LP anylist RP */ - 303, /* (401) anylist ::= anylist ANY */ - 266, /* (402) with ::= */ - 306, /* (403) windowdefn_list ::= windowdefn */ - 308, /* (404) window ::= frame_opt */ + 190, /* (0) explain ::= EXPLAIN */ + 190, /* (1) explain ::= EXPLAIN QUERY PLAN */ + 189, /* (2) cmdx ::= cmd */ + 191, /* (3) cmd ::= BEGIN transtype trans_opt */ + 192, /* (4) transtype ::= */ + 192, /* (5) transtype ::= DEFERRED */ + 192, /* (6) transtype ::= IMMEDIATE */ + 192, /* (7) transtype ::= EXCLUSIVE */ + 191, /* (8) cmd ::= COMMIT|END trans_opt */ + 191, /* (9) cmd ::= ROLLBACK trans_opt */ + 191, /* (10) cmd ::= SAVEPOINT nm */ + 191, /* (11) cmd ::= RELEASE savepoint_opt nm */ + 191, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ + 196, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */ + 198, /* (14) createkw ::= CREATE */ + 200, /* (15) ifnotexists ::= */ + 200, /* (16) ifnotexists ::= IF NOT EXISTS */ + 199, /* (17) temp ::= TEMP */ + 199, /* (18) temp ::= */ + 197, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_option_set */ + 197, /* (20) create_table_args ::= AS select */ + 204, /* (21) table_option_set ::= */ + 204, /* (22) table_option_set ::= table_option_set COMMA table_option */ + 206, /* (23) table_option ::= WITHOUT nm */ + 206, /* (24) table_option ::= nm */ + 207, /* (25) columnname ::= nm typetoken */ + 209, /* (26) typetoken ::= */ + 209, /* (27) typetoken ::= typename LP signed RP */ + 209, /* (28) typetoken ::= typename LP signed COMMA signed RP */ + 210, /* (29) typename ::= typename ID|STRING */ + 214, /* (30) scanpt ::= */ + 215, /* (31) scantok ::= */ + 216, /* (32) ccons ::= CONSTRAINT nm */ + 216, /* (33) ccons ::= DEFAULT scantok term */ + 216, /* (34) ccons ::= DEFAULT LP expr RP */ + 216, /* (35) ccons ::= DEFAULT PLUS scantok term */ + 216, /* (36) ccons ::= DEFAULT MINUS scantok term */ + 216, /* (37) ccons ::= DEFAULT scantok ID|INDEXED */ + 216, /* (38) ccons ::= NOT NULL onconf */ + 216, /* (39) ccons ::= PRIMARY KEY sortorder onconf autoinc */ + 216, /* (40) ccons ::= UNIQUE onconf */ + 216, /* (41) ccons ::= CHECK LP expr RP */ + 216, /* (42) ccons ::= REFERENCES nm eidlist_opt refargs */ + 216, /* (43) ccons ::= defer_subclause */ + 216, /* (44) ccons ::= COLLATE ID|STRING */ + 225, /* (45) generated ::= LP expr RP */ + 225, /* (46) generated ::= LP expr RP ID */ + 221, /* (47) autoinc ::= */ + 221, /* (48) autoinc ::= AUTOINCR */ + 223, /* (49) refargs ::= */ + 223, /* (50) refargs ::= refargs refarg */ + 226, /* (51) refarg ::= MATCH nm */ + 226, /* (52) refarg ::= ON INSERT refact */ + 226, /* (53) refarg ::= ON DELETE refact */ + 226, /* (54) refarg ::= ON UPDATE refact */ + 227, /* (55) refact ::= SET NULL */ + 227, /* (56) refact ::= SET DEFAULT */ + 227, /* (57) refact ::= CASCADE */ + 227, /* (58) refact ::= RESTRICT */ + 227, /* (59) refact ::= NO ACTION */ + 224, /* (60) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ + 224, /* (61) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ + 228, /* (62) init_deferred_pred_opt ::= */ + 228, /* (63) init_deferred_pred_opt ::= INITIALLY DEFERRED */ + 228, /* (64) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ + 203, /* (65) conslist_opt ::= */ + 230, /* (66) tconscomma ::= COMMA */ + 231, /* (67) tcons ::= CONSTRAINT nm */ + 231, /* (68) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ + 231, /* (69) tcons ::= UNIQUE LP sortlist RP onconf */ + 231, /* (70) tcons ::= CHECK LP expr RP onconf */ + 231, /* (71) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ + 234, /* (72) defer_subclause_opt ::= */ + 219, /* (73) onconf ::= */ + 219, /* (74) onconf ::= ON CONFLICT resolvetype */ + 235, /* (75) orconf ::= */ + 235, /* (76) orconf ::= OR resolvetype */ + 236, /* (77) resolvetype ::= IGNORE */ + 236, /* (78) resolvetype ::= REPLACE */ + 191, /* (79) cmd ::= DROP TABLE ifexists fullname */ + 238, /* (80) ifexists ::= IF EXISTS */ + 238, /* (81) ifexists ::= */ + 191, /* (82) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ + 191, /* (83) cmd ::= DROP VIEW ifexists fullname */ + 191, /* (84) cmd ::= select */ + 205, /* (85) select ::= WITH wqlist selectnowith */ + 205, /* (86) select ::= WITH RECURSIVE wqlist selectnowith */ + 205, /* (87) select ::= selectnowith */ + 240, /* (88) selectnowith ::= selectnowith multiselect_op oneselect */ + 243, /* (89) multiselect_op ::= UNION */ + 243, /* (90) multiselect_op ::= UNION ALL */ + 243, /* (91) multiselect_op ::= EXCEPT|INTERSECT */ + 241, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ + 241, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ + 253, /* (94) values ::= VALUES LP nexprlist RP */ + 241, /* (95) oneselect ::= mvalues */ + 255, /* (96) mvalues ::= values COMMA LP nexprlist RP */ + 255, /* (97) mvalues ::= mvalues COMMA LP nexprlist RP */ + 244, /* (98) distinct ::= DISTINCT */ + 244, /* (99) distinct ::= ALL */ + 244, /* (100) distinct ::= */ + 256, /* (101) sclp ::= */ + 245, /* (102) selcollist ::= sclp scanpt expr scanpt as */ + 245, /* (103) selcollist ::= sclp scanpt STAR */ + 245, /* (104) selcollist ::= sclp scanpt nm DOT STAR */ + 257, /* (105) as ::= AS nm */ + 257, /* (106) as ::= */ + 246, /* (107) from ::= */ + 246, /* (108) from ::= FROM seltablist */ + 259, /* (109) stl_prefix ::= seltablist joinop */ + 259, /* (110) stl_prefix ::= */ + 258, /* (111) seltablist ::= stl_prefix nm dbnm as on_using */ + 258, /* (112) seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ + 258, /* (113) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ + 258, /* (114) seltablist ::= stl_prefix LP select RP as on_using */ + 258, /* (115) seltablist ::= stl_prefix LP seltablist RP as on_using */ + 201, /* (116) dbnm ::= */ + 201, /* (117) dbnm ::= DOT nm */ + 239, /* (118) fullname ::= nm */ + 239, /* (119) fullname ::= nm DOT nm */ + 264, /* (120) xfullname ::= nm */ + 264, /* (121) xfullname ::= nm DOT nm */ + 264, /* (122) xfullname ::= nm DOT nm AS nm */ + 264, /* (123) xfullname ::= nm AS nm */ + 260, /* (124) joinop ::= COMMA|JOIN */ + 260, /* (125) joinop ::= JOIN_KW JOIN */ + 260, /* (126) joinop ::= JOIN_KW nm JOIN */ + 260, /* (127) joinop ::= JOIN_KW nm nm JOIN */ + 261, /* (128) on_using ::= ON expr */ + 261, /* (129) on_using ::= USING LP idlist RP */ + 261, /* (130) on_using ::= */ + 266, /* (131) indexed_opt ::= */ + 262, /* (132) indexed_by ::= INDEXED BY nm */ + 262, /* (133) indexed_by ::= NOT INDEXED */ + 250, /* (134) orderby_opt ::= */ + 250, /* (135) orderby_opt ::= ORDER BY sortlist */ + 232, /* (136) sortlist ::= sortlist COMMA expr sortorder nulls */ + 232, /* (137) sortlist ::= expr sortorder nulls */ + 220, /* (138) sortorder ::= ASC */ + 220, /* (139) sortorder ::= DESC */ + 220, /* (140) sortorder ::= */ + 267, /* (141) nulls ::= NULLS FIRST */ + 267, /* (142) nulls ::= NULLS LAST */ + 267, /* (143) nulls ::= */ + 248, /* (144) groupby_opt ::= */ + 248, /* (145) groupby_opt ::= GROUP BY nexprlist */ + 249, /* (146) having_opt ::= */ + 249, /* (147) having_opt ::= HAVING expr */ + 251, /* (148) limit_opt ::= */ + 251, /* (149) limit_opt ::= LIMIT expr */ + 251, /* (150) limit_opt ::= LIMIT expr OFFSET expr */ + 251, /* (151) limit_opt ::= LIMIT expr COMMA expr */ + 191, /* (152) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ + 247, /* (153) where_opt ::= */ + 247, /* (154) where_opt ::= WHERE expr */ + 269, /* (155) where_opt_ret ::= */ + 269, /* (156) where_opt_ret ::= WHERE expr */ + 269, /* (157) where_opt_ret ::= RETURNING selcollist */ + 269, /* (158) where_opt_ret ::= WHERE expr RETURNING selcollist */ + 191, /* (159) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ + 270, /* (160) setlist ::= setlist COMMA nm EQ expr */ + 270, /* (161) setlist ::= setlist COMMA LP idlist RP EQ expr */ + 270, /* (162) setlist ::= nm EQ expr */ + 270, /* (163) setlist ::= LP idlist RP EQ expr */ + 191, /* (164) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ + 191, /* (165) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ + 273, /* (166) upsert ::= */ + 273, /* (167) upsert ::= RETURNING selcollist */ + 273, /* (168) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ + 273, /* (169) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ + 273, /* (170) upsert ::= ON CONFLICT DO NOTHING returning */ + 273, /* (171) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ + 274, /* (172) returning ::= RETURNING selcollist */ + 271, /* (173) insert_cmd ::= INSERT orconf */ + 271, /* (174) insert_cmd ::= REPLACE */ + 272, /* (175) idlist_opt ::= */ + 272, /* (176) idlist_opt ::= LP idlist RP */ + 265, /* (177) idlist ::= idlist COMMA nm */ + 265, /* (178) idlist ::= nm */ + 218, /* (179) expr ::= LP expr RP */ + 218, /* (180) expr ::= ID|INDEXED|JOIN_KW */ + 218, /* (181) expr ::= nm DOT nm */ + 218, /* (182) expr ::= nm DOT nm DOT nm */ + 217, /* (183) term ::= NULL|FLOAT|BLOB */ + 217, /* (184) term ::= STRING */ + 217, /* (185) term ::= INTEGER */ + 218, /* (186) expr ::= VARIABLE */ + 218, /* (187) expr ::= expr COLLATE ID|STRING */ + 218, /* (188) expr ::= CAST LP expr AS typetoken RP */ + 218, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ + 218, /* (190) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ + 218, /* (191) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ + 218, /* (192) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ + 218, /* (193) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ + 218, /* (194) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ + 217, /* (195) term ::= CTIME_KW */ + 218, /* (196) expr ::= LP nexprlist COMMA expr RP */ + 218, /* (197) expr ::= expr AND expr */ + 218, /* (198) expr ::= expr OR expr */ + 218, /* (199) expr ::= expr LT|GT|GE|LE expr */ + 218, /* (200) expr ::= expr EQ|NE expr */ + 218, /* (201) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ + 218, /* (202) expr ::= expr PLUS|MINUS expr */ + 218, /* (203) expr ::= expr STAR|SLASH|REM expr */ + 218, /* (204) expr ::= expr CONCAT expr */ + 276, /* (205) likeop ::= NOT LIKE_KW|MATCH */ + 218, /* (206) expr ::= expr likeop expr */ + 218, /* (207) expr ::= expr likeop expr ESCAPE expr */ + 218, /* (208) expr ::= expr ISNULL|NOTNULL */ + 218, /* (209) expr ::= expr NOT NULL */ + 218, /* (210) expr ::= expr IS expr */ + 218, /* (211) expr ::= expr IS NOT expr */ + 218, /* (212) expr ::= expr IS NOT DISTINCT FROM expr */ + 218, /* (213) expr ::= expr IS DISTINCT FROM expr */ + 218, /* (214) expr ::= NOT expr */ + 218, /* (215) expr ::= BITNOT expr */ + 218, /* (216) expr ::= PLUS|MINUS expr */ + 218, /* (217) expr ::= expr PTR expr */ + 277, /* (218) between_op ::= BETWEEN */ + 277, /* (219) between_op ::= NOT BETWEEN */ + 218, /* (220) expr ::= expr between_op expr AND expr */ + 278, /* (221) in_op ::= IN */ + 278, /* (222) in_op ::= NOT IN */ + 218, /* (223) expr ::= expr in_op LP exprlist RP */ + 218, /* (224) expr ::= LP select RP */ + 218, /* (225) expr ::= expr in_op LP select RP */ + 218, /* (226) expr ::= expr in_op nm dbnm paren_exprlist */ + 218, /* (227) expr ::= EXISTS LP select RP */ + 218, /* (228) expr ::= CASE case_operand case_exprlist case_else END */ + 281, /* (229) case_exprlist ::= case_exprlist WHEN expr THEN expr */ + 281, /* (230) case_exprlist ::= WHEN expr THEN expr */ + 282, /* (231) case_else ::= ELSE expr */ + 282, /* (232) case_else ::= */ + 280, /* (233) case_operand ::= */ + 263, /* (234) exprlist ::= */ + 254, /* (235) nexprlist ::= nexprlist COMMA expr */ + 254, /* (236) nexprlist ::= expr */ + 279, /* (237) paren_exprlist ::= */ + 279, /* (238) paren_exprlist ::= LP exprlist RP */ + 191, /* (239) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ + 283, /* (240) uniqueflag ::= UNIQUE */ + 283, /* (241) uniqueflag ::= */ + 222, /* (242) eidlist_opt ::= */ + 222, /* (243) eidlist_opt ::= LP eidlist RP */ + 233, /* (244) eidlist ::= eidlist COMMA nm collate sortorder */ + 233, /* (245) eidlist ::= nm collate sortorder */ + 284, /* (246) collate ::= */ + 284, /* (247) collate ::= COLLATE ID|STRING */ + 191, /* (248) cmd ::= DROP INDEX ifexists fullname */ + 191, /* (249) cmd ::= VACUUM vinto */ + 191, /* (250) cmd ::= VACUUM nm vinto */ + 285, /* (251) vinto ::= INTO expr */ + 285, /* (252) vinto ::= */ + 191, /* (253) cmd ::= PRAGMA nm dbnm */ + 191, /* (254) cmd ::= PRAGMA nm dbnm EQ nmnum */ + 191, /* (255) cmd ::= PRAGMA nm dbnm LP nmnum RP */ + 191, /* (256) cmd ::= PRAGMA nm dbnm EQ minus_num */ + 191, /* (257) cmd ::= PRAGMA nm dbnm LP minus_num RP */ + 212, /* (258) plus_num ::= PLUS INTEGER|FLOAT */ + 213, /* (259) minus_num ::= MINUS INTEGER|FLOAT */ + 191, /* (260) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ + 287, /* (261) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ + 289, /* (262) trigger_time ::= BEFORE|AFTER */ + 289, /* (263) trigger_time ::= INSTEAD OF */ + 289, /* (264) trigger_time ::= */ + 290, /* (265) trigger_event ::= DELETE|INSERT */ + 290, /* (266) trigger_event ::= UPDATE */ + 290, /* (267) trigger_event ::= UPDATE OF idlist */ + 292, /* (268) when_clause ::= */ + 292, /* (269) when_clause ::= WHEN expr */ + 288, /* (270) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ + 288, /* (271) trigger_cmd_list ::= trigger_cmd SEMI */ + 294, /* (272) trnm ::= nm DOT nm */ + 295, /* (273) tridxby ::= INDEXED BY nm */ + 295, /* (274) tridxby ::= NOT INDEXED */ + 293, /* (275) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ + 293, /* (276) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ + 293, /* (277) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ + 293, /* (278) trigger_cmd ::= scanpt select scanpt */ + 218, /* (279) expr ::= RAISE LP IGNORE RP */ + 218, /* (280) expr ::= RAISE LP raisetype COMMA nm RP */ + 237, /* (281) raisetype ::= ROLLBACK */ + 237, /* (282) raisetype ::= ABORT */ + 237, /* (283) raisetype ::= FAIL */ + 191, /* (284) cmd ::= DROP TRIGGER ifexists fullname */ + 191, /* (285) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ + 191, /* (286) cmd ::= DETACH database_kw_opt expr */ + 297, /* (287) key_opt ::= */ + 297, /* (288) key_opt ::= KEY expr */ + 191, /* (289) cmd ::= REINDEX */ + 191, /* (290) cmd ::= REINDEX nm dbnm */ + 191, /* (291) cmd ::= ANALYZE */ + 191, /* (292) cmd ::= ANALYZE nm dbnm */ + 191, /* (293) cmd ::= ALTER TABLE fullname RENAME TO nm */ + 191, /* (294) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ + 191, /* (295) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ + 298, /* (296) add_column_fullname ::= fullname */ + 191, /* (297) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ + 191, /* (298) cmd ::= create_vtab */ + 191, /* (299) cmd ::= create_vtab LP vtabarglist RP */ + 300, /* (300) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ + 302, /* (301) vtabarg ::= */ + 303, /* (302) vtabargtoken ::= ANY */ + 303, /* (303) vtabargtoken ::= lp anylist RP */ + 304, /* (304) lp ::= LP */ + 268, /* (305) with ::= WITH wqlist */ + 268, /* (306) with ::= WITH RECURSIVE wqlist */ + 307, /* (307) wqas ::= AS */ + 307, /* (308) wqas ::= AS MATERIALIZED */ + 307, /* (309) wqas ::= AS NOT MATERIALIZED */ + 306, /* (310) wqitem ::= withnm eidlist_opt wqas LP select RP */ + 308, /* (311) withnm ::= nm */ + 242, /* (312) wqlist ::= wqitem */ + 242, /* (313) wqlist ::= wqlist COMMA wqitem */ + 309, /* (314) windowdefn_list ::= windowdefn_list COMMA windowdefn */ + 310, /* (315) windowdefn ::= nm AS LP window RP */ + 311, /* (316) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ + 311, /* (317) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ + 311, /* (318) window ::= ORDER BY sortlist frame_opt */ + 311, /* (319) window ::= nm ORDER BY sortlist frame_opt */ + 311, /* (320) window ::= nm frame_opt */ + 312, /* (321) frame_opt ::= */ + 312, /* (322) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ + 312, /* (323) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ + 316, /* (324) range_or_rows ::= RANGE|ROWS|GROUPS */ + 318, /* (325) frame_bound_s ::= frame_bound */ + 318, /* (326) frame_bound_s ::= UNBOUNDED PRECEDING */ + 319, /* (327) frame_bound_e ::= frame_bound */ + 319, /* (328) frame_bound_e ::= UNBOUNDED FOLLOWING */ + 317, /* (329) frame_bound ::= expr PRECEDING|FOLLOWING */ + 317, /* (330) frame_bound ::= CURRENT ROW */ + 320, /* (331) frame_exclude_opt ::= */ + 320, /* (332) frame_exclude_opt ::= EXCLUDE frame_exclude */ + 321, /* (333) frame_exclude ::= NO OTHERS */ + 321, /* (334) frame_exclude ::= CURRENT ROW */ + 321, /* (335) frame_exclude ::= GROUP|TIES */ + 252, /* (336) window_clause ::= WINDOW windowdefn_list */ + 275, /* (337) filter_over ::= filter_clause over_clause */ + 275, /* (338) filter_over ::= over_clause */ + 275, /* (339) filter_over ::= filter_clause */ + 315, /* (340) over_clause ::= OVER LP window RP */ + 315, /* (341) over_clause ::= OVER nm */ + 314, /* (342) filter_clause ::= FILTER LP WHERE expr RP */ + 217, /* (343) term ::= QNUMBER */ + 186, /* (344) input ::= cmdlist */ + 187, /* (345) cmdlist ::= cmdlist ecmd */ + 187, /* (346) cmdlist ::= ecmd */ + 188, /* (347) ecmd ::= SEMI */ + 188, /* (348) ecmd ::= cmdx SEMI */ + 188, /* (349) ecmd ::= explain cmdx SEMI */ + 193, /* (350) trans_opt ::= */ + 193, /* (351) trans_opt ::= TRANSACTION */ + 193, /* (352) trans_opt ::= TRANSACTION nm */ + 195, /* (353) savepoint_opt ::= SAVEPOINT */ + 195, /* (354) savepoint_opt ::= */ + 191, /* (355) cmd ::= create_table create_table_args */ + 204, /* (356) table_option_set ::= table_option */ + 202, /* (357) columnlist ::= columnlist COMMA columnname carglist */ + 202, /* (358) columnlist ::= columnname carglist */ + 194, /* (359) nm ::= ID|INDEXED|JOIN_KW */ + 194, /* (360) nm ::= STRING */ + 209, /* (361) typetoken ::= typename */ + 210, /* (362) typename ::= ID|STRING */ + 211, /* (363) signed ::= plus_num */ + 211, /* (364) signed ::= minus_num */ + 208, /* (365) carglist ::= carglist ccons */ + 208, /* (366) carglist ::= */ + 216, /* (367) ccons ::= NULL onconf */ + 216, /* (368) ccons ::= GENERATED ALWAYS AS generated */ + 216, /* (369) ccons ::= AS generated */ + 203, /* (370) conslist_opt ::= COMMA conslist */ + 229, /* (371) conslist ::= conslist tconscomma tcons */ + 229, /* (372) conslist ::= tcons */ + 230, /* (373) tconscomma ::= */ + 234, /* (374) defer_subclause_opt ::= defer_subclause */ + 236, /* (375) resolvetype ::= raisetype */ + 240, /* (376) selectnowith ::= oneselect */ + 241, /* (377) oneselect ::= values */ + 256, /* (378) sclp ::= selcollist COMMA */ + 257, /* (379) as ::= ID|STRING */ + 266, /* (380) indexed_opt ::= indexed_by */ + 274, /* (381) returning ::= */ + 218, /* (382) expr ::= term */ + 276, /* (383) likeop ::= LIKE_KW|MATCH */ + 280, /* (384) case_operand ::= expr */ + 263, /* (385) exprlist ::= nexprlist */ + 286, /* (386) nmnum ::= plus_num */ + 286, /* (387) nmnum ::= nm */ + 286, /* (388) nmnum ::= ON */ + 286, /* (389) nmnum ::= DELETE */ + 286, /* (390) nmnum ::= DEFAULT */ + 212, /* (391) plus_num ::= INTEGER|FLOAT */ + 291, /* (392) foreach_clause ::= */ + 291, /* (393) foreach_clause ::= FOR EACH ROW */ + 294, /* (394) trnm ::= nm */ + 295, /* (395) tridxby ::= */ + 296, /* (396) database_kw_opt ::= DATABASE */ + 296, /* (397) database_kw_opt ::= */ + 299, /* (398) kwcolumn_opt ::= */ + 299, /* (399) kwcolumn_opt ::= COLUMNKW */ + 301, /* (400) vtabarglist ::= vtabarg */ + 301, /* (401) vtabarglist ::= vtabarglist COMMA vtabarg */ + 302, /* (402) vtabarg ::= vtabarg vtabargtoken */ + 305, /* (403) anylist ::= */ + 305, /* (404) anylist ::= anylist LP anylist RP */ + 305, /* (405) anylist ::= anylist ANY */ + 268, /* (406) with ::= */ + 309, /* (407) windowdefn_list ::= windowdefn */ + 311, /* (408) window ::= frame_opt */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -174144,316 +175752,320 @@ static const signed char yyRuleInfoNRhs[] = { -9, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ -10, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ -4, /* (94) values ::= VALUES LP nexprlist RP */ - -5, /* (95) values ::= values COMMA LP nexprlist RP */ - -1, /* (96) distinct ::= DISTINCT */ - -1, /* (97) distinct ::= ALL */ - 0, /* (98) distinct ::= */ - 0, /* (99) sclp ::= */ - -5, /* (100) selcollist ::= sclp scanpt expr scanpt as */ - -3, /* (101) selcollist ::= sclp scanpt STAR */ - -5, /* (102) selcollist ::= sclp scanpt nm DOT STAR */ - -2, /* (103) as ::= AS nm */ - 0, /* (104) as ::= */ - 0, /* (105) from ::= */ - -2, /* (106) from ::= FROM seltablist */ - -2, /* (107) stl_prefix ::= seltablist joinop */ - 0, /* (108) stl_prefix ::= */ - -5, /* (109) seltablist ::= stl_prefix nm dbnm as on_using */ - -6, /* (110) seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ - -8, /* (111) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ - -6, /* (112) seltablist ::= stl_prefix LP select RP as on_using */ - -6, /* (113) seltablist ::= stl_prefix LP seltablist RP as on_using */ - 0, /* (114) dbnm ::= */ - -2, /* (115) dbnm ::= DOT nm */ - -1, /* (116) fullname ::= nm */ - -3, /* (117) fullname ::= nm DOT nm */ - -1, /* (118) xfullname ::= nm */ - -3, /* (119) xfullname ::= nm DOT nm */ - -5, /* (120) xfullname ::= nm DOT nm AS nm */ - -3, /* (121) xfullname ::= nm AS nm */ - -1, /* (122) joinop ::= COMMA|JOIN */ - -2, /* (123) joinop ::= JOIN_KW JOIN */ - -3, /* (124) joinop ::= JOIN_KW nm JOIN */ - -4, /* (125) joinop ::= JOIN_KW nm nm JOIN */ - -2, /* (126) on_using ::= ON expr */ - -4, /* (127) on_using ::= USING LP idlist RP */ - 0, /* (128) on_using ::= */ - 0, /* (129) indexed_opt ::= */ - -3, /* (130) indexed_by ::= INDEXED BY nm */ - -2, /* (131) indexed_by ::= NOT INDEXED */ - 0, /* (132) orderby_opt ::= */ - -3, /* (133) orderby_opt ::= ORDER BY sortlist */ - -5, /* (134) sortlist ::= sortlist COMMA expr sortorder nulls */ - -3, /* (135) sortlist ::= expr sortorder nulls */ - -1, /* (136) sortorder ::= ASC */ - -1, /* (137) sortorder ::= DESC */ - 0, /* (138) sortorder ::= */ - -2, /* (139) nulls ::= NULLS FIRST */ - -2, /* (140) nulls ::= NULLS LAST */ - 0, /* (141) nulls ::= */ - 0, /* (142) groupby_opt ::= */ - -3, /* (143) groupby_opt ::= GROUP BY nexprlist */ - 0, /* (144) having_opt ::= */ - -2, /* (145) having_opt ::= HAVING expr */ - 0, /* (146) limit_opt ::= */ - -2, /* (147) limit_opt ::= LIMIT expr */ - -4, /* (148) limit_opt ::= LIMIT expr OFFSET expr */ - -4, /* (149) limit_opt ::= LIMIT expr COMMA expr */ - -6, /* (150) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ - 0, /* (151) where_opt ::= */ - -2, /* (152) where_opt ::= WHERE expr */ - 0, /* (153) where_opt_ret ::= */ - -2, /* (154) where_opt_ret ::= WHERE expr */ - -2, /* (155) where_opt_ret ::= RETURNING selcollist */ - -4, /* (156) where_opt_ret ::= WHERE expr RETURNING selcollist */ - -9, /* (157) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ - -5, /* (158) setlist ::= setlist COMMA nm EQ expr */ - -7, /* (159) setlist ::= setlist COMMA LP idlist RP EQ expr */ - -3, /* (160) setlist ::= nm EQ expr */ - -5, /* (161) setlist ::= LP idlist RP EQ expr */ - -7, /* (162) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ - -8, /* (163) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ - 0, /* (164) upsert ::= */ - -2, /* (165) upsert ::= RETURNING selcollist */ - -12, /* (166) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ - -9, /* (167) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ - -5, /* (168) upsert ::= ON CONFLICT DO NOTHING returning */ - -8, /* (169) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ - -2, /* (170) returning ::= RETURNING selcollist */ - -2, /* (171) insert_cmd ::= INSERT orconf */ - -1, /* (172) insert_cmd ::= REPLACE */ - 0, /* (173) idlist_opt ::= */ - -3, /* (174) idlist_opt ::= LP idlist RP */ - -3, /* (175) idlist ::= idlist COMMA nm */ - -1, /* (176) idlist ::= nm */ - -3, /* (177) expr ::= LP expr RP */ - -1, /* (178) expr ::= ID|INDEXED|JOIN_KW */ - -3, /* (179) expr ::= nm DOT nm */ - -5, /* (180) expr ::= nm DOT nm DOT nm */ - -1, /* (181) term ::= NULL|FLOAT|BLOB */ - -1, /* (182) term ::= STRING */ - -1, /* (183) term ::= INTEGER */ - -1, /* (184) expr ::= VARIABLE */ - -3, /* (185) expr ::= expr COLLATE ID|STRING */ - -6, /* (186) expr ::= CAST LP expr AS typetoken RP */ - -5, /* (187) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ - -8, /* (188) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ - -4, /* (189) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ - -6, /* (190) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ - -9, /* (191) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ - -5, /* (192) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ - -1, /* (193) term ::= CTIME_KW */ - -5, /* (194) expr ::= LP nexprlist COMMA expr RP */ - -3, /* (195) expr ::= expr AND expr */ - -3, /* (196) expr ::= expr OR expr */ - -3, /* (197) expr ::= expr LT|GT|GE|LE expr */ - -3, /* (198) expr ::= expr EQ|NE expr */ - -3, /* (199) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ - -3, /* (200) expr ::= expr PLUS|MINUS expr */ - -3, /* (201) expr ::= expr STAR|SLASH|REM expr */ - -3, /* (202) expr ::= expr CONCAT expr */ - -2, /* (203) likeop ::= NOT LIKE_KW|MATCH */ - -3, /* (204) expr ::= expr likeop expr */ - -5, /* (205) expr ::= expr likeop expr ESCAPE expr */ - -2, /* (206) expr ::= expr ISNULL|NOTNULL */ - -3, /* (207) expr ::= expr NOT NULL */ - -3, /* (208) expr ::= expr IS expr */ - -4, /* (209) expr ::= expr IS NOT expr */ - -6, /* (210) expr ::= expr IS NOT DISTINCT FROM expr */ - -5, /* (211) expr ::= expr IS DISTINCT FROM expr */ - -2, /* (212) expr ::= NOT expr */ - -2, /* (213) expr ::= BITNOT expr */ - -2, /* (214) expr ::= PLUS|MINUS expr */ - -3, /* (215) expr ::= expr PTR expr */ - -1, /* (216) between_op ::= BETWEEN */ - -2, /* (217) between_op ::= NOT BETWEEN */ - -5, /* (218) expr ::= expr between_op expr AND expr */ - -1, /* (219) in_op ::= IN */ - -2, /* (220) in_op ::= NOT IN */ - -5, /* (221) expr ::= expr in_op LP exprlist RP */ - -3, /* (222) expr ::= LP select RP */ - -5, /* (223) expr ::= expr in_op LP select RP */ - -5, /* (224) expr ::= expr in_op nm dbnm paren_exprlist */ - -4, /* (225) expr ::= EXISTS LP select RP */ - -5, /* (226) expr ::= CASE case_operand case_exprlist case_else END */ - -5, /* (227) case_exprlist ::= case_exprlist WHEN expr THEN expr */ - -4, /* (228) case_exprlist ::= WHEN expr THEN expr */ - -2, /* (229) case_else ::= ELSE expr */ - 0, /* (230) case_else ::= */ - 0, /* (231) case_operand ::= */ - 0, /* (232) exprlist ::= */ - -3, /* (233) nexprlist ::= nexprlist COMMA expr */ - -1, /* (234) nexprlist ::= expr */ - 0, /* (235) paren_exprlist ::= */ - -3, /* (236) paren_exprlist ::= LP exprlist RP */ - -12, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ - -1, /* (238) uniqueflag ::= UNIQUE */ - 0, /* (239) uniqueflag ::= */ - 0, /* (240) eidlist_opt ::= */ - -3, /* (241) eidlist_opt ::= LP eidlist RP */ - -5, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */ - -3, /* (243) eidlist ::= nm collate sortorder */ - 0, /* (244) collate ::= */ - -2, /* (245) collate ::= COLLATE ID|STRING */ - -4, /* (246) cmd ::= DROP INDEX ifexists fullname */ - -2, /* (247) cmd ::= VACUUM vinto */ - -3, /* (248) cmd ::= VACUUM nm vinto */ - -2, /* (249) vinto ::= INTO expr */ - 0, /* (250) vinto ::= */ - -3, /* (251) cmd ::= PRAGMA nm dbnm */ - -5, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */ - -6, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */ - -5, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */ - -6, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */ - -2, /* (256) plus_num ::= PLUS INTEGER|FLOAT */ - -2, /* (257) minus_num ::= MINUS INTEGER|FLOAT */ - -5, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ - -11, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ - -1, /* (260) trigger_time ::= BEFORE|AFTER */ - -2, /* (261) trigger_time ::= INSTEAD OF */ - 0, /* (262) trigger_time ::= */ - -1, /* (263) trigger_event ::= DELETE|INSERT */ - -1, /* (264) trigger_event ::= UPDATE */ - -3, /* (265) trigger_event ::= UPDATE OF idlist */ - 0, /* (266) when_clause ::= */ - -2, /* (267) when_clause ::= WHEN expr */ - -3, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ - -2, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */ - -3, /* (270) trnm ::= nm DOT nm */ - -3, /* (271) tridxby ::= INDEXED BY nm */ - -2, /* (272) tridxby ::= NOT INDEXED */ - -9, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ - -8, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ - -6, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ - -3, /* (276) trigger_cmd ::= scanpt select scanpt */ - -4, /* (277) expr ::= RAISE LP IGNORE RP */ - -6, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */ - -1, /* (279) raisetype ::= ROLLBACK */ - -1, /* (280) raisetype ::= ABORT */ - -1, /* (281) raisetype ::= FAIL */ - -4, /* (282) cmd ::= DROP TRIGGER ifexists fullname */ - -6, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ - -3, /* (284) cmd ::= DETACH database_kw_opt expr */ - 0, /* (285) key_opt ::= */ - -2, /* (286) key_opt ::= KEY expr */ - -1, /* (287) cmd ::= REINDEX */ - -3, /* (288) cmd ::= REINDEX nm dbnm */ - -1, /* (289) cmd ::= ANALYZE */ - -3, /* (290) cmd ::= ANALYZE nm dbnm */ - -6, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */ - -7, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ - -6, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ - -1, /* (294) add_column_fullname ::= fullname */ - -8, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ - -1, /* (296) cmd ::= create_vtab */ - -4, /* (297) cmd ::= create_vtab LP vtabarglist RP */ - -8, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ - 0, /* (299) vtabarg ::= */ - -1, /* (300) vtabargtoken ::= ANY */ - -3, /* (301) vtabargtoken ::= lp anylist RP */ - -1, /* (302) lp ::= LP */ - -2, /* (303) with ::= WITH wqlist */ - -3, /* (304) with ::= WITH RECURSIVE wqlist */ - -1, /* (305) wqas ::= AS */ - -2, /* (306) wqas ::= AS MATERIALIZED */ - -3, /* (307) wqas ::= AS NOT MATERIALIZED */ - -6, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */ - -1, /* (309) wqlist ::= wqitem */ - -3, /* (310) wqlist ::= wqlist COMMA wqitem */ - -3, /* (311) windowdefn_list ::= windowdefn_list COMMA windowdefn */ - -5, /* (312) windowdefn ::= nm AS LP window RP */ - -5, /* (313) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ - -6, /* (314) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ - -4, /* (315) window ::= ORDER BY sortlist frame_opt */ - -5, /* (316) window ::= nm ORDER BY sortlist frame_opt */ - -2, /* (317) window ::= nm frame_opt */ - 0, /* (318) frame_opt ::= */ - -3, /* (319) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ - -6, /* (320) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ - -1, /* (321) range_or_rows ::= RANGE|ROWS|GROUPS */ - -1, /* (322) frame_bound_s ::= frame_bound */ - -2, /* (323) frame_bound_s ::= UNBOUNDED PRECEDING */ - -1, /* (324) frame_bound_e ::= frame_bound */ - -2, /* (325) frame_bound_e ::= UNBOUNDED FOLLOWING */ - -2, /* (326) frame_bound ::= expr PRECEDING|FOLLOWING */ - -2, /* (327) frame_bound ::= CURRENT ROW */ - 0, /* (328) frame_exclude_opt ::= */ - -2, /* (329) frame_exclude_opt ::= EXCLUDE frame_exclude */ - -2, /* (330) frame_exclude ::= NO OTHERS */ - -2, /* (331) frame_exclude ::= CURRENT ROW */ - -1, /* (332) frame_exclude ::= GROUP|TIES */ - -2, /* (333) window_clause ::= WINDOW windowdefn_list */ - -2, /* (334) filter_over ::= filter_clause over_clause */ - -1, /* (335) filter_over ::= over_clause */ - -1, /* (336) filter_over ::= filter_clause */ - -4, /* (337) over_clause ::= OVER LP window RP */ - -2, /* (338) over_clause ::= OVER nm */ - -5, /* (339) filter_clause ::= FILTER LP WHERE expr RP */ - -1, /* (340) input ::= cmdlist */ - -2, /* (341) cmdlist ::= cmdlist ecmd */ - -1, /* (342) cmdlist ::= ecmd */ - -1, /* (343) ecmd ::= SEMI */ - -2, /* (344) ecmd ::= cmdx SEMI */ - -3, /* (345) ecmd ::= explain cmdx SEMI */ - 0, /* (346) trans_opt ::= */ - -1, /* (347) trans_opt ::= TRANSACTION */ - -2, /* (348) trans_opt ::= TRANSACTION nm */ - -1, /* (349) savepoint_opt ::= SAVEPOINT */ - 0, /* (350) savepoint_opt ::= */ - -2, /* (351) cmd ::= create_table create_table_args */ - -1, /* (352) table_option_set ::= table_option */ - -4, /* (353) columnlist ::= columnlist COMMA columnname carglist */ - -2, /* (354) columnlist ::= columnname carglist */ - -1, /* (355) nm ::= ID|INDEXED|JOIN_KW */ - -1, /* (356) nm ::= STRING */ - -1, /* (357) typetoken ::= typename */ - -1, /* (358) typename ::= ID|STRING */ - -1, /* (359) signed ::= plus_num */ - -1, /* (360) signed ::= minus_num */ - -2, /* (361) carglist ::= carglist ccons */ - 0, /* (362) carglist ::= */ - -2, /* (363) ccons ::= NULL onconf */ - -4, /* (364) ccons ::= GENERATED ALWAYS AS generated */ - -2, /* (365) ccons ::= AS generated */ - -2, /* (366) conslist_opt ::= COMMA conslist */ - -3, /* (367) conslist ::= conslist tconscomma tcons */ - -1, /* (368) conslist ::= tcons */ - 0, /* (369) tconscomma ::= */ - -1, /* (370) defer_subclause_opt ::= defer_subclause */ - -1, /* (371) resolvetype ::= raisetype */ - -1, /* (372) selectnowith ::= oneselect */ - -1, /* (373) oneselect ::= values */ - -2, /* (374) sclp ::= selcollist COMMA */ - -1, /* (375) as ::= ID|STRING */ - -1, /* (376) indexed_opt ::= indexed_by */ - 0, /* (377) returning ::= */ - -1, /* (378) expr ::= term */ - -1, /* (379) likeop ::= LIKE_KW|MATCH */ - -1, /* (380) case_operand ::= expr */ - -1, /* (381) exprlist ::= nexprlist */ - -1, /* (382) nmnum ::= plus_num */ - -1, /* (383) nmnum ::= nm */ - -1, /* (384) nmnum ::= ON */ - -1, /* (385) nmnum ::= DELETE */ - -1, /* (386) nmnum ::= DEFAULT */ - -1, /* (387) plus_num ::= INTEGER|FLOAT */ - 0, /* (388) foreach_clause ::= */ - -3, /* (389) foreach_clause ::= FOR EACH ROW */ - -1, /* (390) trnm ::= nm */ - 0, /* (391) tridxby ::= */ - -1, /* (392) database_kw_opt ::= DATABASE */ - 0, /* (393) database_kw_opt ::= */ - 0, /* (394) kwcolumn_opt ::= */ - -1, /* (395) kwcolumn_opt ::= COLUMNKW */ - -1, /* (396) vtabarglist ::= vtabarg */ - -3, /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */ - -2, /* (398) vtabarg ::= vtabarg vtabargtoken */ - 0, /* (399) anylist ::= */ - -4, /* (400) anylist ::= anylist LP anylist RP */ - -2, /* (401) anylist ::= anylist ANY */ - 0, /* (402) with ::= */ - -1, /* (403) windowdefn_list ::= windowdefn */ - -1, /* (404) window ::= frame_opt */ + -1, /* (95) oneselect ::= mvalues */ + -5, /* (96) mvalues ::= values COMMA LP nexprlist RP */ + -5, /* (97) mvalues ::= mvalues COMMA LP nexprlist RP */ + -1, /* (98) distinct ::= DISTINCT */ + -1, /* (99) distinct ::= ALL */ + 0, /* (100) distinct ::= */ + 0, /* (101) sclp ::= */ + -5, /* (102) selcollist ::= sclp scanpt expr scanpt as */ + -3, /* (103) selcollist ::= sclp scanpt STAR */ + -5, /* (104) selcollist ::= sclp scanpt nm DOT STAR */ + -2, /* (105) as ::= AS nm */ + 0, /* (106) as ::= */ + 0, /* (107) from ::= */ + -2, /* (108) from ::= FROM seltablist */ + -2, /* (109) stl_prefix ::= seltablist joinop */ + 0, /* (110) stl_prefix ::= */ + -5, /* (111) seltablist ::= stl_prefix nm dbnm as on_using */ + -6, /* (112) seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ + -8, /* (113) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ + -6, /* (114) seltablist ::= stl_prefix LP select RP as on_using */ + -6, /* (115) seltablist ::= stl_prefix LP seltablist RP as on_using */ + 0, /* (116) dbnm ::= */ + -2, /* (117) dbnm ::= DOT nm */ + -1, /* (118) fullname ::= nm */ + -3, /* (119) fullname ::= nm DOT nm */ + -1, /* (120) xfullname ::= nm */ + -3, /* (121) xfullname ::= nm DOT nm */ + -5, /* (122) xfullname ::= nm DOT nm AS nm */ + -3, /* (123) xfullname ::= nm AS nm */ + -1, /* (124) joinop ::= COMMA|JOIN */ + -2, /* (125) joinop ::= JOIN_KW JOIN */ + -3, /* (126) joinop ::= JOIN_KW nm JOIN */ + -4, /* (127) joinop ::= JOIN_KW nm nm JOIN */ + -2, /* (128) on_using ::= ON expr */ + -4, /* (129) on_using ::= USING LP idlist RP */ + 0, /* (130) on_using ::= */ + 0, /* (131) indexed_opt ::= */ + -3, /* (132) indexed_by ::= INDEXED BY nm */ + -2, /* (133) indexed_by ::= NOT INDEXED */ + 0, /* (134) orderby_opt ::= */ + -3, /* (135) orderby_opt ::= ORDER BY sortlist */ + -5, /* (136) sortlist ::= sortlist COMMA expr sortorder nulls */ + -3, /* (137) sortlist ::= expr sortorder nulls */ + -1, /* (138) sortorder ::= ASC */ + -1, /* (139) sortorder ::= DESC */ + 0, /* (140) sortorder ::= */ + -2, /* (141) nulls ::= NULLS FIRST */ + -2, /* (142) nulls ::= NULLS LAST */ + 0, /* (143) nulls ::= */ + 0, /* (144) groupby_opt ::= */ + -3, /* (145) groupby_opt ::= GROUP BY nexprlist */ + 0, /* (146) having_opt ::= */ + -2, /* (147) having_opt ::= HAVING expr */ + 0, /* (148) limit_opt ::= */ + -2, /* (149) limit_opt ::= LIMIT expr */ + -4, /* (150) limit_opt ::= LIMIT expr OFFSET expr */ + -4, /* (151) limit_opt ::= LIMIT expr COMMA expr */ + -6, /* (152) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ + 0, /* (153) where_opt ::= */ + -2, /* (154) where_opt ::= WHERE expr */ + 0, /* (155) where_opt_ret ::= */ + -2, /* (156) where_opt_ret ::= WHERE expr */ + -2, /* (157) where_opt_ret ::= RETURNING selcollist */ + -4, /* (158) where_opt_ret ::= WHERE expr RETURNING selcollist */ + -9, /* (159) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ + -5, /* (160) setlist ::= setlist COMMA nm EQ expr */ + -7, /* (161) setlist ::= setlist COMMA LP idlist RP EQ expr */ + -3, /* (162) setlist ::= nm EQ expr */ + -5, /* (163) setlist ::= LP idlist RP EQ expr */ + -7, /* (164) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ + -8, /* (165) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ + 0, /* (166) upsert ::= */ + -2, /* (167) upsert ::= RETURNING selcollist */ + -12, /* (168) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ + -9, /* (169) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ + -5, /* (170) upsert ::= ON CONFLICT DO NOTHING returning */ + -8, /* (171) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ + -2, /* (172) returning ::= RETURNING selcollist */ + -2, /* (173) insert_cmd ::= INSERT orconf */ + -1, /* (174) insert_cmd ::= REPLACE */ + 0, /* (175) idlist_opt ::= */ + -3, /* (176) idlist_opt ::= LP idlist RP */ + -3, /* (177) idlist ::= idlist COMMA nm */ + -1, /* (178) idlist ::= nm */ + -3, /* (179) expr ::= LP expr RP */ + -1, /* (180) expr ::= ID|INDEXED|JOIN_KW */ + -3, /* (181) expr ::= nm DOT nm */ + -5, /* (182) expr ::= nm DOT nm DOT nm */ + -1, /* (183) term ::= NULL|FLOAT|BLOB */ + -1, /* (184) term ::= STRING */ + -1, /* (185) term ::= INTEGER */ + -1, /* (186) expr ::= VARIABLE */ + -3, /* (187) expr ::= expr COLLATE ID|STRING */ + -6, /* (188) expr ::= CAST LP expr AS typetoken RP */ + -5, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ + -8, /* (190) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ + -4, /* (191) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ + -6, /* (192) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ + -9, /* (193) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ + -5, /* (194) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ + -1, /* (195) term ::= CTIME_KW */ + -5, /* (196) expr ::= LP nexprlist COMMA expr RP */ + -3, /* (197) expr ::= expr AND expr */ + -3, /* (198) expr ::= expr OR expr */ + -3, /* (199) expr ::= expr LT|GT|GE|LE expr */ + -3, /* (200) expr ::= expr EQ|NE expr */ + -3, /* (201) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ + -3, /* (202) expr ::= expr PLUS|MINUS expr */ + -3, /* (203) expr ::= expr STAR|SLASH|REM expr */ + -3, /* (204) expr ::= expr CONCAT expr */ + -2, /* (205) likeop ::= NOT LIKE_KW|MATCH */ + -3, /* (206) expr ::= expr likeop expr */ + -5, /* (207) expr ::= expr likeop expr ESCAPE expr */ + -2, /* (208) expr ::= expr ISNULL|NOTNULL */ + -3, /* (209) expr ::= expr NOT NULL */ + -3, /* (210) expr ::= expr IS expr */ + -4, /* (211) expr ::= expr IS NOT expr */ + -6, /* (212) expr ::= expr IS NOT DISTINCT FROM expr */ + -5, /* (213) expr ::= expr IS DISTINCT FROM expr */ + -2, /* (214) expr ::= NOT expr */ + -2, /* (215) expr ::= BITNOT expr */ + -2, /* (216) expr ::= PLUS|MINUS expr */ + -3, /* (217) expr ::= expr PTR expr */ + -1, /* (218) between_op ::= BETWEEN */ + -2, /* (219) between_op ::= NOT BETWEEN */ + -5, /* (220) expr ::= expr between_op expr AND expr */ + -1, /* (221) in_op ::= IN */ + -2, /* (222) in_op ::= NOT IN */ + -5, /* (223) expr ::= expr in_op LP exprlist RP */ + -3, /* (224) expr ::= LP select RP */ + -5, /* (225) expr ::= expr in_op LP select RP */ + -5, /* (226) expr ::= expr in_op nm dbnm paren_exprlist */ + -4, /* (227) expr ::= EXISTS LP select RP */ + -5, /* (228) expr ::= CASE case_operand case_exprlist case_else END */ + -5, /* (229) case_exprlist ::= case_exprlist WHEN expr THEN expr */ + -4, /* (230) case_exprlist ::= WHEN expr THEN expr */ + -2, /* (231) case_else ::= ELSE expr */ + 0, /* (232) case_else ::= */ + 0, /* (233) case_operand ::= */ + 0, /* (234) exprlist ::= */ + -3, /* (235) nexprlist ::= nexprlist COMMA expr */ + -1, /* (236) nexprlist ::= expr */ + 0, /* (237) paren_exprlist ::= */ + -3, /* (238) paren_exprlist ::= LP exprlist RP */ + -12, /* (239) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ + -1, /* (240) uniqueflag ::= UNIQUE */ + 0, /* (241) uniqueflag ::= */ + 0, /* (242) eidlist_opt ::= */ + -3, /* (243) eidlist_opt ::= LP eidlist RP */ + -5, /* (244) eidlist ::= eidlist COMMA nm collate sortorder */ + -3, /* (245) eidlist ::= nm collate sortorder */ + 0, /* (246) collate ::= */ + -2, /* (247) collate ::= COLLATE ID|STRING */ + -4, /* (248) cmd ::= DROP INDEX ifexists fullname */ + -2, /* (249) cmd ::= VACUUM vinto */ + -3, /* (250) cmd ::= VACUUM nm vinto */ + -2, /* (251) vinto ::= INTO expr */ + 0, /* (252) vinto ::= */ + -3, /* (253) cmd ::= PRAGMA nm dbnm */ + -5, /* (254) cmd ::= PRAGMA nm dbnm EQ nmnum */ + -6, /* (255) cmd ::= PRAGMA nm dbnm LP nmnum RP */ + -5, /* (256) cmd ::= PRAGMA nm dbnm EQ minus_num */ + -6, /* (257) cmd ::= PRAGMA nm dbnm LP minus_num RP */ + -2, /* (258) plus_num ::= PLUS INTEGER|FLOAT */ + -2, /* (259) minus_num ::= MINUS INTEGER|FLOAT */ + -5, /* (260) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ + -11, /* (261) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ + -1, /* (262) trigger_time ::= BEFORE|AFTER */ + -2, /* (263) trigger_time ::= INSTEAD OF */ + 0, /* (264) trigger_time ::= */ + -1, /* (265) trigger_event ::= DELETE|INSERT */ + -1, /* (266) trigger_event ::= UPDATE */ + -3, /* (267) trigger_event ::= UPDATE OF idlist */ + 0, /* (268) when_clause ::= */ + -2, /* (269) when_clause ::= WHEN expr */ + -3, /* (270) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ + -2, /* (271) trigger_cmd_list ::= trigger_cmd SEMI */ + -3, /* (272) trnm ::= nm DOT nm */ + -3, /* (273) tridxby ::= INDEXED BY nm */ + -2, /* (274) tridxby ::= NOT INDEXED */ + -9, /* (275) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ + -8, /* (276) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ + -6, /* (277) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ + -3, /* (278) trigger_cmd ::= scanpt select scanpt */ + -4, /* (279) expr ::= RAISE LP IGNORE RP */ + -6, /* (280) expr ::= RAISE LP raisetype COMMA nm RP */ + -1, /* (281) raisetype ::= ROLLBACK */ + -1, /* (282) raisetype ::= ABORT */ + -1, /* (283) raisetype ::= FAIL */ + -4, /* (284) cmd ::= DROP TRIGGER ifexists fullname */ + -6, /* (285) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ + -3, /* (286) cmd ::= DETACH database_kw_opt expr */ + 0, /* (287) key_opt ::= */ + -2, /* (288) key_opt ::= KEY expr */ + -1, /* (289) cmd ::= REINDEX */ + -3, /* (290) cmd ::= REINDEX nm dbnm */ + -1, /* (291) cmd ::= ANALYZE */ + -3, /* (292) cmd ::= ANALYZE nm dbnm */ + -6, /* (293) cmd ::= ALTER TABLE fullname RENAME TO nm */ + -7, /* (294) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ + -6, /* (295) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ + -1, /* (296) add_column_fullname ::= fullname */ + -8, /* (297) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ + -1, /* (298) cmd ::= create_vtab */ + -4, /* (299) cmd ::= create_vtab LP vtabarglist RP */ + -8, /* (300) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ + 0, /* (301) vtabarg ::= */ + -1, /* (302) vtabargtoken ::= ANY */ + -3, /* (303) vtabargtoken ::= lp anylist RP */ + -1, /* (304) lp ::= LP */ + -2, /* (305) with ::= WITH wqlist */ + -3, /* (306) with ::= WITH RECURSIVE wqlist */ + -1, /* (307) wqas ::= AS */ + -2, /* (308) wqas ::= AS MATERIALIZED */ + -3, /* (309) wqas ::= AS NOT MATERIALIZED */ + -6, /* (310) wqitem ::= withnm eidlist_opt wqas LP select RP */ + -1, /* (311) withnm ::= nm */ + -1, /* (312) wqlist ::= wqitem */ + -3, /* (313) wqlist ::= wqlist COMMA wqitem */ + -3, /* (314) windowdefn_list ::= windowdefn_list COMMA windowdefn */ + -5, /* (315) windowdefn ::= nm AS LP window RP */ + -5, /* (316) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ + -6, /* (317) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ + -4, /* (318) window ::= ORDER BY sortlist frame_opt */ + -5, /* (319) window ::= nm ORDER BY sortlist frame_opt */ + -2, /* (320) window ::= nm frame_opt */ + 0, /* (321) frame_opt ::= */ + -3, /* (322) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ + -6, /* (323) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ + -1, /* (324) range_or_rows ::= RANGE|ROWS|GROUPS */ + -1, /* (325) frame_bound_s ::= frame_bound */ + -2, /* (326) frame_bound_s ::= UNBOUNDED PRECEDING */ + -1, /* (327) frame_bound_e ::= frame_bound */ + -2, /* (328) frame_bound_e ::= UNBOUNDED FOLLOWING */ + -2, /* (329) frame_bound ::= expr PRECEDING|FOLLOWING */ + -2, /* (330) frame_bound ::= CURRENT ROW */ + 0, /* (331) frame_exclude_opt ::= */ + -2, /* (332) frame_exclude_opt ::= EXCLUDE frame_exclude */ + -2, /* (333) frame_exclude ::= NO OTHERS */ + -2, /* (334) frame_exclude ::= CURRENT ROW */ + -1, /* (335) frame_exclude ::= GROUP|TIES */ + -2, /* (336) window_clause ::= WINDOW windowdefn_list */ + -2, /* (337) filter_over ::= filter_clause over_clause */ + -1, /* (338) filter_over ::= over_clause */ + -1, /* (339) filter_over ::= filter_clause */ + -4, /* (340) over_clause ::= OVER LP window RP */ + -2, /* (341) over_clause ::= OVER nm */ + -5, /* (342) filter_clause ::= FILTER LP WHERE expr RP */ + -1, /* (343) term ::= QNUMBER */ + -1, /* (344) input ::= cmdlist */ + -2, /* (345) cmdlist ::= cmdlist ecmd */ + -1, /* (346) cmdlist ::= ecmd */ + -1, /* (347) ecmd ::= SEMI */ + -2, /* (348) ecmd ::= cmdx SEMI */ + -3, /* (349) ecmd ::= explain cmdx SEMI */ + 0, /* (350) trans_opt ::= */ + -1, /* (351) trans_opt ::= TRANSACTION */ + -2, /* (352) trans_opt ::= TRANSACTION nm */ + -1, /* (353) savepoint_opt ::= SAVEPOINT */ + 0, /* (354) savepoint_opt ::= */ + -2, /* (355) cmd ::= create_table create_table_args */ + -1, /* (356) table_option_set ::= table_option */ + -4, /* (357) columnlist ::= columnlist COMMA columnname carglist */ + -2, /* (358) columnlist ::= columnname carglist */ + -1, /* (359) nm ::= ID|INDEXED|JOIN_KW */ + -1, /* (360) nm ::= STRING */ + -1, /* (361) typetoken ::= typename */ + -1, /* (362) typename ::= ID|STRING */ + -1, /* (363) signed ::= plus_num */ + -1, /* (364) signed ::= minus_num */ + -2, /* (365) carglist ::= carglist ccons */ + 0, /* (366) carglist ::= */ + -2, /* (367) ccons ::= NULL onconf */ + -4, /* (368) ccons ::= GENERATED ALWAYS AS generated */ + -2, /* (369) ccons ::= AS generated */ + -2, /* (370) conslist_opt ::= COMMA conslist */ + -3, /* (371) conslist ::= conslist tconscomma tcons */ + -1, /* (372) conslist ::= tcons */ + 0, /* (373) tconscomma ::= */ + -1, /* (374) defer_subclause_opt ::= defer_subclause */ + -1, /* (375) resolvetype ::= raisetype */ + -1, /* (376) selectnowith ::= oneselect */ + -1, /* (377) oneselect ::= values */ + -2, /* (378) sclp ::= selcollist COMMA */ + -1, /* (379) as ::= ID|STRING */ + -1, /* (380) indexed_opt ::= indexed_by */ + 0, /* (381) returning ::= */ + -1, /* (382) expr ::= term */ + -1, /* (383) likeop ::= LIKE_KW|MATCH */ + -1, /* (384) case_operand ::= expr */ + -1, /* (385) exprlist ::= nexprlist */ + -1, /* (386) nmnum ::= plus_num */ + -1, /* (387) nmnum ::= nm */ + -1, /* (388) nmnum ::= ON */ + -1, /* (389) nmnum ::= DELETE */ + -1, /* (390) nmnum ::= DEFAULT */ + -1, /* (391) plus_num ::= INTEGER|FLOAT */ + 0, /* (392) foreach_clause ::= */ + -3, /* (393) foreach_clause ::= FOR EACH ROW */ + -1, /* (394) trnm ::= nm */ + 0, /* (395) tridxby ::= */ + -1, /* (396) database_kw_opt ::= DATABASE */ + 0, /* (397) database_kw_opt ::= */ + 0, /* (398) kwcolumn_opt ::= */ + -1, /* (399) kwcolumn_opt ::= COLUMNKW */ + -1, /* (400) vtabarglist ::= vtabarg */ + -3, /* (401) vtabarglist ::= vtabarglist COMMA vtabarg */ + -2, /* (402) vtabarg ::= vtabarg vtabargtoken */ + 0, /* (403) anylist ::= */ + -4, /* (404) anylist ::= anylist LP anylist RP */ + -2, /* (405) anylist ::= anylist ANY */ + 0, /* (406) with ::= */ + -1, /* (407) windowdefn_list ::= windowdefn */ + -1, /* (408) window ::= frame_opt */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -174505,16 +176117,16 @@ static YYACTIONTYPE yy_reduce( { sqlite3FinishCoding(pParse); } break; case 3: /* cmd ::= BEGIN transtype trans_opt */ -{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy394);} +{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy144);} break; case 4: /* transtype ::= */ -{yymsp[1].minor.yy394 = TK_DEFERRED;} +{yymsp[1].minor.yy144 = TK_DEFERRED;} break; case 5: /* transtype ::= DEFERRED */ case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6); case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7); - case 321: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==321); -{yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/} + case 324: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==324); +{yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-X*/} break; case 8: /* cmd ::= COMMIT|END trans_opt */ case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9); @@ -174537,7 +176149,7 @@ static YYACTIONTYPE yy_reduce( break; case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ { - sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy394,0,0,yymsp[-2].minor.yy394); + sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy144,0,0,yymsp[-2].minor.yy144); } break; case 14: /* createkw ::= CREATE */ @@ -174549,40 +176161,40 @@ static YYACTIONTYPE yy_reduce( case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62); case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72); case 81: /* ifexists ::= */ yytestcase(yyruleno==81); - case 98: /* distinct ::= */ yytestcase(yyruleno==98); - case 244: /* collate ::= */ yytestcase(yyruleno==244); -{yymsp[1].minor.yy394 = 0;} + case 100: /* distinct ::= */ yytestcase(yyruleno==100); + case 246: /* collate ::= */ yytestcase(yyruleno==246); +{yymsp[1].minor.yy144 = 0;} break; case 16: /* ifnotexists ::= IF NOT EXISTS */ -{yymsp[-2].minor.yy394 = 1;} +{yymsp[-2].minor.yy144 = 1;} break; case 17: /* temp ::= TEMP */ -{yymsp[0].minor.yy394 = pParse->db->init.busy==0;} +{yymsp[0].minor.yy144 = pParse->db->init.busy==0;} break; case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ { - sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy285,0); + sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy391,0); } break; case 20: /* create_table_args ::= AS select */ { - sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy47); - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy47); + sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy555); + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy555); } break; case 21: /* table_option_set ::= */ -{yymsp[1].minor.yy285 = 0;} +{yymsp[1].minor.yy391 = 0;} break; case 22: /* table_option_set ::= table_option_set COMMA table_option */ -{yylhsminor.yy285 = yymsp[-2].minor.yy285|yymsp[0].minor.yy285;} - yymsp[-2].minor.yy285 = yylhsminor.yy285; +{yylhsminor.yy391 = yymsp[-2].minor.yy391|yymsp[0].minor.yy391;} + yymsp[-2].minor.yy391 = yylhsminor.yy391; break; case 23: /* table_option ::= WITHOUT nm */ { if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){ - yymsp[-1].minor.yy285 = TF_WithoutRowid | TF_NoVisibleRowid; + yymsp[-1].minor.yy391 = TF_WithoutRowid | TF_NoVisibleRowid; }else{ - yymsp[-1].minor.yy285 = 0; + yymsp[-1].minor.yy391 = 0; sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); } } @@ -174590,20 +176202,20 @@ static YYACTIONTYPE yy_reduce( case 24: /* table_option ::= nm */ { if( yymsp[0].minor.yy0.n==6 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"strict",6)==0 ){ - yylhsminor.yy285 = TF_Strict; + yylhsminor.yy391 = TF_Strict; }else{ - yylhsminor.yy285 = 0; + yylhsminor.yy391 = 0; sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); } } - yymsp[0].minor.yy285 = yylhsminor.yy285; + yymsp[0].minor.yy391 = yylhsminor.yy391; break; case 25: /* columnname ::= nm typetoken */ {sqlite3AddColumn(pParse,yymsp[-1].minor.yy0,yymsp[0].minor.yy0);} break; case 26: /* typetoken ::= */ case 65: /* conslist_opt ::= */ yytestcase(yyruleno==65); - case 104: /* as ::= */ yytestcase(yyruleno==104); + case 106: /* as ::= */ yytestcase(yyruleno==106); {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;} break; case 27: /* typetoken ::= typename LP signed RP */ @@ -174622,7 +176234,7 @@ static YYACTIONTYPE yy_reduce( case 30: /* scanpt ::= */ { assert( yyLookahead!=YYNOCODE ); - yymsp[1].minor.yy522 = yyLookaheadToken.z; + yymsp[1].minor.yy168 = yyLookaheadToken.z; } break; case 31: /* scantok ::= */ @@ -174636,17 +176248,17 @@ static YYACTIONTYPE yy_reduce( {pParse->constraintName = yymsp[0].minor.yy0;} break; case 33: /* ccons ::= DEFAULT scantok term */ -{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy528,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} +{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} break; case 34: /* ccons ::= DEFAULT LP expr RP */ -{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy528,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);} +{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);} break; case 35: /* ccons ::= DEFAULT PLUS scantok term */ -{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy528,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} +{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} break; case 36: /* ccons ::= DEFAULT MINUS scantok term */ { - Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy528, 0); + Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy454, 0); sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]); } break; @@ -174661,151 +176273,151 @@ static YYACTIONTYPE yy_reduce( } break; case 38: /* ccons ::= NOT NULL onconf */ -{sqlite3AddNotNull(pParse, yymsp[0].minor.yy394);} +{sqlite3AddNotNull(pParse, yymsp[0].minor.yy144);} break; case 39: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ -{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy394,yymsp[0].minor.yy394,yymsp[-2].minor.yy394);} +{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy144,yymsp[0].minor.yy144,yymsp[-2].minor.yy144);} break; case 40: /* ccons ::= UNIQUE onconf */ -{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy394,0,0,0,0, +{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy144,0,0,0,0, SQLITE_IDXTYPE_UNIQUE);} break; case 41: /* ccons ::= CHECK LP expr RP */ -{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy528,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);} +{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);} break; case 42: /* ccons ::= REFERENCES nm eidlist_opt refargs */ -{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy322,yymsp[0].minor.yy394);} +{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy14,yymsp[0].minor.yy144);} break; case 43: /* ccons ::= defer_subclause */ -{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy394);} +{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy144);} break; case 44: /* ccons ::= COLLATE ID|STRING */ {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);} break; case 45: /* generated ::= LP expr RP */ -{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy528,0);} +{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy454,0);} break; case 46: /* generated ::= LP expr RP ID */ -{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy528,&yymsp[0].minor.yy0);} +{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy454,&yymsp[0].minor.yy0);} break; case 48: /* autoinc ::= AUTOINCR */ -{yymsp[0].minor.yy394 = 1;} +{yymsp[0].minor.yy144 = 1;} break; case 49: /* refargs ::= */ -{ yymsp[1].minor.yy394 = OE_None*0x0101; /* EV: R-19803-45884 */} +{ yymsp[1].minor.yy144 = OE_None*0x0101; /* EV: R-19803-45884 */} break; case 50: /* refargs ::= refargs refarg */ -{ yymsp[-1].minor.yy394 = (yymsp[-1].minor.yy394 & ~yymsp[0].minor.yy231.mask) | yymsp[0].minor.yy231.value; } +{ yymsp[-1].minor.yy144 = (yymsp[-1].minor.yy144 & ~yymsp[0].minor.yy383.mask) | yymsp[0].minor.yy383.value; } break; case 51: /* refarg ::= MATCH nm */ -{ yymsp[-1].minor.yy231.value = 0; yymsp[-1].minor.yy231.mask = 0x000000; } +{ yymsp[-1].minor.yy383.value = 0; yymsp[-1].minor.yy383.mask = 0x000000; } break; case 52: /* refarg ::= ON INSERT refact */ -{ yymsp[-2].minor.yy231.value = 0; yymsp[-2].minor.yy231.mask = 0x000000; } +{ yymsp[-2].minor.yy383.value = 0; yymsp[-2].minor.yy383.mask = 0x000000; } break; case 53: /* refarg ::= ON DELETE refact */ -{ yymsp[-2].minor.yy231.value = yymsp[0].minor.yy394; yymsp[-2].minor.yy231.mask = 0x0000ff; } +{ yymsp[-2].minor.yy383.value = yymsp[0].minor.yy144; yymsp[-2].minor.yy383.mask = 0x0000ff; } break; case 54: /* refarg ::= ON UPDATE refact */ -{ yymsp[-2].minor.yy231.value = yymsp[0].minor.yy394<<8; yymsp[-2].minor.yy231.mask = 0x00ff00; } +{ yymsp[-2].minor.yy383.value = yymsp[0].minor.yy144<<8; yymsp[-2].minor.yy383.mask = 0x00ff00; } break; case 55: /* refact ::= SET NULL */ -{ yymsp[-1].minor.yy394 = OE_SetNull; /* EV: R-33326-45252 */} +{ yymsp[-1].minor.yy144 = OE_SetNull; /* EV: R-33326-45252 */} break; case 56: /* refact ::= SET DEFAULT */ -{ yymsp[-1].minor.yy394 = OE_SetDflt; /* EV: R-33326-45252 */} +{ yymsp[-1].minor.yy144 = OE_SetDflt; /* EV: R-33326-45252 */} break; case 57: /* refact ::= CASCADE */ -{ yymsp[0].minor.yy394 = OE_Cascade; /* EV: R-33326-45252 */} +{ yymsp[0].minor.yy144 = OE_Cascade; /* EV: R-33326-45252 */} break; case 58: /* refact ::= RESTRICT */ -{ yymsp[0].minor.yy394 = OE_Restrict; /* EV: R-33326-45252 */} +{ yymsp[0].minor.yy144 = OE_Restrict; /* EV: R-33326-45252 */} break; case 59: /* refact ::= NO ACTION */ -{ yymsp[-1].minor.yy394 = OE_None; /* EV: R-33326-45252 */} +{ yymsp[-1].minor.yy144 = OE_None; /* EV: R-33326-45252 */} break; case 60: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ -{yymsp[-2].minor.yy394 = 0;} +{yymsp[-2].minor.yy144 = 0;} break; case 61: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ case 76: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==76); - case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171); -{yymsp[-1].minor.yy394 = yymsp[0].minor.yy394;} + case 173: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==173); +{yymsp[-1].minor.yy144 = yymsp[0].minor.yy144;} break; case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80); - case 217: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==217); - case 220: /* in_op ::= NOT IN */ yytestcase(yyruleno==220); - case 245: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==245); -{yymsp[-1].minor.yy394 = 1;} + case 219: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==219); + case 222: /* in_op ::= NOT IN */ yytestcase(yyruleno==222); + case 247: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==247); +{yymsp[-1].minor.yy144 = 1;} break; case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ -{yymsp[-1].minor.yy394 = 0;} +{yymsp[-1].minor.yy144 = 0;} break; case 66: /* tconscomma ::= COMMA */ {pParse->constraintName.n = 0;} break; case 68: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ -{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy322,yymsp[0].minor.yy394,yymsp[-2].minor.yy394,0);} +{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy14,yymsp[0].minor.yy144,yymsp[-2].minor.yy144,0);} break; case 69: /* tcons ::= UNIQUE LP sortlist RP onconf */ -{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy322,yymsp[0].minor.yy394,0,0,0,0, +{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy14,yymsp[0].minor.yy144,0,0,0,0, SQLITE_IDXTYPE_UNIQUE);} break; case 70: /* tcons ::= CHECK LP expr RP onconf */ -{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy528,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);} +{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy454,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);} break; case 71: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ { - sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy322, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[-1].minor.yy394); - sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy394); + sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy14, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy14, yymsp[-1].minor.yy144); + sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy144); } break; case 73: /* onconf ::= */ case 75: /* orconf ::= */ yytestcase(yyruleno==75); -{yymsp[1].minor.yy394 = OE_Default;} +{yymsp[1].minor.yy144 = OE_Default;} break; case 74: /* onconf ::= ON CONFLICT resolvetype */ -{yymsp[-2].minor.yy394 = yymsp[0].minor.yy394;} +{yymsp[-2].minor.yy144 = yymsp[0].minor.yy144;} break; case 77: /* resolvetype ::= IGNORE */ -{yymsp[0].minor.yy394 = OE_Ignore;} +{yymsp[0].minor.yy144 = OE_Ignore;} break; case 78: /* resolvetype ::= REPLACE */ - case 172: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==172); -{yymsp[0].minor.yy394 = OE_Replace;} + case 174: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==174); +{yymsp[0].minor.yy144 = OE_Replace;} break; case 79: /* cmd ::= DROP TABLE ifexists fullname */ { - sqlite3DropTable(pParse, yymsp[0].minor.yy131, 0, yymsp[-1].minor.yy394); + sqlite3DropTable(pParse, yymsp[0].minor.yy203, 0, yymsp[-1].minor.yy144); } break; case 82: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ { - sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[0].minor.yy47, yymsp[-7].minor.yy394, yymsp[-5].minor.yy394); + sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy14, yymsp[0].minor.yy555, yymsp[-7].minor.yy144, yymsp[-5].minor.yy144); } break; case 83: /* cmd ::= DROP VIEW ifexists fullname */ { - sqlite3DropTable(pParse, yymsp[0].minor.yy131, 1, yymsp[-1].minor.yy394); + sqlite3DropTable(pParse, yymsp[0].minor.yy203, 1, yymsp[-1].minor.yy144); } break; case 84: /* cmd ::= select */ { SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0}; - sqlite3Select(pParse, yymsp[0].minor.yy47, &dest); - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy47); + sqlite3Select(pParse, yymsp[0].minor.yy555, &dest); + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy555); } break; case 85: /* select ::= WITH wqlist selectnowith */ -{yymsp[-2].minor.yy47 = attachWithToSelect(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy521);} +{yymsp[-2].minor.yy555 = attachWithToSelect(pParse,yymsp[0].minor.yy555,yymsp[-1].minor.yy59);} break; case 86: /* select ::= WITH RECURSIVE wqlist selectnowith */ -{yymsp[-3].minor.yy47 = attachWithToSelect(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy521);} +{yymsp[-3].minor.yy555 = attachWithToSelect(pParse,yymsp[0].minor.yy555,yymsp[-1].minor.yy59);} break; case 87: /* select ::= selectnowith */ { - Select *p = yymsp[0].minor.yy47; + Select *p = yymsp[0].minor.yy555; if( p ){ parserDoubleLinkSelect(pParse, p); } @@ -174813,8 +176425,8 @@ static YYACTIONTYPE yy_reduce( break; case 88: /* selectnowith ::= selectnowith multiselect_op oneselect */ { - Select *pRhs = yymsp[0].minor.yy47; - Select *pLhs = yymsp[-2].minor.yy47; + Select *pRhs = yymsp[0].minor.yy555; + Select *pLhs = yymsp[-2].minor.yy555; if( pRhs && pRhs->pPrior ){ SrcList *pFrom; Token x; @@ -174824,148 +176436,145 @@ static YYACTIONTYPE yy_reduce( pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0); } if( pRhs ){ - pRhs->op = (u8)yymsp[-1].minor.yy394; + pRhs->op = (u8)yymsp[-1].minor.yy144; pRhs->pPrior = pLhs; if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue; pRhs->selFlags &= ~SF_MultiValue; - if( yymsp[-1].minor.yy394!=TK_ALL ) pParse->hasCompound = 1; + if( yymsp[-1].minor.yy144!=TK_ALL ) pParse->hasCompound = 1; }else{ sqlite3SelectDelete(pParse->db, pLhs); } - yymsp[-2].minor.yy47 = pRhs; + yymsp[-2].minor.yy555 = pRhs; } break; case 89: /* multiselect_op ::= UNION */ case 91: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==91); -{yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-OP*/} +{yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-OP*/} break; case 90: /* multiselect_op ::= UNION ALL */ -{yymsp[-1].minor.yy394 = TK_ALL;} +{yymsp[-1].minor.yy144 = TK_ALL;} break; case 92: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ { - yymsp[-8].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy322,yymsp[-5].minor.yy131,yymsp[-4].minor.yy528,yymsp[-3].minor.yy322,yymsp[-2].minor.yy528,yymsp[-1].minor.yy322,yymsp[-7].minor.yy394,yymsp[0].minor.yy528); + yymsp[-8].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy14,yymsp[-5].minor.yy203,yymsp[-4].minor.yy454,yymsp[-3].minor.yy14,yymsp[-2].minor.yy454,yymsp[-1].minor.yy14,yymsp[-7].minor.yy144,yymsp[0].minor.yy454); } break; case 93: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ { - yymsp[-9].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy322,yymsp[-6].minor.yy131,yymsp[-5].minor.yy528,yymsp[-4].minor.yy322,yymsp[-3].minor.yy528,yymsp[-1].minor.yy322,yymsp[-8].minor.yy394,yymsp[0].minor.yy528); - if( yymsp[-9].minor.yy47 ){ - yymsp[-9].minor.yy47->pWinDefn = yymsp[-2].minor.yy41; + yymsp[-9].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy14,yymsp[-6].minor.yy203,yymsp[-5].minor.yy454,yymsp[-4].minor.yy14,yymsp[-3].minor.yy454,yymsp[-1].minor.yy14,yymsp[-8].minor.yy144,yymsp[0].minor.yy454); + if( yymsp[-9].minor.yy555 ){ + yymsp[-9].minor.yy555->pWinDefn = yymsp[-2].minor.yy211; }else{ - sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy41); + sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy211); } } break; case 94: /* values ::= VALUES LP nexprlist RP */ { - yymsp[-3].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values,0); + yymsp[-3].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy14,0,0,0,0,0,SF_Values,0); } break; - case 95: /* values ::= values COMMA LP nexprlist RP */ + case 95: /* oneselect ::= mvalues */ { - Select *pRight, *pLeft = yymsp[-4].minor.yy47; - pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values|SF_MultiValue,0); - if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue; - if( pRight ){ - pRight->op = TK_ALL; - pRight->pPrior = pLeft; - yymsp[-4].minor.yy47 = pRight; - }else{ - yymsp[-4].minor.yy47 = pLeft; - } + sqlite3MultiValuesEnd(pParse, yymsp[0].minor.yy555); } break; - case 96: /* distinct ::= DISTINCT */ -{yymsp[0].minor.yy394 = SF_Distinct;} - break; - case 97: /* distinct ::= ALL */ -{yymsp[0].minor.yy394 = SF_All;} - break; - case 99: /* sclp ::= */ - case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132); - case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142); - case 232: /* exprlist ::= */ yytestcase(yyruleno==232); - case 235: /* paren_exprlist ::= */ yytestcase(yyruleno==235); - case 240: /* eidlist_opt ::= */ yytestcase(yyruleno==240); -{yymsp[1].minor.yy322 = 0;} - break; - case 100: /* selcollist ::= sclp scanpt expr scanpt as */ + case 96: /* mvalues ::= values COMMA LP nexprlist RP */ + case 97: /* mvalues ::= mvalues COMMA LP nexprlist RP */ yytestcase(yyruleno==97); { - yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy528); - if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[0].minor.yy0, 1); - sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy322,yymsp[-3].minor.yy522,yymsp[-1].minor.yy522); + yymsp[-4].minor.yy555 = sqlite3MultiValues(pParse, yymsp[-4].minor.yy555, yymsp[-1].minor.yy14); } break; - case 101: /* selcollist ::= sclp scanpt STAR */ + case 98: /* distinct ::= DISTINCT */ +{yymsp[0].minor.yy144 = SF_Distinct;} + break; + case 99: /* distinct ::= ALL */ +{yymsp[0].minor.yy144 = SF_All;} + break; + case 101: /* sclp ::= */ + case 134: /* orderby_opt ::= */ yytestcase(yyruleno==134); + case 144: /* groupby_opt ::= */ yytestcase(yyruleno==144); + case 234: /* exprlist ::= */ yytestcase(yyruleno==234); + case 237: /* paren_exprlist ::= */ yytestcase(yyruleno==237); + case 242: /* eidlist_opt ::= */ yytestcase(yyruleno==242); +{yymsp[1].minor.yy14 = 0;} + break; + case 102: /* selcollist ::= sclp scanpt expr scanpt as */ +{ + yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy14, yymsp[-2].minor.yy454); + if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy14, &yymsp[0].minor.yy0, 1); + sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy14,yymsp[-3].minor.yy168,yymsp[-1].minor.yy168); +} + break; + case 103: /* selcollist ::= sclp scanpt STAR */ { Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0); sqlite3ExprSetErrorOffset(p, (int)(yymsp[0].minor.yy0.z - pParse->zTail)); - yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy322, p); + yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy14, p); } break; - case 102: /* selcollist ::= sclp scanpt nm DOT STAR */ + case 104: /* selcollist ::= sclp scanpt nm DOT STAR */ { Expr *pRight, *pLeft, *pDot; pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0); sqlite3ExprSetErrorOffset(pRight, (int)(yymsp[0].minor.yy0.z - pParse->zTail)); pLeft = tokenExpr(pParse, TK_ID, yymsp[-2].minor.yy0); pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight); - yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot); + yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, pDot); } break; - case 103: /* as ::= AS nm */ - case 115: /* dbnm ::= DOT nm */ yytestcase(yyruleno==115); - case 256: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==256); - case 257: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==257); + case 105: /* as ::= AS nm */ + case 117: /* dbnm ::= DOT nm */ yytestcase(yyruleno==117); + case 258: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==258); + case 259: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==259); {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;} break; - case 105: /* from ::= */ - case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108); -{yymsp[1].minor.yy131 = 0;} + case 107: /* from ::= */ + case 110: /* stl_prefix ::= */ yytestcase(yyruleno==110); +{yymsp[1].minor.yy203 = 0;} break; - case 106: /* from ::= FROM seltablist */ + case 108: /* from ::= FROM seltablist */ { - yymsp[-1].minor.yy131 = yymsp[0].minor.yy131; - sqlite3SrcListShiftJoinType(pParse,yymsp[-1].minor.yy131); + yymsp[-1].minor.yy203 = yymsp[0].minor.yy203; + sqlite3SrcListShiftJoinType(pParse,yymsp[-1].minor.yy203); } break; - case 107: /* stl_prefix ::= seltablist joinop */ + case 109: /* stl_prefix ::= seltablist joinop */ { - if( ALWAYS(yymsp[-1].minor.yy131 && yymsp[-1].minor.yy131->nSrc>0) ) yymsp[-1].minor.yy131->a[yymsp[-1].minor.yy131->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy394; + if( ALWAYS(yymsp[-1].minor.yy203 && yymsp[-1].minor.yy203->nSrc>0) ) yymsp[-1].minor.yy203->a[yymsp[-1].minor.yy203->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy144; } break; - case 109: /* seltablist ::= stl_prefix nm dbnm as on_using */ + case 111: /* seltablist ::= stl_prefix nm dbnm as on_using */ { - yymsp[-4].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-4].minor.yy131,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy561); + yymsp[-4].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-4].minor.yy203,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269); } break; - case 110: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ + case 112: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ { - yymsp[-5].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy131,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,0,&yymsp[0].minor.yy561); - sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy131, &yymsp[-1].minor.yy0); + yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,0,&yymsp[0].minor.yy269); + sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy203, &yymsp[-1].minor.yy0); } break; - case 111: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ + case 113: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ { - yymsp[-7].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-7].minor.yy131,&yymsp[-6].minor.yy0,&yymsp[-5].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy561); - sqlite3SrcListFuncArgs(pParse, yymsp[-7].minor.yy131, yymsp[-3].minor.yy322); + yymsp[-7].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-7].minor.yy203,&yymsp[-6].minor.yy0,&yymsp[-5].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269); + sqlite3SrcListFuncArgs(pParse, yymsp[-7].minor.yy203, yymsp[-3].minor.yy14); } break; - case 112: /* seltablist ::= stl_prefix LP select RP as on_using */ + case 114: /* seltablist ::= stl_prefix LP select RP as on_using */ { - yymsp[-5].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy131,0,0,&yymsp[-1].minor.yy0,yymsp[-3].minor.yy47,&yymsp[0].minor.yy561); + yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,yymsp[-3].minor.yy555,&yymsp[0].minor.yy269); } break; - case 113: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ + case 115: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ { - if( yymsp[-5].minor.yy131==0 && yymsp[-1].minor.yy0.n==0 && yymsp[0].minor.yy561.pOn==0 && yymsp[0].minor.yy561.pUsing==0 ){ - yymsp[-5].minor.yy131 = yymsp[-3].minor.yy131; - }else if( ALWAYS(yymsp[-3].minor.yy131!=0) && yymsp[-3].minor.yy131->nSrc==1 ){ - yymsp[-5].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy131,0,0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy561); - if( yymsp[-5].minor.yy131 ){ - SrcItem *pNew = &yymsp[-5].minor.yy131->a[yymsp[-5].minor.yy131->nSrc-1]; - SrcItem *pOld = yymsp[-3].minor.yy131->a; + if( yymsp[-5].minor.yy203==0 && yymsp[-1].minor.yy0.n==0 && yymsp[0].minor.yy269.pOn==0 && yymsp[0].minor.yy269.pUsing==0 ){ + yymsp[-5].minor.yy203 = yymsp[-3].minor.yy203; + }else if( ALWAYS(yymsp[-3].minor.yy203!=0) && yymsp[-3].minor.yy203->nSrc==1 ){ + yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269); + if( yymsp[-5].minor.yy203 ){ + SrcItem *pNew = &yymsp[-5].minor.yy203->a[yymsp[-5].minor.yy203->nSrc-1]; + SrcItem *pOld = yymsp[-3].minor.yy203->a; pNew->zName = pOld->zName; pNew->zDatabase = pOld->zDatabase; pNew->pSelect = pOld->pSelect; @@ -174981,153 +176590,153 @@ static YYACTIONTYPE yy_reduce( pOld->zName = pOld->zDatabase = 0; pOld->pSelect = 0; } - sqlite3SrcListDelete(pParse->db, yymsp[-3].minor.yy131); + sqlite3SrcListDelete(pParse->db, yymsp[-3].minor.yy203); }else{ Select *pSubquery; - sqlite3SrcListShiftJoinType(pParse,yymsp[-3].minor.yy131); - pSubquery = sqlite3SelectNew(pParse,0,yymsp[-3].minor.yy131,0,0,0,0,SF_NestedFrom,0); - yymsp[-5].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy131,0,0,&yymsp[-1].minor.yy0,pSubquery,&yymsp[0].minor.yy561); + sqlite3SrcListShiftJoinType(pParse,yymsp[-3].minor.yy203); + pSubquery = sqlite3SelectNew(pParse,0,yymsp[-3].minor.yy203,0,0,0,0,SF_NestedFrom,0); + yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,pSubquery,&yymsp[0].minor.yy269); } } break; - case 114: /* dbnm ::= */ - case 129: /* indexed_opt ::= */ yytestcase(yyruleno==129); + case 116: /* dbnm ::= */ + case 131: /* indexed_opt ::= */ yytestcase(yyruleno==131); {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;} break; - case 116: /* fullname ::= nm */ + case 118: /* fullname ::= nm */ { - yylhsminor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); - if( IN_RENAME_OBJECT && yylhsminor.yy131 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy131->a[0].zName, &yymsp[0].minor.yy0); + yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); + if( IN_RENAME_OBJECT && yylhsminor.yy203 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy131 = yylhsminor.yy131; + yymsp[0].minor.yy203 = yylhsminor.yy203; break; - case 117: /* fullname ::= nm DOT nm */ + case 119: /* fullname ::= nm DOT nm */ { - yylhsminor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); - if( IN_RENAME_OBJECT && yylhsminor.yy131 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy131->a[0].zName, &yymsp[0].minor.yy0); + yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); + if( IN_RENAME_OBJECT && yylhsminor.yy203 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy131 = yylhsminor.yy131; + yymsp[-2].minor.yy203 = yylhsminor.yy203; break; - case 118: /* xfullname ::= nm */ -{yymsp[0].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} + case 120: /* xfullname ::= nm */ +{yymsp[0].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} break; - case 119: /* xfullname ::= nm DOT nm */ -{yymsp[-2].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} + case 121: /* xfullname ::= nm DOT nm */ +{yymsp[-2].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} break; - case 120: /* xfullname ::= nm DOT nm AS nm */ + case 122: /* xfullname ::= nm DOT nm AS nm */ { - yymsp[-4].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ - if( yymsp[-4].minor.yy131 ) yymsp[-4].minor.yy131->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); + yymsp[-4].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ + if( yymsp[-4].minor.yy203 ) yymsp[-4].minor.yy203->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); } break; - case 121: /* xfullname ::= nm AS nm */ + case 123: /* xfullname ::= nm AS nm */ { - yymsp[-2].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/ - if( yymsp[-2].minor.yy131 ) yymsp[-2].minor.yy131->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); + yymsp[-2].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/ + if( yymsp[-2].minor.yy203 ) yymsp[-2].minor.yy203->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); } break; - case 122: /* joinop ::= COMMA|JOIN */ -{ yymsp[0].minor.yy394 = JT_INNER; } + case 124: /* joinop ::= COMMA|JOIN */ +{ yymsp[0].minor.yy144 = JT_INNER; } break; - case 123: /* joinop ::= JOIN_KW JOIN */ -{yymsp[-1].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} + case 125: /* joinop ::= JOIN_KW JOIN */ +{yymsp[-1].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} break; - case 124: /* joinop ::= JOIN_KW nm JOIN */ -{yymsp[-2].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} + case 126: /* joinop ::= JOIN_KW nm JOIN */ +{yymsp[-2].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} break; - case 125: /* joinop ::= JOIN_KW nm nm JOIN */ -{yymsp[-3].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} + case 127: /* joinop ::= JOIN_KW nm nm JOIN */ +{yymsp[-3].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} break; - case 126: /* on_using ::= ON expr */ -{yymsp[-1].minor.yy561.pOn = yymsp[0].minor.yy528; yymsp[-1].minor.yy561.pUsing = 0;} + case 128: /* on_using ::= ON expr */ +{yymsp[-1].minor.yy269.pOn = yymsp[0].minor.yy454; yymsp[-1].minor.yy269.pUsing = 0;} break; - case 127: /* on_using ::= USING LP idlist RP */ -{yymsp[-3].minor.yy561.pOn = 0; yymsp[-3].minor.yy561.pUsing = yymsp[-1].minor.yy254;} + case 129: /* on_using ::= USING LP idlist RP */ +{yymsp[-3].minor.yy269.pOn = 0; yymsp[-3].minor.yy269.pUsing = yymsp[-1].minor.yy132;} break; - case 128: /* on_using ::= */ -{yymsp[1].minor.yy561.pOn = 0; yymsp[1].minor.yy561.pUsing = 0;} + case 130: /* on_using ::= */ +{yymsp[1].minor.yy269.pOn = 0; yymsp[1].minor.yy269.pUsing = 0;} break; - case 130: /* indexed_by ::= INDEXED BY nm */ + case 132: /* indexed_by ::= INDEXED BY nm */ {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;} break; - case 131: /* indexed_by ::= NOT INDEXED */ + case 133: /* indexed_by ::= NOT INDEXED */ {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;} break; - case 133: /* orderby_opt ::= ORDER BY sortlist */ - case 143: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==143); -{yymsp[-2].minor.yy322 = yymsp[0].minor.yy322;} + case 135: /* orderby_opt ::= ORDER BY sortlist */ + case 145: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==145); +{yymsp[-2].minor.yy14 = yymsp[0].minor.yy14;} break; - case 134: /* sortlist ::= sortlist COMMA expr sortorder nulls */ + case 136: /* sortlist ::= sortlist COMMA expr sortorder nulls */ { - yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322,yymsp[-2].minor.yy528); - sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy322,yymsp[-1].minor.yy394,yymsp[0].minor.yy394); + yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14,yymsp[-2].minor.yy454); + sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy14,yymsp[-1].minor.yy144,yymsp[0].minor.yy144); } break; - case 135: /* sortlist ::= expr sortorder nulls */ + case 137: /* sortlist ::= expr sortorder nulls */ { - yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy528); /*A-overwrites-Y*/ - sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy322,yymsp[-1].minor.yy394,yymsp[0].minor.yy394); + yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy454); /*A-overwrites-Y*/ + sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy14,yymsp[-1].minor.yy144,yymsp[0].minor.yy144); } break; - case 136: /* sortorder ::= ASC */ -{yymsp[0].minor.yy394 = SQLITE_SO_ASC;} + case 138: /* sortorder ::= ASC */ +{yymsp[0].minor.yy144 = SQLITE_SO_ASC;} break; - case 137: /* sortorder ::= DESC */ -{yymsp[0].minor.yy394 = SQLITE_SO_DESC;} + case 139: /* sortorder ::= DESC */ +{yymsp[0].minor.yy144 = SQLITE_SO_DESC;} break; - case 138: /* sortorder ::= */ - case 141: /* nulls ::= */ yytestcase(yyruleno==141); -{yymsp[1].minor.yy394 = SQLITE_SO_UNDEFINED;} + case 140: /* sortorder ::= */ + case 143: /* nulls ::= */ yytestcase(yyruleno==143); +{yymsp[1].minor.yy144 = SQLITE_SO_UNDEFINED;} break; - case 139: /* nulls ::= NULLS FIRST */ -{yymsp[-1].minor.yy394 = SQLITE_SO_ASC;} + case 141: /* nulls ::= NULLS FIRST */ +{yymsp[-1].minor.yy144 = SQLITE_SO_ASC;} break; - case 140: /* nulls ::= NULLS LAST */ -{yymsp[-1].minor.yy394 = SQLITE_SO_DESC;} + case 142: /* nulls ::= NULLS LAST */ +{yymsp[-1].minor.yy144 = SQLITE_SO_DESC;} break; - case 144: /* having_opt ::= */ - case 146: /* limit_opt ::= */ yytestcase(yyruleno==146); - case 151: /* where_opt ::= */ yytestcase(yyruleno==151); - case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153); - case 230: /* case_else ::= */ yytestcase(yyruleno==230); - case 231: /* case_operand ::= */ yytestcase(yyruleno==231); - case 250: /* vinto ::= */ yytestcase(yyruleno==250); -{yymsp[1].minor.yy528 = 0;} + case 146: /* having_opt ::= */ + case 148: /* limit_opt ::= */ yytestcase(yyruleno==148); + case 153: /* where_opt ::= */ yytestcase(yyruleno==153); + case 155: /* where_opt_ret ::= */ yytestcase(yyruleno==155); + case 232: /* case_else ::= */ yytestcase(yyruleno==232); + case 233: /* case_operand ::= */ yytestcase(yyruleno==233); + case 252: /* vinto ::= */ yytestcase(yyruleno==252); +{yymsp[1].minor.yy454 = 0;} break; - case 145: /* having_opt ::= HAVING expr */ - case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152); - case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154); - case 229: /* case_else ::= ELSE expr */ yytestcase(yyruleno==229); - case 249: /* vinto ::= INTO expr */ yytestcase(yyruleno==249); -{yymsp[-1].minor.yy528 = yymsp[0].minor.yy528;} + case 147: /* having_opt ::= HAVING expr */ + case 154: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==154); + case 156: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==156); + case 231: /* case_else ::= ELSE expr */ yytestcase(yyruleno==231); + case 251: /* vinto ::= INTO expr */ yytestcase(yyruleno==251); +{yymsp[-1].minor.yy454 = yymsp[0].minor.yy454;} break; - case 147: /* limit_opt ::= LIMIT expr */ -{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,0);} + case 149: /* limit_opt ::= LIMIT expr */ +{yymsp[-1].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,0);} break; - case 148: /* limit_opt ::= LIMIT expr OFFSET expr */ -{yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);} + case 150: /* limit_opt ::= LIMIT expr OFFSET expr */ +{yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);} break; - case 149: /* limit_opt ::= LIMIT expr COMMA expr */ -{yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,yymsp[-2].minor.yy528);} + case 151: /* limit_opt ::= LIMIT expr COMMA expr */ +{yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,yymsp[-2].minor.yy454);} break; - case 150: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ + case 152: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ { - sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy131, &yymsp[-1].minor.yy0); - sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy131,yymsp[0].minor.yy528,0,0); + sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy203, &yymsp[-1].minor.yy0); + sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy203,yymsp[0].minor.yy454,0,0); } break; - case 155: /* where_opt_ret ::= RETURNING selcollist */ -{sqlite3AddReturning(pParse,yymsp[0].minor.yy322); yymsp[-1].minor.yy528 = 0;} + case 157: /* where_opt_ret ::= RETURNING selcollist */ +{sqlite3AddReturning(pParse,yymsp[0].minor.yy14); yymsp[-1].minor.yy454 = 0;} break; - case 156: /* where_opt_ret ::= WHERE expr RETURNING selcollist */ -{sqlite3AddReturning(pParse,yymsp[0].minor.yy322); yymsp[-3].minor.yy528 = yymsp[-2].minor.yy528;} + case 158: /* where_opt_ret ::= WHERE expr RETURNING selcollist */ +{sqlite3AddReturning(pParse,yymsp[0].minor.yy14); yymsp[-3].minor.yy454 = yymsp[-2].minor.yy454;} break; - case 157: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ + case 159: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ { - sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy131, &yymsp[-4].minor.yy0); - sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy322,"set list"); - if( yymsp[-1].minor.yy131 ){ - SrcList *pFromClause = yymsp[-1].minor.yy131; + sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy203, &yymsp[-4].minor.yy0); + sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy14,"set list"); + if( yymsp[-1].minor.yy203 ){ + SrcList *pFromClause = yymsp[-1].minor.yy203; if( pFromClause->nSrc>1 ){ Select *pSubquery; Token as; @@ -175136,92 +176745,92 @@ static YYACTIONTYPE yy_reduce( as.z = 0; pFromClause = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&as,pSubquery,0); } - yymsp[-5].minor.yy131 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy131, pFromClause); + yymsp[-5].minor.yy203 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy203, pFromClause); } - sqlite3Update(pParse,yymsp[-5].minor.yy131,yymsp[-2].minor.yy322,yymsp[0].minor.yy528,yymsp[-6].minor.yy394,0,0,0); + sqlite3Update(pParse,yymsp[-5].minor.yy203,yymsp[-2].minor.yy14,yymsp[0].minor.yy454,yymsp[-6].minor.yy144,0,0,0); } break; - case 158: /* setlist ::= setlist COMMA nm EQ expr */ + case 160: /* setlist ::= setlist COMMA nm EQ expr */ { - yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[0].minor.yy528); - sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, 1); + yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy14, yymsp[0].minor.yy454); + sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy14, &yymsp[-2].minor.yy0, 1); } break; - case 159: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ + case 161: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ { - yymsp[-6].minor.yy322 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy322, yymsp[-3].minor.yy254, yymsp[0].minor.yy528); + yymsp[-6].minor.yy14 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy14, yymsp[-3].minor.yy132, yymsp[0].minor.yy454); } break; - case 160: /* setlist ::= nm EQ expr */ + case 162: /* setlist ::= nm EQ expr */ { - yylhsminor.yy322 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy528); - sqlite3ExprListSetName(pParse, yylhsminor.yy322, &yymsp[-2].minor.yy0, 1); + yylhsminor.yy14 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy454); + sqlite3ExprListSetName(pParse, yylhsminor.yy14, &yymsp[-2].minor.yy0, 1); } - yymsp[-2].minor.yy322 = yylhsminor.yy322; + yymsp[-2].minor.yy14 = yylhsminor.yy14; break; - case 161: /* setlist ::= LP idlist RP EQ expr */ + case 163: /* setlist ::= LP idlist RP EQ expr */ { - yymsp[-4].minor.yy322 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy254, yymsp[0].minor.yy528); + yymsp[-4].minor.yy14 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy132, yymsp[0].minor.yy454); } break; - case 162: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ + case 164: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ { - sqlite3Insert(pParse, yymsp[-3].minor.yy131, yymsp[-1].minor.yy47, yymsp[-2].minor.yy254, yymsp[-5].minor.yy394, yymsp[0].minor.yy444); + sqlite3Insert(pParse, yymsp[-3].minor.yy203, yymsp[-1].minor.yy555, yymsp[-2].minor.yy132, yymsp[-5].minor.yy144, yymsp[0].minor.yy122); } break; - case 163: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ + case 165: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ { - sqlite3Insert(pParse, yymsp[-4].minor.yy131, 0, yymsp[-3].minor.yy254, yymsp[-6].minor.yy394, 0); + sqlite3Insert(pParse, yymsp[-4].minor.yy203, 0, yymsp[-3].minor.yy132, yymsp[-6].minor.yy144, 0); } break; - case 164: /* upsert ::= */ -{ yymsp[1].minor.yy444 = 0; } + case 166: /* upsert ::= */ +{ yymsp[1].minor.yy122 = 0; } break; - case 165: /* upsert ::= RETURNING selcollist */ -{ yymsp[-1].minor.yy444 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy322); } + case 167: /* upsert ::= RETURNING selcollist */ +{ yymsp[-1].minor.yy122 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy14); } break; - case 166: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ -{ yymsp[-11].minor.yy444 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy322,yymsp[-6].minor.yy528,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528,yymsp[0].minor.yy444);} + case 168: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ +{ yymsp[-11].minor.yy122 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy14,yymsp[-6].minor.yy454,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454,yymsp[0].minor.yy122);} break; - case 167: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ -{ yymsp[-8].minor.yy444 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy322,yymsp[-3].minor.yy528,0,0,yymsp[0].minor.yy444); } + case 169: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ +{ yymsp[-8].minor.yy122 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy14,yymsp[-3].minor.yy454,0,0,yymsp[0].minor.yy122); } break; - case 168: /* upsert ::= ON CONFLICT DO NOTHING returning */ -{ yymsp[-4].minor.yy444 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); } + case 170: /* upsert ::= ON CONFLICT DO NOTHING returning */ +{ yymsp[-4].minor.yy122 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); } break; - case 169: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ -{ yymsp[-7].minor.yy444 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528,0);} + case 171: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ +{ yymsp[-7].minor.yy122 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454,0);} break; - case 170: /* returning ::= RETURNING selcollist */ -{sqlite3AddReturning(pParse,yymsp[0].minor.yy322);} + case 172: /* returning ::= RETURNING selcollist */ +{sqlite3AddReturning(pParse,yymsp[0].minor.yy14);} break; - case 173: /* idlist_opt ::= */ -{yymsp[1].minor.yy254 = 0;} + case 175: /* idlist_opt ::= */ +{yymsp[1].minor.yy132 = 0;} break; - case 174: /* idlist_opt ::= LP idlist RP */ -{yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;} + case 176: /* idlist_opt ::= LP idlist RP */ +{yymsp[-2].minor.yy132 = yymsp[-1].minor.yy132;} break; - case 175: /* idlist ::= idlist COMMA nm */ -{yymsp[-2].minor.yy254 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);} + case 177: /* idlist ::= idlist COMMA nm */ +{yymsp[-2].minor.yy132 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy132,&yymsp[0].minor.yy0);} break; - case 176: /* idlist ::= nm */ -{yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} + case 178: /* idlist ::= nm */ +{yymsp[0].minor.yy132 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} break; - case 177: /* expr ::= LP expr RP */ -{yymsp[-2].minor.yy528 = yymsp[-1].minor.yy528;} + case 179: /* expr ::= LP expr RP */ +{yymsp[-2].minor.yy454 = yymsp[-1].minor.yy454;} break; - case 178: /* expr ::= ID|INDEXED|JOIN_KW */ -{yymsp[0].minor.yy528=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} + case 180: /* expr ::= ID|INDEXED|JOIN_KW */ +{yymsp[0].minor.yy454=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} break; - case 179: /* expr ::= nm DOT nm */ + case 181: /* expr ::= nm DOT nm */ { Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0); Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); - yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); + yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); } - yymsp[-2].minor.yy528 = yylhsminor.yy528; + yymsp[-2].minor.yy454 = yylhsminor.yy454; break; - case 180: /* expr ::= nm DOT nm DOT nm */ + case 182: /* expr ::= nm DOT nm DOT nm */ { Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0); Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0); @@ -175230,27 +176839,27 @@ static YYACTIONTYPE yy_reduce( if( IN_RENAME_OBJECT ){ sqlite3RenameTokenRemap(pParse, 0, temp1); } - yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); + yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); } - yymsp[-4].minor.yy528 = yylhsminor.yy528; + yymsp[-4].minor.yy454 = yylhsminor.yy454; break; - case 181: /* term ::= NULL|FLOAT|BLOB */ - case 182: /* term ::= STRING */ yytestcase(yyruleno==182); -{yymsp[0].minor.yy528=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/} + case 183: /* term ::= NULL|FLOAT|BLOB */ + case 184: /* term ::= STRING */ yytestcase(yyruleno==184); +{yymsp[0].minor.yy454=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/} break; - case 183: /* term ::= INTEGER */ + case 185: /* term ::= INTEGER */ { - yylhsminor.yy528 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1); - if( yylhsminor.yy528 ) yylhsminor.yy528->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail); + yylhsminor.yy454 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1); + if( yylhsminor.yy454 ) yylhsminor.yy454->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail); } - yymsp[0].minor.yy528 = yylhsminor.yy528; + yymsp[0].minor.yy454 = yylhsminor.yy454; break; - case 184: /* expr ::= VARIABLE */ + case 186: /* expr ::= VARIABLE */ { if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){ u32 n = yymsp[0].minor.yy0.n; - yymsp[0].minor.yy528 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0); - sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy528, n); + yymsp[0].minor.yy454 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0); + sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy454, n); }else{ /* When doing a nested parse, one can include terms in an expression ** that look like this: #1 #2 ... These terms refer to registers @@ -175259,194 +176868,203 @@ static YYACTIONTYPE yy_reduce( assert( t.n>=2 ); if( pParse->nested==0 ){ sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t); - yymsp[0].minor.yy528 = 0; + yymsp[0].minor.yy454 = 0; }else{ - yymsp[0].minor.yy528 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0); - if( yymsp[0].minor.yy528 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy528->iTable); + yymsp[0].minor.yy454 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0); + if( yymsp[0].minor.yy454 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy454->iTable); } } } break; - case 185: /* expr ::= expr COLLATE ID|STRING */ + case 187: /* expr ::= expr COLLATE ID|STRING */ { - yymsp[-2].minor.yy528 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy528, &yymsp[0].minor.yy0, 1); + yymsp[-2].minor.yy454 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy454, &yymsp[0].minor.yy0, 1); } break; - case 186: /* expr ::= CAST LP expr AS typetoken RP */ + case 188: /* expr ::= CAST LP expr AS typetoken RP */ { - yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1); - sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy528, yymsp[-3].minor.yy528, 0); + yymsp[-5].minor.yy454 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1); + sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy454, yymsp[-3].minor.yy454, 0); } break; - case 187: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ + case 189: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ { - yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy394); + yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy14, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy144); } - yymsp[-4].minor.yy528 = yylhsminor.yy528; + yymsp[-4].minor.yy454 = yylhsminor.yy454; break; - case 188: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ + case 190: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ { - yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-4].minor.yy322, &yymsp[-7].minor.yy0, yymsp[-5].minor.yy394); - sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy528, yymsp[-1].minor.yy322); + yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-4].minor.yy14, &yymsp[-7].minor.yy0, yymsp[-5].minor.yy144); + sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy454, yymsp[-1].minor.yy14); } - yymsp[-7].minor.yy528 = yylhsminor.yy528; + yymsp[-7].minor.yy454 = yylhsminor.yy454; break; - case 189: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ + case 191: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ { - yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0); + yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0); } - yymsp[-3].minor.yy528 = yylhsminor.yy528; + yymsp[-3].minor.yy454 = yylhsminor.yy454; break; - case 190: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ + case 192: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ { - yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy322, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy394); - sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41); + yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy14, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy144); + sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211); } - yymsp[-5].minor.yy528 = yylhsminor.yy528; + yymsp[-5].minor.yy454 = yylhsminor.yy454; break; - case 191: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ + case 193: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ { - yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-5].minor.yy322, &yymsp[-8].minor.yy0, yymsp[-6].minor.yy394); - sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41); - sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy528, yymsp[-2].minor.yy322); + yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-5].minor.yy14, &yymsp[-8].minor.yy0, yymsp[-6].minor.yy144); + sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211); + sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy454, yymsp[-2].minor.yy14); } - yymsp[-8].minor.yy528 = yylhsminor.yy528; + yymsp[-8].minor.yy454 = yylhsminor.yy454; break; - case 192: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ + case 194: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ { - yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0); - sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41); + yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0); + sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211); } - yymsp[-4].minor.yy528 = yylhsminor.yy528; + yymsp[-4].minor.yy454 = yylhsminor.yy454; break; - case 193: /* term ::= CTIME_KW */ + case 195: /* term ::= CTIME_KW */ { - yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0); + yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0); } - yymsp[0].minor.yy528 = yylhsminor.yy528; + yymsp[0].minor.yy454 = yylhsminor.yy454; break; - case 194: /* expr ::= LP nexprlist COMMA expr RP */ + case 196: /* expr ::= LP nexprlist COMMA expr RP */ { - ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528); - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); - if( yymsp[-4].minor.yy528 ){ - yymsp[-4].minor.yy528->x.pList = pList; + ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy14, yymsp[-1].minor.yy454); + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); + if( yymsp[-4].minor.yy454 ){ + yymsp[-4].minor.yy454->x.pList = pList; if( ALWAYS(pList->nExpr) ){ - yymsp[-4].minor.yy528->flags |= pList->a[0].pExpr->flags & EP_Propagate; + yymsp[-4].minor.yy454->flags |= pList->a[0].pExpr->flags & EP_Propagate; } }else{ sqlite3ExprListDelete(pParse->db, pList); } } break; - case 195: /* expr ::= expr AND expr */ -{yymsp[-2].minor.yy528=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);} + case 197: /* expr ::= expr AND expr */ +{yymsp[-2].minor.yy454=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);} break; - case 196: /* expr ::= expr OR expr */ - case 197: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==197); - case 198: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==198); - case 199: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==199); - case 200: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==200); - case 201: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==201); - case 202: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==202); -{yymsp[-2].minor.yy528=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);} + case 198: /* expr ::= expr OR expr */ + case 199: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==199); + case 200: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==200); + case 201: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==201); + case 202: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==202); + case 203: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==203); + case 204: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==204); +{yymsp[-2].minor.yy454=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);} break; - case 203: /* likeop ::= NOT LIKE_KW|MATCH */ + case 205: /* likeop ::= NOT LIKE_KW|MATCH */ {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/} break; - case 204: /* expr ::= expr likeop expr */ + case 206: /* expr ::= expr likeop expr */ { ExprList *pList; int bNot = yymsp[-1].minor.yy0.n & 0x80000000; yymsp[-1].minor.yy0.n &= 0x7fffffff; - pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy528); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy528); - yymsp[-2].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); - if( bNot ) yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy528, 0); - if( yymsp[-2].minor.yy528 ) yymsp[-2].minor.yy528->flags |= EP_InfixFunc; + pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy454); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy454); + yymsp[-2].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); + if( bNot ) yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy454, 0); + if( yymsp[-2].minor.yy454 ) yymsp[-2].minor.yy454->flags |= EP_InfixFunc; } break; - case 205: /* expr ::= expr likeop expr ESCAPE expr */ + case 207: /* expr ::= expr likeop expr ESCAPE expr */ { ExprList *pList; int bNot = yymsp[-3].minor.yy0.n & 0x80000000; yymsp[-3].minor.yy0.n &= 0x7fffffff; - pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy528); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528); - yymsp[-4].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0); - if( bNot ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); - if( yymsp[-4].minor.yy528 ) yymsp[-4].minor.yy528->flags |= EP_InfixFunc; + pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy454); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454); + yymsp[-4].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0); + if( bNot ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0); + if( yymsp[-4].minor.yy454 ) yymsp[-4].minor.yy454->flags |= EP_InfixFunc; } break; - case 206: /* expr ::= expr ISNULL|NOTNULL */ -{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy528,0);} + case 208: /* expr ::= expr ISNULL|NOTNULL */ +{yymsp[-1].minor.yy454 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy454,0);} break; - case 207: /* expr ::= expr NOT NULL */ -{yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy528,0);} + case 209: /* expr ::= expr NOT NULL */ +{yymsp[-2].minor.yy454 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy454,0);} break; - case 208: /* expr ::= expr IS expr */ + case 210: /* expr ::= expr IS expr */ { - yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy528,yymsp[0].minor.yy528); - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-2].minor.yy528, TK_ISNULL); + yymsp[-2].minor.yy454 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy454,yymsp[0].minor.yy454); + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-2].minor.yy454, TK_ISNULL); } break; - case 209: /* expr ::= expr IS NOT expr */ + case 211: /* expr ::= expr IS NOT expr */ { - yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy528,yymsp[0].minor.yy528); - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-3].minor.yy528, TK_NOTNULL); + yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy454,yymsp[0].minor.yy454); + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-3].minor.yy454, TK_NOTNULL); } break; - case 210: /* expr ::= expr IS NOT DISTINCT FROM expr */ + case 212: /* expr ::= expr IS NOT DISTINCT FROM expr */ { - yymsp[-5].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy528,yymsp[0].minor.yy528); - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-5].minor.yy528, TK_ISNULL); + yymsp[-5].minor.yy454 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy454,yymsp[0].minor.yy454); + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-5].minor.yy454, TK_ISNULL); } break; - case 211: /* expr ::= expr IS DISTINCT FROM expr */ + case 213: /* expr ::= expr IS DISTINCT FROM expr */ { - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy528,yymsp[0].minor.yy528); - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-4].minor.yy528, TK_NOTNULL); + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy454,yymsp[0].minor.yy454); + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-4].minor.yy454, TK_NOTNULL); } break; - case 212: /* expr ::= NOT expr */ - case 213: /* expr ::= BITNOT expr */ yytestcase(yyruleno==213); -{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy528, 0);/*A-overwrites-B*/} + case 214: /* expr ::= NOT expr */ + case 215: /* expr ::= BITNOT expr */ yytestcase(yyruleno==215); +{yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy454, 0);/*A-overwrites-B*/} break; - case 214: /* expr ::= PLUS|MINUS expr */ + case 216: /* expr ::= PLUS|MINUS expr */ { - yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy528, 0); - /*A-overwrites-B*/ + Expr *p = yymsp[0].minor.yy454; + u8 op = yymsp[-1].major + (TK_UPLUS-TK_PLUS); + assert( TK_UPLUS>TK_PLUS ); + assert( TK_UMINUS == TK_MINUS + (TK_UPLUS - TK_PLUS) ); + if( p && p->op==TK_UPLUS ){ + p->op = op; + yymsp[-1].minor.yy454 = p; + }else{ + yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, op, p, 0); + /*A-overwrites-B*/ + } } break; - case 215: /* expr ::= expr PTR expr */ + case 217: /* expr ::= expr PTR expr */ { - ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy528); - pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy528); - yylhsminor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); + ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy454); + pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy454); + yylhsminor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); } - yymsp[-2].minor.yy528 = yylhsminor.yy528; + yymsp[-2].minor.yy454 = yylhsminor.yy454; break; - case 216: /* between_op ::= BETWEEN */ - case 219: /* in_op ::= IN */ yytestcase(yyruleno==219); -{yymsp[0].minor.yy394 = 0;} + case 218: /* between_op ::= BETWEEN */ + case 221: /* in_op ::= IN */ yytestcase(yyruleno==221); +{yymsp[0].minor.yy144 = 0;} break; - case 218: /* expr ::= expr between_op expr AND expr */ + case 220: /* expr ::= expr between_op expr AND expr */ { - ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528); - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy528, 0); - if( yymsp[-4].minor.yy528 ){ - yymsp[-4].minor.yy528->x.pList = pList; + ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454); + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy454, 0); + if( yymsp[-4].minor.yy454 ){ + yymsp[-4].minor.yy454->x.pList = pList; }else{ sqlite3ExprListDelete(pParse->db, pList); } - if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); + if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0); } break; - case 221: /* expr ::= expr in_op LP exprlist RP */ + case 223: /* expr ::= expr in_op LP exprlist RP */ { - if( yymsp[-1].minor.yy322==0 ){ + if( yymsp[-1].minor.yy14==0 ){ /* Expressions of the form ** ** expr1 IN () @@ -175455,208 +177073,208 @@ static YYACTIONTYPE yy_reduce( ** simplify to constants 0 (false) and 1 (true), respectively, ** regardless of the value of expr1. */ - sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy528); - yymsp[-4].minor.yy528 = sqlite3Expr(pParse->db, TK_STRING, yymsp[-3].minor.yy394 ? "true" : "false"); - if( yymsp[-4].minor.yy528 ) sqlite3ExprIdToTrueFalse(yymsp[-4].minor.yy528); + sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy454); + yymsp[-4].minor.yy454 = sqlite3Expr(pParse->db, TK_STRING, yymsp[-3].minor.yy144 ? "true" : "false"); + if( yymsp[-4].minor.yy454 ) sqlite3ExprIdToTrueFalse(yymsp[-4].minor.yy454); }else{ - Expr *pRHS = yymsp[-1].minor.yy322->a[0].pExpr; - if( yymsp[-1].minor.yy322->nExpr==1 && sqlite3ExprIsConstant(pRHS) && yymsp[-4].minor.yy528->op!=TK_VECTOR ){ - yymsp[-1].minor.yy322->a[0].pExpr = 0; - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322); + Expr *pRHS = yymsp[-1].minor.yy14->a[0].pExpr; + if( yymsp[-1].minor.yy14->nExpr==1 && sqlite3ExprIsConstant(pParse,pRHS) && yymsp[-4].minor.yy454->op!=TK_VECTOR ){ + yymsp[-1].minor.yy14->a[0].pExpr = 0; + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14); pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0); - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy528, pRHS); - }else if( yymsp[-1].minor.yy322->nExpr==1 && pRHS->op==TK_SELECT ){ - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pRHS->x.pSelect); + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy454, pRHS); + }else if( yymsp[-1].minor.yy14->nExpr==1 && pRHS->op==TK_SELECT ){ + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0); + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pRHS->x.pSelect); pRHS->x.pSelect = 0; - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322); + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14); }else{ - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); - if( yymsp[-4].minor.yy528==0 ){ - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322); - }else if( yymsp[-4].minor.yy528->pLeft->op==TK_VECTOR ){ - int nExpr = yymsp[-4].minor.yy528->pLeft->x.pList->nExpr; - Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy322); + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0); + if( yymsp[-4].minor.yy454==0 ){ + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14); + }else if( yymsp[-4].minor.yy454->pLeft->op==TK_VECTOR ){ + int nExpr = yymsp[-4].minor.yy454->pLeft->x.pList->nExpr; + Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy14); if( pSelectRHS ){ parserDoubleLinkSelect(pParse, pSelectRHS); - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelectRHS); + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pSelectRHS); } }else{ - yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy322; - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528); + yymsp[-4].minor.yy454->x.pList = yymsp[-1].minor.yy14; + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy454); } } - if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); + if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0); } } break; - case 222: /* expr ::= LP select RP */ + case 224: /* expr ::= LP select RP */ { - yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_SELECT, 0, 0); - sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy528, yymsp[-1].minor.yy47); + yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_SELECT, 0, 0); + sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy454, yymsp[-1].minor.yy555); } break; - case 223: /* expr ::= expr in_op LP select RP */ + case 225: /* expr ::= expr in_op LP select RP */ { - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, yymsp[-1].minor.yy47); - if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0); + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, yymsp[-1].minor.yy555); + if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0); } break; - case 224: /* expr ::= expr in_op nm dbnm paren_exprlist */ + case 226: /* expr ::= expr in_op nm dbnm paren_exprlist */ { SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0); - if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322); - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelect); - if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); + if( yymsp[0].minor.yy14 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy14); + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0); + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pSelect); + if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0); } break; - case 225: /* expr ::= EXISTS LP select RP */ + case 227: /* expr ::= EXISTS LP select RP */ { Expr *p; - p = yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0); - sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy47); + p = yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0); + sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy555); } break; - case 226: /* expr ::= CASE case_operand case_exprlist case_else END */ + case 228: /* expr ::= CASE case_operand case_exprlist case_else END */ { - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy528, 0); - if( yymsp[-4].minor.yy528 ){ - yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy528 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528) : yymsp[-2].minor.yy322; - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528); + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy454, 0); + if( yymsp[-4].minor.yy454 ){ + yymsp[-4].minor.yy454->x.pList = yymsp[-1].minor.yy454 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454) : yymsp[-2].minor.yy14; + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy454); }else{ - sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322); - sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528); + sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy14); + sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy454); } } break; - case 227: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ + case 229: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ { - yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy528); - yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy528); + yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, yymsp[-2].minor.yy454); + yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, yymsp[0].minor.yy454); } break; - case 228: /* case_exprlist ::= WHEN expr THEN expr */ + case 230: /* case_exprlist ::= WHEN expr THEN expr */ { - yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528); - yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy528); + yymsp[-3].minor.yy14 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454); + yymsp[-3].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy14, yymsp[0].minor.yy454); } break; - case 233: /* nexprlist ::= nexprlist COMMA expr */ -{yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy528);} + case 235: /* nexprlist ::= nexprlist COMMA expr */ +{yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[0].minor.yy454);} break; - case 234: /* nexprlist ::= expr */ -{yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy528); /*A-overwrites-Y*/} + case 236: /* nexprlist ::= expr */ +{yymsp[0].minor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy454); /*A-overwrites-Y*/} break; - case 236: /* paren_exprlist ::= LP exprlist RP */ - case 241: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==241); -{yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;} + case 238: /* paren_exprlist ::= LP exprlist RP */ + case 243: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==243); +{yymsp[-2].minor.yy14 = yymsp[-1].minor.yy14;} break; - case 237: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ + case 239: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ { sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, - sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy394, - &yymsp[-11].minor.yy0, yymsp[0].minor.yy528, SQLITE_SO_ASC, yymsp[-8].minor.yy394, SQLITE_IDXTYPE_APPDEF); + sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy14, yymsp[-10].minor.yy144, + &yymsp[-11].minor.yy0, yymsp[0].minor.yy454, SQLITE_SO_ASC, yymsp[-8].minor.yy144, SQLITE_IDXTYPE_APPDEF); if( IN_RENAME_OBJECT && pParse->pNewIndex ){ sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0); } } break; - case 238: /* uniqueflag ::= UNIQUE */ - case 280: /* raisetype ::= ABORT */ yytestcase(yyruleno==280); -{yymsp[0].minor.yy394 = OE_Abort;} + case 240: /* uniqueflag ::= UNIQUE */ + case 282: /* raisetype ::= ABORT */ yytestcase(yyruleno==282); +{yymsp[0].minor.yy144 = OE_Abort;} break; - case 239: /* uniqueflag ::= */ -{yymsp[1].minor.yy394 = OE_None;} + case 241: /* uniqueflag ::= */ +{yymsp[1].minor.yy144 = OE_None;} break; - case 242: /* eidlist ::= eidlist COMMA nm collate sortorder */ + case 244: /* eidlist ::= eidlist COMMA nm collate sortorder */ { - yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); + yymsp[-4].minor.yy14 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy14, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy144, yymsp[0].minor.yy144); } break; - case 243: /* eidlist ::= nm collate sortorder */ + case 245: /* eidlist ::= nm collate sortorder */ { - yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); /*A-overwrites-Y*/ + yymsp[-2].minor.yy14 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy144, yymsp[0].minor.yy144); /*A-overwrites-Y*/ } break; - case 246: /* cmd ::= DROP INDEX ifexists fullname */ -{sqlite3DropIndex(pParse, yymsp[0].minor.yy131, yymsp[-1].minor.yy394);} + case 248: /* cmd ::= DROP INDEX ifexists fullname */ +{sqlite3DropIndex(pParse, yymsp[0].minor.yy203, yymsp[-1].minor.yy144);} break; - case 247: /* cmd ::= VACUUM vinto */ -{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy528);} + case 249: /* cmd ::= VACUUM vinto */ +{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy454);} break; - case 248: /* cmd ::= VACUUM nm vinto */ -{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy528);} + case 250: /* cmd ::= VACUUM nm vinto */ +{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy454);} break; - case 251: /* cmd ::= PRAGMA nm dbnm */ + case 253: /* cmd ::= PRAGMA nm dbnm */ {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} break; - case 252: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ + case 254: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);} break; - case 253: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ + case 255: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);} break; - case 254: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ + case 256: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);} break; - case 255: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ + case 257: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);} break; - case 258: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ + case 260: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ { Token all; all.z = yymsp[-3].minor.yy0.z; all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n; - sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy33, &all); + sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy427, &all); } break; - case 259: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ + case 261: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ { - sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy394, yymsp[-4].minor.yy180.a, yymsp[-4].minor.yy180.b, yymsp[-2].minor.yy131, yymsp[0].minor.yy528, yymsp[-10].minor.yy394, yymsp[-8].minor.yy394); + sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy144, yymsp[-4].minor.yy286.a, yymsp[-4].minor.yy286.b, yymsp[-2].minor.yy203, yymsp[0].minor.yy454, yymsp[-10].minor.yy144, yymsp[-8].minor.yy144); yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ } break; - case 260: /* trigger_time ::= BEFORE|AFTER */ -{ yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/ } + case 262: /* trigger_time ::= BEFORE|AFTER */ +{ yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-X*/ } break; - case 261: /* trigger_time ::= INSTEAD OF */ -{ yymsp[-1].minor.yy394 = TK_INSTEAD;} + case 263: /* trigger_time ::= INSTEAD OF */ +{ yymsp[-1].minor.yy144 = TK_INSTEAD;} break; - case 262: /* trigger_time ::= */ -{ yymsp[1].minor.yy394 = TK_BEFORE; } + case 264: /* trigger_time ::= */ +{ yymsp[1].minor.yy144 = TK_BEFORE; } break; - case 263: /* trigger_event ::= DELETE|INSERT */ - case 264: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==264); -{yymsp[0].minor.yy180.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy180.b = 0;} + case 265: /* trigger_event ::= DELETE|INSERT */ + case 266: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==266); +{yymsp[0].minor.yy286.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy286.b = 0;} break; - case 265: /* trigger_event ::= UPDATE OF idlist */ -{yymsp[-2].minor.yy180.a = TK_UPDATE; yymsp[-2].minor.yy180.b = yymsp[0].minor.yy254;} + case 267: /* trigger_event ::= UPDATE OF idlist */ +{yymsp[-2].minor.yy286.a = TK_UPDATE; yymsp[-2].minor.yy286.b = yymsp[0].minor.yy132;} break; - case 266: /* when_clause ::= */ - case 285: /* key_opt ::= */ yytestcase(yyruleno==285); -{ yymsp[1].minor.yy528 = 0; } + case 268: /* when_clause ::= */ + case 287: /* key_opt ::= */ yytestcase(yyruleno==287); +{ yymsp[1].minor.yy454 = 0; } break; - case 267: /* when_clause ::= WHEN expr */ - case 286: /* key_opt ::= KEY expr */ yytestcase(yyruleno==286); -{ yymsp[-1].minor.yy528 = yymsp[0].minor.yy528; } + case 269: /* when_clause ::= WHEN expr */ + case 288: /* key_opt ::= KEY expr */ yytestcase(yyruleno==288); +{ yymsp[-1].minor.yy454 = yymsp[0].minor.yy454; } break; - case 268: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ + case 270: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ { - assert( yymsp[-2].minor.yy33!=0 ); - yymsp[-2].minor.yy33->pLast->pNext = yymsp[-1].minor.yy33; - yymsp[-2].minor.yy33->pLast = yymsp[-1].minor.yy33; + assert( yymsp[-2].minor.yy427!=0 ); + yymsp[-2].minor.yy427->pLast->pNext = yymsp[-1].minor.yy427; + yymsp[-2].minor.yy427->pLast = yymsp[-1].minor.yy427; } break; - case 269: /* trigger_cmd_list ::= trigger_cmd SEMI */ + case 271: /* trigger_cmd_list ::= trigger_cmd SEMI */ { - assert( yymsp[-1].minor.yy33!=0 ); - yymsp[-1].minor.yy33->pLast = yymsp[-1].minor.yy33; + assert( yymsp[-1].minor.yy427!=0 ); + yymsp[-1].minor.yy427->pLast = yymsp[-1].minor.yy427; } break; - case 270: /* trnm ::= nm DOT nm */ + case 272: /* trnm ::= nm DOT nm */ { yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; sqlite3ErrorMsg(pParse, @@ -175664,367 +177282,377 @@ static YYACTIONTYPE yy_reduce( "statements within triggers"); } break; - case 271: /* tridxby ::= INDEXED BY nm */ + case 273: /* tridxby ::= INDEXED BY nm */ { sqlite3ErrorMsg(pParse, "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; - case 272: /* tridxby ::= NOT INDEXED */ + case 274: /* tridxby ::= NOT INDEXED */ { sqlite3ErrorMsg(pParse, "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; - case 273: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ -{yylhsminor.yy33 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy131, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528, yymsp[-7].minor.yy394, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy522);} - yymsp[-8].minor.yy33 = yylhsminor.yy33; + case 275: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ +{yylhsminor.yy427 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy203, yymsp[-3].minor.yy14, yymsp[-1].minor.yy454, yymsp[-7].minor.yy144, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy168);} + yymsp[-8].minor.yy427 = yylhsminor.yy427; break; - case 274: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ + case 276: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ { - yylhsminor.yy33 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy254,yymsp[-2].minor.yy47,yymsp[-6].minor.yy394,yymsp[-1].minor.yy444,yymsp[-7].minor.yy522,yymsp[0].minor.yy522);/*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/ + yylhsminor.yy427 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy132,yymsp[-2].minor.yy555,yymsp[-6].minor.yy144,yymsp[-1].minor.yy122,yymsp[-7].minor.yy168,yymsp[0].minor.yy168);/*yylhsminor.yy427-overwrites-yymsp[-6].minor.yy144*/ } - yymsp[-7].minor.yy33 = yylhsminor.yy33; + yymsp[-7].minor.yy427 = yylhsminor.yy427; break; - case 275: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ -{yylhsminor.yy33 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy528, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy522);} - yymsp[-5].minor.yy33 = yylhsminor.yy33; + case 277: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ +{yylhsminor.yy427 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy454, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy168);} + yymsp[-5].minor.yy427 = yylhsminor.yy427; break; - case 276: /* trigger_cmd ::= scanpt select scanpt */ -{yylhsminor.yy33 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy47, yymsp[-2].minor.yy522, yymsp[0].minor.yy522); /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/} - yymsp[-2].minor.yy33 = yylhsminor.yy33; + case 278: /* trigger_cmd ::= scanpt select scanpt */ +{yylhsminor.yy427 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy555, yymsp[-2].minor.yy168, yymsp[0].minor.yy168); /*yylhsminor.yy427-overwrites-yymsp[-1].minor.yy555*/} + yymsp[-2].minor.yy427 = yylhsminor.yy427; break; - case 277: /* expr ::= RAISE LP IGNORE RP */ + case 279: /* expr ::= RAISE LP IGNORE RP */ { - yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); - if( yymsp[-3].minor.yy528 ){ - yymsp[-3].minor.yy528->affExpr = OE_Ignore; + yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); + if( yymsp[-3].minor.yy454 ){ + yymsp[-3].minor.yy454->affExpr = OE_Ignore; } } break; - case 278: /* expr ::= RAISE LP raisetype COMMA nm RP */ + case 280: /* expr ::= RAISE LP raisetype COMMA nm RP */ { - yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); - if( yymsp[-5].minor.yy528 ) { - yymsp[-5].minor.yy528->affExpr = (char)yymsp[-3].minor.yy394; + yymsp[-5].minor.yy454 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); + if( yymsp[-5].minor.yy454 ) { + yymsp[-5].minor.yy454->affExpr = (char)yymsp[-3].minor.yy144; } } break; - case 279: /* raisetype ::= ROLLBACK */ -{yymsp[0].minor.yy394 = OE_Rollback;} + case 281: /* raisetype ::= ROLLBACK */ +{yymsp[0].minor.yy144 = OE_Rollback;} break; - case 281: /* raisetype ::= FAIL */ -{yymsp[0].minor.yy394 = OE_Fail;} + case 283: /* raisetype ::= FAIL */ +{yymsp[0].minor.yy144 = OE_Fail;} break; - case 282: /* cmd ::= DROP TRIGGER ifexists fullname */ + case 284: /* cmd ::= DROP TRIGGER ifexists fullname */ { - sqlite3DropTrigger(pParse,yymsp[0].minor.yy131,yymsp[-1].minor.yy394); + sqlite3DropTrigger(pParse,yymsp[0].minor.yy203,yymsp[-1].minor.yy144); } break; - case 283: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ + case 285: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ { - sqlite3Attach(pParse, yymsp[-3].minor.yy528, yymsp[-1].minor.yy528, yymsp[0].minor.yy528); + sqlite3Attach(pParse, yymsp[-3].minor.yy454, yymsp[-1].minor.yy454, yymsp[0].minor.yy454); } break; - case 284: /* cmd ::= DETACH database_kw_opt expr */ + case 286: /* cmd ::= DETACH database_kw_opt expr */ { - sqlite3Detach(pParse, yymsp[0].minor.yy528); + sqlite3Detach(pParse, yymsp[0].minor.yy454); } break; - case 287: /* cmd ::= REINDEX */ + case 289: /* cmd ::= REINDEX */ {sqlite3Reindex(pParse, 0, 0);} break; - case 288: /* cmd ::= REINDEX nm dbnm */ + case 290: /* cmd ::= REINDEX nm dbnm */ {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} break; - case 289: /* cmd ::= ANALYZE */ + case 291: /* cmd ::= ANALYZE */ {sqlite3Analyze(pParse, 0, 0);} break; - case 290: /* cmd ::= ANALYZE nm dbnm */ + case 292: /* cmd ::= ANALYZE nm dbnm */ {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} break; - case 291: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ + case 293: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ { - sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy131,&yymsp[0].minor.yy0); + sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy203,&yymsp[0].minor.yy0); } break; - case 292: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ + case 294: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ { yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n; sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0); } break; - case 293: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ + case 295: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ { - sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy131, &yymsp[0].minor.yy0); + sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy203, &yymsp[0].minor.yy0); } break; - case 294: /* add_column_fullname ::= fullname */ + case 296: /* add_column_fullname ::= fullname */ { disableLookaside(pParse); - sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy131); + sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy203); } break; - case 295: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ + case 297: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ { - sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy131, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); + sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy203, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 296: /* cmd ::= create_vtab */ + case 298: /* cmd ::= create_vtab */ {sqlite3VtabFinishParse(pParse,0);} break; - case 297: /* cmd ::= create_vtab LP vtabarglist RP */ + case 299: /* cmd ::= create_vtab LP vtabarglist RP */ {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} break; - case 298: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ + case 300: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ { - sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy394); + sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy144); } break; - case 299: /* vtabarg ::= */ + case 301: /* vtabarg ::= */ {sqlite3VtabArgInit(pParse);} break; - case 300: /* vtabargtoken ::= ANY */ - case 301: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==301); - case 302: /* lp ::= LP */ yytestcase(yyruleno==302); + case 302: /* vtabargtoken ::= ANY */ + case 303: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==303); + case 304: /* lp ::= LP */ yytestcase(yyruleno==304); {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} break; - case 303: /* with ::= WITH wqlist */ - case 304: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==304); -{ sqlite3WithPush(pParse, yymsp[0].minor.yy521, 1); } + case 305: /* with ::= WITH wqlist */ + case 306: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==306); +{ sqlite3WithPush(pParse, yymsp[0].minor.yy59, 1); } break; - case 305: /* wqas ::= AS */ -{yymsp[0].minor.yy516 = M10d_Any;} + case 307: /* wqas ::= AS */ +{yymsp[0].minor.yy462 = M10d_Any;} break; - case 306: /* wqas ::= AS MATERIALIZED */ -{yymsp[-1].minor.yy516 = M10d_Yes;} + case 308: /* wqas ::= AS MATERIALIZED */ +{yymsp[-1].minor.yy462 = M10d_Yes;} break; - case 307: /* wqas ::= AS NOT MATERIALIZED */ -{yymsp[-2].minor.yy516 = M10d_No;} + case 309: /* wqas ::= AS NOT MATERIALIZED */ +{yymsp[-2].minor.yy462 = M10d_No;} break; - case 308: /* wqitem ::= nm eidlist_opt wqas LP select RP */ + case 310: /* wqitem ::= withnm eidlist_opt wqas LP select RP */ { - yymsp[-5].minor.yy385 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy47, yymsp[-3].minor.yy516); /*A-overwrites-X*/ + yymsp[-5].minor.yy67 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy14, yymsp[-1].minor.yy555, yymsp[-3].minor.yy462); /*A-overwrites-X*/ } break; - case 309: /* wqlist ::= wqitem */ + case 311: /* withnm ::= nm */ +{pParse->bHasWith = 1;} + break; + case 312: /* wqlist ::= wqitem */ { - yymsp[0].minor.yy521 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy385); /*A-overwrites-X*/ + yymsp[0].minor.yy59 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy67); /*A-overwrites-X*/ } break; - case 310: /* wqlist ::= wqlist COMMA wqitem */ + case 313: /* wqlist ::= wqlist COMMA wqitem */ { - yymsp[-2].minor.yy521 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy521, yymsp[0].minor.yy385); + yymsp[-2].minor.yy59 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy59, yymsp[0].minor.yy67); } break; - case 311: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ + case 314: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ { - assert( yymsp[0].minor.yy41!=0 ); - sqlite3WindowChain(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy41); - yymsp[0].minor.yy41->pNextWin = yymsp[-2].minor.yy41; - yylhsminor.yy41 = yymsp[0].minor.yy41; + assert( yymsp[0].minor.yy211!=0 ); + sqlite3WindowChain(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy211); + yymsp[0].minor.yy211->pNextWin = yymsp[-2].minor.yy211; + yylhsminor.yy211 = yymsp[0].minor.yy211; } - yymsp[-2].minor.yy41 = yylhsminor.yy41; + yymsp[-2].minor.yy211 = yylhsminor.yy211; break; - case 312: /* windowdefn ::= nm AS LP window RP */ + case 315: /* windowdefn ::= nm AS LP window RP */ { - if( ALWAYS(yymsp[-1].minor.yy41) ){ - yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n); + if( ALWAYS(yymsp[-1].minor.yy211) ){ + yymsp[-1].minor.yy211->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n); } - yylhsminor.yy41 = yymsp[-1].minor.yy41; + yylhsminor.yy211 = yymsp[-1].minor.yy211; } - yymsp[-4].minor.yy41 = yylhsminor.yy41; + yymsp[-4].minor.yy211 = yylhsminor.yy211; break; - case 313: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ + case 316: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ { - yymsp[-4].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, 0); + yymsp[-4].minor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy14, yymsp[-1].minor.yy14, 0); } break; - case 314: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ + case 317: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ { - yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, &yymsp[-5].minor.yy0); + yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy14, yymsp[-1].minor.yy14, &yymsp[-5].minor.yy0); } - yymsp[-5].minor.yy41 = yylhsminor.yy41; + yymsp[-5].minor.yy211 = yylhsminor.yy211; break; - case 315: /* window ::= ORDER BY sortlist frame_opt */ + case 318: /* window ::= ORDER BY sortlist frame_opt */ { - yymsp[-3].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, 0); + yymsp[-3].minor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, yymsp[-1].minor.yy14, 0); } break; - case 316: /* window ::= nm ORDER BY sortlist frame_opt */ + case 319: /* window ::= nm ORDER BY sortlist frame_opt */ { - yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0); + yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, yymsp[-1].minor.yy14, &yymsp[-4].minor.yy0); } - yymsp[-4].minor.yy41 = yylhsminor.yy41; + yymsp[-4].minor.yy211 = yylhsminor.yy211; break; - case 317: /* window ::= nm frame_opt */ + case 320: /* window ::= nm frame_opt */ { - yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, 0, &yymsp[-1].minor.yy0); + yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, 0, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy41 = yylhsminor.yy41; + yymsp[-1].minor.yy211 = yylhsminor.yy211; break; - case 318: /* frame_opt ::= */ + case 321: /* frame_opt ::= */ { - yymsp[1].minor.yy41 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0); + yymsp[1].minor.yy211 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0); } break; - case 319: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ + case 322: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ { - yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy394, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy516); + yylhsminor.yy211 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy144, yymsp[-1].minor.yy509.eType, yymsp[-1].minor.yy509.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy462); } - yymsp[-2].minor.yy41 = yylhsminor.yy41; + yymsp[-2].minor.yy211 = yylhsminor.yy211; break; - case 320: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ + case 323: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ { - yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy394, yymsp[-3].minor.yy595.eType, yymsp[-3].minor.yy595.pExpr, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, yymsp[0].minor.yy516); + yylhsminor.yy211 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy144, yymsp[-3].minor.yy509.eType, yymsp[-3].minor.yy509.pExpr, yymsp[-1].minor.yy509.eType, yymsp[-1].minor.yy509.pExpr, yymsp[0].minor.yy462); } - yymsp[-5].minor.yy41 = yylhsminor.yy41; + yymsp[-5].minor.yy211 = yylhsminor.yy211; break; - case 322: /* frame_bound_s ::= frame_bound */ - case 324: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==324); -{yylhsminor.yy595 = yymsp[0].minor.yy595;} - yymsp[0].minor.yy595 = yylhsminor.yy595; + case 325: /* frame_bound_s ::= frame_bound */ + case 327: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==327); +{yylhsminor.yy509 = yymsp[0].minor.yy509;} + yymsp[0].minor.yy509 = yylhsminor.yy509; break; - case 323: /* frame_bound_s ::= UNBOUNDED PRECEDING */ - case 325: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==325); - case 327: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==327); -{yylhsminor.yy595.eType = yymsp[-1].major; yylhsminor.yy595.pExpr = 0;} - yymsp[-1].minor.yy595 = yylhsminor.yy595; + case 326: /* frame_bound_s ::= UNBOUNDED PRECEDING */ + case 328: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==328); + case 330: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==330); +{yylhsminor.yy509.eType = yymsp[-1].major; yylhsminor.yy509.pExpr = 0;} + yymsp[-1].minor.yy509 = yylhsminor.yy509; break; - case 326: /* frame_bound ::= expr PRECEDING|FOLLOWING */ -{yylhsminor.yy595.eType = yymsp[0].major; yylhsminor.yy595.pExpr = yymsp[-1].minor.yy528;} - yymsp[-1].minor.yy595 = yylhsminor.yy595; + case 329: /* frame_bound ::= expr PRECEDING|FOLLOWING */ +{yylhsminor.yy509.eType = yymsp[0].major; yylhsminor.yy509.pExpr = yymsp[-1].minor.yy454;} + yymsp[-1].minor.yy509 = yylhsminor.yy509; break; - case 328: /* frame_exclude_opt ::= */ -{yymsp[1].minor.yy516 = 0;} + case 331: /* frame_exclude_opt ::= */ +{yymsp[1].minor.yy462 = 0;} break; - case 329: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ -{yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;} + case 332: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ +{yymsp[-1].minor.yy462 = yymsp[0].minor.yy462;} break; - case 330: /* frame_exclude ::= NO OTHERS */ - case 331: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==331); -{yymsp[-1].minor.yy516 = yymsp[-1].major; /*A-overwrites-X*/} + case 333: /* frame_exclude ::= NO OTHERS */ + case 334: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==334); +{yymsp[-1].minor.yy462 = yymsp[-1].major; /*A-overwrites-X*/} break; - case 332: /* frame_exclude ::= GROUP|TIES */ -{yymsp[0].minor.yy516 = yymsp[0].major; /*A-overwrites-X*/} + case 335: /* frame_exclude ::= GROUP|TIES */ +{yymsp[0].minor.yy462 = yymsp[0].major; /*A-overwrites-X*/} break; - case 333: /* window_clause ::= WINDOW windowdefn_list */ -{ yymsp[-1].minor.yy41 = yymsp[0].minor.yy41; } + case 336: /* window_clause ::= WINDOW windowdefn_list */ +{ yymsp[-1].minor.yy211 = yymsp[0].minor.yy211; } break; - case 334: /* filter_over ::= filter_clause over_clause */ + case 337: /* filter_over ::= filter_clause over_clause */ { - if( yymsp[0].minor.yy41 ){ - yymsp[0].minor.yy41->pFilter = yymsp[-1].minor.yy528; + if( yymsp[0].minor.yy211 ){ + yymsp[0].minor.yy211->pFilter = yymsp[-1].minor.yy454; }else{ - sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528); + sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy454); } - yylhsminor.yy41 = yymsp[0].minor.yy41; + yylhsminor.yy211 = yymsp[0].minor.yy211; } - yymsp[-1].minor.yy41 = yylhsminor.yy41; + yymsp[-1].minor.yy211 = yylhsminor.yy211; break; - case 335: /* filter_over ::= over_clause */ + case 338: /* filter_over ::= over_clause */ { - yylhsminor.yy41 = yymsp[0].minor.yy41; + yylhsminor.yy211 = yymsp[0].minor.yy211; } - yymsp[0].minor.yy41 = yylhsminor.yy41; + yymsp[0].minor.yy211 = yylhsminor.yy211; break; - case 336: /* filter_over ::= filter_clause */ + case 339: /* filter_over ::= filter_clause */ { - yylhsminor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); - if( yylhsminor.yy41 ){ - yylhsminor.yy41->eFrmType = TK_FILTER; - yylhsminor.yy41->pFilter = yymsp[0].minor.yy528; + yylhsminor.yy211 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); + if( yylhsminor.yy211 ){ + yylhsminor.yy211->eFrmType = TK_FILTER; + yylhsminor.yy211->pFilter = yymsp[0].minor.yy454; }else{ - sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy528); + sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy454); } } - yymsp[0].minor.yy41 = yylhsminor.yy41; + yymsp[0].minor.yy211 = yylhsminor.yy211; break; - case 337: /* over_clause ::= OVER LP window RP */ + case 340: /* over_clause ::= OVER LP window RP */ { - yymsp[-3].minor.yy41 = yymsp[-1].minor.yy41; - assert( yymsp[-3].minor.yy41!=0 ); + yymsp[-3].minor.yy211 = yymsp[-1].minor.yy211; + assert( yymsp[-3].minor.yy211!=0 ); } break; - case 338: /* over_clause ::= OVER nm */ + case 341: /* over_clause ::= OVER nm */ { - yymsp[-1].minor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); - if( yymsp[-1].minor.yy41 ){ - yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); + yymsp[-1].minor.yy211 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); + if( yymsp[-1].minor.yy211 ){ + yymsp[-1].minor.yy211->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); } } break; - case 339: /* filter_clause ::= FILTER LP WHERE expr RP */ -{ yymsp[-4].minor.yy528 = yymsp[-1].minor.yy528; } + case 342: /* filter_clause ::= FILTER LP WHERE expr RP */ +{ yymsp[-4].minor.yy454 = yymsp[-1].minor.yy454; } + break; + case 343: /* term ::= QNUMBER */ +{ + yylhsminor.yy454=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); + sqlite3DequoteNumber(pParse, yylhsminor.yy454); +} + yymsp[0].minor.yy454 = yylhsminor.yy454; break; default: - /* (340) input ::= cmdlist */ yytestcase(yyruleno==340); - /* (341) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==341); - /* (342) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=342); - /* (343) ecmd ::= SEMI */ yytestcase(yyruleno==343); - /* (344) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==344); - /* (345) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=345); - /* (346) trans_opt ::= */ yytestcase(yyruleno==346); - /* (347) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==347); - /* (348) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==348); - /* (349) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==349); - /* (350) savepoint_opt ::= */ yytestcase(yyruleno==350); - /* (351) cmd ::= create_table create_table_args */ yytestcase(yyruleno==351); - /* (352) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=352); - /* (353) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==353); - /* (354) columnlist ::= columnname carglist */ yytestcase(yyruleno==354); - /* (355) nm ::= ID|INDEXED|JOIN_KW */ yytestcase(yyruleno==355); - /* (356) nm ::= STRING */ yytestcase(yyruleno==356); - /* (357) typetoken ::= typename */ yytestcase(yyruleno==357); - /* (358) typename ::= ID|STRING */ yytestcase(yyruleno==358); - /* (359) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=359); - /* (360) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=360); - /* (361) carglist ::= carglist ccons */ yytestcase(yyruleno==361); - /* (362) carglist ::= */ yytestcase(yyruleno==362); - /* (363) ccons ::= NULL onconf */ yytestcase(yyruleno==363); - /* (364) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==364); - /* (365) ccons ::= AS generated */ yytestcase(yyruleno==365); - /* (366) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==366); - /* (367) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==367); - /* (368) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=368); - /* (369) tconscomma ::= */ yytestcase(yyruleno==369); - /* (370) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=370); - /* (371) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=371); - /* (372) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=372); - /* (373) oneselect ::= values */ yytestcase(yyruleno==373); - /* (374) sclp ::= selcollist COMMA */ yytestcase(yyruleno==374); - /* (375) as ::= ID|STRING */ yytestcase(yyruleno==375); - /* (376) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=376); - /* (377) returning ::= */ yytestcase(yyruleno==377); - /* (378) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=378); - /* (379) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==379); - /* (380) case_operand ::= expr */ yytestcase(yyruleno==380); - /* (381) exprlist ::= nexprlist */ yytestcase(yyruleno==381); - /* (382) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=382); - /* (383) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=383); - /* (384) nmnum ::= ON */ yytestcase(yyruleno==384); - /* (385) nmnum ::= DELETE */ yytestcase(yyruleno==385); - /* (386) nmnum ::= DEFAULT */ yytestcase(yyruleno==386); - /* (387) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==387); - /* (388) foreach_clause ::= */ yytestcase(yyruleno==388); - /* (389) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==389); - /* (390) trnm ::= nm */ yytestcase(yyruleno==390); - /* (391) tridxby ::= */ yytestcase(yyruleno==391); - /* (392) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==392); - /* (393) database_kw_opt ::= */ yytestcase(yyruleno==393); - /* (394) kwcolumn_opt ::= */ yytestcase(yyruleno==394); - /* (395) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==395); - /* (396) vtabarglist ::= vtabarg */ yytestcase(yyruleno==396); - /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==397); - /* (398) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==398); - /* (399) anylist ::= */ yytestcase(yyruleno==399); - /* (400) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==400); - /* (401) anylist ::= anylist ANY */ yytestcase(yyruleno==401); - /* (402) with ::= */ yytestcase(yyruleno==402); - /* (403) windowdefn_list ::= windowdefn (OPTIMIZED OUT) */ assert(yyruleno!=403); - /* (404) window ::= frame_opt (OPTIMIZED OUT) */ assert(yyruleno!=404); + /* (344) input ::= cmdlist */ yytestcase(yyruleno==344); + /* (345) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==345); + /* (346) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=346); + /* (347) ecmd ::= SEMI */ yytestcase(yyruleno==347); + /* (348) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==348); + /* (349) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=349); + /* (350) trans_opt ::= */ yytestcase(yyruleno==350); + /* (351) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==351); + /* (352) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==352); + /* (353) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==353); + /* (354) savepoint_opt ::= */ yytestcase(yyruleno==354); + /* (355) cmd ::= create_table create_table_args */ yytestcase(yyruleno==355); + /* (356) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=356); + /* (357) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==357); + /* (358) columnlist ::= columnname carglist */ yytestcase(yyruleno==358); + /* (359) nm ::= ID|INDEXED|JOIN_KW */ yytestcase(yyruleno==359); + /* (360) nm ::= STRING */ yytestcase(yyruleno==360); + /* (361) typetoken ::= typename */ yytestcase(yyruleno==361); + /* (362) typename ::= ID|STRING */ yytestcase(yyruleno==362); + /* (363) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=363); + /* (364) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=364); + /* (365) carglist ::= carglist ccons */ yytestcase(yyruleno==365); + /* (366) carglist ::= */ yytestcase(yyruleno==366); + /* (367) ccons ::= NULL onconf */ yytestcase(yyruleno==367); + /* (368) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==368); + /* (369) ccons ::= AS generated */ yytestcase(yyruleno==369); + /* (370) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==370); + /* (371) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==371); + /* (372) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=372); + /* (373) tconscomma ::= */ yytestcase(yyruleno==373); + /* (374) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=374); + /* (375) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=375); + /* (376) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=376); + /* (377) oneselect ::= values */ yytestcase(yyruleno==377); + /* (378) sclp ::= selcollist COMMA */ yytestcase(yyruleno==378); + /* (379) as ::= ID|STRING */ yytestcase(yyruleno==379); + /* (380) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=380); + /* (381) returning ::= */ yytestcase(yyruleno==381); + /* (382) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=382); + /* (383) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==383); + /* (384) case_operand ::= expr */ yytestcase(yyruleno==384); + /* (385) exprlist ::= nexprlist */ yytestcase(yyruleno==385); + /* (386) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=386); + /* (387) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=387); + /* (388) nmnum ::= ON */ yytestcase(yyruleno==388); + /* (389) nmnum ::= DELETE */ yytestcase(yyruleno==389); + /* (390) nmnum ::= DEFAULT */ yytestcase(yyruleno==390); + /* (391) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==391); + /* (392) foreach_clause ::= */ yytestcase(yyruleno==392); + /* (393) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==393); + /* (394) trnm ::= nm */ yytestcase(yyruleno==394); + /* (395) tridxby ::= */ yytestcase(yyruleno==395); + /* (396) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==396); + /* (397) database_kw_opt ::= */ yytestcase(yyruleno==397); + /* (398) kwcolumn_opt ::= */ yytestcase(yyruleno==398); + /* (399) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==399); + /* (400) vtabarglist ::= vtabarg */ yytestcase(yyruleno==400); + /* (401) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==401); + /* (402) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==402); + /* (403) anylist ::= */ yytestcase(yyruleno==403); + /* (404) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==404); + /* (405) anylist ::= anylist ANY */ yytestcase(yyruleno==405); + /* (406) with ::= */ yytestcase(yyruleno==406); + /* (407) windowdefn_list ::= windowdefn (OPTIMIZED OUT) */ assert(yyruleno!=407); + /* (408) window ::= frame_opt (OPTIMIZED OUT) */ assert(yyruleno!=408); break; /********** End reduce actions ************************************************/ }; @@ -176211,19 +177839,12 @@ SQLITE_PRIVATE void sqlite3Parser( (int)(yypParser->yytos - yypParser->yystack)); } #endif -#if YYSTACKDEPTH>0 if( yypParser->yytos>=yypParser->yystackEnd ){ - yyStackOverflow(yypParser); - break; - } -#else - if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ if( yyGrowStack(yypParser) ){ yyStackOverflow(yypParser); break; } } -#endif } yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor sqlite3ParserCTX_PARAM); }else if( yyact <= YY_MAX_SHIFTREDUCE ){ @@ -177294,27 +178915,58 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){ *tokenType = TK_INTEGER; #ifndef SQLITE_OMIT_HEX_INTEGER if( z[0]=='0' && (z[1]=='x' || z[1]=='X') && sqlite3Isxdigit(z[2]) ){ - for(i=3; sqlite3Isxdigit(z[i]); i++){} - return i; - } + for(i=3; 1; i++){ + if( sqlite3Isxdigit(z[i])==0 ){ + if( z[i]==SQLITE_DIGIT_SEPARATOR ){ + *tokenType = TK_QNUMBER; + }else{ + break; + } + } + } + }else #endif - for(i=0; sqlite3Isdigit(z[i]); i++){} + { + for(i=0; 1; i++){ + if( sqlite3Isdigit(z[i])==0 ){ + if( z[i]==SQLITE_DIGIT_SEPARATOR ){ + *tokenType = TK_QNUMBER; + }else{ + break; + } + } + } #ifndef SQLITE_OMIT_FLOATING_POINT - if( z[i]=='.' ){ - i++; - while( sqlite3Isdigit(z[i]) ){ i++; } - *tokenType = TK_FLOAT; - } - if( (z[i]=='e' || z[i]=='E') && - ( sqlite3Isdigit(z[i+1]) - || ((z[i+1]=='+' || z[i+1]=='-') && sqlite3Isdigit(z[i+2])) - ) - ){ - i += 2; - while( sqlite3Isdigit(z[i]) ){ i++; } - *tokenType = TK_FLOAT; - } + if( z[i]=='.' ){ + if( *tokenType==TK_INTEGER ) *tokenType = TK_FLOAT; + for(i++; 1; i++){ + if( sqlite3Isdigit(z[i])==0 ){ + if( z[i]==SQLITE_DIGIT_SEPARATOR ){ + *tokenType = TK_QNUMBER; + }else{ + break; + } + } + } + } + if( (z[i]=='e' || z[i]=='E') && + ( sqlite3Isdigit(z[i+1]) + || ((z[i+1]=='+' || z[i+1]=='-') && sqlite3Isdigit(z[i+2])) + ) + ){ + if( *tokenType==TK_INTEGER ) *tokenType = TK_FLOAT; + for(i+=2; 1; i++){ + if( sqlite3Isdigit(z[i])==0 ){ + if( z[i]==SQLITE_DIGIT_SEPARATOR ){ + *tokenType = TK_QNUMBER; + }else{ + break; + } + } + } + } #endif + } while( IdChar(z[i]) ){ *tokenType = TK_ILLEGAL; i++; @@ -177479,10 +179131,13 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql){ if( tokenType>=TK_WINDOW ){ assert( tokenType==TK_SPACE || tokenType==TK_OVER || tokenType==TK_FILTER || tokenType==TK_ILLEGAL || tokenType==TK_WINDOW + || tokenType==TK_QNUMBER ); #else if( tokenType>=TK_SPACE ){ - assert( tokenType==TK_SPACE || tokenType==TK_ILLEGAL ); + assert( tokenType==TK_SPACE || tokenType==TK_ILLEGAL + || tokenType==TK_QNUMBER + ); #endif /* SQLITE_OMIT_WINDOWFUNC */ if( AtomicLoad(&db->u1.isInterrupted) ){ pParse->rc = SQLITE_INTERRUPT; @@ -177515,7 +179170,7 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql){ assert( n==6 ); tokenType = analyzeFilterKeyword((const u8*)&zSql[6], lastTokenParsed); #endif /* SQLITE_OMIT_WINDOWFUNC */ - }else{ + }else if( tokenType!=TK_QNUMBER ){ Token x; x.z = zSql; x.n = n; @@ -178866,6 +180521,18 @@ SQLITE_API int sqlite3_config(int op, ...){ } #endif /* SQLITE_OMIT_DESERIALIZE */ + case SQLITE_CONFIG_ROWID_IN_VIEW: { + int *pVal = va_arg(ap,int*); +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + if( 0==*pVal ) sqlite3GlobalConfig.mNoVisibleRowid = TF_NoVisibleRowid; + if( 1==*pVal ) sqlite3GlobalConfig.mNoVisibleRowid = 0; + *pVal = (sqlite3GlobalConfig.mNoVisibleRowid==0); +#else + *pVal = 0; +#endif + break; + } + default: { rc = SQLITE_ERROR; break; @@ -188498,22 +190165,24 @@ static int fts3IntegrityMethod( char **pzErr /* Write error message here */ ){ Fts3Table *p = (Fts3Table*)pVtab; - int rc; + int rc = SQLITE_OK; int bOk = 0; UNUSED_PARAMETER(isQuick); rc = sqlite3Fts3IntegrityCheck(p, &bOk); - assert( rc!=SQLITE_CORRUPT_VTAB || bOk==0 ); - if( rc!=SQLITE_OK && rc!=SQLITE_CORRUPT_VTAB ){ + assert( rc!=SQLITE_CORRUPT_VTAB ); + if( rc==SQLITE_ERROR || (rc&0xFF)==SQLITE_CORRUPT ){ *pzErr = sqlite3_mprintf("unable to validate the inverted index for" " FTS%d table %s.%s: %s", p->bFts4 ? 4 : 3, zSchema, zTabname, sqlite3_errstr(rc)); - }else if( bOk==0 ){ + if( *pzErr ) rc = SQLITE_OK; + }else if( rc==SQLITE_OK && bOk==0 ){ *pzErr = sqlite3_mprintf("malformed inverted index for FTS%d table %s.%s", p->bFts4 ? 4 : 3, zSchema, zTabname); + if( *pzErr==0 ) rc = SQLITE_NOMEM; } sqlite3Fts3SegmentsClose(p); - return SQLITE_OK; + return rc; } @@ -200175,7 +201844,12 @@ SQLITE_PRIVATE int sqlite3Fts3IntegrityCheck(Fts3Table *p, int *pbOk){ sqlite3_finalize(pStmt); } - *pbOk = (rc==SQLITE_OK && cksum1==cksum2); + if( rc==SQLITE_CORRUPT_VTAB ){ + rc = SQLITE_OK; + *pbOk = 0; + }else{ + *pbOk = (rc==SQLITE_OK && cksum1==cksum2); + } return rc; } @@ -201081,7 +202755,7 @@ static void fts3SnippetDetails( } mCover |= mPhrase; - for(j=0; jnToken; j++){ + for(j=0; jnToken && jnSnippet; j++){ mHighlight |= (mPos>>j); } @@ -203742,7 +205416,6 @@ static void jsonAppendRawNZ(JsonString *p, const char *zIn, u32 N){ } } - /* Append formatted text (not to exceed N bytes) to the JsonString. */ static void jsonPrintf(int N, JsonString *p, const char *zFormat, ...){ @@ -203800,6 +205473,40 @@ static void jsonAppendSeparator(JsonString *p){ jsonAppendChar(p, ','); } +/* c is a control character. Append the canonical JSON representation +** of that control character to p. +** +** This routine assumes that the output buffer has already been enlarged +** sufficiently to hold the worst-case encoding plus a nul terminator. +*/ +static void jsonAppendControlChar(JsonString *p, u8 c){ + static const char aSpecial[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 'b', 't', 'n', 0, 'f', 'r', 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + assert( sizeof(aSpecial)==32 ); + assert( aSpecial['\b']=='b' ); + assert( aSpecial['\f']=='f' ); + assert( aSpecial['\n']=='n' ); + assert( aSpecial['\r']=='r' ); + assert( aSpecial['\t']=='t' ); + assert( c>=0 && cnUsed+7 <= p->nAlloc ); + if( aSpecial[c] ){ + p->zBuf[p->nUsed] = '\\'; + p->zBuf[p->nUsed+1] = aSpecial[c]; + p->nUsed += 2; + }else{ + p->zBuf[p->nUsed] = '\\'; + p->zBuf[p->nUsed+1] = 'u'; + p->zBuf[p->nUsed+2] = '0'; + p->zBuf[p->nUsed+3] = '0'; + p->zBuf[p->nUsed+4] = "0123456789abcdef"[c>>4]; + p->zBuf[p->nUsed+5] = "0123456789abcdef"[c&0xf]; + p->nUsed += 6; + } +} + /* Append the N-byte string in zIn to the end of the JsonString string ** under construction. Enclose the string in double-quotes ("...") and ** escape any double-quotes or backslash characters contained within the @@ -203859,35 +205566,14 @@ static void jsonAppendString(JsonString *p, const char *zIn, u32 N){ } c = z[0]; if( c=='"' || c=='\\' ){ - json_simple_escape: if( (p->nUsed+N+3 > p->nAlloc) && jsonStringGrow(p,N+3)!=0 ) return; p->zBuf[p->nUsed++] = '\\'; p->zBuf[p->nUsed++] = c; }else if( c=='\'' ){ p->zBuf[p->nUsed++] = c; }else{ - static const char aSpecial[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 'b', 't', 'n', 0, 'f', 'r', 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - assert( sizeof(aSpecial)==32 ); - assert( aSpecial['\b']=='b' ); - assert( aSpecial['\f']=='f' ); - assert( aSpecial['\n']=='n' ); - assert( aSpecial['\r']=='r' ); - assert( aSpecial['\t']=='t' ); - assert( c>=0 && cnUsed+N+7 > p->nAlloc) && jsonStringGrow(p,N+7)!=0 ) return; - p->zBuf[p->nUsed++] = '\\'; - p->zBuf[p->nUsed++] = 'u'; - p->zBuf[p->nUsed++] = '0'; - p->zBuf[p->nUsed++] = '0'; - p->zBuf[p->nUsed++] = "0123456789abcdef"[c>>4]; - p->zBuf[p->nUsed++] = "0123456789abcdef"[c&0xf]; + jsonAppendControlChar(p, c); } z++; N--; @@ -204588,7 +206274,10 @@ static u32 jsonbValidityCheck( if( !jsonIsOk[z[j]] && z[j]!='\'' ){ if( z[j]=='"' ){ if( x==JSONB_TEXTJ ) return j+1; - }else if( z[j]!='\\' || j+1>=k ){ + }else if( z[j]<=0x1f ){ + /* Control characters in JSON5 string literals are ok */ + if( x==JSONB_TEXTJ ) return j+1; + }else if( NEVER(z[j]!='\\') || j+1>=k ){ return j+1; }else if( strchr("\"\\/bfnrt",z[j+1])!=0 ){ j++; @@ -204786,6 +206475,7 @@ json_parse_restart: case '[': { /* Parse array */ iThis = pParse->nBlob; + assert( i<=(u32)pParse->nJson ); jsonBlobAppendNode(pParse, JSONB_ARRAY, pParse->nJson - i, 0); iStart = pParse->nBlob; if( pParse->oom ) return -1; @@ -204882,9 +206572,14 @@ json_parse_restart: return -1; } }else if( c<=0x1f ){ - /* Control characters are not allowed in strings */ - pParse->iErr = j; - return -1; + if( c==0 ){ + pParse->iErr = j; + return -1; + } + /* Control characters are not allowed in canonical JSON string + ** literals, but are allowed in JSON5 string literals. */ + opcode = JSONB_TEXT5; + pParse->hasNonstd = 1; }else if( c=='"' ){ opcode = JSONB_TEXT5; } @@ -205100,6 +206795,7 @@ json_parse_restart: return i+4; } /* fall-through into the default case that checks for NaN */ + /* no break */ deliberate_fall_through } default: { u32 k; @@ -205184,6 +206880,10 @@ static void jsonReturnStringAsBlob(JsonString *pStr){ JsonParse px; memset(&px, 0, sizeof(px)); jsonStringTerminate(pStr); + if( pStr->eErr ){ + sqlite3_result_error_nomem(pStr->pCtx); + return; + } px.zJson = pStr->zBuf; px.nJson = pStr->nUsed; px.db = sqlite3_context_db_handle(pStr->pCtx); @@ -205364,7 +207064,7 @@ static u32 jsonTranslateBlobToText( zIn = (const char*)&pParse->aBlob[i+n]; jsonAppendChar(pOut, '"'); while( sz2>0 ){ - for(k=0; k0 ){ jsonAppendRawNZ(pOut, zIn, k); if( k>=sz2 ){ @@ -205379,6 +207079,13 @@ static u32 jsonTranslateBlobToText( sz2--; continue; } + if( zIn[0]<=0x1f ){ + if( pOut->nUsed+7>pOut->nAlloc && jsonStringGrow(pOut,7) ) break; + jsonAppendControlChar(pOut, zIn[0]); + zIn++; + sz2--; + continue; + } assert( zIn[0]=='\\' ); assert( sz2>=1 ); if( sz2<2 ){ @@ -205481,6 +207188,112 @@ static u32 jsonTranslateBlobToText( return i+n+sz; } +/* Context for recursion of json_pretty() +*/ +typedef struct JsonPretty JsonPretty; +struct JsonPretty { + JsonParse *pParse; /* The BLOB being rendered */ + JsonString *pOut; /* Generate pretty output into this string */ + const char *zIndent; /* Use this text for indentation */ + u32 szIndent; /* Bytes in zIndent[] */ + u32 nIndent; /* Current level of indentation */ +}; + +/* Append indentation to the pretty JSON under construction */ +static void jsonPrettyIndent(JsonPretty *pPretty){ + u32 jj; + for(jj=0; jjnIndent; jj++){ + jsonAppendRaw(pPretty->pOut, pPretty->zIndent, pPretty->szIndent); + } +} + +/* +** Translate the binary JSONB representation of JSON beginning at +** pParse->aBlob[i] into a JSON text string. Append the JSON +** text onto the end of pOut. Return the index in pParse->aBlob[] +** of the first byte past the end of the element that is translated. +** +** This is a variant of jsonTranslateBlobToText() that "pretty-prints" +** the output. Extra whitespace is inserted to make the JSON easier +** for humans to read. +** +** If an error is detected in the BLOB input, the pOut->eErr flag +** might get set to JSTRING_MALFORMED. But not all BLOB input errors +** are detected. So a malformed JSONB input might either result +** in an error, or in incorrect JSON. +** +** The pOut->eErr JSTRING_OOM flag is set on a OOM. +*/ +static u32 jsonTranslateBlobToPrettyText( + JsonPretty *pPretty, /* Pretty-printing context */ + u32 i /* Start rendering at this index */ +){ + u32 sz, n, j, iEnd; + const JsonParse *pParse = pPretty->pParse; + JsonString *pOut = pPretty->pOut; + n = jsonbPayloadSize(pParse, i, &sz); + if( n==0 ){ + pOut->eErr |= JSTRING_MALFORMED; + return pParse->nBlob+1; + } + switch( pParse->aBlob[i] & 0x0f ){ + case JSONB_ARRAY: { + j = i+n; + iEnd = j+sz; + jsonAppendChar(pOut, '['); + if( jnIndent++; + while( pOut->eErr==0 ){ + jsonPrettyIndent(pPretty); + j = jsonTranslateBlobToPrettyText(pPretty, j); + if( j>=iEnd ) break; + jsonAppendRawNZ(pOut, ",\n", 2); + } + jsonAppendChar(pOut, '\n'); + pPretty->nIndent--; + jsonPrettyIndent(pPretty); + } + jsonAppendChar(pOut, ']'); + i = iEnd; + break; + } + case JSONB_OBJECT: { + j = i+n; + iEnd = j+sz; + jsonAppendChar(pOut, '{'); + if( jnIndent++; + while( pOut->eErr==0 ){ + jsonPrettyIndent(pPretty); + j = jsonTranslateBlobToText(pParse, j, pOut); + if( j>iEnd ){ + pOut->eErr |= JSTRING_MALFORMED; + break; + } + jsonAppendRawNZ(pOut, ": ", 2); + j = jsonTranslateBlobToPrettyText(pPretty, j); + if( j>=iEnd ) break; + jsonAppendRawNZ(pOut, ",\n", 2); + } + jsonAppendChar(pOut, '\n'); + pPretty->nIndent--; + jsonPrettyIndent(pPretty); + } + jsonAppendChar(pOut, '}'); + i = iEnd; + break; + } + default: { + i = jsonTranslateBlobToText(pParse, i, pOut); + break; + } + } + return i; +} + + /* Return true if the input pJson ** ** For performance reasons, this routine does not do a detailed check of the @@ -206509,8 +208322,9 @@ rebuild_from_cache: } p->zJson = (char*)sqlite3_value_text(pArg); p->nJson = sqlite3_value_bytes(pArg); + if( db->mallocFailed ) goto json_pfa_oom; if( p->nJson==0 ) goto json_pfa_malformed; - if( NEVER(p->zJson==0) ) goto json_pfa_oom; + assert( p->zJson!=0 ); if( jsonConvertTextToBlob(p, (flgs & JSON_KEEPERROR) ? 0 : ctx) ){ if( flgs & JSON_KEEPERROR ){ p->nErr = 1; @@ -206676,10 +208490,10 @@ static void jsonDebugPrintBlob( if( sz==0 && x<=JSONB_FALSE ){ sqlite3_str_append(pOut, "\n", 1); }else{ - u32 i; + u32 j; sqlite3_str_appendall(pOut, ": \""); - for(i=iStart+n; iaBlob[i]; + for(j=iStart+n; jaBlob[j]; if( c<0x20 || c>=0x7f ) c = '.'; sqlite3_str_append(pOut, (char*)&c, 1); } @@ -206730,11 +208544,12 @@ static void jsonParseFunc( if( p==0 ) return; if( argc==1 ){ jsonDebugPrintBlob(p, 0, p->nBlob, 0, &out); - sqlite3_result_text64(ctx, out.zText, out.nChar, SQLITE_DYNAMIC, SQLITE_UTF8); + sqlite3_result_text64(ctx,out.zText,out.nChar,SQLITE_TRANSIENT,SQLITE_UTF8); }else{ jsonShowParse(p); } jsonParseFree(p); + sqlite3_str_reset(&out); } #endif /* SQLITE_DEBUG */ @@ -206833,13 +208648,6 @@ static void jsonArrayLengthFunc( jsonParseFree(p); } -/* True if the string is all digits */ -static int jsonAllDigits(const char *z, int n){ - int i; - for(i=0; i $[NUMBER] // Not PG. Purely for convenience */ jsonStringInit(&jx, ctx); - if( jsonAllDigits(zPath, nPath) ){ + if( sqlite3_value_type(argv[i])==SQLITE_INTEGER ){ jsonAppendRawNZ(&jx, "[", 1); jsonAppendRaw(&jx, zPath, nPath); jsonAppendRawNZ(&jx, "]", 2); @@ -207398,6 +209206,40 @@ json_type_done: jsonParseFree(p); } +/* +** json_pretty(JSON) +** json_pretty(JSON, INDENT) +** +** Return text that is a pretty-printed rendering of the input JSON. +** If the argument is not valid JSON, return NULL. +** +** The INDENT argument is text that is used for indentation. If omitted, +** it defaults to four spaces (the same as PostgreSQL). +*/ +static void jsonPrettyFunc( + sqlite3_context *ctx, + int argc, + sqlite3_value **argv +){ + JsonString s; /* The output string */ + JsonPretty x; /* Pretty printing context */ + + memset(&x, 0, sizeof(x)); + x.pParse = jsonParseFuncArg(ctx, argv[0], 0); + if( x.pParse==0 ) return; + x.pOut = &s; + jsonStringInit(&s, ctx); + if( argc==1 || (x.zIndent = (const char*)sqlite3_value_text(argv[1]))==0 ){ + x.zIndent = " "; + x.szIndent = 4; + }else{ + x.szIndent = (u32)strlen(x.zIndent); + } + jsonTranslateBlobToPrettyText(&x, 0); + jsonReturnString(&s, 0, 0); + jsonParseFree(x.pParse); +} + /* ** json_valid(JSON) ** json_valid(JSON, FLAGS) @@ -208087,6 +209929,9 @@ static int jsonEachColumn( case JEACH_VALUE: { u32 i = jsonSkipLabel(p); jsonReturnFromBlob(&p->sParse, i, ctx, 1); + if( (p->sParse.aBlob[i] & 0x0f)>=JSONB_ARRAY ){ + sqlite3_result_subtype(ctx, JSON_SUBTYPE); + } break; } case JEACH_TYPE: { @@ -208133,9 +209978,9 @@ static int jsonEachColumn( case JEACH_JSON: { if( p->sParse.zJson==0 ){ sqlite3_result_blob(ctx, p->sParse.aBlob, p->sParse.nBlob, - SQLITE_STATIC); + SQLITE_TRANSIENT); }else{ - sqlite3_result_text(ctx, p->sParse.zJson, -1, SQLITE_STATIC); + sqlite3_result_text(ctx, p->sParse.zJson, -1, SQLITE_TRANSIENT); } break; } @@ -208409,6 +210254,8 @@ SQLITE_PRIVATE void sqlite3RegisterJsonFunctions(void){ JFUNCTION(jsonb_object, -1,0,1, 1,1,0, jsonObjectFunc), JFUNCTION(json_patch, 2,1,1, 0,0,0, jsonPatchFunc), JFUNCTION(jsonb_patch, 2,1,0, 0,1,0, jsonPatchFunc), + JFUNCTION(json_pretty, 1,1,0, 0,0,0, jsonPrettyFunc), + JFUNCTION(json_pretty, 2,1,0, 0,0,0, jsonPrettyFunc), JFUNCTION(json_quote, 1,0,1, 1,0,0, jsonQuoteFunc), JFUNCTION(json_remove, -1,1,1, 0,0,0, jsonRemoveFunc), JFUNCTION(jsonb_remove, -1,1,0, 0,1,0, jsonRemoveFunc), @@ -209161,11 +211008,9 @@ static RtreeNode *nodeNew(Rtree *pRtree, RtreeNode *pParent){ ** Clear the Rtree.pNodeBlob object */ static void nodeBlobReset(Rtree *pRtree){ - if( pRtree->pNodeBlob && pRtree->inWrTrans==0 && pRtree->nCursor==0 ){ - sqlite3_blob *pBlob = pRtree->pNodeBlob; - pRtree->pNodeBlob = 0; - sqlite3_blob_close(pBlob); - } + sqlite3_blob *pBlob = pRtree->pNodeBlob; + pRtree->pNodeBlob = 0; + sqlite3_blob_close(pBlob); } /* @@ -209209,7 +211054,6 @@ static int nodeAcquire( &pRtree->pNodeBlob); } if( rc ){ - nodeBlobReset(pRtree); *ppNode = 0; /* If unable to open an sqlite3_blob on the desired row, that can only ** be because the shadow tables hold erroneous data. */ @@ -209269,6 +211113,7 @@ static int nodeAcquire( } *ppNode = pNode; }else{ + nodeBlobReset(pRtree); if( pNode ){ pRtree->nNodeRef--; sqlite3_free(pNode); @@ -209413,6 +211258,7 @@ static void nodeGetCoord( int iCoord, /* Which coordinate to extract */ RtreeCoord *pCoord /* OUT: Space to write result to */ ){ + assert( iCellzData[12 + pRtree->nBytesPerCell*iCell + 4*iCoord], pCoord); } @@ -209602,7 +211448,9 @@ static int rtreeClose(sqlite3_vtab_cursor *cur){ sqlite3_finalize(pCsr->pReadAux); sqlite3_free(pCsr); pRtree->nCursor--; - nodeBlobReset(pRtree); + if( pRtree->nCursor==0 && pRtree->inWrTrans==0 ){ + nodeBlobReset(pRtree); + } return SQLITE_OK; } @@ -210187,7 +212035,11 @@ static int rtreeRowid(sqlite3_vtab_cursor *pVtabCursor, sqlite_int64 *pRowid){ int rc = SQLITE_OK; RtreeNode *pNode = rtreeNodeOfFirstSearchPoint(pCsr, &rc); if( rc==SQLITE_OK && ALWAYS(p) ){ - *pRowid = nodeGetRowid(RTREE_OF_CURSOR(pCsr), pNode, p->iCell); + if( p->iCell>=NCELL(pNode) ){ + rc = SQLITE_ABORT; + }else{ + *pRowid = nodeGetRowid(RTREE_OF_CURSOR(pCsr), pNode, p->iCell); + } } return rc; } @@ -210205,6 +212057,7 @@ static int rtreeColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){ if( rc ) return rc; if( NEVER(p==0) ) return SQLITE_OK; + if( p->iCell>=NCELL(pNode) ) return SQLITE_ABORT; if( i==0 ){ sqlite3_result_int64(ctx, nodeGetRowid(pRtree, pNode, p->iCell)); }else if( i<=pRtree->nDim2 ){ @@ -210302,6 +212155,8 @@ static int deserializeGeometry(sqlite3_value *pValue, RtreeConstraint *pCons){ return SQLITE_OK; } +SQLITE_PRIVATE int sqlite3IntFloatCompare(i64,double); + /* ** Rtree virtual table module xFilter method. */ @@ -210331,7 +212186,8 @@ static int rtreeFilter( i64 iNode = 0; int eType = sqlite3_value_numeric_type(argv[0]); if( eType==SQLITE_INTEGER - || (eType==SQLITE_FLOAT && sqlite3_value_double(argv[0])==iRowid) + || (eType==SQLITE_FLOAT + && 0==sqlite3IntFloatCompare(iRowid,sqlite3_value_double(argv[0]))) ){ rc = findLeafNode(pRtree, iRowid, &pLeaf, &iNode); }else{ @@ -211687,7 +213543,7 @@ constraint: static int rtreeBeginTransaction(sqlite3_vtab *pVtab){ Rtree *pRtree = (Rtree *)pVtab; assert( pRtree->inWrTrans==0 ); - pRtree->inWrTrans++; + pRtree->inWrTrans = 1; return SQLITE_OK; } @@ -211701,6 +213557,9 @@ static int rtreeEndTransaction(sqlite3_vtab *pVtab){ nodeBlobReset(pRtree); return SQLITE_OK; } +static int rtreeRollback(sqlite3_vtab *pVtab){ + return rtreeEndTransaction(pVtab); +} /* ** The xRename method for rtree module virtual tables. @@ -211819,7 +213678,7 @@ static sqlite3_module rtreeModule = { rtreeBeginTransaction, /* xBegin - begin transaction */ rtreeEndTransaction, /* xSync - sync transaction */ rtreeEndTransaction, /* xCommit - commit transaction */ - rtreeEndTransaction, /* xRollback - rollback transaction */ + rtreeRollback, /* xRollback - rollback transaction */ 0, /* xFindFunction - function overloading */ rtreeRename, /* xRename - rename the table */ rtreeSavepoint, /* xSavepoint */ @@ -215238,7 +217097,7 @@ static void icuLoadCollation( UCollator *pUCollator; /* ICU library collation object */ int rc; /* Return code from sqlite3_create_collation_x() */ - assert(nArg==2); + assert(nArg==2 || nArg==3); (void)nArg; /* Unused parameter */ zLocale = (const char *)sqlite3_value_text(apArg[0]); zName = (const char *)sqlite3_value_text(apArg[1]); @@ -215253,7 +217112,39 @@ static void icuLoadCollation( return; } assert(p); - + if(nArg==3){ + const char *zOption = (const char*)sqlite3_value_text(apArg[2]); + static const struct { + const char *zName; + UColAttributeValue val; + } aStrength[] = { + { "PRIMARY", UCOL_PRIMARY }, + { "SECONDARY", UCOL_SECONDARY }, + { "TERTIARY", UCOL_TERTIARY }, + { "DEFAULT", UCOL_DEFAULT_STRENGTH }, + { "QUARTERNARY", UCOL_QUATERNARY }, + { "IDENTICAL", UCOL_IDENTICAL }, + }; + unsigned int i; + for(i=0; i=sizeof(aStrength)/sizeof(aStrength[0]) ){ + sqlite3_str *pStr = sqlite3_str_new(sqlite3_context_db_handle(p)); + sqlite3_str_appendf(pStr, + "unknown collation strength \"%s\" - should be one of:", + zOption); + for(i=0; ipTblIter, &p->zErrmsg); pIter->zTbl = 0; + pIter->zDataTbl = 0; }else{ pIter->zTbl = (const char*)sqlite3_column_text(pIter->pTblIter, 0); pIter->zDataTbl = (const char*)sqlite3_column_text(pIter->pTblIter,1); @@ -219206,7 +221100,7 @@ static i64 rbuShmChecksum(sqlite3rbu *p){ u32 volatile *ptr; p->rc = pDb->pMethods->xShmMap(pDb, 0, 32*1024, 0, (void volatile**)&ptr); if( p->rc==SQLITE_OK ){ - iRet = ((i64)ptr[10] << 32) + ptr[11]; + iRet = (i64)(((u64)ptr[10] << 32) + ptr[11]); } } return iRet; @@ -226677,14 +228571,14 @@ static int sessionChangesetNextOne( p->rc = sessionInputBuffer(&p->in, 2); if( p->rc!=SQLITE_OK ) return p->rc; + sessionDiscardData(&p->in); + p->in.iCurrent = p->in.iNext; + /* If the iterator is already at the end of the changeset, return DONE. */ if( p->in.iNext>=p->in.nData ){ return SQLITE_DONE; } - sessionDiscardData(&p->in); - p->in.iCurrent = p->in.iNext; - op = p->in.aData[p->in.iNext++]; while( op=='T' || op=='P' ){ if( pbNew ) *pbNew = 1; @@ -228419,6 +230313,7 @@ struct sqlite3_changegroup { int rc; /* Error code */ int bPatch; /* True to accumulate patchsets */ SessionTable *pList; /* List of tables in current patch */ + SessionBuffer rec; sqlite3 *db; /* Configured by changegroup_schema() */ char *zDb; /* Configured by changegroup_schema() */ @@ -228717,108 +230612,128 @@ static int sessionChangesetExtendRecord( } /* -** Add all changes in the changeset traversed by the iterator passed as -** the first argument to the changegroup hash tables. +** Locate or create a SessionTable object that may be used to add the +** change currently pointed to by iterator pIter to changegroup pGrp. +** If successful, set output variable (*ppTab) to point to the table +** object and return SQLITE_OK. Otherwise, if some error occurs, return +** an SQLite error code and leave (*ppTab) set to NULL. */ -static int sessionChangesetToHash( - sqlite3_changeset_iter *pIter, /* Iterator to read from */ - sqlite3_changegroup *pGrp, /* Changegroup object to add changeset to */ - int bRebase /* True if hash table is for rebasing */ +static int sessionChangesetFindTable( + sqlite3_changegroup *pGrp, + const char *zTab, + sqlite3_changeset_iter *pIter, + SessionTable **ppTab ){ - u8 *aRec; - int nRec; int rc = SQLITE_OK; SessionTable *pTab = 0; - SessionBuffer rec = {0, 0, 0}; + int nTab = (int)strlen(zTab); + u8 *abPK = 0; + int nCol = 0; - while( SQLITE_ROW==sessionChangesetNext(pIter, &aRec, &nRec, 0) ){ - const char *zNew; - int nCol; - int op; - int iHash; - int bIndirect; - SessionChange *pChange; - SessionChange *pExist = 0; - SessionChange **pp; + *ppTab = 0; + sqlite3changeset_pk(pIter, &abPK, &nCol); - /* Ensure that only changesets, or only patchsets, but not a mixture - ** of both, are being combined. It is an error to try to combine a - ** changeset and a patchset. */ - if( pGrp->pList==0 ){ - pGrp->bPatch = pIter->bPatchset; - }else if( pIter->bPatchset!=pGrp->bPatch ){ - rc = SQLITE_ERROR; - break; + /* Search the list for an existing table */ + for(pTab = pGrp->pList; pTab; pTab=pTab->pNext){ + if( 0==sqlite3_strnicmp(pTab->zName, zTab, nTab+1) ) break; + } + + /* If one was not found above, create a new table now */ + if( !pTab ){ + SessionTable **ppNew; + + pTab = sqlite3_malloc64(sizeof(SessionTable) + nCol + nTab+1); + if( !pTab ){ + return SQLITE_NOMEM; } + memset(pTab, 0, sizeof(SessionTable)); + pTab->nCol = nCol; + pTab->abPK = (u8*)&pTab[1]; + memcpy(pTab->abPK, abPK, nCol); + pTab->zName = (char*)&pTab->abPK[nCol]; + memcpy(pTab->zName, zTab, nTab+1); - sqlite3changeset_op(pIter, &zNew, &nCol, &op, &bIndirect); - if( !pTab || sqlite3_stricmp(zNew, pTab->zName) ){ - /* Search the list for a matching table */ - int nNew = (int)strlen(zNew); - u8 *abPK; - - sqlite3changeset_pk(pIter, &abPK, 0); - for(pTab = pGrp->pList; pTab; pTab=pTab->pNext){ - if( 0==sqlite3_strnicmp(pTab->zName, zNew, nNew+1) ) break; - } - if( !pTab ){ - SessionTable **ppTab; - - pTab = sqlite3_malloc64(sizeof(SessionTable) + nCol + nNew+1); - if( !pTab ){ - rc = SQLITE_NOMEM; - break; - } - memset(pTab, 0, sizeof(SessionTable)); - pTab->nCol = nCol; - pTab->abPK = (u8*)&pTab[1]; - memcpy(pTab->abPK, abPK, nCol); - pTab->zName = (char*)&pTab->abPK[nCol]; - memcpy(pTab->zName, zNew, nNew+1); - - if( pGrp->db ){ - pTab->nCol = 0; - rc = sessionInitTable(0, pTab, pGrp->db, pGrp->zDb); - if( rc ){ - assert( pTab->azCol==0 ); - sqlite3_free(pTab); - break; - } - } - - /* The new object must be linked on to the end of the list, not - ** simply added to the start of it. This is to ensure that the - ** tables within the output of sqlite3changegroup_output() are in - ** the right order. */ - for(ppTab=&pGrp->pList; *ppTab; ppTab=&(*ppTab)->pNext); - *ppTab = pTab; - } - - if( !sessionChangesetCheckCompat(pTab, nCol, abPK) ){ - rc = SQLITE_SCHEMA; - break; + if( pGrp->db ){ + pTab->nCol = 0; + rc = sessionInitTable(0, pTab, pGrp->db, pGrp->zDb); + if( rc ){ + assert( pTab->azCol==0 ); + sqlite3_free(pTab); + return rc; } } - if( nColnCol ){ - assert( pGrp->db ); - rc = sessionChangesetExtendRecord(pGrp, pTab, nCol, op, aRec, nRec, &rec); - if( rc ) break; - aRec = rec.aBuf; - nRec = rec.nBuf; - } + /* The new object must be linked on to the end of the list, not + ** simply added to the start of it. This is to ensure that the + ** tables within the output of sqlite3changegroup_output() are in + ** the right order. */ + for(ppNew=&pGrp->pList; *ppNew; ppNew=&(*ppNew)->pNext); + *ppNew = pTab; + } - if( sessionGrowHash(0, pIter->bPatchset, pTab) ){ - rc = SQLITE_NOMEM; - break; - } + /* Check that the table is compatible. */ + if( !sessionChangesetCheckCompat(pTab, nCol, abPK) ){ + rc = SQLITE_SCHEMA; + } + + *ppTab = pTab; + return rc; +} + +/* +** Add the change currently indicated by iterator pIter to the hash table +** belonging to changegroup pGrp. +*/ +static int sessionOneChangeToHash( + sqlite3_changegroup *pGrp, + sqlite3_changeset_iter *pIter, + int bRebase +){ + int rc = SQLITE_OK; + int nCol = 0; + int op = 0; + int iHash = 0; + int bIndirect = 0; + SessionChange *pChange = 0; + SessionChange *pExist = 0; + SessionChange **pp = 0; + SessionTable *pTab = 0; + u8 *aRec = &pIter->in.aData[pIter->in.iCurrent + 2]; + int nRec = (pIter->in.iNext - pIter->in.iCurrent) - 2; + + /* Ensure that only changesets, or only patchsets, but not a mixture + ** of both, are being combined. It is an error to try to combine a + ** changeset and a patchset. */ + if( pGrp->pList==0 ){ + pGrp->bPatch = pIter->bPatchset; + }else if( pIter->bPatchset!=pGrp->bPatch ){ + rc = SQLITE_ERROR; + } + + if( rc==SQLITE_OK ){ + const char *zTab = 0; + sqlite3changeset_op(pIter, &zTab, &nCol, &op, &bIndirect); + rc = sessionChangesetFindTable(pGrp, zTab, pIter, &pTab); + } + + if( rc==SQLITE_OK && nColnCol ){ + SessionBuffer *pBuf = &pGrp->rec; + rc = sessionChangesetExtendRecord(pGrp, pTab, nCol, op, aRec, nRec, pBuf); + aRec = pBuf->aBuf; + nRec = pBuf->nBuf; + assert( pGrp->db ); + } + + if( rc==SQLITE_OK && sessionGrowHash(0, pIter->bPatchset, pTab) ){ + rc = SQLITE_NOMEM; + } + + if( rc==SQLITE_OK ){ + /* Search for existing entry. If found, remove it from the hash table. + ** Code below may link it back in. */ iHash = sessionChangeHash( pTab, (pIter->bPatchset && op==SQLITE_DELETE), aRec, pTab->nChange ); - - /* Search for existing entry. If found, remove it from the hash table. - ** Code below may link it back in. - */ for(pp=&pTab->apChange[iHash]; *pp; pp=&(*pp)->pNext){ int bPkOnly1 = 0; int bPkOnly2 = 0; @@ -228833,19 +230748,41 @@ static int sessionChangesetToHash( break; } } + } + if( rc==SQLITE_OK ){ rc = sessionChangeMerge(pTab, bRebase, pIter->bPatchset, pExist, op, bIndirect, aRec, nRec, &pChange ); - if( rc ) break; - if( pChange ){ - pChange->pNext = pTab->apChange[iHash]; - pTab->apChange[iHash] = pChange; - pTab->nEntry++; - } + } + if( rc==SQLITE_OK && pChange ){ + pChange->pNext = pTab->apChange[iHash]; + pTab->apChange[iHash] = pChange; + pTab->nEntry++; + } + + if( rc==SQLITE_OK ) rc = pIter->rc; + return rc; +} + +/* +** Add all changes in the changeset traversed by the iterator passed as +** the first argument to the changegroup hash tables. +*/ +static int sessionChangesetToHash( + sqlite3_changeset_iter *pIter, /* Iterator to read from */ + sqlite3_changegroup *pGrp, /* Changegroup object to add changeset to */ + int bRebase /* True if hash table is for rebasing */ +){ + u8 *aRec; + int nRec; + int rc = SQLITE_OK; + + while( SQLITE_ROW==(sessionChangesetNext(pIter, &aRec, &nRec, 0)) ){ + rc = sessionOneChangeToHash(pGrp, pIter, bRebase); + if( rc!=SQLITE_OK ) break; } - sqlite3_free(rec.aBuf); if( rc==SQLITE_OK ) rc = pIter->rc; return rc; } @@ -228973,6 +230910,23 @@ SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup *pGrp, int nData, void return rc; } +/* +** Add a single change to a changeset-group. +*/ +SQLITE_API int sqlite3changegroup_add_change( + sqlite3_changegroup *pGrp, + sqlite3_changeset_iter *pIter +){ + if( pIter->in.iCurrent==pIter->in.iNext + || pIter->rc!=SQLITE_OK + || pIter->bInvert + ){ + /* Iterator does not point to any valid entry or is an INVERT iterator. */ + return SQLITE_ERROR; + } + return sessionOneChangeToHash(pGrp, pIter, 0); +} + /* ** Obtain a buffer containing a changeset representing the concatenation ** of all changesets added to the group so far. @@ -229022,6 +230976,7 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup *pGrp){ if( pGrp ){ sqlite3_free(pGrp->zDb); sessionDeleteTable(0, pGrp->pList); + sqlite3_free(pGrp->rec.aBuf); sqlite3_free(pGrp); } } @@ -229423,6 +231378,7 @@ SQLITE_API int sqlite3rebaser_rebase_strm( SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p){ if( p ){ sessionDeleteTable(0, p->grp.pList); + sqlite3_free(p->grp.rec.aBuf); sqlite3_free(p); } } @@ -229520,8 +231476,8 @@ struct Fts5PhraseIter { ** EXTENSION API FUNCTIONS ** ** xUserData(pFts): -** Return a copy of the context pointer the extension function was -** registered with. +** Return a copy of the pUserData pointer passed to the xCreateFunction() +** API when the extension function was registered. ** ** xColumnTotalSize(pFts, iCol, pnToken): ** If parameter iCol is less than zero, set output variable *pnToken @@ -231117,6 +233073,9 @@ static void sqlite3Fts5UnicodeAscii(u8*, u8*); ** sqlite3Fts5ParserARG_STORE Code to store %extra_argument into fts5yypParser ** sqlite3Fts5ParserARG_FETCH Code to extract %extra_argument from fts5yypParser ** sqlite3Fts5ParserCTX_* As sqlite3Fts5ParserARG_ except for %extra_context +** fts5YYREALLOC Name of the realloc() function to use +** fts5YYFREE Name of the free() function to use +** fts5YYDYNSTACK True if stack space should be extended on heap ** fts5YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** fts5YYNSTATE the combined number of states. @@ -231130,6 +233089,8 @@ static void sqlite3Fts5UnicodeAscii(u8*, u8*); ** fts5YY_NO_ACTION The fts5yy_action[] code for no-op ** fts5YY_MIN_REDUCE Minimum value for reduce actions ** fts5YY_MAX_REDUCE Maximum value for reduce actions +** fts5YY_MIN_DSTRCTR Minimum symbol value that has a destructor +** fts5YY_MAX_DSTRCTR Maximum symbol value that has a destructor */ #ifndef INTERFACE # define INTERFACE 1 @@ -231156,6 +233117,9 @@ typedef union { #define sqlite3Fts5ParserARG_PARAM ,pParse #define sqlite3Fts5ParserARG_FETCH Fts5Parse *pParse=fts5yypParser->pParse; #define sqlite3Fts5ParserARG_STORE fts5yypParser->pParse=pParse; +#define fts5YYREALLOC realloc +#define fts5YYFREE free +#define fts5YYDYNSTACK 0 #define sqlite3Fts5ParserCTX_SDECL #define sqlite3Fts5ParserCTX_PDECL #define sqlite3Fts5ParserCTX_PARAM @@ -231173,6 +233137,8 @@ typedef union { #define fts5YY_NO_ACTION 82 #define fts5YY_MIN_REDUCE 83 #define fts5YY_MAX_REDUCE 110 +#define fts5YY_MIN_DSTRCTR 16 +#define fts5YY_MAX_DSTRCTR 24 /************* End control #defines *******************************************/ #define fts5YY_NLOOKAHEAD ((int)(sizeof(fts5yy_lookahead)/sizeof(fts5yy_lookahead[0]))) @@ -231188,6 +233154,22 @@ typedef union { # define fts5yytestcase(X) #endif +/* Macro to determine if stack space has the ability to grow using +** heap memory. +*/ +#if fts5YYSTACKDEPTH<=0 || fts5YYDYNSTACK +# define fts5YYGROWABLESTACK 1 +#else +# define fts5YYGROWABLESTACK 0 +#endif + +/* Guarantee a minimum number of initial stack slots. +*/ +#if fts5YYSTACKDEPTH<=0 +# undef fts5YYSTACKDEPTH +# define fts5YYSTACKDEPTH 2 /* Need a minimum stack size */ +#endif + /* Next are the tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement @@ -231348,14 +233330,9 @@ struct fts5yyParser { #endif sqlite3Fts5ParserARG_SDECL /* A place to hold %extra_argument */ sqlite3Fts5ParserCTX_SDECL /* A place to hold %extra_context */ -#if fts5YYSTACKDEPTH<=0 - int fts5yystksz; /* Current side of the stack */ - fts5yyStackEntry *fts5yystack; /* The parser's stack */ - fts5yyStackEntry fts5yystk0; /* First stack entry */ -#else - fts5yyStackEntry fts5yystack[fts5YYSTACKDEPTH]; /* The parser's stack */ - fts5yyStackEntry *fts5yystackEnd; /* Last entry in the stack */ -#endif + fts5yyStackEntry *fts5yystackEnd; /* Last entry in the stack */ + fts5yyStackEntry *fts5yystack; /* The parser stack */ + fts5yyStackEntry fts5yystk0[fts5YYSTACKDEPTH]; /* Initial stack space */ }; typedef struct fts5yyParser fts5yyParser; @@ -231462,37 +233439,45 @@ static const char *const fts5yyRuleName[] = { #endif /* NDEBUG */ -#if fts5YYSTACKDEPTH<=0 +#if fts5YYGROWABLESTACK /* ** Try to increase the size of the parser stack. Return the number ** of errors. Return 0 on success. */ static int fts5yyGrowStack(fts5yyParser *p){ + int oldSize = 1 + (int)(p->fts5yystackEnd - p->fts5yystack); int newSize; int idx; fts5yyStackEntry *pNew; - newSize = p->fts5yystksz*2 + 100; - idx = p->fts5yytos ? (int)(p->fts5yytos - p->fts5yystack) : 0; - if( p->fts5yystack==&p->fts5yystk0 ){ - pNew = malloc(newSize*sizeof(pNew[0])); - if( pNew ) pNew[0] = p->fts5yystk0; + newSize = oldSize*2 + 100; + idx = (int)(p->fts5yytos - p->fts5yystack); + if( p->fts5yystack==p->fts5yystk0 ){ + pNew = fts5YYREALLOC(0, newSize*sizeof(pNew[0])); + if( pNew==0 ) return 1; + memcpy(pNew, p->fts5yystack, oldSize*sizeof(pNew[0])); }else{ - pNew = realloc(p->fts5yystack, newSize*sizeof(pNew[0])); + pNew = fts5YYREALLOC(p->fts5yystack, newSize*sizeof(pNew[0])); + if( pNew==0 ) return 1; } - if( pNew ){ - p->fts5yystack = pNew; - p->fts5yytos = &p->fts5yystack[idx]; + p->fts5yystack = pNew; + p->fts5yytos = &p->fts5yystack[idx]; #ifndef NDEBUG - if( fts5yyTraceFILE ){ - fprintf(fts5yyTraceFILE,"%sStack grows from %d to %d entries.\n", - fts5yyTracePrompt, p->fts5yystksz, newSize); - } -#endif - p->fts5yystksz = newSize; + if( fts5yyTraceFILE ){ + fprintf(fts5yyTraceFILE,"%sStack grows from %d to %d entries.\n", + fts5yyTracePrompt, oldSize, newSize); } - return pNew==0; +#endif + p->fts5yystackEnd = &p->fts5yystack[newSize-1]; + return 0; } +#endif /* fts5YYGROWABLESTACK */ + +#if !fts5YYGROWABLESTACK +/* For builds that do no have a growable stack, fts5yyGrowStack always +** returns an error. +*/ +# define fts5yyGrowStack(X) 1 #endif /* Datatype of the argument to the memory allocated passed as the @@ -231512,24 +233497,14 @@ static void sqlite3Fts5ParserInit(void *fts5yypRawParser sqlite3Fts5ParserCTX_PD #ifdef fts5YYTRACKMAXSTACKDEPTH fts5yypParser->fts5yyhwm = 0; #endif -#if fts5YYSTACKDEPTH<=0 - fts5yypParser->fts5yytos = NULL; - fts5yypParser->fts5yystack = NULL; - fts5yypParser->fts5yystksz = 0; - if( fts5yyGrowStack(fts5yypParser) ){ - fts5yypParser->fts5yystack = &fts5yypParser->fts5yystk0; - fts5yypParser->fts5yystksz = 1; - } -#endif + fts5yypParser->fts5yystack = fts5yypParser->fts5yystk0; + fts5yypParser->fts5yystackEnd = &fts5yypParser->fts5yystack[fts5YYSTACKDEPTH-1]; #ifndef fts5YYNOERRORRECOVERY fts5yypParser->fts5yyerrcnt = -1; #endif fts5yypParser->fts5yytos = fts5yypParser->fts5yystack; fts5yypParser->fts5yystack[0].stateno = 0; fts5yypParser->fts5yystack[0].major = 0; -#if fts5YYSTACKDEPTH>0 - fts5yypParser->fts5yystackEnd = &fts5yypParser->fts5yystack[fts5YYSTACKDEPTH-1]; -#endif } #ifndef sqlite3Fts5Parser_ENGINEALWAYSONSTACK @@ -231643,9 +233618,26 @@ static void fts5yy_pop_parser_stack(fts5yyParser *pParser){ */ static void sqlite3Fts5ParserFinalize(void *p){ fts5yyParser *pParser = (fts5yyParser*)p; - while( pParser->fts5yytos>pParser->fts5yystack ) fts5yy_pop_parser_stack(pParser); -#if fts5YYSTACKDEPTH<=0 - if( pParser->fts5yystack!=&pParser->fts5yystk0 ) free(pParser->fts5yystack); + + /* In-lined version of calling fts5yy_pop_parser_stack() for each + ** element left in the stack */ + fts5yyStackEntry *fts5yytos = pParser->fts5yytos; + while( fts5yytos>pParser->fts5yystack ){ +#ifndef NDEBUG + if( fts5yyTraceFILE ){ + fprintf(fts5yyTraceFILE,"%sPopping %s\n", + fts5yyTracePrompt, + fts5yyTokenName[fts5yytos->major]); + } +#endif + if( fts5yytos->major>=fts5YY_MIN_DSTRCTR ){ + fts5yy_destructor(pParser, fts5yytos->major, &fts5yytos->minor); + } + fts5yytos--; + } + +#if fts5YYGROWABLESTACK + if( pParser->fts5yystack!=pParser->fts5yystk0 ) fts5YYFREE(pParser->fts5yystack); #endif } @@ -231872,25 +233864,19 @@ static void fts5yy_shift( assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack) ); } #endif -#if fts5YYSTACKDEPTH>0 - if( fts5yypParser->fts5yytos>fts5yypParser->fts5yystackEnd ){ - fts5yypParser->fts5yytos--; - fts5yyStackOverflow(fts5yypParser); - return; - } -#else - if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz] ){ + fts5yytos = fts5yypParser->fts5yytos; + if( fts5yytos>fts5yypParser->fts5yystackEnd ){ if( fts5yyGrowStack(fts5yypParser) ){ fts5yypParser->fts5yytos--; fts5yyStackOverflow(fts5yypParser); return; } + fts5yytos = fts5yypParser->fts5yytos; + assert( fts5yytos <= fts5yypParser->fts5yystackEnd ); } -#endif if( fts5yyNewState > fts5YY_MAX_SHIFT ){ fts5yyNewState += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; } - fts5yytos = fts5yypParser->fts5yytos; fts5yytos->stateno = fts5yyNewState; fts5yytos->major = fts5yyMajor; fts5yytos->minor.fts5yy0 = fts5yyMinor; @@ -232327,19 +234313,12 @@ static void sqlite3Fts5Parser( (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)); } #endif -#if fts5YYSTACKDEPTH>0 if( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystackEnd ){ - fts5yyStackOverflow(fts5yypParser); - break; - } -#else - if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){ if( fts5yyGrowStack(fts5yypParser) ){ fts5yyStackOverflow(fts5yypParser); break; } } -#endif } fts5yyact = fts5yy_reduce(fts5yypParser,fts5yyruleno,fts5yymajor,fts5yyminor sqlite3Fts5ParserCTX_PARAM); }else if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){ @@ -235016,7 +236995,11 @@ static int sqlite3Fts5ExprNew( } sqlite3_free(sParse.apPhrase); - *pzErr = sParse.zErr; + if( 0==*pzErr ){ + *pzErr = sParse.zErr; + }else{ + sqlite3_free(sParse.zErr); + } return sParse.rc; } @@ -237144,6 +239127,7 @@ static Fts5ExprNode *sqlite3Fts5ParseImplicitAnd( assert( pRight->eType==FTS5_STRING || pRight->eType==FTS5_TERM || pRight->eType==FTS5_EOF + || (pRight->eType==FTS5_AND && pParse->bPhraseToAnd) ); if( pLeft->eType==FTS5_AND ){ @@ -245378,23 +247362,26 @@ static void fts5IterSetOutputsTokendata(Fts5Iter *pIter){ static void fts5TokendataIterNext(Fts5Iter *pIter, int bFrom, i64 iFrom){ int ii; Fts5TokenDataIter *pT = pIter->pTokenDataIter; + Fts5Index *pIndex = pIter->pIndex; for(ii=0; iinIter; ii++){ Fts5Iter *p = pT->apIter[ii]; if( p->base.bEof==0 && (p->base.iRowid==pIter->base.iRowid || (bFrom && p->base.iRowidpIndex, p, bFrom, iFrom); + fts5MultiIterNext(pIndex, p, bFrom, iFrom); while( bFrom && p->base.bEof==0 && p->base.iRowidpIndex->rc==SQLITE_OK + && pIndex->rc==SQLITE_OK ){ - fts5MultiIterNext(p->pIndex, p, 0, 0); + fts5MultiIterNext(pIndex, p, 0, 0); } } } - fts5IterSetOutputsTokendata(pIter); + if( pIndex->rc==SQLITE_OK ){ + fts5IterSetOutputsTokendata(pIter); + } } /* @@ -249308,6 +251295,7 @@ static int fts5UpdateMethod( rc = SQLITE_ERROR; }else{ rc = fts5SpecialDelete(pTab, apVal); + bUpdateOrDelete = 1; } }else{ rc = fts5SpecialInsert(pTab, z, apVal[2 + pConfig->nCol + 1]); @@ -250482,14 +252470,16 @@ static int sqlite3Fts5GetTokenizer( if( pMod==0 ){ assert( nArg>0 ); rc = SQLITE_ERROR; - *pzErr = sqlite3_mprintf("no such tokenizer: %s", azArg[0]); + if( pzErr ) *pzErr = sqlite3_mprintf("no such tokenizer: %s", azArg[0]); }else{ rc = pMod->x.xCreate( pMod->pUserData, (azArg?&azArg[1]:0), (nArg?nArg-1:0), &pConfig->pTok ); pConfig->pTokApi = &pMod->x; if( rc!=SQLITE_OK ){ - if( pzErr ) *pzErr = sqlite3_mprintf("error in tokenizer constructor"); + if( pzErr && rc!=SQLITE_NOMEM ){ + *pzErr = sqlite3_mprintf("error in tokenizer constructor"); + } }else{ pConfig->ePattern = sqlite3Fts5TokenizerPattern( pMod->x.xCreate, pConfig->pTok @@ -250548,7 +252538,7 @@ static void fts5SourceIdFunc( ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); - sqlite3_result_text(pCtx, "fts5: 2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a", -1, SQLITE_TRANSIENT); + sqlite3_result_text(pCtx, "fts5: 2024-08-13 09:16:08 c9c2ab54ba1f5f46360f1b4f35d849cd3f080e6fc2b6c60e91b16c63f69a1e33", -1, SQLITE_TRANSIENT); } /* @@ -250583,18 +252573,25 @@ static int fts5IntegrityMethod( assert( pzErr!=0 && *pzErr==0 ); UNUSED_PARAM(isQuick); + assert( pTab->p.pConfig->pzErrmsg==0 ); + pTab->p.pConfig->pzErrmsg = pzErr; rc = sqlite3Fts5StorageIntegrity(pTab->pStorage, 0); - if( (rc&0xff)==SQLITE_CORRUPT ){ - *pzErr = sqlite3_mprintf("malformed inverted index for FTS5 table %s.%s", - zSchema, zTabname); - }else if( rc!=SQLITE_OK ){ - *pzErr = sqlite3_mprintf("unable to validate the inverted index for" - " FTS5 table %s.%s: %s", - zSchema, zTabname, sqlite3_errstr(rc)); + if( *pzErr==0 && rc!=SQLITE_OK ){ + if( (rc&0xff)==SQLITE_CORRUPT ){ + *pzErr = sqlite3_mprintf("malformed inverted index for FTS5 table %s.%s", + zSchema, zTabname); + rc = (*pzErr) ? SQLITE_OK : SQLITE_NOMEM; + }else{ + *pzErr = sqlite3_mprintf("unable to validate the inverted index for" + " FTS5 table %s.%s: %s", + zSchema, zTabname, sqlite3_errstr(rc)); + } } - sqlite3Fts5IndexCloseReader(pTab->p.pIndex); - return SQLITE_OK; + sqlite3Fts5IndexCloseReader(pTab->p.pIndex); + pTab->p.pConfig->pzErrmsg = 0; + + return rc; } static int fts5Init(sqlite3 *db){ @@ -252026,7 +254023,7 @@ static int fts5AsciiCreate( int i; memset(p, 0, sizeof(AsciiTokenizer)); memcpy(p->aTokenChar, aAsciiTokenChar, sizeof(aAsciiTokenChar)); - for(i=0; rc==SQLITE_OK && ibFold = 1; pNew->iFoldParam = 0; - for(i=0; rc==SQLITE_OK && iiFoldParam!=0 && pNew->bFold==0 ){ rc = SQLITE_ERROR; diff --git a/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h b/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h index a07a5195..d67a4adb 100644 --- a/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h +++ b/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h @@ -147,9 +147,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.45.1" -#define SQLITE_VERSION_NUMBER 3045001 -#define SQLITE_SOURCE_ID "2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a" +#define SQLITE_VERSION "3.46.1" +#define SQLITE_VERSION_NUMBER 3046001 +#define SQLITE_SOURCE_ID "2024-08-13 09:16:08 c9c2ab54ba1f5f46360f1b4f35d849cd3f080e6fc2b6c60e91b16c63f69a1e33" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -421,6 +421,8 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**); ** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running. **

  • The application must not modify the SQL statement text passed into ** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running. +**
  • The application must not dereference the arrays or string pointers +** passed as the 3rd and 4th callback parameters after it returns. ** */ SQLITE_API int sqlite3_exec( @@ -763,11 +765,11 @@ struct sqlite3_file { ** ** xLock() upgrades the database file lock. In other words, xLock() moves the ** database file lock in the direction NONE toward EXCLUSIVE. The argument to -** xLock() is always on of SHARED, RESERVED, PENDING, or EXCLUSIVE, never +** xLock() is always one of SHARED, RESERVED, PENDING, or EXCLUSIVE, never ** SQLITE_LOCK_NONE. If the database file lock is already at or above the ** requested lock, then the call to xLock() is a no-op. ** xUnlock() downgrades the database file lock to either SHARED or NONE. -* If the lock is already at or below the requested lock state, then the call +** If the lock is already at or below the requested lock state, then the call ** to xUnlock() is a no-op. ** The xCheckReservedLock() method checks whether any database connection, ** either in this process or in some other process, is holding a RESERVED, @@ -2142,6 +2144,22 @@ struct sqlite3_mem_methods { ** configuration setting is never used, then the default maximum is determined ** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that ** compile-time option is not set, then the default maximum is 1073741824. +** +** [[SQLITE_CONFIG_ROWID_IN_VIEW]] +**
    SQLITE_CONFIG_ROWID_IN_VIEW +**
    The SQLITE_CONFIG_ROWID_IN_VIEW option enables or disables the ability +** for VIEWs to have a ROWID. The capability can only be enabled if SQLite is +** compiled with -DSQLITE_ALLOW_ROWID_IN_VIEW, in which case the capability +** defaults to on. This configuration option queries the current setting or +** changes the setting to off or on. The argument is a pointer to an integer. +** If that integer initially holds a value of 1, then the ability for VIEWs to +** have ROWIDs is activated. If the integer initially holds zero, then the +** ability is deactivated. Any other initial value for the integer leaves the +** setting unchanged. After changes, if any, the integer is written with +** a 1 or 0, if the ability for VIEWs to have ROWIDs is on or off. If SQLite +** is compiled without -DSQLITE_ALLOW_ROWID_IN_VIEW (which is the usual and +** recommended case) then the integer is always filled with zero, regardless +** if its initial value. ** */ #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ @@ -2173,6 +2191,7 @@ struct sqlite3_mem_methods { #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */ #define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */ #define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */ +#define SQLITE_CONFIG_ROWID_IN_VIEW 30 /* int* */ /* ** CAPI3REF: Database Connection Configuration Options @@ -3287,8 +3306,8 @@ SQLITE_API int sqlite3_set_authorizer( #define SQLITE_RECURSIVE 33 /* NULL NULL */ /* -** CAPI3REF: Tracing And Profiling Functions -** METHOD: sqlite3 +** CAPI3REF: Deprecated Tracing And Profiling Functions +** DEPRECATED ** ** These routines are deprecated. Use the [sqlite3_trace_v2()] interface ** instead of the routines described here. @@ -6869,6 +6888,12 @@ SQLITE_API int sqlite3_autovacuum_pages( ** The exceptions defined in this paragraph might change in a future ** release of SQLite. ** +** Whether the update hook is invoked before or after the +** corresponding change is currently unspecified and may differ +** depending on the type of change. Do not rely on the order of the +** hook call with regards to the final result of the operation which +** triggers the hook. +** ** The update hook implementation must not do anything that will modify ** the database connection that invoked the update hook. Any actions ** to modify the database connection must be deferred until after the @@ -8339,7 +8364,7 @@ SQLITE_API int sqlite3_test_control(int op, ...); ** The sqlite3_keyword_count() interface returns the number of distinct ** keywords understood by SQLite. ** -** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and +** The sqlite3_keyword_name(N,Z,L) interface finds the 0-based N-th keyword and ** makes *Z point to that keyword expressed as UTF8 and writes the number ** of bytes in the keyword into *L. The string that *Z points to is not ** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns @@ -9918,24 +9943,45 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int); **
  • ** ^(If the sqlite3_vtab_distinct() interface returns 2, that means ** that the query planner does not need the rows returned in any particular -** order, as long as rows with the same values in all "aOrderBy" columns -** are adjacent.)^ ^(Furthermore, only a single row for each particular -** combination of values in the columns identified by the "aOrderBy" field -** needs to be returned.)^ ^It is always ok for two or more rows with the same -** values in all "aOrderBy" columns to be returned, as long as all such rows -** are adjacent. ^The virtual table may, if it chooses, omit extra rows -** that have the same value for all columns identified by "aOrderBy". -** ^However omitting the extra rows is optional. +** order, as long as rows with the same values in all columns identified +** by "aOrderBy" are adjacent.)^ ^(Furthermore, when two or more rows +** contain the same values for all columns identified by "colUsed", all but +** one such row may optionally be omitted from the result.)^ +** The virtual table is not required to omit rows that are duplicates +** over the "colUsed" columns, but if the virtual table can do that without +** too much extra effort, it could potentially help the query to run faster. ** This mode is used for a DISTINCT query. **

  • -** ^(If the sqlite3_vtab_distinct() interface returns 3, that means -** that the query planner needs only distinct rows but it does need the -** rows to be sorted.)^ ^The virtual table implementation is free to omit -** rows that are identical in all aOrderBy columns, if it wants to, but -** it is not required to omit any rows. This mode is used for queries +** ^(If the sqlite3_vtab_distinct() interface returns 3, that means the +** virtual table must return rows in the order defined by "aOrderBy" as +** if the sqlite3_vtab_distinct() interface had returned 0. However if +** two or more rows in the result have the same values for all columns +** identified by "colUsed", then all but one such row may optionally be +** omitted.)^ Like when the return value is 2, the virtual table +** is not required to omit rows that are duplicates over the "colUsed" +** columns, but if the virtual table can do that without +** too much extra effort, it could potentially help the query to run faster. +** This mode is used for queries ** that have both DISTINCT and ORDER BY clauses. ** ** +**

    The following table summarizes the conditions under which the +** virtual table is allowed to set the "orderByConsumed" flag based on +** the value returned by sqlite3_vtab_distinct(). This table is a +** restatement of the previous four paragraphs: +** +** +** +**
    sqlite3_vtab_distinct() return value +** Rows are returned in aOrderBy order +** Rows with the same value in all aOrderBy columns are adjacent +** Duplicates over all colUsed columns may be omitted +**
    0yesyesno +**
    1noyesno +**
    2noyesyes +**
    3yesyesyes +**
    +** ** ^For the purposes of comparing virtual table output values to see if the ** values are same value for sorting purposes, two NULL values are considered ** to be the same. In other words, the comparison operator is "IS" @@ -11980,6 +12026,30 @@ SQLITE_API int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const c */ SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); +/* +** CAPI3REF: Add A Single Change To A Changegroup +** METHOD: sqlite3_changegroup +** +** This function adds the single change currently indicated by the iterator +** passed as the second argument to the changegroup object. The rules for +** adding the change are just as described for [sqlite3changegroup_add()]. +** +** If the change is successfully added to the changegroup, SQLITE_OK is +** returned. Otherwise, an SQLite error code is returned. +** +** The iterator must point to a valid entry when this function is called. +** If it does not, SQLITE_ERROR is returned and no change is added to the +** changegroup. Additionally, the iterator must not have been opened with +** the SQLITE_CHANGESETAPPLY_INVERT flag. In this case SQLITE_ERROR is also +** returned. +*/ +SQLITE_API int sqlite3changegroup_add_change( + sqlite3_changegroup*, + sqlite3_changeset_iter* +); + + + /* ** CAPI3REF: Obtain A Composite Changeset From A Changegroup ** METHOD: sqlite3_changegroup @@ -12784,8 +12854,8 @@ struct Fts5PhraseIter { ** EXTENSION API FUNCTIONS ** ** xUserData(pFts): -** Return a copy of the context pointer the extension function was -** registered with. +** Return a copy of the pUserData pointer passed to the xCreateFunction() +** API when the extension function was registered. ** ** xColumnTotalSize(pFts, iCol, pnToken): ** If parameter iCol is less than zero, set output variable *pnToken diff --git a/vendor/github.com/mattn/go-sqlite3/sqlite3.go b/vendor/github.com/mattn/go-sqlite3/sqlite3.go index 4b3b6cab..ed2a9e2a 100644 --- a/vendor/github.com/mattn/go-sqlite3/sqlite3.go +++ b/vendor/github.com/mattn/go-sqlite3/sqlite3.go @@ -1679,7 +1679,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) { } } - // Forgein Keys + // Foreign Keys if foreignKeys > -1 { if err := exec(fmt.Sprintf("PRAGMA foreign_keys = %d;", foreignKeys)); err != nil { C.sqlite3_close_v2(db) diff --git a/vendor/github.com/mattn/go-sqlite3/sqlite3_libsqlite3.go b/vendor/github.com/mattn/go-sqlite3/sqlite3_libsqlite3.go index 95cc7c0b..6ef23086 100644 --- a/vendor/github.com/mattn/go-sqlite3/sqlite3_libsqlite3.go +++ b/vendor/github.com/mattn/go-sqlite3/sqlite3_libsqlite3.go @@ -18,5 +18,6 @@ package sqlite3 #cgo openbsd LDFLAGS: -lsqlite3 #cgo solaris LDFLAGS: -lsqlite3 #cgo windows LDFLAGS: -lsqlite3 +#cgo zos LDFLAGS: -lsqlite3 */ import "C" diff --git a/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_userauth.go b/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_userauth.go index de9630c2..76d84016 100644 --- a/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_userauth.go +++ b/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_userauth.go @@ -86,7 +86,7 @@ var ( // combination is incorrect or unknown. // // If the SQLITE_USER table is not present in the database file, then -// this interface is a harmless no-op returnning SQLITE_OK. +// this interface is a harmless no-op returning SQLITE_OK. func (c *SQLiteConn) Authenticate(username, password string) error { rv := c.authenticate(username, password) switch rv { diff --git a/vendor/github.com/minio/minio-go/v7/api-bucket-cors.go b/vendor/github.com/minio/minio-go/v7/api-bucket-cors.go new file mode 100644 index 00000000..8bf537f7 --- /dev/null +++ b/vendor/github.com/minio/minio-go/v7/api-bucket-cors.go @@ -0,0 +1,136 @@ +/* + * MinIO Go Library for Amazon S3 Compatible Cloud Storage + * Copyright 2024 MinIO, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package minio + +import ( + "bytes" + "context" + "net/http" + "net/url" + + "github.com/minio/minio-go/v7/pkg/cors" + "github.com/minio/minio-go/v7/pkg/s3utils" +) + +// SetBucketCors sets the cors configuration for the bucket +func (c *Client) SetBucketCors(ctx context.Context, bucketName string, corsConfig *cors.Config) error { + if err := s3utils.CheckValidBucketName(bucketName); err != nil { + return err + } + + if corsConfig == nil { + return c.removeBucketCors(ctx, bucketName) + } + + return c.putBucketCors(ctx, bucketName, corsConfig) +} + +func (c *Client) putBucketCors(ctx context.Context, bucketName string, corsConfig *cors.Config) error { + urlValues := make(url.Values) + urlValues.Set("cors", "") + + corsStr, err := corsConfig.ToXML() + if err != nil { + return err + } + + reqMetadata := requestMetadata{ + bucketName: bucketName, + queryValues: urlValues, + contentBody: bytes.NewReader(corsStr), + contentLength: int64(len(corsStr)), + contentMD5Base64: sumMD5Base64([]byte(corsStr)), + } + + resp, err := c.executeMethod(ctx, http.MethodPut, reqMetadata) + defer closeResponse(resp) + if err != nil { + return err + } + if resp != nil { + if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusNoContent { + return httpRespToErrorResponse(resp, bucketName, "") + } + } + return nil +} + +func (c *Client) removeBucketCors(ctx context.Context, bucketName string) error { + urlValues := make(url.Values) + urlValues.Set("cors", "") + + resp, err := c.executeMethod(ctx, http.MethodDelete, requestMetadata{ + bucketName: bucketName, + queryValues: urlValues, + contentSHA256Hex: emptySHA256Hex, + }) + defer closeResponse(resp) + if err != nil { + return err + } + + if resp.StatusCode != http.StatusNoContent { + return httpRespToErrorResponse(resp, bucketName, "") + } + + return nil +} + +// GetBucketCors returns the current cors +func (c *Client) GetBucketCors(ctx context.Context, bucketName string) (*cors.Config, error) { + if err := s3utils.CheckValidBucketName(bucketName); err != nil { + return nil, err + } + bucketCors, err := c.getBucketCors(ctx, bucketName) + if err != nil { + errResponse := ToErrorResponse(err) + if errResponse.Code == "NoSuchCORSConfiguration" { + return nil, nil + } + return nil, err + } + return bucketCors, nil +} + +func (c *Client) getBucketCors(ctx context.Context, bucketName string) (*cors.Config, error) { + urlValues := make(url.Values) + urlValues.Set("cors", "") + + resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{ + bucketName: bucketName, + queryValues: urlValues, + contentSHA256Hex: emptySHA256Hex, // TODO: needed? copied over from other example, but not spec'd in API. + }) + + defer closeResponse(resp) + if err != nil { + return nil, err + } + + if resp != nil { + if resp.StatusCode != http.StatusOK { + return nil, httpRespToErrorResponse(resp, bucketName, "") + } + } + + corsConfig, err := cors.ParseBucketCorsConfig(resp.Body) + if err != nil { + return nil, err + } + + return corsConfig, nil +} diff --git a/vendor/github.com/minio/minio-go/v7/api-get-object.go b/vendor/github.com/minio/minio-go/v7/api-get-object.go index 9e6b1543..d7fd2783 100644 --- a/vendor/github.com/minio/minio-go/v7/api-get-object.go +++ b/vendor/github.com/minio/minio-go/v7/api-get-object.go @@ -32,10 +32,18 @@ import ( func (c *Client) GetObject(ctx context.Context, bucketName, objectName string, opts GetObjectOptions) (*Object, error) { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { - return nil, err + return nil, ErrorResponse{ + StatusCode: http.StatusBadRequest, + Code: "InvalidBucketName", + Message: err.Error(), + } } if err := s3utils.CheckValidObjectName(objectName); err != nil { - return nil, err + return nil, ErrorResponse{ + StatusCode: http.StatusBadRequest, + Code: "XMinioInvalidObjectName", + Message: err.Error(), + } } gctx, cancel := context.WithCancel(ctx) @@ -649,10 +657,18 @@ func newObject(ctx context.Context, cancel context.CancelFunc, reqCh chan<- getR func (c *Client) getObject(ctx context.Context, bucketName, objectName string, opts GetObjectOptions) (io.ReadCloser, ObjectInfo, http.Header, error) { // Validate input arguments. if err := s3utils.CheckValidBucketName(bucketName); err != nil { - return nil, ObjectInfo{}, nil, err + return nil, ObjectInfo{}, nil, ErrorResponse{ + StatusCode: http.StatusBadRequest, + Code: "InvalidBucketName", + Message: err.Error(), + } } if err := s3utils.CheckValidObjectName(objectName); err != nil { - return nil, ObjectInfo{}, nil, err + return nil, ObjectInfo{}, nil, ErrorResponse{ + StatusCode: http.StatusBadRequest, + Code: "XMinioInvalidObjectName", + Message: err.Error(), + } } // Execute GET on objectName. diff --git a/vendor/github.com/minio/minio-go/v7/api-put-object-multipart.go b/vendor/github.com/minio/minio-go/v7/api-put-object-multipart.go index 5f117afa..a70cbea9 100644 --- a/vendor/github.com/minio/minio-go/v7/api-put-object-multipart.go +++ b/vendor/github.com/minio/minio-go/v7/api-put-object-multipart.go @@ -24,7 +24,6 @@ import ( "encoding/hex" "encoding/xml" "fmt" - "hash/crc32" "io" "net/http" "net/url" @@ -87,7 +86,7 @@ func (c *Client) putObjectMultipartNoStream(ctx context.Context, bucketName, obj if opts.UserMetadata == nil { opts.UserMetadata = make(map[string]string, 1) } - opts.UserMetadata["X-Amz-Checksum-Algorithm"] = "CRC32C" + opts.UserMetadata["X-Amz-Checksum-Algorithm"] = opts.AutoChecksum.String() } // Initiate a new multipart upload. @@ -116,7 +115,7 @@ func (c *Client) putObjectMultipartNoStream(ctx context.Context, bucketName, obj // CRC32C is ~50% faster on AMD64 @ 30GB/s var crcBytes []byte customHeader := make(http.Header) - crc := crc32.New(crc32.MakeTable(crc32.Castagnoli)) + crc := opts.AutoChecksum.Hasher() for partNumber <= totalPartsCount { length, rErr := readFull(reader, buf) if rErr == io.EOF && partNumber > 1 { @@ -154,7 +153,7 @@ func (c *Client) putObjectMultipartNoStream(ctx context.Context, bucketName, obj crc.Reset() crc.Write(buf[:length]) cSum := crc.Sum(nil) - customHeader.Set("x-amz-checksum-crc32c", base64.StdEncoding.EncodeToString(cSum)) + customHeader.Set(opts.AutoChecksum.Key(), base64.StdEncoding.EncodeToString(cSum)) crcBytes = append(crcBytes, cSum...) } @@ -202,12 +201,13 @@ func (c *Client) putObjectMultipartNoStream(ctx context.Context, bucketName, obj sort.Sort(completedParts(complMultipartUpload.Parts)) opts = PutObjectOptions{ ServerSideEncryption: opts.ServerSideEncryption, + AutoChecksum: opts.AutoChecksum, } if len(crcBytes) > 0 { // Add hash of hashes. crc.Reset() crc.Write(crcBytes) - opts.UserMetadata = map[string]string{"X-Amz-Checksum-Crc32c": base64.StdEncoding.EncodeToString(crc.Sum(nil))} + opts.UserMetadata = map[string]string{opts.AutoChecksum.Key(): base64.StdEncoding.EncodeToString(crc.Sum(nil))} } uploadInfo, err := c.completeMultipartUpload(ctx, bucketName, objectName, uploadID, complMultipartUpload, opts) if err != nil { diff --git a/vendor/github.com/minio/minio-go/v7/api-put-object-streaming.go b/vendor/github.com/minio/minio-go/v7/api-put-object-streaming.go index 9182d4ea..eef976c8 100644 --- a/vendor/github.com/minio/minio-go/v7/api-put-object-streaming.go +++ b/vendor/github.com/minio/minio-go/v7/api-put-object-streaming.go @@ -22,7 +22,6 @@ import ( "context" "encoding/base64" "fmt" - "hash/crc32" "io" "net/http" "net/url" @@ -109,13 +108,15 @@ func (c *Client) putObjectMultipartStreamFromReadAt(ctx context.Context, bucketN if err != nil { return UploadInfo{}, err } - + if opts.Checksum.IsSet() { + opts.AutoChecksum = opts.Checksum + } withChecksum := c.trailingHeaderSupport if withChecksum { if opts.UserMetadata == nil { opts.UserMetadata = make(map[string]string, 1) } - opts.UserMetadata["X-Amz-Checksum-Algorithm"] = "CRC32C" + opts.UserMetadata["X-Amz-Checksum-Algorithm"] = opts.AutoChecksum.String() } // Initiate a new multipart upload. uploadID, err := c.newUploadID(ctx, bucketName, objectName, opts) @@ -195,10 +196,10 @@ func (c *Client) putObjectMultipartStreamFromReadAt(ctx context.Context, bucketN sectionReader := newHook(io.NewSectionReader(reader, readOffset, partSize), opts.Progress) trailer := make(http.Header, 1) if withChecksum { - crc := crc32.New(crc32.MakeTable(crc32.Castagnoli)) - trailer.Set("x-amz-checksum-crc32c", base64.StdEncoding.EncodeToString(crc.Sum(nil))) + crc := opts.AutoChecksum.Hasher() + trailer.Set(opts.AutoChecksum.Key(), base64.StdEncoding.EncodeToString(crc.Sum(nil))) sectionReader = newHashReaderWrapper(sectionReader, crc, func(hash []byte) { - trailer.Set("x-amz-checksum-crc32c", base64.StdEncoding.EncodeToString(hash)) + trailer.Set(opts.AutoChecksum.Key(), base64.StdEncoding.EncodeToString(hash)) }) } @@ -271,17 +272,18 @@ func (c *Client) putObjectMultipartStreamFromReadAt(ctx context.Context, bucketN opts = PutObjectOptions{ ServerSideEncryption: opts.ServerSideEncryption, + AutoChecksum: opts.AutoChecksum, } if withChecksum { // Add hash of hashes. - crc := crc32.New(crc32.MakeTable(crc32.Castagnoli)) + crc := opts.AutoChecksum.Hasher() for _, part := range complMultipartUpload.Parts { - cs, err := base64.StdEncoding.DecodeString(part.ChecksumCRC32C) + cs, err := base64.StdEncoding.DecodeString(part.Checksum(opts.AutoChecksum)) if err == nil { crc.Write(cs) } } - opts.UserMetadata = map[string]string{"X-Amz-Checksum-Crc32c": base64.StdEncoding.EncodeToString(crc.Sum(nil))} + opts.UserMetadata = map[string]string{opts.AutoChecksum.KeyCapitalized(): base64.StdEncoding.EncodeToString(crc.Sum(nil))} } uploadInfo, err := c.completeMultipartUpload(ctx, bucketName, objectName, uploadID, complMultipartUpload, opts) @@ -304,11 +306,16 @@ func (c *Client) putObjectMultipartStreamOptionalChecksum(ctx context.Context, b return UploadInfo{}, err } + if opts.Checksum.IsSet() { + opts.AutoChecksum = opts.Checksum + opts.SendContentMd5 = false + } + if !opts.SendContentMd5 { if opts.UserMetadata == nil { opts.UserMetadata = make(map[string]string, 1) } - opts.UserMetadata["X-Amz-Checksum-Algorithm"] = "CRC32C" + opts.UserMetadata["X-Amz-Checksum-Algorithm"] = opts.AutoChecksum.String() } // Calculate the optimal parts info for a given size. @@ -337,7 +344,7 @@ func (c *Client) putObjectMultipartStreamOptionalChecksum(ctx context.Context, b // CRC32C is ~50% faster on AMD64 @ 30GB/s var crcBytes []byte customHeader := make(http.Header) - crc := crc32.New(crc32.MakeTable(crc32.Castagnoli)) + crc := opts.AutoChecksum.Hasher() md5Hash := c.md5Hasher() defer md5Hash.Close() @@ -381,7 +388,7 @@ func (c *Client) putObjectMultipartStreamOptionalChecksum(ctx context.Context, b crc.Reset() crc.Write(buf[:length]) cSum := crc.Sum(nil) - customHeader.Set("x-amz-checksum-crc32c", base64.StdEncoding.EncodeToString(cSum)) + customHeader.Set(opts.AutoChecksum.KeyCapitalized(), base64.StdEncoding.EncodeToString(cSum)) crcBytes = append(crcBytes, cSum...) } @@ -433,12 +440,13 @@ func (c *Client) putObjectMultipartStreamOptionalChecksum(ctx context.Context, b opts = PutObjectOptions{ ServerSideEncryption: opts.ServerSideEncryption, + AutoChecksum: opts.AutoChecksum, } if len(crcBytes) > 0 { // Add hash of hashes. crc.Reset() crc.Write(crcBytes) - opts.UserMetadata = map[string]string{"X-Amz-Checksum-Crc32c": base64.StdEncoding.EncodeToString(crc.Sum(nil))} + opts.UserMetadata = map[string]string{opts.AutoChecksum.KeyCapitalized(): base64.StdEncoding.EncodeToString(crc.Sum(nil))} } uploadInfo, err := c.completeMultipartUpload(ctx, bucketName, objectName, uploadID, complMultipartUpload, opts) if err != nil { @@ -462,12 +470,15 @@ func (c *Client) putObjectMultipartStreamParallel(ctx context.Context, bucketNam if err = s3utils.CheckValidObjectName(objectName); err != nil { return UploadInfo{}, err } - + if opts.Checksum.IsSet() { + opts.SendContentMd5 = false + opts.AutoChecksum = opts.Checksum + } if !opts.SendContentMd5 { if opts.UserMetadata == nil { opts.UserMetadata = make(map[string]string, 1) } - opts.UserMetadata["X-Amz-Checksum-Algorithm"] = "CRC32C" + opts.UserMetadata["X-Amz-Checksum-Algorithm"] = opts.AutoChecksum.String() } // Cancel all when an error occurs. @@ -500,7 +511,7 @@ func (c *Client) putObjectMultipartStreamParallel(ctx context.Context, bucketNam // Create checksums // CRC32C is ~50% faster on AMD64 @ 30GB/s var crcBytes []byte - crc := crc32.New(crc32.MakeTable(crc32.Castagnoli)) + crc := opts.AutoChecksum.Hasher() // Total data read and written to server. should be equal to 'size' at the end of the call. var totalUploadedSize int64 @@ -554,11 +565,11 @@ func (c *Client) putObjectMultipartStreamParallel(ctx context.Context, bucketNam // Calculate md5sum. customHeader := make(http.Header) if !opts.SendContentMd5 { - // Add CRC32C instead. + // Add Checksum instead. crc.Reset() crc.Write(buf[:length]) cSum := crc.Sum(nil) - customHeader.Set("x-amz-checksum-crc32c", base64.StdEncoding.EncodeToString(cSum)) + customHeader.Set(opts.AutoChecksum.Key(), base64.StdEncoding.EncodeToString(cSum)) crcBytes = append(crcBytes, cSum...) } @@ -637,12 +648,15 @@ func (c *Client) putObjectMultipartStreamParallel(ctx context.Context, bucketNam // Sort all completed parts. sort.Sort(completedParts(complMultipartUpload.Parts)) - opts = PutObjectOptions{} + opts = PutObjectOptions{ + ServerSideEncryption: opts.ServerSideEncryption, + AutoChecksum: opts.AutoChecksum, + } if len(crcBytes) > 0 { // Add hash of hashes. crc.Reset() crc.Write(crcBytes) - opts.UserMetadata = map[string]string{"X-Amz-Checksum-Crc32c": base64.StdEncoding.EncodeToString(crc.Sum(nil))} + opts.UserMetadata = map[string]string{opts.AutoChecksum.KeyCapitalized(): base64.StdEncoding.EncodeToString(crc.Sum(nil))} } uploadInfo, err := c.completeMultipartUpload(ctx, bucketName, objectName, uploadID, complMultipartUpload, opts) if err != nil { @@ -673,6 +687,9 @@ func (c *Client) putObject(ctx context.Context, bucketName, objectName string, r if opts.SendContentMd5 && s3utils.IsGoogleEndpoint(*c.endpointURL) && size < 0 { return UploadInfo{}, errInvalidArgument("MD5Sum cannot be calculated with size '-1'") } + if opts.Checksum.IsSet() { + opts.SendContentMd5 = false + } var readSeeker io.Seeker if size > 0 { @@ -742,17 +759,6 @@ func (c *Client) putObjectDo(ctx context.Context, bucketName, objectName string, // Set headers. customHeader := opts.Header() - // Add CRC when client supports it, MD5 is not set, not Google and we don't add SHA256 to chunks. - addCrc := c.trailingHeaderSupport && md5Base64 == "" && !s3utils.IsGoogleEndpoint(*c.endpointURL) && (opts.DisableContentSha256 || c.secure) - - if addCrc { - // If user has added checksums, don't add them ourselves. - for k := range opts.UserMetadata { - if strings.HasPrefix(strings.ToLower(k), "x-amz-checksum-") { - addCrc = false - } - } - } // Populate request metadata. reqMetadata := requestMetadata{ bucketName: bucketName, @@ -763,8 +769,24 @@ func (c *Client) putObjectDo(ctx context.Context, bucketName, objectName string, contentMD5Base64: md5Base64, contentSHA256Hex: sha256Hex, streamSha256: !opts.DisableContentSha256, - addCrc: addCrc, } + // Add CRC when client supports it, MD5 is not set, not Google and we don't add SHA256 to chunks. + addCrc := c.trailingHeaderSupport && md5Base64 == "" && !s3utils.IsGoogleEndpoint(*c.endpointURL) && (opts.DisableContentSha256 || c.secure) + if opts.Checksum.IsSet() { + reqMetadata.addCrc = &opts.Checksum + } else if addCrc { + // If user has added checksums, don't add them ourselves. + for k := range opts.UserMetadata { + if strings.HasPrefix(strings.ToLower(k), "x-amz-checksum-") { + addCrc = false + } + } + if addCrc { + opts.AutoChecksum.SetDefault(ChecksumCRC32C) + reqMetadata.addCrc = &opts.AutoChecksum + } + } + if opts.Internal.SourceVersionID != "" { if opts.Internal.SourceVersionID != nullVersionID { if _, err := uuid.Parse(opts.Internal.SourceVersionID); err != nil { diff --git a/vendor/github.com/minio/minio-go/v7/api-put-object.go b/vendor/github.com/minio/minio-go/v7/api-put-object.go index a96de9b9..d769648a 100644 --- a/vendor/github.com/minio/minio-go/v7/api-put-object.go +++ b/vendor/github.com/minio/minio-go/v7/api-put-object.go @@ -23,7 +23,6 @@ import ( "encoding/base64" "errors" "fmt" - "hash/crc32" "io" "net/http" "sort" @@ -90,6 +89,18 @@ type PutObjectOptions struct { DisableContentSha256 bool DisableMultipart bool + // AutoChecksum is the type of checksum that will be added if no other checksum is added, + // like MD5 or SHA256 streaming checksum, and it is feasible for the upload type. + // If none is specified CRC32C is used, since it is generally the fastest. + AutoChecksum ChecksumType + + // Checksum will force a checksum of the specific type. + // This requires that the client was created with "TrailingHeaders:true" option, + // and that the destination server supports it. + // Unavailable with V2 signatures & Google endpoints. + // This will disable content MD5 checksums if set. + Checksum ChecksumType + // ConcurrentStreamParts will create NumThreads buffers of PartSize bytes, // fill them serially and upload them in parallel. // This can be used for faster uploads on non-seekable or slow-to-seek input. @@ -236,7 +247,7 @@ func (opts PutObjectOptions) Header() (header http.Header) { } // validate() checks if the UserMetadata map has standard headers or and raises an error if so. -func (opts PutObjectOptions) validate() (err error) { +func (opts PutObjectOptions) validate(c *Client) (err error) { for k, v := range opts.UserMetadata { if !httpguts.ValidHeaderFieldName(k) || isStandardHeader(k) || isSSEHeader(k) || isStorageClassHeader(k) || isMinioHeader(k) { return errInvalidArgument(k + " unsupported user defined metadata name") @@ -251,6 +262,17 @@ func (opts PutObjectOptions) validate() (err error) { if opts.LegalHold != "" && !opts.LegalHold.IsValid() { return errInvalidArgument(opts.LegalHold.String() + " unsupported legal-hold status") } + if opts.Checksum.IsSet() { + switch { + case !c.trailingHeaderSupport: + return errInvalidArgument("Checksum requires Client with TrailingHeaders enabled") + case c.overrideSignerType.IsV2(): + return errInvalidArgument("Checksum cannot be used with v2 signatures") + case s3utils.IsGoogleEndpoint(*c.endpointURL): + return errInvalidArgument("Checksum cannot be used with GCS endpoints") + } + } + return nil } @@ -287,7 +309,7 @@ func (c *Client) PutObject(ctx context.Context, bucketName, objectName string, r return UploadInfo{}, errors.New("object size must be provided with disable multipart upload") } - err = opts.validate() + err = opts.validate(c) if err != nil { return UploadInfo{}, err } @@ -300,6 +322,7 @@ func (c *Client) putObjectCommon(ctx context.Context, bucketName, objectName str if size > int64(maxMultipartPutObjectSize) { return UploadInfo{}, errEntityTooLarge(size, maxMultipartPutObjectSize, bucketName, objectName) } + opts.AutoChecksum.SetDefault(ChecksumCRC32C) // NOTE: Streaming signature is not supported by GCS. if s3utils.IsGoogleEndpoint(*c.endpointURL) { @@ -328,7 +351,7 @@ func (c *Client) putObjectCommon(ctx context.Context, bucketName, objectName str return c.putObjectMultipartStreamNoLength(ctx, bucketName, objectName, reader, opts) } - if size < int64(partSize) || opts.DisableMultipart { + if size <= int64(partSize) || opts.DisableMultipart { return c.putObject(ctx, bucketName, objectName, reader, size, opts) } @@ -357,11 +380,15 @@ func (c *Client) putObjectMultipartStreamNoLength(ctx context.Context, bucketNam return UploadInfo{}, err } + if opts.Checksum.IsSet() { + opts.SendContentMd5 = false + opts.AutoChecksum = opts.Checksum + } if !opts.SendContentMd5 { if opts.UserMetadata == nil { opts.UserMetadata = make(map[string]string, 1) } - opts.UserMetadata["X-Amz-Checksum-Algorithm"] = "CRC32C" + opts.UserMetadata["X-Amz-Checksum-Algorithm"] = opts.AutoChecksum.String() } // Initiate a new multipart upload. @@ -390,7 +417,7 @@ func (c *Client) putObjectMultipartStreamNoLength(ctx context.Context, bucketNam // CRC32C is ~50% faster on AMD64 @ 30GB/s var crcBytes []byte customHeader := make(http.Header) - crc := crc32.New(crc32.MakeTable(crc32.Castagnoli)) + crc := opts.AutoChecksum.Hasher() for partNumber <= totalPartsCount { length, rerr := readFull(reader, buf) @@ -413,7 +440,7 @@ func (c *Client) putObjectMultipartStreamNoLength(ctx context.Context, bucketNam crc.Reset() crc.Write(buf[:length]) cSum := crc.Sum(nil) - customHeader.Set("x-amz-checksum-crc32c", base64.StdEncoding.EncodeToString(cSum)) + customHeader.Set(opts.AutoChecksum.Key(), base64.StdEncoding.EncodeToString(cSum)) crcBytes = append(crcBytes, cSum...) } @@ -464,12 +491,15 @@ func (c *Client) putObjectMultipartStreamNoLength(ctx context.Context, bucketNam // Sort all completed parts. sort.Sort(completedParts(complMultipartUpload.Parts)) - opts = PutObjectOptions{} + opts = PutObjectOptions{ + ServerSideEncryption: opts.ServerSideEncryption, + AutoChecksum: opts.AutoChecksum, + } if len(crcBytes) > 0 { // Add hash of hashes. crc.Reset() crc.Write(crcBytes) - opts.UserMetadata = map[string]string{"X-Amz-Checksum-Crc32c": base64.StdEncoding.EncodeToString(crc.Sum(nil))} + opts.UserMetadata = map[string]string{opts.AutoChecksum.KeyCapitalized(): base64.StdEncoding.EncodeToString(crc.Sum(nil))} } uploadInfo, err := c.completeMultipartUpload(ctx, bucketName, objectName, uploadID, complMultipartUpload, opts) if err != nil { diff --git a/vendor/github.com/minio/minio-go/v7/api-putobject-snowball.go b/vendor/github.com/minio/minio-go/v7/api-putobject-snowball.go index eb4da414..6b6559bf 100644 --- a/vendor/github.com/minio/minio-go/v7/api-putobject-snowball.go +++ b/vendor/github.com/minio/minio-go/v7/api-putobject-snowball.go @@ -107,7 +107,7 @@ type readSeekCloser interface { // Total size should be < 5TB. // This function blocks until 'objs' is closed and the content has been uploaded. func (c Client) PutObjectsSnowball(ctx context.Context, bucketName string, opts SnowballOptions, objs <-chan SnowballObject) (err error) { - err = opts.Opts.validate() + err = opts.Opts.validate(&c) if err != nil { return err } diff --git a/vendor/github.com/minio/minio-go/v7/api-s3-datatypes.go b/vendor/github.com/minio/minio-go/v7/api-s3-datatypes.go index 1527b746..790606c5 100644 --- a/vendor/github.com/minio/minio-go/v7/api-s3-datatypes.go +++ b/vendor/github.com/minio/minio-go/v7/api-s3-datatypes.go @@ -340,6 +340,22 @@ type CompletePart struct { ChecksumSHA256 string `xml:"ChecksumSHA256,omitempty"` } +// Checksum will return the checksum for the given type. +// Will return the empty string if not set. +func (c CompletePart) Checksum(t ChecksumType) string { + switch { + case t.Is(ChecksumCRC32C): + return c.ChecksumCRC32C + case t.Is(ChecksumCRC32): + return c.ChecksumCRC32 + case t.Is(ChecksumSHA1): + return c.ChecksumSHA1 + case t.Is(ChecksumSHA256): + return c.ChecksumSHA256 + } + return "" +} + // completeMultipartUpload container for completing multipart upload. type completeMultipartUpload struct { XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CompleteMultipartUpload" json:"-"` diff --git a/vendor/github.com/minio/minio-go/v7/api-stat.go b/vendor/github.com/minio/minio-go/v7/api-stat.go index b043dc40..11455beb 100644 --- a/vendor/github.com/minio/minio-go/v7/api-stat.go +++ b/vendor/github.com/minio/minio-go/v7/api-stat.go @@ -61,10 +61,18 @@ func (c *Client) BucketExists(ctx context.Context, bucketName string) (bool, err func (c *Client) StatObject(ctx context.Context, bucketName, objectName string, opts StatObjectOptions) (ObjectInfo, error) { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { - return ObjectInfo{}, err + return ObjectInfo{}, ErrorResponse{ + StatusCode: http.StatusBadRequest, + Code: "InvalidBucketName", + Message: err.Error(), + } } if err := s3utils.CheckValidObjectName(objectName); err != nil { - return ObjectInfo{}, err + return ObjectInfo{}, ErrorResponse{ + StatusCode: http.StatusBadRequest, + Code: "XMinioInvalidObjectName", + Message: err.Error(), + } } headers := opts.Header() if opts.Internal.ReplicationDeleteMarker { diff --git a/vendor/github.com/minio/minio-go/v7/api.go b/vendor/github.com/minio/minio-go/v7/api.go index eaaaa68c..1d6b6650 100644 --- a/vendor/github.com/minio/minio-go/v7/api.go +++ b/vendor/github.com/minio/minio-go/v7/api.go @@ -23,7 +23,6 @@ import ( "encoding/base64" "errors" "fmt" - "hash/crc32" "io" "math/rand" "net" @@ -129,7 +128,7 @@ type Options struct { // Global constants. const ( libraryName = "minio-go" - libraryVersion = "v7.0.72" + libraryVersion = "v7.0.77" ) // User Agent should always following the below style. @@ -471,7 +470,7 @@ type requestMetadata struct { contentMD5Base64 string // carries base64 encoded md5sum contentSHA256Hex string // carries hex encoded sha256sum streamSha256 bool - addCrc bool + addCrc *ChecksumType trailer http.Header // (http.Request).Trailer. Requires v4 signature. } @@ -616,16 +615,16 @@ func (c *Client) executeMethod(ctx context.Context, method string, metadata requ } } - if metadata.addCrc && metadata.contentLength > 0 { + if metadata.addCrc != nil && metadata.contentLength > 0 { if metadata.trailer == nil { metadata.trailer = make(http.Header, 1) } - crc := crc32.New(crc32.MakeTable(crc32.Castagnoli)) + crc := metadata.addCrc.Hasher() metadata.contentBody = newHashReaderWrapper(metadata.contentBody, crc, func(hash []byte) { // Update trailer when done. - metadata.trailer.Set("x-amz-checksum-crc32c", base64.StdEncoding.EncodeToString(hash)) + metadata.trailer.Set(metadata.addCrc.Key(), base64.StdEncoding.EncodeToString(hash)) }) - metadata.trailer.Set("x-amz-checksum-crc32c", base64.StdEncoding.EncodeToString(crc.Sum(nil))) + metadata.trailer.Set(metadata.addCrc.Key(), base64.StdEncoding.EncodeToString(crc.Sum(nil))) } // Create cancel context to control 'newRetryTimer' go routine. @@ -662,7 +661,7 @@ func (c *Client) executeMethod(ctx context.Context, method string, metadata requ // Initiate the request. res, err = c.do(req) if err != nil { - if isRequestErrorRetryable(err) { + if isRequestErrorRetryable(ctx, err) { // Retry the request continue } diff --git a/vendor/github.com/minio/minio-go/v7/checksum.go b/vendor/github.com/minio/minio-go/v7/checksum.go index a1f6f434..7eb1bf25 100644 --- a/vendor/github.com/minio/minio-go/v7/checksum.go +++ b/vendor/github.com/minio/minio-go/v7/checksum.go @@ -25,6 +25,7 @@ import ( "hash/crc32" "io" "math/bits" + "net/http" ) // ChecksumType contains information about the checksum type. @@ -78,6 +79,11 @@ func (c ChecksumType) Key() string { return "" } +// KeyCapitalized returns the capitalized key as used in HTTP headers. +func (c ChecksumType) KeyCapitalized() string { + return http.CanonicalHeaderKey(c.Key()) +} + // RawByteLen returns the size of the un-encoded checksum. func (c ChecksumType) RawByteLen() int { switch c & checksumMask { @@ -112,6 +118,13 @@ func (c ChecksumType) IsSet() bool { return bits.OnesCount32(uint32(c)) == 1 } +// SetDefault will set the checksum if not already set. +func (c *ChecksumType) SetDefault(t ChecksumType) { + if !c.IsSet() { + *c = t + } +} + // String returns the type as a string. // CRC32, CRC32C, SHA1, and SHA256 for valid values. // Empty string for unset and "" if not valid. diff --git a/vendor/github.com/minio/minio-go/v7/core.go b/vendor/github.com/minio/minio-go/v7/core.go index 132ea702..99b99db9 100644 --- a/vendor/github.com/minio/minio-go/v7/core.go +++ b/vendor/github.com/minio/minio-go/v7/core.go @@ -91,6 +91,7 @@ type PutObjectPartOptions struct { Md5Base64, Sha256Hex string SSE encrypt.ServerSide CustomHeader, Trailer http.Header + DisableContentSha256 bool } // PutObjectPart - Upload an object part. @@ -107,7 +108,7 @@ func (c Core) PutObjectPart(ctx context.Context, bucket, object, uploadID string sha256Hex: opts.Sha256Hex, size: size, sse: opts.SSE, - streamSha256: true, + streamSha256: !opts.DisableContentSha256, customHeader: opts.CustomHeader, trailer: opts.Trailer, } diff --git a/vendor/github.com/minio/minio-go/v7/functional_tests.go b/vendor/github.com/minio/minio-go/v7/functional_tests.go index e77bf9d4..780dc899 100644 --- a/vendor/github.com/minio/minio-go/v7/functional_tests.go +++ b/vendor/github.com/minio/minio-go/v7/functional_tests.go @@ -24,7 +24,6 @@ import ( "archive/zip" "bytes" "context" - "crypto/sha1" "crypto/sha256" "encoding/base64" "errors" @@ -52,6 +51,7 @@ import ( "github.com/google/uuid" "github.com/minio/minio-go/v7" + "github.com/minio/minio-go/v7/pkg/cors" "github.com/minio/minio-go/v7/pkg/credentials" "github.com/minio/minio-go/v7/pkg/encrypt" "github.com/minio/minio-go/v7/pkg/notification" @@ -83,7 +83,7 @@ func createHTTPTransport() (transport *http.Transport) { return nil } - if mustParseBool(os.Getenv(skipCERTValidation)) { + if mustParseBool(os.Getenv(enableHTTPS)) && mustParseBool(os.Getenv(skipCERTValidation)) { transport.TLSClientConfig.InsecureSkipVerify = true } @@ -165,7 +165,7 @@ func logError(testName, function string, args map[string]interface{}, startTime } } -// log failed test runs +// Log failed test runs, do not call this directly, use logError instead, as that correctly stops the test run func logFailure(testName, function string, args map[string]interface{}, startTime time.Time, alert, message string, err error) { l := baseLogger(testName, function, args, startTime).With( "status", "FAIL", @@ -2198,22 +2198,15 @@ func testPutObjectWithChecksums() { defer cleanupBucket(bucketName, c) tests := []struct { - header string - hasher hash.Hash - - // Checksum values - ChecksumCRC32 string - ChecksumCRC32C string - ChecksumSHA1 string - ChecksumSHA256 string + cs minio.ChecksumType }{ - {header: "x-amz-checksum-crc32", hasher: crc32.NewIEEE()}, - {header: "x-amz-checksum-crc32c", hasher: crc32.New(crc32.MakeTable(crc32.Castagnoli))}, - {header: "x-amz-checksum-sha1", hasher: sha1.New()}, - {header: "x-amz-checksum-sha256", hasher: sha256.New()}, + {cs: minio.ChecksumCRC32C}, + {cs: minio.ChecksumCRC32}, + {cs: minio.ChecksumSHA1}, + {cs: minio.ChecksumSHA256}, } - for i, test := range tests { + for _, test := range tests { bufSize := dataFileMap["datafile-10-kB"] // Save the data @@ -2234,29 +2227,27 @@ func testPutObjectWithChecksums() { logError(testName, function, args, startTime, "", "Read failed", err) return } - h := test.hasher + h := test.cs.Hasher() h.Reset() - // Wrong CRC. - meta[test.header] = base64.StdEncoding.EncodeToString(h.Sum(nil)) + + // Test with Wrong CRC. + meta[test.cs.Key()] = base64.StdEncoding.EncodeToString(h.Sum(nil)) args["metadata"] = meta args["range"] = "false" + args["checksum"] = test.cs.String() resp, err := c.PutObject(context.Background(), bucketName, objectName, bytes.NewReader(b), int64(bufSize), minio.PutObjectOptions{ DisableMultipart: true, UserMetadata: meta, }) if err == nil { - if i == 0 && resp.ChecksumCRC32 == "" { - logIgnored(testName, function, args, startTime, "Checksums does not appear to be supported by backend") - return - } - logError(testName, function, args, startTime, "", "PutObject failed", err) + logError(testName, function, args, startTime, "", "PutObject did not fail on wrong CRC", err) return } // Set correct CRC. h.Write(b) - meta[test.header] = base64.StdEncoding.EncodeToString(h.Sum(nil)) + meta[test.cs.Key()] = base64.StdEncoding.EncodeToString(h.Sum(nil)) reader.Close() resp, err = c.PutObject(context.Background(), bucketName, objectName, bytes.NewReader(b), int64(bufSize), minio.PutObjectOptions{ @@ -2343,7 +2334,7 @@ func testPutObjectWithChecksums() { } // Test PutObject with custom checksums. -func testPutMultipartObjectWithChecksums() { +func testPutObjectWithTrailingChecksums() { // initialize logging params startTime := time.Now() testName := getFuncName() @@ -2351,7 +2342,7 @@ func testPutMultipartObjectWithChecksums() { args := map[string]interface{}{ "bucketName": "", "objectName": "", - "opts": "minio.PutObjectOptions{UserMetadata: metadata, Progress: progress}", + "opts": "minio.PutObjectOptions{UserMetadata: metadata, Progress: progress, TrailChecksum: xxx}", } if !isFullMode() { @@ -2365,9 +2356,201 @@ func testPutMultipartObjectWithChecksums() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Transport: createHTTPTransport(), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), + TrailingHeaders: true, + }) + if err != nil { + logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) + return + } + + // Enable tracing, write to stderr. + // c.TraceOn(os.Stderr) + + // Set user agent. + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) + + // Generate a new random bucket name. + bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") + args["bucketName"] = bucketName + + // Make a new bucket. + err = c.MakeBucket(context.Background(), bucketName, minio.MakeBucketOptions{Region: "us-east-1"}) + if err != nil { + logError(testName, function, args, startTime, "", "Make bucket failed", err) + return + } + + defer cleanupBucket(bucketName, c) + tests := []struct { + cs minio.ChecksumType + }{ + {cs: minio.ChecksumCRC32C}, + {cs: minio.ChecksumCRC32}, + {cs: minio.ChecksumSHA1}, + {cs: minio.ChecksumSHA256}, + } + + for _, test := range tests { + function := "PutObject(bucketName, objectName, reader,size, opts)" + bufSize := dataFileMap["datafile-10-kB"] + + // Save the data + objectName := randString(60, rand.NewSource(time.Now().UnixNano()), "") + args["objectName"] = objectName + + cmpChecksum := func(got, want string) { + if want != got { + logError(testName, function, args, startTime, "", "checksum mismatch", fmt.Errorf("want %s, got %s", want, got)) + return + } + } + + meta := map[string]string{} + reader := getDataReader("datafile-10-kB") + b, err := io.ReadAll(reader) + if err != nil { + logError(testName, function, args, startTime, "", "Read failed", err) + return + } + h := test.cs.Hasher() + h.Reset() + + // Test with Wrong CRC. + args["metadata"] = meta + args["range"] = "false" + args["checksum"] = test.cs.String() + + resp, err := c.PutObject(context.Background(), bucketName, objectName, bytes.NewReader(b), int64(bufSize), minio.PutObjectOptions{ + DisableMultipart: true, + DisableContentSha256: true, + UserMetadata: meta, + Checksum: test.cs, + }) + if err != nil { + logError(testName, function, args, startTime, "", "PutObject failed", err) + return + } + + h.Write(b) + meta[test.cs.Key()] = base64.StdEncoding.EncodeToString(h.Sum(nil)) + + cmpChecksum(resp.ChecksumSHA256, meta["x-amz-checksum-sha256"]) + cmpChecksum(resp.ChecksumSHA1, meta["x-amz-checksum-sha1"]) + cmpChecksum(resp.ChecksumCRC32, meta["x-amz-checksum-crc32"]) + cmpChecksum(resp.ChecksumCRC32C, meta["x-amz-checksum-crc32c"]) + + // Read the data back + gopts := minio.GetObjectOptions{Checksum: true} + + function = "GetObject(...)" + r, err := c.GetObject(context.Background(), bucketName, objectName, gopts) + if err != nil { + logError(testName, function, args, startTime, "", "GetObject failed", err) + return + } + + st, err := r.Stat() + if err != nil { + logError(testName, function, args, startTime, "", "Stat failed", err) + return + } + cmpChecksum(st.ChecksumSHA256, meta["x-amz-checksum-sha256"]) + cmpChecksum(st.ChecksumSHA1, meta["x-amz-checksum-sha1"]) + cmpChecksum(st.ChecksumCRC32, meta["x-amz-checksum-crc32"]) + cmpChecksum(st.ChecksumCRC32C, meta["x-amz-checksum-crc32c"]) + + if st.Size != int64(bufSize) { + logError(testName, function, args, startTime, "", "Number of bytes returned by PutObject does not match GetObject, expected "+string(bufSize)+" got "+string(st.Size), err) + return + } + + if err := r.Close(); err != nil { + logError(testName, function, args, startTime, "", "Object Close failed", err) + return + } + if err := r.Close(); err == nil { + logError(testName, function, args, startTime, "", "Object already closed, should respond with error", err) + return + } + + function = "GetObject( Range...)" + args["range"] = "true" + err = gopts.SetRange(100, 1000) + if err != nil { + logError(testName, function, args, startTime, "", "SetRange failed", err) + return + } + r, err = c.GetObject(context.Background(), bucketName, objectName, gopts) + if err != nil { + logError(testName, function, args, startTime, "", "GetObject failed", err) + return + } + + b, err = io.ReadAll(r) + if err != nil { + logError(testName, function, args, startTime, "", "Read failed", err) + return + } + st, err = r.Stat() + if err != nil { + logError(testName, function, args, startTime, "", "Stat failed", err) + return + } + + // Range requests should return empty checksums... + cmpChecksum(st.ChecksumSHA256, "") + cmpChecksum(st.ChecksumSHA1, "") + cmpChecksum(st.ChecksumCRC32, "") + cmpChecksum(st.ChecksumCRC32C, "") + + function = "GetObjectAttributes(...)" + s, err := c.GetObjectAttributes(context.Background(), bucketName, objectName, minio.ObjectAttributesOptions{}) + if err != nil { + logError(testName, function, args, startTime, "", "GetObjectAttributes failed", err) + return + } + cmpChecksum(s.Checksum.ChecksumSHA256, meta["x-amz-checksum-sha256"]) + cmpChecksum(s.Checksum.ChecksumSHA1, meta["x-amz-checksum-sha1"]) + cmpChecksum(s.Checksum.ChecksumCRC32, meta["x-amz-checksum-crc32"]) + cmpChecksum(s.Checksum.ChecksumCRC32C, meta["x-amz-checksum-crc32c"]) + + delete(args, "range") + delete(args, "metadata") + } + + logSuccess(testName, function, args, startTime) +} + +// Test PutObject with custom checksums. +func testPutMultipartObjectWithChecksums(trailing bool) { + // initialize logging params + startTime := time.Now() + testName := getFuncName() + function := "PutObject(bucketName, objectName, reader,size, opts)" + args := map[string]interface{}{ + "bucketName": "", + "objectName": "", + "opts": fmt.Sprintf("minio.PutObjectOptions{UserMetadata: metadata, Progress: progress Checksum: %v}", trailing), + } + + if !isFullMode() { + logIgnored(testName, function, args, startTime, "Skipping functional tests for short/quick runs") + return + } + + // Seed random based on current time. + rand.Seed(time.Now().Unix()) + + // Instantiate new minio client object. + c, err := minio.New(os.Getenv(serverEndpoint), + &minio.Options{ + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), + TrailingHeaders: trailing, }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -2418,17 +2601,12 @@ func testPutMultipartObjectWithChecksums() { } defer cleanupBucket(bucketName, c) tests := []struct { - header string - hasher hash.Hash - - // Checksum values - ChecksumCRC32 string - ChecksumCRC32C string - ChecksumSHA1 string - ChecksumSHA256 string + cs minio.ChecksumType }{ - // Currently there is no way to override the checksum type. - {header: "x-amz-checksum-crc32c", hasher: crc32.New(crc32.MakeTable(crc32.Castagnoli)), ChecksumCRC32C: "OpEx0Q==-13"}, + {cs: minio.ChecksumCRC32C}, + {cs: minio.ChecksumCRC32}, + {cs: minio.ChecksumSHA1}, + {cs: minio.ChecksumSHA256}, } for _, test := range tests { @@ -2437,11 +2615,12 @@ func testPutMultipartObjectWithChecksums() { // Save the data objectName := randString(60, rand.NewSource(time.Now().UnixNano()), "") args["objectName"] = objectName + args["checksum"] = test.cs.String() cmpChecksum := func(got, want string) { if want != got { - // logError(testName, function, args, startTime, "", "checksum mismatch", fmt.Errorf("want %s, got %s", want, got)) - fmt.Printf("want %s, got %s\n", want, got) + logError(testName, function, args, startTime, "", "checksum mismatch", fmt.Errorf("want %s, got %s", want, got)) + //fmt.Printf("want %s, got %s\n", want, got) return } } @@ -2454,26 +2633,57 @@ func testPutMultipartObjectWithChecksums() { return } reader.Close() - h := test.hasher + h := test.cs.Hasher() h.Reset() - test.ChecksumCRC32C = hashMultiPart(b, partSize, test.hasher) + want := hashMultiPart(b, partSize, test.cs.Hasher()) + var cs minio.ChecksumType + rd := io.Reader(io.NopCloser(bytes.NewReader(b))) + if trailing { + cs = test.cs + rd = bytes.NewReader(b) + } // Set correct CRC. - - resp, err := c.PutObject(context.Background(), bucketName, objectName, io.NopCloser(bytes.NewReader(b)), int64(bufSize), minio.PutObjectOptions{ + resp, err := c.PutObject(context.Background(), bucketName, objectName, rd, int64(bufSize), minio.PutObjectOptions{ DisableContentSha256: true, DisableMultipart: false, UserMetadata: nil, PartSize: partSize, + AutoChecksum: test.cs, + Checksum: cs, }) if err != nil { logError(testName, function, args, startTime, "", "PutObject failed", err) return } - cmpChecksum(resp.ChecksumSHA256, test.ChecksumSHA256) - cmpChecksum(resp.ChecksumSHA1, test.ChecksumSHA1) - cmpChecksum(resp.ChecksumCRC32, test.ChecksumCRC32) - cmpChecksum(resp.ChecksumCRC32C, test.ChecksumCRC32C) + + switch test.cs { + case minio.ChecksumCRC32C: + cmpChecksum(resp.ChecksumCRC32C, want) + case minio.ChecksumCRC32: + cmpChecksum(resp.ChecksumCRC32, want) + case minio.ChecksumSHA1: + cmpChecksum(resp.ChecksumSHA1, want) + case minio.ChecksumSHA256: + cmpChecksum(resp.ChecksumSHA256, want) + } + + s, err := c.GetObjectAttributes(context.Background(), bucketName, objectName, minio.ObjectAttributesOptions{}) + if err != nil { + logError(testName, function, args, startTime, "", "GetObjectAttributes failed", err) + return + } + want = want[:strings.IndexByte(want, '-')] + switch test.cs { + case minio.ChecksumCRC32C: + cmpChecksum(s.Checksum.ChecksumCRC32C, want) + case minio.ChecksumCRC32: + cmpChecksum(s.Checksum.ChecksumCRC32, want) + case minio.ChecksumSHA1: + cmpChecksum(s.Checksum.ChecksumSHA1, want) + case minio.ChecksumSHA256: + cmpChecksum(s.Checksum.ChecksumSHA256, want) + } // Read the data back gopts := minio.GetObjectOptions{Checksum: true} @@ -2495,18 +2705,17 @@ func testPutMultipartObjectWithChecksums() { // Test part 2 checksum... h.Reset() h.Write(b[partSize : 2*partSize]) - got := base64.StdEncoding.EncodeToString(h.Sum(nil)) - if test.ChecksumSHA256 != "" { - cmpChecksum(st.ChecksumSHA256, got) - } - if test.ChecksumSHA1 != "" { - cmpChecksum(st.ChecksumSHA1, got) - } - if test.ChecksumCRC32 != "" { - cmpChecksum(st.ChecksumCRC32, got) - } - if test.ChecksumCRC32C != "" { - cmpChecksum(st.ChecksumCRC32C, got) + want = base64.StdEncoding.EncodeToString(h.Sum(nil)) + + switch test.cs { + case minio.ChecksumCRC32C: + cmpChecksum(st.ChecksumCRC32C, want) + case minio.ChecksumCRC32: + cmpChecksum(st.ChecksumCRC32, want) + case minio.ChecksumSHA1: + cmpChecksum(st.ChecksumSHA1, want) + case minio.ChecksumSHA256: + cmpChecksum(st.ChecksumSHA256, want) } delete(args, "metadata") @@ -2971,8 +3180,8 @@ func testGetObjectAttributes() { testFiles[i].UploadInfo, err = c.PutObject(context.Background(), v.Bucket, v.Object, reader, int64(bufSize), minio.PutObjectOptions{ ContentType: v.ContentType, SendContentMd5: v.SendContentMd5, + Checksum: minio.ChecksumCRC32C, }) - if err != nil { logError(testName, function, args, startTime, "", "PutObject failed", err) return @@ -3053,7 +3262,7 @@ func testGetObjectAttributes() { test: objectAttributesTestOptions{ TestFileName: "file1", StorageClass: "STANDARD", - HasFullChecksum: false, + HasFullChecksum: true, }, } @@ -3142,9 +3351,10 @@ func testGetObjectAttributesSSECEncryption() { info, err := c.PutObject(context.Background(), bucketName, objectName, reader, int64(bufSize), minio.PutObjectOptions{ ContentType: "content/custom", - SendContentMd5: true, + SendContentMd5: false, ServerSideEncryption: sse, PartSize: uint64(bufSize) / 2, + Checksum: minio.ChecksumCRC32C, }) if err != nil { logError(testName, function, args, startTime, "", "PutObject failed", err) @@ -3164,9 +3374,9 @@ func testGetObjectAttributesSSECEncryption() { ETag: info.ETag, NumberOfParts: 2, ObjectSize: int(info.Size), - HasFullChecksum: false, + HasFullChecksum: true, HasParts: true, - HasPartChecksums: false, + HasPartChecksums: true, }) if err != nil { logError(testName, function, args, startTime, "", "Validating GetObjectsAttributes response failed", err) @@ -5584,18 +5794,12 @@ func testPresignedPostPolicy() { } writer.Close() - transport, err := minio.DefaultTransport(mustParseBool(os.Getenv(enableHTTPS))) - if err != nil { - logError(testName, function, args, startTime, "", "DefaultTransport failed", err) - return - } - httpClient := &http.Client{ // Setting a sensible time out of 30secs to wait for response // headers. Request is pro-actively canceled after 30secs // with no response. Timeout: 30 * time.Second, - Transport: transport, + Transport: createHTTPTransport(), } args["url"] = presignedPostPolicyURL.String() @@ -7212,7 +7416,6 @@ func testFunctional() { "bucketName": bucketName, } exists, err = c.BucketExists(context.Background(), bucketName) - if err != nil { logError(testName, function, args, startTime, "", "BucketExists failed", err) return @@ -7275,7 +7478,6 @@ func testFunctional() { "bucketPolicy": writeOnlyPolicy, } err = c.SetBucketPolicy(context.Background(), bucketName, writeOnlyPolicy) - if err != nil { logError(testName, function, args, startTime, "", "SetBucketPolicy failed", err) return @@ -7304,7 +7506,6 @@ func testFunctional() { "bucketPolicy": readWritePolicy, } err = c.SetBucketPolicy(context.Background(), bucketName, readWritePolicy) - if err != nil { logError(testName, function, args, startTime, "", "SetBucketPolicy failed", err) return @@ -7481,7 +7682,6 @@ func testFunctional() { "fileName": fileName + "-f", } err = c.FGetObject(context.Background(), bucketName, objectName, fileName+"-f", minio.GetObjectOptions{}) - if err != nil { logError(testName, function, args, startTime, "", "FGetObject failed", err) return @@ -7513,7 +7713,7 @@ func testFunctional() { return } - transport, err := minio.DefaultTransport(mustParseBool(os.Getenv(enableHTTPS))) + transport := createHTTPTransport() if err != nil { logError(testName, function, args, startTime, "", "DefaultTransport failed", err) return @@ -7613,7 +7813,6 @@ func testFunctional() { "reqParams": reqParams, } presignedGetURL, err = c.PresignedGetObject(context.Background(), bucketName, objectName, 3600*time.Second, reqParams) - if err != nil { logError(testName, function, args, startTime, "", "PresignedGetObject failed", err) return @@ -7770,14 +7969,12 @@ func testFunctional() { "objectName": objectName, } err = c.RemoveObject(context.Background(), bucketName, objectName, minio.RemoveObjectOptions{}) - if err != nil { logError(testName, function, args, startTime, "", "RemoveObject failed", err) return } args["objectName"] = objectName + "-f" err = c.RemoveObject(context.Background(), bucketName, objectName+"-f", minio.RemoveObjectOptions{}) - if err != nil { logError(testName, function, args, startTime, "", "RemoveObject failed", err) return @@ -7785,7 +7982,6 @@ func testFunctional() { args["objectName"] = objectName + "-nolength" err = c.RemoveObject(context.Background(), bucketName, objectName+"-nolength", minio.RemoveObjectOptions{}) - if err != nil { logError(testName, function, args, startTime, "", "RemoveObject failed", err) return @@ -7793,7 +7989,6 @@ func testFunctional() { args["objectName"] = objectName + "-presigned" err = c.RemoveObject(context.Background(), bucketName, objectName+"-presigned", minio.RemoveObjectOptions{}) - if err != nil { logError(testName, function, args, startTime, "", "RemoveObject failed", err) return @@ -7801,7 +7996,6 @@ func testFunctional() { args["objectName"] = objectName + "-presign-custom" err = c.RemoveObject(context.Background(), bucketName, objectName+"-presign-custom", minio.RemoveObjectOptions{}) - if err != nil { logError(testName, function, args, startTime, "", "RemoveObject failed", err) return @@ -7813,7 +8007,6 @@ func testFunctional() { "bucketName": bucketName, } err = c.RemoveBucket(context.Background(), bucketName) - if err != nil { logError(testName, function, args, startTime, "", "RemoveBucket failed", err) return @@ -12281,7 +12474,6 @@ func testFunctionalV2() { "bucketPolicy": readWritePolicy, } err = c.SetBucketPolicy(context.Background(), bucketName, readWritePolicy) - if err != nil { logError(testName, function, args, startTime, "", "SetBucketPolicy failed", err) return @@ -12452,18 +12644,12 @@ func testFunctionalV2() { return } - transport, err := minio.DefaultTransport(mustParseBool(os.Getenv(enableHTTPS))) - if err != nil { - logError(testName, function, args, startTime, "", "DefaultTransport failed", err) - return - } - httpClient := &http.Client{ // Setting a sensible time out of 30secs to wait for response // headers. Request is pro-actively canceled after 30secs // with no response. Timeout: 30 * time.Second, - Transport: transport, + Transport: createHTTPTransport(), } req, err := http.NewRequest(http.MethodHead, presignedHeadURL.String(), nil) @@ -13012,7 +13198,6 @@ func testGetObjectACLContext() { ContentType: "binary/octet-stream", UserMetadata: metaData, }) - if err != nil { logError(testName, function, args, startTime, "", "PutObject failed", err) return @@ -13491,6 +13676,844 @@ func testListObjects() { logSuccess(testName, function, args, startTime) } +// testCors is runnable against S3 itself. +// Just provide the env var MINIO_GO_TEST_BUCKET_CORS with bucket that is public and WILL BE DELETED. +// Recreate this manually each time. Minio-go SDK does not support calling +// SetPublicBucket (put-public-access-block) on S3, otherwise we could script the whole thing. +func testCors() { + ctx := context.Background() + startTime := time.Now() + testName := getFuncName() + function := "SetBucketCors(bucketName, cors)" + args := map[string]interface{}{ + "bucketName": "", + "cors": "", + } + + // Instantiate new minio client object + c, err := minio.New(os.Getenv(serverEndpoint), + &minio.Options{ + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), + }) + if err != nil { + logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) + return + } + + // Enable tracing, write to stderr. + // c.TraceOn(os.Stderr) + + // Set user agent. + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) + + // Create or reuse a bucket that will get cors settings applied to it and deleted when done + bucketName := os.Getenv("MINIO_GO_TEST_BUCKET_CORS") + if bucketName == "" { + bucketName = randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") + err = c.MakeBucket(ctx, bucketName, minio.MakeBucketOptions{Region: "us-east-1"}) + if err != nil { + logError(testName, function, args, startTime, "", "MakeBucket failed", err) + return + } + } + args["bucketName"] = bucketName + defer cleanupBucket(bucketName, c) + + publicPolicy := `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":["*"]},"Action":["s3:*"],"Resource":["arn:aws:s3:::` + bucketName + `", "arn:aws:s3:::` + bucketName + `/*"]}]}` + err = c.SetBucketPolicy(ctx, bucketName, publicPolicy) + if err != nil { + logError(testName, function, args, startTime, "", "SetBucketPolicy failed", err) + return + } + + // Upload an object for testing. + objectContents := `some-text-file-contents` + reader := strings.NewReader(objectContents) + bufSize := int64(len(objectContents)) + + objectName := randString(60, rand.NewSource(time.Now().UnixNano()), "") + args["objectName"] = objectName + + _, err = c.PutObject(ctx, bucketName, objectName, reader, int64(bufSize), minio.PutObjectOptions{ContentType: "binary/octet-stream"}) + if err != nil { + logError(testName, function, args, startTime, "", "PutObject call failed", err) + return + } + bucketURL := c.EndpointURL().String() + "/" + bucketName + "/" + objectURL := bucketURL + objectName + + httpClient := &http.Client{ + Timeout: 30 * time.Second, + Transport: createHTTPTransport(), + } + + errStrAccessForbidden := `AccessForbiddenCORSResponse: This CORS request is not allowed. This is usually because the evalution of Origin, request method / Access-Control-Request-Method or Access-Control-Request-Headers are not whitelisted` + testCases := []struct { + name string + + // Cors rules to apply + applyCorsRules []cors.Rule + + // Outbound request info + method string + url string + headers map[string]string + + // Wanted response + wantStatus int + wantHeaders map[string]string + wantBodyContains string + }{ + { + name: "apply bucket rules", + applyCorsRules: []cors.Rule{ + { + AllowedOrigin: []string{"https"}, // S3 documents 'https' origin, but it does not actually work, see test below. + AllowedMethod: []string{"PUT"}, + AllowedHeader: []string{"*"}, + }, + { + AllowedOrigin: []string{"http://www.example1.com"}, + AllowedMethod: []string{"PUT"}, + AllowedHeader: []string{"*"}, + ExposeHeader: []string{"x-amz-server-side-encryption", "x-amz-request-id"}, + MaxAgeSeconds: 3600, + }, + { + AllowedOrigin: []string{"http://www.example2.com"}, + AllowedMethod: []string{"POST"}, + AllowedHeader: []string{"X-My-Special-Header"}, + ExposeHeader: []string{"X-AMZ-Request-ID"}, + }, + { + AllowedOrigin: []string{"http://www.example3.com"}, + AllowedMethod: []string{"PUT"}, + AllowedHeader: []string{"X-Example-3-Special-Header"}, + MaxAgeSeconds: 10, + }, + { + AllowedOrigin: []string{"*"}, + AllowedMethod: []string{"GET"}, + AllowedHeader: []string{"*"}, + ExposeHeader: []string{"x-amz-request-id", "X-AMZ-server-side-encryption"}, + MaxAgeSeconds: 3600, + }, + { + AllowedOrigin: []string{"http://multiplemethodstest.com"}, + AllowedMethod: []string{"POST", "PUT", "DELETE"}, + AllowedHeader: []string{"x-abc-*", "x-def-*"}, + }, + { + AllowedOrigin: []string{"http://UPPERCASEEXAMPLE.com"}, + AllowedMethod: []string{"DELETE"}, + }, + { + AllowedOrigin: []string{"https://*"}, + AllowedMethod: []string{"DELETE"}, + AllowedHeader: []string{"x-abc-*", "x-def-*"}, + }, + }, + }, + { + name: "preflight to object url matches example1 rule", + method: http.MethodOptions, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.example1.com", + "Access-Control-Request-Method": "PUT", + "Access-Control-Request-Headers": "x-another-header,x-could-be-anything", + }, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Origin": "http://www.example1.com", + "Access-Control-Allow-Methods": "PUT", + "Access-Control-Allow-Headers": "x-another-header,x-could-be-anything", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Max-Age": "3600", + "Content-Length": "0", + // S3 additionally sets the following headers here, MinIO follows fetch spec and does not: + // "Access-Control-Expose-Headers": "", + }, + }, + { + name: "preflight to bucket url matches example1 rule", + method: http.MethodOptions, + url: bucketURL, + headers: map[string]string{ + "Origin": "http://www.example1.com", + "Access-Control-Request-Method": "PUT", + "Access-Control-Request-Headers": "x-another-header,x-could-be-anything", + }, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Origin": "http://www.example1.com", + "Access-Control-Allow-Methods": "PUT", + "Access-Control-Allow-Headers": "x-another-header,x-could-be-anything", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Max-Age": "3600", + "Content-Length": "0", + }, + }, + { + name: "preflight matches example2 rule with header given", + method: http.MethodOptions, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.example2.com", + "Access-Control-Request-Method": "POST", + "Access-Control-Request-Headers": "X-My-Special-Header", + }, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Origin": "http://www.example2.com", + "Access-Control-Allow-Methods": "POST", + "Access-Control-Allow-Headers": "x-my-special-header", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Max-Age": "", + "Content-Length": "0", + }, + }, + { + name: "preflight matches example2 rule with no header given", + method: http.MethodOptions, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.example2.com", + "Access-Control-Request-Method": "POST", + }, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Origin": "http://www.example2.com", + "Access-Control-Allow-Methods": "POST", + "Access-Control-Allow-Headers": "", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Max-Age": "", + "Content-Length": "0", + }, + }, + { + name: "preflight matches wildcard origin rule", + method: http.MethodOptions, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.couldbeanything.com", + "Access-Control-Request-Method": "GET", + "Access-Control-Request-Headers": "x-custom-header,x-other-custom-header", + }, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "GET", + "Access-Control-Allow-Headers": "x-custom-header,x-other-custom-header", + "Access-Control-Allow-Credentials": "", + "Access-Control-Max-Age": "3600", + "Content-Length": "0", + }, + }, + { + name: "preflight does not match any rule", + method: http.MethodOptions, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.couldbeanything.com", + "Access-Control-Request-Method": "DELETE", + }, + wantStatus: http.StatusForbidden, + wantBodyContains: errStrAccessForbidden, + }, + { + name: "preflight does not match example1 rule because of method", + method: http.MethodOptions, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.example1.com", + "Access-Control-Request-Method": "POST", + }, + wantStatus: http.StatusForbidden, + wantBodyContains: errStrAccessForbidden, + }, + { + name: "s3 processes cors rules even when request is not preflight if cors headers present test get", + method: http.MethodGet, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.example1.com", + "Access-Control-Request-Headers": "x-another-header,x-could-be-anything", + "Access-Control-Request-Method": "PUT", + }, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Credentials": "true", + "Access-Control-Allow-Origin": "http://www.example1.com", + "Access-Control-Expose-Headers": "x-amz-server-side-encryption,x-amz-request-id", + // S3 additionally sets the following headers here, MinIO follows fetch spec and does not: + // "Access-Control-Allow-Headers": "x-another-header,x-could-be-anything", + // "Access-Control-Allow-Methods": "PUT", + // "Access-Control-Max-Age": "3600", + }, + }, + { + name: "s3 processes cors rules even when request is not preflight if cors headers present test put", + method: http.MethodPut, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.example1.com", + "Access-Control-Request-Method": "GET", + }, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Credentials": "", + "Access-Control-Allow-Origin": "*", + "Access-Control-Expose-Headers": "x-amz-request-id,x-amz-server-side-encryption", + // S3 additionally sets the following headers here, MinIO follows fetch spec and does not: + // "Access-Control-Allow-Headers": "x-another-header,x-could-be-anything", + // "Access-Control-Allow-Methods": "PUT", + // "Access-Control-Max-Age": "3600", + }, + }, + { + name: "s3 processes cors rules even when request is not preflight but there is no rule match", + method: http.MethodGet, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.example1.com", + "Access-Control-Request-Headers": "x-another-header,x-could-be-anything", + "Access-Control-Request-Method": "DELETE", + }, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Methods": "", + "Access-Control-Allow-Origin": "", + "Access-Control-Allow-Headers": "", + "Access-Control-Allow-Credentials": "", + "Access-Control-Expose-Headers": "", + "Access-Control-Max-Age": "", + }, + }, + { + name: "get request matches wildcard origin rule and returns cors headers", + method: http.MethodGet, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.example1.com", + }, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Credentials": "", + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Headers": "", + "Access-Control-Expose-Headers": "x-amz-request-id,X-AMZ-server-side-encryption", + // S3 returns the following headers, MinIO follows fetch spec and does not: + // "Access-Control-Max-Age": "3600", + // "Access-Control-Allow-Methods": "GET", + }, + }, + { + name: "head request does not match rule and returns no cors headers", + method: http.MethodHead, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.nomatchingdomainfound.com", + }, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Credentials": "", + "Access-Control-Allow-Methods": "", + "Access-Control-Allow-Origin": "", + "Access-Control-Allow-Headers": "", + "Access-Control-Expose-Headers": "", + "Access-Control-Max-Age": "", + }, + }, + { + name: "put request with origin does not match rule and returns no cors headers", + method: http.MethodPut, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.nomatchingdomainfound.com", + }, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Credentials": "", + "Access-Control-Allow-Methods": "", + "Access-Control-Allow-Origin": "", + "Access-Control-Allow-Headers": "", + "Access-Control-Expose-Headers": "", + "Access-Control-Max-Age": "", + }, + }, + { + name: "put request with no origin does not match rule and returns no cors headers", + method: http.MethodPut, + url: objectURL, + headers: map[string]string{}, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Credentials": "", + "Access-Control-Allow-Methods": "", + "Access-Control-Allow-Origin": "", + "Access-Control-Allow-Headers": "", + "Access-Control-Expose-Headers": "", + "Access-Control-Max-Age": "", + }, + }, + { + name: "preflight for delete request with wildcard origin does not match", + method: http.MethodOptions, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.notsecureexample.com", + "Access-Control-Request-Method": "DELETE", + }, + wantStatus: http.StatusForbidden, + wantBodyContains: errStrAccessForbidden, + }, + { + name: "preflight for delete request with wildcard https origin matches secureexample", + method: http.MethodOptions, + url: objectURL, + headers: map[string]string{ + "Origin": "https://www.secureexample.com", + "Access-Control-Request-Method": "DELETE", + }, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Credentials": "true", + "Access-Control-Allow-Methods": "DELETE", + "Access-Control-Allow-Origin": "https://www.secureexample.com", + "Access-Control-Allow-Headers": "", + "Access-Control-Expose-Headers": "", + "Access-Control-Max-Age": "", + }, + }, + { + name: "preflight for delete request matches secureexample with wildcard https origin and request headers", + method: http.MethodOptions, + url: objectURL, + headers: map[string]string{ + "Origin": "https://www.secureexample.com", + "Access-Control-Request-Method": "DELETE", + "Access-Control-Request-Headers": "x-abc-1,x-abc-second,x-def-1", + }, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Credentials": "true", + "Access-Control-Allow-Methods": "DELETE", + "Access-Control-Allow-Origin": "https://www.secureexample.com", + "Access-Control-Allow-Headers": "x-abc-1,x-abc-second,x-def-1", + "Access-Control-Expose-Headers": "", + "Access-Control-Max-Age": "", + }, + }, + { + name: "preflight for delete request matches secureexample rejected because request header does not match", + method: http.MethodOptions, + url: objectURL, + headers: map[string]string{ + "Origin": "https://www.secureexample.com", + "Access-Control-Request-Method": "DELETE", + "Access-Control-Request-Headers": "x-abc-1,x-abc-second,x-def-1,x-does-not-match", + }, + wantStatus: http.StatusForbidden, + wantBodyContains: errStrAccessForbidden, + }, + { + name: "preflight with https origin is documented by s3 as matching but it does not match", + method: http.MethodOptions, + url: objectURL, + headers: map[string]string{ + "Origin": "https://www.securebutdoesnotmatch.com", + "Access-Control-Request-Method": "PUT", + }, + wantStatus: http.StatusForbidden, + wantBodyContains: errStrAccessForbidden, + }, + { + name: "put no origin no match returns no cors headers", + method: http.MethodPut, + url: objectURL, + headers: map[string]string{}, + wantStatus: http.StatusOK, + + wantHeaders: map[string]string{ + "Access-Control-Allow-Credentials": "", + "Access-Control-Allow-Methods": "", + "Access-Control-Allow-Origin": "", + "Access-Control-Allow-Headers": "", + "Access-Control-Expose-Headers": "", + "Access-Control-Max-Age": "", + }, + }, + { + name: "put with origin match example1 returns cors headers", + method: http.MethodPut, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.example1.com", + }, + wantStatus: http.StatusOK, + + wantHeaders: map[string]string{ + "Access-Control-Allow-Credentials": "true", + "Access-Control-Allow-Origin": "http://www.example1.com", + "Access-Control-Allow-Headers": "", + "Access-Control-Expose-Headers": "x-amz-server-side-encryption,x-amz-request-id", + // S3 returns the following headers, MinIO follows fetch spec and does not: + // "Access-Control-Max-Age": "3600", + // "Access-Control-Allow-Methods": "PUT", + }, + }, + { + name: "put with origin and header match example1 returns cors headers", + method: http.MethodPut, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.example1.com", + "x-could-be-anything": "myvalue", + }, + wantStatus: http.StatusOK, + + wantHeaders: map[string]string{ + "Access-Control-Allow-Credentials": "true", + "Access-Control-Allow-Origin": "http://www.example1.com", + "Access-Control-Allow-Headers": "", + "Access-Control-Expose-Headers": "x-amz-server-side-encryption,x-amz-request-id", + // S3 returns the following headers, MinIO follows fetch spec and does not: + // "Access-Control-Max-Age": "3600", + // "Access-Control-Allow-Methods": "PUT", + }, + }, + { + name: "put no match found returns no cors headers", + method: http.MethodPut, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.unmatchingdomain.com", + }, + wantStatus: http.StatusOK, + + wantHeaders: map[string]string{ + "Access-Control-Allow-Credentials": "", + "Access-Control-Allow-Methods": "", + "Access-Control-Allow-Origin": "", + "Access-Control-Allow-Headers": "", + "Access-Control-Expose-Headers": "", + "Access-Control-Max-Age": "", + }, + }, + { + name: "put with origin match example3 returns cors headers", + method: http.MethodPut, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.example3.com", + "X-My-Special-Header": "myvalue", + }, + wantStatus: http.StatusOK, + + wantHeaders: map[string]string{ + "Access-Control-Allow-Credentials": "true", + "Access-Control-Allow-Origin": "http://www.example3.com", + "Access-Control-Allow-Headers": "", + "Access-Control-Expose-Headers": "", + // S3 returns the following headers, MinIO follows fetch spec and does not: + // "Access-Control-Max-Age": "10", + // "Access-Control-Allow-Methods": "PUT", + }, + }, + { + name: "preflight matches example1 rule headers case is incorrect", + method: http.MethodOptions, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.example1.com", + "Access-Control-Request-Method": "PUT", + // Fetch standard guarantees that these are sent lowercase, here we test what happens when they are not. + "Access-Control-Request-Headers": "X-Another-Header,X-Could-Be-Anything", + }, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Origin": "http://www.example1.com", + "Access-Control-Allow-Methods": "PUT", + "Access-Control-Allow-Headers": "x-another-header,x-could-be-anything", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Max-Age": "3600", + "Content-Length": "0", + // S3 returns the following headers, MinIO follows fetch spec and does not: + // "Access-Control-Expose-Headers": "x-amz-server-side-encryption,x-amz-request-id", + }, + }, + { + name: "preflight matches example1 rule headers are not sorted", + method: http.MethodOptions, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.example1.com", + "Access-Control-Request-Method": "PUT", + // Fetch standard guarantees that these are sorted, test what happens when they are not. + "Access-Control-Request-Headers": "a-customer-header,b-should-be-last", + }, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Origin": "http://www.example1.com", + "Access-Control-Allow-Methods": "PUT", + "Access-Control-Allow-Headers": "a-customer-header,b-should-be-last", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Max-Age": "3600", + "Content-Length": "0", + // S3 returns the following headers, MinIO follows fetch spec and does not: + // "Access-Control-Expose-Headers": "x-amz-server-side-encryption,x-amz-request-id", + }, + }, + { + name: "preflight with case sensitivity in origin matches uppercase", + method: http.MethodOptions, + url: objectURL, + headers: map[string]string{ + "Origin": "http://UPPERCASEEXAMPLE.com", + "Access-Control-Request-Method": "DELETE", + }, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Credentials": "true", + "Access-Control-Allow-Methods": "DELETE", + "Access-Control-Allow-Origin": "http://UPPERCASEEXAMPLE.com", + "Access-Control-Allow-Headers": "", + "Access-Control-Expose-Headers": "", + "Access-Control-Max-Age": "", + }, + }, + { + name: "preflight with case sensitivity in origin does not match when lowercase", + method: http.MethodOptions, + url: objectURL, + headers: map[string]string{ + "Origin": "http://uppercaseexample.com", + "Access-Control-Request-Method": "DELETE", + }, + wantStatus: http.StatusForbidden, + wantBodyContains: errStrAccessForbidden, + }, + { + name: "preflight match upper case with unknown header but no header restrictions", + method: http.MethodOptions, + url: objectURL, + headers: map[string]string{ + "Origin": "http://UPPERCASEEXAMPLE.com", + "Access-Control-Request-Method": "DELETE", + "Access-Control-Request-Headers": "x-unknown-1", + }, + wantStatus: http.StatusForbidden, + wantBodyContains: errStrAccessForbidden, + }, + { + name: "preflight for delete request matches multiplemethodstest.com origin and request headers", + method: http.MethodOptions, + url: objectURL, + headers: map[string]string{ + "Origin": "http://multiplemethodstest.com", + "Access-Control-Request-Method": "DELETE", + "Access-Control-Request-Headers": "x-abc-1", + }, + wantStatus: http.StatusOK, + wantHeaders: map[string]string{ + "Access-Control-Allow-Credentials": "true", + "Access-Control-Allow-Origin": "http://multiplemethodstest.com", + "Access-Control-Allow-Headers": "x-abc-1", + "Access-Control-Expose-Headers": "", + "Access-Control-Max-Age": "", + // S3 returns POST, PUT, DELETE here, MinIO does not as spec does not require it. + // "Access-Control-Allow-Methods": "DELETE", + }, + }, + { + name: "delete request goes ahead because cors is only for browsers and does not block on the server side", + method: http.MethodDelete, + url: objectURL, + headers: map[string]string{ + "Origin": "http://www.justrandom.com", + }, + wantStatus: http.StatusNoContent, + }, + } + + for i, test := range testCases { + testName := fmt.Sprintf("%s_%d_%s", testName, i+1, strings.ReplaceAll(test.name, " ", "_")) + + // Apply the CORS rules + if test.applyCorsRules != nil { + corsConfig := &cors.Config{ + CORSRules: test.applyCorsRules, + } + err = c.SetBucketCors(ctx, bucketName, corsConfig) + if err != nil { + logError(testName, function, args, startTime, "", "SetBucketCors failed to apply", err) + return + } + } + + // Make request + if test.method != "" && test.url != "" { + req, err := http.NewRequestWithContext(ctx, test.method, test.url, nil) + if err != nil { + logError(testName, function, args, startTime, "", "HTTP request creation failed", err) + return + } + req.Header.Set("User-Agent", "MinIO-go-FunctionalTest/"+appVersion) + + for k, v := range test.headers { + req.Header.Set(k, v) + } + resp, err := httpClient.Do(req) + if err != nil { + logError(testName, function, args, startTime, "", "HTTP request failed", err) + return + } + defer resp.Body.Close() + + // Check returned status code + if resp.StatusCode != test.wantStatus { + errStr := fmt.Sprintf(" incorrect status code in response, want: %d, got: %d", test.wantStatus, resp.StatusCode) + logError(testName, function, args, startTime, "", errStr, nil) + return + } + + // Check returned body + if test.wantBodyContains != "" { + body, err := io.ReadAll(resp.Body) + if err != nil { + logError(testName, function, args, startTime, "", "Failed to read response body", err) + return + } + if !strings.Contains(string(body), test.wantBodyContains) { + errStr := fmt.Sprintf(" incorrect body in response, want: %s, in got: %s", test.wantBodyContains, string(body)) + logError(testName, function, args, startTime, "", errStr, nil) + return + } + } + + // Check returned response headers + for k, v := range test.wantHeaders { + gotVal := resp.Header.Get(k) + if k == "Access-Control-Expose-Headers" { + // MinIO returns this in canonical form, S3 does not. + gotVal = strings.ToLower(gotVal) + v = strings.ToLower(v) + } + // Remove all spaces, S3 adds spaces after CSV values in headers, MinIO does not. + gotVal = strings.ReplaceAll(gotVal, " ", "") + if gotVal != v { + errStr := fmt.Sprintf(" incorrect header in response, want: %s: '%s', got: '%s'", k, v, gotVal) + logError(testName, function, args, startTime, "", errStr, nil) + return + } + } + } + logSuccess(testName, function, args, startTime) + } + logSuccess(testName, function, args, startTime) +} + +func testCorsSetGetDelete() { + ctx := context.Background() + startTime := time.Now() + testName := getFuncName() + function := "SetBucketCors(bucketName, cors)" + args := map[string]interface{}{ + "bucketName": "", + "cors": "", + } + + // Instantiate new minio client object + c, err := minio.New(os.Getenv(serverEndpoint), + &minio.Options{ + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), + }) + if err != nil { + logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) + return + } + + // Enable tracing, write to stderr. + // c.TraceOn(os.Stderr) + + // Set user agent. + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) + + // Generate a new random bucket name. + bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") + args["bucketName"] = bucketName + + // Make a new bucket. + err = c.MakeBucket(ctx, bucketName, minio.MakeBucketOptions{Region: "us-east-1"}) + if err != nil { + logError(testName, function, args, startTime, "", "MakeBucket failed", err) + return + } + defer cleanupBucket(bucketName, c) + + // Set the CORS rules on the new bucket + corsRules := []cors.Rule{ + { + AllowedOrigin: []string{"http://www.example1.com"}, + AllowedMethod: []string{"PUT"}, + AllowedHeader: []string{"*"}, + }, + { + AllowedOrigin: []string{"http://www.example2.com"}, + AllowedMethod: []string{"POST"}, + AllowedHeader: []string{"X-My-Special-Header"}, + }, + { + AllowedOrigin: []string{"*"}, + AllowedMethod: []string{"GET"}, + AllowedHeader: []string{"*"}, + }, + } + corsConfig := cors.NewConfig(corsRules) + err = c.SetBucketCors(ctx, bucketName, corsConfig) + if err != nil { + logError(testName, function, args, startTime, "", "SetBucketCors failed to apply", err) + return + } + + // Get the rules and check they match what we set + gotCorsConfig, err := c.GetBucketCors(ctx, bucketName) + if err != nil { + logError(testName, function, args, startTime, "", "GetBucketCors failed", err) + return + } + if !reflect.DeepEqual(corsConfig, gotCorsConfig) { + msg := fmt.Sprintf("GetBucketCors returned unexpected rules, expected: %+v, got: %+v", corsConfig, gotCorsConfig) + logError(testName, function, args, startTime, "", msg, nil) + return + } + + // Delete the rules + err = c.SetBucketCors(ctx, bucketName, nil) + if err != nil { + logError(testName, function, args, startTime, "", "SetBucketCors failed to delete", err) + return + } + + // Get the rules and check they are now empty + gotCorsConfig, err = c.GetBucketCors(ctx, bucketName) + if err != nil { + logError(testName, function, args, startTime, "", "GetBucketCors failed", err) + return + } + if gotCorsConfig != nil { + logError(testName, function, args, startTime, "", "GetBucketCors returned unexpected rules", nil) + return + } + + logSuccess(testName, function, args, startTime) +} + // Test deleting multiple objects with object retention set in Governance mode func testRemoveObjects() { // initialize logging params @@ -13627,6 +14650,245 @@ func testRemoveObjects() { logSuccess(testName, function, args, startTime) } +// Test get bucket tags +func testGetBucketTagging() { + // initialize logging params + startTime := time.Now() + testName := getFuncName() + function := "GetBucketTagging(bucketName)" + args := map[string]interface{}{ + "bucketName": "", + } + // Seed random based on current time. + rand.Seed(time.Now().Unix()) + + // Instantiate new minio client object. + c, err := minio.New(os.Getenv(serverEndpoint), + &minio.Options{ + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), + }) + if err != nil { + logError(testName, function, args, startTime, "", "MinIO client v4 object creation failed", err) + return + } + + // Enable tracing, write to stderr. + // c.TraceOn(os.Stderr) + + // Set user agent. + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) + + // Generate a new random bucket name. + bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") + args["bucketName"] = bucketName + + // Make a new bucket. + err = c.MakeBucket(context.Background(), bucketName, minio.MakeBucketOptions{Region: "us-east-1", ObjectLocking: true}) + if err != nil { + logError(testName, function, args, startTime, "", "MakeBucket failed", err) + return + } + + _, err = c.GetBucketTagging(context.Background(), bucketName) + if minio.ToErrorResponse(err).Code != "NoSuchTagSet" { + logError(testName, function, args, startTime, "", "Invalid error from server failed", err) + return + } + + if err = cleanupVersionedBucket(bucketName, c); err != nil { + logError(testName, function, args, startTime, "", "CleanupBucket failed", err) + return + } + + logSuccess(testName, function, args, startTime) +} + +// Test setting tags for bucket +func testSetBucketTagging() { + // initialize logging params + startTime := time.Now() + testName := getFuncName() + function := "SetBucketTagging(bucketName, tags)" + args := map[string]interface{}{ + "bucketName": "", + "tags": "", + } + // Seed random based on current time. + rand.Seed(time.Now().Unix()) + + // Instantiate new minio client object. + c, err := minio.New(os.Getenv(serverEndpoint), + &minio.Options{ + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), + }) + if err != nil { + logError(testName, function, args, startTime, "", "MinIO client v4 object creation failed", err) + return + } + + // Enable tracing, write to stderr. + // c.TraceOn(os.Stderr) + + // Set user agent. + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) + + // Generate a new random bucket name. + bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") + args["bucketName"] = bucketName + + // Make a new bucket. + err = c.MakeBucket(context.Background(), bucketName, minio.MakeBucketOptions{Region: "us-east-1", ObjectLocking: true}) + if err != nil { + logError(testName, function, args, startTime, "", "MakeBucket failed", err) + return + } + + _, err = c.GetBucketTagging(context.Background(), bucketName) + if minio.ToErrorResponse(err).Code != "NoSuchTagSet" { + logError(testName, function, args, startTime, "", "Invalid error from server", err) + return + } + + tag := randString(60, rand.NewSource(time.Now().UnixNano()), "") + expectedValue := randString(60, rand.NewSource(time.Now().UnixNano()), "") + + t, err := tags.MapToBucketTags(map[string]string{ + tag: expectedValue, + }) + args["tags"] = t.String() + if err != nil { + logError(testName, function, args, startTime, "", "tags.MapToBucketTags failed", err) + return + } + + err = c.SetBucketTagging(context.Background(), bucketName, t) + if err != nil { + logError(testName, function, args, startTime, "", "SetBucketTagging failed", err) + return + } + + tagging, err := c.GetBucketTagging(context.Background(), bucketName) + if err != nil { + logError(testName, function, args, startTime, "", "GetBucketTagging failed", err) + return + } + + if tagging.ToMap()[tag] != expectedValue { + msg := fmt.Sprintf("Tag %s; got value %s; wanted %s", tag, tagging.ToMap()[tag], expectedValue) + logError(testName, function, args, startTime, "", msg, err) + return + } + + // Delete all objects and buckets + if err = cleanupVersionedBucket(bucketName, c); err != nil { + logError(testName, function, args, startTime, "", "CleanupBucket failed", err) + return + } + + logSuccess(testName, function, args, startTime) +} + +// Test removing bucket tags +func testRemoveBucketTagging() { + // initialize logging params + startTime := time.Now() + testName := getFuncName() + function := "RemoveBucketTagging(bucketName)" + args := map[string]interface{}{ + "bucketName": "", + } + // Seed random based on current time. + rand.Seed(time.Now().Unix()) + + // Instantiate new minio client object. + c, err := minio.New(os.Getenv(serverEndpoint), + &minio.Options{ + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), + }) + if err != nil { + logError(testName, function, args, startTime, "", "MinIO client v4 object creation failed", err) + return + } + + // Enable tracing, write to stderr. + // c.TraceOn(os.Stderr) + + // Set user agent. + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) + + // Generate a new random bucket name. + bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") + args["bucketName"] = bucketName + + // Make a new bucket. + err = c.MakeBucket(context.Background(), bucketName, minio.MakeBucketOptions{Region: "us-east-1", ObjectLocking: true}) + if err != nil { + logError(testName, function, args, startTime, "", "MakeBucket failed", err) + return + } + + _, err = c.GetBucketTagging(context.Background(), bucketName) + if minio.ToErrorResponse(err).Code != "NoSuchTagSet" { + logError(testName, function, args, startTime, "", "Invalid error from server", err) + return + } + + tag := randString(60, rand.NewSource(time.Now().UnixNano()), "") + expectedValue := randString(60, rand.NewSource(time.Now().UnixNano()), "") + + t, err := tags.MapToBucketTags(map[string]string{ + tag: expectedValue, + }) + if err != nil { + logError(testName, function, args, startTime, "", "tags.MapToBucketTags failed", err) + return + } + + err = c.SetBucketTagging(context.Background(), bucketName, t) + if err != nil { + logError(testName, function, args, startTime, "", "SetBucketTagging failed", err) + return + } + + tagging, err := c.GetBucketTagging(context.Background(), bucketName) + if err != nil { + logError(testName, function, args, startTime, "", "GetBucketTagging failed", err) + return + } + + if tagging.ToMap()[tag] != expectedValue { + msg := fmt.Sprintf("Tag %s; got value %s; wanted %s", tag, tagging.ToMap()[tag], expectedValue) + logError(testName, function, args, startTime, "", msg, err) + return + } + + err = c.RemoveBucketTagging(context.Background(), bucketName) + if err != nil { + logError(testName, function, args, startTime, "", "RemoveBucketTagging failed", err) + return + } + + _, err = c.GetBucketTagging(context.Background(), bucketName) + if minio.ToErrorResponse(err).Code != "NoSuchTagSet" { + logError(testName, function, args, startTime, "", "Invalid error from server", err) + return + } + + // Delete all objects and buckets + if err = cleanupVersionedBucket(bucketName, c); err != nil { + logError(testName, function, args, startTime, "", "CleanupBucket failed", err) + return + } + + logSuccess(testName, function, args, startTime) +} + // Convert string to bool and always return false if any error func mustParseBool(str string) bool { b, err := strconv.ParseBool(str) @@ -13660,6 +14922,8 @@ func main() { // execute tests if isFullMode() { + testCorsSetGetDelete() + testCors() testListMultipartUpload() testGetObjectAttributes() testGetObjectAttributesErrorCases() @@ -13676,7 +14940,9 @@ func main() { testCompose10KSourcesV2() testUserMetadataCopyingV2() testPutObjectWithChecksums() - testPutMultipartObjectWithChecksums() + testPutObjectWithTrailingChecksums() + testPutMultipartObjectWithChecksums(false) + testPutMultipartObjectWithChecksums(true) testPutObject0ByteV2() testPutObjectNoLengthV2() testPutObjectsUnknownV2() @@ -13731,6 +14997,9 @@ func main() { testObjectTaggingWithVersioning() testTrailingChecksums() testPutObjectWithAutomaticChecksums() + testGetBucketTagging() + testSetBucketTagging() + testRemoveBucketTagging() // SSE-C tests will only work over TLS connection. if tls { diff --git a/vendor/github.com/minio/minio-go/v7/pkg/cors/cors.go b/vendor/github.com/minio/minio-go/v7/pkg/cors/cors.go new file mode 100644 index 00000000..e71864ee --- /dev/null +++ b/vendor/github.com/minio/minio-go/v7/pkg/cors/cors.go @@ -0,0 +1,91 @@ +/* + * MinIO Go Library for Amazon S3 Compatible Cloud Storage + * Copyright 2015-2024 MinIO, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cors + +import ( + "encoding/xml" + "fmt" + "io" + "strings" + + "github.com/dustin/go-humanize" +) + +const defaultXMLNS = "http://s3.amazonaws.com/doc/2006-03-01/" + +// Config is the container for a CORS configuration for a bucket. +type Config struct { + XMLNS string `xml:"xmlns,attr,omitempty"` + XMLName xml.Name `xml:"CORSConfiguration"` + CORSRules []Rule `xml:"CORSRule"` +} + +// Rule is a single rule in a CORS configuration. +type Rule struct { + AllowedHeader []string `xml:"AllowedHeader,omitempty"` + AllowedMethod []string `xml:"AllowedMethod,omitempty"` + AllowedOrigin []string `xml:"AllowedOrigin,omitempty"` + ExposeHeader []string `xml:"ExposeHeader,omitempty"` + ID string `xml:"ID,omitempty"` + MaxAgeSeconds int `xml:"MaxAgeSeconds,omitempty"` +} + +// NewConfig creates a new CORS configuration with the given rules. +func NewConfig(rules []Rule) *Config { + return &Config{ + XMLNS: defaultXMLNS, + XMLName: xml.Name{ + Local: "CORSConfiguration", + Space: defaultXMLNS, + }, + CORSRules: rules, + } +} + +// ParseBucketCorsConfig parses a CORS configuration in XML from an io.Reader. +func ParseBucketCorsConfig(reader io.Reader) (*Config, error) { + var c Config + + // Max size of cors document is 64KiB according to https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketCors.html + // This limiter is just for safety so has a max of 128KiB + err := xml.NewDecoder(io.LimitReader(reader, 128*humanize.KiByte)).Decode(&c) + if err != nil { + return nil, fmt.Errorf("decoding xml: %w", err) + } + if c.XMLNS == "" { + c.XMLNS = defaultXMLNS + } + for i, rule := range c.CORSRules { + for j, method := range rule.AllowedMethod { + c.CORSRules[i].AllowedMethod[j] = strings.ToUpper(method) + } + } + return &c, nil +} + +// ToXML marshals the CORS configuration to XML. +func (c Config) ToXML() ([]byte, error) { + if c.XMLNS == "" { + c.XMLNS = defaultXMLNS + } + data, err := xml.Marshal(&c) + if err != nil { + return nil, fmt.Errorf("marshaling xml: %w", err) + } + return append([]byte(xml.Header), data...), nil +} diff --git a/vendor/github.com/minio/minio-go/v7/pkg/credentials/file_aws_credentials.go b/vendor/github.com/minio/minio-go/v7/pkg/credentials/file_aws_credentials.go index 8c5c4eb2..541e1a72 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/credentials/file_aws_credentials.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/credentials/file_aws_credentials.go @@ -26,7 +26,7 @@ import ( "strings" "time" - ini "gopkg.in/ini.v1" + "github.com/go-ini/ini" ) // A externalProcessCredentials stores the output of a credential_process diff --git a/vendor/github.com/minio/minio-go/v7/pkg/credentials/file_minio_client.go b/vendor/github.com/minio/minio-go/v7/pkg/credentials/file_minio_client.go index f1c165b7..750e26ff 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/credentials/file_minio_client.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/credentials/file_minio_client.go @@ -39,7 +39,7 @@ type FileMinioClient struct { Filename string // MinIO Alias to extract credentials from the shared credentials file. If empty - // will default to environment variable "MINIO_ALIAS" or "default" if + // will default to environment variable "MINIO_ALIAS" or "s3" if // environment variable is also not set. Alias string diff --git a/vendor/github.com/minio/minio-go/v7/pkg/replication/replication.go b/vendor/github.com/minio/minio-go/v7/pkg/replication/replication.go index 0abbf6ef..65a2f75e 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/replication/replication.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/replication/replication.go @@ -406,6 +406,9 @@ func (c *Config) EditRule(opts Options) error { return fmt.Errorf("priority must be unique. Replication configuration already has a rule with this priority") } if rule.Destination.Bucket != newRule.Destination.Bucket && rule.ID == newRule.ID { + if c.Role == newRule.Destination.Bucket { + continue + } return fmt.Errorf("invalid destination bucket for this rule") } } diff --git a/vendor/github.com/minio/minio-go/v7/pkg/s3utils/utils.go b/vendor/github.com/minio/minio-go/v7/pkg/s3utils/utils.go index 056e78a6..0e63ce2f 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/s3utils/utils.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/s3utils/utils.go @@ -226,7 +226,7 @@ func IsGoogleEndpoint(endpointURL url.URL) bool { if endpointURL == sentinelURL { return false } - return endpointURL.Host == "storage.googleapis.com" + return endpointURL.Hostname() == "storage.googleapis.com" } // Expects ascii encoded strings - from output of urlEncodePath diff --git a/vendor/github.com/minio/minio-go/v7/post-policy.go b/vendor/github.com/minio/minio-go/v7/post-policy.go index f6dbbf7f..19687e02 100644 --- a/vendor/github.com/minio/minio-go/v7/post-policy.go +++ b/vendor/github.com/minio/minio-go/v7/post-policy.go @@ -209,6 +209,23 @@ func (p *PostPolicy) SetContentTypeStartsWith(contentTypeStartsWith string) erro return nil } +// SetContentDisposition - Sets content-disposition of the object for this policy +func (p *PostPolicy) SetContentDisposition(contentDisposition string) error { + if strings.TrimSpace(contentDisposition) == "" || contentDisposition == "" { + return errInvalidArgument("No content disposition specified.") + } + policyCond := policyCondition{ + matchType: "eq", + condition: "$Content-Disposition", + value: contentDisposition, + } + if err := p.addNewPolicy(policyCond); err != nil { + return err + } + p.formData["Content-Disposition"] = contentDisposition + return nil +} + // SetContentLengthRange - Set new min and max content length // condition for all incoming uploads. func (p *PostPolicy) SetContentLengthRange(min, max int64) error { @@ -284,6 +301,25 @@ func (p *PostPolicy) SetUserMetadata(key, value string) error { return nil } +// SetUserMetadataStartsWith - Set how an user metadata should starts with. +// Can be retrieved through a HEAD request or an event. +func (p *PostPolicy) SetUserMetadataStartsWith(key, value string) error { + if strings.TrimSpace(key) == "" || key == "" { + return errInvalidArgument("Key is empty") + } + headerName := fmt.Sprintf("x-amz-meta-%s", key) + policyCond := policyCondition{ + matchType: "starts-with", + condition: fmt.Sprintf("$%s", headerName), + value: value, + } + if err := p.addNewPolicy(policyCond); err != nil { + return err + } + p.formData[headerName] = value + return nil +} + // SetChecksum sets the checksum of the request. func (p *PostPolicy) SetChecksum(c Checksum) { if c.IsSet() { diff --git a/vendor/github.com/minio/minio-go/v7/retry.go b/vendor/github.com/minio/minio-go/v7/retry.go index 5ddcad89..d15eb590 100644 --- a/vendor/github.com/minio/minio-go/v7/retry.go +++ b/vendor/github.com/minio/minio-go/v7/retry.go @@ -129,9 +129,10 @@ func isHTTPStatusRetryable(httpStatusCode int) (ok bool) { } // For now, all http Do() requests are retriable except some well defined errors -func isRequestErrorRetryable(err error) bool { +func isRequestErrorRetryable(ctx context.Context, err error) bool { if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { - return false + // Retry if internal timeout in the HTTP call. + return ctx.Err() == nil } if ue, ok := err.(*url.Error); ok { e := ue.Unwrap() diff --git a/vendor/github.com/minio/minio-go/v7/s3-endpoints.go b/vendor/github.com/minio/minio-go/v7/s3-endpoints.go index 068a6bfa..01cee8a1 100644 --- a/vendor/github.com/minio/minio-go/v7/s3-endpoints.go +++ b/vendor/github.com/minio/minio-go/v7/s3-endpoints.go @@ -44,6 +44,10 @@ var awsS3EndpointMap = map[string]awsS3Endpoint{ "s3.ca-central-1.amazonaws.com", "s3.dualstack.ca-central-1.amazonaws.com", }, + "ca-west-1": { + "s3.ca-west-1.amazonaws.com", + "s3.dualstack.ca-west-1.amazonaws.com", + }, "eu-west-1": { "s3.eu-west-1.amazonaws.com", "s3.dualstack.eu-west-1.amazonaws.com", diff --git a/vendor/github.com/minio/minio-go/v7/s3-error.go b/vendor/github.com/minio/minio-go/v7/s3-error.go index f365157e..f7fad19f 100644 --- a/vendor/github.com/minio/minio-go/v7/s3-error.go +++ b/vendor/github.com/minio/minio-go/v7/s3-error.go @@ -57,5 +57,6 @@ var s3ErrorResponseMap = map[string]string{ "BucketAlreadyOwnedByYou": "Your previous request to create the named bucket succeeded and you already own it.", "InvalidDuration": "Duration provided in the request is invalid.", "XAmzContentSHA256Mismatch": "The provided 'x-amz-content-sha256' header does not match what was computed.", + "NoSuchCORSConfiguration": "The specified bucket does not have a CORS configuration.", // Add new API errors here. } diff --git a/vendor/golang.org/x/time/LICENSE b/vendor/github.com/munnerz/goautoneg/LICENSE similarity index 53% rename from vendor/golang.org/x/time/LICENSE rename to vendor/github.com/munnerz/goautoneg/LICENSE index 6a66aea5..bbc7b897 100644 --- a/vendor/golang.org/x/time/LICENSE +++ b/vendor/github.com/munnerz/goautoneg/LICENSE @@ -1,24 +1,28 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright (c) 2011, Open Knowledge Foundation Ltd. +All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + Neither the name of the Open Knowledge Foundation Ltd. nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior written + permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY diff --git a/vendor/github.com/munnerz/goautoneg/Makefile b/vendor/github.com/munnerz/goautoneg/Makefile new file mode 100644 index 00000000..e33ee173 --- /dev/null +++ b/vendor/github.com/munnerz/goautoneg/Makefile @@ -0,0 +1,13 @@ +include $(GOROOT)/src/Make.inc + +TARG=bitbucket.org/ww/goautoneg +GOFILES=autoneg.go + +include $(GOROOT)/src/Make.pkg + +format: + gofmt -w *.go + +docs: + gomake clean + godoc ${TARG} > README.txt diff --git a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt b/vendor/github.com/munnerz/goautoneg/README.txt similarity index 100% rename from vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt rename to vendor/github.com/munnerz/goautoneg/README.txt diff --git a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go b/vendor/github.com/munnerz/goautoneg/autoneg.go similarity index 52% rename from vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go rename to vendor/github.com/munnerz/goautoneg/autoneg.go index a21b9d15..1dd1cad6 100644 --- a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go +++ b/vendor/github.com/munnerz/goautoneg/autoneg.go @@ -1,28 +1,28 @@ /* -Copyright (c) 2011, Open Knowledge Foundation Ltd. -All rights reserved. - HTTP Content-Type Autonegotiation. The functions in this package implement the behaviour specified in http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html +Copyright (c) 2011, Open Knowledge Foundation Ltd. +All rights reserved. + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. - Neither the name of the Open Knowledge Foundation Ltd. nor the - names of its contributors may be used to endorse or promote - products derived from this software without specific prior written - permission. + Neither the name of the Open Knowledge Foundation Ltd. nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior written + permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -36,6 +36,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + package goautoneg import ( @@ -51,16 +52,14 @@ type Accept struct { Params map[string]string } -// For internal use, so that we can use the sort interface -type accept_slice []Accept +// acceptSlice is defined to implement sort interface. +type acceptSlice []Accept -func (accept accept_slice) Len() int { - slice := []Accept(accept) +func (slice acceptSlice) Len() int { return len(slice) } -func (accept accept_slice) Less(i, j int) bool { - slice := []Accept(accept) +func (slice acceptSlice) Less(i, j int) bool { ai, aj := slice[i], slice[j] if ai.Q > aj.Q { return true @@ -74,63 +73,93 @@ func (accept accept_slice) Less(i, j int) bool { return false } -func (accept accept_slice) Swap(i, j int) { - slice := []Accept(accept) +func (slice acceptSlice) Swap(i, j int) { slice[i], slice[j] = slice[j], slice[i] } +func stringTrimSpaceCutset(r rune) bool { + return r == ' ' +} + +func nextSplitElement(s, sep string) (item string, remaining string) { + if index := strings.Index(s, sep); index != -1 { + return s[:index], s[index+1:] + } + return s, "" +} + // Parse an Accept Header string returning a sorted list // of clauses -func ParseAccept(header string) (accept []Accept) { - parts := strings.Split(header, ",") - accept = make([]Accept, 0, len(parts)) - for _, part := range parts { - part := strings.Trim(part, " ") +func ParseAccept(header string) acceptSlice { + partsCount := 0 + remaining := header + for len(remaining) > 0 { + partsCount++ + _, remaining = nextSplitElement(remaining, ",") + } + accept := make(acceptSlice, 0, partsCount) - a := Accept{} - a.Params = make(map[string]string) - a.Q = 1.0 + remaining = header + var part string + for len(remaining) > 0 { + part, remaining = nextSplitElement(remaining, ",") + part = strings.TrimFunc(part, stringTrimSpaceCutset) - mrp := strings.Split(part, ";") - - media_range := mrp[0] - sp := strings.Split(media_range, "/") - a.Type = strings.Trim(sp[0], " ") - - switch { - case len(sp) == 1 && a.Type == "*": - a.SubType = "*" - case len(sp) == 2: - a.SubType = strings.Trim(sp[1], " ") - default: - continue + a := Accept{ + Q: 1.0, } - if len(mrp) == 1 { + sp, remainingPart := nextSplitElement(part, ";") + + sp0, spRemaining := nextSplitElement(sp, "/") + a.Type = strings.TrimFunc(sp0, stringTrimSpaceCutset) + + switch { + case len(spRemaining) == 0: + if a.Type == "*" { + a.SubType = "*" + } else { + continue + } + default: + var sp1 string + sp1, spRemaining = nextSplitElement(spRemaining, "/") + if len(spRemaining) > 0 { + continue + } + a.SubType = strings.TrimFunc(sp1, stringTrimSpaceCutset) + } + + if len(remainingPart) == 0 { accept = append(accept, a) continue } - for _, param := range mrp[1:] { - sp := strings.SplitN(param, "=", 2) - if len(sp) != 2 { + a.Params = make(map[string]string) + for len(remainingPart) > 0 { + sp, remainingPart = nextSplitElement(remainingPart, ";") + sp0, spRemaining = nextSplitElement(sp, "=") + if len(spRemaining) == 0 { continue } - token := strings.Trim(sp[0], " ") + var sp1 string + sp1, spRemaining = nextSplitElement(spRemaining, "=") + if len(spRemaining) != 0 { + continue + } + token := strings.TrimFunc(sp0, stringTrimSpaceCutset) if token == "q" { - a.Q, _ = strconv.ParseFloat(sp[1], 32) + a.Q, _ = strconv.ParseFloat(sp1, 32) } else { - a.Params[token] = strings.Trim(sp[1], " ") + a.Params[token] = strings.TrimFunc(sp1, stringTrimSpaceCutset) } } accept = append(accept, a) } - slice := accept_slice(accept) - sort.Sort(slice) - - return + sort.Sort(accept) + return accept } // Negotiate the most appropriate content_type given the accept header diff --git a/vendor/github.com/nats-io/nats.go/README.md b/vendor/github.com/nats-io/nats.go/README.md index fd64d93d..0d8ccca1 100644 --- a/vendor/github.com/nats-io/nats.go/README.md +++ b/vendor/github.com/nats-io/nats.go/README.md @@ -31,7 +31,7 @@ When using or transitioning to Go modules support: ```bash # Go client latest or explicit version go get github.com/nats-io/nats.go/@latest -go get github.com/nats-io/nats.go/@v1.36.0 +go get github.com/nats-io/nats.go/@v1.37.0 # For latest NATS Server, add /v2 at the end go get github.com/nats-io/nats-server/v2 @@ -93,11 +93,13 @@ nc.Close() ``` ## JetStream +[![JetStream API Reference](https://pkg.go.dev/badge/github.com/nats-io/nats.go/jetstream.svg)](https://pkg.go.dev/github.com/nats-io/nats.go/jetstream) JetStream is the built-in NATS persistence system. `nats.go` provides a built-in API enabling both managing JetStream assets as well as publishing/consuming persistent messages. + ### Basic usage ```go @@ -134,60 +136,6 @@ To find more information on `nats.go` JetStream API, visit The service API (`micro`) allows you to [easily build NATS services](micro/README.md) The services API is currently in beta release. -## Encoded Connections - -```go - -nc, _ := nats.Connect(nats.DefaultURL) -c, _ := nats.NewEncodedConn(nc, nats.JSON_ENCODER) -defer c.Close() - -// Simple Publisher -c.Publish("foo", "Hello World") - -// Simple Async Subscriber -c.Subscribe("foo", func(s string) { - fmt.Printf("Received a message: %s\n", s) -}) - -// EncodedConn can Publish any raw Go type using the registered Encoder -type person struct { - Name string - Address string - Age int -} - -// Go type Subscriber -c.Subscribe("hello", func(p *person) { - fmt.Printf("Received a person: %+v\n", p) -}) - -me := &person{Name: "derek", Age: 22, Address: "140 New Montgomery Street, San Francisco, CA"} - -// Go type Publisher -c.Publish("hello", me) - -// Unsubscribe -sub, err := c.Subscribe("foo", nil) -// ... -sub.Unsubscribe() - -// Requests -var response string -err = c.Request("help", "help me", &response, 10*time.Millisecond) -if err != nil { - fmt.Printf("Request failed: %v\n", err) -} - -// Replying -c.Subscribe("help", func(subj, reply string, msg string) { - c.Publish(reply, "I can help!") -}) - -// Close connection -c.Close(); -``` - ## New Authentication (Nkeys and User Credentials) This requires server with version >= 2.0.0 @@ -267,34 +215,6 @@ if err != nil { ``` -## Using Go Channels (netchan) - -```go -nc, _ := nats.Connect(nats.DefaultURL) -ec, _ := nats.NewEncodedConn(nc, nats.JSON_ENCODER) -defer ec.Close() - -type person struct { - Name string - Address string - Age int -} - -recvCh := make(chan *person) -ec.BindRecvChan("hello", recvCh) - -sendCh := make(chan *person) -ec.BindSendChan("hello", sendCh) - -me := &person{Name: "derek", Age: 22, Address: "140 New Montgomery Street"} - -// Send via Go channels -sendCh <- me - -// Receive via Go channels -who := <- recvCh -``` - ## Wildcard Subscriptions ```go @@ -461,17 +381,6 @@ msg, err := nc.RequestWithContext(ctx, "foo", []byte("bar")) sub, err := nc.SubscribeSync("foo") msg, err := sub.NextMsgWithContext(ctx) -// Encoded Request with context -c, err := nats.NewEncodedConn(nc, nats.JSON_ENCODER) -type request struct { - Message string `json:"message"` -} -type response struct { - Code int `json:"code"` -} -req := &request{Message: "Hello"} -resp := &response{} -err := c.RequestWithContext(ctx, "foo", req, resp) ``` ## Backwards compatibility diff --git a/vendor/github.com/nats-io/nats.go/context.go b/vendor/github.com/nats-io/nats.go/context.go index 20f1782a..c19673c1 100644 --- a/vendor/github.com/nats-io/nats.go/context.go +++ b/vendor/github.com/nats-io/nats.go/context.go @@ -217,6 +217,8 @@ func (nc *Conn) FlushWithContext(ctx context.Context) error { // RequestWithContext will create an Inbox and perform a Request // using the provided cancellation context with the Inbox reply // for the data v. A response will be decoded into the vPtr last parameter. +// +// Deprecated: Encoded connections are no longer supported. func (c *EncodedConn) RequestWithContext(ctx context.Context, subject string, v any, vPtr any) error { if ctx == nil { return ErrInvalidContext diff --git a/vendor/github.com/nats-io/nats.go/enc.go b/vendor/github.com/nats-io/nats.go/enc.go index 4550f618..78bcc219 100644 --- a/vendor/github.com/nats-io/nats.go/enc.go +++ b/vendor/github.com/nats-io/nats.go/enc.go @@ -24,7 +24,11 @@ import ( "github.com/nats-io/nats.go/encoders/builtin" ) +//lint:file-ignore SA1019 Ignore deprecation warnings for EncodedConn + // Encoder interface is for all register encoders +// +// Deprecated: Encoded connections are no longer supported. type Encoder interface { Encode(subject string, v any) ([]byte, error) Decode(subject string, data []byte, vPtr any) error @@ -51,6 +55,8 @@ func init() { // EncodedConn are the preferred way to interface with NATS. They wrap a bare connection to // a nats server and have an extendable encoder system that will encode and decode messages // from raw Go types. +// +// Deprecated: Encoded connections are no longer supported. type EncodedConn struct { Conn *Conn Enc Encoder @@ -58,6 +64,8 @@ type EncodedConn struct { // NewEncodedConn will wrap an existing Connection and utilize the appropriate registered // encoder. +// +// Deprecated: Encoded connections are no longer supported. func NewEncodedConn(c *Conn, encType string) (*EncodedConn, error) { if c == nil { return nil, errors.New("nats: Nil Connection") @@ -73,6 +81,8 @@ func NewEncodedConn(c *Conn, encType string) (*EncodedConn, error) { } // RegisterEncoder will register the encType with the given Encoder. Useful for customization. +// +// Deprecated: Encoded connections are no longer supported. func RegisterEncoder(encType string, enc Encoder) { encLock.Lock() defer encLock.Unlock() @@ -80,6 +90,8 @@ func RegisterEncoder(encType string, enc Encoder) { } // EncoderForType will return the registered Encoder for the encType. +// +// Deprecated: Encoded connections are no longer supported. func EncoderForType(encType string) Encoder { encLock.Lock() defer encLock.Unlock() @@ -88,6 +100,8 @@ func EncoderForType(encType string) Encoder { // Publish publishes the data argument to the given subject. The data argument // will be encoded using the associated encoder. +// +// Deprecated: Encoded connections are no longer supported. func (c *EncodedConn) Publish(subject string, v any) error { b, err := c.Enc.Encode(subject, v) if err != nil { @@ -99,6 +113,8 @@ func (c *EncodedConn) Publish(subject string, v any) error { // PublishRequest will perform a Publish() expecting a response on the // reply subject. Use Request() for automatically waiting for a response // inline. +// +// Deprecated: Encoded connections are no longer supported. func (c *EncodedConn) PublishRequest(subject, reply string, v any) error { b, err := c.Enc.Encode(subject, v) if err != nil { @@ -110,6 +126,8 @@ func (c *EncodedConn) PublishRequest(subject, reply string, v any) error { // Request will create an Inbox and perform a Request() call // with the Inbox reply for the data v. A response will be // decoded into the vPtr Response. +// +// Deprecated: Encoded connections are no longer supported. func (c *EncodedConn) Request(subject string, v any, vPtr any, timeout time.Duration) error { b, err := c.Enc.Encode(subject, v) if err != nil { @@ -150,6 +168,8 @@ func (c *EncodedConn) Request(subject string, v any, vPtr any, timeout time.Dura // and demarshal it into the given struct, e.g. person. // There are also variants where the callback wants either the subject, or the // subject and the reply subject. +// +// Deprecated: Encoded connections are no longer supported. type Handler any // Dissect the cb Handler's signature @@ -170,6 +190,8 @@ var emptyMsgType = reflect.TypeOf(&Msg{}) // Subscribe will create a subscription on the given subject and process incoming // messages using the specified Handler. The Handler should be a func that matches // a signature from the description of Handler from above. +// +// Deprecated: Encoded connections are no longer supported. func (c *EncodedConn) Subscribe(subject string, cb Handler) (*Subscription, error) { return c.subscribe(subject, _EMPTY_, cb) } @@ -177,6 +199,8 @@ func (c *EncodedConn) Subscribe(subject string, cb Handler) (*Subscription, erro // QueueSubscribe will create a queue subscription on the given subject and process // incoming messages using the specified Handler. The Handler should be a func that // matches a signature from the description of Handler from above. +// +// Deprecated: Encoded connections are no longer supported. func (c *EncodedConn) QueueSubscribe(subject, queue string, cb Handler) (*Subscription, error) { return c.subscribe(subject, queue, cb) } @@ -238,18 +262,24 @@ func (c *EncodedConn) subscribe(subject, queue string, cb Handler) (*Subscriptio } // FlushTimeout allows a Flush operation to have an associated timeout. +// +// Deprecated: Encoded connections are no longer supported. func (c *EncodedConn) FlushTimeout(timeout time.Duration) (err error) { return c.Conn.FlushTimeout(timeout) } // Flush will perform a round trip to the server and return when it // receives the internal reply. +// +// Deprecated: Encoded connections are no longer supported. func (c *EncodedConn) Flush() error { return c.Conn.Flush() } // Close will close the connection to the server. This call will release // all blocking calls, such as Flush(), etc. +// +// Deprecated: Encoded connections are no longer supported. func (c *EncodedConn) Close() { c.Conn.Close() } @@ -259,11 +289,15 @@ func (c *EncodedConn) Close() { // will be drained and can not publish any additional messages. Upon draining // of the publishers, the connection will be closed. Use the ClosedCB() // option to know when the connection has moved from draining to closed. +// +// Deprecated: Encoded connections are no longer supported. func (c *EncodedConn) Drain() error { return c.Conn.Drain() } // LastError reports the last error encountered via the Connection. +// +// Deprecated: Encoded connections are no longer supported. func (c *EncodedConn) LastError() error { return c.Conn.LastError() } diff --git a/vendor/github.com/nats-io/nats.go/encoders/builtin/default_enc.go b/vendor/github.com/nats-io/nats.go/encoders/builtin/default_enc.go index c1d0f6f0..e73113da 100644 --- a/vendor/github.com/nats-io/nats.go/encoders/builtin/default_enc.go +++ b/vendor/github.com/nats-io/nats.go/encoders/builtin/default_enc.go @@ -26,6 +26,8 @@ import ( // turn numbers into appropriate strings that can be decoded. It will also // properly encoded and decode bools. If will encode a struct, but if you want // to properly handle structures you should use JsonEncoder. +// +// Deprecated: Encoded connections are no longer supported. type DefaultEncoder struct { // Empty } @@ -35,6 +37,8 @@ var falseB = []byte("false") var nilB = []byte("") // Encode +// +// Deprecated: Encoded connections are no longer supported. func (je *DefaultEncoder) Encode(subject string, v any) ([]byte, error) { switch arg := v.(type) { case string: @@ -58,6 +62,8 @@ func (je *DefaultEncoder) Encode(subject string, v any) ([]byte, error) { } // Decode +// +// Deprecated: Encoded connections are no longer supported. func (je *DefaultEncoder) Decode(subject string, data []byte, vPtr any) error { // Figure out what it's pointing to... sData := *(*string)(unsafe.Pointer(&data)) diff --git a/vendor/github.com/nats-io/nats.go/encoders/builtin/gob_enc.go b/vendor/github.com/nats-io/nats.go/encoders/builtin/gob_enc.go index 7ecf85e4..e2e8c320 100644 --- a/vendor/github.com/nats-io/nats.go/encoders/builtin/gob_enc.go +++ b/vendor/github.com/nats-io/nats.go/encoders/builtin/gob_enc.go @@ -21,6 +21,8 @@ import ( // GobEncoder is a Go specific GOB Encoder implementation for EncodedConn. // This encoder will use the builtin encoding/gob to Marshal // and Unmarshal most types, including structs. +// +// Deprecated: Encoded connections are no longer supported. type GobEncoder struct { // Empty } @@ -28,6 +30,8 @@ type GobEncoder struct { // FIXME(dlc) - This could probably be more efficient. // Encode +// +// Deprecated: Encoded connections are no longer supported. func (ge *GobEncoder) Encode(subject string, v any) ([]byte, error) { b := new(bytes.Buffer) enc := gob.NewEncoder(b) @@ -38,6 +42,8 @@ func (ge *GobEncoder) Encode(subject string, v any) ([]byte, error) { } // Decode +// +// Deprecated: Encoded connections are no longer supported. func (ge *GobEncoder) Decode(subject string, data []byte, vPtr any) (err error) { dec := gob.NewDecoder(bytes.NewBuffer(data)) err = dec.Decode(vPtr) diff --git a/vendor/github.com/nats-io/nats.go/encoders/builtin/json_enc.go b/vendor/github.com/nats-io/nats.go/encoders/builtin/json_enc.go index 0540d985..8e4c852a 100644 --- a/vendor/github.com/nats-io/nats.go/encoders/builtin/json_enc.go +++ b/vendor/github.com/nats-io/nats.go/encoders/builtin/json_enc.go @@ -21,11 +21,15 @@ import ( // JsonEncoder is a JSON Encoder implementation for EncodedConn. // This encoder will use the builtin encoding/json to Marshal // and Unmarshal most types, including structs. +// +// Deprecated: Encoded connections are no longer supported. type JsonEncoder struct { // Empty } // Encode +// +// Deprecated: Encoded connections are no longer supported. func (je *JsonEncoder) Encode(subject string, v any) ([]byte, error) { b, err := json.Marshal(v) if err != nil { @@ -35,6 +39,8 @@ func (je *JsonEncoder) Encode(subject string, v any) ([]byte, error) { } // Decode +// +// Deprecated: Encoded connections are no longer supported. func (je *JsonEncoder) Decode(subject string, data []byte, vPtr any) (err error) { switch arg := vPtr.(type) { case *string: diff --git a/vendor/github.com/nats-io/nats.go/go_test.mod b/vendor/github.com/nats-io/nats.go/go_test.mod index f5b731dd..20e1ab73 100644 --- a/vendor/github.com/nats-io/nats.go/go_test.mod +++ b/vendor/github.com/nats-io/nats.go/go_test.mod @@ -1,23 +1,25 @@ module github.com/nats-io/nats.go -go 1.19 +go 1.21 + +toolchain go1.22.5 require ( github.com/golang/protobuf v1.4.2 - github.com/klauspost/compress v1.17.8 + github.com/klauspost/compress v1.17.9 github.com/nats-io/jwt v1.2.2 - github.com/nats-io/nats-server/v2 v2.10.16 + github.com/nats-io/nats-server/v2 v2.10.17 github.com/nats-io/nkeys v0.4.7 github.com/nats-io/nuid v1.0.1 go.uber.org/goleak v1.3.0 - golang.org/x/text v0.15.0 + golang.org/x/text v0.16.0 google.golang.org/protobuf v1.23.0 ) require ( github.com/minio/highwayhash v1.0.2 // indirect github.com/nats-io/jwt/v2 v2.5.7 // indirect - golang.org/x/crypto v0.23.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/crypto v0.24.0 // indirect + golang.org/x/sys v0.21.0 // indirect golang.org/x/time v0.5.0 // indirect ) diff --git a/vendor/github.com/nats-io/nats.go/go_test.sum b/vendor/github.com/nats-io/nats.go/go_test.sum index f89d755b..df0ef6d7 100644 --- a/vendor/github.com/nats-io/nats.go/go_test.sum +++ b/vendor/github.com/nats-io/nats.go/go_test.sum @@ -1,4 +1,5 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -10,38 +11,40 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/nats-io/jwt v1.2.2 h1:w3GMTO969dFg+UOKTmmyuu7IGdusK+7Ytlt//OYH/uU= github.com/nats-io/jwt v1.2.2/go.mod h1:/xX356yQA6LuXI9xWW7mZNpxgF2mBmGecH+Fj34sP5Q= github.com/nats-io/jwt/v2 v2.5.7 h1:j5lH1fUXCnJnY8SsQeB/a/z9Azgu2bYIDvtPVNdxe2c= github.com/nats-io/jwt/v2 v2.5.7/go.mod h1:ZdWS1nZa6WMZfFwwgpEaqBV8EPGVgOTDHN/wTbz0Y5A= -github.com/nats-io/nats-server/v2 v2.10.16 h1:2jXaiydp5oB/nAx/Ytf9fdCi9QN6ItIc9eehX8kwVV0= -github.com/nats-io/nats-server/v2 v2.10.16/go.mod h1:Pksi38H2+6xLe1vQx0/EA4bzetM0NqyIHcIbmgXSkIU= +github.com/nats-io/nats-server/v2 v2.10.17 h1:PTVObNBD3TZSNUDgzFb1qQsQX4mOgFmOuG9vhT+KBUY= +github.com/nats-io/nats-server/v2 v2.10.17/go.mod h1:5OUyc4zg42s/p2i92zbbqXvUNsbF0ivdTLKshVMn2YQ= github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI= github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= -golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= +golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= @@ -54,3 +57,4 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/vendor/github.com/nats-io/nats.go/js.go b/vendor/github.com/nats-io/nats.go/js.go index 5f8dfe3e..c8b62683 100644 --- a/vendor/github.com/nats-io/nats.go/js.go +++ b/vendor/github.com/nats-io/nats.go/js.go @@ -1,4 +1,4 @@ -// Copyright 2020-2023 The NATS Authors +// Copyright 2020-2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -58,6 +58,19 @@ type JetStream interface { // PublishAsyncComplete returns a channel that will be closed when all outstanding messages are ack'd. PublishAsyncComplete() <-chan struct{} + // CleanupPublisher will cleanup the publishing side of JetStreamContext. + // + // This will unsubscribe from the internal reply subject if needed. + // All pending async publishes will fail with ErrJetStreamPublisherClosed. + // + // If an error handler was provided, it will be called for each pending async + // publish and PublishAsyncComplete will be closed. + // + // After completing JetStreamContext is still usable - internal subscription + // will be recreated on next publish, but the acks from previous publishes will + // be lost. + CleanupPublisher() + // Subscribe creates an async Subscription for JetStream. // The stream and consumer names can be provided with the nats.Bind() option. // For creating an ephemeral (where the consumer name is picked by the server), @@ -719,10 +732,7 @@ func (js *js) resetPendingAcksOnReconnect() { paf.errCh <- paf.err } if errCb != nil { - // clear reply subject so that new one is created on republish - js.mu.Unlock() - errCb(js, paf.msg, ErrDisconnected) - js.mu.Lock() + defer errCb(js, paf.msg, ErrDisconnected) } delete(js.pafs, id) } @@ -734,6 +744,38 @@ func (js *js) resetPendingAcksOnReconnect() { } } +// CleanupPublisher will cleanup the publishing side of JetStreamContext. +// +// This will unsubscribe from the internal reply subject if needed. +// All pending async publishes will fail with ErrJetStreamContextClosed. +// +// If an error handler was provided, it will be called for each pending async +// publish and PublishAsyncComplete will be closed. +// +// After completing JetStreamContext is still usable - internal subscription +// will be recreated on next publish, but the acks from previous publishes will +// be lost. +func (js *js) CleanupPublisher() { + js.cleanupReplySub() + js.mu.Lock() + errCb := js.opts.aecb + for id, paf := range js.pafs { + paf.err = ErrJetStreamPublisherClosed + if paf.errCh != nil { + paf.errCh <- paf.err + } + if errCb != nil { + defer errCb(js, paf.msg, ErrJetStreamPublisherClosed) + } + delete(js.pafs, id) + } + if js.dch != nil { + close(js.dch) + js.dch = nil + } + js.mu.Unlock() +} + func (js *js) cleanupReplySub() { js.mu.Lock() if js.rsub != nil { @@ -2899,10 +2941,11 @@ func (sub *Subscription) Fetch(batch int, opts ...PullOpt) ([]*Msg, error) { } // Make our request expiration a bit shorter than the current timeout. - expires := ttl - if ttl >= 20*time.Millisecond { - expires = ttl - 10*time.Millisecond + expiresDiff := time.Duration(float64(ttl) * 0.1) + if expiresDiff > 5*time.Second { + expiresDiff = 5 * time.Second } + expires := ttl - expiresDiff nr.Batch = batch - len(msgs) nr.Expires = expires @@ -3166,10 +3209,11 @@ func (sub *Subscription) FetchBatch(batch int, opts ...PullOpt) (MessageBatch, e ttl = time.Until(deadline) // Make our request expiration a bit shorter than the current timeout. - expires := ttl - if ttl >= 20*time.Millisecond { - expires = ttl - 10*time.Millisecond + expiresDiff := time.Duration(float64(ttl) * 0.1) + if expiresDiff > 5*time.Second { + expiresDiff = 5 * time.Second } + expires := ttl - expiresDiff requestBatch := batch - len(result.msgs) req := nextRequest{ diff --git a/vendor/github.com/nats-io/nats.go/jserrors.go b/vendor/github.com/nats-io/nats.go/jserrors.go index f0285943..1c22d812 100644 --- a/vendor/github.com/nats-io/nats.go/jserrors.go +++ b/vendor/github.com/nats-io/nats.go/jserrors.go @@ -151,7 +151,10 @@ var ( // ErrSubscriptionClosed is returned when attempting to send pull request to a closed subscription ErrSubscriptionClosed JetStreamError = &jsError{message: "subscription closed"} - // DEPRECATED: ErrInvalidDurableName is no longer returned and will be removed in future releases. + // ErrJetStreamPublisherClosed is returned for each unfinished ack future when JetStream.Cleanup is called. + ErrJetStreamPublisherClosed JetStreamError = &jsError{message: "jetstream context closed"} + + // Deprecated: ErrInvalidDurableName is no longer returned and will be removed in future releases. // Use ErrInvalidConsumerName instead. ErrInvalidDurableName = errors.New("nats: invalid durable name") ) diff --git a/vendor/github.com/nats-io/nats.go/jsm.go b/vendor/github.com/nats-io/nats.go/jsm.go index 9eb5d4b4..68266473 100644 --- a/vendor/github.com/nats-io/nats.go/jsm.go +++ b/vendor/github.com/nats-io/nats.go/jsm.go @@ -41,7 +41,7 @@ type JetStreamManager interface { PurgeStream(name string, opts ...JSOpt) error // StreamsInfo can be used to retrieve a list of StreamInfo objects. - // DEPRECATED: Use Streams() instead. + // Deprecated: Use Streams() instead. StreamsInfo(opts ...JSOpt) <-chan *StreamInfo // Streams can be used to retrieve a list of StreamInfo objects. @@ -86,7 +86,7 @@ type JetStreamManager interface { ConsumerInfo(stream, name string, opts ...JSOpt) (*ConsumerInfo, error) // ConsumersInfo is used to retrieve a list of ConsumerInfo objects. - // DEPRECATED: Use Consumers() instead. + // Deprecated: Use Consumers() instead. ConsumersInfo(stream string, opts ...JSOpt) <-chan *ConsumerInfo // Consumers is used to retrieve a list of ConsumerInfo objects. @@ -240,7 +240,7 @@ type StreamConfig struct { // v2.10.0 or later. Metadata map[string]string `json:"metadata,omitempty"` - // Template identifies the template that manages the Stream. DEPRECATED: + // Template identifies the template that manages the Stream. Deprecated: // This feature is no longer supported. Template string `json:"template_owner,omitempty"` } @@ -747,7 +747,7 @@ func (jsc *js) Consumers(stream string, opts ...JSOpt) <-chan *ConsumerInfo { } // ConsumersInfo is used to retrieve a list of ConsumerInfo objects. -// DEPRECATED: Use Consumers() instead. +// Deprecated: Use Consumers() instead. func (jsc *js) ConsumersInfo(stream string, opts ...JSOpt) <-chan *ConsumerInfo { return jsc.Consumers(stream, opts...) } @@ -1617,7 +1617,7 @@ func (jsc *js) Streams(opts ...JSOpt) <-chan *StreamInfo { } // StreamsInfo can be used to retrieve a list of StreamInfo objects. -// DEPRECATED: Use Streams() instead. +// Deprecated: Use Streams() instead. func (jsc *js) StreamsInfo(opts ...JSOpt) <-chan *StreamInfo { return jsc.Streams(opts...) } diff --git a/vendor/github.com/nats-io/nats.go/kv.go b/vendor/github.com/nats-io/nats.go/kv.go index d9f40fde..4e7a3fde 100644 --- a/vendor/github.com/nats-io/nats.go/kv.go +++ b/vendor/github.com/nats-io/nats.go/kv.go @@ -65,7 +65,7 @@ type KeyValue interface { // WatchAll will invoke the callback for all updates. WatchAll(opts ...WatchOpt) (KeyWatcher, error) // Keys will return all keys. - // DEPRECATED: Use ListKeys instead to avoid memory issues. + // Deprecated: Use ListKeys instead to avoid memory issues. Keys(opts ...WatchOpt) ([]string, error) // ListKeys will return all keys in a channel. ListKeys(opts ...WatchOpt) (KeyLister, error) diff --git a/vendor/github.com/nats-io/nats.go/nats.go b/vendor/github.com/nats-io/nats.go/nats.go index d019cee4..10fa0f5b 100644 --- a/vendor/github.com/nats-io/nats.go/nats.go +++ b/vendor/github.com/nats-io/nats.go/nats.go @@ -47,7 +47,7 @@ import ( // Default Constants const ( - Version = "1.36.0" + Version = "1.37.0" DefaultURL = "nats://127.0.0.1:4222" DefaultPort = 4222 DefaultMaxReconnect = 60 @@ -160,7 +160,7 @@ func GetDefaultOptions() Options { } } -// DEPRECATED: Use GetDefaultOptions() instead. +// Deprecated: Use GetDefaultOptions() instead. // DefaultOptions is not safe for use by multiple clients. // For details see #308. var DefaultOptions = GetDefaultOptions() @@ -386,7 +386,7 @@ type Options struct { // DisconnectedCB sets the disconnected handler that is called // whenever the connection is disconnected. // Will not be called if DisconnectedErrCB is set - // DEPRECATED. Use DisconnectedErrCB which passes error that caused + // Deprecated. Use DisconnectedErrCB which passes error that caused // the disconnect event. DisconnectedCB ConnHandler @@ -450,7 +450,7 @@ type Options struct { TokenHandler AuthTokenHandler // Dialer allows a custom net.Dialer when forming connections. - // DEPRECATED: should use CustomDialer instead. + // Deprecated: should use CustomDialer instead. Dialer *net.Dialer // CustomDialer allows to specify a custom dialer (not necessarily @@ -1108,7 +1108,7 @@ func DisconnectErrHandler(cb ConnErrHandler) Option { } // DisconnectHandler is an Option to set the disconnected handler. -// DEPRECATED: Use DisconnectErrHandler. +// Deprecated: Use DisconnectErrHandler. func DisconnectHandler(cb ConnHandler) Option { return func(o *Options) error { o.DisconnectedCB = cb @@ -1280,7 +1280,7 @@ func SyncQueueLen(max int) Option { // Dialer is an Option to set the dialer which will be used when // attempting to establish a connection. -// DEPRECATED: Should use CustomDialer instead. +// Deprecated: Should use CustomDialer instead. func Dialer(dialer *net.Dialer) Option { return func(o *Options) error { o.Dialer = dialer @@ -1397,7 +1397,7 @@ func TLSHandshakeFirst() Option { // Handler processing // SetDisconnectHandler will set the disconnect event handler. -// DEPRECATED: Use SetDisconnectErrHandler +// Deprecated: Use SetDisconnectErrHandler func (nc *Conn) SetDisconnectHandler(dcb ConnHandler) { if nc == nil { return @@ -1513,7 +1513,7 @@ func processUrlString(url string) []string { urls := strings.Split(url, ",") var j int for _, s := range urls { - u := strings.TrimSpace(s) + u := strings.TrimSuffix(strings.TrimSpace(s), "/") if len(u) > 0 { urls[j] = u j++ @@ -4902,7 +4902,8 @@ func (s *Subscription) processNextMsgDelivered(msg *Msg) error { } // Queued returns the number of queued messages in the client for this subscription. -// DEPRECATED: Use Pending() +// +// Deprecated: Use Pending() func (s *Subscription) QueuedMsgs() (int, error) { m, _, err := s.Pending() return int(m), err diff --git a/vendor/github.com/nats-io/nats.go/netchan.go b/vendor/github.com/nats-io/nats.go/netchan.go index 6b13690b..3722d9f1 100644 --- a/vendor/github.com/nats-io/nats.go/netchan.go +++ b/vendor/github.com/nats-io/nats.go/netchan.go @@ -23,6 +23,8 @@ import ( // Data will be encoded and decoded via the EncodedConn and its associated encoders. // BindSendChan binds a channel for send operations to NATS. +// +// Deprecated: Encoded connections are no longer supported. func (c *EncodedConn) BindSendChan(subject string, channel any) error { chVal := reflect.ValueOf(channel) if chVal.Kind() != reflect.Chan { @@ -61,11 +63,15 @@ func chPublish(c *EncodedConn, chVal reflect.Value, subject string) { } // BindRecvChan binds a channel for receive operations from NATS. +// +// Deprecated: Encoded connections are no longer supported. func (c *EncodedConn) BindRecvChan(subject string, channel any) (*Subscription, error) { return c.bindRecvChan(subject, _EMPTY_, channel) } // BindRecvQueueChan binds a channel for queue-based receive operations from NATS. +// +// Deprecated: Encoded connections are no longer supported. func (c *EncodedConn) BindRecvQueueChan(subject, queue string, channel any) (*Subscription, error) { return c.bindRecvChan(subject, queue, channel) } diff --git a/vendor/github.com/prometheus/client_golang/NOTICE b/vendor/github.com/prometheus/client_golang/NOTICE index dd878a30..b9cc55ab 100644 --- a/vendor/github.com/prometheus/client_golang/NOTICE +++ b/vendor/github.com/prometheus/client_golang/NOTICE @@ -16,8 +16,3 @@ Go support for Protocol Buffers - Google's data interchange format http://github.com/golang/protobuf/ Copyright 2010 The Go Authors See source code for license details. - -Support for streaming Protocol Buffer messages for the Go language (golang). -https://github.com/matttproud/golang_protobuf_extensions -Copyright 2013 Matt T. Proud -Licensed under the Apache License, Version 2.0 diff --git a/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go index ad9a71a5..520cbd7d 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go @@ -22,13 +22,13 @@ import ( // goRuntimeMemStats provides the metrics initially provided by runtime.ReadMemStats. // From Go 1.17 those similar (and better) statistics are provided by runtime/metrics, so // while eval closure works on runtime.MemStats, the struct from Go 1.17+ is -// populated using runtime/metrics. +// populated using runtime/metrics. Those are the defaults we can't alter. func goRuntimeMemStats() memStatsMetrics { return memStatsMetrics{ { desc: NewDesc( memstatNamespace("alloc_bytes"), - "Number of bytes allocated and still in use.", + "Number of bytes allocated in heap and currently in use. Equals to /memory/classes/heap/objects:bytes.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.Alloc) }, @@ -36,7 +36,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("alloc_bytes_total"), - "Total number of bytes allocated, even if freed.", + "Total number of bytes allocated in heap until now, even if released already. Equals to /gc/heap/allocs:bytes.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.TotalAlloc) }, @@ -44,23 +44,16 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("sys_bytes"), - "Number of bytes obtained from system.", + "Number of bytes obtained from system. Equals to /memory/classes/total:byte.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.Sys) }, valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("lookups_total"), - "Total number of pointer lookups.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.Lookups) }, - valType: CounterValue, }, { desc: NewDesc( memstatNamespace("mallocs_total"), - "Total number of mallocs.", + // TODO(bwplotka): We could add go_memstats_heap_objects, probably useful for discovery. Let's gather more feedback, kind of a waste of bytes for everybody for compatibility reasons to keep both, and we can't really rename/remove useful metric. + "Total number of heap objects allocated, both live and gc-ed. Semantically a counter version for go_memstats_heap_objects gauge. Equals to /gc/heap/allocs:objects + /gc/heap/tiny/allocs:objects.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.Mallocs) }, @@ -68,7 +61,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("frees_total"), - "Total number of frees.", + "Total number of heap objects frees. Equals to /gc/heap/frees:objects + /gc/heap/tiny/allocs:objects.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.Frees) }, @@ -76,7 +69,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("heap_alloc_bytes"), - "Number of heap bytes allocated and still in use.", + "Number of heap bytes allocated and currently in use, same as go_memstats_alloc_bytes. Equals to /memory/classes/heap/objects:bytes.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapAlloc) }, @@ -84,7 +77,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("heap_sys_bytes"), - "Number of heap bytes obtained from system.", + "Number of heap bytes obtained from system. Equals to /memory/classes/heap/objects:bytes + /memory/classes/heap/unused:bytes + /memory/classes/heap/released:bytes + /memory/classes/heap/free:bytes.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapSys) }, @@ -92,7 +85,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("heap_idle_bytes"), - "Number of heap bytes waiting to be used.", + "Number of heap bytes waiting to be used. Equals to /memory/classes/heap/released:bytes + /memory/classes/heap/free:bytes.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapIdle) }, @@ -100,7 +93,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("heap_inuse_bytes"), - "Number of heap bytes that are in use.", + "Number of heap bytes that are in use. Equals to /memory/classes/heap/objects:bytes + /memory/classes/heap/unused:bytes", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapInuse) }, @@ -108,7 +101,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("heap_released_bytes"), - "Number of heap bytes released to OS.", + "Number of heap bytes released to OS. Equals to /memory/classes/heap/released:bytes.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapReleased) }, @@ -116,7 +109,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("heap_objects"), - "Number of allocated objects.", + "Number of currently allocated objects. Equals to /gc/heap/objects:objects.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapObjects) }, @@ -124,7 +117,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("stack_inuse_bytes"), - "Number of bytes in use by the stack allocator.", + "Number of bytes obtained from system for stack allocator in non-CGO environments. Equals to /memory/classes/heap/stacks:bytes.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.StackInuse) }, @@ -132,7 +125,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("stack_sys_bytes"), - "Number of bytes obtained from system for stack allocator.", + "Number of bytes obtained from system for stack allocator. Equals to /memory/classes/heap/stacks:bytes + /memory/classes/os-stacks:bytes.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.StackSys) }, @@ -140,7 +133,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("mspan_inuse_bytes"), - "Number of bytes in use by mspan structures.", + "Number of bytes in use by mspan structures. Equals to /memory/classes/metadata/mspan/inuse:bytes.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.MSpanInuse) }, @@ -148,7 +141,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("mspan_sys_bytes"), - "Number of bytes used for mspan structures obtained from system.", + "Number of bytes used for mspan structures obtained from system. Equals to /memory/classes/metadata/mspan/inuse:bytes + /memory/classes/metadata/mspan/free:bytes.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.MSpanSys) }, @@ -156,7 +149,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("mcache_inuse_bytes"), - "Number of bytes in use by mcache structures.", + "Number of bytes in use by mcache structures. Equals to /memory/classes/metadata/mcache/inuse:bytes.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.MCacheInuse) }, @@ -164,7 +157,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("mcache_sys_bytes"), - "Number of bytes used for mcache structures obtained from system.", + "Number of bytes used for mcache structures obtained from system. Equals to /memory/classes/metadata/mcache/inuse:bytes + /memory/classes/metadata/mcache/free:bytes.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.MCacheSys) }, @@ -172,7 +165,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("buck_hash_sys_bytes"), - "Number of bytes used by the profiling bucket hash table.", + "Number of bytes used by the profiling bucket hash table. Equals to /memory/classes/profiling/buckets:bytes.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.BuckHashSys) }, @@ -180,7 +173,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("gc_sys_bytes"), - "Number of bytes used for garbage collection system metadata.", + "Number of bytes used for garbage collection system metadata. Equals to /memory/classes/metadata/other:bytes.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.GCSys) }, @@ -188,7 +181,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("other_sys_bytes"), - "Number of bytes used for other system allocations.", + "Number of bytes used for other system allocations. Equals to /memory/classes/other:bytes.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.OtherSys) }, @@ -196,7 +189,7 @@ func goRuntimeMemStats() memStatsMetrics { }, { desc: NewDesc( memstatNamespace("next_gc_bytes"), - "Number of heap bytes when next garbage collection will take place.", + "Number of heap bytes when next garbage collection will take place. Equals to /gc/heap/goal:bytes.", nil, nil, ), eval: func(ms *runtime.MemStats) float64 { return float64(ms.NextGC) }, @@ -225,7 +218,7 @@ func newBaseGoCollector() baseGoCollector { nil, nil), gcDesc: NewDesc( "go_gc_duration_seconds", - "A summary of the pause duration of garbage collection cycles.", + "A summary of the wall-time pause (stop-the-world) duration in garbage collection cycles.", nil, nil), gcLastTimeDesc: NewDesc( "go_memstats_last_gc_time_seconds", diff --git a/vendor/github.com/prometheus/client_golang/prometheus/go_collector_latest.go b/vendor/github.com/prometheus/client_golang/prometheus/go_collector_latest.go index 2d8d9f64..51174641 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/go_collector_latest.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/go_collector_latest.go @@ -17,6 +17,7 @@ package prometheus import ( + "fmt" "math" "runtime" "runtime/metrics" @@ -153,7 +154,8 @@ func defaultGoCollectorOptions() internal.GoCollectorOptions { "/gc/heap/frees-by-size:bytes": goGCHeapFreesBytes, }, RuntimeMetricRules: []internal.GoCollectorRule{ - //{Matcher: regexp.MustCompile("")}, + // Recommended metrics we want by default from runtime/metrics. + {Matcher: internal.GoCollectorDefaultRuntimeMetrics}, }, } } @@ -203,6 +205,7 @@ func NewGoCollector(opts ...func(o *internal.GoCollectorOptions)) Collector { // to fail here. This condition is tested in TestExpectedRuntimeMetrics. continue } + help := attachOriginalName(d.Description.Description, d.Name) sampleBuf = append(sampleBuf, metrics.Sample{Name: d.Name}) sampleMap[d.Name] = &sampleBuf[len(sampleBuf)-1] @@ -214,7 +217,7 @@ func NewGoCollector(opts ...func(o *internal.GoCollectorOptions)) Collector { m = newBatchHistogram( NewDesc( BuildFQName(namespace, subsystem, name), - d.Description.Description, + help, nil, nil, ), @@ -226,7 +229,7 @@ func NewGoCollector(opts ...func(o *internal.GoCollectorOptions)) Collector { Namespace: namespace, Subsystem: subsystem, Name: name, - Help: d.Description.Description, + Help: help, }, ) } else { @@ -234,7 +237,7 @@ func NewGoCollector(opts ...func(o *internal.GoCollectorOptions)) Collector { Namespace: namespace, Subsystem: subsystem, Name: name, - Help: d.Description.Description, + Help: help, }) } metricSet = append(metricSet, m) @@ -284,6 +287,10 @@ func NewGoCollector(opts ...func(o *internal.GoCollectorOptions)) Collector { } } +func attachOriginalName(desc, origName string) string { + return fmt.Sprintf("%s Sourced from %s", desc, origName) +} + // Describe returns all descriptions of the collector. func (c *goCollector) Describe(ch chan<- *Desc) { c.base.Describe(ch) @@ -376,13 +383,13 @@ func unwrapScalarRMValue(v metrics.Value) float64 { // // This should never happen because we always populate our metric // set from the runtime/metrics package. - panic("unexpected unsupported metric") + panic("unexpected bad kind metric") default: // Unsupported metric kind. // // This should never happen because we check for this during initialization // and flag and filter metrics whose kinds we don't understand. - panic("unexpected unsupported metric kind") + panic(fmt.Sprintf("unexpected unsupported metric: %v", v.Kind())) } } diff --git a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go b/vendor/github.com/prometheus/client_golang/prometheus/histogram.go index b5c8bcb3..519db348 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/histogram.go @@ -440,7 +440,7 @@ type HistogramOpts struct { // constant (or any negative float value). NativeHistogramZeroThreshold float64 - // The remaining fields define a strategy to limit the number of + // The next three fields define a strategy to limit the number of // populated sparse buckets. If NativeHistogramMaxBucketNumber is left // at zero, the number of buckets is not limited. (Note that this might // lead to unbounded memory consumption if the values observed by the @@ -473,6 +473,22 @@ type HistogramOpts struct { NativeHistogramMinResetDuration time.Duration NativeHistogramMaxZeroThreshold float64 + // NativeHistogramMaxExemplars limits the number of exemplars + // that are kept in memory for each native histogram. If you leave it at + // zero, a default value of 10 is used. If no exemplars should be kept specifically + // for native histograms, set it to a negative value. (Scrapers can + // still use the exemplars exposed for classic buckets, which are managed + // independently.) + NativeHistogramMaxExemplars int + // NativeHistogramExemplarTTL is only checked once + // NativeHistogramMaxExemplars is exceeded. In that case, the + // oldest exemplar is removed if it is older than NativeHistogramExemplarTTL. + // Otherwise, the older exemplar in the pair of exemplars that are closest + // together (on an exponential scale) is removed. + // If NativeHistogramExemplarTTL is left at its zero value, a default value of + // 5m is used. To always delete the oldest exemplar, set it to a negative value. + NativeHistogramExemplarTTL time.Duration + // now is for testing purposes, by default it's time.Now. now func() time.Time @@ -532,6 +548,7 @@ func newHistogram(desc *Desc, opts HistogramOpts, labelValues ...string) Histogr if opts.afterFunc == nil { opts.afterFunc = time.AfterFunc } + h := &histogram{ desc: desc, upperBounds: opts.Buckets, @@ -556,6 +573,7 @@ func newHistogram(desc *Desc, opts HistogramOpts, labelValues ...string) Histogr h.nativeHistogramZeroThreshold = DefNativeHistogramZeroThreshold } // Leave h.nativeHistogramZeroThreshold at 0 otherwise. h.nativeHistogramSchema = pickSchema(opts.NativeHistogramBucketFactor) + h.nativeExemplars = makeNativeExemplars(opts.NativeHistogramExemplarTTL, opts.NativeHistogramMaxExemplars) } for i, upperBound := range h.upperBounds { if i < len(h.upperBounds)-1 { @@ -725,7 +743,8 @@ type histogram struct { // resetScheduled is protected by mtx. It is true if a reset is // scheduled for a later time (when nativeHistogramMinResetDuration has // passed). - resetScheduled bool + resetScheduled bool + nativeExemplars nativeExemplars // now is for testing purposes, by default it's time.Now. now func() time.Time @@ -742,6 +761,9 @@ func (h *histogram) Observe(v float64) { h.observe(v, h.findBucket(v)) } +// ObserveWithExemplar should not be called in a high-frequency setting +// for a native histogram with configured exemplars. For this case, +// the implementation isn't lock-free and might suffer from lock contention. func (h *histogram) ObserveWithExemplar(v float64, e Labels) { i := h.findBucket(v) h.observe(v, i) @@ -821,6 +843,13 @@ func (h *histogram) Write(out *dto.Metric) error { Length: proto.Uint32(0), }} } + + if h.nativeExemplars.isEnabled() { + h.nativeExemplars.Lock() + his.Exemplars = append(his.Exemplars, h.nativeExemplars.exemplars...) + h.nativeExemplars.Unlock() + } + } addAndResetCounts(hotCounts, coldCounts) return nil @@ -1091,8 +1120,10 @@ func (h *histogram) resetCounts(counts *histogramCounts) { deleteSyncMap(&counts.nativeHistogramBucketsPositive) } -// updateExemplar replaces the exemplar for the provided bucket. With empty -// labels, it's a no-op. It panics if any of the labels is invalid. +// updateExemplar replaces the exemplar for the provided classic bucket. +// With empty labels, it's a no-op. It panics if any of the labels is invalid. +// If histogram is native, the exemplar will be cached into nativeExemplars, +// which has a limit, and will remove one exemplar when limit is reached. func (h *histogram) updateExemplar(v float64, bucket int, l Labels) { if l == nil { return @@ -1102,6 +1133,10 @@ func (h *histogram) updateExemplar(v float64, bucket int, l Labels) { panic(err) } h.exemplars[bucket].Store(e) + doSparse := h.nativeHistogramSchema > math.MinInt32 && !math.IsNaN(v) + if doSparse { + h.nativeExemplars.addExemplar(e) + } } // HistogramVec is a Collector that bundles a set of Histograms that all share the @@ -1336,6 +1371,48 @@ func MustNewConstHistogram( return m } +// NewConstHistogramWithCreatedTimestamp does the same thing as NewConstHistogram but sets the created timestamp. +func NewConstHistogramWithCreatedTimestamp( + desc *Desc, + count uint64, + sum float64, + buckets map[float64]uint64, + ct time.Time, + labelValues ...string, +) (Metric, error) { + if desc.err != nil { + return nil, desc.err + } + if err := validateLabelValues(labelValues, len(desc.variableLabels.names)); err != nil { + return nil, err + } + return &constHistogram{ + desc: desc, + count: count, + sum: sum, + buckets: buckets, + labelPairs: MakeLabelPairs(desc, labelValues), + createdTs: timestamppb.New(ct), + }, nil +} + +// MustNewConstHistogramWithCreatedTimestamp is a version of NewConstHistogramWithCreatedTimestamp that panics where +// NewConstHistogramWithCreatedTimestamp would have returned an error. +func MustNewConstHistogramWithCreatedTimestamp( + desc *Desc, + count uint64, + sum float64, + buckets map[float64]uint64, + ct time.Time, + labelValues ...string, +) Metric { + m, err := NewConstHistogramWithCreatedTimestamp(desc, count, sum, buckets, ct, labelValues...) + if err != nil { + panic(err) + } + return m +} + type buckSort []*dto.Bucket func (s buckSort) Len() int { @@ -1575,3 +1652,186 @@ func addAndResetCounts(hot, cold *histogramCounts) { atomic.AddUint64(&hot.nativeHistogramZeroBucket, atomic.LoadUint64(&cold.nativeHistogramZeroBucket)) atomic.StoreUint64(&cold.nativeHistogramZeroBucket, 0) } + +type nativeExemplars struct { + sync.Mutex + + // Time-to-live for exemplars, it is set to -1 if exemplars are disabled, that is NativeHistogramMaxExemplars is below 0. + // The ttl is used on insertion to remove an exemplar that is older than ttl, if present. + ttl time.Duration + + exemplars []*dto.Exemplar +} + +func (n *nativeExemplars) isEnabled() bool { + return n.ttl != -1 +} + +func makeNativeExemplars(ttl time.Duration, maxCount int) nativeExemplars { + if ttl == 0 { + ttl = 5 * time.Minute + } + + if maxCount == 0 { + maxCount = 10 + } + + if maxCount < 0 { + maxCount = 0 + ttl = -1 + } + + return nativeExemplars{ + ttl: ttl, + exemplars: make([]*dto.Exemplar, 0, maxCount), + } +} + +func (n *nativeExemplars) addExemplar(e *dto.Exemplar) { + if !n.isEnabled() { + return + } + + n.Lock() + defer n.Unlock() + + // When the number of exemplars has not yet exceeded or + // is equal to cap(n.exemplars), then + // insert the new exemplar directly. + if len(n.exemplars) < cap(n.exemplars) { + var nIdx int + for nIdx = 0; nIdx < len(n.exemplars); nIdx++ { + if *e.Value < *n.exemplars[nIdx].Value { + break + } + } + n.exemplars = append(n.exemplars[:nIdx], append([]*dto.Exemplar{e}, n.exemplars[nIdx:]...)...) + return + } + + if len(n.exemplars) == 1 { + // When the number of exemplars is 1, then + // replace the existing exemplar with the new exemplar. + n.exemplars[0] = e + return + } + // From this point on, the number of exemplars is greater than 1. + + // When the number of exemplars exceeds the limit, remove one exemplar. + var ( + ot = time.Time{} // Oldest timestamp seen. Initial value doesn't matter as we replace it due to otIdx == -1 in the loop. + otIdx = -1 // Index of the exemplar with the oldest timestamp. + + md = -1.0 // Logarithm of the delta of the closest pair of exemplars. + + // The insertion point of the new exemplar in the exemplars slice after insertion. + // This is calculated purely based on the order of the exemplars by value. + // nIdx == len(n.exemplars) means the new exemplar is to be inserted after the end. + nIdx = -1 + + // rIdx is ultimately the index for the exemplar that we are replacing with the new exemplar. + // The aim is to keep a good spread of exemplars by value and not let them bunch up too much. + // It is calculated in 3 steps: + // 1. First we set rIdx to the index of the older exemplar within the closest pair by value. + // That is the following will be true (on log scale): + // either the exemplar pair on index (rIdx-1, rIdx) or (rIdx, rIdx+1) will have + // the closest values to each other from all pairs. + // For example, suppose the values are distributed like this: + // |-----------x-------------x----------------x----x-----| + // ^--rIdx as this is older. + // Or like this: + // |-----------x-------------x----------------x----x-----| + // ^--rIdx as this is older. + // 2. If there is an exemplar that expired, then we simple reset rIdx to that index. + // 3. We check if by inserting the new exemplar we would create a closer pair at + // (nIdx-1, nIdx) or (nIdx, nIdx+1) and set rIdx to nIdx-1 or nIdx accordingly to + // keep the spread of exemplars by value; otherwise we keep rIdx as it is. + rIdx = -1 + cLog float64 // Logarithm of the current exemplar. + pLog float64 // Logarithm of the previous exemplar. + ) + + for i, exemplar := range n.exemplars { + // Find the exemplar with the oldest timestamp. + if otIdx == -1 || exemplar.Timestamp.AsTime().Before(ot) { + ot = exemplar.Timestamp.AsTime() + otIdx = i + } + + // Find the index at which to insert new the exemplar. + if nIdx == -1 && *e.Value <= *exemplar.Value { + nIdx = i + } + + // Find the two closest exemplars and pick the one the with older timestamp. + pLog = cLog + cLog = math.Log(exemplar.GetValue()) + if i == 0 { + continue + } + diff := math.Abs(cLog - pLog) + if md == -1 || diff < md { + // The closest exemplar pair is at index: i-1, i. + // Choose the exemplar with the older timestamp for replacement. + md = diff + if n.exemplars[i].Timestamp.AsTime().Before(n.exemplars[i-1].Timestamp.AsTime()) { + rIdx = i + } else { + rIdx = i - 1 + } + } + + } + + // If all existing exemplar are smaller than new exemplar, + // then the exemplar should be inserted at the end. + if nIdx == -1 { + nIdx = len(n.exemplars) + } + // Here, we have the following relationships: + // n.exemplars[nIdx-1].Value < e.Value (if nIdx > 0) + // e.Value <= n.exemplars[nIdx].Value (if nIdx < len(n.exemplars)) + + if otIdx != -1 && e.Timestamp.AsTime().Sub(ot) > n.ttl { + // If the oldest exemplar has expired, then replace it with the new exemplar. + rIdx = otIdx + } else { + // In the previous for loop, when calculating the closest pair of exemplars, + // we did not take into account the newly inserted exemplar. + // So we need to calculate with the newly inserted exemplar again. + elog := math.Log(e.GetValue()) + if nIdx > 0 { + diff := math.Abs(elog - math.Log(n.exemplars[nIdx-1].GetValue())) + if diff < md { + // The value we are about to insert is closer to the previous exemplar at the insertion point than what we calculated before in rIdx. + // v--rIdx + // |-----------x-n-----------x----------------x----x-----| + // nIdx-1--^ ^--new exemplar value + // Do not make the spread worse, replace nIdx-1 and not rIdx. + md = diff + rIdx = nIdx - 1 + } + } + if nIdx < len(n.exemplars) { + diff := math.Abs(math.Log(n.exemplars[nIdx].GetValue()) - elog) + if diff < md { + // The value we are about to insert is closer to the next exemplar at the insertion point than what we calculated before in rIdx. + // v--rIdx + // |-----------x-----------n-x----------------x----x-----| + // new exemplar value--^ ^--nIdx + // Do not make the spread worse, replace nIdx-1 and not rIdx. + rIdx = nIdx + } + } + } + + // Adjust the slice according to rIdx and nIdx. + switch { + case rIdx == nIdx: + n.exemplars[nIdx] = e + case rIdx < nIdx: + n.exemplars = append(n.exemplars[:rIdx], append(n.exemplars[rIdx+1:nIdx], append([]*dto.Exemplar{e}, n.exemplars[nIdx:]...)...)...) + case rIdx > nIdx: + n.exemplars = append(n.exemplars[:nIdx], append([]*dto.Exemplar{e}, append(n.exemplars[nIdx:rIdx], n.exemplars[rIdx+1:]...)...)...) + } +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/internal/go_collector_options.go b/vendor/github.com/prometheus/client_golang/prometheus/internal/go_collector_options.go index 723b45d6..a4fa6eab 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/internal/go_collector_options.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/internal/go_collector_options.go @@ -30,3 +30,5 @@ type GoCollectorOptions struct { RuntimeMetricSumForHist map[string]string RuntimeMetricRules []GoCollectorRule } + +var GoCollectorDefaultRuntimeMetrics = regexp.MustCompile(`/gc/gogc:percent|/gc/gomemlimit:bytes|/sched/gomaxprocs:threads`) diff --git a/vendor/github.com/prometheus/client_golang/prometheus/metric.go b/vendor/github.com/prometheus/client_golang/prometheus/metric.go index f018e572..9d9b81ab 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/metric.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/metric.go @@ -234,7 +234,7 @@ func NewMetricWithExemplars(m Metric, exemplars ...Exemplar) (Metric, error) { ) for i, e := range exemplars { ts := e.Timestamp - if ts == (time.Time{}) { + if ts.IsZero() { ts = now } exs[i], err = newExemplar(e.Value, ts, e.Labels) diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go index 8548dd18..62a4e7ad 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go @@ -22,14 +22,15 @@ import ( ) type processCollector struct { - collectFn func(chan<- Metric) - pidFn func() (int, error) - reportErrors bool - cpuTotal *Desc - openFDs, maxFDs *Desc - vsize, maxVsize *Desc - rss *Desc - startTime *Desc + collectFn func(chan<- Metric) + pidFn func() (int, error) + reportErrors bool + cpuTotal *Desc + openFDs, maxFDs *Desc + vsize, maxVsize *Desc + rss *Desc + startTime *Desc + inBytes, outBytes *Desc } // ProcessCollectorOpts defines the behavior of a process metrics collector @@ -100,6 +101,16 @@ func NewProcessCollector(opts ProcessCollectorOpts) Collector { "Start time of the process since unix epoch in seconds.", nil, nil, ), + inBytes: NewDesc( + ns+"process_network_receive_bytes_total", + "Number of bytes received by the process over the network.", + nil, nil, + ), + outBytes: NewDesc( + ns+"process_network_transmit_bytes_total", + "Number of bytes sent by the process over the network.", + nil, nil, + ), } if opts.PidFn == nil { @@ -129,6 +140,8 @@ func (c *processCollector) Describe(ch chan<- *Desc) { ch <- c.maxVsize ch <- c.rss ch <- c.startTime + ch <- c.inBytes + ch <- c.outBytes } // Collect returns the current state of all metrics of the collector. diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go index 8c1136ce..14d56d2d 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go @@ -63,4 +63,18 @@ func (c *processCollector) processCollect(ch chan<- Metric) { } else { c.reportError(ch, nil, err) } + + if netstat, err := p.Netstat(); err == nil { + var inOctets, outOctets float64 + if netstat.IpExt.InOctets != nil { + inOctets = *netstat.IpExt.InOctets + } + if netstat.IpExt.OutOctets != nil { + outOctets = *netstat.IpExt.OutOctets + } + ch <- MustNewConstMetric(c.inBytes, CounterValue, inOctets) + ch <- MustNewConstMetric(c.outBytes, CounterValue, outOctets) + } else { + c.reportError(ch, nil, err) + } } diff --git a/vendor/github.com/prometheus/client_golang/prometheus/registry.go b/vendor/github.com/prometheus/client_golang/prometheus/registry.go index 5e2ced25..c6fd2f58 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/registry.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/registry.go @@ -314,16 +314,17 @@ func (r *Registry) Register(c Collector) error { if dimHash != desc.dimHash { return fmt.Errorf("a previously registered descriptor with the same fully-qualified name as %s has different label names or a different help string", desc) } - } else { - // ...then check the new descriptors already seen. - if dimHash, exists := newDimHashesByName[desc.fqName]; exists { - if dimHash != desc.dimHash { - return fmt.Errorf("descriptors reported by collector have inconsistent label names or help strings for the same fully-qualified name, offender is %s", desc) - } - } else { - newDimHashesByName[desc.fqName] = desc.dimHash - } + continue } + + // ...then check the new descriptors already seen. + if dimHash, exists := newDimHashesByName[desc.fqName]; exists { + if dimHash != desc.dimHash { + return fmt.Errorf("descriptors reported by collector have inconsistent label names or help strings for the same fully-qualified name, offender is %s", desc) + } + continue + } + newDimHashesByName[desc.fqName] = desc.dimHash } // A Collector yielding no Desc at all is considered unchecked. if len(newDescIDs) == 0 { diff --git a/vendor/github.com/prometheus/client_golang/prometheus/summary.go b/vendor/github.com/prometheus/client_golang/prometheus/summary.go index 14627044..1ab0e479 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/summary.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/summary.go @@ -783,3 +783,45 @@ func MustNewConstSummary( } return m } + +// NewConstSummaryWithCreatedTimestamp does the same thing as NewConstSummary but sets the created timestamp. +func NewConstSummaryWithCreatedTimestamp( + desc *Desc, + count uint64, + sum float64, + quantiles map[float64]float64, + ct time.Time, + labelValues ...string, +) (Metric, error) { + if desc.err != nil { + return nil, desc.err + } + if err := validateLabelValues(labelValues, len(desc.variableLabels.names)); err != nil { + return nil, err + } + return &constSummary{ + desc: desc, + count: count, + sum: sum, + quantiles: quantiles, + labelPairs: MakeLabelPairs(desc, labelValues), + createdTs: timestamppb.New(ct), + }, nil +} + +// MustNewConstSummaryWithCreatedTimestamp is a version of NewConstSummaryWithCreatedTimestamp that panics where +// NewConstSummaryWithCreatedTimestamp would have returned an error. +func MustNewConstSummaryWithCreatedTimestamp( + desc *Desc, + count uint64, + sum float64, + quantiles map[float64]float64, + ct time.Time, + labelValues ...string, +) Metric { + m, err := NewConstSummaryWithCreatedTimestamp(desc, count, sum, quantiles, ct, labelValues...) + if err != nil { + panic(err) + } + return m +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/vec.go b/vendor/github.com/prometheus/client_golang/prometheus/vec.go index 955cfd59..2c808eec 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/vec.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/vec.go @@ -507,7 +507,7 @@ func (m *metricMap) getOrCreateMetricWithLabelValues( return metric } -// getOrCreateMetricWithLabelValues retrieves the metric by hash and label value +// getOrCreateMetricWithLabels retrieves the metric by hash and label value // or creates it and returns the new one. // // This function holds the mutex. diff --git a/vendor/github.com/prometheus/common/expfmt/decode.go b/vendor/github.com/prometheus/common/expfmt/decode.go index 25cfaa21..1448439b 100644 --- a/vendor/github.com/prometheus/common/expfmt/decode.go +++ b/vendor/github.com/prometheus/common/expfmt/decode.go @@ -45,7 +45,7 @@ func ResponseFormat(h http.Header) Format { mediatype, params, err := mime.ParseMediaType(ct) if err != nil { - return fmtUnknown + return FmtUnknown } const textType = "text/plain" @@ -53,21 +53,21 @@ func ResponseFormat(h http.Header) Format { switch mediatype { case ProtoType: if p, ok := params["proto"]; ok && p != ProtoProtocol { - return fmtUnknown + return FmtUnknown } if e, ok := params["encoding"]; ok && e != "delimited" { - return fmtUnknown + return FmtUnknown } - return fmtProtoDelim + return FmtProtoDelim case textType: if v, ok := params["version"]; ok && v != TextVersion { - return fmtUnknown + return FmtUnknown } - return fmtText + return FmtText } - return fmtUnknown + return FmtUnknown } // NewDecoder returns a new decoder based on the given input format. diff --git a/vendor/github.com/prometheus/common/expfmt/encode.go b/vendor/github.com/prometheus/common/expfmt/encode.go index 7f6cbe7d..cf0c150c 100644 --- a/vendor/github.com/prometheus/common/expfmt/encode.go +++ b/vendor/github.com/prometheus/common/expfmt/encode.go @@ -21,9 +21,10 @@ import ( "google.golang.org/protobuf/encoding/protodelim" "google.golang.org/protobuf/encoding/prototext" - "github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg" "github.com/prometheus/common/model" + "github.com/munnerz/goautoneg" + dto "github.com/prometheus/client_model/go" ) @@ -76,18 +77,18 @@ func Negotiate(h http.Header) Format { if ac.Type+"/"+ac.SubType == ProtoType && ac.Params["proto"] == ProtoProtocol { switch ac.Params["encoding"] { case "delimited": - return fmtProtoDelim + escapingScheme + return FmtProtoDelim + escapingScheme case "text": - return fmtProtoText + escapingScheme + return FmtProtoText + escapingScheme case "compact-text": - return fmtProtoCompact + escapingScheme + return FmtProtoCompact + escapingScheme } } if ac.Type == "text" && ac.SubType == "plain" && (ver == TextVersion || ver == "") { - return fmtText + escapingScheme + return FmtText + escapingScheme } } - return fmtText + escapingScheme + return FmtText + escapingScheme } // NegotiateIncludingOpenMetrics works like Negotiate but includes @@ -109,26 +110,26 @@ func NegotiateIncludingOpenMetrics(h http.Header) Format { if ac.Type+"/"+ac.SubType == ProtoType && ac.Params["proto"] == ProtoProtocol { switch ac.Params["encoding"] { case "delimited": - return fmtProtoDelim + escapingScheme + return FmtProtoDelim + escapingScheme case "text": - return fmtProtoText + escapingScheme + return FmtProtoText + escapingScheme case "compact-text": - return fmtProtoCompact + escapingScheme + return FmtProtoCompact + escapingScheme } } if ac.Type == "text" && ac.SubType == "plain" && (ver == TextVersion || ver == "") { - return fmtText + escapingScheme + return FmtText + escapingScheme } if ac.Type+"/"+ac.SubType == OpenMetricsType && (ver == OpenMetricsVersion_0_0_1 || ver == OpenMetricsVersion_1_0_0 || ver == "") { switch ver { case OpenMetricsVersion_1_0_0: - return fmtOpenMetrics_1_0_0 + escapingScheme + return FmtOpenMetrics_1_0_0 + escapingScheme default: - return fmtOpenMetrics_0_0_1 + escapingScheme + return FmtOpenMetrics_0_0_1 + escapingScheme } } } - return fmtText + escapingScheme + return FmtText + escapingScheme } // NewEncoder returns a new encoder based on content type negotiation. All diff --git a/vendor/github.com/prometheus/common/expfmt/expfmt.go b/vendor/github.com/prometheus/common/expfmt/expfmt.go index 051b38cd..d942af8e 100644 --- a/vendor/github.com/prometheus/common/expfmt/expfmt.go +++ b/vendor/github.com/prometheus/common/expfmt/expfmt.go @@ -32,24 +32,31 @@ type Format string // it on the wire, new content-type strings will have to be agreed upon and // added here. const ( - TextVersion = "0.0.4" - ProtoType = `application/vnd.google.protobuf` - ProtoProtocol = `io.prometheus.client.MetricFamily` - protoFmt = ProtoType + "; proto=" + ProtoProtocol + ";" + TextVersion = "0.0.4" + ProtoType = `application/vnd.google.protobuf` + ProtoProtocol = `io.prometheus.client.MetricFamily` + // Deprecated: Use expfmt.NewFormat(expfmt.TypeProtoCompact) instead. + ProtoFmt = ProtoType + "; proto=" + ProtoProtocol + ";" OpenMetricsType = `application/openmetrics-text` OpenMetricsVersion_0_0_1 = "0.0.1" OpenMetricsVersion_1_0_0 = "1.0.0" - // The Content-Type values for the different wire protocols. Note that these - // values are now unexported. If code was relying on comparisons to these - // constants, instead use FormatType(). - fmtUnknown Format = `` - fmtText Format = `text/plain; version=` + TextVersion + `; charset=utf-8` - fmtProtoDelim Format = protoFmt + ` encoding=delimited` - fmtProtoText Format = protoFmt + ` encoding=text` - fmtProtoCompact Format = protoFmt + ` encoding=compact-text` - fmtOpenMetrics_1_0_0 Format = OpenMetricsType + `; version=` + OpenMetricsVersion_1_0_0 + `; charset=utf-8` - fmtOpenMetrics_0_0_1 Format = OpenMetricsType + `; version=` + OpenMetricsVersion_0_0_1 + `; charset=utf-8` + // The Content-Type values for the different wire protocols. Do not do direct + // comparisons to these constants, instead use the comparison functions. + // Deprecated: Use expfmt.NewFormat(expfmt.TypeUnknown) instead. + FmtUnknown Format = `` + // Deprecated: Use expfmt.NewFormat(expfmt.TypeTextPlain) instead. + FmtText Format = `text/plain; version=` + TextVersion + `; charset=utf-8` + // Deprecated: Use expfmt.NewFormat(expfmt.TypeProtoDelim) instead. + FmtProtoDelim Format = ProtoFmt + ` encoding=delimited` + // Deprecated: Use expfmt.NewFormat(expfmt.TypeProtoText) instead. + FmtProtoText Format = ProtoFmt + ` encoding=text` + // Deprecated: Use expfmt.NewFormat(expfmt.TypeProtoCompact) instead. + FmtProtoCompact Format = ProtoFmt + ` encoding=compact-text` + // Deprecated: Use expfmt.NewFormat(expfmt.TypeOpenMetrics) instead. + FmtOpenMetrics_1_0_0 Format = OpenMetricsType + `; version=` + OpenMetricsVersion_1_0_0 + `; charset=utf-8` + // Deprecated: Use expfmt.NewFormat(expfmt.TypeOpenMetrics) instead. + FmtOpenMetrics_0_0_1 Format = OpenMetricsType + `; version=` + OpenMetricsVersion_0_0_1 + `; charset=utf-8` ) const ( @@ -79,17 +86,17 @@ const ( func NewFormat(t FormatType) Format { switch t { case TypeProtoCompact: - return fmtProtoCompact + return FmtProtoCompact case TypeProtoDelim: - return fmtProtoDelim + return FmtProtoDelim case TypeProtoText: - return fmtProtoText + return FmtProtoText case TypeTextPlain: - return fmtText + return FmtText case TypeOpenMetrics: - return fmtOpenMetrics_1_0_0 + return FmtOpenMetrics_1_0_0 default: - return fmtUnknown + return FmtUnknown } } @@ -97,12 +104,35 @@ func NewFormat(t FormatType) Format { // specified version number. func NewOpenMetricsFormat(version string) (Format, error) { if version == OpenMetricsVersion_0_0_1 { - return fmtOpenMetrics_0_0_1, nil + return FmtOpenMetrics_0_0_1, nil } if version == OpenMetricsVersion_1_0_0 { - return fmtOpenMetrics_1_0_0, nil + return FmtOpenMetrics_1_0_0, nil } - return fmtUnknown, fmt.Errorf("unknown open metrics version string") + return FmtUnknown, fmt.Errorf("unknown open metrics version string") +} + +// WithEscapingScheme returns a copy of Format with the specified escaping +// scheme appended to the end. If an escaping scheme already exists it is +// removed. +func (f Format) WithEscapingScheme(s model.EscapingScheme) Format { + var terms []string + for _, p := range strings.Split(string(f), ";") { + toks := strings.Split(p, "=") + if len(toks) != 2 { + trimmed := strings.TrimSpace(p) + if len(trimmed) > 0 { + terms = append(terms, trimmed) + } + continue + } + key := strings.TrimSpace(toks[0]) + if key != model.EscapingKey { + terms = append(terms, strings.TrimSpace(p)) + } + } + terms = append(terms, model.EscapingKey+"="+s.String()) + return Format(strings.Join(terms, "; ")) } // FormatType deduces an overall FormatType for the given format. diff --git a/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go b/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go index 353c5e93..11c8ff4b 100644 --- a/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go +++ b/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go @@ -477,7 +477,7 @@ func writeOpenMetricsNameAndLabelPairs( if name != "" { // If the name does not pass the legacy validity check, we must put the // metric name inside the braces, quoted. - if !model.IsValidLegacyMetricName(model.LabelValue(name)) { + if !model.IsValidLegacyMetricName(name) { metricInsideBraces = true err := w.WriteByte(separator) written++ diff --git a/vendor/github.com/prometheus/common/expfmt/text_create.go b/vendor/github.com/prometheus/common/expfmt/text_create.go index f9b8265a..4b86434b 100644 --- a/vendor/github.com/prometheus/common/expfmt/text_create.go +++ b/vendor/github.com/prometheus/common/expfmt/text_create.go @@ -354,7 +354,7 @@ func writeNameAndLabelPairs( if name != "" { // If the name does not pass the legacy validity check, we must put the // metric name inside the braces. - if !model.IsValidLegacyMetricName(model.LabelValue(name)) { + if !model.IsValidLegacyMetricName(name) { metricInsideBraces = true err := w.WriteByte(separator) written++ @@ -498,7 +498,7 @@ func writeInt(w enhancedWriter, i int64) (int, error) { // writeName writes a string as-is if it complies with the legacy naming // scheme, or escapes it in double quotes if not. func writeName(w enhancedWriter, name string) (int, error) { - if model.IsValidLegacyMetricName(model.LabelValue(name)) { + if model.IsValidLegacyMetricName(name) { return w.WriteString(name) } var written int diff --git a/vendor/github.com/prometheus/common/expfmt/text_parse.go b/vendor/github.com/prometheus/common/expfmt/text_parse.go index 26490211..f085a923 100644 --- a/vendor/github.com/prometheus/common/expfmt/text_parse.go +++ b/vendor/github.com/prometheus/common/expfmt/text_parse.go @@ -22,9 +22,9 @@ import ( "math" "strconv" "strings" + "unicode/utf8" dto "github.com/prometheus/client_model/go" - "google.golang.org/protobuf/proto" "github.com/prometheus/common/model" @@ -60,6 +60,7 @@ type TextParser struct { currentMF *dto.MetricFamily currentMetric *dto.Metric currentLabelPair *dto.LabelPair + currentLabelPairs []*dto.LabelPair // Temporarily stores label pairs while parsing a metric line. // The remaining member variables are only used for summaries/histograms. currentLabels map[string]string // All labels including '__name__' but excluding 'quantile'/'le' @@ -74,6 +75,9 @@ type TextParser struct { // count and sum of that summary/histogram. currentIsSummaryCount, currentIsSummarySum bool currentIsHistogramCount, currentIsHistogramSum bool + // These indicate if the metric name from the current line being parsed is inside + // braces and if that metric name was found respectively. + currentMetricIsInsideBraces, currentMetricInsideBracesIsPresent bool } // TextToMetricFamilies reads 'in' as the simple and flat text-based exchange @@ -137,12 +141,15 @@ func (p *TextParser) reset(in io.Reader) { } p.currentQuantile = math.NaN() p.currentBucket = math.NaN() + p.currentMF = nil } // startOfLine represents the state where the next byte read from p.buf is the // start of a line (or whitespace leading up to it). func (p *TextParser) startOfLine() stateFn { p.lineCount++ + p.currentMetricIsInsideBraces = false + p.currentMetricInsideBracesIsPresent = false if p.skipBlankTab(); p.err != nil { // This is the only place that we expect to see io.EOF, // which is not an error but the signal that we are done. @@ -158,6 +165,9 @@ func (p *TextParser) startOfLine() stateFn { return p.startComment case '\n': return p.startOfLine // Empty line, start the next one. + case '{': + p.currentMetricIsInsideBraces = true + return p.readingLabels } return p.readingMetricName } @@ -275,6 +285,8 @@ func (p *TextParser) startLabelName() stateFn { return nil // Unexpected end of input. } if p.currentByte == '}' { + p.currentMetric.Label = append(p.currentMetric.Label, p.currentLabelPairs...) + p.currentLabelPairs = nil if p.skipBlankTab(); p.err != nil { return nil // Unexpected end of input. } @@ -287,6 +299,45 @@ func (p *TextParser) startLabelName() stateFn { p.parseError(fmt.Sprintf("invalid label name for metric %q", p.currentMF.GetName())) return nil } + if p.skipBlankTabIfCurrentBlankTab(); p.err != nil { + return nil // Unexpected end of input. + } + if p.currentByte != '=' { + if p.currentMetricIsInsideBraces { + if p.currentMetricInsideBracesIsPresent { + p.parseError(fmt.Sprintf("multiple metric names for metric %q", p.currentMF.GetName())) + return nil + } + switch p.currentByte { + case ',': + p.setOrCreateCurrentMF() + if p.currentMF.Type == nil { + p.currentMF.Type = dto.MetricType_UNTYPED.Enum() + } + p.currentMetric = &dto.Metric{} + p.currentMetricInsideBracesIsPresent = true + return p.startLabelName + case '}': + p.setOrCreateCurrentMF() + if p.currentMF.Type == nil { + p.currentMF.Type = dto.MetricType_UNTYPED.Enum() + } + p.currentMetric = &dto.Metric{} + p.currentMetric.Label = append(p.currentMetric.Label, p.currentLabelPairs...) + p.currentLabelPairs = nil + if p.skipBlankTab(); p.err != nil { + return nil // Unexpected end of input. + } + return p.readingValue + default: + p.parseError(fmt.Sprintf("unexpected end of metric name %q", p.currentByte)) + return nil + } + } + p.parseError(fmt.Sprintf("expected '=' after label name, found %q", p.currentByte)) + p.currentLabelPairs = nil + return nil + } p.currentLabelPair = &dto.LabelPair{Name: proto.String(p.currentToken.String())} if p.currentLabelPair.GetName() == string(model.MetricNameLabel) { p.parseError(fmt.Sprintf("label name %q is reserved", model.MetricNameLabel)) @@ -296,23 +347,17 @@ func (p *TextParser) startLabelName() stateFn { // labels to 'real' labels. if !(p.currentMF.GetType() == dto.MetricType_SUMMARY && p.currentLabelPair.GetName() == model.QuantileLabel) && !(p.currentMF.GetType() == dto.MetricType_HISTOGRAM && p.currentLabelPair.GetName() == model.BucketLabel) { - p.currentMetric.Label = append(p.currentMetric.Label, p.currentLabelPair) - } - if p.skipBlankTabIfCurrentBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - if p.currentByte != '=' { - p.parseError(fmt.Sprintf("expected '=' after label name, found %q", p.currentByte)) - return nil + p.currentLabelPairs = append(p.currentLabelPairs, p.currentLabelPair) } // Check for duplicate label names. labels := make(map[string]struct{}) - for _, l := range p.currentMetric.Label { + for _, l := range p.currentLabelPairs { lName := l.GetName() if _, exists := labels[lName]; !exists { labels[lName] = struct{}{} } else { p.parseError(fmt.Sprintf("duplicate label names for metric %q", p.currentMF.GetName())) + p.currentLabelPairs = nil return nil } } @@ -345,6 +390,7 @@ func (p *TextParser) startLabelValue() stateFn { if p.currentQuantile, p.err = parseFloat(p.currentLabelPair.GetValue()); p.err != nil { // Create a more helpful error message. p.parseError(fmt.Sprintf("expected float as value for 'quantile' label, got %q", p.currentLabelPair.GetValue())) + p.currentLabelPairs = nil return nil } } else { @@ -371,12 +417,19 @@ func (p *TextParser) startLabelValue() stateFn { return p.startLabelName case '}': + if p.currentMF == nil { + p.parseError("invalid metric name") + return nil + } + p.currentMetric.Label = append(p.currentMetric.Label, p.currentLabelPairs...) + p.currentLabelPairs = nil if p.skipBlankTab(); p.err != nil { return nil // Unexpected end of input. } return p.readingValue default: p.parseError(fmt.Sprintf("unexpected end of label value %q", p.currentLabelPair.GetValue())) + p.currentLabelPairs = nil return nil } } @@ -585,6 +638,8 @@ func (p *TextParser) readTokenUntilNewline(recognizeEscapeSequence bool) { p.currentToken.WriteByte(p.currentByte) case 'n': p.currentToken.WriteByte('\n') + case '"': + p.currentToken.WriteByte('"') default: p.parseError(fmt.Sprintf("invalid escape sequence '\\%c'", p.currentByte)) return @@ -610,13 +665,45 @@ func (p *TextParser) readTokenUntilNewline(recognizeEscapeSequence bool) { // but not into p.currentToken. func (p *TextParser) readTokenAsMetricName() { p.currentToken.Reset() + // A UTF-8 metric name must be quoted and may have escaped characters. + quoted := false + escaped := false if !isValidMetricNameStart(p.currentByte) { return } - for { - p.currentToken.WriteByte(p.currentByte) + for p.err == nil { + if escaped { + switch p.currentByte { + case '\\': + p.currentToken.WriteByte(p.currentByte) + case 'n': + p.currentToken.WriteByte('\n') + case '"': + p.currentToken.WriteByte('"') + default: + p.parseError(fmt.Sprintf("invalid escape sequence '\\%c'", p.currentByte)) + return + } + escaped = false + } else { + switch p.currentByte { + case '"': + quoted = !quoted + if !quoted { + p.currentByte, p.err = p.buf.ReadByte() + return + } + case '\n': + p.parseError(fmt.Sprintf("metric name %q contains unescaped new-line", p.currentToken.String())) + return + case '\\': + escaped = true + default: + p.currentToken.WriteByte(p.currentByte) + } + } p.currentByte, p.err = p.buf.ReadByte() - if p.err != nil || !isValidMetricNameContinuation(p.currentByte) { + if !isValidMetricNameContinuation(p.currentByte, quoted) || (!quoted && p.currentByte == ' ') { return } } @@ -628,13 +715,45 @@ func (p *TextParser) readTokenAsMetricName() { // but not into p.currentToken. func (p *TextParser) readTokenAsLabelName() { p.currentToken.Reset() + // A UTF-8 label name must be quoted and may have escaped characters. + quoted := false + escaped := false if !isValidLabelNameStart(p.currentByte) { return } - for { - p.currentToken.WriteByte(p.currentByte) + for p.err == nil { + if escaped { + switch p.currentByte { + case '\\': + p.currentToken.WriteByte(p.currentByte) + case 'n': + p.currentToken.WriteByte('\n') + case '"': + p.currentToken.WriteByte('"') + default: + p.parseError(fmt.Sprintf("invalid escape sequence '\\%c'", p.currentByte)) + return + } + escaped = false + } else { + switch p.currentByte { + case '"': + quoted = !quoted + if !quoted { + p.currentByte, p.err = p.buf.ReadByte() + return + } + case '\n': + p.parseError(fmt.Sprintf("label name %q contains unescaped new-line", p.currentToken.String())) + return + case '\\': + escaped = true + default: + p.currentToken.WriteByte(p.currentByte) + } + } p.currentByte, p.err = p.buf.ReadByte() - if p.err != nil || !isValidLabelNameContinuation(p.currentByte) { + if !isValidLabelNameContinuation(p.currentByte, quoted) || (!quoted && p.currentByte == '=') { return } } @@ -660,6 +779,7 @@ func (p *TextParser) readTokenAsLabelValue() { p.currentToken.WriteByte('\n') default: p.parseError(fmt.Sprintf("invalid escape sequence '\\%c'", p.currentByte)) + p.currentLabelPairs = nil return } escaped = false @@ -718,19 +838,19 @@ func (p *TextParser) setOrCreateCurrentMF() { } func isValidLabelNameStart(b byte) bool { - return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' + return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || b == '"' } -func isValidLabelNameContinuation(b byte) bool { - return isValidLabelNameStart(b) || (b >= '0' && b <= '9') +func isValidLabelNameContinuation(b byte, quoted bool) bool { + return isValidLabelNameStart(b) || (b >= '0' && b <= '9') || (quoted && utf8.ValidString(string(b))) } func isValidMetricNameStart(b byte) bool { return isValidLabelNameStart(b) || b == ':' } -func isValidMetricNameContinuation(b byte) bool { - return isValidLabelNameContinuation(b) || b == ':' +func isValidMetricNameContinuation(b byte, quoted bool) bool { + return isValidLabelNameContinuation(b, quoted) || b == ':' } func isBlankOrTab(b byte) bool { diff --git a/vendor/github.com/prometheus/common/model/labels.go b/vendor/github.com/prometheus/common/model/labels.go index 3317ce22..73b7aa3e 100644 --- a/vendor/github.com/prometheus/common/model/labels.go +++ b/vendor/github.com/prometheus/common/model/labels.go @@ -97,26 +97,35 @@ var LabelNameRE = regexp.MustCompile("^[a-zA-Z_][a-zA-Z0-9_]*$") // therewith. type LabelName string -// IsValid returns true iff name matches the pattern of LabelNameRE for legacy -// names, and iff it's valid UTF-8 if NameValidationScheme is set to -// UTF8Validation. For the legacy matching, it does not use LabelNameRE for the -// check but a much faster hardcoded implementation. +// IsValid returns true iff the name matches the pattern of LabelNameRE when +// NameValidationScheme is set to LegacyValidation, or valid UTF-8 if +// NameValidationScheme is set to UTF8Validation. func (ln LabelName) IsValid() bool { if len(ln) == 0 { return false } switch NameValidationScheme { case LegacyValidation: - for i, b := range ln { - if !((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || (b >= '0' && b <= '9' && i > 0)) { - return false - } - } + return ln.IsValidLegacy() case UTF8Validation: return utf8.ValidString(string(ln)) default: panic(fmt.Sprintf("Invalid name validation scheme requested: %d", NameValidationScheme)) } +} + +// IsValidLegacy returns true iff name matches the pattern of LabelNameRE for +// legacy names. It does not use LabelNameRE for the check but a much faster +// hardcoded implementation. +func (ln LabelName) IsValidLegacy() bool { + if len(ln) == 0 { + return false + } + for i, b := range ln { + if !((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || (b >= '0' && b <= '9' && i > 0)) { + return false + } + } return true } diff --git a/vendor/github.com/prometheus/common/model/metric.go b/vendor/github.com/prometheus/common/model/metric.go index eb865e5a..f50966bc 100644 --- a/vendor/github.com/prometheus/common/model/metric.go +++ b/vendor/github.com/prometheus/common/model/metric.go @@ -34,10 +34,13 @@ var ( // goroutines are started. NameValidationScheme = LegacyValidation - // NameEscapingScheme defines the default way that names will be - // escaped when presented to systems that do not support UTF-8 names. If the - // Content-Type "escaping" term is specified, that will override this value. - NameEscapingScheme = ValueEncodingEscaping + // NameEscapingScheme defines the default way that names will be escaped when + // presented to systems that do not support UTF-8 names. If the Content-Type + // "escaping" term is specified, that will override this value. + // NameEscapingScheme should not be set to the NoEscaping value. That string + // is used in content negotiation to indicate that a system supports UTF-8 and + // has that feature enabled. + NameEscapingScheme = UnderscoreEscaping ) // ValidationScheme is a Go enum for determining how metric and label names will @@ -161,7 +164,7 @@ func (m Metric) FastFingerprint() Fingerprint { func IsValidMetricName(n LabelValue) bool { switch NameValidationScheme { case LegacyValidation: - return IsValidLegacyMetricName(n) + return IsValidLegacyMetricName(string(n)) case UTF8Validation: if len(n) == 0 { return false @@ -176,7 +179,7 @@ func IsValidMetricName(n LabelValue) bool { // legacy validation scheme regardless of the value of NameValidationScheme. // This function, however, does not use MetricNameRE for the check but a much // faster hardcoded implementation. -func IsValidLegacyMetricName(n LabelValue) bool { +func IsValidLegacyMetricName(n string) bool { if len(n) == 0 { return false } @@ -208,7 +211,7 @@ func EscapeMetricFamily(v *dto.MetricFamily, scheme EscapingScheme) *dto.MetricF } // If the name is nil, copy as-is, don't try to escape. - if v.Name == nil || IsValidLegacyMetricName(LabelValue(v.GetName())) { + if v.Name == nil || IsValidLegacyMetricName(v.GetName()) { out.Name = v.Name } else { out.Name = proto.String(EscapeName(v.GetName(), scheme)) @@ -230,7 +233,7 @@ func EscapeMetricFamily(v *dto.MetricFamily, scheme EscapingScheme) *dto.MetricF for _, l := range m.Label { if l.GetName() == MetricNameLabel { - if l.Value == nil || IsValidLegacyMetricName(LabelValue(l.GetValue())) { + if l.Value == nil || IsValidLegacyMetricName(l.GetValue()) { escaped.Label = append(escaped.Label, l) continue } @@ -240,7 +243,7 @@ func EscapeMetricFamily(v *dto.MetricFamily, scheme EscapingScheme) *dto.MetricF }) continue } - if l.Name == nil || IsValidLegacyMetricName(LabelValue(l.GetName())) { + if l.Name == nil || IsValidLegacyMetricName(l.GetName()) { escaped.Label = append(escaped.Label, l) continue } @@ -256,10 +259,10 @@ func EscapeMetricFamily(v *dto.MetricFamily, scheme EscapingScheme) *dto.MetricF func metricNeedsEscaping(m *dto.Metric) bool { for _, l := range m.Label { - if l.GetName() == MetricNameLabel && !IsValidLegacyMetricName(LabelValue(l.GetValue())) { + if l.GetName() == MetricNameLabel && !IsValidLegacyMetricName(l.GetValue()) { return true } - if !IsValidLegacyMetricName(LabelValue(l.GetName())) { + if !IsValidLegacyMetricName(l.GetName()) { return true } } @@ -283,7 +286,7 @@ func EscapeName(name string, scheme EscapingScheme) string { case NoEscaping: return name case UnderscoreEscaping: - if IsValidLegacyMetricName(LabelValue(name)) { + if IsValidLegacyMetricName(name) { return name } for i, b := range name { @@ -309,7 +312,7 @@ func EscapeName(name string, scheme EscapingScheme) string { } return escaped.String() case ValueEncodingEscaping: - if IsValidLegacyMetricName(LabelValue(name)) { + if IsValidLegacyMetricName(name) { return name } escaped.WriteString("U__") @@ -452,6 +455,6 @@ func ToEscapingScheme(s string) (EscapingScheme, error) { case EscapeValues: return ValueEncodingEscaping, nil default: - return NoEscaping, fmt.Errorf("unknown format scheme " + s) + return NoEscaping, fmt.Errorf("unknown format scheme %s", s) } } diff --git a/vendor/github.com/rs/xid/.gitignore b/vendor/github.com/rs/xid/.gitignore new file mode 100644 index 00000000..81be9277 --- /dev/null +++ b/vendor/github.com/rs/xid/.gitignore @@ -0,0 +1,3 @@ +/.idea +/.vscode +.DS_Store \ No newline at end of file diff --git a/vendor/github.com/rs/xid/README.md b/vendor/github.com/rs/xid/README.md index 974e67d2..1bf45bd1 100644 --- a/vendor/github.com/rs/xid/README.md +++ b/vendor/github.com/rs/xid/README.md @@ -4,7 +4,7 @@ Package xid is a globally unique id generator library, ready to safely be used directly in your server code. -Xid uses the Mongo Object ID algorithm to generate globally unique ids with a different serialization (base64) to make it shorter when transported as a string: +Xid uses the Mongo Object ID algorithm to generate globally unique ids with a different serialization ([base32hex](https://datatracker.ietf.org/doc/html/rfc4648#page-10)) to make it shorter when transported as a string: https://docs.mongodb.org/manual/reference/object-id/ - 4-byte value representing the seconds since the Unix epoch, @@ -13,7 +13,7 @@ https://docs.mongodb.org/manual/reference/object-id/ - 3-byte counter, starting with a random value. The binary representation of the id is compatible with Mongo 12 bytes Object IDs. -The string representation is using base32 hex (w/o padding) for better space efficiency +The string representation is using [base32hex](https://datatracker.ietf.org/doc/html/rfc4648#page-10) (w/o padding) for better space efficiency when stored in that form (20 bytes). The hex variant of base32 is used to retain the sortable property of the id. @@ -71,8 +71,10 @@ References: - Java port by [0xShamil](https://github.com/0xShamil/): https://github.com/0xShamil/java-xid - Dart port by [Peter Bwire](https://github.com/pitabwire): https://pub.dev/packages/xid - PostgreSQL port by [Rasmus Holm](https://github.com/crholm): https://github.com/modfin/pg-xid -- Swift port by [Uditha Atukorala](https://github.com/uditha-atukorala): https://github.com/uditha-atukorala/swift-xid -- C++ port by [Uditha Atukorala](https://github.com/uditha-atukorala): https://github.com/uditha-atukorala/libxid +- Swift port by [Uditha Atukorala](https://github.com/uatuko): https://github.com/uatuko/swift-xid +- C++ port by [Uditha Atukorala](https://github.com/uatuko): https://github.com/uatuko/libxid +- Typescript & Javascript port by [Yiwen AI](https://github.com/yiwen-ai): https://github.com/yiwen-ai/xid-ts +- Gleam port by [Alexandre Del Vecchio](https://github.com/defgenx): https://github.com/defgenx/gxid ## Install diff --git a/vendor/github.com/rs/xid/hostid_darwin.go b/vendor/github.com/rs/xid/hostid_darwin.go index 08351ff7..17351563 100644 --- a/vendor/github.com/rs/xid/hostid_darwin.go +++ b/vendor/github.com/rs/xid/hostid_darwin.go @@ -2,8 +2,33 @@ package xid -import "syscall" +import ( + "errors" + "os/exec" + "strings" +) func readPlatformMachineID() (string, error) { - return syscall.Sysctl("kern.uuid") + ioreg, err := exec.LookPath("ioreg") + if err != nil { + return "", err + } + + cmd := exec.Command(ioreg, "-rd1", "-c", "IOPlatformExpertDevice") + out, err := cmd.CombinedOutput() + if err != nil { + return "", err + } + + for _, line := range strings.Split(string(out), "\n") { + if strings.Contains(line, "IOPlatformUUID") { + parts := strings.SplitAfter(line, `" = "`) + if len(parts) == 2 { + uuid := strings.TrimRight(parts[1], `"`) + return strings.ToLower(uuid), nil + } + } + } + + return "", errors.New("cannot find host id") } diff --git a/vendor/github.com/rs/xid/hostid_windows.go b/vendor/github.com/rs/xid/hostid_windows.go index ec2593ee..a4d98ab0 100644 --- a/vendor/github.com/rs/xid/hostid_windows.go +++ b/vendor/github.com/rs/xid/hostid_windows.go @@ -11,11 +11,17 @@ import ( func readPlatformMachineID() (string, error) { // source: https://github.com/shirou/gopsutil/blob/master/host/host_syscall.go var h syscall.Handle - err := syscall.RegOpenKeyEx(syscall.HKEY_LOCAL_MACHINE, syscall.StringToUTF16Ptr(`SOFTWARE\Microsoft\Cryptography`), 0, syscall.KEY_READ|syscall.KEY_WOW64_64KEY, &h) + + regKeyCryptoPtr, err := syscall.UTF16PtrFromString(`SOFTWARE\Microsoft\Cryptography`) + if err != nil { + return "", fmt.Errorf(`error reading registry key "SOFTWARE\Microsoft\Cryptography": %w`, err) + } + + err = syscall.RegOpenKeyEx(syscall.HKEY_LOCAL_MACHINE, regKeyCryptoPtr, 0, syscall.KEY_READ|syscall.KEY_WOW64_64KEY, &h) if err != nil { return "", err } - defer syscall.RegCloseKey(h) + defer func() { _ = syscall.RegCloseKey(h) }() const syscallRegBufLen = 74 // len(`{`) + len(`abcdefgh-1234-456789012-123345456671` * 2) + len(`}`) // 2 == bytes/UTF16 const uuidLen = 36 @@ -23,9 +29,15 @@ func readPlatformMachineID() (string, error) { var regBuf [syscallRegBufLen]uint16 bufLen := uint32(syscallRegBufLen) var valType uint32 - err = syscall.RegQueryValueEx(h, syscall.StringToUTF16Ptr(`MachineGuid`), nil, &valType, (*byte)(unsafe.Pointer(®Buf[0])), &bufLen) + + mGuidPtr, err := syscall.UTF16PtrFromString(`MachineGuid`) if err != nil { - return "", err + return "", fmt.Errorf("error reading machine GUID: %w", err) + } + + err = syscall.RegQueryValueEx(h, mGuidPtr, nil, &valType, (*byte)(unsafe.Pointer(®Buf[0])), &bufLen) + if err != nil { + return "", fmt.Errorf("error parsing ") } hostID := syscall.UTF16ToString(regBuf[:]) diff --git a/vendor/github.com/rs/xid/id.go b/vendor/github.com/rs/xid/id.go index fcd7a041..e88984d9 100644 --- a/vendor/github.com/rs/xid/id.go +++ b/vendor/github.com/rs/xid/id.go @@ -54,7 +54,6 @@ import ( "sort" "sync/atomic" "time" - "unsafe" ) // Code inspired from mgo/bson ObjectId @@ -172,7 +171,7 @@ func FromString(id string) (ID, error) { func (id ID) String() string { text := make([]byte, encodedLen) encode(text, id[:]) - return *(*string)(unsafe.Pointer(&text)) + return string(text) } // Encode encodes the id using base32 encoding, writing 20 bytes to dst and return it. @@ -206,23 +205,23 @@ func encode(dst, id []byte) { dst[19] = encoding[(id[11]<<4)&0x1F] dst[18] = encoding[(id[11]>>1)&0x1F] - dst[17] = encoding[(id[11]>>6)&0x1F|(id[10]<<2)&0x1F] + dst[17] = encoding[(id[11]>>6)|(id[10]<<2)&0x1F] dst[16] = encoding[id[10]>>3] dst[15] = encoding[id[9]&0x1F] dst[14] = encoding[(id[9]>>5)|(id[8]<<3)&0x1F] dst[13] = encoding[(id[8]>>2)&0x1F] dst[12] = encoding[id[8]>>7|(id[7]<<1)&0x1F] - dst[11] = encoding[(id[7]>>4)&0x1F|(id[6]<<4)&0x1F] + dst[11] = encoding[(id[7]>>4)|(id[6]<<4)&0x1F] dst[10] = encoding[(id[6]>>1)&0x1F] - dst[9] = encoding[(id[6]>>6)&0x1F|(id[5]<<2)&0x1F] + dst[9] = encoding[(id[6]>>6)|(id[5]<<2)&0x1F] dst[8] = encoding[id[5]>>3] dst[7] = encoding[id[4]&0x1F] dst[6] = encoding[id[4]>>5|(id[3]<<3)&0x1F] dst[5] = encoding[(id[3]>>2)&0x1F] dst[4] = encoding[id[3]>>7|(id[2]<<1)&0x1F] - dst[3] = encoding[(id[2]>>4)&0x1F|(id[1]<<4)&0x1F] + dst[3] = encoding[(id[2]>>4)|(id[1]<<4)&0x1F] dst[2] = encoding[(id[1]>>1)&0x1F] - dst[1] = encoding[(id[1]>>6)&0x1F|(id[0]<<2)&0x1F] + dst[1] = encoding[(id[1]>>6)|(id[0]<<2)&0x1F] dst[0] = encoding[id[0]>>3] } diff --git a/vendor/github.com/sashabaranov/go-openai/.zshrc b/vendor/github.com/sashabaranov/go-openai/.zshrc new file mode 100644 index 00000000..e69de29b diff --git a/vendor/github.com/sashabaranov/go-openai/README.md b/vendor/github.com/sashabaranov/go-openai/README.md index 799dc602..b3ebc147 100644 --- a/vendor/github.com/sashabaranov/go-openai/README.md +++ b/vendor/github.com/sashabaranov/go-openai/README.md @@ -141,7 +141,7 @@ func main() { ctx := context.Background() req := openai.CompletionRequest{ - Model: openai.GPT3Ada, + Model: openai.GPT3Babbage002, MaxTokens: 5, Prompt: "Lorem ipsum", } @@ -174,7 +174,7 @@ func main() { ctx := context.Background() req := openai.CompletionRequest{ - Model: openai.GPT3Ada, + Model: openai.GPT3Babbage002, MaxTokens: 5, Prompt: "Lorem ipsum", Stream: true, @@ -743,6 +743,70 @@ func main() { } ``` + +

    +Structured Outputs + +```go +package main + +import ( + "context" + "fmt" + "log" + + "github.com/sashabaranov/go-openai" + "github.com/sashabaranov/go-openai/jsonschema" +) + +func main() { + client := openai.NewClient("your token") + ctx := context.Background() + + type Result struct { + Steps []struct { + Explanation string `json:"explanation"` + Output string `json:"output"` + } `json:"steps"` + FinalAnswer string `json:"final_answer"` + } + var result Result + schema, err := jsonschema.GenerateSchemaForType(result) + if err != nil { + log.Fatalf("GenerateSchemaForType error: %v", err) + } + resp, err := client.CreateChatCompletion(ctx, openai.ChatCompletionRequest{ + Model: openai.GPT4oMini, + Messages: []openai.ChatCompletionMessage{ + { + Role: openai.ChatMessageRoleSystem, + Content: "You are a helpful math tutor. Guide the user through the solution step by step.", + }, + { + Role: openai.ChatMessageRoleUser, + Content: "how can I solve 8x + 7 = -23", + }, + }, + ResponseFormat: &openai.ChatCompletionResponseFormat{ + Type: openai.ChatCompletionResponseFormatTypeJSONSchema, + JSONSchema: &openai.ChatCompletionResponseFormatJSONSchema{ + Name: "math_reasoning", + Schema: schema, + Strict: true, + }, + }, + }) + if err != nil { + log.Fatalf("CreateChatCompletion error: %v", err) + } + err = schema.Unmarshal(resp.Choices[0].Message.Content, &result) + if err != nil { + log.Fatalf("Unmarshal schema error: %v", err) + } + fmt.Println(result) +} +``` +
    See the `examples/` folder for more. ## Frequently Asked Questions diff --git a/vendor/github.com/sashabaranov/go-openai/assistant.go b/vendor/github.com/sashabaranov/go-openai/assistant.go index cc13a302..4c89c1b2 100644 --- a/vendor/github.com/sashabaranov/go-openai/assistant.go +++ b/vendor/github.com/sashabaranov/go-openai/assistant.go @@ -62,14 +62,17 @@ type AssistantToolResource struct { // If Tools is empty slice it will effectively delete all of the Assistant's tools. // If Tools is populated, it will replace all of the existing Assistant's tools with the provided tools. type AssistantRequest struct { - Model string `json:"model"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Instructions *string `json:"instructions,omitempty"` - Tools []AssistantTool `json:"-"` - FileIDs []string `json:"file_ids,omitempty"` - Metadata map[string]any `json:"metadata,omitempty"` - ToolResources *AssistantToolResource `json:"tool_resources,omitempty"` + Model string `json:"model"` + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Instructions *string `json:"instructions,omitempty"` + Tools []AssistantTool `json:"-"` + FileIDs []string `json:"file_ids,omitempty"` + Metadata map[string]any `json:"metadata,omitempty"` + ToolResources *AssistantToolResource `json:"tool_resources,omitempty"` + ResponseFormat any `json:"response_format,omitempty"` + Temperature *float32 `json:"temperature,omitempty"` + TopP *float32 `json:"top_p,omitempty"` } // MarshalJSON provides a custom marshaller for the assistant request to handle the API use cases diff --git a/vendor/github.com/sashabaranov/go-openai/audio.go b/vendor/github.com/sashabaranov/go-openai/audio.go index dbc26d15..f321f93d 100644 --- a/vendor/github.com/sashabaranov/go-openai/audio.go +++ b/vendor/github.com/sashabaranov/go-openai/audio.go @@ -122,8 +122,13 @@ func (c *Client) callAudioAPI( } urlSuffix := fmt.Sprintf("/audio/%s", endpointSuffix) - req, err := c.newRequest(ctx, http.MethodPost, c.fullURL(urlSuffix, request.Model), - withBody(&formBody), withContentType(builder.FormDataContentType())) + req, err := c.newRequest( + ctx, + http.MethodPost, + c.fullURL(urlSuffix, withModel(request.Model)), + withBody(&formBody), + withContentType(builder.FormDataContentType()), + ) if err != nil { return AudioResponse{}, err } diff --git a/vendor/github.com/sashabaranov/go-openai/batch.go b/vendor/github.com/sashabaranov/go-openai/batch.go index 4aba966b..3c1a9d0d 100644 --- a/vendor/github.com/sashabaranov/go-openai/batch.go +++ b/vendor/github.com/sashabaranov/go-openai/batch.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "encoding/json" - "errors" "fmt" "net/http" "net/url" @@ -66,7 +65,7 @@ type Batch struct { Endpoint BatchEndpoint `json:"endpoint"` Errors *struct { Object string `json:"object,omitempty"` - Data struct { + Data []struct { Code string `json:"code,omitempty"` Message string `json:"message,omitempty"` Param *string `json:"param,omitempty"` @@ -109,8 +108,6 @@ type BatchResponse struct { Batch } -var ErrUploadBatchFileFailed = errors.New("upload batch file failed") - // CreateBatch — API call to Create batch. func (c *Client) CreateBatch( ctx context.Context, @@ -202,7 +199,6 @@ func (c *Client) CreateBatchWithUploadFile( Lines: request.Lines, }) if err != nil { - err = errors.Join(ErrUploadBatchFileFailed, err) return } return c.CreateBatch(ctx, CreateBatchRequest{ diff --git a/vendor/github.com/sashabaranov/go-openai/chat.go b/vendor/github.com/sashabaranov/go-openai/chat.go index a1eb1172..dd99c530 100644 --- a/vendor/github.com/sashabaranov/go-openai/chat.go +++ b/vendor/github.com/sashabaranov/go-openai/chat.go @@ -82,6 +82,7 @@ type ChatMessagePart struct { type ChatCompletionMessage struct { Role string `json:"role"` Content string `json:"content"` + Refusal string `json:"refusal,omitempty"` MultiContent []ChatMessagePart // This property isn't in the official documentation, but it's in @@ -107,6 +108,7 @@ func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) { msg := struct { Role string `json:"role"` Content string `json:"-"` + Refusal string `json:"refusal,omitempty"` MultiContent []ChatMessagePart `json:"content,omitempty"` Name string `json:"name,omitempty"` FunctionCall *FunctionCall `json:"function_call,omitempty"` @@ -115,9 +117,11 @@ func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) { }(m) return json.Marshal(msg) } + msg := struct { Role string `json:"role"` Content string `json:"content"` + Refusal string `json:"refusal,omitempty"` MultiContent []ChatMessagePart `json:"-"` Name string `json:"name,omitempty"` FunctionCall *FunctionCall `json:"function_call,omitempty"` @@ -131,12 +135,14 @@ func (m *ChatCompletionMessage) UnmarshalJSON(bs []byte) error { msg := struct { Role string `json:"role"` Content string `json:"content"` + Refusal string `json:"refusal,omitempty"` MultiContent []ChatMessagePart Name string `json:"name,omitempty"` FunctionCall *FunctionCall `json:"function_call,omitempty"` ToolCalls []ToolCall `json:"tool_calls,omitempty"` ToolCallID string `json:"tool_call_id,omitempty"` }{} + if err := json.Unmarshal(bs, &msg); err == nil { *m = ChatCompletionMessage(msg) return nil @@ -144,6 +150,7 @@ func (m *ChatCompletionMessage) UnmarshalJSON(bs []byte) error { multiMsg := struct { Role string `json:"role"` Content string + Refusal string `json:"refusal,omitempty"` MultiContent []ChatMessagePart `json:"content"` Name string `json:"name,omitempty"` FunctionCall *FunctionCall `json:"function_call,omitempty"` @@ -175,27 +182,43 @@ type ChatCompletionResponseFormatType string const ( ChatCompletionResponseFormatTypeJSONObject ChatCompletionResponseFormatType = "json_object" + ChatCompletionResponseFormatTypeJSONSchema ChatCompletionResponseFormatType = "json_schema" ChatCompletionResponseFormatTypeText ChatCompletionResponseFormatType = "text" ) type ChatCompletionResponseFormat struct { - Type ChatCompletionResponseFormatType `json:"type,omitempty"` + Type ChatCompletionResponseFormatType `json:"type,omitempty"` + JSONSchema *ChatCompletionResponseFormatJSONSchema `json:"json_schema,omitempty"` +} + +type ChatCompletionResponseFormatJSONSchema struct { + Name string `json:"name"` + Description string `json:"description,omitempty"` + Schema json.Marshaler `json:"schema"` + Strict bool `json:"strict"` } // ChatCompletionRequest represents a request structure for chat completion API. type ChatCompletionRequest struct { - Model string `json:"model"` - Messages []ChatCompletionMessage `json:"messages"` - MaxTokens int `json:"max_tokens,omitempty"` - Temperature float32 `json:"temperature,omitempty"` - TopP float32 `json:"top_p,omitempty"` - N int `json:"n,omitempty"` - Stream bool `json:"stream,omitempty"` - Stop []string `json:"stop,omitempty"` - PresencePenalty float32 `json:"presence_penalty,omitempty"` - ResponseFormat *ChatCompletionResponseFormat `json:"response_format,omitempty"` - Seed *int `json:"seed,omitempty"` - FrequencyPenalty float32 `json:"frequency_penalty,omitempty"` + Model string `json:"model"` + Messages []ChatCompletionMessage `json:"messages"` + // MaxTokens The maximum number of tokens that can be generated in the chat completion. + // This value can be used to control costs for text generated via API. + // This value is now deprecated in favor of max_completion_tokens, and is not compatible with o1 series models. + // refs: https://platform.openai.com/docs/api-reference/chat/create#chat-create-max_tokens + MaxTokens int `json:"max_tokens,omitempty"` + // MaxCompletionsTokens An upper bound for the number of tokens that can be generated for a completion, + // including visible output tokens and reasoning tokens https://platform.openai.com/docs/guides/reasoning + MaxCompletionsTokens int `json:"max_completion_tokens,omitempty"` + Temperature float32 `json:"temperature,omitempty"` + TopP float32 `json:"top_p,omitempty"` + N int `json:"n,omitempty"` + Stream bool `json:"stream,omitempty"` + Stop []string `json:"stop,omitempty"` + PresencePenalty float32 `json:"presence_penalty,omitempty"` + ResponseFormat *ChatCompletionResponseFormat `json:"response_format,omitempty"` + Seed *int `json:"seed,omitempty"` + FrequencyPenalty float32 `json:"frequency_penalty,omitempty"` // LogitBias is must be a token id string (specified by their token ID in the tokenizer), not a word string. // incorrect: `"logit_bias":{"You": 6}`, correct: `"logit_bias":{"1639": 6}` // refs: https://platform.openai.com/docs/api-reference/chat/create#chat/create-logit_bias @@ -218,6 +241,8 @@ type ChatCompletionRequest struct { ToolChoice any `json:"tool_choice,omitempty"` // Options for streaming response. Only set this when you set stream: true. StreamOptions *StreamOptions `json:"stream_options,omitempty"` + // Disable the default behavior of parallel tool calls by setting it: false. + ParallelToolCalls any `json:"parallel_tool_calls,omitempty"` } type StreamOptions struct { @@ -251,6 +276,7 @@ type ToolFunction struct { type FunctionDefinition struct { Name string `json:"name"` Description string `json:"description,omitempty"` + Strict bool `json:"strict,omitempty"` // Parameters is an object describing the function. // You can pass json.RawMessage to describe the schema, // or you can pass in a struct which serializes to the proper JSON schema. @@ -345,7 +371,16 @@ func (c *Client) CreateChatCompletion( return } - req, err := c.newRequest(ctx, http.MethodPost, c.fullURL(urlSuffix, request.Model), withBody(request)) + if err = validateRequestForO1Models(request); err != nil { + return + } + + req, err := c.newRequest( + ctx, + http.MethodPost, + c.fullURL(urlSuffix, withModel(request.Model)), + withBody(request), + ) if err != nil { return } diff --git a/vendor/github.com/sashabaranov/go-openai/chat_stream.go b/vendor/github.com/sashabaranov/go-openai/chat_stream.go index ffd512ff..f43d0183 100644 --- a/vendor/github.com/sashabaranov/go-openai/chat_stream.go +++ b/vendor/github.com/sashabaranov/go-openai/chat_stream.go @@ -60,7 +60,16 @@ func (c *Client) CreateChatCompletionStream( } request.Stream = true - req, err := c.newRequest(ctx, http.MethodPost, c.fullURL(urlSuffix, request.Model), withBody(request)) + if err = validateRequestForO1Models(request); err != nil { + return + } + + req, err := c.newRequest( + ctx, + http.MethodPost, + c.fullURL(urlSuffix, withModel(request.Model)), + withBody(request), + ) if err != nil { return nil, err } diff --git a/vendor/github.com/sashabaranov/go-openai/client.go b/vendor/github.com/sashabaranov/go-openai/client.go index 7bc28e98..583244fe 100644 --- a/vendor/github.com/sashabaranov/go-openai/client.go +++ b/vendor/github.com/sashabaranov/go-openai/client.go @@ -7,6 +7,7 @@ import ( "fmt" "io" "net/http" + "net/url" "strings" utils "github.com/sashabaranov/go-openai/internal" @@ -221,46 +222,81 @@ func decodeString(body io.Reader, output *string) error { return nil } +type fullURLOptions struct { + model string +} + +type fullURLOption func(*fullURLOptions) + +func withModel(model string) fullURLOption { + return func(args *fullURLOptions) { + args.model = model + } +} + +var azureDeploymentsEndpoints = []string{ + "/completions", + "/embeddings", + "/chat/completions", + "/audio/transcriptions", + "/audio/translations", + "/audio/speech", + "/images/generations", +} + // fullURL returns full URL for request. -// args[0] is model name, if API type is Azure, model name is required to get deployment name. -func (c *Client) fullURL(suffix string, args ...any) string { - // /openai/deployments/{model}/chat/completions?api-version={api_version} +func (c *Client) fullURL(suffix string, setters ...fullURLOption) string { + baseURL := strings.TrimRight(c.config.BaseURL, "/") + args := fullURLOptions{} + for _, setter := range setters { + setter(&args) + } + if c.config.APIType == APITypeAzure || c.config.APIType == APITypeAzureAD { - baseURL := c.config.BaseURL - baseURL = strings.TrimRight(baseURL, "/") - // if suffix is /models change to {endpoint}/openai/models?api-version=2022-12-01 - // https://learn.microsoft.com/en-us/rest/api/cognitiveservices/azureopenaistable/models/list?tabs=HTTP - if containsSubstr([]string{"/models", "/assistants", "/threads", "/files"}, suffix) { - return fmt.Sprintf("%s/%s%s?api-version=%s", baseURL, azureAPIPrefix, suffix, c.config.APIVersion) - } - azureDeploymentName := "UNKNOWN" - if len(args) > 0 { - model, ok := args[0].(string) - if ok { - azureDeploymentName = c.config.GetAzureDeploymentByModel(model) - } - } - return fmt.Sprintf("%s/%s/%s/%s%s?api-version=%s", - baseURL, azureAPIPrefix, azureDeploymentsPrefix, - azureDeploymentName, suffix, c.config.APIVersion, - ) + baseURL = c.baseURLWithAzureDeployment(baseURL, suffix, args.model) } - // https://developers.cloudflare.com/ai-gateway/providers/azureopenai/ - if c.config.APIType == APITypeCloudflareAzure { - baseURL := c.config.BaseURL - baseURL = strings.TrimRight(baseURL, "/") - return fmt.Sprintf("%s%s?api-version=%s", baseURL, suffix, c.config.APIVersion) + if c.config.APIVersion != "" { + suffix = c.suffixWithAPIVersion(suffix) } + return fmt.Sprintf("%s%s", baseURL, suffix) +} - return fmt.Sprintf("%s%s", c.config.BaseURL, suffix) +func (c *Client) suffixWithAPIVersion(suffix string) string { + parsedSuffix, err := url.Parse(suffix) + if err != nil { + panic("failed to parse url suffix") + } + query := parsedSuffix.Query() + query.Add("api-version", c.config.APIVersion) + return fmt.Sprintf("%s?%s", parsedSuffix.Path, query.Encode()) +} + +func (c *Client) baseURLWithAzureDeployment(baseURL, suffix, model string) (newBaseURL string) { + baseURL = fmt.Sprintf("%s/%s", strings.TrimRight(baseURL, "/"), azureAPIPrefix) + if containsSubstr(azureDeploymentsEndpoints, suffix) { + azureDeploymentName := c.config.GetAzureDeploymentByModel(model) + if azureDeploymentName == "" { + azureDeploymentName = "UNKNOWN" + } + baseURL = fmt.Sprintf("%s/%s/%s", baseURL, azureDeploymentsPrefix, azureDeploymentName) + } + return baseURL } func (c *Client) handleErrorResp(resp *http.Response) error { + if !strings.HasPrefix(resp.Header.Get("Content-Type"), "application/json") { + body, err := io.ReadAll(resp.Body) + if err != nil { + return fmt.Errorf("error, reading response body: %w", err) + } + return fmt.Errorf("error, status code: %d, status: %s, body: %s", resp.StatusCode, resp.Status, body) + } var errRes ErrorResponse err := json.NewDecoder(resp.Body).Decode(&errRes) if err != nil || errRes.Error == nil { reqErr := &RequestError{ + HTTPStatus: resp.Status, HTTPStatusCode: resp.StatusCode, Err: err, } @@ -270,6 +306,7 @@ func (c *Client) handleErrorResp(resp *http.Response) error { return reqErr } + errRes.Error.HTTPStatus = resp.Status errRes.Error.HTTPStatusCode = resp.StatusCode return errRes.Error } diff --git a/vendor/github.com/sashabaranov/go-openai/common.go b/vendor/github.com/sashabaranov/go-openai/common.go index cbfda4e3..cde14154 100644 --- a/vendor/github.com/sashabaranov/go-openai/common.go +++ b/vendor/github.com/sashabaranov/go-openai/common.go @@ -4,7 +4,13 @@ package openai // Usage Represents the total token usage per request to OpenAI. type Usage struct { - PromptTokens int `json:"prompt_tokens"` - CompletionTokens int `json:"completion_tokens"` - TotalTokens int `json:"total_tokens"` + PromptTokens int `json:"prompt_tokens"` + CompletionTokens int `json:"completion_tokens"` + TotalTokens int `json:"total_tokens"` + CompletionTokensDetails *CompletionTokensDetails `json:"completion_tokens_details"` +} + +// CompletionTokensDetails Breakdown of tokens used in a completion. +type CompletionTokensDetails struct { + ReasoningTokens int `json:"reasoning_tokens"` } diff --git a/vendor/github.com/sashabaranov/go-openai/completion.go b/vendor/github.com/sashabaranov/go-openai/completion.go index 024f09b1..8e3172ac 100644 --- a/vendor/github.com/sashabaranov/go-openai/completion.go +++ b/vendor/github.com/sashabaranov/go-openai/completion.go @@ -7,16 +7,29 @@ import ( ) var ( + ErrO1MaxTokensDeprecated = errors.New("this model is not supported MaxTokens, please use MaxCompletionsTokens") //nolint:lll ErrCompletionUnsupportedModel = errors.New("this model is not supported with this method, please use CreateChatCompletion client method instead") //nolint:lll ErrCompletionStreamNotSupported = errors.New("streaming is not supported with this method, please use CreateCompletionStream") //nolint:lll ErrCompletionRequestPromptTypeNotSupported = errors.New("the type of CompletionRequest.Prompt only supports string and []string") //nolint:lll ) +var ( + ErrO1BetaLimitationsMessageTypes = errors.New("this model has beta-limitations, user and assistant messages only, system messages are not supported") //nolint:lll + ErrO1BetaLimitationsStreaming = errors.New("this model has beta-limitations, streaming not supported") //nolint:lll + ErrO1BetaLimitationsTools = errors.New("this model has beta-limitations, tools, function calling, and response format parameters are not supported") //nolint:lll + ErrO1BetaLimitationsLogprobs = errors.New("this model has beta-limitations, logprobs not supported") //nolint:lll + ErrO1BetaLimitationsOther = errors.New("this model has beta-limitations, temperature, top_p and n are fixed at 1, while presence_penalty and frequency_penalty are fixed at 0") //nolint:lll +) + // GPT3 Defines the models provided by OpenAI to use when generating // completions from OpenAI. // GPT3 Models are designed for text-based tasks. For code-specific // tasks, please refer to the Codex series of models. const ( + O1Mini = "o1-mini" + O1Mini20240912 = "o1-mini-2024-09-12" + O1Preview = "o1-preview" + O1Preview20240912 = "o1-preview-2024-09-12" GPT432K0613 = "gpt-4-32k-0613" GPT432K0314 = "gpt-4-32k-0314" GPT432K = "gpt-4-32k" @@ -24,6 +37,10 @@ const ( GPT40314 = "gpt-4-0314" GPT4o = "gpt-4o" GPT4o20240513 = "gpt-4o-2024-05-13" + GPT4o20240806 = "gpt-4o-2024-08-06" + GPT4oLatest = "chatgpt-4o-latest" + GPT4oMini = "gpt-4o-mini" + GPT4oMini20240718 = "gpt-4o-mini-2024-07-18" GPT4Turbo = "gpt-4-turbo" GPT4Turbo20240409 = "gpt-4-turbo-2024-04-09" GPT4Turbo0125 = "gpt-4-0125-preview" @@ -77,8 +94,21 @@ const ( CodexCodeDavinci001 = "code-davinci-001" ) +// O1SeriesModels List of new Series of OpenAI models. +// Some old api attributes not supported. +var O1SeriesModels = map[string]struct{}{ + O1Mini: {}, + O1Mini20240912: {}, + O1Preview: {}, + O1Preview20240912: {}, +} + var disabledModelsForEndpoints = map[string]map[string]bool{ "/completions": { + O1Mini: true, + O1Mini20240912: true, + O1Preview: true, + O1Preview20240912: true, GPT3Dot5Turbo: true, GPT3Dot5Turbo0301: true, GPT3Dot5Turbo0613: true, @@ -89,6 +119,10 @@ var disabledModelsForEndpoints = map[string]map[string]bool{ GPT4: true, GPT4o: true, GPT4o20240513: true, + GPT4o20240806: true, + GPT4oLatest: true, + GPT4oMini: true, + GPT4oMini20240718: true, GPT4TurboPreview: true, GPT4VisionPreview: true, GPT4Turbo1106: true, @@ -130,27 +164,92 @@ func checkPromptType(prompt any) bool { return isString || isStringSlice } +var unsupportedToolsForO1Models = map[ToolType]struct{}{ + ToolTypeFunction: {}, +} + +var availableMessageRoleForO1Models = map[string]struct{}{ + ChatMessageRoleUser: {}, + ChatMessageRoleAssistant: {}, +} + +// validateRequestForO1Models checks for deprecated fields of OpenAI models. +func validateRequestForO1Models(request ChatCompletionRequest) error { + if _, found := O1SeriesModels[request.Model]; !found { + return nil + } + + if request.MaxTokens > 0 { + return ErrO1MaxTokensDeprecated + } + + // Beta Limitations + // refs:https://platform.openai.com/docs/guides/reasoning/beta-limitations + // Streaming: not supported + if request.Stream { + return ErrO1BetaLimitationsStreaming + } + // Logprobs: not supported. + if request.LogProbs { + return ErrO1BetaLimitationsLogprobs + } + + // Message types: user and assistant messages only, system messages are not supported. + for _, m := range request.Messages { + if _, found := availableMessageRoleForO1Models[m.Role]; !found { + return ErrO1BetaLimitationsMessageTypes + } + } + + // Tools: tools, function calling, and response format parameters are not supported + for _, t := range request.Tools { + if _, found := unsupportedToolsForO1Models[t.Type]; found { + return ErrO1BetaLimitationsTools + } + } + + // Other: temperature, top_p and n are fixed at 1, while presence_penalty and frequency_penalty are fixed at 0. + if request.Temperature > 0 && request.Temperature != 1 { + return ErrO1BetaLimitationsOther + } + if request.TopP > 0 && request.TopP != 1 { + return ErrO1BetaLimitationsOther + } + if request.N > 0 && request.N != 1 { + return ErrO1BetaLimitationsOther + } + if request.PresencePenalty > 0 { + return ErrO1BetaLimitationsOther + } + if request.FrequencyPenalty > 0 { + return ErrO1BetaLimitationsOther + } + + return nil +} + // CompletionRequest represents a request structure for completion API. type CompletionRequest struct { - Model string `json:"model"` - Prompt any `json:"prompt,omitempty"` - Suffix string `json:"suffix,omitempty"` - MaxTokens int `json:"max_tokens,omitempty"` - Temperature float32 `json:"temperature,omitempty"` - TopP float32 `json:"top_p,omitempty"` - N int `json:"n,omitempty"` - Stream bool `json:"stream,omitempty"` - LogProbs int `json:"logprobs,omitempty"` - Echo bool `json:"echo,omitempty"` - Stop []string `json:"stop,omitempty"` - PresencePenalty float32 `json:"presence_penalty,omitempty"` - FrequencyPenalty float32 `json:"frequency_penalty,omitempty"` - BestOf int `json:"best_of,omitempty"` + Model string `json:"model"` + Prompt any `json:"prompt,omitempty"` + BestOf int `json:"best_of,omitempty"` + Echo bool `json:"echo,omitempty"` + FrequencyPenalty float32 `json:"frequency_penalty,omitempty"` // LogitBias is must be a token id string (specified by their token ID in the tokenizer), not a word string. // incorrect: `"logit_bias":{"You": 6}`, correct: `"logit_bias":{"1639": 6}` // refs: https://platform.openai.com/docs/api-reference/completions/create#completions/create-logit_bias - LogitBias map[string]int `json:"logit_bias,omitempty"` - User string `json:"user,omitempty"` + LogitBias map[string]int `json:"logit_bias,omitempty"` + LogProbs int `json:"logprobs,omitempty"` + MaxTokens int `json:"max_tokens,omitempty"` + N int `json:"n,omitempty"` + PresencePenalty float32 `json:"presence_penalty,omitempty"` + Seed *int `json:"seed,omitempty"` + Stop []string `json:"stop,omitempty"` + Stream bool `json:"stream,omitempty"` + Suffix string `json:"suffix,omitempty"` + Temperature float32 `json:"temperature,omitempty"` + TopP float32 `json:"top_p,omitempty"` + User string `json:"user,omitempty"` } // CompletionChoice represents one of possible completions. @@ -206,7 +305,12 @@ func (c *Client) CreateCompletion( return } - req, err := c.newRequest(ctx, http.MethodPost, c.fullURL(urlSuffix, request.Model), withBody(request)) + req, err := c.newRequest( + ctx, + http.MethodPost, + c.fullURL(urlSuffix, withModel(request.Model)), + withBody(request), + ) if err != nil { return } diff --git a/vendor/github.com/sashabaranov/go-openai/config.go b/vendor/github.com/sashabaranov/go-openai/config.go index 1347567d..8a918355 100644 --- a/vendor/github.com/sashabaranov/go-openai/config.go +++ b/vendor/github.com/sashabaranov/go-openai/config.go @@ -26,6 +26,10 @@ const AzureAPIKeyHeader = "api-key" const defaultAssistantVersion = "v2" // upgrade to v2 to support vector store +type HTTPDoer interface { + Do(req *http.Request) (*http.Response, error) +} + // ClientConfig is a configuration of a client. type ClientConfig struct { authToken string @@ -36,7 +40,7 @@ type ClientConfig struct { APIVersion string // required when APIType is APITypeAzure or APITypeAzureAD AssistantVersion string AzureModelMapperFunc func(model string) string // replace model to azure deployment name func - HTTPClient *http.Client + HTTPClient HTTPDoer EmptyMessagesLimit uint } diff --git a/vendor/github.com/sashabaranov/go-openai/edits.go b/vendor/github.com/sashabaranov/go-openai/edits.go index 97d02602..fe8ecd0c 100644 --- a/vendor/github.com/sashabaranov/go-openai/edits.go +++ b/vendor/github.com/sashabaranov/go-openai/edits.go @@ -38,7 +38,12 @@ will need to migrate to GPT-3.5 Turbo by January 4, 2024. You can use CreateChatCompletion or CreateChatCompletionStream instead. */ func (c *Client) Edits(ctx context.Context, request EditsRequest) (response EditsResponse, err error) { - req, err := c.newRequest(ctx, http.MethodPost, c.fullURL("/edits", fmt.Sprint(request.Model)), withBody(request)) + req, err := c.newRequest( + ctx, + http.MethodPost, + c.fullURL("/edits", withModel(fmt.Sprint(request.Model))), + withBody(request), + ) if err != nil { return } diff --git a/vendor/github.com/sashabaranov/go-openai/embeddings.go b/vendor/github.com/sashabaranov/go-openai/embeddings.go index b513ba6a..74eb8aa5 100644 --- a/vendor/github.com/sashabaranov/go-openai/embeddings.go +++ b/vendor/github.com/sashabaranov/go-openai/embeddings.go @@ -241,7 +241,12 @@ func (c *Client) CreateEmbeddings( conv EmbeddingRequestConverter, ) (res EmbeddingResponse, err error) { baseReq := conv.Convert() - req, err := c.newRequest(ctx, http.MethodPost, c.fullURL("/embeddings", string(baseReq.Model)), withBody(baseReq)) + req, err := c.newRequest( + ctx, + http.MethodPost, + c.fullURL("/embeddings", withModel(string(baseReq.Model))), + withBody(baseReq), + ) if err != nil { return } diff --git a/vendor/github.com/sashabaranov/go-openai/error.go b/vendor/github.com/sashabaranov/go-openai/error.go index 37959a27..1f6a8971 100644 --- a/vendor/github.com/sashabaranov/go-openai/error.go +++ b/vendor/github.com/sashabaranov/go-openai/error.go @@ -13,6 +13,7 @@ type APIError struct { Message string `json:"message"` Param *string `json:"param,omitempty"` Type string `json:"type"` + HTTPStatus string `json:"-"` HTTPStatusCode int `json:"-"` InnerError *InnerError `json:"innererror,omitempty"` } @@ -25,6 +26,7 @@ type InnerError struct { // RequestError provides information about generic request errors. type RequestError struct { + HTTPStatus string HTTPStatusCode int Err error } @@ -35,7 +37,7 @@ type ErrorResponse struct { func (e *APIError) Error() string { if e.HTTPStatusCode > 0 { - return fmt.Sprintf("error, status code: %d, message: %s", e.HTTPStatusCode, e.Message) + return fmt.Sprintf("error, status code: %d, status: %s, message: %s", e.HTTPStatusCode, e.HTTPStatus, e.Message) } return e.Message @@ -101,7 +103,7 @@ func (e *APIError) UnmarshalJSON(data []byte) (err error) { } func (e *RequestError) Error() string { - return fmt.Sprintf("error, status code: %d, message: %s", e.HTTPStatusCode, e.Err) + return fmt.Sprintf("error, status code: %d, status: %s, message: %s", e.HTTPStatusCode, e.HTTPStatus, e.Err) } func (e *RequestError) Unwrap() error { diff --git a/vendor/github.com/sashabaranov/go-openai/files.go b/vendor/github.com/sashabaranov/go-openai/files.go index 26ad6bd7..edc9f2a2 100644 --- a/vendor/github.com/sashabaranov/go-openai/files.go +++ b/vendor/github.com/sashabaranov/go-openai/files.go @@ -102,6 +102,7 @@ func (c *Client) CreateFile(ctx context.Context, request FileRequest) (file File if err != nil { return } + defer fileData.Close() err = builder.CreateFormFile("file", fileData) if err != nil { diff --git a/vendor/github.com/sashabaranov/go-openai/fine_tunes.go b/vendor/github.com/sashabaranov/go-openai/fine_tunes.go index ca840781..74b47bf3 100644 --- a/vendor/github.com/sashabaranov/go-openai/fine_tunes.go +++ b/vendor/github.com/sashabaranov/go-openai/fine_tunes.go @@ -115,7 +115,7 @@ func (c *Client) CreateFineTune(ctx context.Context, request FineTuneRequest) (r // This API will be officially deprecated on January 4th, 2024. // OpenAI recommends to migrate to the new fine tuning API implemented in fine_tuning_job.go. func (c *Client) CancelFineTune(ctx context.Context, fineTuneID string) (response FineTune, err error) { - req, err := c.newRequest(ctx, http.MethodPost, c.fullURL("/fine-tunes/"+fineTuneID+"/cancel")) + req, err := c.newRequest(ctx, http.MethodPost, c.fullURL("/fine-tunes/"+fineTuneID+"/cancel")) //nolint:lll //this method is deprecated if err != nil { return } diff --git a/vendor/github.com/sashabaranov/go-openai/fine_tuning_job.go b/vendor/github.com/sashabaranov/go-openai/fine_tuning_job.go index 9dcb49de..5a9f54a9 100644 --- a/vendor/github.com/sashabaranov/go-openai/fine_tuning_job.go +++ b/vendor/github.com/sashabaranov/go-openai/fine_tuning_job.go @@ -26,7 +26,9 @@ type FineTuningJob struct { } type Hyperparameters struct { - Epochs any `json:"n_epochs,omitempty"` + Epochs any `json:"n_epochs,omitempty"` + LearningRateMultiplier any `json:"learning_rate_multiplier,omitempty"` + BatchSize any `json:"batch_size,omitempty"` } type FineTuningJobRequest struct { diff --git a/vendor/github.com/sashabaranov/go-openai/image.go b/vendor/github.com/sashabaranov/go-openai/image.go index 665de1a7..577d7db9 100644 --- a/vendor/github.com/sashabaranov/go-openai/image.go +++ b/vendor/github.com/sashabaranov/go-openai/image.go @@ -68,7 +68,12 @@ type ImageResponseDataInner struct { // CreateImage - API call to create an image. This is the main endpoint of the DALL-E API. func (c *Client) CreateImage(ctx context.Context, request ImageRequest) (response ImageResponse, err error) { urlSuffix := "/images/generations" - req, err := c.newRequest(ctx, http.MethodPost, c.fullURL(urlSuffix, request.Model), withBody(request)) + req, err := c.newRequest( + ctx, + http.MethodPost, + c.fullURL(urlSuffix, withModel(request.Model)), + withBody(request), + ) if err != nil { return } @@ -132,8 +137,13 @@ func (c *Client) CreateEditImage(ctx context.Context, request ImageEditRequest) return } - req, err := c.newRequest(ctx, http.MethodPost, c.fullURL("/images/edits", request.Model), - withBody(body), withContentType(builder.FormDataContentType())) + req, err := c.newRequest( + ctx, + http.MethodPost, + c.fullURL("/images/edits", withModel(request.Model)), + withBody(body), + withContentType(builder.FormDataContentType()), + ) if err != nil { return } @@ -183,8 +193,13 @@ func (c *Client) CreateVariImage(ctx context.Context, request ImageVariRequest) return } - req, err := c.newRequest(ctx, http.MethodPost, c.fullURL("/images/variations", request.Model), - withBody(body), withContentType(builder.FormDataContentType())) + req, err := c.newRequest( + ctx, + http.MethodPost, + c.fullURL("/images/variations", withModel(request.Model)), + withBody(body), + withContentType(builder.FormDataContentType()), + ) if err != nil { return } diff --git a/vendor/github.com/sashabaranov/go-openai/messages.go b/vendor/github.com/sashabaranov/go-openai/messages.go index 6af11844..eefc29a3 100644 --- a/vendor/github.com/sashabaranov/go-openai/messages.go +++ b/vendor/github.com/sashabaranov/go-openai/messages.go @@ -73,6 +73,14 @@ type MessageFilesList struct { httpHeader } +type MessageDeletionStatus struct { + ID string `json:"id"` + Object string `json:"object"` + Deleted bool `json:"deleted"` + + httpHeader +} + // CreateMessage creates a new message. func (c *Client) CreateMessage(ctx context.Context, threadID string, request MessageRequest) (msg Message, err error) { urlSuffix := fmt.Sprintf("/threads/%s/%s", threadID, messagesSuffix) @@ -92,6 +100,7 @@ func (c *Client) ListMessage(ctx context.Context, threadID string, order *string, after *string, before *string, + runID *string, ) (messages MessagesList, err error) { urlValues := url.Values{} if limit != nil { @@ -106,6 +115,10 @@ func (c *Client) ListMessage(ctx context.Context, threadID string, if before != nil { urlValues.Add("before", *before) } + if runID != nil { + urlValues.Add("run_id", *runID) + } + encodedValues := "" if len(urlValues) > 0 { encodedValues = "?" + urlValues.Encode() @@ -186,3 +199,19 @@ func (c *Client) ListMessageFiles( err = c.sendRequest(req, &files) return } + +// DeleteMessage deletes a message.. +func (c *Client) DeleteMessage( + ctx context.Context, + threadID, messageID string, +) (status MessageDeletionStatus, err error) { + urlSuffix := fmt.Sprintf("/threads/%s/%s/%s", threadID, messagesSuffix, messageID) + req, err := c.newRequest(ctx, http.MethodDelete, c.fullURL(urlSuffix), + withBetaAssistantVersion(c.config.AssistantVersion)) + if err != nil { + return + } + + err = c.sendRequest(req, &status) + return +} diff --git a/vendor/github.com/sashabaranov/go-openai/moderation.go b/vendor/github.com/sashabaranov/go-openai/moderation.go index ae285ef8..c8652efc 100644 --- a/vendor/github.com/sashabaranov/go-openai/moderation.go +++ b/vendor/github.com/sashabaranov/go-openai/moderation.go @@ -88,7 +88,12 @@ func (c *Client) Moderations(ctx context.Context, request ModerationRequest) (re err = ErrModerationInvalidModel return } - req, err := c.newRequest(ctx, http.MethodPost, c.fullURL("/moderations", request.Model), withBody(&request)) + req, err := c.newRequest( + ctx, + http.MethodPost, + c.fullURL("/moderations", withModel(request.Model)), + withBody(&request), + ) if err != nil { return } diff --git a/vendor/github.com/sashabaranov/go-openai/run.go b/vendor/github.com/sashabaranov/go-openai/run.go index 5598f1df..d3e755f0 100644 --- a/vendor/github.com/sashabaranov/go-openai/run.go +++ b/vendor/github.com/sashabaranov/go-openai/run.go @@ -110,6 +110,8 @@ type RunRequest struct { ToolChoice any `json:"tool_choice,omitempty"` // This can be either a string or a ResponseFormat object. ResponseFormat any `json:"response_format,omitempty"` + // Disable the default behavior of parallel tool calls by setting it: false. + ParallelToolCalls any `json:"parallel_tool_calls,omitempty"` } // ThreadTruncationStrategy defines the truncation strategy to use for the thread. diff --git a/vendor/github.com/sashabaranov/go-openai/speech.go b/vendor/github.com/sashabaranov/go-openai/speech.go index 7e22e755..20b52e33 100644 --- a/vendor/github.com/sashabaranov/go-openai/speech.go +++ b/vendor/github.com/sashabaranov/go-openai/speech.go @@ -2,7 +2,6 @@ package openai import ( "context" - "errors" "net/http" ) @@ -36,11 +35,6 @@ const ( SpeechResponseFormatPcm SpeechResponseFormat = "pcm" ) -var ( - ErrInvalidSpeechModel = errors.New("invalid speech model") - ErrInvalidVoice = errors.New("invalid voice") -) - type CreateSpeechRequest struct { Model SpeechModel `json:"model"` Input string `json:"input"` @@ -49,33 +43,11 @@ type CreateSpeechRequest struct { Speed float64 `json:"speed,omitempty"` // Optional, default to 1.0 } -func contains[T comparable](s []T, e T) bool { - for _, v := range s { - if v == e { - return true - } - } - return false -} - -func isValidSpeechModel(model SpeechModel) bool { - return contains([]SpeechModel{TTSModel1, TTSModel1HD, TTSModelCanary}, model) -} - -func isValidVoice(voice SpeechVoice) bool { - return contains([]SpeechVoice{VoiceAlloy, VoiceEcho, VoiceFable, VoiceOnyx, VoiceNova, VoiceShimmer}, voice) -} - func (c *Client) CreateSpeech(ctx context.Context, request CreateSpeechRequest) (response RawResponse, err error) { - if !isValidSpeechModel(request.Model) { - err = ErrInvalidSpeechModel - return - } - if !isValidVoice(request.Voice) { - err = ErrInvalidVoice - return - } - req, err := c.newRequest(ctx, http.MethodPost, c.fullURL("/audio/speech", string(request.Model)), + req, err := c.newRequest( + ctx, + http.MethodPost, + c.fullURL("/audio/speech", withModel(string(request.Model))), withBody(request), withContentType("application/json"), ) diff --git a/vendor/github.com/sashabaranov/go-openai/stream.go b/vendor/github.com/sashabaranov/go-openai/stream.go index b277f3c2..a61c7c97 100644 --- a/vendor/github.com/sashabaranov/go-openai/stream.go +++ b/vendor/github.com/sashabaranov/go-openai/stream.go @@ -3,6 +3,7 @@ package openai import ( "context" "errors" + "net/http" ) var ( @@ -33,7 +34,12 @@ func (c *Client) CreateCompletionStream( } request.Stream = true - req, err := c.newRequest(ctx, "POST", c.fullURL(urlSuffix, request.Model), withBody(request)) + req, err := c.newRequest( + ctx, + http.MethodPost, + c.fullURL(urlSuffix, withModel(request.Model)), + withBody(request), + ) if err != nil { return nil, err } diff --git a/vendor/github.com/sashabaranov/go-openai/thread.go b/vendor/github.com/sashabaranov/go-openai/thread.go index 6f752145..bc08e2bc 100644 --- a/vendor/github.com/sashabaranov/go-openai/thread.go +++ b/vendor/github.com/sashabaranov/go-openai/thread.go @@ -83,14 +83,25 @@ type ModifyThreadRequest struct { type ThreadMessageRole string const ( - ThreadMessageRoleUser ThreadMessageRole = "user" + ThreadMessageRoleAssistant ThreadMessageRole = "assistant" + ThreadMessageRoleUser ThreadMessageRole = "user" ) type ThreadMessage struct { - Role ThreadMessageRole `json:"role"` - Content string `json:"content"` - FileIDs []string `json:"file_ids,omitempty"` - Metadata map[string]any `json:"metadata,omitempty"` + Role ThreadMessageRole `json:"role"` + Content string `json:"content"` + FileIDs []string `json:"file_ids,omitempty"` + Attachments []ThreadAttachment `json:"attachments,omitempty"` + Metadata map[string]any `json:"metadata,omitempty"` +} + +type ThreadAttachment struct { + FileID string `json:"file_id"` + Tools []ThreadAttachmentTool `json:"tools"` +} + +type ThreadAttachmentTool struct { + Type string `json:"type"` } type ThreadDeleteResponse struct { diff --git a/vendor/github.com/valyala/fasthttp/README.md b/vendor/github.com/valyala/fasthttp/README.md index cbdb9de2..f43ea6dc 100644 --- a/vendor/github.com/valyala/fasthttp/README.md +++ b/vendor/github.com/valyala/fasthttp/README.md @@ -600,7 +600,7 @@ This is an **unsafe** way, the result string and `[]byte` buffer share the same * *Which GO versions are supported by fasthttp?* - Go 1.18.x. Older versions won't be supported. + Go 1.21.x and newer. Older versions might work, but won't officially be supported. * *Please provide real benchmark data and server information* diff --git a/vendor/github.com/valyala/fasthttp/brotli.go b/vendor/github.com/valyala/fasthttp/brotli.go index 30b7d66d..1e8e0f08 100644 --- a/vendor/github.com/valyala/fasthttp/brotli.go +++ b/vendor/github.com/valyala/fasthttp/brotli.go @@ -97,7 +97,7 @@ var ( // - CompressBrotliBestCompression // - CompressBrotliDefaultCompression func AppendBrotliBytesLevel(dst, src []byte, level int) []byte { - w := &byteSliceWriter{dst} + w := &byteSliceWriter{b: dst} WriteBrotliLevel(w, src, level) //nolint:errcheck return w.b } @@ -167,7 +167,7 @@ func AppendBrotliBytes(dst, src []byte) []byte { // WriteUnbrotli writes unbrotlied p to w and returns the number of uncompressed // bytes written to w. func WriteUnbrotli(w io.Writer, p []byte) (int, error) { - r := &byteSliceReader{p} + r := &byteSliceReader{b: p} zr, err := acquireBrotliReader(r) if err != nil { return 0, err @@ -183,7 +183,7 @@ func WriteUnbrotli(w io.Writer, p []byte) (int, error) { // AppendUnbrotliBytes appends unbrotlied src to dst and returns the resulting dst. func AppendUnbrotliBytes(dst, src []byte) ([]byte, error) { - w := &byteSliceWriter{dst} + w := &byteSliceWriter{b: dst} _, err := WriteUnbrotli(w, src) return w.b, err } diff --git a/vendor/github.com/valyala/fasthttp/bytesconv.go b/vendor/github.com/valyala/fasthttp/bytesconv.go index dddf24fd..053da6a7 100644 --- a/vendor/github.com/valyala/fasthttp/bytesconv.go +++ b/vendor/github.com/valyala/fasthttp/bytesconv.go @@ -8,8 +8,8 @@ import ( "errors" "fmt" "io" - "math" "net" + "strconv" "sync" "time" ) @@ -127,21 +127,7 @@ func AppendUint(dst []byte, n int) []byte { panic("BUG: int must be positive") } - var b [20]byte - buf := b[:] - i := len(buf) - var q int - for n >= 10 { - i-- - q = n / 10 - buf[i] = '0' + byte(n-q*10) - n = q - } - i-- - buf[i] = '0' + byte(n) - - dst = append(dst, buf[i:]...) - return dst + return strconv.AppendUint(dst, uint64(n), 10) } // ParseUint parses uint from buf. @@ -185,61 +171,19 @@ func parseUintBuf(b []byte) (int, int, error) { return v, n, nil } -var ( - errEmptyFloat = errors.New("empty float number") - errDuplicateFloatPoint = errors.New("duplicate point found in float number") - errUnexpectedFloatEnd = errors.New("unexpected end of float number") - errInvalidFloatExponent = errors.New("invalid float number exponent") - errUnexpectedFloatChar = errors.New("unexpected char found in float number") -) - // ParseUfloat parses unsigned float from buf. func ParseUfloat(buf []byte) (float64, error) { - if len(buf) == 0 { - return -1, errEmptyFloat + // The implementation of parsing a float string is not easy. + // We believe that the conservative approach is to call strconv.ParseFloat. + // https://github.com/valyala/fasthttp/pull/1865 + res, err := strconv.ParseFloat(b2s(buf), 64) + if res < 0 { + return -1, errors.New("negative input is invalid") } - b := buf - var v uint64 - offset := 1.0 - var pointFound bool - for i, c := range b { - if c < '0' || c > '9' { - if c == '.' { - if pointFound { - return -1, errDuplicateFloatPoint - } - pointFound = true - continue - } - if c == 'e' || c == 'E' { - if i+1 >= len(b) { - return -1, errUnexpectedFloatEnd - } - b = b[i+1:] - minus := -1 - switch b[0] { - case '+': - b = b[1:] - minus = 1 - case '-': - b = b[1:] - default: - minus = 1 - } - vv, err := ParseUint(b) - if err != nil { - return -1, errInvalidFloatExponent - } - return float64(v) * offset * math.Pow10(minus*vv), nil - } - return -1, errUnexpectedFloatChar - } - v = 10*v + uint64(c-'0') - if pointFound { - offset /= 10 - } + if err != nil { + return -1, err } - return float64(v) * offset, nil + return res, err } var ( diff --git a/vendor/github.com/valyala/fasthttp/bytesconv_table.go b/vendor/github.com/valyala/fasthttp/bytesconv_table.go index 5b230f1a..591470fc 100644 --- a/vendor/github.com/valyala/fasthttp/bytesconv_table.go +++ b/vendor/github.com/valyala/fasthttp/bytesconv_table.go @@ -9,3 +9,5 @@ const toUpperTable = "\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0e\x0f\x10\x11 const quotedArgShouldEscapeTable = "\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x01\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x01\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01" const quotedPathShouldEscapeTable = "\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x01\x00\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x01\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x01\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01" const validHeaderFieldByteTable = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x01\x01\x01\x01\x01\x00\x00\x01\x01\x00\x01\x01\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x01\x00\x01\x00" +const validHeaderValueByteTable = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01" +const validMethodValueByteTable = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x01\x01\x01\x01\x01\x00\x00\x01\x01\x00\x01\x01\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" diff --git a/vendor/github.com/valyala/fasthttp/client.go b/vendor/github.com/valyala/fasthttp/client.go index 5cae78dd..84a7f93e 100644 --- a/vendor/github.com/valyala/fasthttp/client.go +++ b/vendor/github.com/valyala/fasthttp/client.go @@ -175,14 +175,8 @@ var defaultClient Client type Client struct { noCopy noCopy - // Client name. Used in User-Agent request header. - // - // Default client name is used if not set. - Name string - - // NoDefaultUserAgentHeader when set to true, causes the default - // User-Agent header to be excluded from the Request. - NoDefaultUserAgentHeader bool + readerPool sync.Pool + writerPool sync.Pool // Callback for establishing new connections to hosts. // @@ -197,20 +191,36 @@ type Client struct { // If not set, DialTimeout is used. Dial DialFunc - // Attempt to connect to both ipv4 and ipv6 addresses if set to true. - // - // This option is used only if default TCP dialer is used, - // i.e. if Dial is blank. - // - // By default client connects only to ipv4 addresses, - // since unfortunately ipv6 remains broken in many networks worldwide :) - DialDualStack bool - // TLS config for https connections. // // Default TLS config is used if not set. TLSConfig *tls.Config + // RetryIf controls whether a retry should be attempted after an error. + // + // By default will use isIdempotent function. + // + // Deprecated: Use RetryIfErr instead. + // This field is only effective when the `RetryIfErr` field is not set. + RetryIf RetryIfFunc + + // When the client encounters an error during a request, the behavior—whether to retry + // and whether to reset the request timeout—should be determined + // based on the return value of this field. + // This field is only effective within the range of MaxIdemponentCallAttempts. + RetryIfErr RetryIfErrFunc + + // ConfigureClient configures the fasthttp.HostClient. + ConfigureClient func(hc *HostClient) error + + m map[string]*HostClient + ms map[string]*HostClient + + // Client name. Used in User-Agent request header. + // + // Default client name is used if not set. + Name string + // Maximum number of connections per each host which may be established. // // DefaultMaxConnsPerHost is used if not set. @@ -261,6 +271,30 @@ type Client struct { // By default response body size is unlimited. MaxResponseBodySize int + // Maximum duration for waiting for a free connection. + // + // By default will not waiting, return ErrNoFreeConns immediately. + MaxConnWaitTimeout time.Duration + + // Connection pool strategy. Can be either LIFO or FIFO (default). + ConnPoolStrategy ConnPoolStrategyType + + mLock sync.RWMutex + mOnce sync.Once + + // NoDefaultUserAgentHeader when set to true, causes the default + // User-Agent header to be excluded from the Request. + NoDefaultUserAgentHeader bool + + // Attempt to connect to both ipv4 and ipv6 addresses if set to true. + // + // This option is used only if default TCP dialer is used, + // i.e. if Dial is blank. + // + // By default client connects only to ipv4 addresses, + // since unfortunately ipv6 remains broken in many networks worldwide :) + DialDualStack bool + // Header names are passed as-is without normalization // if this option is set. // @@ -288,31 +322,8 @@ type Client struct { // extra slashes are removed, special characters are encoded. DisablePathNormalizing bool - // Maximum duration for waiting for a free connection. - // - // By default will not waiting, return ErrNoFreeConns immediately. - MaxConnWaitTimeout time.Duration - - // RetryIf controls whether a retry should be attempted after an error. - // - // By default will use isIdempotent function. - RetryIf RetryIfFunc - - // Connection pool strategy. Can be either LIFO or FIFO (default). - ConnPoolStrategy ConnPoolStrategyType - // StreamResponseBody enables response body streaming. StreamResponseBody bool - - // ConfigureClient configures the fasthttp.HostClient. - ConfigureClient func(hc *HostClient) error - - mLock sync.RWMutex - mOnce sync.Once - m map[string]*HostClient - ms map[string]*HostClient - readerPool sync.Pool - writerPool sync.Pool } // Get returns the status code and body of url. @@ -535,6 +546,7 @@ func (c *Client) Do(req *Request, resp *Response) error { DisablePathNormalizing: c.DisablePathNormalizing, MaxConnWaitTimeout: c.MaxConnWaitTimeout, RetryIf: c.RetryIf, + RetryIfErr: c.RetryIfErr, ConnPoolStrategy: c.ConnPoolStrategy, StreamResponseBody: c.StreamResponseBody, clientReaderPool: &c.readerPool, @@ -595,7 +607,6 @@ func (c *Client) mCleaner(m map[string]*HostClient) { c.mLock.Lock() for k, v := range m { v.connsLock.Lock() - /* #nosec G601 */ if v.connsCount == 0 && atomic.LoadInt32(&v.pendingClientRequests) == 0 { delete(m, k) } @@ -653,11 +664,28 @@ type DialFunc func(addr string) (net.Conn, error) // - foobar.com:8080 type DialFuncWithTimeout func(addr string, timeout time.Duration) (net.Conn, error) -// RetryIfFunc signature of retry if function. -// +// RetryIfFunc defines the signature of the retry if function. // Request argument passed to RetryIfFunc, if there are any request errors. type RetryIfFunc func(request *Request) bool +// RetryIfErrFunc defines an interface used for implementing the following functionality: +// When the client encounters an error during a request, the behavior—whether to retry +// and whether to reset the request timeout—should be determined +// based on the return value of this interface. +// +// attempt indicates which attempt the current retry is due to a failure of. +// The first request counts as the first attempt. +// +// err represents the error encountered while attempting the `attempts`-th request. +// +// resetTimeout indicates whether to reuse the `Request`'s timeout as the timeout interval, +// rather than using the timeout after subtracting the time spent on previous failed requests. +// This return value is meaningful only when you use `Request.SetTimeout`, `DoTimeout`, or `DoDeadline`. +// +// retry indicates whether to retry the current request. If it is false, +// the request function will immediately return with the `err`. +type RetryIfErrFunc func(request *Request, attempts int, err error) (resetTimeout bool, retry bool) + // RoundTripper wraps every request/response. type RoundTripper interface { RoundTrip(hc *HostClient, req *Request, resp *Response) (retry bool, err error) @@ -684,23 +712,11 @@ const ( type HostClient struct { noCopy noCopy - // Comma-separated list of upstream HTTP server host addresses, - // which are passed to Dial or DialTimeout in a round-robin manner. - // - // Each address may contain port if default dialer is used. - // For example, - // - // - foobar.com:80 - // - foobar.com:443 - // - foobar.com:8080 - Addr string + readerPool sync.Pool + writerPool sync.Pool - // Client name. Used in User-Agent request header. - Name string - - // NoDefaultUserAgentHeader when set to true, causes the default - // User-Agent header to be excluded from the Request. - NoDefaultUserAgentHeader bool + // Transport defines a transport-like mechanism that wraps every request/response. + Transport RoundTripper // Callback for establishing new connections to hosts. // @@ -715,22 +731,46 @@ type HostClient struct { // If not set, DialTimeout is used. Dial DialFunc - // Attempt to connect to both ipv4 and ipv6 host addresses - // if set to true. - // - // This option is used only if default TCP dialer is used, - // i.e. if Dial and DialTimeout are blank. - // - // By default client connects only to ipv4 addresses, - // since unfortunately ipv6 remains broken in many networks worldwide :) - DialDualStack bool - - // Whether to use TLS (aka SSL or HTTPS) for host connections. - IsTLS bool - // Optional TLS config. TLSConfig *tls.Config + // RetryIf controls whether a retry should be attempted after an error. + // By default, it uses the isIdempotent function. + // + // Deprecated: Use RetryIfErr instead. + // This field is only effective when the `RetryIfErr` field is not set. + RetryIf RetryIfFunc + + // When the client encounters an error during a request, the behavior—whether to retry + // and whether to reset the request timeout—should be determined + // based on the return value of this field. + // This field is only effective within the range of MaxIdemponentCallAttempts. + RetryIfErr RetryIfErrFunc + + connsWait *wantConnQueue + + tlsConfigMap map[string]*tls.Config + + clientReaderPool *sync.Pool + clientWriterPool *sync.Pool + + // Comma-separated list of upstream HTTP server host addresses, + // which are passed to Dial or DialTimeout in a round-robin manner. + // + // Each address may contain port if default dialer is used. + // For example, + // + // - foobar.com:80 + // - foobar.com:443 + // - foobar.com:8080 + Addr string + + // Client name. Used in User-Agent request header. + Name string + + conns []*clientConn + addrs []string + // Maximum number of connections which may be established to all hosts // listed in Addr. // @@ -753,7 +793,10 @@ type HostClient struct { // Maximum number of attempts for idempotent calls. // - // DefaultMaxIdemponentCallAttempts is used if not set. + // A value of 0 or a negative value represents using DefaultMaxIdemponentCallAttempts. + // For example, a value of 1 means the request will be executed only once, + // while 2 means the request will be executed at most twice. + // The RetryIfErr and RetryIf fields can invalidate remaining attempts. MaxIdemponentCallAttempts int // Per-connection buffer size for responses' reading. @@ -785,6 +828,47 @@ type HostClient struct { // By default response body size is unlimited. MaxResponseBodySize int + // Maximum duration for waiting for a free connection. + // + // By default will not waiting, return ErrNoFreeConns immediately + MaxConnWaitTimeout time.Duration + + // Connection pool strategy. Can be either LIFO or FIFO (default). + ConnPoolStrategy ConnPoolStrategyType + + connsCount int + + connsLock sync.Mutex + + addrsLock sync.Mutex + tlsConfigMapLock sync.Mutex + + addrIdx uint32 + lastUseTime uint32 + + pendingRequests int32 + + // pendingClientRequests counts the number of requests that a Client is currently running using this HostClient. + // It will be incremented earlier than pendingRequests and will be used by Client to see if the HostClient is still in use. + pendingClientRequests int32 + + // NoDefaultUserAgentHeader when set to true, causes the default + // User-Agent header to be excluded from the Request. + NoDefaultUserAgentHeader bool + + // Attempt to connect to both ipv4 and ipv6 host addresses + // if set to true. + // + // This option is used only if default TCP dialer is used, + // i.e. if Dial and DialTimeout are blank. + // + // By default client connects only to ipv4 addresses, + // since unfortunately ipv6 remains broken in many networks worldwide :) + DialDualStack bool + + // Whether to use TLS (aka SSL or HTTPS) for host connections. + IsTLS bool + // Header names are passed as-is without normalization // if this option is set. // @@ -820,51 +904,9 @@ type HostClient struct { // Client logs full errors by default. SecureErrorLogMessage bool - // Maximum duration for waiting for a free connection. - // - // By default will not waiting, return ErrNoFreeConns immediately - MaxConnWaitTimeout time.Duration - - // RetryIf controls whether a retry should be attempted after an error. - // - // By default will use isIdempotent function - RetryIf RetryIfFunc - - // Transport defines a transport-like mechanism that wraps every request/response. - Transport RoundTripper - - // Connection pool strategy. Can be either LIFO or FIFO (default). - ConnPoolStrategy ConnPoolStrategyType - // StreamResponseBody enables response body streaming. StreamResponseBody bool - lastUseTime uint32 - - connsLock sync.Mutex - connsCount int - conns []*clientConn - connsWait *wantConnQueue - - addrsLock sync.Mutex - addrs []string - addrIdx uint32 - - tlsConfigMap map[string]*tls.Config - tlsConfigMapLock sync.Mutex - - readerPool sync.Pool - writerPool sync.Pool - - clientReaderPool *sync.Pool - clientWriterPool *sync.Pool - - pendingRequests int32 - - // pendingClientRequests counts the number of requests that a Client is currently running using this HostClient. - // It will be incremented earlier than pendingRequests and will be used by Client to see if the HostClient is still in use. - pendingClientRequests int32 - connsCleanerRun bool } @@ -950,9 +992,9 @@ func clientGetURLTimeout(dst []byte, url string, timeout time.Duration, c client } type clientURLResponse struct { - statusCode int - body []byte err error + body []byte + statusCode int } func clientGetURLDeadline(dst []byte, url string, deadline time.Time, c clientDoer) (statusCode int, body []byte, err error) { @@ -1271,16 +1313,15 @@ func (c *HostClient) DoRedirects(req *Request, resp *Response, maxRedirectsCount // It is recommended obtaining req and resp via AcquireRequest // and AcquireResponse in performance-critical code. func (c *HostClient) Do(req *Request, resp *Response) error { - var err error - var retry bool + var ( + err error + retry bool + resetTimeout bool + ) maxAttempts := c.MaxIdemponentCallAttempts if maxAttempts <= 0 { maxAttempts = DefaultMaxIdemponentCallAttempts } - isRequestRetryable := isIdempotent - if c.RetryIf != nil { - isRequestRetryable = c.RetryIf - } attempts := 0 hasBodyStream := req.IsBodyStream() @@ -1292,6 +1333,10 @@ func (c *HostClient) Do(req *Request, resp *Response) error { if timeout > 0 { deadline = time.Now().Add(timeout) } + retryFunc := c.RetryIf + if retryFunc == nil { + retryFunc = isIdempotent + } atomic.AddInt32(&c.pendingRequests, 1) for { @@ -1313,22 +1358,23 @@ func (c *HostClient) Do(req *Request, resp *Response) error { if hasBodyStream { break } - if !isRequestRetryable(req) { - // Retry non-idempotent requests if the server closes - // the connection before sending the response. - // - // This case is possible if the server closes the idle - // keep-alive connection on timeout. - // - // Apache and nginx usually do this. - if err != io.EOF { - break - } - } + // Path prioritization based on ease of computation attempts++ + if attempts >= maxAttempts { break } + if c.RetryIfErr != nil { + resetTimeout, retry = c.RetryIfErr(req, attempts, err) + } else { + retry = retryFunc(req) + } + if !retry { + break + } + if timeout > 0 && resetTimeout { + deadline = time.Now().Add(timeout) + } } atomic.AddInt32(&c.pendingRequests, -1) @@ -1360,9 +1406,7 @@ func (c *HostClient) do(req *Request, resp *Response) (bool, error) { defer ReleaseResponse(resp) } - ok, err := c.doNonNilReqResp(req, resp) - - return ok, err + return c.doNonNilReqResp(req, resp) } func (c *HostClient) doNonNilReqResp(req *Request, resp *Response) (bool, error) { @@ -1385,7 +1429,7 @@ func (c *HostClient) doNonNilReqResp(req *Request, resp *Response) (bool, error) return false, ErrHostClientRedirectToDifferentScheme } - atomic.StoreUint32(&c.lastUseTime, uint32(time.Now().Unix()-startTimeUnix)) + atomic.StoreUint32(&c.lastUseTime, uint32(time.Now().Unix()-startTimeUnix)) // #nosec G115 // Free up resources occupied by response before sending the request, // so the GC may reclaim these resources (e.g. response body). @@ -1547,6 +1591,7 @@ func (c *HostClient) acquireConn(reqTimeout time.Duration, connectionClose bool) case <-w.ready: return w.conn, w.err case <-tc.C: + c.connsWait.failedWaiters.Add(1) if timeoutOverridden { return nil, ErrTimeout } @@ -1692,6 +1737,7 @@ func (c *HostClient) decConnsCount() { dialed = true break } + c.connsWait.failedWaiters.Add(-1) } } if !dialed { @@ -1744,8 +1790,19 @@ func (c *HostClient) releaseConn(cc *clientConn) { w := q.popFront() if w.waiting() { delivered = w.tryDeliver(cc, nil) - break + // This is the last resort to hand over conCount sema. + // We must ensure that there are no valid waiters in connsWait + // when we exit this loop. + // + // We did not apply the same looping pattern in the decConnsCount + // method because it needs to create a new time-spent connection, + // and the decConnsCount call chain will inevitably reach this point. + // When MaxConnWaitTimeout>0. + if delivered { + break + } } + c.connsWait.failedWaiters.Add(-1) } } if !delivered { @@ -1859,7 +1916,7 @@ func (c *HostClient) nextAddr() string { } addr := c.addrs[0] if len(c.addrs) > 1 { - addr = c.addrs[c.addrIdx%uint32(len(c.addrs))] + addr = c.addrs[c.addrIdx%uint32(len(c.addrs))] // #nosec G115 c.addrIdx++ } c.addrsLock.Unlock() @@ -2033,10 +2090,10 @@ func AddMissingPort(addr string, isTLS bool) string { // // Inspired by net/http/transport.go. type wantConn struct { - ready chan struct{} - mu sync.Mutex // protects conn, err, close(ready) - conn *clientConn err error + ready chan struct{} + conn *clientConn + mu sync.Mutex // protects conn, err, close(ready) } // waiting reports whether w is still waiting for an answer (connection or error). @@ -2099,13 +2156,19 @@ type wantConnQueue struct { // in Okasaki's purely functional queue but without the // overhead of reversing the list when swapping stages. head []*wantConn - headPos int tail []*wantConn + headPos int + // failedWaiters is the number of waiters in the head or tail queue, + // but is invalid. + // These state waiters cannot truly be considered as waiters; the current + // implementation does not immediately remove them when they become + // invalid but instead only marks them. + failedWaiters atomic.Int64 } // len returns the number of items in the queue. func (q *wantConnQueue) len() int { - return len(q.head) - q.headPos + len(q.tail) + return len(q.head) - q.headPos + len(q.tail) - int(q.failedWaiters.Load()) } // pushBack adds w to the back of the queue. @@ -2149,6 +2212,7 @@ func (q *wantConnQueue) clearFront() (cleaned bool) { return cleaned } q.popFront() + q.failedWaiters.Add(-1) cleaned = true } } @@ -2168,15 +2232,26 @@ func (q *wantConnQueue) clearFront() (cleaned bool) { type PipelineClient struct { noCopy noCopy + // Logger for logging client errors. + // + // By default standard logger from log package is used. + Logger Logger + + // Callback for connection establishing to the host. + // + // Default Dial is used if not set. + Dial DialFunc + + // Optional TLS config. + TLSConfig *tls.Config + // Address of the host to connect to. Addr string // PipelineClient name. Used in User-Agent request header. Name string - // NoDefaultUserAgentHeader when set to true, causes the default - // User-Agent header to be excluded from the Request. - NoDefaultUserAgentHeader bool + connClients []*pipelineConnClient // The maximum number of concurrent connections to the Addr. // @@ -2195,10 +2270,38 @@ type PipelineClient struct { // By default requests are sent immediately to the server. MaxBatchDelay time.Duration - // Callback for connection establishing to the host. + // Idle connection to the host is closed after this duration. // - // Default Dial is used if not set. - Dial DialFunc + // By default idle connection is closed after + // DefaultMaxIdleConnDuration. + MaxIdleConnDuration time.Duration + + // Buffer size for responses' reading. + // This also limits the maximum header size. + // + // Default buffer size is used if 0. + ReadBufferSize int + + // Buffer size for requests' writing. + // + // Default buffer size is used if 0. + WriteBufferSize int + + // Maximum duration for full response reading (including body). + // + // By default response read timeout is unlimited. + ReadTimeout time.Duration + + // Maximum duration for full request writing (including body). + // + // By default request write timeout is unlimited. + WriteTimeout time.Duration + + connClientsLock sync.Mutex + + // NoDefaultUserAgentHeader when set to true, causes the default + // User-Agent header to be excluded from the Request. + NoDefaultUserAgentHeader bool // Attempt to connect to both ipv4 and ipv6 host addresses // if set to true. @@ -2239,86 +2342,51 @@ type PipelineClient struct { // Whether to use TLS (aka SSL or HTTPS) for host connections. IsTLS bool - - // Optional TLS config. - TLSConfig *tls.Config - - // Idle connection to the host is closed after this duration. - // - // By default idle connection is closed after - // DefaultMaxIdleConnDuration. - MaxIdleConnDuration time.Duration - - // Buffer size for responses' reading. - // This also limits the maximum header size. - // - // Default buffer size is used if 0. - ReadBufferSize int - - // Buffer size for requests' writing. - // - // Default buffer size is used if 0. - WriteBufferSize int - - // Maximum duration for full response reading (including body). - // - // By default response read timeout is unlimited. - ReadTimeout time.Duration - - // Maximum duration for full request writing (including body). - // - // By default request write timeout is unlimited. - WriteTimeout time.Duration - - // Logger for logging client errors. - // - // By default standard logger from log package is used. - Logger Logger - - connClients []*pipelineConnClient - connClientsLock sync.Mutex } type pipelineConnClient struct { noCopy noCopy - Addr string - Name string + workPool sync.Pool + + Logger Logger + + Dial DialFunc + TLSConfig *tls.Config + chW chan *pipelineWork + chR chan *pipelineWork + + tlsConfig *tls.Config + + Addr string + Name string + MaxPendingRequests int + MaxBatchDelay time.Duration + MaxIdleConnDuration time.Duration + ReadBufferSize int + WriteBufferSize int + ReadTimeout time.Duration + WriteTimeout time.Duration + + chLock sync.Mutex + + tlsConfigLock sync.Mutex NoDefaultUserAgentHeader bool - MaxPendingRequests int - MaxBatchDelay time.Duration - Dial DialFunc DialDualStack bool DisableHeaderNamesNormalizing bool DisablePathNormalizing bool IsTLS bool - TLSConfig *tls.Config - MaxIdleConnDuration time.Duration - ReadBufferSize int - WriteBufferSize int - ReadTimeout time.Duration - WriteTimeout time.Duration - Logger Logger - - workPool sync.Pool - - chLock sync.Mutex - chW chan *pipelineWork - chR chan *pipelineWork - - tlsConfigLock sync.Mutex - tlsConfig *tls.Config } type pipelineWork struct { - reqCopy Request respCopy Response + deadline time.Time + err error req *Request resp *Response t *time.Timer - deadline time.Time - err error done chan struct{} + reqCopy Request } // DoTimeout performs the given request and waits for response during @@ -2941,8 +3009,7 @@ func (t *transport) RoundTrip(hc *HostClient, req *Request, resp *Response) (ret err = ErrTimeout } - isConnRST := isConnectionReset(err) - if err != nil && !isConnRST { + if err != nil { hc.closeConn(cc) return true, err } @@ -2977,7 +3044,7 @@ func (t *transport) RoundTrip(hc *HostClient, req *Request, resp *Response) (ret return needRetry, err } - closeConn := resetConnection || req.ConnectionClose() || resp.ConnectionClose() || isConnRST + closeConn := resetConnection || req.ConnectionClose() || resp.ConnectionClose() if customStreamBody && resp.bodyStream != nil { rbs := resp.bodyStream resp.bodyStream = newCloseReaderWithError(rbs, func(wErr error) error { diff --git a/vendor/github.com/valyala/fasthttp/compress.go b/vendor/github.com/valyala/fasthttp/compress.go index 895dc51c..19bb4352 100644 --- a/vendor/github.com/valyala/fasthttp/compress.go +++ b/vendor/github.com/valyala/fasthttp/compress.go @@ -141,7 +141,7 @@ var ( // - CompressDefaultCompression // - CompressHuffmanOnly func AppendGzipBytesLevel(dst, src []byte, level int) []byte { - w := &byteSliceWriter{dst} + w := &byteSliceWriter{b: dst} WriteGzipLevel(w, src, level) //nolint:errcheck return w.b } @@ -212,7 +212,7 @@ func AppendGzipBytes(dst, src []byte) []byte { // WriteGunzip writes ungzipped p to w and returns the number of uncompressed // bytes written to w. func WriteGunzip(w io.Writer, p []byte) (int, error) { - r := &byteSliceReader{p} + r := &byteSliceReader{b: p} zr, err := acquireGzipReader(r) if err != nil { return 0, err @@ -228,7 +228,7 @@ func WriteGunzip(w io.Writer, p []byte) (int, error) { // AppendGunzipBytes appends gunzipped src to dst and returns the resulting dst. func AppendGunzipBytes(dst, src []byte) ([]byte, error) { - w := &byteSliceWriter{dst} + w := &byteSliceWriter{b: dst} _, err := WriteGunzip(w, src) return w.b, err } @@ -244,7 +244,7 @@ func AppendGunzipBytes(dst, src []byte) ([]byte, error) { // - CompressDefaultCompression // - CompressHuffmanOnly func AppendDeflateBytesLevel(dst, src []byte, level int) []byte { - w := &byteSliceWriter{dst} + w := &byteSliceWriter{b: dst} WriteDeflateLevel(w, src, level) //nolint:errcheck return w.b } @@ -321,7 +321,7 @@ func AppendDeflateBytes(dst, src []byte) []byte { // WriteInflate writes inflated p to w and returns the number of uncompressed // bytes written to w. func WriteInflate(w io.Writer, p []byte) (int, error) { - r := &byteSliceReader{p} + r := &byteSliceReader{b: p} zr, err := acquireFlateReader(r) if err != nil { return 0, err @@ -337,7 +337,7 @@ func WriteInflate(w io.Writer, p []byte) (int, error) { // AppendInflateBytes appends inflated src to dst and returns the resulting dst. func AppendInflateBytes(dst, src []byte) ([]byte, error) { - w := &byteSliceWriter{dst} + w := &byteSliceWriter{b: dst} _, err := WriteInflate(w, src) return w.b, err } diff --git a/vendor/github.com/valyala/fasthttp/cookie.go b/vendor/github.com/valyala/fasthttp/cookie.go index e99ea675..3b1fe6b9 100644 --- a/vendor/github.com/valyala/fasthttp/cookie.go +++ b/vendor/github.com/valyala/fasthttp/cookie.go @@ -67,20 +67,22 @@ var cookiePool = &sync.Pool{ type Cookie struct { noCopy noCopy + expire time.Time + key []byte value []byte - expire time.Time - maxAge int domain []byte path []byte + bufK []byte + bufV []byte + + maxAge int + + sameSite CookieSameSite httpOnly bool secure bool - sameSite CookieSameSite partitioned bool - - bufKV argsKV - buf []byte } // CopyTo copies src cookie to c. @@ -154,14 +156,14 @@ func (c *Cookie) Path() []byte { // SetPath sets cookie path. func (c *Cookie) SetPath(path string) { - c.buf = append(c.buf[:0], path...) - c.path = normalizePath(c.path, c.buf) + c.bufK = append(c.bufK[:0], path...) + c.path = normalizePath(c.path, c.bufK) } // SetPathBytes sets cookie path. func (c *Cookie) SetPathBytes(path []byte) { - c.buf = append(c.buf[:0], path...) - c.path = normalizePath(c.path, c.buf) + c.bufK = append(c.bufK[:0], path...) + c.path = normalizePath(c.path, c.bufK) } // Domain returns cookie domain. @@ -282,11 +284,11 @@ func (c *Cookie) AppendBytes(dst []byte) []byte { dst = append(dst, '=') dst = AppendUint(dst, c.maxAge) } else if !c.expire.IsZero() { - c.bufKV.value = AppendHTTPDate(c.bufKV.value[:0], c.expire) + c.bufV = AppendHTTPDate(c.bufV[:0], c.expire) dst = append(dst, ';', ' ') dst = append(dst, strCookieExpires...) dst = append(dst, '=') - dst = append(dst, c.bufKV.value...) + dst = append(dst, c.bufV...) } if len(c.domain) > 0 { dst = appendCookiePart(dst, strCookieDomain, c.domain) @@ -334,8 +336,8 @@ func (c *Cookie) AppendBytes(dst []byte) []byte { // The returned value is valid until the Cookie reused or released (ReleaseCookie). // Do not store references to the returned value. Make copies instead. func (c *Cookie) Cookie() []byte { - c.buf = c.AppendBytes(c.buf[:0]) - return c.buf + c.bufK = c.AppendBytes(c.bufK[:0]) + return c.bufK } // String returns cookie representation. @@ -355,8 +357,8 @@ var errNoCookies = errors.New("no cookies found") // Parse parses Set-Cookie header. func (c *Cookie) Parse(src string) error { - c.buf = append(c.buf[:0], src...) - return c.ParseBytes(c.buf) + c.bufK = append(c.bufK[:0], src...) + return c.ParseBytes(c.bufK) } // ParseBytes parses Set-Cookie header. @@ -366,21 +368,20 @@ func (c *Cookie) ParseBytes(src []byte) error { var s cookieScanner s.b = src - kv := &c.bufKV - if !s.next(kv) { + if !s.next(&c.bufK, &c.bufV) { return errNoCookies } - c.key = append(c.key, kv.key...) - c.value = append(c.value, kv.value...) + c.key = append(c.key, c.bufK...) + c.value = append(c.value, c.bufV...) - for s.next(kv) { - if len(kv.key) != 0 { + for s.next(&c.bufK, &c.bufV) { + if len(c.bufK) != 0 { // Case insensitive switch on first char - switch kv.key[0] | 0x20 { + switch c.bufK[0] | 0x20 { case 'm': - if caseInsensitiveCompare(strCookieMaxAge, kv.key) { - maxAge, err := ParseUint(kv.value) + if caseInsensitiveCompare(strCookieMaxAge, c.bufK) { + maxAge, err := ParseUint(c.bufV) if err != nil { return err } @@ -388,8 +389,8 @@ func (c *Cookie) ParseBytes(src []byte) error { } case 'e': // "expires" - if caseInsensitiveCompare(strCookieExpires, kv.key) { - v := b2s(kv.value) + if caseInsensitiveCompare(strCookieExpires, c.bufK) { + v := b2s(c.bufV) // Try the same two formats as net/http // See: https://github.com/golang/go/blob/00379be17e63a5b75b3237819392d2dc3b313a27/src/net/http/cookie.go#L133-L135 exptime, err := time.ParseInLocation(time.RFC1123, v, time.UTC) @@ -403,52 +404,52 @@ func (c *Cookie) ParseBytes(src []byte) error { } case 'd': // "domain" - if caseInsensitiveCompare(strCookieDomain, kv.key) { - c.domain = append(c.domain, kv.value...) + if caseInsensitiveCompare(strCookieDomain, c.bufK) { + c.domain = append(c.domain, c.bufV...) } case 'p': // "path" - if caseInsensitiveCompare(strCookiePath, kv.key) { - c.path = append(c.path, kv.value...) + if caseInsensitiveCompare(strCookiePath, c.bufK) { + c.path = append(c.path, c.bufV...) } case 's': // "samesite" - if caseInsensitiveCompare(strCookieSameSite, kv.key) { - if len(kv.value) > 0 { + if caseInsensitiveCompare(strCookieSameSite, c.bufK) { + if len(c.bufV) > 0 { // Case insensitive switch on first char - switch kv.value[0] | 0x20 { + switch c.bufV[0] | 0x20 { case 'l': // "lax" - if caseInsensitiveCompare(strCookieSameSiteLax, kv.value) { + if caseInsensitiveCompare(strCookieSameSiteLax, c.bufV) { c.sameSite = CookieSameSiteLaxMode } case 's': // "strict" - if caseInsensitiveCompare(strCookieSameSiteStrict, kv.value) { + if caseInsensitiveCompare(strCookieSameSiteStrict, c.bufV) { c.sameSite = CookieSameSiteStrictMode } case 'n': // "none" - if caseInsensitiveCompare(strCookieSameSiteNone, kv.value) { + if caseInsensitiveCompare(strCookieSameSiteNone, c.bufV) { c.sameSite = CookieSameSiteNoneMode } } } } } - } else if len(kv.value) != 0 { + } else if len(c.bufV) != 0 { // Case insensitive switch on first char - switch kv.value[0] | 0x20 { + switch c.bufV[0] | 0x20 { case 'h': // "httponly" - if caseInsensitiveCompare(strCookieHTTPOnly, kv.value) { + if caseInsensitiveCompare(strCookieHTTPOnly, c.bufV) { c.httpOnly = true } case 's': // "secure" - if caseInsensitiveCompare(strCookieSecure, kv.value) { + if caseInsensitiveCompare(strCookieSecure, c.bufV) { c.secure = true - } else if caseInsensitiveCompare(strCookieSameSite, kv.value) { + } else if caseInsensitiveCompare(strCookieSameSite, c.bufV) { c.sameSite = CookieSameSiteDefaultMode } case 'p': // "partitioned" - if caseInsensitiveCompare(strCookiePartitioned, kv.value) { + if caseInsensitiveCompare(strCookiePartitioned, c.bufV) { c.partitioned = true } } @@ -505,7 +506,7 @@ func parseRequestCookies(cookies []argsKV, src []byte) []argsKV { s.b = src var kv *argsKV cookies, kv = allocArg(cookies) - for s.next(kv) { + for s.next(&kv.key, &kv.value) { if len(kv.key) > 0 || len(kv.value) > 0 { cookies, kv = allocArg(cookies) } @@ -517,7 +518,7 @@ type cookieScanner struct { b []byte } -func (s *cookieScanner) next(kv *argsKV) bool { +func (s *cookieScanner) next(key, val *[]byte) bool { b := s.b if len(b) == 0 { return false @@ -530,23 +531,23 @@ func (s *cookieScanner) next(kv *argsKV) bool { case '=': if isKey { isKey = false - kv.key = decodeCookieArg(kv.key, b[:i], false) + *key = decodeCookieArg(*key, b[:i], false) k = i + 1 } case ';': if isKey { - kv.key = kv.key[:0] + *key = (*key)[:0] } - kv.value = decodeCookieArg(kv.value, b[k:i], true) + *val = decodeCookieArg(*val, b[k:i], true) s.b = b[i+1:] return true } } if isKey { - kv.key = kv.key[:0] + *key = (*key)[:0] } - kv.value = decodeCookieArg(kv.value, b[k:], true) + *val = decodeCookieArg(*val, b[k:], true) s.b = b[len(b):] return true } diff --git a/vendor/github.com/valyala/fasthttp/fasthttputil/inmemory_listener.go b/vendor/github.com/valyala/fasthttp/fasthttputil/inmemory_listener.go index 1aaa8e1b..2df46640 100644 --- a/vendor/github.com/valyala/fasthttp/fasthttputil/inmemory_listener.go +++ b/vendor/github.com/valyala/fasthttp/fasthttputil/inmemory_listener.go @@ -14,11 +14,11 @@ var ErrInmemoryListenerClosed = errors.New("InmemoryListener is already closed: // It may be used either for fast in-process client<->server communications // without network stack overhead or for client<->server tests. type InmemoryListener struct { + listenerAddr net.Addr + conns chan acceptConn + addrLock sync.RWMutex lock sync.Mutex closed bool - conns chan acceptConn - listenerAddr net.Addr - addrLock sync.RWMutex } type acceptConn struct { @@ -117,7 +117,7 @@ func (ln *InmemoryListener) DialWithLocalAddr(local net.Addr) (net.Conn, error) ln.lock.Lock() accepted := make(chan struct{}) if !ln.closed { - ln.conns <- acceptConn{sConn, accepted} + ln.conns <- acceptConn{conn: sConn, accepted: accepted} // Wait until the connection has been accepted. <-accepted } else { diff --git a/vendor/github.com/valyala/fasthttp/fasthttputil/pipeconns.go b/vendor/github.com/valyala/fasthttp/fasthttputil/pipeconns.go index d401fe92..f4466f55 100644 --- a/vendor/github.com/valyala/fasthttp/fasthttputil/pipeconns.go +++ b/vendor/github.com/valyala/fasthttp/fasthttputil/pipeconns.go @@ -42,9 +42,9 @@ func NewPipeConns() *PipeConns { // // PipeConns is NOT safe for concurrent use by multiple goroutines! type PipeConns struct { + stopCh chan struct{} c1 pipeConn c2 pipeConn - stopCh chan struct{} stopChLock sync.Mutex } @@ -93,8 +93,9 @@ func (pc *PipeConns) Close() error { } type pipeConn struct { - b *byteBuffer - bb []byte + localAddr net.Addr + remoteAddr net.Addr + b *byteBuffer rCh chan *byteBuffer wCh chan *byteBuffer @@ -106,11 +107,11 @@ type pipeConn struct { readDeadlineCh <-chan time.Time writeDeadlineCh <-chan time.Time - readDeadlineChLock sync.Mutex + bb []byte - localAddr net.Addr - remoteAddr net.Addr - addrLock sync.RWMutex + addrLock sync.RWMutex + + readDeadlineChLock sync.Mutex } func (c *pipeConn) Write(p []byte) (int, error) { diff --git a/vendor/github.com/valyala/fasthttp/fs.go b/vendor/github.com/valyala/fasthttp/fs.go index 7738ca2a..22f82178 100644 --- a/vendor/github.com/valyala/fasthttp/fs.go +++ b/vendor/github.com/valyala/fasthttp/fs.go @@ -256,14 +256,46 @@ type FS struct { // FS is filesystem to serve files from. eg: embed.FS os.DirFS FS fs.FS + // Path rewriting function. + // + // By default request path is not modified. + PathRewrite PathRewriteFunc + + // PathNotFound fires when file is not found in filesystem + // this functions tries to replace "Cannot open requested path" + // server response giving to the programmer the control of server flow. + // + // By default PathNotFound returns + // "Cannot open requested path" + PathNotFound RequestHandler + + // Suffixes list to add to compressedFileSuffix depending on encoding + // + // This value has sense only if Compress is set. + // + // FSCompressedFileSuffixes is used by default. + CompressedFileSuffixes map[string]string + + // If CleanStop is set, the channel can be closed to stop the cleanup handlers + // for the FS RequestHandlers created with NewRequestHandler. + // NEVER close this channel while the handler is still being used! + CleanStop chan struct{} + + h RequestHandler + // Path to the root directory to serve files from. Root string - // AllowEmptyRoot controls what happens when Root is empty. When false (default) it will default to the - // current working directory. An empty root is mostly useful when you want to use absolute paths - // on windows that are on different filesystems. On linux setting your Root to "/" already allows you to use - // absolute paths on any filesystem. - AllowEmptyRoot bool + // Path to the compressed root directory to serve files from. If this value + // is empty, Root is used. + CompressRoot string + + // Suffix to add to the name of cached compressed file. + // + // This value has sense only if Compress is set. + // + // FSCompressedFileSuffix is used by default. + CompressedFileSuffix string // List of index file names to try opening during directory access. // @@ -276,6 +308,26 @@ type FS struct { // By default the list is empty. IndexNames []string + // Expiration duration for inactive file handlers. + // + // FSHandlerCacheDuration is used by default. + CacheDuration time.Duration + + once sync.Once + + // AllowEmptyRoot controls what happens when Root is empty. When false (default) it will default to the + // current working directory. An empty root is mostly useful when you want to use absolute paths + // on windows that are on different filesystems. On linux setting your Root to "/" already allows you to use + // absolute paths on any filesystem. + AllowEmptyRoot bool + + // Uses brotli encoding and fallbacks to gzip in responses if set to true, uses gzip if set to false. + // + // This value has sense only if Compress is set. + // + // Brotli encoding is disabled by default. + CompressBrotli bool + // Index pages for directories without files matching IndexNames // are automatically generated if set. // @@ -298,66 +350,15 @@ type FS struct { // Transparent compression is disabled by default. Compress bool - // Uses brotli encoding and fallbacks to gzip in responses if set to true, uses gzip if set to false. - // - // This value has sense only if Compress is set. - // - // Brotli encoding is disabled by default. - CompressBrotli bool - - // Path to the compressed root directory to serve files from. If this value - // is empty, Root is used. - CompressRoot string - // Enables byte range requests if set to true. // // Byte range requests are disabled by default. AcceptByteRange bool - // Path rewriting function. - // - // By default request path is not modified. - PathRewrite PathRewriteFunc - - // PathNotFound fires when file is not found in filesystem - // this functions tries to replace "Cannot open requested path" - // server response giving to the programmer the control of server flow. - // - // By default PathNotFound returns - // "Cannot open requested path" - PathNotFound RequestHandler - // SkipCache if true, will cache no file handler. // // By default is false. SkipCache bool - - // Expiration duration for inactive file handlers. - // - // FSHandlerCacheDuration is used by default. - CacheDuration time.Duration - - // Suffix to add to the name of cached compressed file. - // - // This value has sense only if Compress is set. - // - // FSCompressedFileSuffix is used by default. - CompressedFileSuffix string - - // Suffixes list to add to compressedFileSuffix depending on encoding - // - // This value has sense only if Compress is set. - // - // FSCompressedFileSuffixes is used by default. - CompressedFileSuffixes map[string]string - - // If CleanStop is set, the channel can be closed to stop the cleanup handlers - // for the FS RequestHandlers created with NewRequestHandler. - // NEVER close this channel while the handler is still being used! - CleanStop chan struct{} - - once sync.Once - h RequestHandler } // FSCompressedFileSuffix is the suffix FS adds to the original file names @@ -502,40 +503,41 @@ func (fs *FS) initRequestHandler() { } type fsHandler struct { - filesystem fs.FS - root string - indexNames []string - pathRewrite PathRewriteFunc - pathNotFound RequestHandler - generateIndexPages bool - compress bool - compressBrotli bool - compressRoot string - acceptByteRange bool - compressedFileSuffixes map[string]string + smallFileReaderPool sync.Pool + filesystem fs.FS cacheManager cacheManager - smallFileReaderPool sync.Pool + pathRewrite PathRewriteFunc + pathNotFound RequestHandler + compressedFileSuffixes map[string]string + + root string + compressRoot string + indexNames []string + generateIndexPages bool + compress bool + compressBrotli bool + acceptByteRange bool } type fsFile struct { - h *fsHandler - f fs.File - filename string // fs.FileInfo.Name() return filename, isn't filepath. - dirIndex []byte - contentType string - contentLength int - compressed bool + lastModified time.Time - lastModified time.Time + t time.Time + f fs.File + h *fsHandler + filename string // fs.FileInfo.Name() return filename, isn't filepath. + contentType string + dirIndex []byte lastModifiedStr []byte - t time.Time - readersCount int + bigFiles []*bigFileReader + contentLength int + readersCount int - bigFiles []*bigFileReader bigFilesLock sync.Mutex + compressed bool } func (ff *fsFile) NewReader() (io.Reader, error) { @@ -817,6 +819,7 @@ func newCacheManager(fs *FS) cacheManager { cache: make(map[string]*fsFile), cacheBrotli: make(map[string]*fsFile), cacheGzip: make(map[string]*fsFile), + cacheZstd: make(map[string]*fsFile), } go instance.handleCleanCache(fs.CleanStop) @@ -845,10 +848,11 @@ func (*noopCacheManager) SetFileToCache(cacheKind CacheKind, path string, ff *fs } type inMemoryCacheManager struct { - cacheDuration time.Duration cache map[string]*fsFile cacheBrotli map[string]*fsFile cacheGzip map[string]*fsFile + cacheZstd map[string]*fsFile + cacheDuration time.Duration cacheLock sync.Mutex } @@ -867,6 +871,8 @@ func (cm *inMemoryCacheManager) getFsCache(cacheKind CacheKind) map[string]*fsFi fileCache = cm.cacheBrotli case gzipCacheKind: fileCache = cm.cacheGzip + case zstdCacheKind: + fileCache = cm.cacheZstd } return fileCache @@ -957,6 +963,7 @@ func (cm *inMemoryCacheManager) cleanCache(pendingFiles []*fsFile) []*fsFile { pendingFiles, filesToRelease = cleanCacheNolock(cm.cache, pendingFiles, filesToRelease, cm.cacheDuration) pendingFiles, filesToRelease = cleanCacheNolock(cm.cacheBrotli, pendingFiles, filesToRelease, cm.cacheDuration) pendingFiles, filesToRelease = cleanCacheNolock(cm.cacheGzip, pendingFiles, filesToRelease, cm.cacheDuration) + pendingFiles, filesToRelease = cleanCacheNolock(cm.cacheZstd, pendingFiles, filesToRelease, cm.cacheDuration) cm.cacheLock.Unlock() @@ -1015,7 +1022,6 @@ func (h *fsHandler) handleRequest(ctx *RequestCtx) { path = ctx.Path() } hasTrailingSlash := len(path) > 0 && path[len(path)-1] == '/' - path = stripTrailingSlashes(path) if n := bytes.IndexByte(path, 0); n >= 0 { ctx.Logger().Printf("cannot serve path with nil byte at position %d: %q", n, path) @@ -1054,9 +1060,13 @@ func (h *fsHandler) handleRequest(ctx *RequestCtx) { } } - pathStr := string(path) + originalPathStr := string(path) + pathStr := originalPathStr + if hasTrailingSlash { + pathStr = originalPathStr[:len(originalPathStr)-1] + } - ff, ok := h.cacheManager.GetFileFromCache(fileCacheKind, pathStr) + ff, ok := h.cacheManager.GetFileFromCache(fileCacheKind, originalPathStr) if !ok { filePath := h.pathToFilePath(pathStr) @@ -1091,7 +1101,7 @@ func (h *fsHandler) handleRequest(ctx *RequestCtx) { return } - ff = h.cacheManager.SetFileToCache(fileCacheKind, pathStr, ff) + ff = h.cacheManager.SetFileToCache(fileCacheKind, originalPathStr, ff) } if !ctx.IfModifiedSince(ff.lastModified) { @@ -1396,7 +1406,7 @@ func (h *fsHandler) compressAndOpenFSFile(filePath, fileEncoding string) (*fsFil } if compressedFilePath != filePath { - if err := os.MkdirAll(filepath.Dir(compressedFilePath), os.ModePerm); err != nil { + if err := os.MkdirAll(filepath.Dir(compressedFilePath), 0o750); err != nil { return nil, err } } diff --git a/vendor/github.com/valyala/fasthttp/header.go b/vendor/github.com/valyala/fasthttp/header.go index b0262944..b6d8ffec 100644 --- a/vendor/github.com/valyala/fasthttp/header.go +++ b/vendor/github.com/valyala/fasthttp/header.go @@ -26,18 +26,9 @@ const ( type ResponseHeader struct { noCopy noCopy - disableNormalizing bool - noHTTP11 bool - connectionClose bool - noDefaultContentType bool - noDefaultDate bool - - statusCode int - statusMessage []byte - protocol []byte - contentLength int - contentLengthBytes []byte - secureErrorLogMessage bool + statusMessage []byte + protocol []byte + contentLengthBytes []byte contentType []byte contentEncoding []byte @@ -46,9 +37,20 @@ type ResponseHeader struct { h []argsKV trailer []argsKV - bufKV argsKV cookies []argsKV + bufK []byte + bufV []byte + + statusCode int + contentLength int + + disableNormalizing bool + noHTTP11 bool + connectionClose bool + noDefaultContentType bool + noDefaultDate bool + secureErrorLogMessage bool } // RequestHeader represents HTTP request header. @@ -61,19 +63,7 @@ type ResponseHeader struct { type RequestHeader struct { noCopy noCopy - disableNormalizing bool - noHTTP11 bool - connectionClose bool - noDefaultContentType bool - disableSpecialHeader bool - - // These two fields have been moved close to other bool fields - // for reducing RequestHeader object size. - cookiesCollected bool - - contentLength int - contentLengthBytes []byte - secureErrorLogMessage bool + contentLengthBytes []byte method []byte requestURI []byte @@ -85,19 +75,34 @@ type RequestHeader struct { h []argsKV trailer []argsKV - bufKV argsKV cookies []argsKV // stores an immutable copy of headers as they were received from the // wire. rawHeaders []byte + bufK []byte + bufV []byte + + contentLength int + + disableNormalizing bool + noHTTP11 bool + connectionClose bool + noDefaultContentType bool + disableSpecialHeader bool + + // These two fields have been moved close to other bool fields + // for reducing RequestHeader object size. + cookiesCollected bool + + secureErrorLogMessage bool } // SetContentRange sets 'Content-Range: bytes startPos-endPos/contentLength' // header. func (h *ResponseHeader) SetContentRange(startPos, endPos, contentLength int) { - b := h.bufKV.value[:0] + b := h.bufV[:0] b = append(b, strBytes...) b = append(b, ' ') b = AppendUint(b, startPos) @@ -105,9 +110,9 @@ func (h *ResponseHeader) SetContentRange(startPos, endPos, contentLength int) { b = AppendUint(b, endPos) b = append(b, '/') b = AppendUint(b, contentLength) - h.bufKV.value = b + h.bufV = b - h.setNonSpecial(strContentRange, h.bufKV.value) + h.setNonSpecial(strContentRange, h.bufV) } // SetByteRange sets 'Range: bytes=startPos-endPos' header. @@ -115,7 +120,7 @@ func (h *ResponseHeader) SetContentRange(startPos, endPos, contentLength int) { // - If startPos is negative, then 'bytes=-startPos' value is set. // - If endPos is negative, then 'bytes=startPos-' value is set. func (h *RequestHeader) SetByteRange(startPos, endPos int) { - b := h.bufKV.value[:0] + b := h.bufV[:0] b = append(b, strBytes...) b = append(b, '=') if startPos >= 0 { @@ -127,9 +132,9 @@ func (h *RequestHeader) SetByteRange(startPos, endPos int) { if endPos >= 0 { b = AppendUint(b, endPos) } - h.bufKV.value = b + h.bufV = b - h.setNonSpecial(strRange, h.bufKV.value) + h.setNonSpecial(strRange, h.bufV) } // StatusCode returns response status code. @@ -170,8 +175,8 @@ func (h *ResponseHeader) SetProtocol(protocol []byte) { // SetLastModified sets 'Last-Modified' header to the given value. func (h *ResponseHeader) SetLastModified(t time.Time) { - h.bufKV.value = AppendHTTPDate(h.bufKV.value[:0], t) - h.setNonSpecial(strLastModified, h.bufKV.value) + h.bufV = AppendHTTPDate(h.bufV[:0], t) + h.setNonSpecial(strLastModified, h.bufV) } // ConnectionClose returns true if 'Connection: close' header is set. @@ -408,30 +413,30 @@ func (h *RequestHeader) SetContentEncodingBytes(contentEncoding []byte) { // 'multipart/form-data; boundary=...' // where ... is substituted by the given boundary. func (h *RequestHeader) SetMultipartFormBoundary(boundary string) { - b := h.bufKV.value[:0] + b := h.bufV[:0] b = append(b, strMultipartFormData...) b = append(b, ';', ' ') b = append(b, strBoundary...) b = append(b, '=') b = append(b, boundary...) - h.bufKV.value = b + h.bufV = b - h.SetContentTypeBytes(h.bufKV.value) + h.SetContentTypeBytes(h.bufV) } // SetMultipartFormBoundaryBytes sets the following Content-Type: // 'multipart/form-data; boundary=...' // where ... is substituted by the given boundary. func (h *RequestHeader) SetMultipartFormBoundaryBytes(boundary []byte) { - b := h.bufKV.value[:0] + b := h.bufV[:0] b = append(b, strMultipartFormData...) b = append(b, ';', ' ') b = append(b, strBoundary...) b = append(b, '=') b = append(b, boundary...) - h.bufKV.value = b + h.bufV = b - h.SetContentTypeBytes(h.bufKV.value) + h.SetContentTypeBytes(h.bufV) } // SetTrailer sets header Trailer value for chunked response @@ -537,20 +542,26 @@ func (h *ResponseHeader) AddTrailerBytes(trailer []byte) error { err = ErrBadTrailer continue } - h.bufKV.key = append(h.bufKV.key[:0], key...) - normalizeHeaderKey(h.bufKV.key, h.disableNormalizing) - h.trailer = appendArgBytes(h.trailer, h.bufKV.key, nil, argsNoValue) + h.bufK = append(h.bufK[:0], key...) + normalizeHeaderKey(h.bufK, h.disableNormalizing) + h.trailer = appendArgBytes(h.trailer, h.bufK, nil, argsNoValue) } return err } -// validHeaderFieldByte returns true if c is a valid tchar as defined -// by section 5.6.2 of [RFC9110]. +// validHeaderFieldByte returns true if c valid header field byte +// as defined by RFC 7230. func validHeaderFieldByte(c byte) bool { return c < 128 && validHeaderFieldByteTable[c] == 1 } +// validHeaderValueByte returns true if c valid header value byte +// as defined by RFC 7230. +func validHeaderValueByte(c byte) bool { + return validHeaderValueByteTable[c] == 1 +} + // VisitHeaderParams calls f for each parameter in the given header bytes. // It stops processing when f returns false or an invalid parameter is found. // Parameter values may be quoted, in which case \ is treated as an escape @@ -879,9 +890,9 @@ func (h *RequestHeader) AddTrailerBytes(trailer []byte) error { err = ErrBadTrailer continue } - h.bufKV.key = append(h.bufKV.key[:0], key...) - normalizeHeaderKey(h.bufKV.key, h.disableNormalizing) - h.trailer = appendArgBytes(h.trailer, h.bufKV.key, nil, argsNoValue) + h.bufK = append(h.bufK[:0], key...) + normalizeHeaderKey(h.bufK, h.disableNormalizing) + h.trailer = appendArgBytes(h.trailer, h.bufK, nil, argsNoValue) } return err @@ -945,8 +956,8 @@ func (h *ResponseHeader) IsHTTP11() bool { // HasAcceptEncoding returns true if the header contains // the given Accept-Encoding value. func (h *RequestHeader) HasAcceptEncoding(acceptEncoding string) bool { - h.bufKV.value = append(h.bufKV.value[:0], acceptEncoding...) - return h.HasAcceptEncodingBytes(h.bufKV.value) + h.bufV = append(h.bufV[:0], acceptEncoding...) + return h.HasAcceptEncodingBytes(h.bufV) } // HasAcceptEncodingBytes returns true if the header contains @@ -1275,8 +1286,8 @@ func (h *RequestHeader) VisitAll(f func(key, value []byte)) { h.collectCookies() if len(h.cookies) > 0 { - h.bufKV.value = appendRequestCookieBytes(h.bufKV.value[:0], h.cookies) - f(strCookie, h.bufKV.value) + h.bufV = appendRequestCookieBytes(h.bufV[:0], h.cookies) + f(strCookie, h.bufV) } visitArgs(h.h, f) if h.ConnectionClose() { @@ -1304,15 +1315,15 @@ func (h *RequestHeader) VisitAllInOrder(f func(key, value []byte)) { // Del deletes header with the given key. func (h *ResponseHeader) Del(key string) { - k := getHeaderKeyBytes(&h.bufKV, key, h.disableNormalizing) - h.del(k) + h.bufK = getHeaderKeyBytes(h.bufK, key, h.disableNormalizing) + h.del(h.bufK) } // DelBytes deletes header with the given key. func (h *ResponseHeader) DelBytes(key []byte) { - h.bufKV.key = append(h.bufKV.key[:0], key...) - normalizeHeaderKey(h.bufKV.key, h.disableNormalizing) - h.del(h.bufKV.key) + h.bufK = append(h.bufK[:0], key...) + normalizeHeaderKey(h.bufK, h.disableNormalizing) + h.del(h.bufK) } func (h *ResponseHeader) del(key []byte) { @@ -1338,15 +1349,15 @@ func (h *ResponseHeader) del(key []byte) { // Del deletes header with the given key. func (h *RequestHeader) Del(key string) { - k := getHeaderKeyBytes(&h.bufKV, key, h.disableNormalizing) - h.del(k) + h.bufK = getHeaderKeyBytes(h.bufK, key, h.disableNormalizing) + h.del(h.bufK) } // DelBytes deletes header with the given key. func (h *RequestHeader) DelBytes(key []byte) { - h.bufKV.key = append(h.bufKV.key[:0], key...) - normalizeHeaderKey(h.bufKV.key, h.disableNormalizing) - h.del(h.bufKV.key) + h.bufK = append(h.bufK[:0], key...) + normalizeHeaderKey(h.bufK, h.disableNormalizing) + h.del(h.bufK) } func (h *RequestHeader) del(key []byte) { @@ -1554,8 +1565,8 @@ func (h *ResponseHeader) AddBytesKV(key, value []byte) { return } - k := getHeaderKeyBytes(&h.bufKV, b2s(key), h.disableNormalizing) - h.h = appendArgBytes(h.h, k, value, argsHasValue) + h.bufK = getHeaderKeyBytes(h.bufK, b2s(key), h.disableNormalizing) + h.h = appendArgBytes(h.h, h.bufK, value, argsHasValue) } // Set sets the given 'key: value' header. @@ -1565,8 +1576,8 @@ func (h *ResponseHeader) AddBytesKV(key, value []byte) { // // Use Add for setting multiple header values under the same key. func (h *ResponseHeader) Set(key, value string) { - initHeaderKV(&h.bufKV, key, value, h.disableNormalizing) - h.SetCanonical(h.bufKV.key, h.bufKV.value) + h.bufK, h.bufV = initHeaderKV(h.bufK, h.bufV, key, value, h.disableNormalizing) + h.SetCanonical(h.bufK, h.bufV) } // SetBytesK sets the given 'key: value' header. @@ -1576,8 +1587,8 @@ func (h *ResponseHeader) Set(key, value string) { // // Use AddBytesK for setting multiple header values under the same key. func (h *ResponseHeader) SetBytesK(key []byte, value string) { - h.bufKV.value = append(h.bufKV.value[:0], value...) - h.SetBytesKV(key, h.bufKV.value) + h.bufV = append(h.bufV[:0], value...) + h.SetBytesKV(key, h.bufV) } // SetBytesV sets the given 'key: value' header. @@ -1587,8 +1598,8 @@ func (h *ResponseHeader) SetBytesK(key []byte, value string) { // // Use AddBytesV for setting multiple header values under the same key. func (h *ResponseHeader) SetBytesV(key string, value []byte) { - k := getHeaderKeyBytes(&h.bufKV, key, h.disableNormalizing) - h.SetCanonical(k, value) + h.bufK = getHeaderKeyBytes(h.bufK, key, h.disableNormalizing) + h.SetCanonical(h.bufK, value) } // SetBytesKV sets the given 'key: value' header. @@ -1598,9 +1609,9 @@ func (h *ResponseHeader) SetBytesV(key string, value []byte) { // // Use AddBytesKV for setting multiple header values under the same key. func (h *ResponseHeader) SetBytesKV(key, value []byte) { - h.bufKV.key = append(h.bufKV.key[:0], key...) - normalizeHeaderKey(h.bufKV.key, h.disableNormalizing) - h.SetCanonical(h.bufKV.key, value) + h.bufK = append(h.bufK[:0], key...) + normalizeHeaderKey(h.bufK, h.disableNormalizing) + h.SetCanonical(h.bufK, value) } // SetCanonical sets the given 'key: value' header assuming that @@ -1765,8 +1776,8 @@ func (h *RequestHeader) AddBytesKV(key, value []byte) { return } - k := getHeaderKeyBytes(&h.bufKV, b2s(key), h.disableNormalizing) - h.h = appendArgBytes(h.h, k, value, argsHasValue) + h.bufK = getHeaderKeyBytes(h.bufK, b2s(key), h.disableNormalizing) + h.h = appendArgBytes(h.h, h.bufK, value, argsHasValue) } // Set sets the given 'key: value' header. @@ -1776,8 +1787,8 @@ func (h *RequestHeader) AddBytesKV(key, value []byte) { // // Use Add for setting multiple header values under the same key. func (h *RequestHeader) Set(key, value string) { - initHeaderKV(&h.bufKV, key, value, h.disableNormalizing) - h.SetCanonical(h.bufKV.key, h.bufKV.value) + h.bufK, h.bufV = initHeaderKV(h.bufK, h.bufV, key, value, h.disableNormalizing) + h.SetCanonical(h.bufK, h.bufV) } // SetBytesK sets the given 'key: value' header. @@ -1787,8 +1798,8 @@ func (h *RequestHeader) Set(key, value string) { // // Use AddBytesK for setting multiple header values under the same key. func (h *RequestHeader) SetBytesK(key []byte, value string) { - h.bufKV.value = append(h.bufKV.value[:0], value...) - h.SetBytesKV(key, h.bufKV.value) + h.bufV = append(h.bufV[:0], value...) + h.SetBytesKV(key, h.bufV) } // SetBytesV sets the given 'key: value' header. @@ -1798,8 +1809,8 @@ func (h *RequestHeader) SetBytesK(key []byte, value string) { // // Use AddBytesV for setting multiple header values under the same key. func (h *RequestHeader) SetBytesV(key string, value []byte) { - k := getHeaderKeyBytes(&h.bufKV, key, h.disableNormalizing) - h.SetCanonical(k, value) + h.bufK = getHeaderKeyBytes(h.bufK, key, h.disableNormalizing) + h.SetCanonical(h.bufK, value) } // SetBytesKV sets the given 'key: value' header. @@ -1809,9 +1820,9 @@ func (h *RequestHeader) SetBytesV(key string, value []byte) { // // Use AddBytesKV for setting multiple header values under the same key. func (h *RequestHeader) SetBytesKV(key, value []byte) { - h.bufKV.key = append(h.bufKV.key[:0], key...) - normalizeHeaderKey(h.bufKV.key, h.disableNormalizing) - h.SetCanonical(h.bufKV.key, value) + h.bufK = append(h.bufK[:0], key...) + normalizeHeaderKey(h.bufK, h.disableNormalizing) + h.SetCanonical(h.bufK, value) } // SetCanonical sets the given 'key: value' header assuming that @@ -1832,8 +1843,8 @@ func (h *RequestHeader) SetCanonical(key, value []byte) { // either though ReleaseResponse or your request handler returning. // Do not store references to the returned value. Make copies instead. func (h *ResponseHeader) Peek(key string) []byte { - k := getHeaderKeyBytes(&h.bufKV, key, h.disableNormalizing) - return h.peek(k) + h.bufK = getHeaderKeyBytes(h.bufK, key, h.disableNormalizing) + return h.peek(h.bufK) } // PeekBytes returns header value for the given key. @@ -1842,9 +1853,9 @@ func (h *ResponseHeader) Peek(key string) []byte { // either though ReleaseResponse or your request handler returning. // Do not store references to returned value. Make copies instead. func (h *ResponseHeader) PeekBytes(key []byte) []byte { - h.bufKV.key = append(h.bufKV.key[:0], key...) - normalizeHeaderKey(h.bufKV.key, h.disableNormalizing) - return h.peek(h.bufKV.key) + h.bufK = append(h.bufK[:0], key...) + normalizeHeaderKey(h.bufK, h.disableNormalizing) + return h.peek(h.bufK) } // Peek returns header value for the given key. @@ -1853,8 +1864,8 @@ func (h *ResponseHeader) PeekBytes(key []byte) []byte { // either though ReleaseRequest or your request handler returning. // Do not store references to returned value. Make copies instead. func (h *RequestHeader) Peek(key string) []byte { - k := getHeaderKeyBytes(&h.bufKV, key, h.disableNormalizing) - return h.peek(k) + h.bufK = getHeaderKeyBytes(h.bufK, key, h.disableNormalizing) + return h.peek(h.bufK) } // PeekBytes returns header value for the given key. @@ -1863,9 +1874,9 @@ func (h *RequestHeader) Peek(key string) []byte { // either though ReleaseRequest or your request handler returning. // Do not store references to returned value. Make copies instead. func (h *RequestHeader) PeekBytes(key []byte) []byte { - h.bufKV.key = append(h.bufKV.key[:0], key...) - normalizeHeaderKey(h.bufKV.key, h.disableNormalizing) - return h.peek(h.bufKV.key) + h.bufK = append(h.bufK[:0], key...) + normalizeHeaderKey(h.bufK, h.disableNormalizing) + return h.peek(h.bufK) } func (h *ResponseHeader) peek(key []byte) []byte { @@ -1926,8 +1937,8 @@ func (h *RequestHeader) peek(key []byte) []byte { // Any future calls to the Peek* will modify the returned value. // Do not store references to returned value. Make copies instead. func (h *RequestHeader) PeekAll(key string) [][]byte { - k := getHeaderKeyBytes(&h.bufKV, key, h.disableNormalizing) - return h.peekAll(k) + h.bufK = getHeaderKeyBytes(h.bufK, key, h.disableNormalizing) + return h.peekAll(h.bufK) } func (h *RequestHeader) peekAll(key []byte) [][]byte { @@ -1974,8 +1985,8 @@ func (h *RequestHeader) peekAll(key []byte) [][]byte { // Any future calls to the Peek* will modify the returned value. // Do not store references to returned value. Make copies instead. func (h *ResponseHeader) PeekAll(key string) [][]byte { - k := getHeaderKeyBytes(&h.bufKV, key, h.disableNormalizing) - return h.peekAll(k) + h.bufK = getHeaderKeyBytes(h.bufK, key, h.disableNormalizing) + return h.peekAll(h.bufK) } func (h *ResponseHeader) peekAll(key []byte) [][]byte { @@ -2323,7 +2334,7 @@ func (h *RequestHeader) tryRead(r *bufio.Reader, n int) error { // n == 1 on the first read for the request. if n == 1 { // We didn't read a single byte. - return ErrNothingRead{err} + return ErrNothingRead{error: err} } return fmt.Errorf("error when reading request headers: %w", err) @@ -2403,8 +2414,8 @@ func (h *ResponseHeader) WriteTo(w io.Writer) (int64, error) { // either though ReleaseRequest or your request handler returning. // Do not store references to returned value. Make copies instead. func (h *ResponseHeader) Header() []byte { - h.bufKV.value = h.AppendBytes(h.bufKV.value[:0]) - return h.bufKV.value + h.bufV = h.AppendBytes(h.bufV[:0]) + return h.bufV } // writeTrailer writes response trailer to w. @@ -2421,13 +2432,13 @@ func (h *ResponseHeader) writeTrailer(w *bufio.Writer) error { // either though ReleaseRequest or your request handler returning. // Do not store references to returned value. Make copies instead. func (h *ResponseHeader) TrailerHeader() []byte { - h.bufKV.value = h.bufKV.value[:0] + h.bufV = h.bufV[:0] for _, t := range h.trailer { value := h.peek(t.key) - h.bufKV.value = appendHeaderLine(h.bufKV.value, t.key, value) + h.bufV = appendHeaderLine(h.bufV, t.key, value) } - h.bufKV.value = append(h.bufKV.value, strCRLF...) - return h.bufKV.value + h.bufV = append(h.bufV, strCRLF...) + return h.bufV } // String returns response header representation. @@ -2535,8 +2546,8 @@ func (h *RequestHeader) WriteTo(w io.Writer) (int64, error) { // either though ReleaseRequest or your request handler returning. // Do not store references to returned value. Make copies instead. func (h *RequestHeader) Header() []byte { - h.bufKV.value = h.AppendBytes(h.bufKV.value[:0]) - return h.bufKV.value + h.bufV = h.AppendBytes(h.bufV[:0]) + return h.bufV } // writeTrailer writes request trailer to w. @@ -2553,13 +2564,13 @@ func (h *RequestHeader) writeTrailer(w *bufio.Writer) error { // either though ReleaseRequest or your request handler returning. // Do not store references to returned value. Make copies instead. func (h *RequestHeader) TrailerHeader() []byte { - h.bufKV.value = h.bufKV.value[:0] + h.bufV = h.bufV[:0] for _, t := range h.trailer { value := h.peek(t.key) - h.bufKV.value = appendHeaderLine(h.bufKV.value, t.key, value) + h.bufV = appendHeaderLine(h.bufV, t.key, value) } - h.bufKV.value = append(h.bufKV.value, strCRLF...) - return h.bufKV.value + h.bufV = append(h.bufV, strCRLF...) + return h.bufV } // RawHeaders returns raw header key/value bytes. @@ -2849,6 +2860,15 @@ func (h *ResponseHeader) parseFirstLine(buf []byte) (int, error) { return len(buf) - len(bNext), nil } +func isValidMethod(method []byte) bool { + for _, ch := range method { + if validMethodValueByteTable[ch] == 0 { + return false + } + } + return true +} + func (h *RequestHeader) parseFirstLine(buf []byte) (int, error) { bNext := buf var b []byte @@ -2868,6 +2888,14 @@ func (h *RequestHeader) parseFirstLine(buf []byte) (int, error) { return 0, fmt.Errorf("cannot find http request method in %q", buf) } h.method = append(h.method[:0], b[:n]...) + + if !isValidMethod(h.method) { + if h.secureErrorLogMessage { + return 0, errors.New("unsupported http request method") + } + return 0, fmt.Errorf("unsupported http request method %q in %q", h.method, buf) + } + b = b[n+1:] // parse requestURI @@ -2945,75 +2973,90 @@ func (h *ResponseHeader) parseHeaders(buf []byte) (int, error) { var s headerScanner s.b = buf s.disableNormalizing = h.disableNormalizing - var err error var kv *argsKV -outer: for s.next() { - if len(s.key) > 0 { - for _, ch := range s.key { - if !validHeaderFieldByte(ch) { - err = fmt.Errorf("invalid header key %q", s.key) - continue outer - } - } - - switch s.key[0] | 0x20 { - case 'c': - if caseInsensitiveCompare(s.key, strContentType) { - h.contentType = append(h.contentType[:0], s.value...) - continue - } - if caseInsensitiveCompare(s.key, strContentEncoding) { - h.contentEncoding = append(h.contentEncoding[:0], s.value...) - continue - } - if caseInsensitiveCompare(s.key, strContentLength) { - if h.contentLength != -1 { - if h.contentLength, err = parseContentLength(s.value); err != nil { - h.contentLength = -2 - } else { - h.contentLengthBytes = append(h.contentLengthBytes[:0], s.value...) - } - } - continue - } - if caseInsensitiveCompare(s.key, strConnection) { - if bytes.Equal(s.value, strClose) { - h.connectionClose = true - } else { - h.connectionClose = false - h.h = appendArgBytes(h.h, s.key, s.value, argsHasValue) - } - continue - } - case 's': - if caseInsensitiveCompare(s.key, strServer) { - h.server = append(h.server[:0], s.value...) - continue - } - if caseInsensitiveCompare(s.key, strSetCookie) { - h.cookies, kv = allocArg(h.cookies) - kv.key = getCookieKey(kv.key, s.value) - kv.value = append(kv.value[:0], s.value...) - continue - } - case 't': - if caseInsensitiveCompare(s.key, strTransferEncoding) { - if len(s.value) > 0 && !bytes.Equal(s.value, strIdentity) { - h.contentLength = -1 - h.h = setArgBytes(h.h, strTransferEncoding, strChunked, argsHasValue) - } - continue - } - if caseInsensitiveCompare(s.key, strTrailer) { - err = h.SetTrailerBytes(s.value) - continue - } - } - h.h = appendArgBytes(h.h, s.key, s.value, argsHasValue) + if len(s.key) == 0 { + h.connectionClose = true + return 0, fmt.Errorf("invalid header key %q", s.key) } + + for _, ch := range s.key { + if !validHeaderFieldByte(ch) { + h.connectionClose = true + return 0, fmt.Errorf("invalid header key %q", s.key) + } + } + for _, ch := range s.value { + if !validHeaderValueByte(ch) { + h.connectionClose = true + return 0, fmt.Errorf("invalid header value %q", s.value) + } + } + + switch s.key[0] | 0x20 { + case 'c': + if caseInsensitiveCompare(s.key, strContentType) { + h.contentType = append(h.contentType[:0], s.value...) + continue + } + if caseInsensitiveCompare(s.key, strContentEncoding) { + h.contentEncoding = append(h.contentEncoding[:0], s.value...) + continue + } + if caseInsensitiveCompare(s.key, strContentLength) { + if h.contentLength != -1 { + var err error + h.contentLength, err = parseContentLength(s.value) + if err != nil { + h.contentLength = -2 + h.connectionClose = true + return 0, err + } + h.contentLengthBytes = append(h.contentLengthBytes[:0], s.value...) + } + continue + } + if caseInsensitiveCompare(s.key, strConnection) { + if bytes.Equal(s.value, strClose) { + h.connectionClose = true + } else { + h.connectionClose = false + h.h = appendArgBytes(h.h, s.key, s.value, argsHasValue) + } + continue + } + case 's': + if caseInsensitiveCompare(s.key, strServer) { + h.server = append(h.server[:0], s.value...) + continue + } + if caseInsensitiveCompare(s.key, strSetCookie) { + h.cookies, kv = allocArg(h.cookies) + kv.key = getCookieKey(kv.key, s.value) + kv.value = append(kv.value[:0], s.value...) + continue + } + case 't': + if caseInsensitiveCompare(s.key, strTransferEncoding) { + if len(s.value) > 0 && !bytes.Equal(s.value, strIdentity) { + h.contentLength = -1 + h.h = setArgBytes(h.h, strTransferEncoding, strChunked, argsHasValue) + } + continue + } + if caseInsensitiveCompare(s.key, strTrailer) { + err := h.SetTrailerBytes(s.value) + if err != nil { + h.connectionClose = true + return 0, err + } + continue + } + } + h.h = appendArgBytes(h.h, s.key, s.value, argsHasValue) } + if s.err != nil { h.connectionClose = true return 0, s.err @@ -3032,7 +3075,7 @@ outer: h.connectionClose = !hasHeaderValue(v, strKeepAlive) } - return len(buf) - len(s.b), err + return len(buf) - len(s.b), nil } func (h *RequestHeader) parseHeaders(buf []byte) (int, error) { @@ -3043,103 +3086,109 @@ func (h *RequestHeader) parseHeaders(buf []byte) (int, error) { var s headerScanner s.b = buf s.disableNormalizing = h.disableNormalizing - var err error -outer: for s.next() { - if len(s.key) > 0 { - for _, ch := range s.key { - if !validHeaderFieldByte(ch) { - err = fmt.Errorf("invalid header key %q", s.key) - continue outer - } - } + if len(s.key) == 0 { + h.connectionClose = true + return 0, fmt.Errorf("invalid header key %q", s.key) + } - if h.disableSpecialHeader { - h.h = appendArgBytes(h.h, s.key, s.value, argsHasValue) + for _, ch := range s.key { + if !validHeaderFieldByte(ch) { + h.connectionClose = true + return 0, fmt.Errorf("invalid header key %q", s.key) + } + } + for _, ch := range s.value { + if !validHeaderValueByte(ch) { + h.connectionClose = true + return 0, fmt.Errorf("invalid header value %q", s.value) + } + } + + if h.disableSpecialHeader { + h.h = appendArgBytes(h.h, s.key, s.value, argsHasValue) + continue + } + + switch s.key[0] | 0x20 { + case 'h': + if caseInsensitiveCompare(s.key, strHost) { + h.host = append(h.host[:0], s.value...) continue } + case 'u': + if caseInsensitiveCompare(s.key, strUserAgent) { + h.userAgent = append(h.userAgent[:0], s.value...) + continue + } + case 'c': + if caseInsensitiveCompare(s.key, strContentType) { + h.contentType = append(h.contentType[:0], s.value...) + continue + } + if caseInsensitiveCompare(s.key, strContentLength) { + if contentLengthSeen { + h.connectionClose = true + return 0, errors.New("duplicate Content-Length header") + } + contentLengthSeen = true - switch s.key[0] | 0x20 { - case 'h': - if caseInsensitiveCompare(s.key, strHost) { - h.host = append(h.host[:0], s.value...) - continue - } - case 'u': - if caseInsensitiveCompare(s.key, strUserAgent) { - h.userAgent = append(h.userAgent[:0], s.value...) - continue - } - case 'c': - if caseInsensitiveCompare(s.key, strContentType) { - h.contentType = append(h.contentType[:0], s.value...) - continue - } - if caseInsensitiveCompare(s.key, strContentLength) { - if contentLengthSeen { - return 0, errors.New("duplicate Content-Length header") - } - contentLengthSeen = true - - if h.contentLength != -1 { - var nerr error - if h.contentLength, nerr = parseContentLength(s.value); nerr != nil { - if err == nil { - err = nerr - } - h.contentLength = -2 - } else { - h.contentLengthBytes = append(h.contentLengthBytes[:0], s.value...) - } - } - continue - } - if caseInsensitiveCompare(s.key, strConnection) { - if bytes.Equal(s.value, strClose) { + if h.contentLength != -1 { + var err error + h.contentLength, err = parseContentLength(s.value) + if err != nil { + h.contentLength = -2 h.connectionClose = true - } else { - h.connectionClose = false - h.h = appendArgBytes(h.h, s.key, s.value, argsHasValue) + return 0, err } - continue + h.contentLengthBytes = append(h.contentLengthBytes[:0], s.value...) } - case 't': - if caseInsensitiveCompare(s.key, strTransferEncoding) { - isIdentity := caseInsensitiveCompare(s.value, strIdentity) - isChunked := caseInsensitiveCompare(s.value, strChunked) + continue + } + if caseInsensitiveCompare(s.key, strConnection) { + if bytes.Equal(s.value, strClose) { + h.connectionClose = true + } else { + h.connectionClose = false + h.h = appendArgBytes(h.h, s.key, s.value, argsHasValue) + } + continue + } + case 't': + if caseInsensitiveCompare(s.key, strTransferEncoding) { + isIdentity := caseInsensitiveCompare(s.value, strIdentity) + isChunked := caseInsensitiveCompare(s.value, strChunked) - if !isIdentity && !isChunked { - if h.secureErrorLogMessage { - return 0, errors.New("unsupported Transfer-Encoding") - } - return 0, fmt.Errorf("unsupported Transfer-Encoding: %q", s.value) + if !isIdentity && !isChunked { + h.connectionClose = true + if h.secureErrorLogMessage { + return 0, errors.New("unsupported Transfer-Encoding") } + return 0, fmt.Errorf("unsupported Transfer-Encoding: %q", s.value) + } - if isChunked { - h.contentLength = -1 - h.h = setArgBytes(h.h, strTransferEncoding, strChunked, argsHasValue) - } - continue + if isChunked { + h.contentLength = -1 + h.h = setArgBytes(h.h, strTransferEncoding, strChunked, argsHasValue) } - if caseInsensitiveCompare(s.key, strTrailer) { - if nerr := h.SetTrailerBytes(s.value); nerr != nil { - if err == nil { - err = nerr - } - } - continue + continue + } + if caseInsensitiveCompare(s.key, strTrailer) { + err := h.SetTrailerBytes(s.value) + if err != nil { + h.connectionClose = true + return 0, err } + continue } } h.h = appendArgBytes(h.h, s.key, s.value, argsHasValue) } - if s.err != nil && err == nil { - err = s.err - } - if err != nil { + + if s.err != nil { h.connectionClose = true - return 0, err + return 0, s.err } if h.contentLength < 0 { @@ -3187,16 +3236,15 @@ func parseContentLength(b []byte) (int, error) { } type headerScanner struct { + err error + b []byte key []byte value []byte - err error // hLen stores header subslice len hLen int - disableNormalizing bool - // by checking whether the next line contains a colon or not to tell // it's a header entry or a multi line value of current header entry. // the side effect of this operation is that we know the index of the @@ -3205,7 +3253,8 @@ type headerScanner struct { nextColon int nextNewLine int - initialized bool + disableNormalizing bool + initialized bool } func (s *headerScanner) next() bool { @@ -3253,7 +3302,7 @@ func (s *headerScanner) next() bool { s.key = s.b[:n] normalizeHeaderKey(s.key, s.disableNormalizing) n++ - for len(s.b) > n && s.b[n] == ' ' { + for len(s.b) > n && (s.b[n] == ' ' || s.b[n] == '\t') { n++ // the newline index is a relative index, and lines below trimmed `s.b` by `n`, // so the relative newline index also shifted forward. it's safe to decrease @@ -3307,13 +3356,14 @@ func (s *headerScanner) next() bool { if n > 0 && s.value[n-1] == rChar { n-- } - for n > 0 && s.value[n-1] == ' ' { + for n > 0 && (s.value[n-1] == ' ' || s.value[n-1] == '\t') { n-- } s.value = s.value[:n] if isMultiLineValue { s.value, s.b, s.hLen = normalizeHeaderValue(s.value, oldB, s.hLen) } + return true } @@ -3371,17 +3421,18 @@ func nextLine(b []byte) ([]byte, []byte, error) { return b[:n], b[nNext+1:], nil } -func initHeaderKV(kv *argsKV, key, value string, disableNormalizing bool) { - kv.key = getHeaderKeyBytes(kv, key, disableNormalizing) +func initHeaderKV(bufK, bufV []byte, key, value string, disableNormalizing bool) ([]byte, []byte) { + bufK = getHeaderKeyBytes(bufK, key, disableNormalizing) // https://tools.ietf.org/html/rfc7230#section-3.2.4 - kv.value = append(kv.value[:0], value...) - kv.value = removeNewLines(kv.value) + bufV = append(bufV[:0], value...) + bufV = removeNewLines(bufV) + return bufK, bufV } -func getHeaderKeyBytes(kv *argsKV, key string, disableNormalizing bool) []byte { - kv.key = append(kv.key[:0], key...) - normalizeHeaderKey(kv.key, disableNormalizing) - return kv.key +func getHeaderKeyBytes(bufK []byte, key string, disableNormalizing bool) []byte { + bufK = append(bufK[:0], key...) + normalizeHeaderKey(bufK, disableNormalizing) + return bufK } func normalizeHeaderValue(ov, ob []byte, headerLength int) (nv, nb []byte, nhl int) { @@ -3392,6 +3443,7 @@ func normalizeHeaderValue(ov, ob []byte, headerLength int) (nv, nb []byte, nhl i } write := 0 shrunk := 0 + once := false lineStart := false for read := 0; read < length; read++ { c := ov[read] @@ -3400,10 +3452,17 @@ func normalizeHeaderValue(ov, ob []byte, headerLength int) (nv, nb []byte, nhl i shrunk++ if c == nChar { lineStart = true + once = false } continue - case lineStart && c == '\t': - c = ' ' + case lineStart && (c == '\t' || c == ' '): + if !once { + c = ' ' + once = true + } else { + shrunk++ + continue + } default: lineStart = false } diff --git a/vendor/github.com/valyala/fasthttp/headers.go b/vendor/github.com/valyala/fasthttp/headers.go index 4f916290..e06b7349 100644 --- a/vendor/github.com/valyala/fasthttp/headers.go +++ b/vendor/github.com/valyala/fasthttp/headers.go @@ -136,7 +136,7 @@ const ( // WebSockets. HeaderSecWebSocketAccept = "Sec-WebSocket-Accept" - HeaderSecWebSocketExtensions = "Sec-WebSocket-Extensions" /* #nosec G101 */ + HeaderSecWebSocketExtensions = "Sec-WebSocket-Extensions" // #nosec G101 HeaderSecWebSocketKey = "Sec-WebSocket-Key" HeaderSecWebSocketProtocol = "Sec-WebSocket-Protocol" HeaderSecWebSocketVersion = "Sec-WebSocket-Version" diff --git a/vendor/github.com/valyala/fasthttp/http.go b/vendor/github.com/valyala/fasthttp/http.go index 75d8b6ca..f8217014 100644 --- a/vendor/github.com/valyala/fasthttp/http.go +++ b/vendor/github.com/valyala/fasthttp/http.go @@ -38,21 +38,28 @@ func SetBodySizePoolLimit(reqBodyLimit, respBodyLimit int) { type Request struct { noCopy noCopy + bodyStream io.Reader + w requestBodyWriter + body *bytebufferpool.ByteBuffer + + multipartForm *multipart.Form + multipartFormBoundary string + + postArgs Args + + bodyRaw []byte + + uri URI + // Request header. // // Copying Header by value is forbidden. Use pointer to Header instead. Header RequestHeader - uri URI - postArgs Args + // Request timeout. Usually set by DoDeadline or DoTimeout + // if <= 0, means not set + timeout time.Duration - bodyStream io.Reader - w requestBodyWriter - body *bytebufferpool.ByteBuffer - bodyRaw []byte - - multipartForm *multipart.Form - multipartFormBoundary string secureErrorLogMessage bool // Group bool members in order to reduce Request object size. @@ -65,10 +72,6 @@ type Request struct { // Client/HostClient shouldn't use this field but should depend on the uri.scheme instead. isTLS bool - // Request timeout. Usually set by DoDeadline or DoTimeout - // if <= 0, means not set - timeout time.Duration - // Use Host header (request.Header.SetHost) instead of the host from SetRequestURI, SetHost, or URI().SetHost UseHostHeader bool @@ -88,6 +91,17 @@ type Request struct { type Response struct { noCopy noCopy + bodyStream io.Reader + + // Remote TCPAddr from concurrently net.Conn. + raddr net.Addr + // Local TCPAddr from concurrently net.Conn. + laddr net.Addr + w responseBodyWriter + body *bytebufferpool.ByteBuffer + + bodyRaw []byte + // Response header. // // Copying Header by value is forbidden. Use pointer to Header instead. @@ -101,11 +115,6 @@ type Response struct { // Use SetBodyStream to set the body stream. StreamBody bool - bodyStream io.Reader - w responseBodyWriter - body *bytebufferpool.ByteBuffer - bodyRaw []byte - // Response.Read() skips reading body if set to true. // Use it for reading HEAD responses. // @@ -115,11 +124,6 @@ type Response struct { keepBodyBuffer bool secureErrorLogMessage bool - - // Remote TCPAddr from concurrently net.Conn. - raddr net.Addr - // Local TCPAddr from concurrently net.Conn. - laddr net.Addr } // SetHost sets host for the request. @@ -1435,19 +1439,14 @@ func (resp *Response) ReadLimitBody(r *bufio.Reader, maxBodySize int) error { if !resp.mustSkipBody() { err = resp.ReadBody(r, maxBodySize) if err != nil { - if isConnectionReset(err) { - return nil - } return err } } - if resp.Header.ContentLength() == -1 && !resp.StreamBody { + // A response without a body can't have trailers. + if resp.Header.ContentLength() == -1 && !resp.StreamBody && !resp.mustSkipBody() { err = resp.Header.ReadTrailer(r) if err != nil && err != io.EOF { - if isConnectionReset(err) { - return nil - } return err } } @@ -1596,10 +1595,10 @@ func (req *Request) Write(w *bufio.Writer) error { nl := len(uri.username) + len(uri.password) + 1 nb := nl + len(strBasicSpace) tl := nb + base64.StdEncoding.EncodedLen(nl) - if tl > cap(req.Header.bufKV.value) { - req.Header.bufKV.value = make([]byte, 0, tl) + if tl > cap(req.Header.bufV) { + req.Header.bufV = make([]byte, 0, tl) } - buf := req.Header.bufKV.value[:0] + buf := req.Header.bufV[:0] buf = append(buf, uri.username...) buf = append(buf, strColon...) buf = append(buf, uri.password...) @@ -2279,12 +2278,13 @@ func readBodyWithStreaming(r *bufio.Reader, contentLength, maxBodySize int, dst readN = 8 * 1024 } - if contentLength >= 0 && maxBodySize >= contentLength { - b, err = appendBodyFixedSize(r, dst, readN) - } else { - b, err = readBodyIdentity(r, readN, dst) - } - + // A fixed-length pre-read function should be used here; otherwise, + // it may read content beyond the request body into areas outside + // the br buffer. This could affect the handling of the next request + // in the br buffer, if there is one. The original two branches can + // be handled with this single branch. by the way, + // fix issue: https://github.com/valyala/fasthttp/issues/1816 + b, err = appendBodyFixedSize(r, dst, readN) if err != nil { return b, err } diff --git a/vendor/github.com/valyala/fasthttp/lbclient.go b/vendor/github.com/valyala/fasthttp/lbclient.go index a9a40a2b..690f4d0c 100644 --- a/vendor/github.com/valyala/fasthttp/lbclient.go +++ b/vendor/github.com/valyala/fasthttp/lbclient.go @@ -27,10 +27,6 @@ type BalancingClient interface { type LBClient struct { noCopy noCopy - // Clients must contain non-zero clients list. - // Incoming requests are balanced among these clients. - Clients []BalancingClient - // HealthCheck is a callback called after each request. // // The request, response and the error returned by the client @@ -42,15 +38,20 @@ type LBClient struct { // By default HealthCheck returns false if err != nil. HealthCheck func(req *Request, resp *Response, err error) bool + // Clients must contain non-zero clients list. + // Incoming requests are balanced among these clients. + Clients []BalancingClient + + cs []*lbClient + // Timeout is the request timeout used when calling LBClient.Do. // // DefaultLBClientTimeout is used by default. Timeout time.Duration - cs []*lbClient + mu sync.RWMutex once sync.Once - mu sync.RWMutex } // DefaultLBClientTimeout is the default request timeout used by LBClient @@ -138,7 +139,7 @@ func (cc *LBClient) get() *lbClient { minT := atomic.LoadUint64(&minC.total) for _, c := range cs[1:] { n := c.PendingRequests() - t := atomic.LoadUint64(&c.total) /* #nosec G601 */ + t := atomic.LoadUint64(&c.total) if n < minN || (n == minN && t < minT) { minC = c minN = n diff --git a/vendor/github.com/valyala/fasthttp/peripconn.go b/vendor/github.com/valyala/fasthttp/peripconn.go index 46bddbf8..d09aaf83 100644 --- a/vendor/github.com/valyala/fasthttp/peripconn.go +++ b/vendor/github.com/valyala/fasthttp/peripconn.go @@ -9,8 +9,8 @@ import ( type perIPConnCounter struct { perIPConnPool sync.Pool perIPTLSConnPool sync.Pool - lock sync.Mutex m map[uint32]int + lock sync.Mutex } func (cc *perIPConnCounter) Register(ip uint32) int { @@ -41,29 +41,31 @@ func (cc *perIPConnCounter) Unregister(ip uint32) { type perIPConn struct { net.Conn - ip uint32 perIPConnCounter *perIPConnCounter + + ip uint32 } type perIPTLSConn struct { *tls.Conn - ip uint32 perIPConnCounter *perIPConnCounter + + ip uint32 } func acquirePerIPConn(conn net.Conn, ip uint32, counter *perIPConnCounter) net.Conn { - if tlcConn, ok := conn.(*tls.Conn); ok { + if tlsConn, ok := conn.(*tls.Conn); ok { v := counter.perIPTLSConnPool.Get() if v == nil { return &perIPTLSConn{ perIPConnCounter: counter, - Conn: tlcConn, + Conn: tlsConn, ip: ip, } } - c := v.(*perIPConn) - c.Conn = conn + c := v.(*perIPTLSConn) + c.Conn = tlsConn c.ip = ip return c } diff --git a/vendor/github.com/valyala/fasthttp/reuseport/reuseport.go b/vendor/github.com/valyala/fasthttp/reuseport/reuseport.go index 8ad9b06c..efe21417 100644 --- a/vendor/github.com/valyala/fasthttp/reuseport/reuseport.go +++ b/vendor/github.com/valyala/fasthttp/reuseport/reuseport.go @@ -34,7 +34,7 @@ import ( func Listen(network, addr string) (net.Listener, error) { ln, err := cfg.NewListener(network, addr) if err != nil && strings.Contains(err.Error(), "SO_REUSEPORT") { - return nil, &ErrNoReusePort{err} + return nil, &ErrNoReusePort{err: err} } return ln, err } diff --git a/vendor/github.com/valyala/fasthttp/round2_64.go b/vendor/github.com/valyala/fasthttp/round2_64.go index a05df232..05e88df2 100644 --- a/vendor/github.com/valyala/fasthttp/round2_64.go +++ b/vendor/github.com/valyala/fasthttp/round2_64.go @@ -12,12 +12,12 @@ func roundUpForSliceCap(n int) int { return n } - x := uint64(n - 1) + x := uint64(n - 1) // #nosec G115 x |= x >> 1 x |= x >> 2 x |= x >> 4 x |= x >> 8 x |= x >> 16 - return int(x + 1) + return int(x + 1) // #nosec G115 } diff --git a/vendor/github.com/valyala/fasthttp/server.go b/vendor/github.com/valyala/fasthttp/server.go index fe194a55..8cd6fef5 100644 --- a/vendor/github.com/valyala/fasthttp/server.go +++ b/vendor/github.com/valyala/fasthttp/server.go @@ -148,6 +148,18 @@ type ServeHandler func(c net.Conn) error type Server struct { noCopy noCopy + perIPConnCounter perIPConnCounter + + ctxPool sync.Pool + readerPool sync.Pool + writerPool sync.Pool + hijackConnPool sync.Pool + + // Logger, which is used by RequestCtx.Logger(). + // + // By default standard logger from log package is used. + Logger Logger + // Handler for processing incoming requests. // // Take into account that no `panic` recovery is done by `fasthttp` (thus any `panic` will take down the entire server). @@ -181,11 +193,43 @@ type Server struct { // like they are normal requests. ContinueHandler func(header *RequestHeader) bool + // ConnState specifies an optional callback function that is + // called when a client connection changes state. See the + // ConnState type and associated constants for details. + ConnState func(net.Conn, ConnState) + + // TLSConfig optionally provides a TLS configuration for use + // by ServeTLS, ServeTLSEmbed, ListenAndServeTLS, ListenAndServeTLSEmbed, + // AppendCert, AppendCertEmbed and NextProto. + // + // Note that this value is cloned by ServeTLS, ServeTLSEmbed, ListenAndServeTLS + // and ListenAndServeTLSEmbed, so it's not possible to modify the configuration + // with methods like tls.Config.SetSessionTicketKeys. + // To use SetSessionTicketKeys, use Server.Serve with a TLS Listener + // instead. + TLSConfig *tls.Config + + // FormValueFunc, which is used by RequestCtx.FormValue and support for customizing + // the behaviour of the RequestCtx.FormValue function. + // + // NetHttpFormValueFunc gives a FormValueFunc func implementation that is consistent with net/http. + FormValueFunc FormValueFunc + + nextProtos map[string]ServeHandler + + concurrencyCh chan struct{} + + idleConns map[net.Conn]time.Time + done chan struct{} + // Server name for sending in response headers. // // Default server name is used if left blank. Name string + // We need to know our listeners and idle connections so we can close them in Shutdown(). + ln []net.Listener + // The maximum number of concurrent connections the server may serve. // // DefaultConcurrency is used if not set. @@ -262,6 +306,21 @@ type Server struct { // Request body size is limited by DefaultMaxRequestBodySize by default. MaxRequestBodySize int + // SleepWhenConcurrencyLimitsExceeded is a duration to be slept of if + // the concurrency limit in exceeded (default [when is 0]: don't sleep + // and accept new connections immediately). + SleepWhenConcurrencyLimitsExceeded time.Duration + + idleConnsMu sync.Mutex + + mu sync.Mutex + + concurrency uint32 + open int32 + stop int32 + + rejectedRequestsCount uint32 + // Whether to disable keep-alive connections. // // The server will close all the incoming connections after sending @@ -340,11 +399,6 @@ type Server struct { // * cONTENT-lenGTH -> Content-Length DisableHeaderNamesNormalizing bool - // SleepWhenConcurrencyLimitsExceeded is a duration to be slept of if - // the concurrency limit in exceeded (default [when is 0]: don't sleep - // and accept new connections immediately). - SleepWhenConcurrencyLimitsExceeded time.Duration - // NoDefaultServerHeader, when set to true, causes the default Server header // to be excluded from the Response. // @@ -382,57 +436,6 @@ type Server struct { // and calls the handler sooner when given body is // larger than the current limit. StreamRequestBody bool - - // ConnState specifies an optional callback function that is - // called when a client connection changes state. See the - // ConnState type and associated constants for details. - ConnState func(net.Conn, ConnState) - - // Logger, which is used by RequestCtx.Logger(). - // - // By default standard logger from log package is used. - Logger Logger - - // TLSConfig optionally provides a TLS configuration for use - // by ServeTLS, ServeTLSEmbed, ListenAndServeTLS, ListenAndServeTLSEmbed, - // AppendCert, AppendCertEmbed and NextProto. - // - // Note that this value is cloned by ServeTLS, ServeTLSEmbed, ListenAndServeTLS - // and ListenAndServeTLSEmbed, so it's not possible to modify the configuration - // with methods like tls.Config.SetSessionTicketKeys. - // To use SetSessionTicketKeys, use Server.Serve with a TLS Listener - // instead. - TLSConfig *tls.Config - - // FormValueFunc, which is used by RequestCtx.FormValue and support for customizing - // the behaviour of the RequestCtx.FormValue function. - // - // NetHttpFormValueFunc gives a FormValueFunc func implementation that is consistent with net/http. - FormValueFunc FormValueFunc - - nextProtos map[string]ServeHandler - - concurrency uint32 - concurrencyCh chan struct{} - perIPConnCounter perIPConnCounter - - ctxPool sync.Pool - readerPool sync.Pool - writerPool sync.Pool - hijackConnPool sync.Pool - - // We need to know our listeners and idle connections so we can close them in Shutdown(). - ln []net.Listener - - idleConns map[net.Conn]time.Time - idleConnsMu sync.Mutex - - mu sync.Mutex - open int32 - stop int32 - done chan struct{} - - rejectedRequestsCount uint32 } // TimeoutHandler creates RequestHandler, which returns StatusRequestTimeout @@ -585,37 +588,39 @@ func CompressHandlerBrotliLevel(h RequestHandler, brotliLevel, otherLevel int) R type RequestCtx struct { noCopy noCopy - // Incoming request. - // - // Copying Request by value is forbidden. Use pointer to Request instead. - Request Request - // Outgoing response. // // Copying Response by value is forbidden. Use pointer to Response instead. Response Response - userValues userData - - connID uint64 - connRequestNum uint64 - connTime time.Time - remoteAddr net.Addr + connTime time.Time time time.Time - logger ctxLogger - s *Server - c net.Conn - fbr firstByteReader + logger ctxLogger + remoteAddr net.Addr + + c net.Conn + s *Server timeoutResponse *Response timeoutCh chan struct{} timeoutTimer *time.Timer - hijackHandler HijackHandler + hijackHandler HijackHandler + formValueFunc FormValueFunc + fbr firstByteReader + + userValues userData + + // Incoming request. + // + // Copying Request by value is forbidden. Use pointer to Request instead. + Request Request + + connID uint64 + connRequestNum uint64 hijackNoResponse bool - formValueFunc FormValueFunc } // HijackHandler must process the hijacked connection c. @@ -1592,14 +1597,14 @@ func (s *Server) NextProto(key string, nph ServeHandler) { func (s *Server) getNextProto(c net.Conn) (proto string, err error) { if tlsConn, ok := c.(connTLSer); ok { if s.ReadTimeout > 0 { - if err := c.SetReadDeadline(time.Now().Add(s.ReadTimeout)); err != nil { - panic(fmt.Sprintf("BUG: error in SetReadDeadline(%v): %v", s.ReadTimeout, err)) + if err = c.SetReadDeadline(time.Now().Add(s.ReadTimeout)); err != nil { + return } } if s.WriteTimeout > 0 { - if err := c.SetWriteDeadline(time.Now().Add(s.WriteTimeout)); err != nil { - panic(fmt.Sprintf("BUG: error in SetWriteDeadline(%v): %v", s.WriteTimeout, err)) + if err = c.SetWriteDeadline(time.Now().Add(s.WriteTimeout)); err != nil { + return } } @@ -2029,8 +2034,8 @@ func (s *Server) ServeConn(c net.Conn) error { c = pic } - n := atomic.AddUint32(&s.concurrency, 1) - if n > uint32(s.getConcurrency()) { + n := int(atomic.AddUint32(&s.concurrency, 1)) // #nosec G115 + if n > s.getConcurrency() { atomic.AddUint32(&s.concurrency, ^uint32(0)) s.writeFastError(c, StatusServiceUnavailable, "The connection cannot be served because Server.Concurrency limit exceeded") c.Close() @@ -2132,8 +2137,8 @@ func (s *Server) serveConn(c net.Conn) (err error) { // Remove read or write deadlines that might have previously been set. // The next handler is responsible for setting its own deadlines. if s.ReadTimeout > 0 || s.WriteTimeout > 0 { - if err := c.SetDeadline(zeroTime); err != nil { - panic(fmt.Sprintf("BUG: error in SetDeadline(zeroTime): %v", err)) + if err = c.SetDeadline(zeroTime); err != nil { + return } } @@ -2172,7 +2177,7 @@ func (s *Server) serveConn(c net.Conn) (err error) { // If this is a keep-alive connection set the idle timeout. if connRequestNum > 1 { if d := s.idleTimeout(); d > 0 { - if err := c.SetReadDeadline(time.Now().Add(d)); err != nil { + if err = c.SetReadDeadline(time.Now().Add(d)); err != nil { break } } @@ -2192,7 +2197,7 @@ func (s *Server) serveConn(c net.Conn) (err error) { // If reading from a keep-alive connection returns nothing it means // the connection was closed (either timeout or from the other side). if err != io.EOF { - err = ErrNothingRead{err} + err = ErrNothingRead{error: err} } } } @@ -2216,13 +2221,13 @@ func (s *Server) serveConn(c net.Conn) (err error) { s.setState(c, StateActive) if s.ReadTimeout > 0 { - if err := c.SetReadDeadline(time.Now().Add(s.ReadTimeout)); err != nil { + if err = c.SetReadDeadline(time.Now().Add(s.ReadTimeout)); err != nil { break } } else if s.IdleTimeout > 0 && connRequestNum > 1 { // If this was an idle connection and the server has an IdleTimeout but // no ReadTimeout then we should remove the ReadTimeout. - if err := c.SetReadDeadline(zeroTime); err != nil { + if err = c.SetReadDeadline(zeroTime); err != nil { break } } @@ -2256,8 +2261,8 @@ func (s *Server) serveConn(c net.Conn) (err error) { reqConf := onHdrRecv(&ctx.Request.Header) if reqConf.ReadTimeout > 0 { deadline := time.Now().Add(reqConf.ReadTimeout) - if err := c.SetReadDeadline(deadline); err != nil { - panic(fmt.Sprintf("BUG: error in SetReadDeadline(%v): %v", deadline, err)) + if err = c.SetReadDeadline(deadline); err != nil { + break } } switch { @@ -2281,8 +2286,9 @@ func (s *Server) serveConn(c net.Conn) (err error) { err = ctx.Request.readLimitBody(br, maxRequestBodySize, s.GetOnly, !s.DisablePreParseMultipartForm) } } - - if (s.ReduceMemoryUsage && br.Buffered() == 0) || err != nil { + // When StreamRequestBody is set to true, we cannot safely release br. + // For example, when using chunked encoding, it's possible that br has only read the request headers. + if (!s.StreamRequestBody && s.ReduceMemoryUsage && br.Buffered() == 0) || err != nil { releaseReader(s, br) br = nil } @@ -2353,7 +2359,7 @@ func (s *Server) serveConn(c net.Conn) (err error) { } else { err = ctx.Request.ContinueReadBody(br, maxRequestBodySize, !s.DisablePreParseMultipartForm) } - if (s.ReduceMemoryUsage && br.Buffered() == 0) || err != nil { + if (!s.StreamRequestBody && s.ReduceMemoryUsage && br.Buffered() == 0) || err != nil { releaseReader(s, br) br = nil } @@ -2396,20 +2402,20 @@ func (s *Server) serveConn(c net.Conn) (err error) { ctx.hijackNoResponse = false if writeTimeout > 0 { - if err := c.SetWriteDeadline(time.Now().Add(writeTimeout)); err != nil { - panic(fmt.Sprintf("BUG: error in SetWriteDeadline(%v): %v", writeTimeout, err)) + if err = c.SetWriteDeadline(time.Now().Add(writeTimeout)); err != nil { + break } previousWriteTimeout = writeTimeout } else if previousWriteTimeout > 0 { // We don't want a write timeout but we previously set one, remove it. - if err := c.SetWriteDeadline(zeroTime); err != nil { - panic(fmt.Sprintf("BUG: error in SetWriteDeadline(zeroTime): %v", err)) + if err = c.SetWriteDeadline(zeroTime); err != nil { + break } previousWriteTimeout = 0 } connectionClose = connectionClose || - (s.MaxRequestsPerConn > 0 && connRequestNum >= uint64(s.MaxRequestsPerConn)) || + (s.MaxRequestsPerConn > 0 && connRequestNum >= uint64(s.MaxRequestsPerConn)) || // #nosec G115 ctx.Response.Header.ConnectionClose() || (s.CloseOnShutdown && atomic.LoadInt32(&s.stop) == 1) if connectionClose { @@ -2743,7 +2749,15 @@ func (ctx *RequestCtx) Deadline() (deadline time.Time, ok bool) { // Note: Because creating a new channel for every request is just too expensive, so // RequestCtx.s.done is only closed when the server is shutting down. func (ctx *RequestCtx) Done() <-chan struct{} { - return ctx.s.done + // fix use new variables to prevent panic caused by modifying the original done chan to nil. + done := ctx.s.done + + if done == nil { + done = make(chan struct{}, 1) + done <- struct{}{} + return done + } + return done } // Err returns a non-nil error value after Done is closed, @@ -2757,7 +2771,7 @@ func (ctx *RequestCtx) Done() <-chan struct{} { // RequestCtx.s.done is only closed when the server is shutting down. func (ctx *RequestCtx) Err() error { select { - case <-ctx.s.done: + case <-ctx.Done(): return context.Canceled default: return nil @@ -2959,7 +2973,7 @@ const ( StateClosed ) -var stateName = map[ConnState]string{ +var stateName = []string{ StateNew: "new", StateActive: "active", StateIdle: "idle", diff --git a/vendor/github.com/valyala/fasthttp/stackless/writer.go b/vendor/github.com/valyala/fasthttp/stackless/writer.go index 28dbedf5..2a6841ac 100644 --- a/vendor/github.com/valyala/fasthttp/stackless/writer.go +++ b/vendor/github.com/valyala/fasthttp/stackless/writer.go @@ -41,12 +41,13 @@ func NewWriter(dstW io.Writer, newWriter NewWriterFunc) Writer { type writer struct { dstW io.Writer zw Writer - xw xWriter err error - n int + xw xWriter + + p []byte + n int - p []byte op op } diff --git a/vendor/github.com/valyala/fasthttp/tcp.go b/vendor/github.com/valyala/fasthttp/tcp.go deleted file mode 100644 index 7e804374..00000000 --- a/vendor/github.com/valyala/fasthttp/tcp.go +++ /dev/null @@ -1,12 +0,0 @@ -//go:build !windows - -package fasthttp - -import ( - "errors" - "syscall" -) - -func isConnectionReset(err error) bool { - return errors.Is(err, syscall.ECONNRESET) -} diff --git a/vendor/github.com/valyala/fasthttp/tcp_windows.go b/vendor/github.com/valyala/fasthttp/tcp_windows.go deleted file mode 100644 index d71950b9..00000000 --- a/vendor/github.com/valyala/fasthttp/tcp_windows.go +++ /dev/null @@ -1,10 +0,0 @@ -package fasthttp - -import ( - "errors" - "syscall" -) - -func isConnectionReset(err error) bool { - return errors.Is(err, syscall.WSAECONNRESET) -} diff --git a/vendor/github.com/valyala/fasthttp/tcpdialer.go b/vendor/github.com/valyala/fasthttp/tcpdialer.go index e5f06bd0..9b648daf 100644 --- a/vendor/github.com/valyala/fasthttp/tcpdialer.go +++ b/vendor/github.com/valyala/fasthttp/tcpdialer.go @@ -126,19 +126,6 @@ type Resolver interface { // TCPDialer contains options to control a group of Dial calls. type TCPDialer struct { - // Concurrency controls the maximum number of concurrent Dials - // that can be performed using this object. - // Setting this to 0 means unlimited. - // - // WARNING: This can only be changed before the first Dial. - // Changes made after the first Dial will not affect anything. - Concurrency int - - // LocalAddr is the local address to use when dialing an - // address. - // If nil, a local address is automatically chosen. - LocalAddr *net.TCPAddr - // This may be used to override DNS resolving policy, like this: // var dialer = &fasthttp.TCPDialer{ // Resolver: &net.Resolver{ @@ -152,16 +139,30 @@ type TCPDialer struct { // } Resolver Resolver - // DisableDNSResolution may be used to disable DNS resolution - DisableDNSResolution bool - // DNSCacheDuration may be used to override the default DNS cache duration (DefaultDNSCacheDuration) - DNSCacheDuration time.Duration - - tcpAddrsMap sync.Map + // LocalAddr is the local address to use when dialing an + // address. + // If nil, a local address is automatically chosen. + LocalAddr *net.TCPAddr concurrencyCh chan struct{} + tcpAddrsMap sync.Map + + // Concurrency controls the maximum number of concurrent Dials + // that can be performed using this object. + // Setting this to 0 means unlimited. + // + // WARNING: This can only be changed before the first Dial. + // Changes made after the first Dial will not affect anything. + Concurrency int + + // DNSCacheDuration may be used to override the default DNS cache duration (DefaultDNSCacheDuration) + DNSCacheDuration time.Duration + once sync.Once + + // DisableDNSResolution may be used to disable DNS resolution + DisableDNSResolution bool } // Dial dials the given TCP addr using tcp4. @@ -297,7 +298,7 @@ func (d *TCPDialer) dial(addr string, dualStack bool, timeout time.Duration) (ne return nil, err } var conn net.Conn - n := uint32(len(addrs)) + n := uint32(len(addrs)) // #nosec G115 for n > 0 { conn, err = d.tryDial(network, addrs[idx%n].String(), deadline, d.concurrencyCh) if err == nil { @@ -371,8 +372,8 @@ var ErrDialTimeout = errors.New("dialing to the given TCP address timed out") // upstream = dialErr.Upstream // 34.206.39.153:80 // } type ErrDialWithUpstream struct { - Upstream string wrapErr error + Upstream string } func (e *ErrDialWithUpstream) Error() string { @@ -395,11 +396,11 @@ func wrapDialWithUpstream(err error, upstream string) error { const DefaultDialTimeout = 3 * time.Second type tcpAddrEntry struct { - addrs []net.TCPAddr - addrsIdx uint32 - - pending int32 resolveTime time.Time + addrs []net.TCPAddr + addrsIdx uint32 + + pending int32 } // DefaultDNSCacheDuration is the duration for caching resolved TCP addresses diff --git a/vendor/github.com/valyala/fasthttp/uri.go b/vendor/github.com/valyala/fasthttp/uri.go index 19ceb694..7ddadfcb 100644 --- a/vendor/github.com/valyala/fasthttp/uri.go +++ b/vendor/github.com/valyala/fasthttp/uri.go @@ -42,6 +42,8 @@ var uriPool = &sync.Pool{ type URI struct { noCopy noCopy + queryArgs Args + pathOriginal []byte scheme []byte path []byte @@ -49,7 +51,11 @@ type URI struct { hash []byte host []byte - queryArgs Args + fullURI []byte + requestURI []byte + + username []byte + password []byte parsedQueryArgs bool // Path values are sent as-is without normalization. @@ -60,12 +66,6 @@ type URI struct { // By default path values are normalized, i.e. // extra slashes are removed, special characters are encoded. DisablePathNormalizing bool - - fullURI []byte - requestURI []byte - - username []byte - password []byte } // CopyTo copies uri contents to dst. diff --git a/vendor/github.com/valyala/fasthttp/userdata.go b/vendor/github.com/valyala/fasthttp/userdata.go index 38cca864..20366b63 100644 --- a/vendor/github.com/valyala/fasthttp/userdata.go +++ b/vendor/github.com/valyala/fasthttp/userdata.go @@ -77,6 +77,8 @@ func (d *userData) Reset() { if vc, ok := v.(io.Closer); ok { vc.Close() } + (*d)[i].value = nil + (*d)[i].key = nil } *d = (*d)[:0] } @@ -92,6 +94,7 @@ func (d *userData) Remove(key any) { if kv.key == key { n-- args[i], args[n] = args[n], args[i] + args[n].key = nil args[n].value = nil args = args[:n] *d = args diff --git a/vendor/github.com/valyala/fasthttp/workerpool.go b/vendor/github.com/valyala/fasthttp/workerpool.go index 235eec10..9ecd9481 100644 --- a/vendor/github.com/valyala/fasthttp/workerpool.go +++ b/vendor/github.com/valyala/fasthttp/workerpool.go @@ -15,29 +15,30 @@ import ( // // Such a scheme keeps CPU caches hot (in theory). type workerPool struct { + workerChanPool sync.Pool + + Logger Logger + // Function for serving server connections. // It must leave c unclosed. WorkerFunc ServeHandler - MaxWorkersCount int + stopCh chan struct{} - LogAllErrors bool - - MaxIdleWorkerDuration time.Duration - - Logger Logger - - lock sync.Mutex - workersCount int - mustStop bool + connState func(net.Conn, ConnState) ready []*workerChan - stopCh chan struct{} + MaxWorkersCount int - workerChanPool sync.Pool + MaxIdleWorkerDuration time.Duration - connState func(net.Conn, ConnState) + workersCount int + + lock sync.Mutex + + LogAllErrors bool + mustStop bool } type workerChan struct { diff --git a/vendor/github.com/valyala/fasthttp/zstd.go b/vendor/github.com/valyala/fasthttp/zstd.go index 226a1263..0ee2cca1 100644 --- a/vendor/github.com/valyala/fasthttp/zstd.go +++ b/vendor/github.com/valyala/fasthttp/zstd.go @@ -102,7 +102,7 @@ func releaseRealZstdWrter(zw *zstd.Encoder, level int) { } func AppendZstdBytesLevel(dst, src []byte, level int) []byte { - w := &byteSliceWriter{dst} + w := &byteSliceWriter{b: dst} WriteZstdLevel(w, src, level) //nolint:errcheck return w.b } @@ -155,7 +155,7 @@ func AppendZstdBytes(dst, src []byte) []byte { // WriteUnzstd writes unzstd p to w and returns the number of uncompressed // bytes written to w. func WriteUnzstd(w io.Writer, p []byte) (int, error) { - r := &byteSliceReader{p} + r := &byteSliceReader{b: p} zr, err := acquireZstdReader(r) if err != nil { return 0, err @@ -171,7 +171,7 @@ func WriteUnzstd(w io.Writer, p []byte) (int, error) { // AppendUnzstdBytes appends unzstd src to dst and returns the resulting dst. func AppendUnzstdBytes(dst, src []byte) ([]byte, error) { - w := &byteSliceWriter{dst} + w := &byteSliceWriter{b: dst} _, err := WriteUnzstd(w, src) return w.b, err } diff --git a/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/Makefile b/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/Makefile index 72933d4f..a3f18843 100644 --- a/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/Makefile +++ b/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/Makefile @@ -2,13 +2,13 @@ test: clear go fmt ./... - go test -timeout=30s -shuffle=on -vet=all -race -count 1 -test.shuffle on -coverprofile cover.out -covermode atomic ./... ./data_packer/... ./sync_confirm/... ./sync_global/... ./sync_types/... + go test -vet=all -race -count 1 -test.shuffle on -coverprofile cover.out -covermode atomic ./... ./data_packer/... ./sync_confirm/... ./sync_global/... ./sync_types/... go tool cover -func=cover.out ## mod mod: clear - go mod tidy -compat=1.20 + go mod tidy -compat=1.22 go mod vendor go fmt ./... diff --git a/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/README.md b/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/README.md index 9a2021e0..e837e071 100644 --- a/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/README.md +++ b/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/README.md @@ -1,96 +1,78 @@ # sync_exchange - Пакет для синхронного обмена данными через шину (NATS). ## Принцип обмена - -Сервис пишет в определённый топик шины, подписывается на другой топик (генерируется исходя из названия сервиса и идентификатора пакета) и ожидает сообщение. +Сервис пишет в определённый топик шины, подписывается на другой топик (генерируется исходя из названия сервиса и идентификатора пакета) и ожидает сообщение. Слушающий сервис вычитывает топик, после обработки пакета отправляет ответ. ## Команды для формирования пакетов - ### SyncPackageToJSON - View SyncPackage as JSON string ### SyncPackageFromJSON - Make SyncPackage from JSON string ### MakeSyncCommand - Create SyncPackage as command package ### MakeSyncResult - Create SyncPackage as result package ### MakeSyncError - Create SyncPackage as error package ## Команды для обмена - ### InitSyncExchange - Функция инициализации подключения к шине ### DeInitSyncExchange - Функция деинициализации подключения к шине ### SendMessage - Отправка сообщения в шину без ожидания ответа ### WaitMessage - Ожидание сообщения из определённого топика ### SendRequest - Отправка запроса с ожиданием ответа ### SendResponse - Отправка ответа на запрос ## Пример использования - ```go package main import ( - "fmt" - "log" - "gitlab.aescorp.ru/dsp_dev/test_area/test_claim/pkg/sync_exchange" - "gitlab.aescorp.ru/dsp_dev/test_area/test_claim/pkg/sync_exchange/sync_types" + "fmt" + "log" + "gitlab.aescorp.ru/dsp_dev/test_area/test_claim/pkg/sync_exchange" + "gitlab.aescorp.ru/dsp_dev/test_area/test_claim/pkg/sync_exchange/sync_types" ) func main() { - err := sync_exchange.InitSyncExchange("localhost", "service_name") - if err != nil { - log.Fatal(err) - } + err := sync_exchange.InitSyncExchange("localhost", "service_name") + if err != nil { + log.Fatal(err) + } - params := make(map[string]string) - params["something"] = "sometime" - pack := sync_types.MakeSyncCommand("command_1", params) - resp, err := sync_exchange.SendRequest("service_new", pack, 10000) + params := make(map[string]string) + params["something"] = "sometime" + pack := sync_types.MakeSyncCommand("command_1", params) + resp, err := sync_exchange.SendRequest("service_new", pack, 10000) - fmt.Println(resp.Body.Result["state"]) + fmt.Println(resp.Body.Result["state"]) - err = sync_exchange.DeInitSyncExchange() - if err != nil { - log.Fatal(err) - } + err = sync_exchange.DeInitSyncExchange() + if err != nil { + log.Fatal(err) + } } ``` ## Формат пакетов - ### Команда MakeSyncCommand - ```json { "head": { @@ -114,9 +96,7 @@ func main() { } } ``` - ### Команда MakeSyncResult - ```json { "head": { @@ -139,9 +119,7 @@ func main() { } } ``` - ### Команда MakeSyncError - ```json { "head": { diff --git a/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/bus_conn/bus_conn.go b/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/bus_conn/bus_conn.go deleted file mode 100644 index 800b8be5..00000000 --- a/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/bus_conn/bus_conn.go +++ /dev/null @@ -1,33 +0,0 @@ -// package bus_conn -- подключение к локальной шине -package bus_conn - -import ( - "sync" -) - -// BusConn -- подключение к локальной шине -type BusConn struct { - isConn bool // Признак подключения шины - block sync.RWMutex -} - -// Set -- устанавливает состояние подключения -func (sf *BusConn) Set() { - sf.block.Lock() - defer sf.block.Unlock() - sf.isConn = true -} - -// Reset -- сбрасывает состояние подключения -func (sf *BusConn) Reset() { - sf.block.Lock() - defer sf.block.Unlock() - sf.isConn = false -} - -// IsConnect -- возвращает признак подключения -func (sf *BusConn) IsConnect() bool { - sf.block.RLock() - defer sf.block.RUnlock() - return sf.isConn -} diff --git a/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/cons/cons.go b/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/cons/cons.go deleted file mode 100644 index c820dc14..00000000 --- a/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/cons/cons.go +++ /dev/null @@ -1,6 +0,0 @@ -package cons - -const ( - // StorePath -- путь к хранилищу - StorePath = "./store" -) diff --git a/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/liveness/liveness.go b/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/liveness/liveness.go new file mode 100644 index 00000000..9a6567e2 --- /dev/null +++ b/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/liveness/liveness.go @@ -0,0 +1,25 @@ +package liveness + +import ( + "fmt" + "github.com/nats-io/nats.go" + "log" + "time" +) + +func RunLiveness(nc *nats.Conn, service string, version string) { + topic := "sync_exchange.liveness" + + data := fmt.Sprintf("{%q: %q, %q: %q}", + "service", service, "version", version) + + for { + err := nc.Publish(topic, []byte(data)) + if err != nil { + log.Printf("[ERROR] RunLiveness, data: %v, message: %v", data, err) + return + } + + time.Sleep(30 * time.Second) + } +} diff --git a/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/sync_exchange.go b/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/sync_exchange.go index 68c795cb..19d1d965 100644 --- a/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/sync_exchange.go +++ b/vendor/gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/sync_exchange.go @@ -9,9 +9,8 @@ import ( "github.com/nats-io/nats.go" "github.com/syndtr/goleveldb/leveldb" - "gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/bus_conn" - "gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/cons" "gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/data_packer" + "gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/liveness" "gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/sync_confirm" "gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/sync_global" "gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/sync_types" @@ -20,11 +19,12 @@ import ( // PRIVATE var ( - nc *nats.Conn - packer *data_packer.DataPacker - db *leveldb.DB - block1 sync.Mutex - busConn bus_conn.BusConn + nc *nats.Conn + packer *data_packer.DataPacker + db *leveldb.DB + block sync.RWMutex + block1 sync.Mutex + isInited bool ) func requestTopic(topic string) string { @@ -35,6 +35,18 @@ func responseTopic(pack *sync_types.SyncPackage) string { return sync_global.SyncRoot + pack.Head.Sender + "/" + pack.Head.NetID + "/" } +func setIsInited(b bool) { + block.Lock() + defer block.Unlock() + isInited = b +} + +func getIsInited() bool { + block.RLock() + defer block.RUnlock() + return isInited +} + // doSendMessage Непосредственно отправка сообщения func doSendMessage(topic string, pack sync_types.SyncPackage, wait bool) error { // block1.Lock() @@ -140,14 +152,15 @@ func doWaitMessage(topic string, callback Callback) error { type Callback func(pack *sync_types.SyncPackage) // InitSyncExchange Функция инициализации подключения к шине -func InitSyncExchange(url string, serviceName string) error { - if busConn.IsConnect() { - log.Println("InitSyncExchange(): already inited") - return nil - } +func InitSyncExchange(url string, serviceName string, version string) error { block1.Lock() defer block1.Unlock() + if getIsInited() { + log.Println("[INFO] InitSyncExchange, already inited") + return nil + } + err := sync_global.SetSyncService(serviceName) if err != nil { return fmt.Errorf("InitSyncExchange, SetSyncService, error: %v", err) @@ -170,13 +183,19 @@ func InitSyncExchange(url string, serviceName string) error { log.Printf("[INFO] InitSyncExchange, NATS connection status: %v\n", status.String()) } + // TODO Вынести путь в параметр функции + storePath := "./store" // TODO Тут обработать не подтверждённые пакеты - _db, err := sync_confirm.InitConfirm(cons.StorePath) + _db, err := sync_confirm.InitConfirm(storePath) if err != nil { - return fmt.Errorf("InitSyncExchange, InitConfirm, path: %q, error: %v", cons.StorePath, err) + return fmt.Errorf("InitSyncExchange, InitConfirm, path: %q, error: %v", storePath, err) } db = _db - busConn.Set() + + setIsInited(true) + + go liveness.RunLiveness(nc, serviceName, version) + return nil } @@ -185,10 +204,10 @@ func DeInitSyncExchange() error { block1.Lock() defer block1.Unlock() - if !busConn.IsConnect() { - return fmt.Errorf("DeInitSyncExchange(): not inited") + if !getIsInited() { + return fmt.Errorf("DeInitSyncExchange, not inited") } - defer busConn.Reset() + defer setIsInited(false) nc.Close() @@ -209,8 +228,8 @@ func SendMessage(topic string, pack sync_types.SyncPackage) error { block1.Lock() defer block1.Unlock() - if !busConn.IsConnect() { - return fmt.Errorf("SendMessage(): not inited") + if !getIsInited() { + return fmt.Errorf("SendMessage, not inited") } // log.Println("[DEBUG] SendMessage") err := doSendMessage(topic, pack, false) @@ -226,8 +245,8 @@ func WaitMessage(topic string, callback Callback) error { // block1.Lock() // defer block1.Unlock() - if !busConn.IsConnect() { - return fmt.Errorf("WaitMessage(): not inited") + if !getIsInited() { + return fmt.Errorf("WaitMessage, not inited") } // log.Println("[DEBUG] WaitMessage") @@ -241,8 +260,8 @@ func SendRequest(receiver string, pack sync_types.SyncPackage, timeout int) (res result = sync_types.MakeSyncError("", 0, "") - if !busConn.IsConnect() { - return result, fmt.Errorf("SendRequest(): not inited") + if !getIsInited() { + return result, fmt.Errorf("SendRequest, not inited") } // log.Println("[DEBUG] SendRequest") // _time := time.Now() @@ -340,8 +359,8 @@ func SendRequest(receiver string, pack sync_types.SyncPackage, timeout int) (res // SendResponse Отправка ответа на запрос func SendResponse(packIn *sync_types.SyncPackage, packOut sync_types.SyncPackage) error { - if !busConn.IsConnect() { - return fmt.Errorf("SendResponse(): not inited") + if !getIsInited() { + return fmt.Errorf("SendResponse, not inited") } // log.Println("[DEBUG] SendResponse") diff --git a/vendor/gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/db/db_constants/db_constants.go b/vendor/gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/db/db_constants/db_constants.go index a252a442..80148fb1 100644 --- a/vendor/gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/db/db_constants/db_constants.go +++ b/vendor/gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/db/db_constants/db_constants.go @@ -10,6 +10,6 @@ const TIMEOUT_DB_SECONDS = 30 const TEXT_RECORD_NOT_FOUND = "record not found" -const TextCrudIsNotInit = "Need initializate crud with InitCrudTransport_GRPC() function at first." +const TextCrudIsNotInit = "Need initializate crud with InitCrudTransport_DB() function at first." var ErrorCrudIsNotInit error = errors.New(TextCrudIsNotInit) diff --git a/vendor/gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/connections/connections_crud.go b/vendor/gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/connections/connections_crud.go index f449a3c4..0f2c6883 100644 --- a/vendor/gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/connections/connections_crud.go +++ b/vendor/gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/connections/connections_crud.go @@ -25,6 +25,8 @@ type ICrud_Connection interface { Create(*Connection) error ReadFromCache(ID int64) (Connection, error) UpdateManyFields(*Connection, []string) error + FindBy_BranchID_IsLegal(*Connection) error + FindMassBy_BranchID(*Connection) ([]Connection, error) Update_BranchID(*Connection) error Update_DbName(*Connection) error Update_DbScheme(*Connection) error @@ -36,7 +38,7 @@ type ICrud_Connection interface { Update_Server(*Connection) error } -// TableName - возвращает имя таблицы в БД +// TableNameDB - возвращает имя таблицы в БД func (m Connection) TableNameDB() string { return "connections" } diff --git a/vendor/gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/connections/connections_findby.go b/vendor/gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/connections/connections_findby.go new file mode 100644 index 00000000..bb99e61a --- /dev/null +++ b/vendor/gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/connections/connections_findby.go @@ -0,0 +1,19 @@ +//Файл создан автоматически кодогенератором crud_generator +//Не изменяйте ничего здесь. + +package connections + +import ( + "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/db/db_constants" +) + +// FindBy_BranchID_IsLegal - находит запись по BranchID+IsLegal +func (m *Connection) FindBy_BranchID_IsLegal() error { + if Crud_manual_Connection == nil { + return db_constants.ErrorCrudIsNotInit + } + + err := Crud_Connection.FindBy_BranchID_IsLegal(m) + + return err +} diff --git a/vendor/gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/connections/connections_findmassby.go b/vendor/gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/connections/connections_findmassby.go new file mode 100644 index 00000000..d01a6e59 --- /dev/null +++ b/vendor/gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/connections/connections_findmassby.go @@ -0,0 +1,20 @@ +//Файл создан автоматически кодогенератором crud_generator +//Не изменяйте ничего здесь. + +package connections + +import ( + "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/db/db_constants" +) + +// FindMassBy_BranchID - находит запись по BranchID +func (m *Connection) FindMassBy_BranchID() ([]Connection, error) { + Otvet := make([]Connection, 0) + if Crud_manual_Connection == nil { + return Otvet, db_constants.ErrorCrudIsNotInit + } + + Otvet, err := Crud_Connection.FindMassBy_BranchID(m) + + return Otvet, err +} diff --git a/vendor/go.etcd.io/bbolt/.go-version b/vendor/go.etcd.io/bbolt/.go-version index f124bfa1..013173af 100644 --- a/vendor/go.etcd.io/bbolt/.go-version +++ b/vendor/go.etcd.io/bbolt/.go-version @@ -1 +1 @@ -1.21.9 +1.22.6 diff --git a/vendor/go.etcd.io/bbolt/Makefile b/vendor/go.etcd.io/bbolt/Makefile index 18154c63..21407797 100644 --- a/vendor/go.etcd.io/bbolt/Makefile +++ b/vendor/go.etcd.io/bbolt/Makefile @@ -41,6 +41,15 @@ coverage: TEST_FREELIST_TYPE=array go test -v -timeout 30m \ -coverprofile cover-freelist-array.out -covermode atomic +BOLT_CMD=bbolt + +build: + go build -o bin/${BOLT_CMD} ./cmd/${BOLT_CMD} + +.PHONY: clean +clean: # Clean binaries + rm -f ./bin/${BOLT_CMD} + .PHONY: gofail-enable gofail-enable: install-gofail gofail enable . @@ -61,3 +70,7 @@ test-failpoint: @echo "[failpoint] array freelist test" TEST_FREELIST_TYPE=array go test -v ${TESTFLAGS} -timeout 30m ./tests/failpoint +.PHONY: test-robustness # Running robustness tests requires root permission +test-robustness: + go test -v ${TESTFLAGS} ./tests/dmflakey -test.root + go test -v ${TESTFLAGS} ./tests/robustness -test.root diff --git a/vendor/go.etcd.io/bbolt/db.go b/vendor/go.etcd.io/bbolt/db.go index 4175bdf3..822798e4 100644 --- a/vendor/go.etcd.io/bbolt/db.go +++ b/vendor/go.etcd.io/bbolt/db.go @@ -524,7 +524,7 @@ func (db *DB) munmap() error { // gofail: var unmapError string // return errors.New(unmapError) if err := munmap(db); err != nil { - return fmt.Errorf("unmap error: " + err.Error()) + return fmt.Errorf("unmap error: %v", err.Error()) } return nil @@ -571,7 +571,7 @@ func (db *DB) munlock(fileSize int) error { // gofail: var munlockError string // return errors.New(munlockError) if err := munlock(db, fileSize); err != nil { - return fmt.Errorf("munlock error: " + err.Error()) + return fmt.Errorf("munlock error: %v", err.Error()) } return nil } @@ -580,7 +580,7 @@ func (db *DB) mlock(fileSize int) error { // gofail: var mlockError string // return errors.New(mlockError) if err := mlock(db, fileSize); err != nil { - return fmt.Errorf("mlock error: " + err.Error()) + return fmt.Errorf("mlock error: %v", err.Error()) } return nil } @@ -1159,6 +1159,8 @@ func (db *DB) grow(sz int) error { // https://github.com/boltdb/bolt/issues/284 if !db.NoGrowSync && !db.readOnly { if runtime.GOOS != "windows" { + // gofail: var resizeFileError string + // return errors.New(resizeFileError) if err := db.file.Truncate(int64(sz)); err != nil { return fmt.Errorf("file resize error: %s", err) } diff --git a/vendor/go.etcd.io/bbolt/freelist.go b/vendor/go.etcd.io/bbolt/freelist.go index 61d43f81..dffc7bc7 100644 --- a/vendor/go.etcd.io/bbolt/freelist.go +++ b/vendor/go.etcd.io/bbolt/freelist.go @@ -252,6 +252,14 @@ func (f *freelist) rollback(txid txid) { } // Remove pages from pending list and mark as free if allocated by txid. delete(f.pending, txid) + + // Remove pgids which are allocated by this txid + for pgid, tid := range f.allocs { + if tid == txid { + delete(f.allocs, pgid) + } + } + f.mergeSpans(m) } diff --git a/vendor/go.etcd.io/bbolt/tx.go b/vendor/go.etcd.io/bbolt/tx.go index 2fac8c0a..766395de 100644 --- a/vendor/go.etcd.io/bbolt/tx.go +++ b/vendor/go.etcd.io/bbolt/tx.go @@ -1,6 +1,7 @@ package bbolt import ( + "errors" "fmt" "io" "os" @@ -185,6 +186,10 @@ func (tx *Tx) Commit() error { // If the high water mark has moved up then attempt to grow the database. if tx.meta.pgid > opgid { + _ = errors.New("") + // gofail: var lackOfDiskSpace string + // tx.rollback() + // return errors.New(lackOfDiskSpace) if err := tx.db.grow(int(tx.meta.pgid+1) * tx.db.pageSize); err != nil { tx.rollback() return err @@ -470,6 +475,7 @@ func (tx *Tx) write() error { // Ignore file sync if flag is set on DB. if !tx.db.NoSync || IgnoreNoSync { + // gofail: var beforeSyncDataPages struct{} if err := fdatasync(tx.db); err != nil { return err } @@ -507,6 +513,7 @@ func (tx *Tx) writeMeta() error { return err } if !tx.db.NoSync || IgnoreNoSync { + // gofail: var beforeSyncMetaPage struct{} if err := fdatasync(tx.db); err != nil { return err } diff --git a/vendor/go.mau.fi/libsignal/serialize/ProtoBufferSerializer.go b/vendor/go.mau.fi/libsignal/serialize/ProtoBufferSerializer.go index 81482d31..e20f5bfe 100644 --- a/vendor/go.mau.fi/libsignal/serialize/ProtoBufferSerializer.go +++ b/vendor/go.mau.fi/libsignal/serialize/ProtoBufferSerializer.go @@ -112,7 +112,7 @@ func (j *ProtoBufPreKeySignalMessageSerializer) Serialize(signalMessage *protoco Message: signalMessage.Message, } - if !signalMessage.PreKeyID.IsEmpty { + if signalMessage.PreKeyID != nil && !signalMessage.PreKeyID.IsEmpty { preKeyMessage.PreKeyId = &signalMessage.PreKeyID.Value } diff --git a/vendor/go.mau.fi/util/fallocate/doc.go b/vendor/go.mau.fi/util/fallocate/doc.go new file mode 100644 index 00000000..8fccdcd6 --- /dev/null +++ b/vendor/go.mau.fi/util/fallocate/doc.go @@ -0,0 +1,9 @@ +// Copyright (C) 2024 Sumner Evans +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// Package fallocate provides a unified interface for preallocating space for a +// file. +package fallocate diff --git a/vendor/go.mau.fi/util/fallocate/fallocate_darwin.go b/vendor/go.mau.fi/util/fallocate/fallocate_darwin.go new file mode 100644 index 00000000..846910be --- /dev/null +++ b/vendor/go.mau.fi/util/fallocate/fallocate_darwin.go @@ -0,0 +1,29 @@ +// Copyright (C) 2024 Sumner Evans +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +//go:build darwin + +package fallocate + +import ( + "os" + + "golang.org/x/sys/unix" +) + +var ErrOutOfSpace error = unix.ENOSPC + +func Fallocate(file *os.File, size int) error { + if size <= 0 { + return nil + } + return unix.FcntlFstore(uintptr(file.Fd()), unix.F_PREALLOCATE, &unix.Fstore_t{ + Flags: unix.F_ALLOCATEALL, + Posmode: unix.F_PEOFPOSMODE, + Offset: 0, + Length: int64(size), + }) +} diff --git a/vendor/go.mau.fi/util/fallocate/fallocate_linux.go b/vendor/go.mau.fi/util/fallocate/fallocate_linux.go new file mode 100644 index 00000000..5b137a63 --- /dev/null +++ b/vendor/go.mau.fi/util/fallocate/fallocate_linux.go @@ -0,0 +1,24 @@ +// Copyright (C) 2024 Sumner Evans +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +//go:build linux + +package fallocate + +import ( + "os" + + "golang.org/x/sys/unix" +) + +var ErrOutOfSpace error = unix.ENOSPC + +func Fallocate(file *os.File, size int) error { + if size <= 0 { + return nil + } + return unix.Fallocate(int(file.Fd()), 0, 0, int64(size)) +} diff --git a/vendor/go.mau.fi/util/fallocate/fallocate_unknown.go b/vendor/go.mau.fi/util/fallocate/fallocate_unknown.go new file mode 100644 index 00000000..3f7aacfb --- /dev/null +++ b/vendor/go.mau.fi/util/fallocate/fallocate_unknown.go @@ -0,0 +1,17 @@ +// Copyright (C) 2024 Sumner Evans +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +//go:build !linux && !android && !darwin + +package fallocate + +import "os" + +var ErrOutOfSpace error = nil + +func Fallocate(file *os.File, size int) error { + return nil +} diff --git a/vendor/go.mau.fi/whatsmeow/README.md b/vendor/go.mau.fi/whatsmeow/README.md index b0d36ffb..4eaa56bf 100644 --- a/vendor/go.mau.fi/whatsmeow/README.md +++ b/vendor/go.mau.fi/whatsmeow/README.md @@ -14,9 +14,7 @@ discussions. ## Usage The [godoc](https://pkg.go.dev/go.mau.fi/whatsmeow) includes docs for all methods and event types. -There's also a [simple example](https://godocs.io/go.mau.fi/whatsmeow#example-package) at the top. - -Also see [mdtest](./mdtest) for a CLI tool you can easily try out whatsmeow with. +There's also a [simple example](https://pkg.go.dev/go.mau.fi/whatsmeow#example-package) at the top. ## Features Most core features are already present: diff --git a/vendor/go.mau.fi/whatsmeow/appstate/encode.go b/vendor/go.mau.fi/whatsmeow/appstate/encode.go index 859b5f83..20d91f3d 100644 --- a/vendor/go.mau.fi/whatsmeow/appstate/encode.go +++ b/vendor/go.mau.fi/whatsmeow/appstate/encode.go @@ -213,6 +213,36 @@ func BuildSettingPushName(pushName string) PatchInfo { } } +func newStarMutation(targetJID, senderJID string, messageID types.MessageID, fromMe string, starred bool) MutationInfo { + return MutationInfo{ + Index: []string{IndexStar, targetJID, messageID, fromMe, senderJID}, + Version: 2, + Value: &waProto.SyncActionValue{ + StarAction: &waProto.StarAction{ + Starred: &starred, + }, + }, + } +} + +// BuildStar builds an app state patch for starring or unstarring a message. +func BuildStar(target, sender types.JID, messageID types.MessageID, fromMe, starred bool) PatchInfo { + isFromMe := "0" + if fromMe { + isFromMe = "1" + } + targetJID, senderJID := target.String(), sender.String() + if target.User == sender.User { + senderJID = "0" + } + return PatchInfo{ + Type: WAPatchRegularHigh, + Mutations: []MutationInfo{ + newStarMutation(targetJID, senderJID, messageID, isFromMe, starred), + }, + } +} + func (proc *Processor) EncodePatch(keyID []byte, state HashState, patchInfo PatchInfo) ([]byte, error) { keys, err := proc.getAppStateKey(keyID) if err != nil { diff --git a/vendor/go.mau.fi/whatsmeow/binary/encoder.go b/vendor/go.mau.fi/whatsmeow/binary/encoder.go index 21e22cf8..eed07184 100644 --- a/vendor/go.mau.fi/whatsmeow/binary/encoder.go +++ b/vendor/go.mau.fi/whatsmeow/binary/encoder.go @@ -90,7 +90,7 @@ func (w *binaryEncoder) writeNode(n Node) { hasContent = 1 } - w.writeListStart(2*len(n.Attrs) + tagSize + hasContent) + w.writeListStart(2*w.countAttributes(n.Attrs) + tagSize + hasContent) w.writeString(n.Tag) w.writeAttributes(n.Attrs) if n.Content != nil { @@ -187,10 +187,6 @@ func (w *binaryEncoder) writeJID(jid types.JID) { } func (w *binaryEncoder) writeAttributes(attributes Attrs) { - if attributes == nil { - return - } - for key, val := range attributes { if val == "" || val == nil { continue @@ -201,6 +197,16 @@ func (w *binaryEncoder) writeAttributes(attributes Attrs) { } } +func (w *binaryEncoder) countAttributes(attributes Attrs) (count int) { + for _, val := range attributes { + if val == "" || val == nil { + continue + } + count += 1 + } + return +} + func (w *binaryEncoder) writeListStart(listSize int) { if listSize == 0 { w.pushByte(byte(token.ListEmpty)) diff --git a/vendor/go.mau.fi/whatsmeow/binary/proto/legacy.go b/vendor/go.mau.fi/whatsmeow/binary/proto/legacy.go index c28b8096..93da7af0 100644 --- a/vendor/go.mau.fi/whatsmeow/binary/proto/legacy.go +++ b/vendor/go.mau.fi/whatsmeow/binary/proto/legacy.go @@ -175,7 +175,6 @@ type ( ContextInfo = waE2E.ContextInfo ForwardedNewsletterMessageInfo = waE2E.ContextInfo_ForwardedNewsletterMessageInfo BotSuggestedPromptMetadata = waE2E.BotSuggestedPromptMetadata - BotSearchMetadata = waE2E.BotSearchMetadata BotPluginMetadata = waE2E.BotPluginMetadata BotMetadata = waE2E.BotMetadata BotAvatarMetadata = waE2E.BotAvatarMetadata diff --git a/vendor/go.mau.fi/whatsmeow/call.go b/vendor/go.mau.fi/whatsmeow/call.go index 7a6ffcb2..a672b6de 100644 --- a/vendor/go.mau.fi/whatsmeow/call.go +++ b/vendor/go.mau.fi/whatsmeow/call.go @@ -83,7 +83,30 @@ func (cli *Client) handleCallEvent(node *waBinary.Node) { Reason: cag.String("reason"), Data: &child, }) + case "reject": + cli.dispatchEvent(&events.CallReject{ + BasicCallMeta: basicMeta, + Data: &child, + }) default: cli.dispatchEvent(&events.UnknownCallEvent{Node: node}) } } + +// RejectCall reject an incoming call. +func (cli *Client) RejectCall(callFrom types.JID, callID string) error { + ownID := cli.getOwnID() + if ownID.IsEmpty() { + return ErrNotLoggedIn + } + ownID, callFrom = ownID.ToNonAD(), callFrom.ToNonAD() + return cli.sendNode(waBinary.Node{ + Tag: "call", + Attrs: waBinary.Attrs{"id": cli.GenerateMessageID(), "from": ownID, "to": callFrom}, + Content: []waBinary.Node{{ + Tag: "reject", + Attrs: waBinary.Attrs{"call-id": callID, "call-creator": callFrom, "count": "0"}, + Content: nil, + }}, + }) +} diff --git a/vendor/go.mau.fi/whatsmeow/client.go b/vendor/go.mau.fi/whatsmeow/client.go index 101a2501..72bcf469 100644 --- a/vendor/go.mau.fi/whatsmeow/client.go +++ b/vendor/go.mau.fi/whatsmeow/client.go @@ -70,6 +70,8 @@ type Client struct { // the client will not attempt to reconnect. The number of retries can be read from AutoReconnectErrors. AutoReconnectHook func(error) bool + DisableLoginAutoReconnect bool + sendActiveReceipts atomic.Uint32 // EmitAppStateEventsOnFullSync can be set to true if you want to get app state events emitted @@ -238,6 +240,7 @@ func NewClient(deviceStore *store.Device, log waLog.Logger) *Client { } cli.nodeHandlers = map[string]nodeHandler{ "message": cli.handleEncryptedMessage, + "appdata": cli.handleEncryptedMessage, "receipt": cli.handleReceipt, "call": cli.handleCallEvent, "chatstate": cli.handleChatState, diff --git a/vendor/go.mau.fi/whatsmeow/connectionevents.go b/vendor/go.mau.fi/whatsmeow/connectionevents.go index 5feaed25..2a2a5be8 100644 --- a/vendor/go.mau.fi/whatsmeow/connectionevents.go +++ b/vendor/go.mau.fi/whatsmeow/connectionevents.go @@ -23,6 +23,11 @@ func (cli *Client) handleStreamError(node *waBinary.Node) { conflictType := conflict.AttrGetter().OptionalString("type") switch { case code == "515": + if cli.DisableLoginAutoReconnect { + cli.Log.Infof("Got 515 code, but login autoreconnect is disabled, not reconnecting") + cli.dispatchEvent(&events.ManualLoginReconnect{}) + return + } cli.Log.Infof("Got 515 code, reconnecting...") go func() { cli.Disconnect() diff --git a/vendor/go.mau.fi/whatsmeow/download-to-file.go b/vendor/go.mau.fi/whatsmeow/download-to-file.go new file mode 100644 index 00000000..488c7e83 --- /dev/null +++ b/vendor/go.mau.fi/whatsmeow/download-to-file.go @@ -0,0 +1,198 @@ +// Copyright (c) 2024 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "crypto/hmac" + "crypto/sha256" + "encoding/base64" + "errors" + "fmt" + "io" + "os" + "strings" + "time" + + "go.mau.fi/util/fallocate" + "go.mau.fi/util/retryafter" + + "go.mau.fi/whatsmeow/proto/waMediaTransport" + "go.mau.fi/whatsmeow/util/cbcutil" +) + +type File interface { + io.Reader + io.Writer + io.Seeker + io.ReaderAt + io.WriterAt + Truncate(size int64) error + Stat() (os.FileInfo, error) +} + +// DownloadToFile downloads the attachment from the given protobuf message. +// +// This is otherwise identical to [Download], but writes the attachment to a file instead of returning it as a byte slice. +func (cli *Client) DownloadToFile(msg DownloadableMessage, file File) error { + mediaType, ok := classToMediaType[msg.ProtoReflect().Descriptor().Name()] + if !ok { + return fmt.Errorf("%w '%s'", ErrUnknownMediaType, string(msg.ProtoReflect().Descriptor().Name())) + } + urlable, ok := msg.(downloadableMessageWithURL) + var url string + var isWebWhatsappNetURL bool + if ok { + url = urlable.GetUrl() + isWebWhatsappNetURL = strings.HasPrefix(url, "https://web.whatsapp.net") + } + if len(url) > 0 && !isWebWhatsappNetURL { + return cli.downloadAndDecryptToFile(url, msg.GetMediaKey(), mediaType, getSize(msg), msg.GetFileEncSHA256(), msg.GetFileSHA256(), file) + } else if len(msg.GetDirectPath()) > 0 { + return cli.DownloadMediaWithPathToFile(msg.GetDirectPath(), msg.GetFileEncSHA256(), msg.GetFileSHA256(), msg.GetMediaKey(), getSize(msg), mediaType, mediaTypeToMMSType[mediaType], file) + } else { + if isWebWhatsappNetURL { + cli.Log.Warnf("Got a media message with a web.whatsapp.net URL (%s) and no direct path", url) + } + return ErrNoURLPresent + } +} + +func (cli *Client) DownloadFBToFile(transport *waMediaTransport.WAMediaTransport_Integral, mediaType MediaType, file File) error { + return cli.DownloadMediaWithPathToFile(transport.GetDirectPath(), transport.GetFileEncSHA256(), transport.GetFileSHA256(), transport.GetMediaKey(), -1, mediaType, mediaTypeToMMSType[mediaType], file) +} + +func (cli *Client) DownloadMediaWithPathToFile(directPath string, encFileHash, fileHash, mediaKey []byte, fileLength int, mediaType MediaType, mmsType string, file File) error { + mediaConn, err := cli.refreshMediaConn(false) + if err != nil { + return fmt.Errorf("failed to refresh media connections: %w", err) + } + if len(mmsType) == 0 { + mmsType = mediaTypeToMMSType[mediaType] + } + for i, host := range mediaConn.Hosts { + // TODO omit hash for unencrypted media? + mediaURL := fmt.Sprintf("https://%s%s&hash=%s&mms-type=%s&__wa-mms=", host.Hostname, directPath, base64.URLEncoding.EncodeToString(encFileHash), mmsType) + err = cli.downloadAndDecryptToFile(mediaURL, mediaKey, mediaType, fileLength, encFileHash, fileHash, file) + if err == nil || errors.Is(err, ErrFileLengthMismatch) || errors.Is(err, ErrInvalidMediaSHA256) { + return err + } else if i >= len(mediaConn.Hosts)-1 { + return fmt.Errorf("failed to download media from last host: %w", err) + } + // TODO there are probably some errors that shouldn't retry + cli.Log.Warnf("Failed to download media: %s, trying with next host...", err) + } + return err +} + +func (cli *Client) downloadAndDecryptToFile(url string, mediaKey []byte, appInfo MediaType, fileLength int, fileEncSHA256, fileSHA256 []byte, file File) error { + iv, cipherKey, macKey, _ := getMediaKeys(mediaKey, appInfo) + hasher := sha256.New() + if mac, err := cli.downloadPossiblyEncryptedMediaWithRetriesToFile(url, fileEncSHA256, file); err != nil { + return err + } else if mediaKey == nil && fileEncSHA256 == nil && mac == nil { + // Unencrypted media, just return the downloaded data + return nil + } else if err = validateMediaFile(file, iv, macKey, mac); err != nil { + return err + } else if _, err = file.Seek(0, io.SeekStart); err != nil { + return fmt.Errorf("failed to seek to start of file after validating mac: %w", err) + } else if err = cbcutil.DecryptFile(cipherKey, iv, file); err != nil { + return fmt.Errorf("failed to decrypt file: %w", err) + } else if info, err := file.Stat(); err != nil { + return fmt.Errorf("failed to stat file: %w", err) + } else if info.Size() != int64(fileLength) { + return fmt.Errorf("%w: expected %d, got %d", ErrFileLengthMismatch, fileLength, info.Size()) + } else if _, err = file.Seek(0, io.SeekStart); err != nil { + return fmt.Errorf("failed to seek to start of file after decrypting: %w", err) + } else if _, err = io.Copy(hasher, file); err != nil { + return fmt.Errorf("failed to hash file: %w", err) + } else if !hmac.Equal(fileSHA256, hasher.Sum(nil)) { + return ErrInvalidMediaSHA256 + } + return nil +} + +func (cli *Client) downloadPossiblyEncryptedMediaWithRetriesToFile(url string, checksum []byte, file File) (mac []byte, err error) { + for retryNum := 0; retryNum < 5; retryNum++ { + if checksum == nil { + _, _, err = cli.downloadMediaToFile(url, file) + } else { + mac, err = cli.downloadEncryptedMediaToFile(url, checksum, file) + } + if err == nil || !shouldRetryMediaDownload(err) { + return + } + retryDuration := time.Duration(retryNum+1) * time.Second + var httpErr DownloadHTTPError + if errors.As(err, &httpErr) { + retryDuration = retryafter.Parse(httpErr.Response.Header.Get("Retry-After"), retryDuration) + } + cli.Log.Warnf("Failed to download media due to network error: %v, retrying in %s...", err, retryDuration) + _, err = file.Seek(0, io.SeekStart) + if err != nil { + return nil, fmt.Errorf("failed to seek to start of file to retry download: %w", err) + } + time.Sleep(retryDuration) + } + return +} + +func (cli *Client) downloadMediaToFile(url string, file io.Writer) (int64, []byte, error) { + resp, err := cli.doMediaDownloadRequest(url) + if err != nil { + return 0, nil, err + } + defer resp.Body.Close() + osFile, ok := file.(*os.File) + if ok && resp.ContentLength > 0 { + err = fallocate.Fallocate(osFile, int(resp.ContentLength)) + if err != nil { + return 0, nil, fmt.Errorf("failed to preallocate file: %w", err) + } + } + hasher := sha256.New() + n, err := io.Copy(file, io.TeeReader(resp.Body, hasher)) + return n, hasher.Sum(nil), err +} + +func (cli *Client) downloadEncryptedMediaToFile(url string, checksum []byte, file File) ([]byte, error) { + size, hash, err := cli.downloadMediaToFile(url, file) + if err != nil { + return nil, err + } else if size <= mediaHMACLength { + return nil, ErrTooShortFile + } else if len(checksum) == 32 && !hmac.Equal(checksum, hash) { + return nil, ErrInvalidMediaEncSHA256 + } + mac := make([]byte, mediaHMACLength) + _, err = file.ReadAt(mac, size-mediaHMACLength) + if err != nil { + return nil, fmt.Errorf("failed to read MAC from file: %w", err) + } + err = file.Truncate(size - mediaHMACLength) + if err != nil { + return nil, fmt.Errorf("failed to truncate file to remove MAC: %w", err) + } + return mac, nil +} + +func validateMediaFile(file io.ReadSeeker, iv, macKey, mac []byte) error { + h := hmac.New(sha256.New, macKey) + h.Write(iv) + _, err := file.Seek(0, io.SeekStart) + if err != nil { + return fmt.Errorf("failed to seek to start of file: %w", err) + } + _, err = io.Copy(h, file) + if err != nil { + return fmt.Errorf("failed to hash file: %w", err) + } + if !hmac.Equal(h.Sum(nil)[:mediaHMACLength], mac) { + return ErrInvalidMediaHMAC + } + return nil +} diff --git a/vendor/go.mau.fi/whatsmeow/download.go b/vendor/go.mau.fi/whatsmeow/download.go index 0407eb30..cc7de259 100644 --- a/vendor/go.mau.fi/whatsmeow/download.go +++ b/vendor/go.mau.fi/whatsmeow/download.go @@ -229,7 +229,7 @@ func (cli *Client) DownloadMediaWithPath(directPath string, encFileHash, fileHas // TODO omit hash for unencrypted media? mediaURL := fmt.Sprintf("https://%s%s&hash=%s&mms-type=%s&__wa-mms=", host.Hostname, directPath, base64.URLEncoding.EncodeToString(encFileHash), mmsType) data, err = cli.downloadAndDecrypt(mediaURL, mediaKey, mediaType, fileLength, encFileHash, fileHash) - if err == nil { + if err == nil || errors.Is(err, ErrFileLengthMismatch) || errors.Is(err, ErrInvalidMediaSHA256) { return } else if i >= len(mediaConn.Hosts)-1 { return nil, fmt.Errorf("failed to download media from last host: %w", err) @@ -288,13 +288,13 @@ func (cli *Client) downloadPossiblyEncryptedMediaWithRetries(url string, checksu if errors.As(err, &httpErr) { retryDuration = retryafter.Parse(httpErr.Response.Header.Get("Retry-After"), retryDuration) } - cli.Log.Warnf("Failed to download media due to network error: %w, retrying in %s...", err, retryDuration) + cli.Log.Warnf("Failed to download media due to network error: %v, retrying in %s...", err, retryDuration) time.Sleep(retryDuration) } return } -func (cli *Client) downloadMedia(url string) ([]byte, error) { +func (cli *Client) doMediaDownloadRequest(url string) (*http.Response, error) { req, err := http.NewRequest(http.MethodGet, url, nil) if err != nil { return nil, fmt.Errorf("failed to prepare request: %w", err) @@ -309,22 +309,34 @@ func (cli *Client) downloadMedia(url string) ([]byte, error) { if err != nil { return nil, err } - defer resp.Body.Close() if resp.StatusCode != http.StatusOK { + _ = resp.Body.Close() return nil, DownloadHTTPError{Response: resp} } - return io.ReadAll(resp.Body) + return resp, nil } +func (cli *Client) downloadMedia(url string) ([]byte, error) { + resp, err := cli.doMediaDownloadRequest(url) + if err != nil { + return nil, err + } + data, err := io.ReadAll(resp.Body) + _ = resp.Body.Close() + return data, err +} + +const mediaHMACLength = 10 + func (cli *Client) downloadEncryptedMedia(url string, checksum []byte) (file, mac []byte, err error) { data, err := cli.downloadMedia(url) if err != nil { return - } else if len(data) <= 10 { + } else if len(data) <= mediaHMACLength { err = ErrTooShortFile return } - file, mac = data[:len(data)-10], data[len(data)-10:] + file, mac = data[:len(data)-mediaHMACLength], data[len(data)-mediaHMACLength:] if len(checksum) == 32 && sha256.Sum256(data) != *(*[32]byte)(checksum) { err = ErrInvalidMediaEncSHA256 } @@ -335,7 +347,7 @@ func validateMedia(iv, file, macKey, mac []byte) error { h := hmac.New(sha256.New, macKey) h.Write(iv) h.Write(file) - if !hmac.Equal(h.Sum(nil)[:10], mac) { + if !hmac.Equal(h.Sum(nil)[:mediaHMACLength], mac) { return ErrInvalidMediaHMAC } return nil diff --git a/vendor/go.mau.fi/whatsmeow/errors.go b/vendor/go.mau.fi/whatsmeow/errors.go index 27c2f318..3f784409 100644 --- a/vendor/go.mau.fi/whatsmeow/errors.go +++ b/vendor/go.mau.fi/whatsmeow/errors.go @@ -106,6 +106,7 @@ var ( ErrUnknownServer = errors.New("can't send message to unknown server") ErrRecipientADJID = errors.New("message recipient must be a user JID with no device part") ErrServerReturnedError = errors.New("server returned error") + ErrInvalidInlineBotID = errors.New("invalid inline bot ID") ) type DownloadHTTPError struct { diff --git a/vendor/go.mau.fi/whatsmeow/group.go b/vendor/go.mau.fi/whatsmeow/group.go index 199493c8..296258fc 100644 --- a/vendor/go.mau.fi/whatsmeow/group.go +++ b/vendor/go.mau.fi/whatsmeow/group.go @@ -439,6 +439,10 @@ func (cli *Client) JoinGroupWithLink(code string) (types.JID, error) { } else if err != nil { return types.EmptyJID, err } + membershipApprovalModeNode, ok := resp.GetOptionalChildByTag("membership_approval_request") + if ok { + return membershipApprovalModeNode.AttrGetter().JID("jid"), nil + } groupNode, ok := resp.GetOptionalChildByTag("group") if !ok { return types.EmptyJID, &ElementMissingError{Tag: "group", In: "response to group link join query"} @@ -640,7 +644,8 @@ func (cli *Client) parseGroupNode(groupNode *waBinary.Node) (*types.GroupInfo, e group.DefaultMembershipApprovalMode = childAG.OptionalString("default_membership_approval_mode") case "incognito": group.IsIncognito = true - // TODO: membership_approval_mode + case "membership_approval_mode": + group.IsJoinApprovalRequired = true default: cli.Log.Debugf("Unknown element in group node %s: %s", group.JID.String(), child.XMLString()) } @@ -810,6 +815,10 @@ func (cli *Client) parseGroupChange(node *waBinary.Node) (*events.GroupInfo, err if err != nil { return nil, fmt.Errorf("failed to parse group unlink node in group change: %w", err) } + case "membership_approval_mode": + evt.MembershipApprovalMode = &types.GroupMembershipApprovalMode{ + IsJoinApprovalRequired: true, + } default: evt.UnknownChanges = append(evt.UnknownChanges, &child) } @@ -864,3 +873,55 @@ func (cli *Client) parseGroupNotification(node *waBinary.Node) (interface{}, err return groupChange, nil } } + +// SetGroupJoinApprovalMode sets the group join approval mode to 'on' or 'off'. +func (cli *Client) SetGroupJoinApprovalMode(jid types.JID, mode bool) error { + modeStr := "off" + if mode { + modeStr = "on" + } + + content := waBinary.Node{ + Tag: "membership_approval_mode", + Content: []waBinary.Node{ + { + Tag: "group_join", + Attrs: waBinary.Attrs{"state": modeStr}, + }, + }, + } + + _, err := cli.sendGroupIQ(context.TODO(), iqSet, jid, content) + return err +} + +// SetGroupMemberAddMode sets the group member add mode to 'admin_add' or 'all_member_add'. +func (cli *Client) SetGroupMemberAddMode(jid types.JID, mode types.GroupMemberAddMode) error { + if mode != types.GroupMemberAddModeAdmin && mode != types.GroupMemberAddModeAllMember { + return errors.New("invalid mode, must be 'admin_add' or 'all_member_add'") + } + + content := waBinary.Node{ + Tag: "member_add_mode", + Content: []byte(mode), + } + + _, err := cli.sendGroupIQ(context.TODO(), iqSet, jid, content) + return err +} + +// SetGroupDescription updates the group description. +func (cli *Client) SetGroupDescription(jid types.JID, description string) error { + content := waBinary.Node{ + Tag: "description", + Content: []waBinary.Node{ + { + Tag: "body", + Content: []byte(description), + }, + }, + } + + _, err := cli.sendGroupIQ(context.TODO(), iqSet, jid, content) + return err +} diff --git a/vendor/go.mau.fi/whatsmeow/message.go b/vendor/go.mau.fi/whatsmeow/message.go index 4b08df16..5aef10e8 100644 --- a/vendor/go.mau.fi/whatsmeow/message.go +++ b/vendor/go.mau.fi/whatsmeow/message.go @@ -16,6 +16,8 @@ import ( "runtime/debug" "time" + "go.mau.fi/whatsmeow/proto/waE2E" + "go.mau.fi/libsignal/groups" "go.mau.fi/libsignal/protocol" "go.mau.fi/libsignal/session" @@ -88,6 +90,16 @@ func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bo } else { source.Chat = from.ToNonAD() } + } else if from.IsBot() { + source.Sender = from + meta := node.GetChildByTag("meta") + ag = meta.AttrGetter() + targetChatJID := ag.OptionalJID("target_chat_jid") + if targetChatJID != nil { + source.Chat = targetChatJID.ToNonAD() + } else { + source.Chat = from + } } else { source.Chat = from.ToNonAD() source.Sender = from @@ -96,6 +108,32 @@ func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bo return } +func (cli *Client) parseMsgBotInfo(node waBinary.Node) (botInfo types.MsgBotInfo, err error) { + botNode := node.GetChildByTag("bot") + + ag := botNode.AttrGetter() + botInfo.EditType = types.BotEditType(ag.String("edit")) + if botInfo.EditType == types.EditTypeInner || botInfo.EditType == types.EditTypeLast { + botInfo.EditTargetID = types.MessageID(ag.String("edit_target_id")) + botInfo.EditSenderTimestampMS = ag.UnixMilli("sender_timestamp_ms") + } + err = ag.Error() + return +} + +func (cli *Client) parseMsgMetaInfo(node waBinary.Node) (metaInfo types.MsgMetaInfo, err error) { + metaNode := node.GetChildByTag("meta") + + ag := metaNode.AttrGetter() + metaInfo.TargetID = types.MessageID(ag.String("target_id")) + targetSenderJID := ag.OptionalJIDOrEmpty("target_sender_jid") + if targetSenderJID.User != "" { + metaInfo.TargetSender = targetSenderJID + } + err = ag.Error() + return +} + func (cli *Client) parseMessageInfo(node *waBinary.Node) (*types.MessageInfo, error) { var info types.MessageInfo var err error @@ -124,6 +162,14 @@ func (cli *Client) parseMessageInfo(node *waBinary.Node) (*types.MessageInfo, er if err != nil { cli.Log.Warnf("Failed to parse verified_name node in %s: %v", info.ID, err) } + case "bot": + info.MsgBotInfo, err = cli.parseMsgBotInfo(child) + if err != nil { + cli.Log.Warnf("Failed to parse node in %s: %v", info.ID, err) + } + case "meta": + // TODO parse non-bot metadata too + info.MsgMetaInfo, _ = cli.parseMsgMetaInfo(child) case "franking": // TODO case "trace": @@ -175,7 +221,7 @@ func (cli *Client) handlePlaintextMessage(info *types.MessageInfo, node *waBinar func (cli *Client) decryptMessages(info *types.MessageInfo, node *waBinary.Node) { if len(node.GetChildrenByTag("unavailable")) > 0 && len(node.GetChildrenByTag("enc")) == 0 { cli.Log.Warnf("Unavailable message %s from %s", info.ID, info.SourceString()) - go cli.sendRetryReceipt(node, info, true) + go cli.delayedRequestMessageFromPhone(info) cli.dispatchEvent(&events.UndecryptableMessage{Info: *info, IsUnavailable: true}) return } @@ -200,10 +246,47 @@ func (cli *Client) decryptMessages(info *types.MessageInfo, node *waBinary.Node) containsDirectMsg = true } else if info.IsGroup && encType == "skmsg" { decrypted, err = cli.decryptGroupMsg(&child, info.Sender, info.Chat) + } else if encType == "msmsg" && info.Sender.IsBot() { + // Meta AI / other bots (biz?): + + // step 1: get message secret + targetSenderJID := info.MsgMetaInfo.TargetSender + if targetSenderJID.User == "" { + // if no targetSenderJID in this must be ourselves (one-one-one mode) + targetSenderJID = cli.getOwnID() + } + + messageSecret, err := cli.Store.MsgSecrets.GetMessageSecret(info.Chat, targetSenderJID, info.MsgMetaInfo.TargetID) + if err != nil || messageSecret == nil { + cli.Log.Warnf("Error getting message secret for bot msg with id %s", node.AttrGetter().String("id")) + continue + } + + // step 2: get MessageSecretMessage + byteContents := child.Content.([]byte) // contents + var msMsg waE2E.MessageSecretMessage + + err = proto.Unmarshal(byteContents, &msMsg) + if err != nil { + cli.Log.Warnf("Error decoding MessageSecretMesage protobuf %v", err) + continue + } + + // step 3: determine best message id for decryption + var messageID string + if info.MsgBotInfo.EditType == types.EditTypeInner || info.MsgBotInfo.EditType == types.EditTypeLast { + messageID = info.MsgBotInfo.EditTargetID + } else { + messageID = info.ID + } + + // step 4: decrypt and voila + decrypted, err = cli.decryptBotMessage(messageSecret, &msMsg, messageID, targetSenderJID, info) } else { cli.Log.Warnf("Unhandled encrypted message (type %s) from %s", encType, info.SourceString()) continue } + if err != nil { cli.Log.Warnf("Error decrypting message from %s: %v", info.SourceString(), err) isUnavailable := encType == "skmsg" && !containsDirectMsg && errors.Is(err, signalerror.ErrNoSenderKeyForUser) @@ -216,11 +299,9 @@ func (cli *Client) decryptMessages(info *types.MessageInfo, node *waBinary.Node) return } retryCount := ag.OptionalInt("count") - if retryCount > 0 { - cli.cancelDelayedRequestFromPhone(info.ID) - } + cli.cancelDelayedRequestFromPhone(info.ID) - var msg waProto.Message + var msg waE2E.Message switch ag.Int("v") { case 2: err = proto.Unmarshal(decrypted, &msg) diff --git a/vendor/go.mau.fi/whatsmeow/msgsecret.go b/vendor/go.mau.fi/whatsmeow/msgsecret.go index 69989dab..31822f7b 100644 --- a/vendor/go.mau.fi/whatsmeow/msgsecret.go +++ b/vendor/go.mau.fi/whatsmeow/msgsecret.go @@ -11,6 +11,9 @@ import ( "fmt" "time" + "go.mau.fi/whatsmeow/proto/waCommon" + "go.mau.fi/whatsmeow/proto/waE2E" + "go.mau.fi/util/random" "google.golang.org/protobuf/proto" @@ -26,8 +29,13 @@ type MsgSecretType string const ( EncSecretPollVote MsgSecretType = "Poll Vote" EncSecretReaction MsgSecretType = "Enc Reaction" + EncSecretBotMsg MsgSecretType = "Bot Message" ) +func applyBotMessageHKDF(messageSecret []byte) []byte { + return hkdfutil.SHA256(messageSecret, nil, []byte(EncSecretBotMsg), 32) +} + func generateMsgSecretKey( modificationType MsgSecretType, modificationSender types.JID, origMsgID types.MessageID, origMsgSender types.JID, origMsgSecret []byte, @@ -47,7 +55,7 @@ func generateMsgSecretKey( return secretKey, additionalData } -func getOrigSenderFromKey(msg *events.Message, key *waProto.MessageKey) (types.JID, error) { +func getOrigSenderFromKey(msg *events.Message, key *waCommon.MessageKey) (types.JID, error) { if key.GetFromMe() { // fromMe always means the poll and vote were sent by the same user return msg.Info.Sender, nil @@ -74,18 +82,18 @@ type messageEncryptedSecret interface { GetEncPayload() []byte } -func (cli *Client) decryptMsgSecret(msg *events.Message, useCase MsgSecretType, encrypted messageEncryptedSecret, origMsgKey *waProto.MessageKey) ([]byte, error) { +func (cli *Client) decryptMsgSecret(msg *events.Message, useCase MsgSecretType, encrypted messageEncryptedSecret, origMsgKey *waCommon.MessageKey) ([]byte, error) { pollSender, err := getOrigSenderFromKey(msg, origMsgKey) if err != nil { return nil, err } - baseEncKey, err := cli.Store.MsgSecrets.GetMessageSecret(msg.Info.Chat, pollSender, origMsgKey.GetId()) + baseEncKey, err := cli.Store.MsgSecrets.GetMessageSecret(msg.Info.Chat, pollSender, origMsgKey.GetID()) if err != nil { return nil, fmt.Errorf("failed to get original message secret key: %w", err) } else if baseEncKey == nil { return nil, ErrOriginalMessageSecretNotFound } - secretKey, additionalData := generateMsgSecretKey(useCase, msg.Info.Sender, origMsgKey.GetId(), pollSender, baseEncKey) + secretKey, additionalData := generateMsgSecretKey(useCase, msg.Info.Sender, origMsgKey.GetID(), pollSender, baseEncKey) plaintext, err := gcmutil.Decrypt(secretKey, encrypted.GetEncIV(), encrypted.GetEncPayload(), additionalData) if err != nil { return nil, fmt.Errorf("failed to decrypt secret message: %w", err) @@ -115,6 +123,18 @@ func (cli *Client) encryptMsgSecret(chat, origSender types.JID, origMsgID types. return ciphertext, iv, nil } +func (cli *Client) decryptBotMessage(messageSecret []byte, msMsg messageEncryptedSecret, messageID types.MessageID, targetSenderJID types.JID, info *types.MessageInfo) ([]byte, error) { + // gcm decrypt key generation + newKey, additionalData := generateMsgSecretKey("", info.Sender, messageID, targetSenderJID, applyBotMessageHKDF(messageSecret)) + + plaintext, err := gcmutil.Decrypt(newKey, msMsg.GetEncIV(), msMsg.GetEncPayload(), additionalData) + if err != nil { + return nil, fmt.Errorf("failed to decrypt secret message: %w", err) + } + + return plaintext, nil +} + // DecryptReaction decrypts a reaction update message. This form of reactions hasn't been rolled out yet, // so this function is likely not of much use. // @@ -126,7 +146,7 @@ func (cli *Client) encryptMsgSecret(chat, origSender types.JID, origMsgID types. // } // fmt.Printf("Reaction message: %+v\n", reaction) // } -func (cli *Client) DecryptReaction(reaction *events.Message) (*waProto.ReactionMessage, error) { +func (cli *Client) DecryptReaction(reaction *events.Message) (*waE2E.ReactionMessage, error) { encReaction := reaction.Message.GetEncReactionMessage() if encReaction == nil { return nil, ErrNotEncryptedReactionMessage @@ -135,7 +155,7 @@ func (cli *Client) DecryptReaction(reaction *events.Message) (*waProto.ReactionM if err != nil { return nil, fmt.Errorf("failed to decrypt reaction: %w", err) } - var msg waProto.ReactionMessage + var msg waE2E.ReactionMessage err = proto.Unmarshal(plaintext, &msg) if err != nil { return nil, fmt.Errorf("failed to decode reaction protobuf: %w", err) @@ -156,7 +176,7 @@ func (cli *Client) DecryptReaction(reaction *events.Message) (*waProto.ReactionM // fmt.Printf("- %X\n", hash) // } // } -func (cli *Client) DecryptPollVote(vote *events.Message) (*waProto.PollVoteMessage, error) { +func (cli *Client) DecryptPollVote(vote *events.Message) (*waE2E.PollVoteMessage, error) { pollUpdate := vote.Message.GetPollUpdateMessage() if pollUpdate == nil { return nil, ErrNotPollUpdateMessage @@ -165,7 +185,7 @@ func (cli *Client) DecryptPollVote(vote *events.Message) (*waProto.PollVoteMessa if err != nil { return nil, fmt.Errorf("failed to decrypt poll vote: %w", err) } - var msg waProto.PollVoteMessage + var msg waE2E.PollVoteMessage err = proto.Unmarshal(plaintext, &msg) if err != nil { return nil, fmt.Errorf("failed to decode poll vote protobuf: %w", err) @@ -173,8 +193,8 @@ func (cli *Client) DecryptPollVote(vote *events.Message) (*waProto.PollVoteMessa return &msg, nil } -func getKeyFromInfo(msgInfo *types.MessageInfo) *waProto.MessageKey { - creationKey := &waProto.MessageKey{ +func getKeyFromInfo(msgInfo *types.MessageInfo) *waCommon.MessageKey { + creationKey := &waCommon.MessageKey{ RemoteJID: proto.String(msgInfo.Chat.String()), FromMe: proto.Bool(msgInfo.IsFromMe), ID: proto.String(msgInfo.ID), diff --git a/vendor/go.mau.fi/whatsmeow/pair-code.go b/vendor/go.mau.fi/whatsmeow/pair-code.go index ea8f0933..d1a8497b 100644 --- a/vendor/go.mau.fi/whatsmeow/pair-code.go +++ b/vendor/go.mau.fi/whatsmeow/pair-code.go @@ -14,6 +14,7 @@ import ( "fmt" "regexp" "strconv" + "strings" "go.mau.fi/util/random" "golang.org/x/crypto/curve25519" @@ -72,7 +73,9 @@ func generateCompanionEphemeralKey() (ephemeralKeyPair *keys.KeyPair, ephemeralK // PairPhone generates a pairing code that can be used to link to a phone without scanning a QR code. // // You must connect the client normally before calling this (which means you'll also receive a QR code -// event, but that can be ignored when doing code pairing). +// event, but that can be ignored when doing code pairing). You should also wait for `*events.QR` before +// calling this to ensure the connection is fully established. If using [Client.GetQRChannel], wait for +// the first item in the channel. Alternatively, sleeping for a second after calling Connect will probably work too. // // The exact expiry of pairing codes is unknown, but QR codes are always generated and the login websocket is closed // after the QR codes run out, which means there's a 160-second time limit. It is recommended to generate the pairing @@ -86,6 +89,11 @@ func generateCompanionEphemeralKey() (ephemeralKeyPair *keys.KeyPair, ephemeralK func (cli *Client) PairPhone(phone string, showPushNotification bool, clientType PairClientType, clientDisplayName string) (string, error) { ephemeralKeyPair, ephemeralKey, encodedLinkingCode := generateCompanionEphemeralKey() phone = notNumbers.ReplaceAllString(phone, "") + if len(phone) <= 6 { + return "", fmt.Errorf("phone number too short") + } else if strings.HasPrefix(phone, "0") { + return "", fmt.Errorf("international phone number required (must not start with 0)") + } jid := types.NewJID(phone, types.DefaultUserServer) resp, err := cli.sendIQ(infoQuery{ Namespace: "md", diff --git a/vendor/go.mau.fi/whatsmeow/prekeys.go b/vendor/go.mau.fi/whatsmeow/prekeys.go index 35c9215c..b8656bb5 100644 --- a/vendor/go.mau.fi/whatsmeow/prekeys.go +++ b/vendor/go.mau.fi/whatsmeow/prekeys.go @@ -174,19 +174,34 @@ func nodeToPreKeyBundle(deviceID uint32, node waBinary.Node) (*prekey.Bundle, er } identityKeyPub := *(*[32]byte)(identityKeyRaw) - preKey, err := nodeToPreKey(keysNode.GetChildByTag("key")) - if err != nil { - return nil, fmt.Errorf("invalid prekey in prekey response: %w", err) + preKeyNode, ok := keysNode.GetOptionalChildByTag("key") + preKey := &keys.PreKey{} + if ok { + var err error + preKey, err = nodeToPreKey(preKeyNode) + if err != nil { + return nil, fmt.Errorf("invalid prekey in prekey response: %w", err) + } } + signedPreKey, err := nodeToPreKey(keysNode.GetChildByTag("skey")) if err != nil { return nil, fmt.Errorf("invalid signed prekey in prekey response: %w", err) } - return prekey.NewBundle(registrationID, deviceID, - optional.NewOptionalUint32(preKey.KeyID), signedPreKey.KeyID, - ecc.NewDjbECPublicKey(*preKey.Pub), ecc.NewDjbECPublicKey(*signedPreKey.Pub), *signedPreKey.Signature, - identity.NewKey(ecc.NewDjbECPublicKey(identityKeyPub))), nil + var bundle *prekey.Bundle + if ok { + bundle = prekey.NewBundle(registrationID, deviceID, + optional.NewOptionalUint32(preKey.KeyID), signedPreKey.KeyID, + ecc.NewDjbECPublicKey(*preKey.Pub), ecc.NewDjbECPublicKey(*signedPreKey.Pub), *signedPreKey.Signature, + identity.NewKey(ecc.NewDjbECPublicKey(identityKeyPub))) + } else { + bundle = prekey.NewBundle(registrationID, deviceID, optional.NewEmptyUint32(), signedPreKey.KeyID, + nil, ecc.NewDjbECPublicKey(*signedPreKey.Pub), *signedPreKey.Signature, + identity.NewKey(ecc.NewDjbECPublicKey(identityKeyPub))) + } + + return bundle, nil } func nodeToPreKey(node waBinary.Node) (*keys.PreKey, error) { diff --git a/vendor/go.mau.fi/whatsmeow/proto/extra.go b/vendor/go.mau.fi/whatsmeow/proto/extra.go index a4a5fe7b..444d93e7 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/extra.go +++ b/vendor/go.mau.fi/whatsmeow/proto/extra.go @@ -1,6 +1,8 @@ package armadillo import ( + "google.golang.org/protobuf/proto" + "go.mau.fi/whatsmeow/proto/waArmadilloApplication" "go.mau.fi/whatsmeow/proto/waCommon" "go.mau.fi/whatsmeow/proto/waConsumerApplication" @@ -11,6 +13,11 @@ type MessageApplicationSub interface { IsMessageApplicationSub() } +type RealMessageApplicationSub interface { + MessageApplicationSub + proto.Message +} + type Unsupported_BusinessApplication waCommon.SubProtocol type Unsupported_PaymentApplication waCommon.SubProtocol type Unsupported_Voip waCommon.SubProtocol diff --git a/vendor/go.mau.fi/whatsmeow/proto/generate.sh b/vendor/go.mau.fi/whatsmeow/proto/generate.sh deleted file mode 100644 index 11e855b2..00000000 --- a/vendor/go.mau.fi/whatsmeow/proto/generate.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -cd $(dirname $0) -set -euo pipefail -if [[ ! -f "protos.js" ]]; then - echo "Please download the WhatsApp JavaScript modules with protobuf schemas into protos.js first" - exit 1 -fi -node parse-proto.js -protoc --go_out=. --go_opt=paths=source_relative --go_opt=embed_raw=true */*.proto -pre-commit run -a diff --git a/vendor/go.mau.fi/whatsmeow/proto/parse-proto.js b/vendor/go.mau.fi/whatsmeow/proto/parse-proto.js deleted file mode 100644 index 2ba0a4a1..00000000 --- a/vendor/go.mau.fi/whatsmeow/proto/parse-proto.js +++ /dev/null @@ -1,469 +0,0 @@ -/////////////////// -// JS EVALUATION // -/////////////////// - -const protos = [] -const modules = { - "$InternalEnum": { - exports: { - exports: function (data) { - data.__enum__ = true - return data - } - } - }, -} - -const depRenameMap = { - "WAProtocol.pb": "WACommon.pb", - "WAWebProtobufsProtocol.pb": "WACommon.pb", - "WAWebProtobufsAdv.pb": "WAAdv.pb", - "WAWebProtobufsMmsRetry.pb": "WAMmsRetry.pb", - "WAWebProtobufSyncAction.pb": "WASyncAction.pb", - "WAWebProtobufsFingerprintV3.pb": "WAFingerprint.pb", - "WAWebProtobufsDeviceCapabilities.pb": "WAProtobufsDeviceCapabilities.pb", - "WAWebProtobufsChatLockSettings.pb": "WAProtobufsChatLockSettings.pb", - "WAWebProtobufsUserPassword.pb": "WAProtobufsUserPassword.pb", -} - -function requireModule(name) { - name = depRenameMap[name] ?? name - if (!modules[name]) { - throw new Error(`Unknown requirement ${name}`) - } - return modules[name].exports -} - -function requireDefault(name) { - return requireModule(name).exports -} - -function ignoreModule(name) { - if (name === "WAProtoConst") { - return false - } else if (!name.endsWith(".pb")) { - // Ignore any non-protobuf modules, except WAProtoConst above - return true - } else if (name.startsWith("MAWArmadillo") && (name.endsWith("TableSchema.pb") || name.endsWith("TablesSchema.pb"))) { - // Ignore internal table schemas - return true - } else if (name.startsWith("WAWebProtobufsMdStorage")) { - return true - } else if (["WAWebProtobufsAdv.pb", "WAWebProtobufsMmsRetry.pb", "WAWebProtobufSyncAction.pb", "WAWebProtobufsFingerprintV3.pb", - "WAWebProtobufsDeviceCapabilities.pb", "WAWebProtobufsChatLockSettings.pb", "WAWebProtobufsUserPassword.pb", - "WAProtocol.pb", "WAWebProtobufsProtocol.pb"].includes(name)) { - // Ignore duplicates (e.g. WAAdv.pb is the same as WAWebProtobufsAdv.pb) - return true - } else if (["WAWa5.pb", "WAE2E.pb"].includes(name)) { - // Ignore the shorter version of duplicates when the WebProtobufs one has more fields - return true - } else if (name === "WASignalLocalStorageProtocol.pb" || name === "WASignalWhisperTextProtocol.pb") { - // Ignore standard signal protocol stuff - return true - } else { - return false - } -} - -const lazyModules = {} - -function defineModule(name, dependencies, callback, unknownIntOrNull) { - if (ignoreModule(name)) { - return - } else if (modules[name]) { - return // ignore duplicates - } - dependencies = dependencies.map(dep => depRenameMap[dep] ?? dep) - lazyModules[name] = { - dependencies, - load: () => { - const exports = {} - if (dependencies.length > 0) { - callback(null, requireDefault, null, requireModule, null, null, exports) - } else { - callback(null, requireDefault, null, requireModule, exports, exports) - } - modules[name] = {exports, dependencies} - } - } -} - -function loadLazyModule(name) { - if (modules[name]) { - return - } - const mod = lazyModules[name] - for (const dep of mod.dependencies) { - loadLazyModule(dep) - } - console.log("Loading", name, mod.dependencies) - mod.load() -} - -function loadLazyModules() { - for (const name of Object.keys(lazyModules)) { - loadLazyModule(name) - } -} - -global.self = global -global.__d = defineModule -global.window = {} - -/*const neededFiles = new Map() -require("child_process").spawnSync("grep", ["-Er", `^__d\\("([A-Za-z0-9]+\\.pb|WAProtoConst)",`, 'js']) - .stdout - .toString() - .split("\n") - .forEach(line => { - if (!line) { - return - } - const match = line.match(/^(.+\.js):__d\("([A-Za-z0-9]+\.pb|WAProtoConst)",/) - const file = match[1] - const module = match[2] - if (module.startsWith("MAWArmadillo") && (module.endsWith("TableSchema.pb") || module.endsWith("TablesSchema.pb"))) { - return - } else if (module.startsWith("Instamadillo")) { - return - } - if (!neededFiles.has(file)) { - neededFiles.set(file, []) - } - neededFiles.get(file).push(module) - }) -const neededFilesList = [...neededFiles.entries()] - -const alreadyImported = new Set() -for (const [file, modules] of neededFilesList) { - if (modules.every(mod => alreadyImported.has(mod))) { - console.log("Skipping", file, "(only duplicates)") - } else { - modules.forEach(mod => alreadyImported.add(mod)) - console.log("Requiring", file, "for", modules) - require(`./${file}`) - } -}*/ -require("./protos.js") -console.log("Requirements loaded, evaluating...") -loadLazyModules() -console.log("Everything required") - -function dereference(obj, module, currentPath, next, ...remainder) { - if (!next) { - return obj - } - if (!obj.messages[next]) { - obj.messages[next] = {messages: {}, enums: {}, __module__: module, __path__: currentPath, __name__: next} - } - return dereference(obj.messages[next], module, currentPath.concat([next]), ...remainder) -} - -function dereferenceSnake(obj, currentPath, path) { - let next = path[0] - path = path.slice(1) - while (!obj.messages[next]) { - if (path.length === 0) { - return [obj, currentPath, next] - } - next += path[0] - path = path.slice(1) - } - return dereferenceSnake(obj.messages[next], currentPath.concat([next]), path) -} - -function renameModule(name) { - return name.replace(".pb", "") -} - -function renameDependencies(dependencies) { - return dependencies - .filter(name => name.endsWith(".pb")) - .map(renameModule) - // .map(name => name === "WAProtocol" ? "WACommon" : name) -} - -function renameType(protoName, fieldName, field) { - fieldName = fieldName.replace(/Spec$/, "") - if (protoName === "WAWebProtobufsE2E" && fieldName.startsWith("Message$")) { - fieldName = fieldName.replace(/^Message\$/, "") - } else if (protoName === "WASyncAction" && fieldName.startsWith("SyncActionValue$")) { - fieldName = fieldName.replace(/^SyncActionValue\$/, "") - } - return fieldName -} - -for (const [name, module] of Object.entries(modules)) { - if (!name.endsWith(".pb")) { - continue - } else if (!module.exports) { - console.warn(name, "has no exports") - continue - } - // Slightly hacky way to get rid of WAProtocol.pb and just use the MessageKey in WACommon - // if (name === "WAProtocol.pb" || name === "WAWebProtobufsProtocol.pb") { - // if (Object.entries(module.exports).length > 1) { - // console.warn("WAProtocol.pb has more than one export") - // } - // module.exports["MessageKeySpec"].__name__ = "MessageKey" - // module.exports["MessageKeySpec"].__module__ = "WACommon" - // module.exports["MessageKeySpec"].__path__ = [] - // continue - // } - const proto = { - __protobuf__: true, - messages: {}, - enums: {}, - __name__: renameModule(name), - dependencies: renameDependencies(module.dependencies), - } - const upperSnakeEnums = [] - for (const [name, field] of Object.entries(module.exports)) { - const namePath = renameType(proto.__name__, name, field).split("$") - field.__name__ = namePath[namePath.length - 1] - namePath[namePath.length - 1] = field.__name__ - field.__path__ = namePath.slice(0, -1) - field.__module__ = proto.__name__ - if (field.internalSpec) { - dereference(proto, proto.__name__, [], ...namePath).message = field.internalSpec - } else if (namePath.length === 1 && name.toUpperCase() === name) { - upperSnakeEnums.push(field) - } else { - dereference(proto, proto.__name__, [], ...namePath.slice(0, -1)).enums[field.__name__] = field - } - } - // Some enums have uppercase names, instead of capital case with $ separators. - // For those, we need to find the right nesting location. - for (const field of upperSnakeEnums) { - field.__enum__ = true - const [obj, path, name] = dereferenceSnake(proto, [], field.__name__.split("_").map(part => part[0] + part.slice(1).toLowerCase())) - field.__path__ = path - field.__name__ = name - field.__module__ = proto.__name__ - obj.enums[name] = field - } - protos.push(proto) -} - -//////////////////////////////// -// PROTOBUF SCHEMA GENERATION // -//////////////////////////////// - -function indent(lines, indent = "\t") { - return lines.map(line => line ? `${indent}${line}` : "") -} - -function flattenWithBlankLines(...items) { - return items - .flatMap(item => item.length > 0 ? [item, [""]] : []) - .slice(0, -1) - .flatMap(item => item) -} - -function protoifyChildren(container, proto3) { - return flattenWithBlankLines( - ...Object.values(container.enums).map(protoifyEnum), - ...Object.values(container.messages).map(msg => protoifyMessage(msg, proto3)), - ) -} - -function protoifyEnum(enumDef) { - const values = [] - const names = Object.fromEntries(Object.entries(enumDef).map(([name, value]) => [value, name])) - if (!names["0"]) { - if (names["-1"]) { - enumDef[names["-1"]] = 0 - } else { - // TODO add snake case - // values.push(`${enumDef.__name__.toUpperCase()}_AUTOGEN_UNKNOWN = 0;`) - } - } - for (const [name, value] of Object.entries(enumDef)) { - if (name.startsWith("__") && name.endsWith("__")) { - continue - } - values.push(`${name} = ${value};`) - } - return [`enum ${enumDef.__name__} ` + "{", ...indent(values), "}"] -} - -const {TYPES, TYPE_MASK, FLAGS} = requireModule("WAProtoConst") - -function mapFieldTypeName(ref, parentModule, parentPath) { - if (typeof ref === "object") { - return fieldTypeName(TYPES.MESSAGE, ref, parentModule, parentPath) - } else { - return fieldTypeName(ref, undefined, parentModule, parentPath) - } -} - -function fieldTypeName(typeID, typeRef, parentModule, parentPath) { - switch (typeID) { - case TYPES.INT32: - return "int32" - case TYPES.INT64: - return "int64" - case TYPES.UINT32: - return "uint32" - case TYPES.UINT64: - return "uint64" - case TYPES.SINT32: - return "sint32" - case TYPES.SINT64: - return "sint64" - case TYPES.BOOL: - return "bool" - case TYPES.ENUM: - case TYPES.MESSAGE: - let pathStartIndex = 0 - for (let i = 0; i < parentPath.length && i < typeRef.__path__.length; i++) { - if (typeRef.__path__[i] === parentPath[i]) { - pathStartIndex++ - } else { - break - } - } - const namePath = [] - if (typeRef.__module__ !== parentModule) { - namePath.push(typeRef.__module__) - pathStartIndex = 0 - } - namePath.push(...typeRef.__path__.slice(pathStartIndex)) - namePath.push(typeRef.__name__) - return namePath.join(".") - case TYPES.MAP: - return `map<${mapFieldTypeName(typeRef[0], parentModule, parentPath)}, ${mapFieldTypeName(typeRef[1], parentModule, parentPath)}>` - case TYPES.FIXED64: - return "fixed64" - case TYPES.SFIXED64: - return "sfixed64" - case TYPES.DOUBLE: - return "double" - case TYPES.STRING: - return "string" - case TYPES.BYTES: - return "bytes" - case TYPES.FIXED32: - return "fixed32" - case TYPES.SFIXED32: - return "sfixed32" - case TYPES.FLOAT: - return "float" - } -} - -const staticRenames = { - id: "ID", - jid: "JID", - encIv: "encIV", - iv: "IV", - ptt: "PTT", - hmac: "HMAC", - url: "URL", - fbid: "FBID", - jpegThumbnail: "JPEGThumbnail", - dsm: "DSM", -} - -function fixFieldName(name) { - if (name === "id") { - return "ID" - } else if (name === "encIv") { - return "encIV" - } - return staticRenames[name] ?? name - .replace(/Id([A-Zs]|$)/, "ID$1") - .replace("Jid", "JID") - .replace(/Ms([A-Z]|$)/, "MS$1") - .replace(/Ts([A-Z]|$)/, "TS$1") - .replace(/Mac([A-Z]|$)/, "MAC$1") - .replace("Url", "URL") - .replace("Cdn", "CDN") - .replace("Json", "JSON") - .replace("Jpeg", "JPEG") - .replace("Sha256", "SHA256") -} - -function protoifyField(name, [index, flags, typeRef], parentModule, parentPath, isOneOf, proto3) { - const preflags = [] - const postflags = [""] - const isMap = (flags & TYPE_MASK) === TYPES.MAP - if (!isOneOf) { - if ((flags & FLAGS.REPEATED) !== 0) { - preflags.push("repeated") - } else if (!proto3) { - if ((flags & FLAGS.REQUIRED) === 0) { - preflags.push("optional") - } else { - preflags.push("required") - } - } - } - preflags.push(fieldTypeName(flags & TYPE_MASK, typeRef, parentModule, parentPath)) - if ((flags & FLAGS.PACKED) !== 0) { - postflags.push(`[packed=true]`) - } - return `${preflags.join(" ")} ${fixFieldName(name)} = ${index}${postflags.join(" ")};` -} - -function protoifyFields(fields, parentModule, parentPath, isOneOf, proto3) { - return Object.entries(fields).map(([name, definition]) => protoifyField(name, definition, parentModule, parentPath, isOneOf, proto3)) -} - -function protoifyMessage(message, proto3) { - const sections = [protoifyChildren(message, proto3)] - const spec = message.message - const fullMessagePath = message.__path__.concat([message.__name__]) - for (const [name, fieldNames] of Object.entries(spec.__oneofs__ ?? {})) { - const fields = Object.fromEntries(fieldNames.map(fieldName => { - const def = spec[fieldName] - delete spec[fieldName] - return [fieldName, def] - })) - sections.push([`oneof ${name} ` + "{", ...indent(protoifyFields(fields, message.__module__, fullMessagePath, true, proto3)), "}"]) - } - if (spec.__reserved__) { - console.warn("Found reserved keys:", message.__name__, spec.__reserved__) - } - delete spec.__oneofs__ - delete spec.__reserved__ - sections.push(protoifyFields(spec, message.__module__, fullMessagePath, false, proto3)) - return [`message ${message.__name__} ` + "{", ...indent(flattenWithBlankLines(...sections)), "}"] -} - -function goPackageName(name) { - return name.replace(/^WA/, "wa").replace("WebProtobufs", "").replace("Protobufs", "") -} - -const needsProto3 = { - "WAWebProtobufsReporting": true -} - -function protoifyModule(module) { - const output = [] - const proto3 = needsProto3[module.__name__] - if (proto3) { - output.push(`syntax = "proto3";`) - } else { - output.push(`syntax = "proto2";`) - } - output.push(`package ${module.__name__};`) - output.push(`option go_package = "go.mau.fi/whatsmeow/proto/${goPackageName(module.__name__)}";`) - output.push("") - if (module.dependencies.length > 0) { - for (const dependency of module.dependencies) { - output.push(`import "${goPackageName(dependency)}/${dependency}.proto";`) - } - output.push("") - } - const children = protoifyChildren(module, proto3) - children.push("") - return output.concat(children) -} - -const fs = require("fs") - -for (const proto of protos) { - fs.mkdirSync(goPackageName(proto.__name__), {recursive: true}) - fs.writeFileSync(`${goPackageName(proto.__name__)}/${proto.__name__}.proto`, protoifyModule(proto).join("\n")) -} diff --git a/vendor/go.mau.fi/whatsmeow/proto/waAdv/WAAdv.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waAdv/WAAdv.pb.go index 80b12712..8019cc38 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waAdv/WAAdv.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waAdv/WAAdv.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waAdv/WAAdv.proto @@ -453,7 +453,7 @@ func file_waAdv_WAAdv_proto_rawDescGZIP() []byte { var file_waAdv_WAAdv_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_waAdv_WAAdv_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_waAdv_WAAdv_proto_goTypes = []interface{}{ +var file_waAdv_WAAdv_proto_goTypes = []any{ (ADVEncryptionType)(0), // 0: WAAdv.ADVEncryptionType (*ADVKeyIndexList)(nil), // 1: WAAdv.ADVKeyIndexList (*ADVSignedKeyIndexList)(nil), // 2: WAAdv.ADVSignedKeyIndexList @@ -479,7 +479,7 @@ func file_waAdv_WAAdv_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waAdv_WAAdv_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waAdv_WAAdv_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*ADVKeyIndexList); i { case 0: return &v.state @@ -491,7 +491,7 @@ func file_waAdv_WAAdv_proto_init() { return nil } } - file_waAdv_WAAdv_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waAdv_WAAdv_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*ADVSignedKeyIndexList); i { case 0: return &v.state @@ -503,7 +503,7 @@ func file_waAdv_WAAdv_proto_init() { return nil } } - file_waAdv_WAAdv_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waAdv_WAAdv_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*ADVDeviceIdentity); i { case 0: return &v.state @@ -515,7 +515,7 @@ func file_waAdv_WAAdv_proto_init() { return nil } } - file_waAdv_WAAdv_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waAdv_WAAdv_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*ADVSignedDeviceIdentity); i { case 0: return &v.state @@ -527,7 +527,7 @@ func file_waAdv_WAAdv_proto_init() { return nil } } - file_waAdv_WAAdv_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_waAdv_WAAdv_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*ADVSignedDeviceIdentityHMAC); i { case 0: return &v.state diff --git a/vendor/go.mau.fi/whatsmeow/proto/waArmadilloApplication/WAArmadilloApplication.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waArmadilloApplication/WAArmadilloApplication.pb.go index 20054351..63f2ce7f 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waArmadilloApplication/WAArmadilloApplication.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waArmadilloApplication/WAArmadilloApplication.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waArmadilloApplication/WAArmadilloApplication.proto @@ -2526,7 +2526,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_rawDescGZIP() []by var file_waArmadilloApplication_WAArmadilloApplication_proto_enumTypes = make([]protoimpl.EnumInfo, 6) var file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes = make([]protoimpl.MessageInfo, 29) -var file_waArmadilloApplication_WAArmadilloApplication_proto_goTypes = []interface{}{ +var file_waArmadilloApplication_WAArmadilloApplication_proto_goTypes = []any{ (Armadillo_Signal_EncryptedBackupsSecrets_Epoch_EpochStatus)(0), // 0: WAArmadilloApplication.Armadillo.Signal.EncryptedBackupsSecrets.Epoch.EpochStatus (Armadillo_Content_PaymentsTransactionMessage_PaymentStatus)(0), // 1: WAArmadilloApplication.Armadillo.Content.PaymentsTransactionMessage.PaymentStatus (Armadillo_Content_ScreenshotAction_ScreenshotType)(0), // 2: WAArmadilloApplication.Armadillo.Content.ScreenshotAction.ScreenshotType @@ -2634,7 +2634,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*Armadillo); i { case 0: return &v.state @@ -2646,7 +2646,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_Metadata); i { case 0: return &v.state @@ -2658,7 +2658,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_Payload); i { case 0: return &v.state @@ -2670,7 +2670,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_SubProtocolPayload); i { case 0: return &v.state @@ -2682,7 +2682,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_Signal); i { case 0: return &v.state @@ -2694,7 +2694,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_ApplicationData); i { case 0: return &v.state @@ -2706,7 +2706,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_Content); i { case 0: return &v.state @@ -2718,7 +2718,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_Signal_EncryptedBackupsSecrets); i { case 0: return &v.state @@ -2730,7 +2730,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_Signal_EncryptedBackupsSecrets_Epoch); i { case 0: return &v.state @@ -2742,7 +2742,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_ApplicationData_AIBotResponseMessage); i { case 0: return &v.state @@ -2754,7 +2754,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_ApplicationData_MetadataSyncAction); i { case 0: return &v.state @@ -2766,7 +2766,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_ApplicationData_MetadataSyncNotification); i { case 0: return &v.state @@ -2778,7 +2778,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[12].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_ApplicationData_MetadataSyncAction_SyncMessageAction); i { case 0: return &v.state @@ -2790,7 +2790,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[13].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_ApplicationData_MetadataSyncAction_SyncChatAction); i { case 0: return &v.state @@ -2802,7 +2802,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[14].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_ApplicationData_MetadataSyncAction_SyncActionMessage); i { case 0: return &v.state @@ -2814,7 +2814,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[15].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_ApplicationData_MetadataSyncAction_SyncActionMessageRange); i { case 0: return &v.state @@ -2826,7 +2826,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[16].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_ApplicationData_MetadataSyncAction_SyncMessageAction_ActionMessageDelete); i { case 0: return &v.state @@ -2838,7 +2838,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[17].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_ApplicationData_MetadataSyncAction_SyncChatAction_ActionChatRead); i { case 0: return &v.state @@ -2850,7 +2850,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[18].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_ApplicationData_MetadataSyncAction_SyncChatAction_ActionChatDelete); i { case 0: return &v.state @@ -2862,7 +2862,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[19].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_ApplicationData_MetadataSyncAction_SyncChatAction_ActionChatArchive); i { case 0: return &v.state @@ -2874,7 +2874,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[20].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_Content_PaymentsTransactionMessage); i { case 0: return &v.state @@ -2886,7 +2886,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[21].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_Content_NoteReplyMessage); i { case 0: return &v.state @@ -2898,7 +2898,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[22].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_Content_BumpExistingMessage); i { case 0: return &v.state @@ -2910,7 +2910,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[23].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_Content_ImageGalleryMessage); i { case 0: return &v.state @@ -2922,7 +2922,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[24].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_Content_ScreenshotAction); i { case 0: return &v.state @@ -2934,7 +2934,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[25].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_Content_ExtendedContentMessageWithSear); i { case 0: return &v.state @@ -2946,7 +2946,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[26].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_Content_RavenActionNotifMessage); i { case 0: return &v.state @@ -2958,7 +2958,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[27].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_Content_RavenMessage); i { case 0: return &v.state @@ -2970,7 +2970,7 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { return nil } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[28].Exporter = func(v any, i int) any { switch v := v.(*Armadillo_Content_CommonSticker); i { case 0: return &v.state @@ -2983,20 +2983,20 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { } } } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[2].OneofWrappers = []interface{}{ + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[2].OneofWrappers = []any{ (*Armadillo_Payload_Content)(nil), (*Armadillo_Payload_ApplicationData)(nil), (*Armadillo_Payload_Signal)(nil), (*Armadillo_Payload_SubProtocol)(nil), } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[4].OneofWrappers = []interface{}{ + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[4].OneofWrappers = []any{ (*Armadillo_Signal_EncryptedBackupsSecrets_)(nil), } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[5].OneofWrappers = []interface{}{ + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[5].OneofWrappers = []any{ (*Armadillo_ApplicationData_MetadataSync)(nil), (*Armadillo_ApplicationData_AiBotResponse)(nil), } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[6].OneofWrappers = []interface{}{ + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[6].OneofWrappers = []any{ (*Armadillo_Content_CommonSticker_)(nil), (*Armadillo_Content_ScreenshotAction_)(nil), (*Armadillo_Content_ExtendedContentMessage)(nil), @@ -3009,24 +3009,24 @@ func file_waArmadilloApplication_WAArmadilloApplication_proto_init() { (*Armadillo_Content_NoteReplyMessage_)(nil), (*Armadillo_Content_RavenMessageMsgr)(nil), } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[10].OneofWrappers = []interface{}{ + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[10].OneofWrappers = []any{ (*Armadillo_ApplicationData_MetadataSyncAction_ChatAction)(nil), (*Armadillo_ApplicationData_MetadataSyncAction_MessageAction)(nil), } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[12].OneofWrappers = []interface{}{ + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[12].OneofWrappers = []any{ (*Armadillo_ApplicationData_MetadataSyncAction_SyncMessageAction_MessageDelete)(nil), } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[13].OneofWrappers = []interface{}{ + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[13].OneofWrappers = []any{ (*Armadillo_ApplicationData_MetadataSyncAction_SyncChatAction_ChatArchive)(nil), (*Armadillo_ApplicationData_MetadataSyncAction_SyncChatAction_ChatDelete)(nil), (*Armadillo_ApplicationData_MetadataSyncAction_SyncChatAction_ChatRead)(nil), } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[21].OneofWrappers = []interface{}{ + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[21].OneofWrappers = []any{ (*Armadillo_Content_NoteReplyMessage_TextContent)(nil), (*Armadillo_Content_NoteReplyMessage_StickerContent)(nil), (*Armadillo_Content_NoteReplyMessage_VideoContent)(nil), } - file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[27].OneofWrappers = []interface{}{ + file_waArmadilloApplication_WAArmadilloApplication_proto_msgTypes[27].OneofWrappers = []any{ (*Armadillo_Content_RavenMessage_ImageMessage)(nil), (*Armadillo_Content_RavenMessage_VideoMessage)(nil), } diff --git a/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.go index 06407066..f54a7f3f 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waArmadilloXMA/WAArmadilloXMA.proto @@ -228,6 +228,7 @@ func (ExtendedContentMessage_XmaLayoutType) EnumDescriptor() ([]byte, []int) { type ExtendedContentMessage_ExtendedContentType int32 const ( + ExtendedContentMessage_UNSUPPORTED ExtendedContentMessage_ExtendedContentType = 0 ExtendedContentMessage_IG_STORY_PHOTO_MENTION ExtendedContentMessage_ExtendedContentType = 4 ExtendedContentMessage_IG_SINGLE_IMAGE_POST_SHARE ExtendedContentMessage_ExtendedContentType = 9 ExtendedContentMessage_IG_MULTIPOST_SHARE ExtendedContentMessage_ExtendedContentType = 10 @@ -275,6 +276,13 @@ const ( ExtendedContentMessage_MSG_AI_CONTACT ExtendedContentMessage_ExtendedContentType = 2014 ExtendedContentMessage_MSG_MEMORIES_SHARE ExtendedContentMessage_ExtendedContentType = 2015 ExtendedContentMessage_MSG_SHARED_ALBUM_REPLY ExtendedContentMessage_ExtendedContentType = 2016 + ExtendedContentMessage_MSG_SHARED_ALBUM ExtendedContentMessage_ExtendedContentType = 2017 + ExtendedContentMessage_MSG_OCCAMADILLO_XMA ExtendedContentMessage_ExtendedContentType = 2018 + ExtendedContentMessage_MSG_GEN_AI_SUBSCRIPTION ExtendedContentMessage_ExtendedContentType = 2021 + ExtendedContentMessage_MSG_GEN_AI_REMINDER ExtendedContentMessage_ExtendedContentType = 2022 + ExtendedContentMessage_MSG_GEN_AI_MEMU_ONBOARDING_RESPONSE ExtendedContentMessage_ExtendedContentType = 2023 + ExtendedContentMessage_MSG_NOTE_REPLY ExtendedContentMessage_ExtendedContentType = 2024 + ExtendedContentMessage_MSG_NOTE_MENTION ExtendedContentMessage_ExtendedContentType = 2025 ExtendedContentMessage_RTC_AUDIO_CALL ExtendedContentMessage_ExtendedContentType = 3000 ExtendedContentMessage_RTC_VIDEO_CALL ExtendedContentMessage_ExtendedContentType = 3001 ExtendedContentMessage_RTC_MISSED_AUDIO_CALL ExtendedContentMessage_ExtendedContentType = 3002 @@ -289,6 +297,7 @@ const ( // Enum value maps for ExtendedContentMessage_ExtendedContentType. var ( ExtendedContentMessage_ExtendedContentType_name = map[int32]string{ + 0: "UNSUPPORTED", 4: "IG_STORY_PHOTO_MENTION", 9: "IG_SINGLE_IMAGE_POST_SHARE", 10: "IG_MULTIPOST_SHARE", @@ -336,6 +345,13 @@ var ( 2014: "MSG_AI_CONTACT", 2015: "MSG_MEMORIES_SHARE", 2016: "MSG_SHARED_ALBUM_REPLY", + 2017: "MSG_SHARED_ALBUM", + 2018: "MSG_OCCAMADILLO_XMA", + 2021: "MSG_GEN_AI_SUBSCRIPTION", + 2022: "MSG_GEN_AI_REMINDER", + 2023: "MSG_GEN_AI_MEMU_ONBOARDING_RESPONSE", + 2024: "MSG_NOTE_REPLY", + 2025: "MSG_NOTE_MENTION", 3000: "RTC_AUDIO_CALL", 3001: "RTC_VIDEO_CALL", 3002: "RTC_MISSED_AUDIO_CALL", @@ -347,6 +363,7 @@ var ( 4000: "DATACLASS_SENDER_COPY", } ExtendedContentMessage_ExtendedContentType_value = map[string]int32{ + "UNSUPPORTED": 0, "IG_STORY_PHOTO_MENTION": 4, "IG_SINGLE_IMAGE_POST_SHARE": 9, "IG_MULTIPOST_SHARE": 10, @@ -394,6 +411,13 @@ var ( "MSG_AI_CONTACT": 2014, "MSG_MEMORIES_SHARE": 2015, "MSG_SHARED_ALBUM_REPLY": 2016, + "MSG_SHARED_ALBUM": 2017, + "MSG_OCCAMADILLO_XMA": 2018, + "MSG_GEN_AI_SUBSCRIPTION": 2021, + "MSG_GEN_AI_REMINDER": 2022, + "MSG_GEN_AI_MEMU_ONBOARDING_RESPONSE": 2023, + "MSG_NOTE_REPLY": 2024, + "MSG_NOTE_MENTION": 2025, "RTC_AUDIO_CALL": 3000, "RTC_VIDEO_CALL": 3001, "RTC_MISSED_AUDIO_CALL": 3002, @@ -471,6 +495,8 @@ type ExtendedContentMessage struct { HeaderSubtitle *string `protobuf:"bytes,21,opt,name=headerSubtitle" json:"headerSubtitle,omitempty"` XmaDataclass *string `protobuf:"bytes,22,opt,name=xmaDataclass" json:"xmaDataclass,omitempty"` ContentRef *string `protobuf:"bytes,23,opt,name=contentRef" json:"contentRef,omitempty"` + MentionedJID []string `protobuf:"bytes,24,rep,name=mentionedJID" json:"mentionedJID,omitempty"` + Commands []*waCommon.Command `protobuf:"bytes,25,rep,name=commands" json:"commands,omitempty"` } func (x *ExtendedContentMessage) Reset() { @@ -516,7 +542,7 @@ func (x *ExtendedContentMessage) GetTargetType() ExtendedContentMessage_Extended if x != nil && x.TargetType != nil { return *x.TargetType } - return ExtendedContentMessage_IG_STORY_PHOTO_MENTION + return ExtendedContentMessage_UNSUPPORTED } func (x *ExtendedContentMessage) GetTargetUsername() string { @@ -666,6 +692,20 @@ func (x *ExtendedContentMessage) GetContentRef() string { return "" } +func (x *ExtendedContentMessage) GetMentionedJID() []string { + if x != nil { + return x.MentionedJID + } + return nil +} + +func (x *ExtendedContentMessage) GetCommands() []*waCommon.Command { + if x != nil { + return x.Commands + } + return nil +} + type ExtendedContentMessage_CTA struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -772,7 +812,7 @@ func file_waArmadilloXMA_WAArmadilloXMA_proto_rawDescGZIP() []byte { var file_waArmadilloXMA_WAArmadilloXMA_proto_enumTypes = make([]protoimpl.EnumInfo, 4) var file_waArmadilloXMA_WAArmadilloXMA_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_waArmadilloXMA_WAArmadilloXMA_proto_goTypes = []interface{}{ +var file_waArmadilloXMA_WAArmadilloXMA_proto_goTypes = []any{ (ExtendedContentMessage_OverlayIconGlyph)(0), // 0: WAArmadilloXMA.ExtendedContentMessage.OverlayIconGlyph (ExtendedContentMessage_CtaButtonType)(0), // 1: WAArmadilloXMA.ExtendedContentMessage.CtaButtonType (ExtendedContentMessage_XmaLayoutType)(0), // 2: WAArmadilloXMA.ExtendedContentMessage.XmaLayoutType @@ -780,22 +820,24 @@ var file_waArmadilloXMA_WAArmadilloXMA_proto_goTypes = []interface{}{ (*ExtendedContentMessage)(nil), // 4: WAArmadilloXMA.ExtendedContentMessage (*ExtendedContentMessage_CTA)(nil), // 5: WAArmadilloXMA.ExtendedContentMessage.CTA (*waCommon.SubProtocol)(nil), // 6: WACommon.SubProtocol + (*waCommon.Command)(nil), // 7: WACommon.Command } var file_waArmadilloXMA_WAArmadilloXMA_proto_depIdxs = []int32{ - 6, // 0: WAArmadilloXMA.ExtendedContentMessage.associatedMessage:type_name -> WACommon.SubProtocol - 3, // 1: WAArmadilloXMA.ExtendedContentMessage.targetType:type_name -> WAArmadilloXMA.ExtendedContentMessage.ExtendedContentType - 2, // 2: WAArmadilloXMA.ExtendedContentMessage.xmaLayoutType:type_name -> WAArmadilloXMA.ExtendedContentMessage.XmaLayoutType - 5, // 3: WAArmadilloXMA.ExtendedContentMessage.ctas:type_name -> WAArmadilloXMA.ExtendedContentMessage.CTA - 6, // 4: WAArmadilloXMA.ExtendedContentMessage.previews:type_name -> WACommon.SubProtocol - 6, // 5: WAArmadilloXMA.ExtendedContentMessage.favicon:type_name -> WACommon.SubProtocol - 6, // 6: WAArmadilloXMA.ExtendedContentMessage.headerImage:type_name -> WACommon.SubProtocol - 0, // 7: WAArmadilloXMA.ExtendedContentMessage.overlayIconGlyph:type_name -> WAArmadilloXMA.ExtendedContentMessage.OverlayIconGlyph - 1, // 8: WAArmadilloXMA.ExtendedContentMessage.CTA.buttonType:type_name -> WAArmadilloXMA.ExtendedContentMessage.CtaButtonType - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 6, // 0: WAArmadilloXMA.ExtendedContentMessage.associatedMessage:type_name -> WACommon.SubProtocol + 3, // 1: WAArmadilloXMA.ExtendedContentMessage.targetType:type_name -> WAArmadilloXMA.ExtendedContentMessage.ExtendedContentType + 2, // 2: WAArmadilloXMA.ExtendedContentMessage.xmaLayoutType:type_name -> WAArmadilloXMA.ExtendedContentMessage.XmaLayoutType + 5, // 3: WAArmadilloXMA.ExtendedContentMessage.ctas:type_name -> WAArmadilloXMA.ExtendedContentMessage.CTA + 6, // 4: WAArmadilloXMA.ExtendedContentMessage.previews:type_name -> WACommon.SubProtocol + 6, // 5: WAArmadilloXMA.ExtendedContentMessage.favicon:type_name -> WACommon.SubProtocol + 6, // 6: WAArmadilloXMA.ExtendedContentMessage.headerImage:type_name -> WACommon.SubProtocol + 0, // 7: WAArmadilloXMA.ExtendedContentMessage.overlayIconGlyph:type_name -> WAArmadilloXMA.ExtendedContentMessage.OverlayIconGlyph + 7, // 8: WAArmadilloXMA.ExtendedContentMessage.commands:type_name -> WACommon.Command + 1, // 9: WAArmadilloXMA.ExtendedContentMessage.CTA.buttonType:type_name -> WAArmadilloXMA.ExtendedContentMessage.CtaButtonType + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { file_waArmadilloXMA_WAArmadilloXMA_proto_init() } @@ -804,7 +846,7 @@ func file_waArmadilloXMA_WAArmadilloXMA_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waArmadilloXMA_WAArmadilloXMA_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloXMA_WAArmadilloXMA_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*ExtendedContentMessage); i { case 0: return &v.state @@ -816,7 +858,7 @@ func file_waArmadilloXMA_WAArmadilloXMA_proto_init() { return nil } } - file_waArmadilloXMA_WAArmadilloXMA_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waArmadilloXMA_WAArmadilloXMA_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*ExtendedContentMessage_CTA); i { case 0: return &v.state diff --git a/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.raw b/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.raw index 91a2ff4e..30ee16d5 100644 Binary files a/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.raw and b/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.raw differ diff --git a/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.proto b/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.proto index f71aa556..61745643 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.proto +++ b/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.proto @@ -32,6 +32,7 @@ message ExtendedContentMessage { } enum ExtendedContentType { + UNSUPPORTED = 0; IG_STORY_PHOTO_MENTION = 4; IG_SINGLE_IMAGE_POST_SHARE = 9; IG_MULTIPOST_SHARE = 10; @@ -79,6 +80,13 @@ message ExtendedContentMessage { MSG_AI_CONTACT = 2014; MSG_MEMORIES_SHARE = 2015; MSG_SHARED_ALBUM_REPLY = 2016; + MSG_SHARED_ALBUM = 2017; + MSG_OCCAMADILLO_XMA = 2018; + MSG_GEN_AI_SUBSCRIPTION = 2021; + MSG_GEN_AI_REMINDER = 2022; + MSG_GEN_AI_MEMU_ONBOARDING_RESPONSE = 2023; + MSG_NOTE_REPLY = 2024; + MSG_NOTE_MENTION = 2025; RTC_AUDIO_CALL = 3000; RTC_VIDEO_CALL = 3001; RTC_MISSED_AUDIO_CALL = 3002; @@ -122,4 +130,6 @@ message ExtendedContentMessage { optional string headerSubtitle = 21; optional string xmaDataclass = 22; optional string contentRef = 23; + repeated string mentionedJID = 24; + repeated WACommon.Command commands = 25; } diff --git a/vendor/go.mau.fi/whatsmeow/proto/waCert/WACert.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waCert/WACert.pb.go index 2e7e9a24..c1f15b41 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waCert/WACert.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waCert/WACert.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waCert/WACert.proto @@ -364,7 +364,7 @@ func file_waCert_WACert_proto_rawDescGZIP() []byte { } var file_waCert_WACert_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_waCert_WACert_proto_goTypes = []interface{}{ +var file_waCert_WACert_proto_goTypes = []any{ (*NoiseCertificate)(nil), // 0: WACert.NoiseCertificate (*CertChain)(nil), // 1: WACert.CertChain (*NoiseCertificate_Details)(nil), // 2: WACert.NoiseCertificate.Details @@ -387,7 +387,7 @@ func file_waCert_WACert_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waCert_WACert_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waCert_WACert_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*NoiseCertificate); i { case 0: return &v.state @@ -399,7 +399,7 @@ func file_waCert_WACert_proto_init() { return nil } } - file_waCert_WACert_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waCert_WACert_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*CertChain); i { case 0: return &v.state @@ -411,7 +411,7 @@ func file_waCert_WACert_proto_init() { return nil } } - file_waCert_WACert_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waCert_WACert_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*NoiseCertificate_Details); i { case 0: return &v.state @@ -423,7 +423,7 @@ func file_waCert_WACert_proto_init() { return nil } } - file_waCert_WACert_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waCert_WACert_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*CertChain_NoiseCertificate); i { case 0: return &v.state @@ -435,7 +435,7 @@ func file_waCert_WACert_proto_init() { return nil } } - file_waCert_WACert_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_waCert_WACert_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*CertChain_NoiseCertificate_Details); i { case 0: return &v.state diff --git a/vendor/go.mau.fi/whatsmeow/proto/waChatLockSettings/WAProtobufsChatLockSettings.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waChatLockSettings/WAProtobufsChatLockSettings.pb.go index d7e98ed4..dbf33ca5 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waChatLockSettings/WAProtobufsChatLockSettings.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waChatLockSettings/WAProtobufsChatLockSettings.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waChatLockSettings/WAProtobufsChatLockSettings.proto @@ -97,7 +97,7 @@ func file_waChatLockSettings_WAProtobufsChatLockSettings_proto_rawDescGZIP() []b } var file_waChatLockSettings_WAProtobufsChatLockSettings_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_waChatLockSettings_WAProtobufsChatLockSettings_proto_goTypes = []interface{}{ +var file_waChatLockSettings_WAProtobufsChatLockSettings_proto_goTypes = []any{ (*ChatLockSettings)(nil), // 0: WAProtobufsChatLockSettings.ChatLockSettings (*waUserPassword.UserPassword)(nil), // 1: WAProtobufsUserPassword.UserPassword } @@ -116,7 +116,7 @@ func file_waChatLockSettings_WAProtobufsChatLockSettings_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waChatLockSettings_WAProtobufsChatLockSettings_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waChatLockSettings_WAProtobufsChatLockSettings_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*ChatLockSettings); i { case 0: return &v.state diff --git a/vendor/go.mau.fi/whatsmeow/proto/waCommon/WACommon.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waCommon/WACommon.pb.go index 7d565952..756697d5 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waCommon/WACommon.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waCommon/WACommon.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waCommon/WACommon.proto @@ -423,7 +423,7 @@ func file_waCommon_WACommon_proto_rawDescGZIP() []byte { var file_waCommon_WACommon_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_waCommon_WACommon_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_waCommon_WACommon_proto_goTypes = []interface{}{ +var file_waCommon_WACommon_proto_goTypes = []any{ (FutureProofBehavior)(0), // 0: WACommon.FutureProofBehavior (Command_CommandType)(0), // 1: WACommon.Command.CommandType (*MessageKey)(nil), // 2: WACommon.MessageKey @@ -447,7 +447,7 @@ func file_waCommon_WACommon_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waCommon_WACommon_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waCommon_WACommon_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*MessageKey); i { case 0: return &v.state @@ -459,7 +459,7 @@ func file_waCommon_WACommon_proto_init() { return nil } } - file_waCommon_WACommon_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waCommon_WACommon_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*Command); i { case 0: return &v.state @@ -471,7 +471,7 @@ func file_waCommon_WACommon_proto_init() { return nil } } - file_waCommon_WACommon_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waCommon_WACommon_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*MessageText); i { case 0: return &v.state @@ -483,7 +483,7 @@ func file_waCommon_WACommon_proto_init() { return nil } } - file_waCommon_WACommon_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waCommon_WACommon_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*SubProtocol); i { case 0: return &v.state diff --git a/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WAWebProtobufsCompanionReg.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WAWebProtobufsCompanionReg.pb.go index 505d4121..ff7b9661 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WAWebProtobufsCompanionReg.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WAWebProtobufsCompanionReg.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waCompanionReg/WAWebProtobufsCompanionReg.proto @@ -50,6 +50,7 @@ const ( DeviceProps_UWP DeviceProps_PlatformType = 21 DeviceProps_VR DeviceProps_PlatformType = 22 DeviceProps_CLOUD_API DeviceProps_PlatformType = 23 + DeviceProps_SMARTGLASSES DeviceProps_PlatformType = 24 ) // Enum value maps for DeviceProps_PlatformType. @@ -79,6 +80,7 @@ var ( 21: "UWP", 22: "VR", 23: "CLOUD_API", + 24: "SMARTGLASSES", } DeviceProps_PlatformType_value = map[string]int32{ "UNKNOWN": 0, @@ -105,6 +107,7 @@ var ( "UWP": 21, "VR": 22, "CLOUD_API": 23, + "SMARTGLASSES": 24, } ) @@ -389,6 +392,53 @@ func (x *EncryptedPairingRequest) GetIV() []byte { return nil } +type ClientPairingProps struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IsChatDbLidMigrated *bool `protobuf:"varint,1,opt,name=isChatDbLidMigrated" json:"isChatDbLidMigrated,omitempty"` +} + +func (x *ClientPairingProps) Reset() { + *x = ClientPairingProps{} + if protoimpl.UnsafeEnabled { + mi := &file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClientPairingProps) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClientPairingProps) ProtoMessage() {} + +func (x *ClientPairingProps) ProtoReflect() protoreflect.Message { + mi := &file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClientPairingProps.ProtoReflect.Descriptor instead. +func (*ClientPairingProps) Descriptor() ([]byte, []int) { + return file_waCompanionReg_WAWebProtobufsCompanionReg_proto_rawDescGZIP(), []int{4} +} + +func (x *ClientPairingProps) GetIsChatDbLidMigrated() bool { + if x != nil && x.IsChatDbLidMigrated != nil { + return *x.IsChatDbLidMigrated + } + return false +} + type DeviceProps_HistorySyncConfig struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -406,12 +456,14 @@ type DeviceProps_HistorySyncConfig struct { SupportRecentSyncChunkMessageCountTuning *bool `protobuf:"varint,10,opt,name=supportRecentSyncChunkMessageCountTuning" json:"supportRecentSyncChunkMessageCountTuning,omitempty"` SupportHostedGroupMsg *bool `protobuf:"varint,11,opt,name=supportHostedGroupMsg" json:"supportHostedGroupMsg,omitempty"` SupportFbidBotChatHistory *bool `protobuf:"varint,12,opt,name=supportFbidBotChatHistory" json:"supportFbidBotChatHistory,omitempty"` + SupportAddOnHistorySyncMigration *bool `protobuf:"varint,13,opt,name=supportAddOnHistorySyncMigration" json:"supportAddOnHistorySyncMigration,omitempty"` + SupportMessageAssociation *bool `protobuf:"varint,14,opt,name=supportMessageAssociation" json:"supportMessageAssociation,omitempty"` } func (x *DeviceProps_HistorySyncConfig) Reset() { *x = DeviceProps_HistorySyncConfig{} if protoimpl.UnsafeEnabled { - mi := &file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[4] + mi := &file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -424,7 +476,7 @@ func (x *DeviceProps_HistorySyncConfig) String() string { func (*DeviceProps_HistorySyncConfig) ProtoMessage() {} func (x *DeviceProps_HistorySyncConfig) ProtoReflect() protoreflect.Message { - mi := &file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[4] + mi := &file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -524,6 +576,20 @@ func (x *DeviceProps_HistorySyncConfig) GetSupportFbidBotChatHistory() bool { return false } +func (x *DeviceProps_HistorySyncConfig) GetSupportAddOnHistorySyncMigration() bool { + if x != nil && x.SupportAddOnHistorySyncMigration != nil { + return *x.SupportAddOnHistorySyncMigration + } + return false +} + +func (x *DeviceProps_HistorySyncConfig) GetSupportMessageAssociation() bool { + if x != nil && x.SupportMessageAssociation != nil { + return *x.SupportMessageAssociation + } + return false +} + type DeviceProps_AppVersion struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -539,7 +605,7 @@ type DeviceProps_AppVersion struct { func (x *DeviceProps_AppVersion) Reset() { *x = DeviceProps_AppVersion{} if protoimpl.UnsafeEnabled { - mi := &file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[5] + mi := &file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -552,7 +618,7 @@ func (x *DeviceProps_AppVersion) String() string { func (*DeviceProps_AppVersion) ProtoMessage() {} func (x *DeviceProps_AppVersion) ProtoReflect() protoreflect.Message { - mi := &file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[5] + mi := &file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -621,20 +687,21 @@ func file_waCompanionReg_WAWebProtobufsCompanionReg_proto_rawDescGZIP() []byte { } var file_waCompanionReg_WAWebProtobufsCompanionReg_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_waCompanionReg_WAWebProtobufsCompanionReg_proto_goTypes = []interface{}{ +var file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_waCompanionReg_WAWebProtobufsCompanionReg_proto_goTypes = []any{ (DeviceProps_PlatformType)(0), // 0: WAWebProtobufsCompanionReg.DeviceProps.PlatformType (*DeviceProps)(nil), // 1: WAWebProtobufsCompanionReg.DeviceProps (*CompanionEphemeralIdentity)(nil), // 2: WAWebProtobufsCompanionReg.CompanionEphemeralIdentity (*PrimaryEphemeralIdentity)(nil), // 3: WAWebProtobufsCompanionReg.PrimaryEphemeralIdentity (*EncryptedPairingRequest)(nil), // 4: WAWebProtobufsCompanionReg.EncryptedPairingRequest - (*DeviceProps_HistorySyncConfig)(nil), // 5: WAWebProtobufsCompanionReg.DeviceProps.HistorySyncConfig - (*DeviceProps_AppVersion)(nil), // 6: WAWebProtobufsCompanionReg.DeviceProps.AppVersion + (*ClientPairingProps)(nil), // 5: WAWebProtobufsCompanionReg.ClientPairingProps + (*DeviceProps_HistorySyncConfig)(nil), // 6: WAWebProtobufsCompanionReg.DeviceProps.HistorySyncConfig + (*DeviceProps_AppVersion)(nil), // 7: WAWebProtobufsCompanionReg.DeviceProps.AppVersion } var file_waCompanionReg_WAWebProtobufsCompanionReg_proto_depIdxs = []int32{ - 6, // 0: WAWebProtobufsCompanionReg.DeviceProps.version:type_name -> WAWebProtobufsCompanionReg.DeviceProps.AppVersion + 7, // 0: WAWebProtobufsCompanionReg.DeviceProps.version:type_name -> WAWebProtobufsCompanionReg.DeviceProps.AppVersion 0, // 1: WAWebProtobufsCompanionReg.DeviceProps.platformType:type_name -> WAWebProtobufsCompanionReg.DeviceProps.PlatformType - 5, // 2: WAWebProtobufsCompanionReg.DeviceProps.historySyncConfig:type_name -> WAWebProtobufsCompanionReg.DeviceProps.HistorySyncConfig + 6, // 2: WAWebProtobufsCompanionReg.DeviceProps.historySyncConfig:type_name -> WAWebProtobufsCompanionReg.DeviceProps.HistorySyncConfig 0, // 3: WAWebProtobufsCompanionReg.CompanionEphemeralIdentity.deviceType:type_name -> WAWebProtobufsCompanionReg.DeviceProps.PlatformType 4, // [4:4] is the sub-list for method output_type 4, // [4:4] is the sub-list for method input_type @@ -649,7 +716,7 @@ func file_waCompanionReg_WAWebProtobufsCompanionReg_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*DeviceProps); i { case 0: return &v.state @@ -661,7 +728,7 @@ func file_waCompanionReg_WAWebProtobufsCompanionReg_proto_init() { return nil } } - file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*CompanionEphemeralIdentity); i { case 0: return &v.state @@ -673,7 +740,7 @@ func file_waCompanionReg_WAWebProtobufsCompanionReg_proto_init() { return nil } } - file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*PrimaryEphemeralIdentity); i { case 0: return &v.state @@ -685,7 +752,7 @@ func file_waCompanionReg_WAWebProtobufsCompanionReg_proto_init() { return nil } } - file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*EncryptedPairingRequest); i { case 0: return &v.state @@ -697,7 +764,19 @@ func file_waCompanionReg_WAWebProtobufsCompanionReg_proto_init() { return nil } } - file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*ClientPairingProps); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*DeviceProps_HistorySyncConfig); i { case 0: return &v.state @@ -709,7 +788,7 @@ func file_waCompanionReg_WAWebProtobufsCompanionReg_proto_init() { return nil } } - file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_waCompanionReg_WAWebProtobufsCompanionReg_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*DeviceProps_AppVersion); i { case 0: return &v.state @@ -728,7 +807,7 @@ func file_waCompanionReg_WAWebProtobufsCompanionReg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_waCompanionReg_WAWebProtobufsCompanionReg_proto_rawDesc, NumEnums: 1, - NumMessages: 6, + NumMessages: 7, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WAWebProtobufsCompanionReg.pb.raw b/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WAWebProtobufsCompanionReg.pb.raw index edefd4db..c623a6cf 100644 Binary files a/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WAWebProtobufsCompanionReg.pb.raw and b/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WAWebProtobufsCompanionReg.pb.raw differ diff --git a/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WAWebProtobufsCompanionReg.proto b/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WAWebProtobufsCompanionReg.proto index 14ef9ada..89fafd31 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WAWebProtobufsCompanionReg.proto +++ b/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WAWebProtobufsCompanionReg.proto @@ -28,6 +28,7 @@ message DeviceProps { UWP = 21; VR = 22; CLOUD_API = 23; + SMARTGLASSES = 24; } message HistorySyncConfig { @@ -43,6 +44,8 @@ message DeviceProps { optional bool supportRecentSyncChunkMessageCountTuning = 10; optional bool supportHostedGroupMsg = 11; optional bool supportFbidBotChatHistory = 12; + optional bool supportAddOnHistorySyncMigration = 13; + optional bool supportMessageAssociation = 14; } message AppVersion { @@ -74,3 +77,7 @@ message EncryptedPairingRequest { optional bytes encryptedPayload = 1; optional bytes IV = 2; } + +message ClientPairingProps { + optional bool isChatDbLidMigrated = 1; +} diff --git a/vendor/go.mau.fi/whatsmeow/proto/waConsumerApplication/WAConsumerApplication.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waConsumerApplication/WAConsumerApplication.pb.go index f7a35736..21bd0693 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waConsumerApplication/WAConsumerApplication.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waConsumerApplication/WAConsumerApplication.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waConsumerApplication/WAConsumerApplication.proto @@ -2526,7 +2526,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_rawDescGZIP() []byte var file_waConsumerApplication_WAConsumerApplication_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_waConsumerApplication_WAConsumerApplication_proto_msgTypes = make([]protoimpl.MessageInfo, 33) -var file_waConsumerApplication_WAConsumerApplication_proto_goTypes = []interface{}{ +var file_waConsumerApplication_WAConsumerApplication_proto_goTypes = []any{ (ConsumerApplication_Metadata_SpecialTextSize)(0), // 0: WAConsumerApplication.ConsumerApplication.Metadata.SpecialTextSize (ConsumerApplication_StatusTextMesage_FontType)(0), // 1: WAConsumerApplication.ConsumerApplication.StatusTextMesage.FontType (ConsumerApplication_ExtendedTextMessage_PreviewType)(0), // 2: WAConsumerApplication.ConsumerApplication.ExtendedTextMessage.PreviewType @@ -2641,7 +2641,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication); i { case 0: return &v.state @@ -2653,7 +2653,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_Payload); i { case 0: return &v.state @@ -2665,7 +2665,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_SubProtocolPayload); i { case 0: return &v.state @@ -2677,7 +2677,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_Metadata); i { case 0: return &v.state @@ -2689,7 +2689,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_Signal); i { case 0: return &v.state @@ -2701,7 +2701,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_ApplicationData); i { case 0: return &v.state @@ -2713,7 +2713,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_Content); i { case 0: return &v.state @@ -2725,7 +2725,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_EditMessage); i { case 0: return &v.state @@ -2737,7 +2737,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_PollAddOptionMessage); i { case 0: return &v.state @@ -2749,7 +2749,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_PollVoteMessage); i { case 0: return &v.state @@ -2761,7 +2761,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_PollEncValue); i { case 0: return &v.state @@ -2773,7 +2773,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_PollUpdateMessage); i { case 0: return &v.state @@ -2785,7 +2785,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[12].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_PollCreationMessage); i { case 0: return &v.state @@ -2797,7 +2797,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[13].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_Option); i { case 0: return &v.state @@ -2809,7 +2809,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[14].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_ReactionMessage); i { case 0: return &v.state @@ -2821,7 +2821,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[15].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_RevokeMessage); i { case 0: return &v.state @@ -2833,7 +2833,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[16].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_ViewOnceMessage); i { case 0: return &v.state @@ -2845,7 +2845,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[17].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_GroupInviteMessage); i { case 0: return &v.state @@ -2857,7 +2857,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[18].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_LiveLocationMessage); i { case 0: return &v.state @@ -2869,7 +2869,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[19].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_ContactsArrayMessage); i { case 0: return &v.state @@ -2881,7 +2881,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[20].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_ContactMessage); i { case 0: return &v.state @@ -2893,7 +2893,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[21].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_StatusTextMesage); i { case 0: return &v.state @@ -2905,7 +2905,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[22].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_ExtendedTextMessage); i { case 0: return &v.state @@ -2917,7 +2917,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[23].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_LocationMessage); i { case 0: return &v.state @@ -2929,7 +2929,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[24].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_StickerMessage); i { case 0: return &v.state @@ -2941,7 +2941,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[25].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_DocumentMessage); i { case 0: return &v.state @@ -2953,7 +2953,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[26].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_VideoMessage); i { case 0: return &v.state @@ -2965,7 +2965,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[27].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_AudioMessage); i { case 0: return &v.state @@ -2977,7 +2977,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[28].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_ImageMessage); i { case 0: return &v.state @@ -2989,7 +2989,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[29].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_InteractiveAnnotation); i { case 0: return &v.state @@ -3001,7 +3001,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[30].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_Point); i { case 0: return &v.state @@ -3013,7 +3013,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[31].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_Location); i { case 0: return &v.state @@ -3025,7 +3025,7 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { return nil } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[32].Exporter = func(v any, i int) any { switch v := v.(*ConsumerApplication_MediaPayload); i { case 0: return &v.state @@ -3038,16 +3038,16 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { } } } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[1].OneofWrappers = []interface{}{ + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[1].OneofWrappers = []any{ (*ConsumerApplication_Payload_Content)(nil), (*ConsumerApplication_Payload_ApplicationData)(nil), (*ConsumerApplication_Payload_Signal)(nil), (*ConsumerApplication_Payload_SubProtocol)(nil), } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[5].OneofWrappers = []interface{}{ + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[5].OneofWrappers = []any{ (*ConsumerApplication_ApplicationData_Revoke)(nil), } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[6].OneofWrappers = []interface{}{ + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[6].OneofWrappers = []any{ (*ConsumerApplication_Content_MessageText)(nil), (*ConsumerApplication_Content_ImageMessage)(nil), (*ConsumerApplication_Content_ContactMessage)(nil), @@ -3067,11 +3067,11 @@ func file_waConsumerApplication_WAConsumerApplication_proto_init() { (*ConsumerApplication_Content_PollUpdateMessage)(nil), (*ConsumerApplication_Content_EditMessage)(nil), } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[16].OneofWrappers = []interface{}{ + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[16].OneofWrappers = []any{ (*ConsumerApplication_ViewOnceMessage_ImageMessage)(nil), (*ConsumerApplication_ViewOnceMessage_VideoMessage)(nil), } - file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[29].OneofWrappers = []interface{}{ + file_waConsumerApplication_WAConsumerApplication_proto_msgTypes[29].OneofWrappers = []any{ (*ConsumerApplication_InteractiveAnnotation_Location)(nil), } type x struct{} diff --git a/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.pb.go index 5a315c28..ef9d20d9 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waDeviceCapabilities/WAProtobufsDeviceCapabilities.proto @@ -148,7 +148,7 @@ func file_waDeviceCapabilities_WAProtobufsDeviceCapabilities_proto_rawDescGZIP() var file_waDeviceCapabilities_WAProtobufsDeviceCapabilities_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_waDeviceCapabilities_WAProtobufsDeviceCapabilities_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_waDeviceCapabilities_WAProtobufsDeviceCapabilities_proto_goTypes = []interface{}{ +var file_waDeviceCapabilities_WAProtobufsDeviceCapabilities_proto_goTypes = []any{ (DeviceCapabilities_ChatLockSupportLevel)(0), // 0: WAProtobufsDeviceCapabilities.DeviceCapabilities.ChatLockSupportLevel (*DeviceCapabilities)(nil), // 1: WAProtobufsDeviceCapabilities.DeviceCapabilities } @@ -167,7 +167,7 @@ func file_waDeviceCapabilities_WAProtobufsDeviceCapabilities_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waDeviceCapabilities_WAProtobufsDeviceCapabilities_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waDeviceCapabilities_WAProtobufsDeviceCapabilities_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*DeviceCapabilities); i { case 0: return &v.state diff --git a/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go index 3dab5560..68c160fa 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waE2E/WAWebProtobufsE2E.proto @@ -12,6 +12,7 @@ import ( waAdv "go.mau.fi/whatsmeow/proto/waAdv" waCommon "go.mau.fi/whatsmeow/proto/waCommon" + waCompanionReg "go.mau.fi/whatsmeow/proto/waCompanionReg" waMmsRetry "go.mau.fi/whatsmeow/proto/waMmsRetry" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -35,6 +36,7 @@ const ( PeerDataOperationRequestType_HISTORY_SYNC_ON_DEMAND PeerDataOperationRequestType = 3 PeerDataOperationRequestType_PLACEHOLDER_MESSAGE_RESEND PeerDataOperationRequestType = 4 PeerDataOperationRequestType_WAFFLE_LINKING_NONCE_FETCH PeerDataOperationRequestType = 5 + PeerDataOperationRequestType_FULL_HISTORY_SYNC_ON_DEMAND PeerDataOperationRequestType = 6 ) // Enum value maps for PeerDataOperationRequestType. @@ -46,6 +48,7 @@ var ( 3: "HISTORY_SYNC_ON_DEMAND", 4: "PLACEHOLDER_MESSAGE_RESEND", 5: "WAFFLE_LINKING_NONCE_FETCH", + 6: "FULL_HISTORY_SYNC_ON_DEMAND", } PeerDataOperationRequestType_value = map[string]int32{ "UPLOAD_STICKER": 0, @@ -54,6 +57,7 @@ var ( "HISTORY_SYNC_ON_DEMAND": 3, "PLACEHOLDER_MESSAGE_RESEND": 4, "WAFFLE_LINKING_NONCE_FETCH": 5, + "FULL_HISTORY_SYNC_ON_DEMAND": 6, } ) @@ -94,6 +98,74 @@ func (PeerDataOperationRequestType) EnumDescriptor() ([]byte, []int) { return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{0} } +type BotSessionSource int32 + +const ( + BotSessionSource_NULL_STATE BotSessionSource = 1 + BotSessionSource_TYPEAHEAD BotSessionSource = 2 + BotSessionSource_USER_INPUT BotSessionSource = 3 + BotSessionSource_EMU_FLASH BotSessionSource = 4 + BotSessionSource_EMU_FLASH_FOLLOWUP BotSessionSource = 5 + BotSessionSource_VOICE BotSessionSource = 6 +) + +// Enum value maps for BotSessionSource. +var ( + BotSessionSource_name = map[int32]string{ + 1: "NULL_STATE", + 2: "TYPEAHEAD", + 3: "USER_INPUT", + 4: "EMU_FLASH", + 5: "EMU_FLASH_FOLLOWUP", + 6: "VOICE", + } + BotSessionSource_value = map[string]int32{ + "NULL_STATE": 1, + "TYPEAHEAD": 2, + "USER_INPUT": 3, + "EMU_FLASH": 4, + "EMU_FLASH_FOLLOWUP": 5, + "VOICE": 6, + } +) + +func (x BotSessionSource) Enum() *BotSessionSource { + p := new(BotSessionSource) + *p = x + return p +} + +func (x BotSessionSource) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BotSessionSource) Descriptor() protoreflect.EnumDescriptor { + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[1].Descriptor() +} + +func (BotSessionSource) Type() protoreflect.EnumType { + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[1] +} + +func (x BotSessionSource) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *BotSessionSource) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = BotSessionSource(num) + return nil +} + +// Deprecated: Use BotSessionSource.Descriptor instead. +func (BotSessionSource) EnumDescriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{1} +} + type KeepType int32 const ( @@ -127,11 +199,11 @@ func (x KeepType) String() string { } func (KeepType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[1].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[2].Descriptor() } func (KeepType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[1] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[2] } func (x KeepType) Number() protoreflect.EnumNumber { @@ -150,7 +222,7 @@ func (x *KeepType) UnmarshalJSON(b []byte) error { // Deprecated: Use KeepType.Descriptor instead. func (KeepType) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{1} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{2} } type PlaceholderMessage_PlaceholderType int32 @@ -180,11 +252,11 @@ func (x PlaceholderMessage_PlaceholderType) String() string { } func (PlaceholderMessage_PlaceholderType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[2].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[3].Descriptor() } func (PlaceholderMessage_PlaceholderType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[2] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[3] } func (x PlaceholderMessage_PlaceholderType) Number() protoreflect.EnumNumber { @@ -239,11 +311,11 @@ func (x BCallMessage_MediaType) String() string { } func (BCallMessage_MediaType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[3].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[4].Descriptor() } func (BCallMessage_MediaType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[3] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[4] } func (x BCallMessage_MediaType) Number() protoreflect.EnumNumber { @@ -313,11 +385,11 @@ func (x CallLogMessage_CallOutcome) String() string { } func (CallLogMessage_CallOutcome) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[4].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[5].Descriptor() } func (CallLogMessage_CallOutcome) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[4] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[5] } func (x CallLogMessage_CallOutcome) Number() protoreflect.EnumNumber { @@ -372,11 +444,11 @@ func (x CallLogMessage_CallType) String() string { } func (CallLogMessage_CallType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[5].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[6].Descriptor() } func (CallLogMessage_CallType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[5] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[6] } func (x CallLogMessage_CallType) Number() protoreflect.EnumNumber { @@ -428,11 +500,11 @@ func (x ScheduledCallEditMessage_EditType) String() string { } func (ScheduledCallEditMessage_EditType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[6].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[7].Descriptor() } func (ScheduledCallEditMessage_EditType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[6] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[7] } func (x ScheduledCallEditMessage_EditType) Number() protoreflect.EnumNumber { @@ -487,11 +559,11 @@ func (x ScheduledCallCreationMessage_CallType) String() string { } func (ScheduledCallCreationMessage_CallType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[7].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[8].Descriptor() } func (ScheduledCallCreationMessage_CallType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[7] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[8] } func (x ScheduledCallCreationMessage_CallType) Number() protoreflect.EnumNumber { @@ -549,11 +621,11 @@ func (x EventResponseMessage_EventResponseType) String() string { } func (EventResponseMessage_EventResponseType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[8].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[9].Descriptor() } func (EventResponseMessage_EventResponseType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[8] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[9] } func (x EventResponseMessage_EventResponseType) Number() protoreflect.EnumNumber { @@ -608,11 +680,11 @@ func (x PinInChatMessage_Type) String() string { } func (PinInChatMessage_Type) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[9].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[10].Descriptor() } func (PinInChatMessage_Type) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[9] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[10] } func (x PinInChatMessage_Type) Number() protoreflect.EnumNumber { @@ -664,11 +736,11 @@ func (x ButtonsResponseMessage_Type) String() string { } func (ButtonsResponseMessage_Type) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[10].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[11].Descriptor() } func (ButtonsResponseMessage_Type) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[10] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[11] } func (x ButtonsResponseMessage_Type) Number() protoreflect.EnumNumber { @@ -735,11 +807,11 @@ func (x ButtonsMessage_HeaderType) String() string { } func (ButtonsMessage_HeaderType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[11].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[12].Descriptor() } func (ButtonsMessage_HeaderType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[11] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[12] } func (x ButtonsMessage_HeaderType) Number() protoreflect.EnumNumber { @@ -794,11 +866,11 @@ func (x ButtonsMessage_Button_Type) String() string { } func (ButtonsMessage_Button_Type) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[12].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[13].Descriptor() } func (ButtonsMessage_Button_Type) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[12] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[13] } func (x ButtonsMessage_Button_Type) Number() protoreflect.EnumNumber { @@ -850,11 +922,11 @@ func (x SecretEncryptedMessage_SecretEncType) String() string { } func (SecretEncryptedMessage_SecretEncType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[13].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[14].Descriptor() } func (SecretEncryptedMessage_SecretEncType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[13] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[14] } func (x SecretEncryptedMessage_SecretEncType) Number() protoreflect.EnumNumber { @@ -906,11 +978,11 @@ func (x GroupInviteMessage_GroupType) String() string { } func (GroupInviteMessage_GroupType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[14].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[15].Descriptor() } func (GroupInviteMessage_GroupType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[14] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[15] } func (x GroupInviteMessage_GroupType) Number() protoreflect.EnumNumber { @@ -962,11 +1034,11 @@ func (x InteractiveResponseMessage_Body_Format) String() string { } func (InteractiveResponseMessage_Body_Format) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[15].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[16].Descriptor() } func (InteractiveResponseMessage_Body_Format) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[15] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[16] } func (x InteractiveResponseMessage_Body_Format) Number() protoreflect.EnumNumber { @@ -1024,11 +1096,11 @@ func (x InteractiveMessage_ShopMessage_Surface) String() string { } func (InteractiveMessage_ShopMessage_Surface) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[16].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[17].Descriptor() } func (InteractiveMessage_ShopMessage_Surface) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[16] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[17] } func (x InteractiveMessage_ShopMessage_Surface) Number() protoreflect.EnumNumber { @@ -1080,11 +1152,11 @@ func (x ListResponseMessage_ListType) String() string { } func (ListResponseMessage_ListType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[17].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[18].Descriptor() } func (ListResponseMessage_ListType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[17] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[18] } func (x ListResponseMessage_ListType) Number() protoreflect.EnumNumber { @@ -1139,11 +1211,11 @@ func (x ListMessage_ListType) String() string { } func (ListMessage_ListType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[18].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[19].Descriptor() } func (ListMessage_ListType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[18] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[19] } func (x ListMessage_ListType) Number() protoreflect.EnumNumber { @@ -1192,11 +1264,11 @@ func (x OrderMessage_OrderSurface) String() string { } func (OrderMessage_OrderSurface) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[19].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[20].Descriptor() } func (OrderMessage_OrderSurface) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[19] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[20] } func (x OrderMessage_OrderSurface) Number() protoreflect.EnumNumber { @@ -1251,11 +1323,11 @@ func (x OrderMessage_OrderStatus) String() string { } func (OrderMessage_OrderStatus) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[20].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[21].Descriptor() } func (OrderMessage_OrderStatus) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[20] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[21] } func (x OrderMessage_OrderStatus) Number() protoreflect.EnumNumber { @@ -1313,11 +1385,11 @@ func (x PaymentInviteMessage_ServiceType) String() string { } func (PaymentInviteMessage_ServiceType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[21].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[22].Descriptor() } func (PaymentInviteMessage_ServiceType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[21] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[22] } func (x PaymentInviteMessage_ServiceType) Number() protoreflect.EnumNumber { @@ -1369,11 +1441,11 @@ func (x HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeC } func (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[22].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[23].Descriptor() } func (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[22] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[23] } func (x HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType) Number() protoreflect.EnumNumber { @@ -1440,11 +1512,11 @@ func (x HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeC } func (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[23].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[24].Descriptor() } func (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[23] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[24] } func (x HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType) Number() protoreflect.EnumNumber { @@ -1466,6 +1538,77 @@ func (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeCom return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{17, 0, 0, 0, 1} } +type PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode int32 + +const ( + PeerDataOperationRequestResponseMessage_PeerDataOperationResult_REQUEST_SUCCESS PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode = 0 + PeerDataOperationRequestResponseMessage_PeerDataOperationResult_REQUEST_TIME_EXPIRED PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode = 1 + PeerDataOperationRequestResponseMessage_PeerDataOperationResult_DECLINED_SHARING_HISTORY PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode = 2 + PeerDataOperationRequestResponseMessage_PeerDataOperationResult_GENERIC_ERROR PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode = 3 + PeerDataOperationRequestResponseMessage_PeerDataOperationResult_ERROR_REQUEST_ON_NON_SMB_PRIMARY PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode = 4 + PeerDataOperationRequestResponseMessage_PeerDataOperationResult_ERROR_HOSTED_DEVICE_NOT_CONNECTED PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode = 5 + PeerDataOperationRequestResponseMessage_PeerDataOperationResult_ERROR_HOSTED_DEVICE_LOGIN_TIME_NOT_SET PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode = 6 +) + +// Enum value maps for PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode. +var ( + PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode_name = map[int32]string{ + 0: "REQUEST_SUCCESS", + 1: "REQUEST_TIME_EXPIRED", + 2: "DECLINED_SHARING_HISTORY", + 3: "GENERIC_ERROR", + 4: "ERROR_REQUEST_ON_NON_SMB_PRIMARY", + 5: "ERROR_HOSTED_DEVICE_NOT_CONNECTED", + 6: "ERROR_HOSTED_DEVICE_LOGIN_TIME_NOT_SET", + } + PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode_value = map[string]int32{ + "REQUEST_SUCCESS": 0, + "REQUEST_TIME_EXPIRED": 1, + "DECLINED_SHARING_HISTORY": 2, + "GENERIC_ERROR": 3, + "ERROR_REQUEST_ON_NON_SMB_PRIMARY": 4, + "ERROR_HOSTED_DEVICE_NOT_CONNECTED": 5, + "ERROR_HOSTED_DEVICE_LOGIN_TIME_NOT_SET": 6, + } +) + +func (x PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode) Enum() *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode { + p := new(PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode) + *p = x + return p +} + +func (x PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode) Descriptor() protoreflect.EnumDescriptor { + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[25].Descriptor() +} + +func (PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode) Type() protoreflect.EnumType { + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[25] +} + +func (x PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode(num) + return nil +} + +// Deprecated: Use PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode.Descriptor instead. +func (PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode) EnumDescriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{18, 0, 0} +} + type HistorySyncNotification_HistorySyncType int32 const ( @@ -1514,11 +1657,11 @@ func (x HistorySyncNotification_HistorySyncType) String() string { } func (HistorySyncNotification_HistorySyncType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[24].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[26].Descriptor() } func (HistorySyncNotification_HistorySyncType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[24] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[26] } func (x HistorySyncNotification_HistorySyncType) Number() protoreflect.EnumNumber { @@ -1537,7 +1680,7 @@ func (x *HistorySyncNotification_HistorySyncType) UnmarshalJSON(b []byte) error // Deprecated: Use HistorySyncNotification_HistorySyncType.Descriptor instead. func (HistorySyncNotification_HistorySyncType) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{18, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{19, 0} } type RequestWelcomeMessageMetadata_LocalChatState int32 @@ -1570,11 +1713,11 @@ func (x RequestWelcomeMessageMetadata_LocalChatState) String() string { } func (RequestWelcomeMessageMetadata_LocalChatState) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[25].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[27].Descriptor() } func (RequestWelcomeMessageMetadata_LocalChatState) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[25] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[27] } func (x RequestWelcomeMessageMetadata_LocalChatState) Number() protoreflect.EnumNumber { @@ -1593,7 +1736,7 @@ func (x *RequestWelcomeMessageMetadata_LocalChatState) UnmarshalJSON(b []byte) e // Deprecated: Use RequestWelcomeMessageMetadata_LocalChatState.Descriptor instead. func (RequestWelcomeMessageMetadata_LocalChatState) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{19, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{20, 0} } type ProtocolMessage_Type int32 @@ -1619,6 +1762,7 @@ const ( ProtocolMessage_LID_MIGRATION_MAPPING_SYNC ProtocolMessage_Type = 22 ProtocolMessage_REMINDER_MESSAGE ProtocolMessage_Type = 23 ProtocolMessage_BOT_MEMU_ONBOARDING_MESSAGE ProtocolMessage_Type = 24 + ProtocolMessage_STATUS_MENTION_MESSAGE ProtocolMessage_Type = 25 ) // Enum value maps for ProtocolMessage_Type. @@ -1644,6 +1788,7 @@ var ( 22: "LID_MIGRATION_MAPPING_SYNC", 23: "REMINDER_MESSAGE", 24: "BOT_MEMU_ONBOARDING_MESSAGE", + 25: "STATUS_MENTION_MESSAGE", } ProtocolMessage_Type_value = map[string]int32{ "REVOKE": 0, @@ -1666,6 +1811,7 @@ var ( "LID_MIGRATION_MAPPING_SYNC": 22, "REMINDER_MESSAGE": 23, "BOT_MEMU_ONBOARDING_MESSAGE": 24, + "STATUS_MENTION_MESSAGE": 25, } ) @@ -1680,11 +1826,11 @@ func (x ProtocolMessage_Type) String() string { } func (ProtocolMessage_Type) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[26].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[28].Descriptor() } func (ProtocolMessage_Type) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[26] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[28] } func (x ProtocolMessage_Type) Number() protoreflect.EnumNumber { @@ -1703,7 +1849,7 @@ func (x *ProtocolMessage_Type) UnmarshalJSON(b []byte) error { // Deprecated: Use ProtocolMessage_Type.Descriptor instead. func (ProtocolMessage_Type) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{20, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{21, 0} } type CloudAPIThreadControlNotification_CloudAPIThreadControl int32 @@ -1739,11 +1885,11 @@ func (x CloudAPIThreadControlNotification_CloudAPIThreadControl) String() string } func (CloudAPIThreadControlNotification_CloudAPIThreadControl) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[27].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[29].Descriptor() } func (CloudAPIThreadControlNotification_CloudAPIThreadControl) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[27] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[29] } func (x CloudAPIThreadControlNotification_CloudAPIThreadControl) Number() protoreflect.EnumNumber { @@ -1762,7 +1908,7 @@ func (x *CloudAPIThreadControlNotification_CloudAPIThreadControl) UnmarshalJSON( // Deprecated: Use CloudAPIThreadControlNotification_CloudAPIThreadControl.Descriptor instead. func (CloudAPIThreadControlNotification_CloudAPIThreadControl) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{21, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{22, 0} } type BotFeedbackMessage_ReportKind int32 @@ -1792,11 +1938,11 @@ func (x BotFeedbackMessage_ReportKind) String() string { } func (BotFeedbackMessage_ReportKind) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[28].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[30].Descriptor() } func (BotFeedbackMessage_ReportKind) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[28] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[30] } func (x BotFeedbackMessage_ReportKind) Number() protoreflect.EnumNumber { @@ -1815,7 +1961,7 @@ func (x *BotFeedbackMessage_ReportKind) UnmarshalJSON(b []byte) error { // Deprecated: Use BotFeedbackMessage_ReportKind.Descriptor instead. func (BotFeedbackMessage_ReportKind) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{22, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{23, 0} } type BotFeedbackMessage_BotFeedbackKindMultiplePositive int32 @@ -1845,11 +1991,11 @@ func (x BotFeedbackMessage_BotFeedbackKindMultiplePositive) String() string { } func (BotFeedbackMessage_BotFeedbackKindMultiplePositive) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[29].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[31].Descriptor() } func (BotFeedbackMessage_BotFeedbackKindMultiplePositive) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[29] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[31] } func (x BotFeedbackMessage_BotFeedbackKindMultiplePositive) Number() protoreflect.EnumNumber { @@ -1868,7 +2014,7 @@ func (x *BotFeedbackMessage_BotFeedbackKindMultiplePositive) UnmarshalJSON(b []b // Deprecated: Use BotFeedbackMessage_BotFeedbackKindMultiplePositive.Descriptor instead. func (BotFeedbackMessage_BotFeedbackKindMultiplePositive) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{22, 1} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{23, 1} } type BotFeedbackMessage_BotFeedbackKindMultipleNegative int32 @@ -1922,11 +2068,11 @@ func (x BotFeedbackMessage_BotFeedbackKindMultipleNegative) String() string { } func (BotFeedbackMessage_BotFeedbackKindMultipleNegative) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[30].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[32].Descriptor() } func (BotFeedbackMessage_BotFeedbackKindMultipleNegative) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[30] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[32] } func (x BotFeedbackMessage_BotFeedbackKindMultipleNegative) Number() protoreflect.EnumNumber { @@ -1945,7 +2091,7 @@ func (x *BotFeedbackMessage_BotFeedbackKindMultipleNegative) UnmarshalJSON(b []b // Deprecated: Use BotFeedbackMessage_BotFeedbackKindMultipleNegative.Descriptor instead. func (BotFeedbackMessage_BotFeedbackKindMultipleNegative) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{22, 2} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{23, 2} } type BotFeedbackMessage_BotFeedbackKind int32 @@ -2002,11 +2148,11 @@ func (x BotFeedbackMessage_BotFeedbackKind) String() string { } func (BotFeedbackMessage_BotFeedbackKind) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[31].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[33].Descriptor() } func (BotFeedbackMessage_BotFeedbackKind) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[31] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[33] } func (x BotFeedbackMessage_BotFeedbackKind) Number() protoreflect.EnumNumber { @@ -2025,7 +2171,7 @@ func (x *BotFeedbackMessage_BotFeedbackKind) UnmarshalJSON(b []byte) error { // Deprecated: Use BotFeedbackMessage_BotFeedbackKind.Descriptor instead. func (BotFeedbackMessage_BotFeedbackKind) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{22, 3} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{23, 3} } type VideoMessage_Attribution int32 @@ -2061,11 +2207,11 @@ func (x VideoMessage_Attribution) String() string { } func (VideoMessage_Attribution) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[32].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[34].Descriptor() } func (VideoMessage_Attribution) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[32] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[34] } func (x VideoMessage_Attribution) Number() protoreflect.EnumNumber { @@ -2084,7 +2230,7 @@ func (x *VideoMessage_Attribution) UnmarshalJSON(b []byte) error { // Deprecated: Use VideoMessage_Attribution.Descriptor instead. func (VideoMessage_Attribution) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{23, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{24, 0} } type ExtendedTextMessage_InviteLinkGroupType int32 @@ -2123,11 +2269,11 @@ func (x ExtendedTextMessage_InviteLinkGroupType) String() string { } func (ExtendedTextMessage_InviteLinkGroupType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[33].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[35].Descriptor() } func (ExtendedTextMessage_InviteLinkGroupType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[33] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[35] } func (x ExtendedTextMessage_InviteLinkGroupType) Number() protoreflect.EnumNumber { @@ -2146,7 +2292,7 @@ func (x *ExtendedTextMessage_InviteLinkGroupType) UnmarshalJSON(b []byte) error // Deprecated: Use ExtendedTextMessage_InviteLinkGroupType.Descriptor instead. func (ExtendedTextMessage_InviteLinkGroupType) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{24, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{25, 0} } type ExtendedTextMessage_PreviewType int32 @@ -2188,11 +2334,11 @@ func (x ExtendedTextMessage_PreviewType) String() string { } func (ExtendedTextMessage_PreviewType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[34].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[36].Descriptor() } func (ExtendedTextMessage_PreviewType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[34] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[36] } func (x ExtendedTextMessage_PreviewType) Number() protoreflect.EnumNumber { @@ -2211,7 +2357,7 @@ func (x *ExtendedTextMessage_PreviewType) UnmarshalJSON(b []byte) error { // Deprecated: Use ExtendedTextMessage_PreviewType.Descriptor instead. func (ExtendedTextMessage_PreviewType) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{24, 1} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{25, 1} } type ExtendedTextMessage_FontType int32 @@ -2262,11 +2408,11 @@ func (x ExtendedTextMessage_FontType) String() string { } func (ExtendedTextMessage_FontType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[35].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[37].Descriptor() } func (ExtendedTextMessage_FontType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[35] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[37] } func (x ExtendedTextMessage_FontType) Number() protoreflect.EnumNumber { @@ -2285,7 +2431,7 @@ func (x *ExtendedTextMessage_FontType) UnmarshalJSON(b []byte) error { // Deprecated: Use ExtendedTextMessage_FontType.Descriptor instead. func (ExtendedTextMessage_FontType) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{24, 2} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{25, 2} } type InvoiceMessage_AttachmentType int32 @@ -2318,11 +2464,11 @@ func (x InvoiceMessage_AttachmentType) String() string { } func (InvoiceMessage_AttachmentType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[36].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[38].Descriptor() } func (InvoiceMessage_AttachmentType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[36] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[38] } func (x InvoiceMessage_AttachmentType) Number() protoreflect.EnumNumber { @@ -2341,7 +2487,7 @@ func (x *InvoiceMessage_AttachmentType) UnmarshalJSON(b []byte) error { // Deprecated: Use InvoiceMessage_AttachmentType.Descriptor instead. func (InvoiceMessage_AttachmentType) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{25, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{26, 0} } type ImageMessage_ImageSourceType int32 @@ -2377,11 +2523,11 @@ func (x ImageMessage_ImageSourceType) String() string { } func (ImageMessage_ImageSourceType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[37].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[39].Descriptor() } func (ImageMessage_ImageSourceType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[37] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[39] } func (x ImageMessage_ImageSourceType) Number() protoreflect.EnumNumber { @@ -2400,7 +2546,7 @@ func (x *ImageMessage_ImageSourceType) UnmarshalJSON(b []byte) error { // Deprecated: Use ImageMessage_ImageSourceType.Descriptor instead. func (ImageMessage_ImageSourceType) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{26, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{27, 0} } type ContextInfo_ForwardedNewsletterMessageInfo_ContentType int32 @@ -2436,11 +2582,11 @@ func (x ContextInfo_ForwardedNewsletterMessageInfo_ContentType) String() string } func (ContextInfo_ForwardedNewsletterMessageInfo_ContentType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[38].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[40].Descriptor() } func (ContextInfo_ForwardedNewsletterMessageInfo_ContentType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[38] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[40] } func (x ContextInfo_ForwardedNewsletterMessageInfo_ContentType) Number() protoreflect.EnumNumber { @@ -2459,7 +2605,7 @@ func (x *ContextInfo_ForwardedNewsletterMessageInfo_ContentType) UnmarshalJSON(b // Deprecated: Use ContextInfo_ForwardedNewsletterMessageInfo_ContentType.Descriptor instead. func (ContextInfo_ForwardedNewsletterMessageInfo_ContentType) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{27, 0, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{28, 0, 0} } type ContextInfo_ExternalAdReplyInfo_MediaType int32 @@ -2495,11 +2641,11 @@ func (x ContextInfo_ExternalAdReplyInfo_MediaType) String() string { } func (ContextInfo_ExternalAdReplyInfo_MediaType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[39].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[41].Descriptor() } func (ContextInfo_ExternalAdReplyInfo_MediaType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[39] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[41] } func (x ContextInfo_ExternalAdReplyInfo_MediaType) Number() protoreflect.EnumNumber { @@ -2518,7 +2664,7 @@ func (x *ContextInfo_ExternalAdReplyInfo_MediaType) UnmarshalJSON(b []byte) erro // Deprecated: Use ContextInfo_ExternalAdReplyInfo_MediaType.Descriptor instead. func (ContextInfo_ExternalAdReplyInfo_MediaType) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{27, 1, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{28, 1, 0} } type ContextInfo_AdReplyInfo_MediaType int32 @@ -2554,11 +2700,11 @@ func (x ContextInfo_AdReplyInfo_MediaType) String() string { } func (ContextInfo_AdReplyInfo_MediaType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[40].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[42].Descriptor() } func (ContextInfo_AdReplyInfo_MediaType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[40] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[42] } func (x ContextInfo_AdReplyInfo_MediaType) Number() protoreflect.EnumNumber { @@ -2577,7 +2723,7 @@ func (x *ContextInfo_AdReplyInfo_MediaType) UnmarshalJSON(b []byte) error { // Deprecated: Use ContextInfo_AdReplyInfo_MediaType.Descriptor instead. func (ContextInfo_AdReplyInfo_MediaType) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{27, 2, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{28, 2, 0} } type BotPluginMetadata_PluginType int32 @@ -2610,11 +2756,11 @@ func (x BotPluginMetadata_PluginType) String() string { } func (BotPluginMetadata_PluginType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[41].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[43].Descriptor() } func (BotPluginMetadata_PluginType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[41] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[43] } func (x BotPluginMetadata_PluginType) Number() protoreflect.EnumNumber { @@ -2633,14 +2779,15 @@ func (x *BotPluginMetadata_PluginType) UnmarshalJSON(b []byte) error { // Deprecated: Use BotPluginMetadata_PluginType.Descriptor instead. func (BotPluginMetadata_PluginType) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{28, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{29, 0} } type BotPluginMetadata_SearchProvider int32 const ( - BotPluginMetadata_BING BotPluginMetadata_SearchProvider = 1 - BotPluginMetadata_GOOGLE BotPluginMetadata_SearchProvider = 2 + BotPluginMetadata_BING BotPluginMetadata_SearchProvider = 1 + BotPluginMetadata_GOOGLE BotPluginMetadata_SearchProvider = 2 + BotPluginMetadata_SUPPORT BotPluginMetadata_SearchProvider = 3 ) // Enum value maps for BotPluginMetadata_SearchProvider. @@ -2648,10 +2795,12 @@ var ( BotPluginMetadata_SearchProvider_name = map[int32]string{ 1: "BING", 2: "GOOGLE", + 3: "SUPPORT", } BotPluginMetadata_SearchProvider_value = map[string]int32{ - "BING": 1, - "GOOGLE": 2, + "BING": 1, + "GOOGLE": 2, + "SUPPORT": 3, } ) @@ -2666,11 +2815,11 @@ func (x BotPluginMetadata_SearchProvider) String() string { } func (BotPluginMetadata_SearchProvider) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[42].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[44].Descriptor() } func (BotPluginMetadata_SearchProvider) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[42] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[44] } func (x BotPluginMetadata_SearchProvider) Number() protoreflect.EnumNumber { @@ -2689,72 +2838,66 @@ func (x *BotPluginMetadata_SearchProvider) UnmarshalJSON(b []byte) error { // Deprecated: Use BotPluginMetadata_SearchProvider.Descriptor instead. func (BotPluginMetadata_SearchProvider) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{28, 1} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{29, 1} } -type BotSearchMetadata_SessionSource int32 +type BotMediaMetadata_OrientationType int32 const ( - BotSearchMetadata_NULL_STATE BotSearchMetadata_SessionSource = 1 - BotSearchMetadata_TYPEAHEAD BotSearchMetadata_SessionSource = 2 - BotSearchMetadata_USER_INPUT BotSearchMetadata_SessionSource = 3 - BotSearchMetadata_EMU_FLASH BotSearchMetadata_SessionSource = 4 - BotSearchMetadata_EMU_FLASH_FOLLOWUP BotSearchMetadata_SessionSource = 5 + BotMediaMetadata_CENTER BotMediaMetadata_OrientationType = 1 + BotMediaMetadata_LEFT BotMediaMetadata_OrientationType = 2 + BotMediaMetadata_RIGHT BotMediaMetadata_OrientationType = 3 ) -// Enum value maps for BotSearchMetadata_SessionSource. +// Enum value maps for BotMediaMetadata_OrientationType. var ( - BotSearchMetadata_SessionSource_name = map[int32]string{ - 1: "NULL_STATE", - 2: "TYPEAHEAD", - 3: "USER_INPUT", - 4: "EMU_FLASH", - 5: "EMU_FLASH_FOLLOWUP", + BotMediaMetadata_OrientationType_name = map[int32]string{ + 1: "CENTER", + 2: "LEFT", + 3: "RIGHT", } - BotSearchMetadata_SessionSource_value = map[string]int32{ - "NULL_STATE": 1, - "TYPEAHEAD": 2, - "USER_INPUT": 3, - "EMU_FLASH": 4, - "EMU_FLASH_FOLLOWUP": 5, + BotMediaMetadata_OrientationType_value = map[string]int32{ + "CENTER": 1, + "LEFT": 2, + "RIGHT": 3, } ) -func (x BotSearchMetadata_SessionSource) Enum() *BotSearchMetadata_SessionSource { - p := new(BotSearchMetadata_SessionSource) +func (x BotMediaMetadata_OrientationType) Enum() *BotMediaMetadata_OrientationType { + p := new(BotMediaMetadata_OrientationType) *p = x return p } -func (x BotSearchMetadata_SessionSource) String() string { +func (x BotMediaMetadata_OrientationType) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (BotSearchMetadata_SessionSource) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[43].Descriptor() +func (BotMediaMetadata_OrientationType) Descriptor() protoreflect.EnumDescriptor { + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[45].Descriptor() } -func (BotSearchMetadata_SessionSource) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[43] +func (BotMediaMetadata_OrientationType) Type() protoreflect.EnumType { + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[45] } -func (x BotSearchMetadata_SessionSource) Number() protoreflect.EnumNumber { +func (x BotMediaMetadata_OrientationType) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Do not use. -func (x *BotSearchMetadata_SessionSource) UnmarshalJSON(b []byte) error { +func (x *BotMediaMetadata_OrientationType) UnmarshalJSON(b []byte) error { num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) if err != nil { return err } - *x = BotSearchMetadata_SessionSource(num) + *x = BotMediaMetadata_OrientationType(num) return nil } -// Deprecated: Use BotSearchMetadata_SessionSource.Descriptor instead. -func (BotSearchMetadata_SessionSource) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{29, 0} +// Deprecated: Use BotMediaMetadata_OrientationType.Descriptor instead. +func (BotMediaMetadata_OrientationType) EnumDescriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{30, 0} } type BotReminderMetadata_ReminderFrequency int32 @@ -2796,11 +2939,11 @@ func (x BotReminderMetadata_ReminderFrequency) String() string { } func (BotReminderMetadata_ReminderFrequency) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[44].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[46].Descriptor() } func (BotReminderMetadata_ReminderFrequency) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[44] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[46] } func (x BotReminderMetadata_ReminderFrequency) Number() protoreflect.EnumNumber { @@ -2819,7 +2962,7 @@ func (x *BotReminderMetadata_ReminderFrequency) UnmarshalJSON(b []byte) error { // Deprecated: Use BotReminderMetadata_ReminderFrequency.Descriptor instead. func (BotReminderMetadata_ReminderFrequency) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{30, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{31, 0} } type BotReminderMetadata_ReminderAction int32 @@ -2828,6 +2971,7 @@ const ( BotReminderMetadata_NOTIFY BotReminderMetadata_ReminderAction = 1 BotReminderMetadata_CREATE BotReminderMetadata_ReminderAction = 2 BotReminderMetadata_DELETE BotReminderMetadata_ReminderAction = 3 + BotReminderMetadata_UPDATE BotReminderMetadata_ReminderAction = 4 ) // Enum value maps for BotReminderMetadata_ReminderAction. @@ -2836,11 +2980,13 @@ var ( 1: "NOTIFY", 2: "CREATE", 3: "DELETE", + 4: "UPDATE", } BotReminderMetadata_ReminderAction_value = map[string]int32{ "NOTIFY": 1, "CREATE": 2, "DELETE": 3, + "UPDATE": 4, } ) @@ -2855,11 +3001,11 @@ func (x BotReminderMetadata_ReminderAction) String() string { } func (BotReminderMetadata_ReminderAction) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[45].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[47].Descriptor() } func (BotReminderMetadata_ReminderAction) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[45] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[47] } func (x BotReminderMetadata_ReminderAction) Number() protoreflect.EnumNumber { @@ -2878,28 +3024,146 @@ func (x *BotReminderMetadata_ReminderAction) UnmarshalJSON(b []byte) error { // Deprecated: Use BotReminderMetadata_ReminderAction.Descriptor instead. func (BotReminderMetadata_ReminderAction) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{30, 1} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{31, 1} +} + +type BotModelMetadata_PremiumModelStatus int32 + +const ( + BotModelMetadata_AVAILABLE BotModelMetadata_PremiumModelStatus = 1 + BotModelMetadata_QUOTA_EXCEED_LIMIT BotModelMetadata_PremiumModelStatus = 2 +) + +// Enum value maps for BotModelMetadata_PremiumModelStatus. +var ( + BotModelMetadata_PremiumModelStatus_name = map[int32]string{ + 1: "AVAILABLE", + 2: "QUOTA_EXCEED_LIMIT", + } + BotModelMetadata_PremiumModelStatus_value = map[string]int32{ + "AVAILABLE": 1, + "QUOTA_EXCEED_LIMIT": 2, + } +) + +func (x BotModelMetadata_PremiumModelStatus) Enum() *BotModelMetadata_PremiumModelStatus { + p := new(BotModelMetadata_PremiumModelStatus) + *p = x + return p +} + +func (x BotModelMetadata_PremiumModelStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BotModelMetadata_PremiumModelStatus) Descriptor() protoreflect.EnumDescriptor { + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[48].Descriptor() +} + +func (BotModelMetadata_PremiumModelStatus) Type() protoreflect.EnumType { + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[48] +} + +func (x BotModelMetadata_PremiumModelStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *BotModelMetadata_PremiumModelStatus) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = BotModelMetadata_PremiumModelStatus(num) + return nil +} + +// Deprecated: Use BotModelMetadata_PremiumModelStatus.Descriptor instead. +func (BotModelMetadata_PremiumModelStatus) EnumDescriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{32, 0} +} + +type BotModelMetadata_ModelType int32 + +const ( + BotModelMetadata_LLAMA_PROD BotModelMetadata_ModelType = 1 + BotModelMetadata_LLAMA_PROD_PREMIUM BotModelMetadata_ModelType = 2 +) + +// Enum value maps for BotModelMetadata_ModelType. +var ( + BotModelMetadata_ModelType_name = map[int32]string{ + 1: "LLAMA_PROD", + 2: "LLAMA_PROD_PREMIUM", + } + BotModelMetadata_ModelType_value = map[string]int32{ + "LLAMA_PROD": 1, + "LLAMA_PROD_PREMIUM": 2, + } +) + +func (x BotModelMetadata_ModelType) Enum() *BotModelMetadata_ModelType { + p := new(BotModelMetadata_ModelType) + *p = x + return p +} + +func (x BotModelMetadata_ModelType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BotModelMetadata_ModelType) Descriptor() protoreflect.EnumDescriptor { + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[49].Descriptor() +} + +func (BotModelMetadata_ModelType) Type() protoreflect.EnumType { + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[49] +} + +func (x BotModelMetadata_ModelType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *BotModelMetadata_ModelType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = BotModelMetadata_ModelType(num) + return nil +} + +// Deprecated: Use BotModelMetadata_ModelType.Descriptor instead. +func (BotModelMetadata_ModelType) EnumDescriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{32, 1} } type MessageAssociation_AssociationType int32 const ( + MessageAssociation_UNKNOWN MessageAssociation_AssociationType = 0 MessageAssociation_MEDIA_ALBUM MessageAssociation_AssociationType = 1 MessageAssociation_BOT_PLUGIN MessageAssociation_AssociationType = 2 MessageAssociation_EVENT_COVER_IMAGE MessageAssociation_AssociationType = 3 + MessageAssociation_STATUS_POLL MessageAssociation_AssociationType = 4 ) // Enum value maps for MessageAssociation_AssociationType. var ( MessageAssociation_AssociationType_name = map[int32]string{ + 0: "UNKNOWN", 1: "MEDIA_ALBUM", 2: "BOT_PLUGIN", 3: "EVENT_COVER_IMAGE", + 4: "STATUS_POLL", } MessageAssociation_AssociationType_value = map[string]int32{ + "UNKNOWN": 0, "MEDIA_ALBUM": 1, "BOT_PLUGIN": 2, "EVENT_COVER_IMAGE": 3, + "STATUS_POLL": 4, } ) @@ -2914,11 +3178,11 @@ func (x MessageAssociation_AssociationType) String() string { } func (MessageAssociation_AssociationType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[46].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[50].Descriptor() } func (MessageAssociation_AssociationType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[46] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[50] } func (x MessageAssociation_AssociationType) Number() protoreflect.EnumNumber { @@ -2937,7 +3201,7 @@ func (x *MessageAssociation_AssociationType) UnmarshalJSON(b []byte) error { // Deprecated: Use MessageAssociation_AssociationType.Descriptor instead. func (MessageAssociation_AssociationType) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{31, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{33, 0} } type MessageContextInfo_MessageAddonExpiryType int32 @@ -2970,11 +3234,11 @@ func (x MessageContextInfo_MessageAddonExpiryType) String() string { } func (MessageContextInfo_MessageAddonExpiryType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[47].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[51].Descriptor() } func (MessageContextInfo_MessageAddonExpiryType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[47] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[51] } func (x MessageContextInfo_MessageAddonExpiryType) Number() protoreflect.EnumNumber { @@ -2993,7 +3257,7 @@ func (x *MessageContextInfo_MessageAddonExpiryType) UnmarshalJSON(b []byte) erro // Deprecated: Use MessageContextInfo_MessageAddonExpiryType.Descriptor instead. func (MessageContextInfo_MessageAddonExpiryType) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{32, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{34, 0} } type HydratedTemplateButton_HydratedURLButton_WebviewPresentationType int32 @@ -3029,11 +3293,11 @@ func (x HydratedTemplateButton_HydratedURLButton_WebviewPresentationType) String } func (HydratedTemplateButton_HydratedURLButton_WebviewPresentationType) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[48].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[52].Descriptor() } func (HydratedTemplateButton_HydratedURLButton_WebviewPresentationType) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[48] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[52] } func (x HydratedTemplateButton_HydratedURLButton_WebviewPresentationType) Number() protoreflect.EnumNumber { @@ -3052,7 +3316,7 @@ func (x *HydratedTemplateButton_HydratedURLButton_WebviewPresentationType) Unmar // Deprecated: Use HydratedTemplateButton_HydratedURLButton_WebviewPresentationType.Descriptor instead. func (HydratedTemplateButton_HydratedURLButton_WebviewPresentationType) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{33, 0, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{35, 0, 0} } type PaymentBackground_Type int32 @@ -3085,11 +3349,11 @@ func (x PaymentBackground_Type) String() string { } func (PaymentBackground_Type) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[49].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[53].Descriptor() } func (PaymentBackground_Type) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[49] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[53] } func (x PaymentBackground_Type) Number() protoreflect.EnumNumber { @@ -3108,7 +3372,7 @@ func (x *PaymentBackground_Type) UnmarshalJSON(b []byte) error { // Deprecated: Use PaymentBackground_Type.Descriptor instead. func (PaymentBackground_Type) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{34, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{36, 0} } type DisappearingMode_Trigger int32 @@ -3119,6 +3383,7 @@ const ( DisappearingMode_ACCOUNT_SETTING DisappearingMode_Trigger = 2 DisappearingMode_BULK_CHANGE DisappearingMode_Trigger = 3 DisappearingMode_BIZ_SUPPORTS_FB_HOSTING DisappearingMode_Trigger = 4 + DisappearingMode_UNKNOWN_GROUPS DisappearingMode_Trigger = 5 ) // Enum value maps for DisappearingMode_Trigger. @@ -3129,6 +3394,7 @@ var ( 2: "ACCOUNT_SETTING", 3: "BULK_CHANGE", 4: "BIZ_SUPPORTS_FB_HOSTING", + 5: "UNKNOWN_GROUPS", } DisappearingMode_Trigger_value = map[string]int32{ "UNKNOWN": 0, @@ -3136,6 +3402,7 @@ var ( "ACCOUNT_SETTING": 2, "BULK_CHANGE": 3, "BIZ_SUPPORTS_FB_HOSTING": 4, + "UNKNOWN_GROUPS": 5, } ) @@ -3150,11 +3417,11 @@ func (x DisappearingMode_Trigger) String() string { } func (DisappearingMode_Trigger) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[50].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[54].Descriptor() } func (DisappearingMode_Trigger) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[50] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[54] } func (x DisappearingMode_Trigger) Number() protoreflect.EnumNumber { @@ -3173,7 +3440,7 @@ func (x *DisappearingMode_Trigger) UnmarshalJSON(b []byte) error { // Deprecated: Use DisappearingMode_Trigger.Descriptor instead. func (DisappearingMode_Trigger) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{35, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{37, 0} } type DisappearingMode_Initiator int32 @@ -3212,11 +3479,11 @@ func (x DisappearingMode_Initiator) String() string { } func (DisappearingMode_Initiator) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[51].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[55].Descriptor() } func (DisappearingMode_Initiator) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[51] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[55] } func (x DisappearingMode_Initiator) Number() protoreflect.EnumNumber { @@ -3235,7 +3502,7 @@ func (x *DisappearingMode_Initiator) UnmarshalJSON(b []byte) error { // Deprecated: Use DisappearingMode_Initiator.Descriptor instead. func (DisappearingMode_Initiator) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{35, 1} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{37, 1} } type ProcessedVideo_VideoQuality int32 @@ -3274,11 +3541,11 @@ func (x ProcessedVideo_VideoQuality) String() string { } func (ProcessedVideo_VideoQuality) Descriptor() protoreflect.EnumDescriptor { - return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[52].Descriptor() + return file_waE2E_WAWebProtobufsE2E_proto_enumTypes[56].Descriptor() } func (ProcessedVideo_VideoQuality) Type() protoreflect.EnumType { - return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[52] + return &file_waE2E_WAWebProtobufsE2E_proto_enumTypes[56] } func (x ProcessedVideo_VideoQuality) Number() protoreflect.EnumNumber { @@ -3297,7 +3564,7 @@ func (x *ProcessedVideo_VideoQuality) UnmarshalJSON(b []byte) error { // Deprecated: Use ProcessedVideo_VideoQuality.Descriptor instead. func (ProcessedVideo_VideoQuality) EnumDescriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{36, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{38, 0} } type PlaceholderMessage struct { @@ -4893,29 +5160,94 @@ func (x *HighlyStructuredMessage) GetHydratedHsm() *TemplateMessage { return nil } +type PeerDataOperationRequestResponseMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PeerDataOperationRequestType *PeerDataOperationRequestType `protobuf:"varint,1,opt,name=peerDataOperationRequestType,enum=WAWebProtobufsE2E.PeerDataOperationRequestType" json:"peerDataOperationRequestType,omitempty"` + StanzaID *string `protobuf:"bytes,2,opt,name=stanzaID" json:"stanzaID,omitempty"` + PeerDataOperationResult []*PeerDataOperationRequestResponseMessage_PeerDataOperationResult `protobuf:"bytes,3,rep,name=peerDataOperationResult" json:"peerDataOperationResult,omitempty"` +} + +func (x *PeerDataOperationRequestResponseMessage) Reset() { + *x = PeerDataOperationRequestResponseMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestResponseMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestResponseMessage) ProtoMessage() {} + +func (x *PeerDataOperationRequestResponseMessage) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestResponseMessage.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestResponseMessage) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{18} +} + +func (x *PeerDataOperationRequestResponseMessage) GetPeerDataOperationRequestType() PeerDataOperationRequestType { + if x != nil && x.PeerDataOperationRequestType != nil { + return *x.PeerDataOperationRequestType + } + return PeerDataOperationRequestType_UPLOAD_STICKER +} + +func (x *PeerDataOperationRequestResponseMessage) GetStanzaID() string { + if x != nil && x.StanzaID != nil { + return *x.StanzaID + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage) GetPeerDataOperationResult() []*PeerDataOperationRequestResponseMessage_PeerDataOperationResult { + if x != nil { + return x.PeerDataOperationResult + } + return nil +} + type HistorySyncNotification struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - FileSHA256 []byte `protobuf:"bytes,1,opt,name=fileSHA256" json:"fileSHA256,omitempty"` - FileLength *uint64 `protobuf:"varint,2,opt,name=fileLength" json:"fileLength,omitempty"` - MediaKey []byte `protobuf:"bytes,3,opt,name=mediaKey" json:"mediaKey,omitempty"` - FileEncSHA256 []byte `protobuf:"bytes,4,opt,name=fileEncSHA256" json:"fileEncSHA256,omitempty"` - DirectPath *string `protobuf:"bytes,5,opt,name=directPath" json:"directPath,omitempty"` - SyncType *HistorySyncNotification_HistorySyncType `protobuf:"varint,6,opt,name=syncType,enum=WAWebProtobufsE2E.HistorySyncNotification_HistorySyncType" json:"syncType,omitempty"` - ChunkOrder *uint32 `protobuf:"varint,7,opt,name=chunkOrder" json:"chunkOrder,omitempty"` - OriginalMessageID *string `protobuf:"bytes,8,opt,name=originalMessageID" json:"originalMessageID,omitempty"` - Progress *uint32 `protobuf:"varint,9,opt,name=progress" json:"progress,omitempty"` - OldestMsgInChunkTimestampSec *int64 `protobuf:"varint,10,opt,name=oldestMsgInChunkTimestampSec" json:"oldestMsgInChunkTimestampSec,omitempty"` - InitialHistBootstrapInlinePayload []byte `protobuf:"bytes,11,opt,name=initialHistBootstrapInlinePayload" json:"initialHistBootstrapInlinePayload,omitempty"` - PeerDataRequestSessionID *string `protobuf:"bytes,12,opt,name=peerDataRequestSessionID" json:"peerDataRequestSessionID,omitempty"` + FileSHA256 []byte `protobuf:"bytes,1,opt,name=fileSHA256" json:"fileSHA256,omitempty"` + FileLength *uint64 `protobuf:"varint,2,opt,name=fileLength" json:"fileLength,omitempty"` + MediaKey []byte `protobuf:"bytes,3,opt,name=mediaKey" json:"mediaKey,omitempty"` + FileEncSHA256 []byte `protobuf:"bytes,4,opt,name=fileEncSHA256" json:"fileEncSHA256,omitempty"` + DirectPath *string `protobuf:"bytes,5,opt,name=directPath" json:"directPath,omitempty"` + SyncType *HistorySyncNotification_HistorySyncType `protobuf:"varint,6,opt,name=syncType,enum=WAWebProtobufsE2E.HistorySyncNotification_HistorySyncType" json:"syncType,omitempty"` + ChunkOrder *uint32 `protobuf:"varint,7,opt,name=chunkOrder" json:"chunkOrder,omitempty"` + OriginalMessageID *string `protobuf:"bytes,8,opt,name=originalMessageID" json:"originalMessageID,omitempty"` + Progress *uint32 `protobuf:"varint,9,opt,name=progress" json:"progress,omitempty"` + OldestMsgInChunkTimestampSec *int64 `protobuf:"varint,10,opt,name=oldestMsgInChunkTimestampSec" json:"oldestMsgInChunkTimestampSec,omitempty"` + InitialHistBootstrapInlinePayload []byte `protobuf:"bytes,11,opt,name=initialHistBootstrapInlinePayload" json:"initialHistBootstrapInlinePayload,omitempty"` + PeerDataRequestSessionID *string `protobuf:"bytes,12,opt,name=peerDataRequestSessionID" json:"peerDataRequestSessionID,omitempty"` + FullHistorySyncOnDemandRequestMetadata *FullHistorySyncOnDemandRequestMetadata `protobuf:"bytes,13,opt,name=fullHistorySyncOnDemandRequestMetadata" json:"fullHistorySyncOnDemandRequestMetadata,omitempty"` + EncHandle *string `protobuf:"bytes,14,opt,name=encHandle" json:"encHandle,omitempty"` } func (x *HistorySyncNotification) Reset() { *x = HistorySyncNotification{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[18] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4928,7 +5260,7 @@ func (x *HistorySyncNotification) String() string { func (*HistorySyncNotification) ProtoMessage() {} func (x *HistorySyncNotification) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[18] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4941,7 +5273,7 @@ func (x *HistorySyncNotification) ProtoReflect() protoreflect.Message { // Deprecated: Use HistorySyncNotification.ProtoReflect.Descriptor instead. func (*HistorySyncNotification) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{18} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{19} } func (x *HistorySyncNotification) GetFileSHA256() []byte { @@ -5028,6 +5360,20 @@ func (x *HistorySyncNotification) GetPeerDataRequestSessionID() string { return "" } +func (x *HistorySyncNotification) GetFullHistorySyncOnDemandRequestMetadata() *FullHistorySyncOnDemandRequestMetadata { + if x != nil { + return x.FullHistorySyncOnDemandRequestMetadata + } + return nil +} + +func (x *HistorySyncNotification) GetEncHandle() string { + if x != nil && x.EncHandle != nil { + return *x.EncHandle + } + return "" +} + type RequestWelcomeMessageMetadata struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -5039,7 +5385,7 @@ type RequestWelcomeMessageMetadata struct { func (x *RequestWelcomeMessageMetadata) Reset() { *x = RequestWelcomeMessageMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[19] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5052,7 +5398,7 @@ func (x *RequestWelcomeMessageMetadata) String() string { func (*RequestWelcomeMessageMetadata) ProtoMessage() {} func (x *RequestWelcomeMessageMetadata) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[19] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5065,7 +5411,7 @@ func (x *RequestWelcomeMessageMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use RequestWelcomeMessageMetadata.ProtoReflect.Descriptor instead. func (*RequestWelcomeMessageMetadata) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{19} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{20} } func (x *RequestWelcomeMessageMetadata) GetLocalChatState() RequestWelcomeMessageMetadata_LocalChatState { @@ -5105,7 +5451,7 @@ type ProtocolMessage struct { func (x *ProtocolMessage) Reset() { *x = ProtocolMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[20] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5118,7 +5464,7 @@ func (x *ProtocolMessage) String() string { func (*ProtocolMessage) ProtoMessage() {} func (x *ProtocolMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[20] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5131,7 +5477,7 @@ func (x *ProtocolMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use ProtocolMessage.ProtoReflect.Descriptor instead. func (*ProtocolMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{20} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{21} } func (x *ProtocolMessage) GetKey() *waCommon.MessageKey { @@ -5288,7 +5634,7 @@ type CloudAPIThreadControlNotification struct { func (x *CloudAPIThreadControlNotification) Reset() { *x = CloudAPIThreadControlNotification{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[21] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5301,7 +5647,7 @@ func (x *CloudAPIThreadControlNotification) String() string { func (*CloudAPIThreadControlNotification) ProtoMessage() {} func (x *CloudAPIThreadControlNotification) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[21] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5314,7 +5660,7 @@ func (x *CloudAPIThreadControlNotification) ProtoReflect() protoreflect.Message // Deprecated: Use CloudAPIThreadControlNotification.ProtoReflect.Descriptor instead. func (*CloudAPIThreadControlNotification) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{21} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{22} } func (x *CloudAPIThreadControlNotification) GetStatus() CloudAPIThreadControlNotification_CloudAPIThreadControl { @@ -5361,7 +5707,7 @@ type BotFeedbackMessage struct { func (x *BotFeedbackMessage) Reset() { *x = BotFeedbackMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[22] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5374,7 +5720,7 @@ func (x *BotFeedbackMessage) String() string { func (*BotFeedbackMessage) ProtoMessage() {} func (x *BotFeedbackMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[22] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5387,7 +5733,7 @@ func (x *BotFeedbackMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use BotFeedbackMessage.ProtoReflect.Descriptor instead. func (*BotFeedbackMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{22} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{23} } func (x *BotFeedbackMessage) GetMessageKey() *waCommon.MessageKey { @@ -5468,7 +5814,7 @@ type VideoMessage struct { func (x *VideoMessage) Reset() { *x = VideoMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[23] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5481,7 +5827,7 @@ func (x *VideoMessage) String() string { func (*VideoMessage) ProtoMessage() {} func (x *VideoMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[23] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5494,7 +5840,7 @@ func (x *VideoMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use VideoMessage.ProtoReflect.Descriptor instead. func (*VideoMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{23} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{24} } func (x *VideoMessage) GetURL() string { @@ -5715,7 +6061,7 @@ type ExtendedTextMessage struct { func (x *ExtendedTextMessage) Reset() { *x = ExtendedTextMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[24] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5728,7 +6074,7 @@ func (x *ExtendedTextMessage) String() string { func (*ExtendedTextMessage) ProtoMessage() {} func (x *ExtendedTextMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[24] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5741,7 +6087,7 @@ func (x *ExtendedTextMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use ExtendedTextMessage.ProtoReflect.Descriptor instead. func (*ExtendedTextMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{24} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{25} } func (x *ExtendedTextMessage) GetText() string { @@ -5946,7 +6292,7 @@ type InvoiceMessage struct { func (x *InvoiceMessage) Reset() { *x = InvoiceMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[25] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5959,7 +6305,7 @@ func (x *InvoiceMessage) String() string { func (*InvoiceMessage) ProtoMessage() {} func (x *InvoiceMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[25] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5972,7 +6318,7 @@ func (x *InvoiceMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use InvoiceMessage.ProtoReflect.Descriptor instead. func (*InvoiceMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{25} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{26} } func (x *InvoiceMessage) GetNote() string { @@ -6084,7 +6430,7 @@ type ImageMessage struct { func (x *ImageMessage) Reset() { *x = ImageMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[26] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6097,7 +6443,7 @@ func (x *ImageMessage) String() string { func (*ImageMessage) ProtoMessage() {} func (x *ImageMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[26] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[27] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6110,7 +6456,7 @@ func (x *ImageMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use ImageMessage.ProtoReflect.Descriptor instead. func (*ImageMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{26} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{27} } func (x *ImageMessage) GetURL() string { @@ -6321,47 +6667,51 @@ type ContextInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - StanzaID *string `protobuf:"bytes,1,opt,name=stanzaID" json:"stanzaID,omitempty"` - Participant *string `protobuf:"bytes,2,opt,name=participant" json:"participant,omitempty"` - QuotedMessage *Message `protobuf:"bytes,3,opt,name=quotedMessage" json:"quotedMessage,omitempty"` - RemoteJID *string `protobuf:"bytes,4,opt,name=remoteJID" json:"remoteJID,omitempty"` - MentionedJID []string `protobuf:"bytes,15,rep,name=mentionedJID" json:"mentionedJID,omitempty"` - ConversionSource *string `protobuf:"bytes,18,opt,name=conversionSource" json:"conversionSource,omitempty"` - ConversionData []byte `protobuf:"bytes,19,opt,name=conversionData" json:"conversionData,omitempty"` - ConversionDelaySeconds *uint32 `protobuf:"varint,20,opt,name=conversionDelaySeconds" json:"conversionDelaySeconds,omitempty"` - ForwardingScore *uint32 `protobuf:"varint,21,opt,name=forwardingScore" json:"forwardingScore,omitempty"` - IsForwarded *bool `protobuf:"varint,22,opt,name=isForwarded" json:"isForwarded,omitempty"` - QuotedAd *ContextInfo_AdReplyInfo `protobuf:"bytes,23,opt,name=quotedAd" json:"quotedAd,omitempty"` - PlaceholderKey *waCommon.MessageKey `protobuf:"bytes,24,opt,name=placeholderKey" json:"placeholderKey,omitempty"` - Expiration *uint32 `protobuf:"varint,25,opt,name=expiration" json:"expiration,omitempty"` - EphemeralSettingTimestamp *int64 `protobuf:"varint,26,opt,name=ephemeralSettingTimestamp" json:"ephemeralSettingTimestamp,omitempty"` - EphemeralSharedSecret []byte `protobuf:"bytes,27,opt,name=ephemeralSharedSecret" json:"ephemeralSharedSecret,omitempty"` - ExternalAdReply *ContextInfo_ExternalAdReplyInfo `protobuf:"bytes,28,opt,name=externalAdReply" json:"externalAdReply,omitempty"` - EntryPointConversionSource *string `protobuf:"bytes,29,opt,name=entryPointConversionSource" json:"entryPointConversionSource,omitempty"` - EntryPointConversionApp *string `protobuf:"bytes,30,opt,name=entryPointConversionApp" json:"entryPointConversionApp,omitempty"` - EntryPointConversionDelaySeconds *uint32 `protobuf:"varint,31,opt,name=entryPointConversionDelaySeconds" json:"entryPointConversionDelaySeconds,omitempty"` - DisappearingMode *DisappearingMode `protobuf:"bytes,32,opt,name=disappearingMode" json:"disappearingMode,omitempty"` - ActionLink *ActionLink `protobuf:"bytes,33,opt,name=actionLink" json:"actionLink,omitempty"` - GroupSubject *string `protobuf:"bytes,34,opt,name=groupSubject" json:"groupSubject,omitempty"` - ParentGroupJID *string `protobuf:"bytes,35,opt,name=parentGroupJID" json:"parentGroupJID,omitempty"` - TrustBannerType *string `protobuf:"bytes,37,opt,name=trustBannerType" json:"trustBannerType,omitempty"` - TrustBannerAction *uint32 `protobuf:"varint,38,opt,name=trustBannerAction" json:"trustBannerAction,omitempty"` - IsSampled *bool `protobuf:"varint,39,opt,name=isSampled" json:"isSampled,omitempty"` - GroupMentions []*GroupMention `protobuf:"bytes,40,rep,name=groupMentions" json:"groupMentions,omitempty"` - Utm *ContextInfo_UTMInfo `protobuf:"bytes,41,opt,name=utm" json:"utm,omitempty"` - ForwardedNewsletterMessageInfo *ContextInfo_ForwardedNewsletterMessageInfo `protobuf:"bytes,43,opt,name=forwardedNewsletterMessageInfo" json:"forwardedNewsletterMessageInfo,omitempty"` - BusinessMessageForwardInfo *ContextInfo_BusinessMessageForwardInfo `protobuf:"bytes,44,opt,name=businessMessageForwardInfo" json:"businessMessageForwardInfo,omitempty"` - SmbClientCampaignID *string `protobuf:"bytes,45,opt,name=smbClientCampaignID" json:"smbClientCampaignID,omitempty"` - SmbServerCampaignID *string `protobuf:"bytes,46,opt,name=smbServerCampaignID" json:"smbServerCampaignID,omitempty"` - DataSharingContext *ContextInfo_DataSharingContext `protobuf:"bytes,47,opt,name=dataSharingContext" json:"dataSharingContext,omitempty"` - AlwaysShowAdAttribution *bool `protobuf:"varint,48,opt,name=alwaysShowAdAttribution" json:"alwaysShowAdAttribution,omitempty"` - FeatureEligibilities *ContextInfo_FeatureEligibilities `protobuf:"bytes,49,opt,name=featureEligibilities" json:"featureEligibilities,omitempty"` + StanzaID *string `protobuf:"bytes,1,opt,name=stanzaID" json:"stanzaID,omitempty"` + Participant *string `protobuf:"bytes,2,opt,name=participant" json:"participant,omitempty"` + QuotedMessage *Message `protobuf:"bytes,3,opt,name=quotedMessage" json:"quotedMessage,omitempty"` + RemoteJID *string `protobuf:"bytes,4,opt,name=remoteJID" json:"remoteJID,omitempty"` + MentionedJID []string `protobuf:"bytes,15,rep,name=mentionedJID" json:"mentionedJID,omitempty"` + ConversionSource *string `protobuf:"bytes,18,opt,name=conversionSource" json:"conversionSource,omitempty"` + ConversionData []byte `protobuf:"bytes,19,opt,name=conversionData" json:"conversionData,omitempty"` + ConversionDelaySeconds *uint32 `protobuf:"varint,20,opt,name=conversionDelaySeconds" json:"conversionDelaySeconds,omitempty"` + ForwardingScore *uint32 `protobuf:"varint,21,opt,name=forwardingScore" json:"forwardingScore,omitempty"` + IsForwarded *bool `protobuf:"varint,22,opt,name=isForwarded" json:"isForwarded,omitempty"` + QuotedAd *ContextInfo_AdReplyInfo `protobuf:"bytes,23,opt,name=quotedAd" json:"quotedAd,omitempty"` + PlaceholderKey *waCommon.MessageKey `protobuf:"bytes,24,opt,name=placeholderKey" json:"placeholderKey,omitempty"` + Expiration *uint32 `protobuf:"varint,25,opt,name=expiration" json:"expiration,omitempty"` + EphemeralSettingTimestamp *int64 `protobuf:"varint,26,opt,name=ephemeralSettingTimestamp" json:"ephemeralSettingTimestamp,omitempty"` + EphemeralSharedSecret []byte `protobuf:"bytes,27,opt,name=ephemeralSharedSecret" json:"ephemeralSharedSecret,omitempty"` + ExternalAdReply *ContextInfo_ExternalAdReplyInfo `protobuf:"bytes,28,opt,name=externalAdReply" json:"externalAdReply,omitempty"` + EntryPointConversionSource *string `protobuf:"bytes,29,opt,name=entryPointConversionSource" json:"entryPointConversionSource,omitempty"` + EntryPointConversionApp *string `protobuf:"bytes,30,opt,name=entryPointConversionApp" json:"entryPointConversionApp,omitempty"` + EntryPointConversionDelaySeconds *uint32 `protobuf:"varint,31,opt,name=entryPointConversionDelaySeconds" json:"entryPointConversionDelaySeconds,omitempty"` + DisappearingMode *DisappearingMode `protobuf:"bytes,32,opt,name=disappearingMode" json:"disappearingMode,omitempty"` + ActionLink *ActionLink `protobuf:"bytes,33,opt,name=actionLink" json:"actionLink,omitempty"` + GroupSubject *string `protobuf:"bytes,34,opt,name=groupSubject" json:"groupSubject,omitempty"` + ParentGroupJID *string `protobuf:"bytes,35,opt,name=parentGroupJID" json:"parentGroupJID,omitempty"` + TrustBannerType *string `protobuf:"bytes,37,opt,name=trustBannerType" json:"trustBannerType,omitempty"` + TrustBannerAction *uint32 `protobuf:"varint,38,opt,name=trustBannerAction" json:"trustBannerAction,omitempty"` + IsSampled *bool `protobuf:"varint,39,opt,name=isSampled" json:"isSampled,omitempty"` + GroupMentions []*GroupMention `protobuf:"bytes,40,rep,name=groupMentions" json:"groupMentions,omitempty"` + Utm *ContextInfo_UTMInfo `protobuf:"bytes,41,opt,name=utm" json:"utm,omitempty"` + ForwardedNewsletterMessageInfo *ContextInfo_ForwardedNewsletterMessageInfo `protobuf:"bytes,43,opt,name=forwardedNewsletterMessageInfo" json:"forwardedNewsletterMessageInfo,omitempty"` + BusinessMessageForwardInfo *ContextInfo_BusinessMessageForwardInfo `protobuf:"bytes,44,opt,name=businessMessageForwardInfo" json:"businessMessageForwardInfo,omitempty"` + SmbClientCampaignID *string `protobuf:"bytes,45,opt,name=smbClientCampaignID" json:"smbClientCampaignID,omitempty"` + SmbServerCampaignID *string `protobuf:"bytes,46,opt,name=smbServerCampaignID" json:"smbServerCampaignID,omitempty"` + DataSharingContext *ContextInfo_DataSharingContext `protobuf:"bytes,47,opt,name=dataSharingContext" json:"dataSharingContext,omitempty"` + AlwaysShowAdAttribution *bool `protobuf:"varint,48,opt,name=alwaysShowAdAttribution" json:"alwaysShowAdAttribution,omitempty"` + FeatureEligibilities *ContextInfo_FeatureEligibilities `protobuf:"bytes,49,opt,name=featureEligibilities" json:"featureEligibilities,omitempty"` + EntryPointConversionExternalSource *string `protobuf:"bytes,50,opt,name=entryPointConversionExternalSource" json:"entryPointConversionExternalSource,omitempty"` + EntryPointConversionExternalMedium *string `protobuf:"bytes,51,opt,name=entryPointConversionExternalMedium" json:"entryPointConversionExternalMedium,omitempty"` + CtwaSignals *string `protobuf:"bytes,54,opt,name=ctwaSignals" json:"ctwaSignals,omitempty"` + CtwaPayload []byte `protobuf:"bytes,55,opt,name=ctwaPayload" json:"ctwaPayload,omitempty"` } func (x *ContextInfo) Reset() { *x = ContextInfo{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[27] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6374,7 +6724,7 @@ func (x *ContextInfo) String() string { func (*ContextInfo) ProtoMessage() {} func (x *ContextInfo) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[27] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[28] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6387,7 +6737,7 @@ func (x *ContextInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use ContextInfo.ProtoReflect.Descriptor instead. func (*ContextInfo) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{27} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{28} } func (x *ContextInfo) GetStanzaID() string { @@ -6635,6 +6985,34 @@ func (x *ContextInfo) GetFeatureEligibilities() *ContextInfo_FeatureEligibilitie return nil } +func (x *ContextInfo) GetEntryPointConversionExternalSource() string { + if x != nil && x.EntryPointConversionExternalSource != nil { + return *x.EntryPointConversionExternalSource + } + return "" +} + +func (x *ContextInfo) GetEntryPointConversionExternalMedium() string { + if x != nil && x.EntryPointConversionExternalMedium != nil { + return *x.EntryPointConversionExternalMedium + } + return "" +} + +func (x *ContextInfo) GetCtwaSignals() string { + if x != nil && x.CtwaSignals != nil { + return *x.CtwaSignals + } + return "" +} + +func (x *ContextInfo) GetCtwaPayload() []byte { + if x != nil { + return x.CtwaPayload + } + return nil +} + type BotPluginMetadata struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -6649,13 +7027,14 @@ type BotPluginMetadata struct { ExpectedLinksCount *uint32 `protobuf:"varint,7,opt,name=expectedLinksCount" json:"expectedLinksCount,omitempty"` SearchQuery *string `protobuf:"bytes,9,opt,name=searchQuery" json:"searchQuery,omitempty"` ParentPluginMessageKey *waCommon.MessageKey `protobuf:"bytes,10,opt,name=parentPluginMessageKey" json:"parentPluginMessageKey,omitempty"` - ParentPluginType *BotPluginMetadata_PluginType `protobuf:"varint,11,opt,name=parentPluginType,enum=WAWebProtobufsE2E.BotPluginMetadata_PluginType" json:"parentPluginType,omitempty"` + DeprecatedField *BotPluginMetadata_PluginType `protobuf:"varint,11,opt,name=deprecatedField,enum=WAWebProtobufsE2E.BotPluginMetadata_PluginType" json:"deprecatedField,omitempty"` + ParentPluginType *BotPluginMetadata_PluginType `protobuf:"varint,12,opt,name=parentPluginType,enum=WAWebProtobufsE2E.BotPluginMetadata_PluginType" json:"parentPluginType,omitempty"` } func (x *BotPluginMetadata) Reset() { *x = BotPluginMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[28] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6668,7 +7047,7 @@ func (x *BotPluginMetadata) String() string { func (*BotPluginMetadata) ProtoMessage() {} func (x *BotPluginMetadata) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[28] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[29] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6681,7 +7060,7 @@ func (x *BotPluginMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use BotPluginMetadata.ProtoReflect.Descriptor instead. func (*BotPluginMetadata) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{28} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{29} } func (x *BotPluginMetadata) GetProvider() BotPluginMetadata_SearchProvider { @@ -6747,6 +7126,13 @@ func (x *BotPluginMetadata) GetParentPluginMessageKey() *waCommon.MessageKey { return nil } +func (x *BotPluginMetadata) GetDeprecatedField() BotPluginMetadata_PluginType { + if x != nil && x.DeprecatedField != nil { + return *x.DeprecatedField + } + return BotPluginMetadata_REELS +} + func (x *BotPluginMetadata) GetParentPluginType() BotPluginMetadata_PluginType { if x != nil && x.ParentPluginType != nil { return *x.ParentPluginType @@ -6754,32 +7140,37 @@ func (x *BotPluginMetadata) GetParentPluginType() BotPluginMetadata_PluginType { return BotPluginMetadata_REELS } -type BotSearchMetadata struct { +type BotMediaMetadata struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - SessionID *string `protobuf:"bytes,1,opt,name=sessionID" json:"sessionID,omitempty"` - SessionSource *BotSearchMetadata_SessionSource `protobuf:"varint,2,opt,name=sessionSource,enum=WAWebProtobufsE2E.BotSearchMetadata_SessionSource" json:"sessionSource,omitempty"` + FileSHA256 *string `protobuf:"bytes,1,opt,name=fileSHA256" json:"fileSHA256,omitempty"` + MediaKey *string `protobuf:"bytes,2,opt,name=mediaKey" json:"mediaKey,omitempty"` + FileEncSHA256 *string `protobuf:"bytes,3,opt,name=fileEncSHA256" json:"fileEncSHA256,omitempty"` + DirectPath *string `protobuf:"bytes,4,opt,name=directPath" json:"directPath,omitempty"` + MediaKeyTimestamp *int64 `protobuf:"varint,5,opt,name=mediaKeyTimestamp" json:"mediaKeyTimestamp,omitempty"` + Mimetype *string `protobuf:"bytes,6,opt,name=mimetype" json:"mimetype,omitempty"` + OrientationType *BotMediaMetadata_OrientationType `protobuf:"varint,7,opt,name=orientationType,enum=WAWebProtobufsE2E.BotMediaMetadata_OrientationType" json:"orientationType,omitempty"` } -func (x *BotSearchMetadata) Reset() { - *x = BotSearchMetadata{} +func (x *BotMediaMetadata) Reset() { + *x = BotMediaMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[29] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *BotSearchMetadata) String() string { +func (x *BotMediaMetadata) String() string { return protoimpl.X.MessageStringOf(x) } -func (*BotSearchMetadata) ProtoMessage() {} +func (*BotMediaMetadata) ProtoMessage() {} -func (x *BotSearchMetadata) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[29] +func (x *BotMediaMetadata) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[30] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6790,23 +7181,58 @@ func (x *BotSearchMetadata) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use BotSearchMetadata.ProtoReflect.Descriptor instead. -func (*BotSearchMetadata) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{29} +// Deprecated: Use BotMediaMetadata.ProtoReflect.Descriptor instead. +func (*BotMediaMetadata) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{30} } -func (x *BotSearchMetadata) GetSessionID() string { - if x != nil && x.SessionID != nil { - return *x.SessionID +func (x *BotMediaMetadata) GetFileSHA256() string { + if x != nil && x.FileSHA256 != nil { + return *x.FileSHA256 } return "" } -func (x *BotSearchMetadata) GetSessionSource() BotSearchMetadata_SessionSource { - if x != nil && x.SessionSource != nil { - return *x.SessionSource +func (x *BotMediaMetadata) GetMediaKey() string { + if x != nil && x.MediaKey != nil { + return *x.MediaKey } - return BotSearchMetadata_NULL_STATE + return "" +} + +func (x *BotMediaMetadata) GetFileEncSHA256() string { + if x != nil && x.FileEncSHA256 != nil { + return *x.FileEncSHA256 + } + return "" +} + +func (x *BotMediaMetadata) GetDirectPath() string { + if x != nil && x.DirectPath != nil { + return *x.DirectPath + } + return "" +} + +func (x *BotMediaMetadata) GetMediaKeyTimestamp() int64 { + if x != nil && x.MediaKeyTimestamp != nil { + return *x.MediaKeyTimestamp + } + return 0 +} + +func (x *BotMediaMetadata) GetMimetype() string { + if x != nil && x.Mimetype != nil { + return *x.Mimetype + } + return "" +} + +func (x *BotMediaMetadata) GetOrientationType() BotMediaMetadata_OrientationType { + if x != nil && x.OrientationType != nil { + return *x.OrientationType + } + return BotMediaMetadata_CENTER } type BotReminderMetadata struct { @@ -6824,7 +7250,7 @@ type BotReminderMetadata struct { func (x *BotReminderMetadata) Reset() { *x = BotReminderMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[30] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6837,7 +7263,7 @@ func (x *BotReminderMetadata) String() string { func (*BotReminderMetadata) ProtoMessage() {} func (x *BotReminderMetadata) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[30] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[31] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6850,7 +7276,7 @@ func (x *BotReminderMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use BotReminderMetadata.ProtoReflect.Descriptor instead. func (*BotReminderMetadata) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{30} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{31} } func (x *BotReminderMetadata) GetRequestMessageKey() *waCommon.MessageKey { @@ -6888,6 +7314,61 @@ func (x *BotReminderMetadata) GetFrequency() BotReminderMetadata_ReminderFrequen return BotReminderMetadata_ONCE } +type BotModelMetadata struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ModelType *BotModelMetadata_ModelType `protobuf:"varint,1,opt,name=modelType,enum=WAWebProtobufsE2E.BotModelMetadata_ModelType" json:"modelType,omitempty"` + PremiumModelStatus *BotModelMetadata_PremiumModelStatus `protobuf:"varint,2,opt,name=premiumModelStatus,enum=WAWebProtobufsE2E.BotModelMetadata_PremiumModelStatus" json:"premiumModelStatus,omitempty"` +} + +func (x *BotModelMetadata) Reset() { + *x = BotModelMetadata{} + if protoimpl.UnsafeEnabled { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BotModelMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BotModelMetadata) ProtoMessage() {} + +func (x *BotModelMetadata) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BotModelMetadata.ProtoReflect.Descriptor instead. +func (*BotModelMetadata) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{32} +} + +func (x *BotModelMetadata) GetModelType() BotModelMetadata_ModelType { + if x != nil && x.ModelType != nil { + return *x.ModelType + } + return BotModelMetadata_LLAMA_PROD +} + +func (x *BotModelMetadata) GetPremiumModelStatus() BotModelMetadata_PremiumModelStatus { + if x != nil && x.PremiumModelStatus != nil { + return *x.PremiumModelStatus + } + return BotModelMetadata_AVAILABLE +} + type MessageAssociation struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -6900,7 +7381,7 @@ type MessageAssociation struct { func (x *MessageAssociation) Reset() { *x = MessageAssociation{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[31] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6913,7 +7394,7 @@ func (x *MessageAssociation) String() string { func (*MessageAssociation) ProtoMessage() {} func (x *MessageAssociation) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[31] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[33] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6926,14 +7407,14 @@ func (x *MessageAssociation) ProtoReflect() protoreflect.Message { // Deprecated: Use MessageAssociation.ProtoReflect.Descriptor instead. func (*MessageAssociation) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{31} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{33} } func (x *MessageAssociation) GetAssociationType() MessageAssociation_AssociationType { if x != nil && x.AssociationType != nil { return *x.AssociationType } - return MessageAssociation_MEDIA_ALBUM + return MessageAssociation_UNKNOWN } func (x *MessageAssociation) GetParentMessageKey() *waCommon.MessageKey { @@ -6958,12 +7439,14 @@ type MessageContextInfo struct { ReportingTokenVersion *int32 `protobuf:"varint,8,opt,name=reportingTokenVersion" json:"reportingTokenVersion,omitempty"` MessageAddOnExpiryType *MessageContextInfo_MessageAddonExpiryType `protobuf:"varint,9,opt,name=messageAddOnExpiryType,enum=WAWebProtobufsE2E.MessageContextInfo_MessageAddonExpiryType" json:"messageAddOnExpiryType,omitempty"` MessageAssociation *MessageAssociation `protobuf:"bytes,10,opt,name=messageAssociation" json:"messageAssociation,omitempty"` + CapiCreatedGroup *bool `protobuf:"varint,11,opt,name=capiCreatedGroup" json:"capiCreatedGroup,omitempty"` + SupportPayload *string `protobuf:"bytes,12,opt,name=supportPayload" json:"supportPayload,omitempty"` } func (x *MessageContextInfo) Reset() { *x = MessageContextInfo{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[32] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6976,7 +7459,7 @@ func (x *MessageContextInfo) String() string { func (*MessageContextInfo) ProtoMessage() {} func (x *MessageContextInfo) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[32] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[34] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6989,7 +7472,7 @@ func (x *MessageContextInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use MessageContextInfo.ProtoReflect.Descriptor instead. func (*MessageContextInfo) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{32} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{34} } func (x *MessageContextInfo) GetDeviceListMetadata() *DeviceListMetadata { @@ -7062,6 +7545,20 @@ func (x *MessageContextInfo) GetMessageAssociation() *MessageAssociation { return nil } +func (x *MessageContextInfo) GetCapiCreatedGroup() bool { + if x != nil && x.CapiCreatedGroup != nil { + return *x.CapiCreatedGroup + } + return false +} + +func (x *MessageContextInfo) GetSupportPayload() string { + if x != nil && x.SupportPayload != nil { + return *x.SupportPayload + } + return "" +} + type HydratedTemplateButton struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -7079,7 +7576,7 @@ type HydratedTemplateButton struct { func (x *HydratedTemplateButton) Reset() { *x = HydratedTemplateButton{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[33] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7092,7 +7589,7 @@ func (x *HydratedTemplateButton) String() string { func (*HydratedTemplateButton) ProtoMessage() {} func (x *HydratedTemplateButton) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[33] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[35] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7105,7 +7602,7 @@ func (x *HydratedTemplateButton) ProtoReflect() protoreflect.Message { // Deprecated: Use HydratedTemplateButton.ProtoReflect.Descriptor instead. func (*HydratedTemplateButton) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{33} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{35} } func (m *HydratedTemplateButton) GetHydratedButton() isHydratedTemplateButton_HydratedButton { @@ -7185,7 +7682,7 @@ type PaymentBackground struct { func (x *PaymentBackground) Reset() { *x = PaymentBackground{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[34] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[36] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7198,7 +7695,7 @@ func (x *PaymentBackground) String() string { func (*PaymentBackground) ProtoMessage() {} func (x *PaymentBackground) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[34] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[36] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7211,7 +7708,7 @@ func (x *PaymentBackground) ProtoReflect() protoreflect.Message { // Deprecated: Use PaymentBackground.ProtoReflect.Descriptor instead. func (*PaymentBackground) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{34} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{36} } func (x *PaymentBackground) GetID() string { @@ -7298,7 +7795,7 @@ type DisappearingMode struct { func (x *DisappearingMode) Reset() { *x = DisappearingMode{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[35] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[37] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7311,7 +7808,7 @@ func (x *DisappearingMode) String() string { func (*DisappearingMode) ProtoMessage() {} func (x *DisappearingMode) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[35] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[37] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7324,7 +7821,7 @@ func (x *DisappearingMode) ProtoReflect() protoreflect.Message { // Deprecated: Use DisappearingMode.ProtoReflect.Descriptor instead. func (*DisappearingMode) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{35} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{37} } func (x *DisappearingMode) GetInitiator() DisappearingMode_Initiator { @@ -7373,7 +7870,7 @@ type ProcessedVideo struct { func (x *ProcessedVideo) Reset() { *x = ProcessedVideo{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[36] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[38] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7386,7 +7883,7 @@ func (x *ProcessedVideo) String() string { func (*ProcessedVideo) ProtoMessage() {} func (x *ProcessedVideo) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[36] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[38] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7399,7 +7896,7 @@ func (x *ProcessedVideo) ProtoReflect() protoreflect.Message { // Deprecated: Use ProcessedVideo.ProtoReflect.Descriptor instead. func (*ProcessedVideo) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{36} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{38} } func (x *ProcessedVideo) GetDirectPath() string { @@ -7532,14 +8029,16 @@ type Message struct { PlaceholderMessage *PlaceholderMessage `protobuf:"bytes,80,opt,name=placeholderMessage" json:"placeholderMessage,omitempty"` SecretEncryptedMessage *SecretEncryptedMessage `protobuf:"bytes,82,opt,name=secretEncryptedMessage" json:"secretEncryptedMessage,omitempty"` AlbumMessage *AlbumMessage `protobuf:"bytes,83,opt,name=albumMessage" json:"albumMessage,omitempty"` - PollResultSnapshotMessage *PollResultSnapshotMessage `protobuf:"bytes,84,opt,name=pollResultSnapshotMessage" json:"pollResultSnapshotMessage,omitempty"` EventCoverImage *FutureProofMessage `protobuf:"bytes,85,opt,name=eventCoverImage" json:"eventCoverImage,omitempty"` + StickerPackMessage *StickerPackMessage `protobuf:"bytes,86,opt,name=stickerPackMessage" json:"stickerPackMessage,omitempty"` + StatusMentionMessage *FutureProofMessage `protobuf:"bytes,87,opt,name=statusMentionMessage" json:"statusMentionMessage,omitempty"` + PollResultSnapshotMessage *PollResultSnapshotMessage `protobuf:"bytes,88,opt,name=pollResultSnapshotMessage" json:"pollResultSnapshotMessage,omitempty"` } func (x *Message) Reset() { *x = Message{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[37] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[39] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7552,7 +8051,7 @@ func (x *Message) String() string { func (*Message) ProtoMessage() {} func (x *Message) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[37] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[39] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7565,7 +8064,7 @@ func (x *Message) ProtoReflect() protoreflect.Message { // Deprecated: Use Message.ProtoReflect.Descriptor instead. func (*Message) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{37} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{39} } func (x *Message) GetConversation() string { @@ -8051,13 +8550,6 @@ func (x *Message) GetAlbumMessage() *AlbumMessage { return nil } -func (x *Message) GetPollResultSnapshotMessage() *PollResultSnapshotMessage { - if x != nil { - return x.PollResultSnapshotMessage - } - return nil -} - func (x *Message) GetEventCoverImage() *FutureProofMessage { if x != nil { return x.EventCoverImage @@ -8065,18 +8557,241 @@ func (x *Message) GetEventCoverImage() *FutureProofMessage { return nil } +func (x *Message) GetStickerPackMessage() *StickerPackMessage { + if x != nil { + return x.StickerPackMessage + } + return nil +} + +func (x *Message) GetStatusMentionMessage() *FutureProofMessage { + if x != nil { + return x.StatusMentionMessage + } + return nil +} + +func (x *Message) GetPollResultSnapshotMessage() *PollResultSnapshotMessage { + if x != nil { + return x.PollResultSnapshotMessage + } + return nil +} + +type StickerPackMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + StickerPackID *string `protobuf:"bytes,1,opt,name=stickerPackID" json:"stickerPackID,omitempty"` + Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` + Publisher *string `protobuf:"bytes,3,opt,name=publisher" json:"publisher,omitempty"` + Stickers []*StickerPackMessage_Sticker `protobuf:"bytes,4,rep,name=stickers" json:"stickers,omitempty"` + FileLength *uint64 `protobuf:"varint,5,opt,name=fileLength" json:"fileLength,omitempty"` + FileSHA256 []byte `protobuf:"bytes,6,opt,name=fileSHA256" json:"fileSHA256,omitempty"` + FileEncSHA256 []byte `protobuf:"bytes,7,opt,name=fileEncSHA256" json:"fileEncSHA256,omitempty"` + MediaKey []byte `protobuf:"bytes,8,opt,name=mediaKey" json:"mediaKey,omitempty"` + DirectPath *string `protobuf:"bytes,9,opt,name=directPath" json:"directPath,omitempty"` + Caption *string `protobuf:"bytes,10,opt,name=caption" json:"caption,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,11,opt,name=contextInfo" json:"contextInfo,omitempty"` + PackDescription *string `protobuf:"bytes,12,opt,name=packDescription" json:"packDescription,omitempty"` + MediaKeyTimestamp *int64 `protobuf:"varint,13,opt,name=mediaKeyTimestamp" json:"mediaKeyTimestamp,omitempty"` + TrayIconFileName *string `protobuf:"bytes,14,opt,name=trayIconFileName" json:"trayIconFileName,omitempty"` + ThumbnailDirectPath *string `protobuf:"bytes,15,opt,name=thumbnailDirectPath" json:"thumbnailDirectPath,omitempty"` + ThumbnailSHA256 []byte `protobuf:"bytes,16,opt,name=thumbnailSHA256" json:"thumbnailSHA256,omitempty"` + ThumbnailEncSHA256 []byte `protobuf:"bytes,17,opt,name=thumbnailEncSHA256" json:"thumbnailEncSHA256,omitempty"` + ThumbnailHeight *uint32 `protobuf:"varint,18,opt,name=thumbnailHeight" json:"thumbnailHeight,omitempty"` + ThumbnailWidth *uint32 `protobuf:"varint,19,opt,name=thumbnailWidth" json:"thumbnailWidth,omitempty"` + ImageDataHash *string `protobuf:"bytes,20,opt,name=imageDataHash" json:"imageDataHash,omitempty"` +} + +func (x *StickerPackMessage) Reset() { + *x = StickerPackMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StickerPackMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StickerPackMessage) ProtoMessage() {} + +func (x *StickerPackMessage) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[40] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StickerPackMessage.ProtoReflect.Descriptor instead. +func (*StickerPackMessage) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{40} +} + +func (x *StickerPackMessage) GetStickerPackID() string { + if x != nil && x.StickerPackID != nil { + return *x.StickerPackID + } + return "" +} + +func (x *StickerPackMessage) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *StickerPackMessage) GetPublisher() string { + if x != nil && x.Publisher != nil { + return *x.Publisher + } + return "" +} + +func (x *StickerPackMessage) GetStickers() []*StickerPackMessage_Sticker { + if x != nil { + return x.Stickers + } + return nil +} + +func (x *StickerPackMessage) GetFileLength() uint64 { + if x != nil && x.FileLength != nil { + return *x.FileLength + } + return 0 +} + +func (x *StickerPackMessage) GetFileSHA256() []byte { + if x != nil { + return x.FileSHA256 + } + return nil +} + +func (x *StickerPackMessage) GetFileEncSHA256() []byte { + if x != nil { + return x.FileEncSHA256 + } + return nil +} + +func (x *StickerPackMessage) GetMediaKey() []byte { + if x != nil { + return x.MediaKey + } + return nil +} + +func (x *StickerPackMessage) GetDirectPath() string { + if x != nil && x.DirectPath != nil { + return *x.DirectPath + } + return "" +} + +func (x *StickerPackMessage) GetCaption() string { + if x != nil && x.Caption != nil { + return *x.Caption + } + return "" +} + +func (x *StickerPackMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +func (x *StickerPackMessage) GetPackDescription() string { + if x != nil && x.PackDescription != nil { + return *x.PackDescription + } + return "" +} + +func (x *StickerPackMessage) GetMediaKeyTimestamp() int64 { + if x != nil && x.MediaKeyTimestamp != nil { + return *x.MediaKeyTimestamp + } + return 0 +} + +func (x *StickerPackMessage) GetTrayIconFileName() string { + if x != nil && x.TrayIconFileName != nil { + return *x.TrayIconFileName + } + return "" +} + +func (x *StickerPackMessage) GetThumbnailDirectPath() string { + if x != nil && x.ThumbnailDirectPath != nil { + return *x.ThumbnailDirectPath + } + return "" +} + +func (x *StickerPackMessage) GetThumbnailSHA256() []byte { + if x != nil { + return x.ThumbnailSHA256 + } + return nil +} + +func (x *StickerPackMessage) GetThumbnailEncSHA256() []byte { + if x != nil { + return x.ThumbnailEncSHA256 + } + return nil +} + +func (x *StickerPackMessage) GetThumbnailHeight() uint32 { + if x != nil && x.ThumbnailHeight != nil { + return *x.ThumbnailHeight + } + return 0 +} + +func (x *StickerPackMessage) GetThumbnailWidth() uint32 { + if x != nil && x.ThumbnailWidth != nil { + return *x.ThumbnailWidth + } + return 0 +} + +func (x *StickerPackMessage) GetImageDataHash() string { + if x != nil && x.ImageDataHash != nil { + return *x.ImageDataHash + } + return "" +} + type AlbumMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Caption *string `protobuf:"bytes,1,opt,name=caption" json:"caption,omitempty"` + Caption *string `protobuf:"bytes,1,opt,name=caption" json:"caption,omitempty"` + ExpectedImageCount *uint32 `protobuf:"varint,2,opt,name=expectedImageCount" json:"expectedImageCount,omitempty"` + ExpectedVideoCount *uint32 `protobuf:"varint,3,opt,name=expectedVideoCount" json:"expectedVideoCount,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` } func (x *AlbumMessage) Reset() { *x = AlbumMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[38] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[41] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8089,7 +8804,7 @@ func (x *AlbumMessage) String() string { func (*AlbumMessage) ProtoMessage() {} func (x *AlbumMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[38] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[41] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8102,7 +8817,7 @@ func (x *AlbumMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use AlbumMessage.ProtoReflect.Descriptor instead. func (*AlbumMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{38} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{41} } func (x *AlbumMessage) GetCaption() string { @@ -8112,6 +8827,27 @@ func (x *AlbumMessage) GetCaption() string { return "" } +func (x *AlbumMessage) GetExpectedImageCount() uint32 { + if x != nil && x.ExpectedImageCount != nil { + return *x.ExpectedImageCount + } + return 0 +} + +func (x *AlbumMessage) GetExpectedVideoCount() uint32 { + if x != nil && x.ExpectedVideoCount != nil { + return *x.ExpectedVideoCount + } + return 0 +} + +func (x *AlbumMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + type MessageHistoryBundle struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -8130,7 +8866,7 @@ type MessageHistoryBundle struct { func (x *MessageHistoryBundle) Reset() { *x = MessageHistoryBundle{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[39] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[42] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8143,7 +8879,7 @@ func (x *MessageHistoryBundle) String() string { func (*MessageHistoryBundle) ProtoMessage() {} func (x *MessageHistoryBundle) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[39] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[42] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8156,7 +8892,7 @@ func (x *MessageHistoryBundle) ProtoReflect() protoreflect.Message { // Deprecated: Use MessageHistoryBundle.ProtoReflect.Descriptor instead. func (*MessageHistoryBundle) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{39} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{42} } func (x *MessageHistoryBundle) GetMimetype() string { @@ -8228,7 +8964,7 @@ type EncEventResponseMessage struct { func (x *EncEventResponseMessage) Reset() { *x = EncEventResponseMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[40] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[43] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8241,7 +8977,7 @@ func (x *EncEventResponseMessage) String() string { func (*EncEventResponseMessage) ProtoMessage() {} func (x *EncEventResponseMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[40] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[43] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8254,7 +8990,7 @@ func (x *EncEventResponseMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use EncEventResponseMessage.ProtoReflect.Descriptor instead. func (*EncEventResponseMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{40} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{43} } func (x *EncEventResponseMessage) GetEventCreationMessageKey() *waCommon.MessageKey { @@ -8297,7 +9033,7 @@ type EventMessage struct { func (x *EventMessage) Reset() { *x = EventMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[41] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[44] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8310,7 +9046,7 @@ func (x *EventMessage) String() string { func (*EventMessage) ProtoMessage() {} func (x *EventMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[41] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[44] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8323,7 +9059,7 @@ func (x *EventMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use EventMessage.ProtoReflect.Descriptor instead. func (*EventMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{41} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{44} } func (x *EventMessage) GetContextInfo() *ContextInfo { @@ -8401,7 +9137,7 @@ type CommentMessage struct { func (x *CommentMessage) Reset() { *x = CommentMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[42] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[45] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8414,7 +9150,7 @@ func (x *CommentMessage) String() string { func (*CommentMessage) ProtoMessage() {} func (x *CommentMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[42] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[45] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8427,7 +9163,7 @@ func (x *CommentMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use CommentMessage.ProtoReflect.Descriptor instead. func (*CommentMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{42} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{45} } func (x *CommentMessage) GetMessage() *Message { @@ -8457,7 +9193,7 @@ type EncCommentMessage struct { func (x *EncCommentMessage) Reset() { *x = EncCommentMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[43] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[46] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8470,7 +9206,7 @@ func (x *EncCommentMessage) String() string { func (*EncCommentMessage) ProtoMessage() {} func (x *EncCommentMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[43] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[46] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8483,7 +9219,7 @@ func (x *EncCommentMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use EncCommentMessage.ProtoReflect.Descriptor instead. func (*EncCommentMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{43} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{46} } func (x *EncCommentMessage) GetTargetMessageKey() *waCommon.MessageKey { @@ -8520,7 +9256,7 @@ type EncReactionMessage struct { func (x *EncReactionMessage) Reset() { *x = EncReactionMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[44] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[47] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8533,7 +9269,7 @@ func (x *EncReactionMessage) String() string { func (*EncReactionMessage) ProtoMessage() {} func (x *EncReactionMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[44] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[47] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8546,7 +9282,7 @@ func (x *EncReactionMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use EncReactionMessage.ProtoReflect.Descriptor instead. func (*EncReactionMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{44} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{47} } func (x *EncReactionMessage) GetTargetMessageKey() *waCommon.MessageKey { @@ -8583,7 +9319,7 @@ type KeepInChatMessage struct { func (x *KeepInChatMessage) Reset() { *x = KeepInChatMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[45] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[48] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8596,7 +9332,7 @@ func (x *KeepInChatMessage) String() string { func (*KeepInChatMessage) ProtoMessage() {} func (x *KeepInChatMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[45] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[48] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8609,7 +9345,7 @@ func (x *KeepInChatMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use KeepInChatMessage.ProtoReflect.Descriptor instead. func (*KeepInChatMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{45} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{48} } func (x *KeepInChatMessage) GetKey() *waCommon.MessageKey { @@ -8646,7 +9382,7 @@ type PollResultSnapshotMessage struct { func (x *PollResultSnapshotMessage) Reset() { *x = PollResultSnapshotMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[46] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[49] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8659,7 +9395,7 @@ func (x *PollResultSnapshotMessage) String() string { func (*PollResultSnapshotMessage) ProtoMessage() {} func (x *PollResultSnapshotMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[46] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[49] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8672,7 +9408,7 @@ func (x *PollResultSnapshotMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use PollResultSnapshotMessage.ProtoReflect.Descriptor instead. func (*PollResultSnapshotMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{46} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{49} } func (x *PollResultSnapshotMessage) GetName() string { @@ -8707,7 +9443,7 @@ type PollVoteMessage struct { func (x *PollVoteMessage) Reset() { *x = PollVoteMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[47] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[50] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8720,7 +9456,7 @@ func (x *PollVoteMessage) String() string { func (*PollVoteMessage) ProtoMessage() {} func (x *PollVoteMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[47] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[50] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8733,7 +9469,7 @@ func (x *PollVoteMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use PollVoteMessage.ProtoReflect.Descriptor instead. func (*PollVoteMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{47} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{50} } func (x *PollVoteMessage) GetSelectedOptions() [][]byte { @@ -8755,7 +9491,7 @@ type PollEncValue struct { func (x *PollEncValue) Reset() { *x = PollEncValue{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[48] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[51] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8768,7 +9504,7 @@ func (x *PollEncValue) String() string { func (*PollEncValue) ProtoMessage() {} func (x *PollEncValue) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[48] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[51] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8781,7 +9517,7 @@ func (x *PollEncValue) ProtoReflect() protoreflect.Message { // Deprecated: Use PollEncValue.ProtoReflect.Descriptor instead. func (*PollEncValue) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{48} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{51} } func (x *PollEncValue) GetEncPayload() []byte { @@ -8807,7 +9543,7 @@ type PollUpdateMessageMetadata struct { func (x *PollUpdateMessageMetadata) Reset() { *x = PollUpdateMessageMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[49] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[52] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8820,7 +9556,7 @@ func (x *PollUpdateMessageMetadata) String() string { func (*PollUpdateMessageMetadata) ProtoMessage() {} func (x *PollUpdateMessageMetadata) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[49] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[52] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8833,7 +9569,7 @@ func (x *PollUpdateMessageMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use PollUpdateMessageMetadata.ProtoReflect.Descriptor instead. func (*PollUpdateMessageMetadata) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{49} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{52} } type PollUpdateMessage struct { @@ -8850,7 +9586,7 @@ type PollUpdateMessage struct { func (x *PollUpdateMessage) Reset() { *x = PollUpdateMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[50] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[53] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8863,7 +9599,7 @@ func (x *PollUpdateMessage) String() string { func (*PollUpdateMessage) ProtoMessage() {} func (x *PollUpdateMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[50] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[53] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8876,7 +9612,7 @@ func (x *PollUpdateMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use PollUpdateMessage.ProtoReflect.Descriptor instead. func (*PollUpdateMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{50} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{53} } func (x *PollUpdateMessage) GetPollCreationMessageKey() *waCommon.MessageKey { @@ -8922,7 +9658,7 @@ type PollCreationMessage struct { func (x *PollCreationMessage) Reset() { *x = PollCreationMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[51] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[54] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8935,7 +9671,7 @@ func (x *PollCreationMessage) String() string { func (*PollCreationMessage) ProtoMessage() {} func (x *PollCreationMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[51] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[54] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8948,7 +9684,7 @@ func (x *PollCreationMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use PollCreationMessage.ProtoReflect.Descriptor instead. func (*PollCreationMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{51} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{54} } func (x *PollCreationMessage) GetEncKey() []byte { @@ -8999,7 +9735,7 @@ type StickerSyncRMRMessage struct { func (x *StickerSyncRMRMessage) Reset() { *x = StickerSyncRMRMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[52] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[55] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9012,7 +9748,7 @@ func (x *StickerSyncRMRMessage) String() string { func (*StickerSyncRMRMessage) ProtoMessage() {} func (x *StickerSyncRMRMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[52] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[55] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9025,7 +9761,7 @@ func (x *StickerSyncRMRMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use StickerSyncRMRMessage.ProtoReflect.Descriptor instead. func (*StickerSyncRMRMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{52} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{55} } func (x *StickerSyncRMRMessage) GetFilehash() []string { @@ -9063,7 +9799,7 @@ type ReactionMessage struct { func (x *ReactionMessage) Reset() { *x = ReactionMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[53] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[56] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9076,7 +9812,7 @@ func (x *ReactionMessage) String() string { func (*ReactionMessage) ProtoMessage() {} func (x *ReactionMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[53] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[56] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9089,7 +9825,7 @@ func (x *ReactionMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use ReactionMessage.ProtoReflect.Descriptor instead. func (*ReactionMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{53} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{56} } func (x *ReactionMessage) GetKey() *waCommon.MessageKey { @@ -9131,7 +9867,7 @@ type FutureProofMessage struct { func (x *FutureProofMessage) Reset() { *x = FutureProofMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[54] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[57] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9144,7 +9880,7 @@ func (x *FutureProofMessage) String() string { func (*FutureProofMessage) ProtoMessage() {} func (x *FutureProofMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[54] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[57] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9157,7 +9893,7 @@ func (x *FutureProofMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use FutureProofMessage.ProtoReflect.Descriptor instead. func (*FutureProofMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{54} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{57} } func (x *FutureProofMessage) GetMessage() *Message { @@ -9180,7 +9916,7 @@ type DeviceSentMessage struct { func (x *DeviceSentMessage) Reset() { *x = DeviceSentMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[55] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[58] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9193,7 +9929,7 @@ func (x *DeviceSentMessage) String() string { func (*DeviceSentMessage) ProtoMessage() {} func (x *DeviceSentMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[55] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[58] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9206,7 +9942,7 @@ func (x *DeviceSentMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use DeviceSentMessage.ProtoReflect.Descriptor instead. func (*DeviceSentMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{55} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{58} } func (x *DeviceSentMessage) GetDestinationJID() string { @@ -9241,7 +9977,7 @@ type RequestPhoneNumberMessage struct { func (x *RequestPhoneNumberMessage) Reset() { *x = RequestPhoneNumberMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[56] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[59] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9254,7 +9990,7 @@ func (x *RequestPhoneNumberMessage) String() string { func (*RequestPhoneNumberMessage) ProtoMessage() {} func (x *RequestPhoneNumberMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[56] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[59] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9267,7 +10003,7 @@ func (x *RequestPhoneNumberMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use RequestPhoneNumberMessage.ProtoReflect.Descriptor instead. func (*RequestPhoneNumberMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{56} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{59} } func (x *RequestPhoneNumberMessage) GetContextInfo() *ContextInfo { @@ -9293,7 +10029,7 @@ type NewsletterAdminInviteMessage struct { func (x *NewsletterAdminInviteMessage) Reset() { *x = NewsletterAdminInviteMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[57] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[60] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9306,7 +10042,7 @@ func (x *NewsletterAdminInviteMessage) String() string { func (*NewsletterAdminInviteMessage) ProtoMessage() {} func (x *NewsletterAdminInviteMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[57] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[60] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9319,7 +10055,7 @@ func (x *NewsletterAdminInviteMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use NewsletterAdminInviteMessage.ProtoReflect.Descriptor instead. func (*NewsletterAdminInviteMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{57} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{60} } func (x *NewsletterAdminInviteMessage) GetNewsletterJID() string { @@ -9380,7 +10116,7 @@ type ProductMessage struct { func (x *ProductMessage) Reset() { *x = ProductMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[58] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[61] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9393,7 +10129,7 @@ func (x *ProductMessage) String() string { func (*ProductMessage) ProtoMessage() {} func (x *ProductMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[58] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[61] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9406,7 +10142,7 @@ func (x *ProductMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use ProductMessage.ProtoReflect.Descriptor instead. func (*ProductMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{58} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{61} } func (x *ProductMessage) GetProduct() *ProductMessage_ProductSnapshot { @@ -9466,7 +10202,7 @@ type TemplateButtonReplyMessage struct { func (x *TemplateButtonReplyMessage) Reset() { *x = TemplateButtonReplyMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[59] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[62] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9479,7 +10215,7 @@ func (x *TemplateButtonReplyMessage) String() string { func (*TemplateButtonReplyMessage) ProtoMessage() {} func (x *TemplateButtonReplyMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[59] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[62] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9492,7 +10228,7 @@ func (x *TemplateButtonReplyMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use TemplateButtonReplyMessage.ProtoReflect.Descriptor instead. func (*TemplateButtonReplyMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{59} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{62} } func (x *TemplateButtonReplyMessage) GetSelectedID() string { @@ -9549,7 +10285,7 @@ type TemplateMessage struct { func (x *TemplateMessage) Reset() { *x = TemplateMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[60] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[63] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9562,7 +10298,7 @@ func (x *TemplateMessage) String() string { func (*TemplateMessage) ProtoMessage() {} func (x *TemplateMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[60] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[63] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9575,7 +10311,7 @@ func (x *TemplateMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use TemplateMessage.ProtoReflect.Descriptor instead. func (*TemplateMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{60} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{63} } func (m *TemplateMessage) GetFormat() isTemplateMessage_Format { @@ -9679,7 +10415,7 @@ type StickerMessage struct { func (x *StickerMessage) Reset() { *x = StickerMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[61] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[64] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9692,7 +10428,7 @@ func (x *StickerMessage) String() string { func (*StickerMessage) ProtoMessage() {} func (x *StickerMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[61] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[64] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9705,7 +10441,7 @@ func (x *StickerMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use StickerMessage.ProtoReflect.Descriptor instead. func (*StickerMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{61} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{64} } func (x *StickerMessage) GetURL() string { @@ -9868,7 +10604,7 @@ type LiveLocationMessage struct { func (x *LiveLocationMessage) Reset() { *x = LiveLocationMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[62] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[65] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9881,7 +10617,7 @@ func (x *LiveLocationMessage) String() string { func (*LiveLocationMessage) ProtoMessage() {} func (x *LiveLocationMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[62] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[65] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9894,7 +10630,7 @@ func (x *LiveLocationMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use LiveLocationMessage.ProtoReflect.Descriptor instead. func (*LiveLocationMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{62} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{65} } func (x *LiveLocationMessage) GetDegreesLatitude() float64 { @@ -9978,7 +10714,7 @@ type CancelPaymentRequestMessage struct { func (x *CancelPaymentRequestMessage) Reset() { *x = CancelPaymentRequestMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[63] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[66] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9991,7 +10727,7 @@ func (x *CancelPaymentRequestMessage) String() string { func (*CancelPaymentRequestMessage) ProtoMessage() {} func (x *CancelPaymentRequestMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[63] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[66] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -10004,7 +10740,7 @@ func (x *CancelPaymentRequestMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use CancelPaymentRequestMessage.ProtoReflect.Descriptor instead. func (*CancelPaymentRequestMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{63} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{66} } func (x *CancelPaymentRequestMessage) GetKey() *waCommon.MessageKey { @@ -10025,7 +10761,7 @@ type DeclinePaymentRequestMessage struct { func (x *DeclinePaymentRequestMessage) Reset() { *x = DeclinePaymentRequestMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[64] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[67] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -10038,7 +10774,7 @@ func (x *DeclinePaymentRequestMessage) String() string { func (*DeclinePaymentRequestMessage) ProtoMessage() {} func (x *DeclinePaymentRequestMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[64] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[67] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -10051,7 +10787,7 @@ func (x *DeclinePaymentRequestMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use DeclinePaymentRequestMessage.ProtoReflect.Descriptor instead. func (*DeclinePaymentRequestMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{64} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{67} } func (x *DeclinePaymentRequestMessage) GetKey() *waCommon.MessageKey { @@ -10078,7 +10814,7 @@ type RequestPaymentMessage struct { func (x *RequestPaymentMessage) Reset() { *x = RequestPaymentMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[65] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[68] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -10091,7 +10827,7 @@ func (x *RequestPaymentMessage) String() string { func (*RequestPaymentMessage) ProtoMessage() {} func (x *RequestPaymentMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[65] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[68] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -10104,7 +10840,7 @@ func (x *RequestPaymentMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use RequestPaymentMessage.ProtoReflect.Descriptor instead. func (*RequestPaymentMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{65} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{68} } func (x *RequestPaymentMessage) GetNoteMessage() *Message { @@ -10169,7 +10905,7 @@ type SendPaymentMessage struct { func (x *SendPaymentMessage) Reset() { *x = SendPaymentMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[66] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[69] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -10182,7 +10918,7 @@ func (x *SendPaymentMessage) String() string { func (*SendPaymentMessage) ProtoMessage() {} func (x *SendPaymentMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[66] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[69] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -10195,7 +10931,7 @@ func (x *SendPaymentMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use SendPaymentMessage.ProtoReflect.Descriptor instead. func (*SendPaymentMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{66} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{69} } func (x *SendPaymentMessage) GetNoteMessage() *Message { @@ -10232,7 +10968,7 @@ type ContactsArrayMessage struct { func (x *ContactsArrayMessage) Reset() { *x = ContactsArrayMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[67] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[70] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -10245,7 +10981,7 @@ func (x *ContactsArrayMessage) String() string { func (*ContactsArrayMessage) ProtoMessage() {} func (x *ContactsArrayMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[67] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[70] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -10258,7 +10994,7 @@ func (x *ContactsArrayMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use ContactsArrayMessage.ProtoReflect.Descriptor instead. func (*ContactsArrayMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{67} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{70} } func (x *ContactsArrayMessage) GetDisplayName() string { @@ -10293,7 +11029,7 @@ type InitialSecurityNotificationSettingSync struct { func (x *InitialSecurityNotificationSettingSync) Reset() { *x = InitialSecurityNotificationSettingSync{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[68] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[71] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -10306,7 +11042,7 @@ func (x *InitialSecurityNotificationSettingSync) String() string { func (*InitialSecurityNotificationSettingSync) ProtoMessage() {} func (x *InitialSecurityNotificationSettingSync) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[68] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[71] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -10319,7 +11055,7 @@ func (x *InitialSecurityNotificationSettingSync) ProtoReflect() protoreflect.Mes // Deprecated: Use InitialSecurityNotificationSettingSync.ProtoReflect.Descriptor instead. func (*InitialSecurityNotificationSettingSync) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{68} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{71} } func (x *InitialSecurityNotificationSettingSync) GetSecurityNotificationEnabled() bool { @@ -10329,69 +11065,6 @@ func (x *InitialSecurityNotificationSettingSync) GetSecurityNotificationEnabled( return false } -type PeerDataOperationRequestResponseMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PeerDataOperationRequestType *PeerDataOperationRequestType `protobuf:"varint,1,opt,name=peerDataOperationRequestType,enum=WAWebProtobufsE2E.PeerDataOperationRequestType" json:"peerDataOperationRequestType,omitempty"` - StanzaID *string `protobuf:"bytes,2,opt,name=stanzaID" json:"stanzaID,omitempty"` - PeerDataOperationResult []*PeerDataOperationRequestResponseMessage_PeerDataOperationResult `protobuf:"bytes,3,rep,name=peerDataOperationResult" json:"peerDataOperationResult,omitempty"` -} - -func (x *PeerDataOperationRequestResponseMessage) Reset() { - *x = PeerDataOperationRequestResponseMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[69] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PeerDataOperationRequestResponseMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PeerDataOperationRequestResponseMessage) ProtoMessage() {} - -func (x *PeerDataOperationRequestResponseMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[69] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PeerDataOperationRequestResponseMessage.ProtoReflect.Descriptor instead. -func (*PeerDataOperationRequestResponseMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{69} -} - -func (x *PeerDataOperationRequestResponseMessage) GetPeerDataOperationRequestType() PeerDataOperationRequestType { - if x != nil && x.PeerDataOperationRequestType != nil { - return *x.PeerDataOperationRequestType - } - return PeerDataOperationRequestType_UPLOAD_STICKER -} - -func (x *PeerDataOperationRequestResponseMessage) GetStanzaID() string { - if x != nil && x.StanzaID != nil { - return *x.StanzaID - } - return "" -} - -func (x *PeerDataOperationRequestResponseMessage) GetPeerDataOperationResult() []*PeerDataOperationRequestResponseMessage_PeerDataOperationResult { - if x != nil { - return x.PeerDataOperationResult - } - return nil -} - type PeerDataOperationRequestMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -10402,12 +11075,13 @@ type PeerDataOperationRequestMessage struct { RequestURLPreview []*PeerDataOperationRequestMessage_RequestUrlPreview `protobuf:"bytes,3,rep,name=requestURLPreview" json:"requestURLPreview,omitempty"` HistorySyncOnDemandRequest *PeerDataOperationRequestMessage_HistorySyncOnDemandRequest `protobuf:"bytes,4,opt,name=historySyncOnDemandRequest" json:"historySyncOnDemandRequest,omitempty"` PlaceholderMessageResendRequest []*PeerDataOperationRequestMessage_PlaceholderMessageResendRequest `protobuf:"bytes,5,rep,name=placeholderMessageResendRequest" json:"placeholderMessageResendRequest,omitempty"` + FullHistorySyncOnDemandRequest *PeerDataOperationRequestMessage_FullHistorySyncOnDemandRequest `protobuf:"bytes,6,opt,name=fullHistorySyncOnDemandRequest" json:"fullHistorySyncOnDemandRequest,omitempty"` } func (x *PeerDataOperationRequestMessage) Reset() { *x = PeerDataOperationRequestMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[70] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[72] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -10420,7 +11094,7 @@ func (x *PeerDataOperationRequestMessage) String() string { func (*PeerDataOperationRequestMessage) ProtoMessage() {} func (x *PeerDataOperationRequestMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[70] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[72] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -10433,7 +11107,7 @@ func (x *PeerDataOperationRequestMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use PeerDataOperationRequestMessage.ProtoReflect.Descriptor instead. func (*PeerDataOperationRequestMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{70} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{72} } func (x *PeerDataOperationRequestMessage) GetPeerDataOperationRequestType() PeerDataOperationRequestType { @@ -10471,6 +11145,60 @@ func (x *PeerDataOperationRequestMessage) GetPlaceholderMessageResendRequest() [ return nil } +func (x *PeerDataOperationRequestMessage) GetFullHistorySyncOnDemandRequest() *PeerDataOperationRequestMessage_FullHistorySyncOnDemandRequest { + if x != nil { + return x.FullHistorySyncOnDemandRequest + } + return nil +} + +type FullHistorySyncOnDemandRequestMetadata struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestID *string `protobuf:"bytes,1,opt,name=requestID" json:"requestID,omitempty"` +} + +func (x *FullHistorySyncOnDemandRequestMetadata) Reset() { + *x = FullHistorySyncOnDemandRequestMetadata{} + if protoimpl.UnsafeEnabled { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[73] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FullHistorySyncOnDemandRequestMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FullHistorySyncOnDemandRequestMetadata) ProtoMessage() {} + +func (x *FullHistorySyncOnDemandRequestMetadata) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[73] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FullHistorySyncOnDemandRequestMetadata.ProtoReflect.Descriptor instead. +func (*FullHistorySyncOnDemandRequestMetadata) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{73} +} + +func (x *FullHistorySyncOnDemandRequestMetadata) GetRequestID() string { + if x != nil && x.RequestID != nil { + return *x.RequestID + } + return "" +} + type AppStateFatalExceptionNotification struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -10483,7 +11211,7 @@ type AppStateFatalExceptionNotification struct { func (x *AppStateFatalExceptionNotification) Reset() { *x = AppStateFatalExceptionNotification{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[71] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[74] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -10496,7 +11224,7 @@ func (x *AppStateFatalExceptionNotification) String() string { func (*AppStateFatalExceptionNotification) ProtoMessage() {} func (x *AppStateFatalExceptionNotification) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[71] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[74] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -10509,7 +11237,7 @@ func (x *AppStateFatalExceptionNotification) ProtoReflect() protoreflect.Message // Deprecated: Use AppStateFatalExceptionNotification.ProtoReflect.Descriptor instead. func (*AppStateFatalExceptionNotification) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{71} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{74} } func (x *AppStateFatalExceptionNotification) GetCollectionNames() []string { @@ -10537,7 +11265,7 @@ type AppStateSyncKeyRequest struct { func (x *AppStateSyncKeyRequest) Reset() { *x = AppStateSyncKeyRequest{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[72] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[75] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -10550,7 +11278,7 @@ func (x *AppStateSyncKeyRequest) String() string { func (*AppStateSyncKeyRequest) ProtoMessage() {} func (x *AppStateSyncKeyRequest) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[72] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[75] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -10563,7 +11291,7 @@ func (x *AppStateSyncKeyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AppStateSyncKeyRequest.ProtoReflect.Descriptor instead. func (*AppStateSyncKeyRequest) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{72} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{75} } func (x *AppStateSyncKeyRequest) GetKeyIDs() []*AppStateSyncKeyId { @@ -10584,7 +11312,7 @@ type AppStateSyncKeyShare struct { func (x *AppStateSyncKeyShare) Reset() { *x = AppStateSyncKeyShare{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[73] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[76] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -10597,7 +11325,7 @@ func (x *AppStateSyncKeyShare) String() string { func (*AppStateSyncKeyShare) ProtoMessage() {} func (x *AppStateSyncKeyShare) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[73] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[76] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -10610,7 +11338,7 @@ func (x *AppStateSyncKeyShare) ProtoReflect() protoreflect.Message { // Deprecated: Use AppStateSyncKeyShare.ProtoReflect.Descriptor instead. func (*AppStateSyncKeyShare) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{73} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{76} } func (x *AppStateSyncKeyShare) GetKeys() []*AppStateSyncKey { @@ -10633,7 +11361,7 @@ type AppStateSyncKeyData struct { func (x *AppStateSyncKeyData) Reset() { *x = AppStateSyncKeyData{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[74] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[77] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -10646,7 +11374,7 @@ func (x *AppStateSyncKeyData) String() string { func (*AppStateSyncKeyData) ProtoMessage() {} func (x *AppStateSyncKeyData) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[74] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[77] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -10659,7 +11387,7 @@ func (x *AppStateSyncKeyData) ProtoReflect() protoreflect.Message { // Deprecated: Use AppStateSyncKeyData.ProtoReflect.Descriptor instead. func (*AppStateSyncKeyData) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{74} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{77} } func (x *AppStateSyncKeyData) GetKeyData() []byte { @@ -10696,7 +11424,7 @@ type AppStateSyncKeyFingerprint struct { func (x *AppStateSyncKeyFingerprint) Reset() { *x = AppStateSyncKeyFingerprint{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[75] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[78] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -10709,7 +11437,7 @@ func (x *AppStateSyncKeyFingerprint) String() string { func (*AppStateSyncKeyFingerprint) ProtoMessage() {} func (x *AppStateSyncKeyFingerprint) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[75] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[78] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -10722,7 +11450,7 @@ func (x *AppStateSyncKeyFingerprint) ProtoReflect() protoreflect.Message { // Deprecated: Use AppStateSyncKeyFingerprint.ProtoReflect.Descriptor instead. func (*AppStateSyncKeyFingerprint) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{75} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{78} } func (x *AppStateSyncKeyFingerprint) GetRawID() uint32 { @@ -10757,7 +11485,7 @@ type AppStateSyncKeyId struct { func (x *AppStateSyncKeyId) Reset() { *x = AppStateSyncKeyId{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[76] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[79] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -10770,7 +11498,7 @@ func (x *AppStateSyncKeyId) String() string { func (*AppStateSyncKeyId) ProtoMessage() {} func (x *AppStateSyncKeyId) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[76] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[79] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -10783,7 +11511,7 @@ func (x *AppStateSyncKeyId) ProtoReflect() protoreflect.Message { // Deprecated: Use AppStateSyncKeyId.ProtoReflect.Descriptor instead. func (*AppStateSyncKeyId) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{76} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{79} } func (x *AppStateSyncKeyId) GetKeyID() []byte { @@ -10805,7 +11533,7 @@ type AppStateSyncKey struct { func (x *AppStateSyncKey) Reset() { *x = AppStateSyncKey{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[77] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[80] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -10818,7 +11546,7 @@ func (x *AppStateSyncKey) String() string { func (*AppStateSyncKey) ProtoMessage() {} func (x *AppStateSyncKey) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[77] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[80] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -10831,7 +11559,7 @@ func (x *AppStateSyncKey) ProtoReflect() protoreflect.Message { // Deprecated: Use AppStateSyncKey.ProtoReflect.Descriptor instead. func (*AppStateSyncKey) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{77} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{80} } func (x *AppStateSyncKey) GetKeyID() *AppStateSyncKeyId { @@ -10860,7 +11588,7 @@ type Chat struct { func (x *Chat) Reset() { *x = Chat{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[78] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[81] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -10873,7 +11601,7 @@ func (x *Chat) String() string { func (*Chat) ProtoMessage() {} func (x *Chat) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[78] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[81] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -10886,7 +11614,7 @@ func (x *Chat) ProtoReflect() protoreflect.Message { // Deprecated: Use Chat.ProtoReflect.Descriptor instead. func (*Chat) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{78} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{81} } func (x *Chat) GetDisplayName() string { @@ -10912,12 +11640,14 @@ type Call struct { ConversionSource *string `protobuf:"bytes,2,opt,name=conversionSource" json:"conversionSource,omitempty"` ConversionData []byte `protobuf:"bytes,3,opt,name=conversionData" json:"conversionData,omitempty"` ConversionDelaySeconds *uint32 `protobuf:"varint,4,opt,name=conversionDelaySeconds" json:"conversionDelaySeconds,omitempty"` + CtwaSignals *string `protobuf:"bytes,5,opt,name=ctwaSignals" json:"ctwaSignals,omitempty"` + CtwaPayload []byte `protobuf:"bytes,6,opt,name=ctwaPayload" json:"ctwaPayload,omitempty"` } func (x *Call) Reset() { *x = Call{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[79] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[82] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -10930,7 +11660,7 @@ func (x *Call) String() string { func (*Call) ProtoMessage() {} func (x *Call) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[79] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[82] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -10943,7 +11673,7 @@ func (x *Call) ProtoReflect() protoreflect.Message { // Deprecated: Use Call.ProtoReflect.Descriptor instead. func (*Call) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{79} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{82} } func (x *Call) GetCallKey() []byte { @@ -10974,6 +11704,20 @@ func (x *Call) GetConversionDelaySeconds() uint32 { return 0 } +func (x *Call) GetCtwaSignals() string { + if x != nil && x.CtwaSignals != nil { + return *x.CtwaSignals + } + return "" +} + +func (x *Call) GetCtwaPayload() []byte { + if x != nil { + return x.CtwaPayload + } + return nil +} + type AudioMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -11000,7 +11744,7 @@ type AudioMessage struct { func (x *AudioMessage) Reset() { *x = AudioMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[80] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[83] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -11013,7 +11757,7 @@ func (x *AudioMessage) String() string { func (*AudioMessage) ProtoMessage() {} func (x *AudioMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[80] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[83] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11026,7 +11770,7 @@ func (x *AudioMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use AudioMessage.ProtoReflect.Descriptor instead. func (*AudioMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{80} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{83} } func (x *AudioMessage) GetURL() string { @@ -11172,7 +11916,7 @@ type DocumentMessage struct { func (x *DocumentMessage) Reset() { *x = DocumentMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[81] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[84] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -11185,7 +11929,7 @@ func (x *DocumentMessage) String() string { func (*DocumentMessage) ProtoMessage() {} func (x *DocumentMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[81] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[84] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11198,7 +11942,7 @@ func (x *DocumentMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use DocumentMessage.ProtoReflect.Descriptor instead. func (*DocumentMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{81} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{84} } func (x *DocumentMessage) GetURL() string { @@ -11370,7 +12114,7 @@ type LocationMessage struct { func (x *LocationMessage) Reset() { *x = LocationMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[82] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[85] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -11383,7 +12127,7 @@ func (x *LocationMessage) String() string { func (*LocationMessage) ProtoMessage() {} func (x *LocationMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[82] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[85] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11396,7 +12140,7 @@ func (x *LocationMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use LocationMessage.ProtoReflect.Descriptor instead. func (*LocationMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{82} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{85} } func (x *LocationMessage) GetDegreesLatitude() float64 { @@ -11496,7 +12240,7 @@ type ContactMessage struct { func (x *ContactMessage) Reset() { *x = ContactMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[83] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[86] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -11509,7 +12253,7 @@ func (x *ContactMessage) String() string { func (*ContactMessage) ProtoMessage() {} func (x *ContactMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[83] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[86] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11522,7 +12266,7 @@ func (x *ContactMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use ContactMessage.ProtoReflect.Descriptor instead. func (*ContactMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{83} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{86} } func (x *ContactMessage) GetDisplayName() string { @@ -11558,7 +12302,7 @@ type SenderKeyDistributionMessage struct { func (x *SenderKeyDistributionMessage) Reset() { *x = SenderKeyDistributionMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[84] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[87] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -11571,7 +12315,7 @@ func (x *SenderKeyDistributionMessage) String() string { func (*SenderKeyDistributionMessage) ProtoMessage() {} func (x *SenderKeyDistributionMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[84] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[87] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11584,7 +12328,7 @@ func (x *SenderKeyDistributionMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use SenderKeyDistributionMessage.ProtoReflect.Descriptor instead. func (*SenderKeyDistributionMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{84} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{87} } func (x *SenderKeyDistributionMessage) GetGroupID() string { @@ -11616,7 +12360,7 @@ type BotAvatarMetadata struct { func (x *BotAvatarMetadata) Reset() { *x = BotAvatarMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[85] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[88] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -11629,7 +12373,7 @@ func (x *BotAvatarMetadata) String() string { func (*BotAvatarMetadata) ProtoMessage() {} func (x *BotAvatarMetadata) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[85] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[88] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11642,7 +12386,7 @@ func (x *BotAvatarMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use BotAvatarMetadata.ProtoReflect.Descriptor instead. func (*BotAvatarMetadata) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{85} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{88} } func (x *BotAvatarMetadata) GetSentiment() uint32 { @@ -11692,7 +12436,7 @@ type BotSuggestedPromptMetadata struct { func (x *BotSuggestedPromptMetadata) Reset() { *x = BotSuggestedPromptMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[86] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[89] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -11705,7 +12449,7 @@ func (x *BotSuggestedPromptMetadata) String() string { func (*BotSuggestedPromptMetadata) ProtoMessage() {} func (x *BotSuggestedPromptMetadata) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[86] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[89] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11718,7 +12462,7 @@ func (x *BotSuggestedPromptMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use BotSuggestedPromptMetadata.ProtoReflect.Descriptor instead. func (*BotSuggestedPromptMetadata) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{86} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{89} } func (x *BotSuggestedPromptMetadata) GetSuggestedPrompts() []string { @@ -11735,36 +12479,32 @@ func (x *BotSuggestedPromptMetadata) GetSelectedPromptIndex() uint32 { return 0 } -type BotMediaMetadata struct { +type BotSessionMetadata struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - FileSHA256 []byte `protobuf:"bytes,1,opt,name=fileSHA256" json:"fileSHA256,omitempty"` - MediaKey []byte `protobuf:"bytes,2,opt,name=mediaKey" json:"mediaKey,omitempty"` - FileEncSHA256 []byte `protobuf:"bytes,3,opt,name=fileEncSHA256" json:"fileEncSHA256,omitempty"` - DirectPath *string `protobuf:"bytes,4,opt,name=directPath" json:"directPath,omitempty"` - MediaKeyTimestamp *int64 `protobuf:"varint,5,opt,name=mediaKeyTimestamp" json:"mediaKeyTimestamp,omitempty"` - Mimetype *string `protobuf:"bytes,6,opt,name=mimetype" json:"mimetype,omitempty"` + SessionID *string `protobuf:"bytes,1,opt,name=sessionID" json:"sessionID,omitempty"` + SessionSource *BotSessionSource `protobuf:"varint,2,opt,name=sessionSource,enum=WAWebProtobufsE2E.BotSessionSource" json:"sessionSource,omitempty"` } -func (x *BotMediaMetadata) Reset() { - *x = BotMediaMetadata{} +func (x *BotSessionMetadata) Reset() { + *x = BotSessionMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[87] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[90] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *BotMediaMetadata) String() string { +func (x *BotSessionMetadata) String() string { return protoimpl.X.MessageStringOf(x) } -func (*BotMediaMetadata) ProtoMessage() {} +func (*BotSessionMetadata) ProtoMessage() {} -func (x *BotMediaMetadata) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[87] +func (x *BotSessionMetadata) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[90] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11775,51 +12515,23 @@ func (x *BotMediaMetadata) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use BotMediaMetadata.ProtoReflect.Descriptor instead. -func (*BotMediaMetadata) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{87} +// Deprecated: Use BotSessionMetadata.ProtoReflect.Descriptor instead. +func (*BotSessionMetadata) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{90} } -func (x *BotMediaMetadata) GetFileSHA256() []byte { - if x != nil { - return x.FileSHA256 - } - return nil -} - -func (x *BotMediaMetadata) GetMediaKey() []byte { - if x != nil { - return x.MediaKey - } - return nil -} - -func (x *BotMediaMetadata) GetFileEncSHA256() []byte { - if x != nil { - return x.FileEncSHA256 - } - return nil -} - -func (x *BotMediaMetadata) GetDirectPath() string { - if x != nil && x.DirectPath != nil { - return *x.DirectPath +func (x *BotSessionMetadata) GetSessionID() string { + if x != nil && x.SessionID != nil { + return *x.SessionID } return "" } -func (x *BotMediaMetadata) GetMediaKeyTimestamp() int64 { - if x != nil && x.MediaKeyTimestamp != nil { - return *x.MediaKeyTimestamp +func (x *BotSessionMetadata) GetSessionSource() BotSessionSource { + if x != nil && x.SessionSource != nil { + return *x.SessionSource } - return 0 -} - -func (x *BotMediaMetadata) GetMimetype() string { - if x != nil && x.Mimetype != nil { - return *x.Mimetype - } - return "" + return BotSessionSource_NULL_STATE } type BotMemuMetadata struct { @@ -11833,7 +12545,7 @@ type BotMemuMetadata struct { func (x *BotMemuMetadata) Reset() { *x = BotMemuMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[88] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[91] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -11846,7 +12558,7 @@ func (x *BotMemuMetadata) String() string { func (*BotMemuMetadata) ProtoMessage() {} func (x *BotMemuMetadata) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[88] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[91] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11859,7 +12571,7 @@ func (x *BotMemuMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use BotMemuMetadata.ProtoReflect.Descriptor instead. func (*BotMemuMetadata) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{88} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{91} } func (x *BotMemuMetadata) GetFaceImages() []*BotMediaMetadata { @@ -11869,26 +12581,76 @@ func (x *BotMemuMetadata) GetFaceImages() []*BotMediaMetadata { return nil } +type BotProgressIndicatorMetadata struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProgressDescription *string `protobuf:"bytes,1,opt,name=progressDescription" json:"progressDescription,omitempty"` +} + +func (x *BotProgressIndicatorMetadata) Reset() { + *x = BotProgressIndicatorMetadata{} + if protoimpl.UnsafeEnabled { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[92] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BotProgressIndicatorMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BotProgressIndicatorMetadata) ProtoMessage() {} + +func (x *BotProgressIndicatorMetadata) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[92] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BotProgressIndicatorMetadata.ProtoReflect.Descriptor instead. +func (*BotProgressIndicatorMetadata) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{92} +} + +func (x *BotProgressIndicatorMetadata) GetProgressDescription() string { + if x != nil && x.ProgressDescription != nil { + return *x.ProgressDescription + } + return "" +} + type BotMetadata struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - AvatarMetadata *BotAvatarMetadata `protobuf:"bytes,1,opt,name=avatarMetadata" json:"avatarMetadata,omitempty"` - PersonaID *string `protobuf:"bytes,2,opt,name=personaID" json:"personaID,omitempty"` - PluginMetadata *BotPluginMetadata `protobuf:"bytes,3,opt,name=pluginMetadata" json:"pluginMetadata,omitempty"` - SuggestedPromptMetadata *BotSuggestedPromptMetadata `protobuf:"bytes,4,opt,name=suggestedPromptMetadata" json:"suggestedPromptMetadata,omitempty"` - InvokerJID *string `protobuf:"bytes,5,opt,name=invokerJID" json:"invokerJID,omitempty"` - SearchMetadata *BotSearchMetadata `protobuf:"bytes,6,opt,name=searchMetadata" json:"searchMetadata,omitempty"` - MemuMetadata *BotMemuMetadata `protobuf:"bytes,7,opt,name=memuMetadata" json:"memuMetadata,omitempty"` - Timezone *string `protobuf:"bytes,8,opt,name=timezone" json:"timezone,omitempty"` - ReminderMetadata *BotReminderMetadata `protobuf:"bytes,9,opt,name=reminderMetadata" json:"reminderMetadata,omitempty"` + AvatarMetadata *BotAvatarMetadata `protobuf:"bytes,1,opt,name=avatarMetadata" json:"avatarMetadata,omitempty"` + PersonaID *string `protobuf:"bytes,2,opt,name=personaID" json:"personaID,omitempty"` + PluginMetadata *BotPluginMetadata `protobuf:"bytes,3,opt,name=pluginMetadata" json:"pluginMetadata,omitempty"` + SuggestedPromptMetadata *BotSuggestedPromptMetadata `protobuf:"bytes,4,opt,name=suggestedPromptMetadata" json:"suggestedPromptMetadata,omitempty"` + InvokerJID *string `protobuf:"bytes,5,opt,name=invokerJID" json:"invokerJID,omitempty"` + SessionMetadata *BotSessionMetadata `protobuf:"bytes,6,opt,name=sessionMetadata" json:"sessionMetadata,omitempty"` + MemuMetadata *BotMemuMetadata `protobuf:"bytes,7,opt,name=memuMetadata" json:"memuMetadata,omitempty"` + Timezone *string `protobuf:"bytes,8,opt,name=timezone" json:"timezone,omitempty"` + ReminderMetadata *BotReminderMetadata `protobuf:"bytes,9,opt,name=reminderMetadata" json:"reminderMetadata,omitempty"` + ModelMetadata *BotModelMetadata `protobuf:"bytes,10,opt,name=modelMetadata" json:"modelMetadata,omitempty"` + MessageDisclaimerText *string `protobuf:"bytes,11,opt,name=messageDisclaimerText" json:"messageDisclaimerText,omitempty"` + ProgressIndicatorMetadata *BotProgressIndicatorMetadata `protobuf:"bytes,12,opt,name=progressIndicatorMetadata" json:"progressIndicatorMetadata,omitempty"` } func (x *BotMetadata) Reset() { *x = BotMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[89] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[93] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -11901,7 +12663,7 @@ func (x *BotMetadata) String() string { func (*BotMetadata) ProtoMessage() {} func (x *BotMetadata) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[89] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[93] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11914,7 +12676,7 @@ func (x *BotMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use BotMetadata.ProtoReflect.Descriptor instead. func (*BotMetadata) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{89} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{93} } func (x *BotMetadata) GetAvatarMetadata() *BotAvatarMetadata { @@ -11952,9 +12714,9 @@ func (x *BotMetadata) GetInvokerJID() string { return "" } -func (x *BotMetadata) GetSearchMetadata() *BotSearchMetadata { +func (x *BotMetadata) GetSessionMetadata() *BotSessionMetadata { if x != nil { - return x.SearchMetadata + return x.SessionMetadata } return nil } @@ -11980,6 +12742,27 @@ func (x *BotMetadata) GetReminderMetadata() *BotReminderMetadata { return nil } +func (x *BotMetadata) GetModelMetadata() *BotModelMetadata { + if x != nil { + return x.ModelMetadata + } + return nil +} + +func (x *BotMetadata) GetMessageDisclaimerText() string { + if x != nil && x.MessageDisclaimerText != nil { + return *x.MessageDisclaimerText + } + return "" +} + +func (x *BotMetadata) GetProgressIndicatorMetadata() *BotProgressIndicatorMetadata { + if x != nil { + return x.ProgressIndicatorMetadata + } + return nil +} + type DeviceListMetadata struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -11998,7 +12781,7 @@ type DeviceListMetadata struct { func (x *DeviceListMetadata) Reset() { *x = DeviceListMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[90] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[94] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12011,7 +12794,7 @@ func (x *DeviceListMetadata) String() string { func (*DeviceListMetadata) ProtoMessage() {} func (x *DeviceListMetadata) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[90] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[94] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12024,7 +12807,7 @@ func (x *DeviceListMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use DeviceListMetadata.ProtoReflect.Descriptor instead. func (*DeviceListMetadata) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{90} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{94} } func (x *DeviceListMetadata) GetSenderKeyHash() []byte { @@ -12083,6 +12866,269 @@ func (x *DeviceListMetadata) GetRecipientKeyIndexes() []uint32 { return nil } +type EmbeddedMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + StanzaID *string `protobuf:"bytes,1,opt,name=stanzaID" json:"stanzaID,omitempty"` + Message *Message `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` +} + +func (x *EmbeddedMessage) Reset() { + *x = EmbeddedMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[95] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EmbeddedMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EmbeddedMessage) ProtoMessage() {} + +func (x *EmbeddedMessage) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[95] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EmbeddedMessage.ProtoReflect.Descriptor instead. +func (*EmbeddedMessage) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{95} +} + +func (x *EmbeddedMessage) GetStanzaID() string { + if x != nil && x.StanzaID != nil { + return *x.StanzaID + } + return "" +} + +func (x *EmbeddedMessage) GetMessage() *Message { + if x != nil { + return x.Message + } + return nil +} + +type EmbeddedMusic struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MusicContentMediaID *string `protobuf:"bytes,1,opt,name=musicContentMediaID" json:"musicContentMediaID,omitempty"` + SongID *string `protobuf:"bytes,2,opt,name=songID" json:"songID,omitempty"` + Author *string `protobuf:"bytes,3,opt,name=author" json:"author,omitempty"` + Title *string `protobuf:"bytes,4,opt,name=title" json:"title,omitempty"` + ArtworkDirectPath *string `protobuf:"bytes,5,opt,name=artworkDirectPath" json:"artworkDirectPath,omitempty"` + ArtworkSHA256 []byte `protobuf:"bytes,6,opt,name=artworkSHA256" json:"artworkSHA256,omitempty"` + ArtworkEncSHA256 []byte `protobuf:"bytes,7,opt,name=artworkEncSHA256" json:"artworkEncSHA256,omitempty"` + ArtworkMediaKey []byte `protobuf:"bytes,11,opt,name=artworkMediaKey" json:"artworkMediaKey,omitempty"` + ArtistAttribution *string `protobuf:"bytes,8,opt,name=artistAttribution" json:"artistAttribution,omitempty"` + CountryBlocklist []byte `protobuf:"bytes,9,opt,name=countryBlocklist" json:"countryBlocklist,omitempty"` + IsExplicit *bool `protobuf:"varint,10,opt,name=isExplicit" json:"isExplicit,omitempty"` +} + +func (x *EmbeddedMusic) Reset() { + *x = EmbeddedMusic{} + if protoimpl.UnsafeEnabled { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[96] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EmbeddedMusic) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EmbeddedMusic) ProtoMessage() {} + +func (x *EmbeddedMusic) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[96] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EmbeddedMusic.ProtoReflect.Descriptor instead. +func (*EmbeddedMusic) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{96} +} + +func (x *EmbeddedMusic) GetMusicContentMediaID() string { + if x != nil && x.MusicContentMediaID != nil { + return *x.MusicContentMediaID + } + return "" +} + +func (x *EmbeddedMusic) GetSongID() string { + if x != nil && x.SongID != nil { + return *x.SongID + } + return "" +} + +func (x *EmbeddedMusic) GetAuthor() string { + if x != nil && x.Author != nil { + return *x.Author + } + return "" +} + +func (x *EmbeddedMusic) GetTitle() string { + if x != nil && x.Title != nil { + return *x.Title + } + return "" +} + +func (x *EmbeddedMusic) GetArtworkDirectPath() string { + if x != nil && x.ArtworkDirectPath != nil { + return *x.ArtworkDirectPath + } + return "" +} + +func (x *EmbeddedMusic) GetArtworkSHA256() []byte { + if x != nil { + return x.ArtworkSHA256 + } + return nil +} + +func (x *EmbeddedMusic) GetArtworkEncSHA256() []byte { + if x != nil { + return x.ArtworkEncSHA256 + } + return nil +} + +func (x *EmbeddedMusic) GetArtworkMediaKey() []byte { + if x != nil { + return x.ArtworkMediaKey + } + return nil +} + +func (x *EmbeddedMusic) GetArtistAttribution() string { + if x != nil && x.ArtistAttribution != nil { + return *x.ArtistAttribution + } + return "" +} + +func (x *EmbeddedMusic) GetCountryBlocklist() []byte { + if x != nil { + return x.CountryBlocklist + } + return nil +} + +func (x *EmbeddedMusic) GetIsExplicit() bool { + if x != nil && x.IsExplicit != nil { + return *x.IsExplicit + } + return false +} + +type EmbeddedContent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Content: + // + // *EmbeddedContent_EmbeddedMessage + // *EmbeddedContent_EmbeddedMusic + Content isEmbeddedContent_Content `protobuf_oneof:"content"` +} + +func (x *EmbeddedContent) Reset() { + *x = EmbeddedContent{} + if protoimpl.UnsafeEnabled { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[97] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EmbeddedContent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EmbeddedContent) ProtoMessage() {} + +func (x *EmbeddedContent) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[97] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EmbeddedContent.ProtoReflect.Descriptor instead. +func (*EmbeddedContent) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{97} +} + +func (m *EmbeddedContent) GetContent() isEmbeddedContent_Content { + if m != nil { + return m.Content + } + return nil +} + +func (x *EmbeddedContent) GetEmbeddedMessage() *EmbeddedMessage { + if x, ok := x.GetContent().(*EmbeddedContent_EmbeddedMessage); ok { + return x.EmbeddedMessage + } + return nil +} + +func (x *EmbeddedContent) GetEmbeddedMusic() *EmbeddedMusic { + if x, ok := x.GetContent().(*EmbeddedContent_EmbeddedMusic); ok { + return x.EmbeddedMusic + } + return nil +} + +type isEmbeddedContent_Content interface { + isEmbeddedContent_Content() +} + +type EmbeddedContent_EmbeddedMessage struct { + EmbeddedMessage *EmbeddedMessage `protobuf:"bytes,1,opt,name=embeddedMessage,oneof"` +} + +type EmbeddedContent_EmbeddedMusic struct { + EmbeddedMusic *EmbeddedMusic `protobuf:"bytes,2,opt,name=embeddedMusic,oneof"` +} + +func (*EmbeddedContent_EmbeddedMessage) isEmbeddedContent_Content() {} + +func (*EmbeddedContent_EmbeddedMusic) isEmbeddedContent_Content() {} + type InteractiveAnnotation struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -12092,15 +13138,17 @@ type InteractiveAnnotation struct { // // *InteractiveAnnotation_Location // *InteractiveAnnotation_Newsletter + // *InteractiveAnnotation_EmbeddedAction Action isInteractiveAnnotation_Action `protobuf_oneof:"action"` PolygonVertices []*Point `protobuf:"bytes,1,rep,name=polygonVertices" json:"polygonVertices,omitempty"` ShouldSkipConfirmation *bool `protobuf:"varint,4,opt,name=shouldSkipConfirmation" json:"shouldSkipConfirmation,omitempty"` + EmbeddedContent *EmbeddedContent `protobuf:"bytes,5,opt,name=embeddedContent" json:"embeddedContent,omitempty"` } func (x *InteractiveAnnotation) Reset() { *x = InteractiveAnnotation{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[91] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[98] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12113,7 +13161,7 @@ func (x *InteractiveAnnotation) String() string { func (*InteractiveAnnotation) ProtoMessage() {} func (x *InteractiveAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[91] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[98] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12126,7 +13174,7 @@ func (x *InteractiveAnnotation) ProtoReflect() protoreflect.Message { // Deprecated: Use InteractiveAnnotation.ProtoReflect.Descriptor instead. func (*InteractiveAnnotation) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{91} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{98} } func (m *InteractiveAnnotation) GetAction() isInteractiveAnnotation_Action { @@ -12150,6 +13198,13 @@ func (x *InteractiveAnnotation) GetNewsletter() *ContextInfo_ForwardedNewsletter return nil } +func (x *InteractiveAnnotation) GetEmbeddedAction() bool { + if x, ok := x.GetAction().(*InteractiveAnnotation_EmbeddedAction); ok { + return x.EmbeddedAction + } + return false +} + func (x *InteractiveAnnotation) GetPolygonVertices() []*Point { if x != nil { return x.PolygonVertices @@ -12164,6 +13219,13 @@ func (x *InteractiveAnnotation) GetShouldSkipConfirmation() bool { return false } +func (x *InteractiveAnnotation) GetEmbeddedContent() *EmbeddedContent { + if x != nil { + return x.EmbeddedContent + } + return nil +} + type isInteractiveAnnotation_Action interface { isInteractiveAnnotation_Action() } @@ -12176,10 +13238,16 @@ type InteractiveAnnotation_Newsletter struct { Newsletter *ContextInfo_ForwardedNewsletterMessageInfo `protobuf:"bytes,3,opt,name=newsletter,oneof"` } +type InteractiveAnnotation_EmbeddedAction struct { + EmbeddedAction bool `protobuf:"varint,6,opt,name=embeddedAction,oneof"` +} + func (*InteractiveAnnotation_Location) isInteractiveAnnotation_Action() {} func (*InteractiveAnnotation_Newsletter) isInteractiveAnnotation_Action() {} +func (*InteractiveAnnotation_EmbeddedAction) isInteractiveAnnotation_Action() {} + type Point struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -12194,7 +13262,7 @@ type Point struct { func (x *Point) Reset() { *x = Point{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[92] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[99] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12207,7 +13275,7 @@ func (x *Point) String() string { func (*Point) ProtoMessage() {} func (x *Point) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[92] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[99] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12220,7 +13288,7 @@ func (x *Point) ProtoReflect() protoreflect.Message { // Deprecated: Use Point.ProtoReflect.Descriptor instead. func (*Point) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{92} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{99} } func (x *Point) GetXDeprecated() int32 { @@ -12264,7 +13332,7 @@ type Location struct { func (x *Location) Reset() { *x = Location{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[93] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[100] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12277,7 +13345,7 @@ func (x *Location) String() string { func (*Location) ProtoMessage() {} func (x *Location) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[93] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[100] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12290,7 +13358,7 @@ func (x *Location) ProtoReflect() protoreflect.Message { // Deprecated: Use Location.ProtoReflect.Descriptor instead. func (*Location) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{93} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{100} } func (x *Location) GetDegreesLatitude() float64 { @@ -12331,7 +13399,7 @@ type TemplateButton struct { func (x *TemplateButton) Reset() { *x = TemplateButton{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[94] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[101] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12344,7 +13412,7 @@ func (x *TemplateButton) String() string { func (*TemplateButton) ProtoMessage() {} func (x *TemplateButton) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[94] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[101] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12357,7 +13425,7 @@ func (x *TemplateButton) ProtoReflect() protoreflect.Message { // Deprecated: Use TemplateButton.ProtoReflect.Descriptor instead. func (*TemplateButton) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{94} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{101} } func (m *TemplateButton) GetButton() isTemplateButton_Button { @@ -12430,7 +13498,7 @@ type Money struct { func (x *Money) Reset() { *x = Money{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[95] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[102] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12443,7 +13511,7 @@ func (x *Money) String() string { func (*Money) ProtoMessage() {} func (x *Money) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[95] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[102] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12456,7 +13524,7 @@ func (x *Money) ProtoReflect() protoreflect.Message { // Deprecated: Use Money.ProtoReflect.Descriptor instead. func (*Money) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{95} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{102} } func (x *Money) GetValue() int64 { @@ -12492,7 +13560,7 @@ type ActionLink struct { func (x *ActionLink) Reset() { *x = ActionLink{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[96] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[103] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12505,7 +13573,7 @@ func (x *ActionLink) String() string { func (*ActionLink) ProtoMessage() {} func (x *ActionLink) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[96] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[103] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12518,7 +13586,7 @@ func (x *ActionLink) ProtoReflect() protoreflect.Message { // Deprecated: Use ActionLink.ProtoReflect.Descriptor instead. func (*ActionLink) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{96} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{103} } func (x *ActionLink) GetURL() string { @@ -12547,7 +13615,7 @@ type GroupMention struct { func (x *GroupMention) Reset() { *x = GroupMention{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[97] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[104] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12560,7 +13628,7 @@ func (x *GroupMention) String() string { func (*GroupMention) ProtoMessage() {} func (x *GroupMention) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[97] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[104] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12573,7 +13641,7 @@ func (x *GroupMention) ProtoReflect() protoreflect.Message { // Deprecated: Use GroupMention.ProtoReflect.Descriptor instead. func (*GroupMention) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{97} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{104} } func (x *GroupMention) GetGroupJID() string { @@ -12603,7 +13671,7 @@ type MessageSecretMessage struct { func (x *MessageSecretMessage) Reset() { *x = MessageSecretMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[98] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[105] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12616,7 +13684,7 @@ func (x *MessageSecretMessage) String() string { func (*MessageSecretMessage) ProtoMessage() {} func (x *MessageSecretMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[98] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[105] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12629,7 +13697,7 @@ func (x *MessageSecretMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use MessageSecretMessage.ProtoReflect.Descriptor instead. func (*MessageSecretMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{98} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{105} } func (x *MessageSecretMessage) GetVersion() int32 { @@ -12666,7 +13734,7 @@ type MediaNotifyMessage struct { func (x *MediaNotifyMessage) Reset() { *x = MediaNotifyMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[99] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[106] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12679,7 +13747,7 @@ func (x *MediaNotifyMessage) String() string { func (*MediaNotifyMessage) ProtoMessage() {} func (x *MediaNotifyMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[99] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[106] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12692,7 +13760,7 @@ func (x *MediaNotifyMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use MediaNotifyMessage.ProtoReflect.Descriptor instead. func (*MediaNotifyMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{99} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{106} } func (x *MediaNotifyMessage) GetExpressPathURL() string { @@ -12727,7 +13795,7 @@ type LIDMigrationMappingSyncMessage struct { func (x *LIDMigrationMappingSyncMessage) Reset() { *x = LIDMigrationMappingSyncMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[100] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[107] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12740,7 +13808,7 @@ func (x *LIDMigrationMappingSyncMessage) String() string { func (*LIDMigrationMappingSyncMessage) ProtoMessage() {} func (x *LIDMigrationMappingSyncMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[100] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[107] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12753,7 +13821,7 @@ func (x *LIDMigrationMappingSyncMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use LIDMigrationMappingSyncMessage.ProtoReflect.Descriptor instead. func (*LIDMigrationMappingSyncMessage) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{100} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{107} } func (x *LIDMigrationMappingSyncMessage) GetEncodedMappingPayload() []byte { @@ -12775,7 +13843,7 @@ type CallLogMessage_CallParticipant struct { func (x *CallLogMessage_CallParticipant) Reset() { *x = CallLogMessage_CallParticipant{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[101] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[108] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12788,7 +13856,7 @@ func (x *CallLogMessage_CallParticipant) String() string { func (*CallLogMessage_CallParticipant) ProtoMessage() {} func (x *CallLogMessage_CallParticipant) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[101] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[108] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12832,7 +13900,7 @@ type ButtonsMessage_Button struct { func (x *ButtonsMessage_Button) Reset() { *x = ButtonsMessage_Button{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[102] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[109] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12845,7 +13913,7 @@ func (x *ButtonsMessage_Button) String() string { func (*ButtonsMessage_Button) ProtoMessage() {} func (x *ButtonsMessage_Button) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[102] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[109] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12901,7 +13969,7 @@ type ButtonsMessage_Button_NativeFlowInfo struct { func (x *ButtonsMessage_Button_NativeFlowInfo) Reset() { *x = ButtonsMessage_Button_NativeFlowInfo{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[103] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[110] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12914,7 +13982,7 @@ func (x *ButtonsMessage_Button_NativeFlowInfo) String() string { func (*ButtonsMessage_Button_NativeFlowInfo) ProtoMessage() {} func (x *ButtonsMessage_Button_NativeFlowInfo) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[103] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[110] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12955,7 +14023,7 @@ type ButtonsMessage_Button_ButtonText struct { func (x *ButtonsMessage_Button_ButtonText) Reset() { *x = ButtonsMessage_Button_ButtonText{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[104] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[111] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12968,7 +14036,7 @@ func (x *ButtonsMessage_Button_ButtonText) String() string { func (*ButtonsMessage_Button_ButtonText) ProtoMessage() {} func (x *ButtonsMessage_Button_ButtonText) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[104] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[111] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13003,7 +14071,7 @@ type InteractiveResponseMessage_Body struct { func (x *InteractiveResponseMessage_Body) Reset() { *x = InteractiveResponseMessage_Body{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[105] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[112] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13016,7 +14084,7 @@ func (x *InteractiveResponseMessage_Body) String() string { func (*InteractiveResponseMessage_Body) ProtoMessage() {} func (x *InteractiveResponseMessage_Body) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[105] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[112] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13059,7 +14127,7 @@ type InteractiveResponseMessage_NativeFlowResponseMessage struct { func (x *InteractiveResponseMessage_NativeFlowResponseMessage) Reset() { *x = InteractiveResponseMessage_NativeFlowResponseMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[106] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[113] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13072,7 +14140,7 @@ func (x *InteractiveResponseMessage_NativeFlowResponseMessage) String() string { func (*InteractiveResponseMessage_NativeFlowResponseMessage) ProtoMessage() {} func (x *InteractiveResponseMessage_NativeFlowResponseMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[106] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[113] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13122,7 +14190,7 @@ type InteractiveMessage_ShopMessage struct { func (x *InteractiveMessage_ShopMessage) Reset() { *x = InteractiveMessage_ShopMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[107] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[114] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13135,7 +14203,7 @@ func (x *InteractiveMessage_ShopMessage) String() string { func (*InteractiveMessage_ShopMessage) ProtoMessage() {} func (x *InteractiveMessage_ShopMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[107] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[114] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13184,7 +14252,7 @@ type InteractiveMessage_CarouselMessage struct { func (x *InteractiveMessage_CarouselMessage) Reset() { *x = InteractiveMessage_CarouselMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[108] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[115] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13197,7 +14265,7 @@ func (x *InteractiveMessage_CarouselMessage) String() string { func (*InteractiveMessage_CarouselMessage) ProtoMessage() {} func (x *InteractiveMessage_CarouselMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[108] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[115] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13240,7 +14308,7 @@ type InteractiveMessage_NativeFlowMessage struct { func (x *InteractiveMessage_NativeFlowMessage) Reset() { *x = InteractiveMessage_NativeFlowMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[109] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[116] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13253,7 +14321,7 @@ func (x *InteractiveMessage_NativeFlowMessage) String() string { func (*InteractiveMessage_NativeFlowMessage) ProtoMessage() {} func (x *InteractiveMessage_NativeFlowMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[109] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[116] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13303,7 +14371,7 @@ type InteractiveMessage_CollectionMessage struct { func (x *InteractiveMessage_CollectionMessage) Reset() { *x = InteractiveMessage_CollectionMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[110] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[117] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13316,7 +14384,7 @@ func (x *InteractiveMessage_CollectionMessage) String() string { func (*InteractiveMessage_CollectionMessage) ProtoMessage() {} func (x *InteractiveMessage_CollectionMessage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[110] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[117] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13364,7 +14432,7 @@ type InteractiveMessage_Footer struct { func (x *InteractiveMessage_Footer) Reset() { *x = InteractiveMessage_Footer{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[111] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[118] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13377,7 +14445,7 @@ func (x *InteractiveMessage_Footer) String() string { func (*InteractiveMessage_Footer) ProtoMessage() {} func (x *InteractiveMessage_Footer) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[111] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[118] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13411,7 +14479,7 @@ type InteractiveMessage_Body struct { func (x *InteractiveMessage_Body) Reset() { *x = InteractiveMessage_Body{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[112] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[119] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13424,7 +14492,7 @@ func (x *InteractiveMessage_Body) String() string { func (*InteractiveMessage_Body) ProtoMessage() {} func (x *InteractiveMessage_Body) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[112] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[119] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13469,7 +14537,7 @@ type InteractiveMessage_Header struct { func (x *InteractiveMessage_Header) Reset() { *x = InteractiveMessage_Header{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[113] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[120] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13482,7 +14550,7 @@ func (x *InteractiveMessage_Header) String() string { func (*InteractiveMessage_Header) ProtoMessage() {} func (x *InteractiveMessage_Header) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[113] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[120] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13620,7 +14688,7 @@ type InteractiveMessage_NativeFlowMessage_NativeFlowButton struct { func (x *InteractiveMessage_NativeFlowMessage_NativeFlowButton) Reset() { *x = InteractiveMessage_NativeFlowMessage_NativeFlowButton{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[114] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[121] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13633,7 +14701,7 @@ func (x *InteractiveMessage_NativeFlowMessage_NativeFlowButton) String() string func (*InteractiveMessage_NativeFlowMessage_NativeFlowButton) ProtoMessage() {} func (x *InteractiveMessage_NativeFlowMessage_NativeFlowButton) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[114] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[121] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13674,7 +14742,7 @@ type ListResponseMessage_SingleSelectReply struct { func (x *ListResponseMessage_SingleSelectReply) Reset() { *x = ListResponseMessage_SingleSelectReply{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[115] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[122] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13687,7 +14755,7 @@ func (x *ListResponseMessage_SingleSelectReply) String() string { func (*ListResponseMessage_SingleSelectReply) ProtoMessage() {} func (x *ListResponseMessage_SingleSelectReply) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[115] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[122] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13723,7 +14791,7 @@ type ListMessage_ProductListInfo struct { func (x *ListMessage_ProductListInfo) Reset() { *x = ListMessage_ProductListInfo{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[116] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[123] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13736,7 +14804,7 @@ func (x *ListMessage_ProductListInfo) String() string { func (*ListMessage_ProductListInfo) ProtoMessage() {} func (x *ListMessage_ProductListInfo) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[116] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[123] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13785,7 +14853,7 @@ type ListMessage_ProductListHeaderImage struct { func (x *ListMessage_ProductListHeaderImage) Reset() { *x = ListMessage_ProductListHeaderImage{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[117] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[124] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13798,7 +14866,7 @@ func (x *ListMessage_ProductListHeaderImage) String() string { func (*ListMessage_ProductListHeaderImage) ProtoMessage() {} func (x *ListMessage_ProductListHeaderImage) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[117] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[124] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13840,7 +14908,7 @@ type ListMessage_ProductSection struct { func (x *ListMessage_ProductSection) Reset() { *x = ListMessage_ProductSection{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[118] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[125] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13853,7 +14921,7 @@ func (x *ListMessage_ProductSection) String() string { func (*ListMessage_ProductSection) ProtoMessage() {} func (x *ListMessage_ProductSection) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[118] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[125] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13894,7 +14962,7 @@ type ListMessage_Product struct { func (x *ListMessage_Product) Reset() { *x = ListMessage_Product{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[119] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[126] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13907,7 +14975,7 @@ func (x *ListMessage_Product) String() string { func (*ListMessage_Product) ProtoMessage() {} func (x *ListMessage_Product) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[119] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[126] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13942,7 +15010,7 @@ type ListMessage_Section struct { func (x *ListMessage_Section) Reset() { *x = ListMessage_Section{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[120] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[127] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13955,7 +15023,7 @@ func (x *ListMessage_Section) String() string { func (*ListMessage_Section) ProtoMessage() {} func (x *ListMessage_Section) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[120] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[127] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13998,7 +15066,7 @@ type ListMessage_Row struct { func (x *ListMessage_Row) Reset() { *x = ListMessage_Row{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[121] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[128] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14011,7 +15079,7 @@ func (x *ListMessage_Row) String() string { func (*ListMessage_Row) ProtoMessage() {} func (x *ListMessage_Row) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[121] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[128] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14064,7 +15132,7 @@ type HighlyStructuredMessage_HSMLocalizableParameter struct { func (x *HighlyStructuredMessage_HSMLocalizableParameter) Reset() { *x = HighlyStructuredMessage_HSMLocalizableParameter{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[122] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[129] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14077,7 +15145,7 @@ func (x *HighlyStructuredMessage_HSMLocalizableParameter) String() string { func (*HighlyStructuredMessage_HSMLocalizableParameter) ProtoMessage() {} func (x *HighlyStructuredMessage_HSMLocalizableParameter) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[122] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[129] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14154,7 +15222,7 @@ type HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime struct { func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) Reset() { *x = HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[123] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[130] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14167,7 +15235,7 @@ func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) String() s func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) ProtoMessage() {} func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[123] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[130] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14234,7 +15302,7 @@ type HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency struct { func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) Reset() { *x = HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[124] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[131] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14247,7 +15315,7 @@ func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) String() s func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) ProtoMessage() {} func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[124] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[131] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14294,7 +15362,7 @@ type HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComp func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) Reset() { *x = HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[125] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[132] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14308,7 +15376,7 @@ func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeCo } func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[125] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[132] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14384,7 +15452,7 @@ type HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnix func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch) Reset() { *x = HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[126] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[133] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14398,7 +15466,7 @@ func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUn } func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[126] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[133] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14421,6 +15489,453 @@ func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTime return 0 } +type PeerDataOperationRequestResponseMessage_PeerDataOperationResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MediaUploadResult *waMmsRetry.MediaRetryNotification_ResultType `protobuf:"varint,1,opt,name=mediaUploadResult,enum=WAMmsRetry.MediaRetryNotification_ResultType" json:"mediaUploadResult,omitempty"` + StickerMessage *StickerMessage `protobuf:"bytes,2,opt,name=stickerMessage" json:"stickerMessage,omitempty"` + LinkPreviewResponse *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse `protobuf:"bytes,3,opt,name=linkPreviewResponse" json:"linkPreviewResponse,omitempty"` + PlaceholderMessageResendResponse *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse `protobuf:"bytes,4,opt,name=placeholderMessageResendResponse" json:"placeholderMessageResendResponse,omitempty"` + WaffleNonceFetchRequestResponse *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse `protobuf:"bytes,5,opt,name=waffleNonceFetchRequestResponse" json:"waffleNonceFetchRequestResponse,omitempty"` + FullHistorySyncOnDemandRequestResponse *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandRequestResponse `protobuf:"bytes,6,opt,name=fullHistorySyncOnDemandRequestResponse" json:"fullHistorySyncOnDemandRequestResponse,omitempty"` +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) Reset() { + *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult{} + if protoimpl.UnsafeEnabled { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[134] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult) ProtoMessage() {} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[134] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestResponseMessage_PeerDataOperationResult.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{18, 0} +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) GetMediaUploadResult() waMmsRetry.MediaRetryNotification_ResultType { + if x != nil && x.MediaUploadResult != nil { + return *x.MediaUploadResult + } + return waMmsRetry.MediaRetryNotification_ResultType(0) +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) GetStickerMessage() *StickerMessage { + if x != nil { + return x.StickerMessage + } + return nil +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) GetLinkPreviewResponse() *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse { + if x != nil { + return x.LinkPreviewResponse + } + return nil +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) GetPlaceholderMessageResendResponse() *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse { + if x != nil { + return x.PlaceholderMessageResendResponse + } + return nil +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) GetWaffleNonceFetchRequestResponse() *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse { + if x != nil { + return x.WaffleNonceFetchRequestResponse + } + return nil +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) GetFullHistorySyncOnDemandRequestResponse() *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandRequestResponse { + if x != nil { + return x.FullHistorySyncOnDemandRequestResponse + } + return nil +} + +type PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Nonce *string `protobuf:"bytes,1,opt,name=nonce" json:"nonce,omitempty"` + WaEntFbid *string `protobuf:"bytes,2,opt,name=waEntFbid" json:"waEntFbid,omitempty"` +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse) Reset() { + *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[135] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse) ProtoMessage() { +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[135] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{18, 0, 0} +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse) GetNonce() string { + if x != nil && x.Nonce != nil { + return *x.Nonce + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse) GetWaEntFbid() string { + if x != nil && x.WaEntFbid != nil { + return *x.WaEntFbid + } + return "" +} + +type PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandRequestResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestMetadata *FullHistorySyncOnDemandRequestMetadata `protobuf:"bytes,1,opt,name=requestMetadata" json:"requestMetadata,omitempty"` + ResponseCode *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode `protobuf:"varint,2,opt,name=responseCode,enum=WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode" json:"responseCode,omitempty"` +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandRequestResponse) Reset() { + *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandRequestResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[136] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandRequestResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandRequestResponse) ProtoMessage() { +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandRequestResponse) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[136] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandRequestResponse.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandRequestResponse) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{18, 0, 1} +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandRequestResponse) GetRequestMetadata() *FullHistorySyncOnDemandRequestMetadata { + if x != nil { + return x.RequestMetadata + } + return nil +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandRequestResponse) GetResponseCode() PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode { + if x != nil && x.ResponseCode != nil { + return *x.ResponseCode + } + return PeerDataOperationRequestResponseMessage_PeerDataOperationResult_REQUEST_SUCCESS +} + +type PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WebMessageInfoBytes []byte `protobuf:"bytes,1,opt,name=webMessageInfoBytes" json:"webMessageInfoBytes,omitempty"` +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) Reset() { + *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[137] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) ProtoMessage() { +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[137] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{18, 0, 2} +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) GetWebMessageInfoBytes() []byte { + if x != nil { + return x.WebMessageInfoBytes + } + return nil +} + +type PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + URL *string `protobuf:"bytes,1,opt,name=URL" json:"URL,omitempty"` + Title *string `protobuf:"bytes,2,opt,name=title" json:"title,omitempty"` + Description *string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` + ThumbData []byte `protobuf:"bytes,4,opt,name=thumbData" json:"thumbData,omitempty"` + CanonicalURL *string `protobuf:"bytes,5,opt,name=canonicalURL" json:"canonicalURL,omitempty"` + MatchText *string `protobuf:"bytes,6,opt,name=matchText" json:"matchText,omitempty"` + PreviewType *string `protobuf:"bytes,7,opt,name=previewType" json:"previewType,omitempty"` + HqThumbnail *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail `protobuf:"bytes,8,opt,name=hqThumbnail" json:"hqThumbnail,omitempty"` +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) Reset() { + *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[138] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) ProtoMessage() { +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[138] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{18, 0, 3} +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetURL() string { + if x != nil && x.URL != nil { + return *x.URL + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetTitle() string { + if x != nil && x.Title != nil { + return *x.Title + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetDescription() string { + if x != nil && x.Description != nil { + return *x.Description + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetThumbData() []byte { + if x != nil { + return x.ThumbData + } + return nil +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetCanonicalURL() string { + if x != nil && x.CanonicalURL != nil { + return *x.CanonicalURL + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetMatchText() string { + if x != nil && x.MatchText != nil { + return *x.MatchText + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetPreviewType() string { + if x != nil && x.PreviewType != nil { + return *x.PreviewType + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetHqThumbnail() *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail { + if x != nil { + return x.HqThumbnail + } + return nil +} + +type PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DirectPath *string `protobuf:"bytes,1,opt,name=directPath" json:"directPath,omitempty"` + ThumbHash *string `protobuf:"bytes,2,opt,name=thumbHash" json:"thumbHash,omitempty"` + EncThumbHash *string `protobuf:"bytes,3,opt,name=encThumbHash" json:"encThumbHash,omitempty"` + MediaKey []byte `protobuf:"bytes,4,opt,name=mediaKey" json:"mediaKey,omitempty"` + MediaKeyTimestampMS *int64 `protobuf:"varint,5,opt,name=mediaKeyTimestampMS" json:"mediaKeyTimestampMS,omitempty"` + ThumbWidth *int32 `protobuf:"varint,6,opt,name=thumbWidth" json:"thumbWidth,omitempty"` + ThumbHeight *int32 `protobuf:"varint,7,opt,name=thumbHeight" json:"thumbHeight,omitempty"` +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) Reset() { + *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail{} + if protoimpl.UnsafeEnabled { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[139] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) ProtoMessage() { +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[139] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{18, 0, 3, 0} +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetDirectPath() string { + if x != nil && x.DirectPath != nil { + return *x.DirectPath + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetThumbHash() string { + if x != nil && x.ThumbHash != nil { + return *x.ThumbHash + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetEncThumbHash() string { + if x != nil && x.EncThumbHash != nil { + return *x.EncThumbHash + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetMediaKey() []byte { + if x != nil { + return x.MediaKey + } + return nil +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetMediaKeyTimestampMS() int64 { + if x != nil && x.MediaKeyTimestampMS != nil { + return *x.MediaKeyTimestampMS + } + return 0 +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetThumbWidth() int32 { + if x != nil && x.ThumbWidth != nil { + return *x.ThumbWidth + } + return 0 +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetThumbHeight() int32 { + if x != nil && x.ThumbHeight != nil { + return *x.ThumbHeight + } + return 0 +} + type ContextInfo_ForwardedNewsletterMessageInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -14436,7 +15951,7 @@ type ContextInfo_ForwardedNewsletterMessageInfo struct { func (x *ContextInfo_ForwardedNewsletterMessageInfo) Reset() { *x = ContextInfo_ForwardedNewsletterMessageInfo{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[127] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[140] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14449,7 +15964,7 @@ func (x *ContextInfo_ForwardedNewsletterMessageInfo) String() string { func (*ContextInfo_ForwardedNewsletterMessageInfo) ProtoMessage() {} func (x *ContextInfo_ForwardedNewsletterMessageInfo) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[127] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[140] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14462,7 +15977,7 @@ func (x *ContextInfo_ForwardedNewsletterMessageInfo) ProtoReflect() protoreflect // Deprecated: Use ContextInfo_ForwardedNewsletterMessageInfo.ProtoReflect.Descriptor instead. func (*ContextInfo_ForwardedNewsletterMessageInfo) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{27, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{28, 0} } func (x *ContextInfo_ForwardedNewsletterMessageInfo) GetNewsletterJID() string { @@ -14505,28 +16020,33 @@ type ContextInfo_ExternalAdReplyInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Title *string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"` - Body *string `protobuf:"bytes,2,opt,name=body" json:"body,omitempty"` - MediaType *ContextInfo_ExternalAdReplyInfo_MediaType `protobuf:"varint,3,opt,name=mediaType,enum=WAWebProtobufsE2E.ContextInfo_ExternalAdReplyInfo_MediaType" json:"mediaType,omitempty"` - ThumbnailURL *string `protobuf:"bytes,4,opt,name=thumbnailURL" json:"thumbnailURL,omitempty"` - MediaURL *string `protobuf:"bytes,5,opt,name=mediaURL" json:"mediaURL,omitempty"` - Thumbnail []byte `protobuf:"bytes,6,opt,name=thumbnail" json:"thumbnail,omitempty"` - SourceType *string `protobuf:"bytes,7,opt,name=sourceType" json:"sourceType,omitempty"` - SourceID *string `protobuf:"bytes,8,opt,name=sourceID" json:"sourceID,omitempty"` - SourceURL *string `protobuf:"bytes,9,opt,name=sourceURL" json:"sourceURL,omitempty"` - ContainsAutoReply *bool `protobuf:"varint,10,opt,name=containsAutoReply" json:"containsAutoReply,omitempty"` - RenderLargerThumbnail *bool `protobuf:"varint,11,opt,name=renderLargerThumbnail" json:"renderLargerThumbnail,omitempty"` - ShowAdAttribution *bool `protobuf:"varint,12,opt,name=showAdAttribution" json:"showAdAttribution,omitempty"` - CtwaClid *string `protobuf:"bytes,13,opt,name=ctwaClid" json:"ctwaClid,omitempty"` - Ref *string `protobuf:"bytes,14,opt,name=ref" json:"ref,omitempty"` - ClickToWhatsappCall *bool `protobuf:"varint,15,opt,name=clickToWhatsappCall" json:"clickToWhatsappCall,omitempty"` - AdContextPreviewDismissed *bool `protobuf:"varint,16,opt,name=adContextPreviewDismissed" json:"adContextPreviewDismissed,omitempty"` + Title *string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"` + Body *string `protobuf:"bytes,2,opt,name=body" json:"body,omitempty"` + MediaType *ContextInfo_ExternalAdReplyInfo_MediaType `protobuf:"varint,3,opt,name=mediaType,enum=WAWebProtobufsE2E.ContextInfo_ExternalAdReplyInfo_MediaType" json:"mediaType,omitempty"` + ThumbnailURL *string `protobuf:"bytes,4,opt,name=thumbnailURL" json:"thumbnailURL,omitempty"` + MediaURL *string `protobuf:"bytes,5,opt,name=mediaURL" json:"mediaURL,omitempty"` + Thumbnail []byte `protobuf:"bytes,6,opt,name=thumbnail" json:"thumbnail,omitempty"` + SourceType *string `protobuf:"bytes,7,opt,name=sourceType" json:"sourceType,omitempty"` + SourceID *string `protobuf:"bytes,8,opt,name=sourceID" json:"sourceID,omitempty"` + SourceURL *string `protobuf:"bytes,9,opt,name=sourceURL" json:"sourceURL,omitempty"` + ContainsAutoReply *bool `protobuf:"varint,10,opt,name=containsAutoReply" json:"containsAutoReply,omitempty"` + RenderLargerThumbnail *bool `protobuf:"varint,11,opt,name=renderLargerThumbnail" json:"renderLargerThumbnail,omitempty"` + ShowAdAttribution *bool `protobuf:"varint,12,opt,name=showAdAttribution" json:"showAdAttribution,omitempty"` + CtwaClid *string `protobuf:"bytes,13,opt,name=ctwaClid" json:"ctwaClid,omitempty"` + Ref *string `protobuf:"bytes,14,opt,name=ref" json:"ref,omitempty"` + ClickToWhatsappCall *bool `protobuf:"varint,15,opt,name=clickToWhatsappCall" json:"clickToWhatsappCall,omitempty"` + AdContextPreviewDismissed *bool `protobuf:"varint,16,opt,name=adContextPreviewDismissed" json:"adContextPreviewDismissed,omitempty"` + SourceApp *string `protobuf:"bytes,17,opt,name=sourceApp" json:"sourceApp,omitempty"` + AutomatedGreetingMessageShown *bool `protobuf:"varint,18,opt,name=automatedGreetingMessageShown" json:"automatedGreetingMessageShown,omitempty"` + GreetingMessageBody *string `protobuf:"bytes,19,opt,name=greetingMessageBody" json:"greetingMessageBody,omitempty"` + CtaPayload *string `protobuf:"bytes,20,opt,name=ctaPayload" json:"ctaPayload,omitempty"` + DisableNudge *bool `protobuf:"varint,21,opt,name=disableNudge" json:"disableNudge,omitempty"` } func (x *ContextInfo_ExternalAdReplyInfo) Reset() { *x = ContextInfo_ExternalAdReplyInfo{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[128] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[141] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14539,7 +16059,7 @@ func (x *ContextInfo_ExternalAdReplyInfo) String() string { func (*ContextInfo_ExternalAdReplyInfo) ProtoMessage() {} func (x *ContextInfo_ExternalAdReplyInfo) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[128] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[141] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14552,7 +16072,7 @@ func (x *ContextInfo_ExternalAdReplyInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use ContextInfo_ExternalAdReplyInfo.ProtoReflect.Descriptor instead. func (*ContextInfo_ExternalAdReplyInfo) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{27, 1} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{28, 1} } func (x *ContextInfo_ExternalAdReplyInfo) GetTitle() string { @@ -14667,6 +16187,41 @@ func (x *ContextInfo_ExternalAdReplyInfo) GetAdContextPreviewDismissed() bool { return false } +func (x *ContextInfo_ExternalAdReplyInfo) GetSourceApp() string { + if x != nil && x.SourceApp != nil { + return *x.SourceApp + } + return "" +} + +func (x *ContextInfo_ExternalAdReplyInfo) GetAutomatedGreetingMessageShown() bool { + if x != nil && x.AutomatedGreetingMessageShown != nil { + return *x.AutomatedGreetingMessageShown + } + return false +} + +func (x *ContextInfo_ExternalAdReplyInfo) GetGreetingMessageBody() string { + if x != nil && x.GreetingMessageBody != nil { + return *x.GreetingMessageBody + } + return "" +} + +func (x *ContextInfo_ExternalAdReplyInfo) GetCtaPayload() string { + if x != nil && x.CtaPayload != nil { + return *x.CtaPayload + } + return "" +} + +func (x *ContextInfo_ExternalAdReplyInfo) GetDisableNudge() bool { + if x != nil && x.DisableNudge != nil { + return *x.DisableNudge + } + return false +} + type ContextInfo_AdReplyInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -14681,7 +16236,7 @@ type ContextInfo_AdReplyInfo struct { func (x *ContextInfo_AdReplyInfo) Reset() { *x = ContextInfo_AdReplyInfo{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[129] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[142] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14694,7 +16249,7 @@ func (x *ContextInfo_AdReplyInfo) String() string { func (*ContextInfo_AdReplyInfo) ProtoMessage() {} func (x *ContextInfo_AdReplyInfo) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[129] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[142] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14707,7 +16262,7 @@ func (x *ContextInfo_AdReplyInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use ContextInfo_AdReplyInfo.ProtoReflect.Descriptor instead. func (*ContextInfo_AdReplyInfo) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{27, 2} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{28, 2} } func (x *ContextInfo_AdReplyInfo) GetAdvertiserName() string { @@ -14744,13 +16299,14 @@ type ContextInfo_FeatureEligibilities struct { unknownFields protoimpl.UnknownFields CannotBeReactedTo *bool `protobuf:"varint,1,opt,name=cannotBeReactedTo" json:"cannotBeReactedTo,omitempty"` - CanRequestFeedback *bool `protobuf:"varint,2,opt,name=canRequestFeedback" json:"canRequestFeedback,omitempty"` + CannotBeRanked *bool `protobuf:"varint,2,opt,name=cannotBeRanked" json:"cannotBeRanked,omitempty"` + CanRequestFeedback *bool `protobuf:"varint,3,opt,name=canRequestFeedback" json:"canRequestFeedback,omitempty"` } func (x *ContextInfo_FeatureEligibilities) Reset() { *x = ContextInfo_FeatureEligibilities{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[130] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[143] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14763,7 +16319,7 @@ func (x *ContextInfo_FeatureEligibilities) String() string { func (*ContextInfo_FeatureEligibilities) ProtoMessage() {} func (x *ContextInfo_FeatureEligibilities) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[130] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[143] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14776,7 +16332,7 @@ func (x *ContextInfo_FeatureEligibilities) ProtoReflect() protoreflect.Message { // Deprecated: Use ContextInfo_FeatureEligibilities.ProtoReflect.Descriptor instead. func (*ContextInfo_FeatureEligibilities) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{27, 3} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{28, 3} } func (x *ContextInfo_FeatureEligibilities) GetCannotBeReactedTo() bool { @@ -14786,6 +16342,13 @@ func (x *ContextInfo_FeatureEligibilities) GetCannotBeReactedTo() bool { return false } +func (x *ContextInfo_FeatureEligibilities) GetCannotBeRanked() bool { + if x != nil && x.CannotBeRanked != nil { + return *x.CannotBeRanked + } + return false +} + func (x *ContextInfo_FeatureEligibilities) GetCanRequestFeedback() bool { if x != nil && x.CanRequestFeedback != nil { return *x.CanRequestFeedback @@ -14798,14 +16361,15 @@ type ContextInfo_DataSharingContext struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ShowMmDisclosure *bool `protobuf:"varint,1,opt,name=showMmDisclosure" json:"showMmDisclosure,omitempty"` - EncryptedSignalTokenConsented *string `protobuf:"bytes,2,opt,name=encryptedSignalTokenConsented" json:"encryptedSignalTokenConsented,omitempty"` + ShowMmDisclosure *bool `protobuf:"varint,1,opt,name=showMmDisclosure" json:"showMmDisclosure,omitempty"` + EncryptedSignalTokenConsented *string `protobuf:"bytes,2,opt,name=encryptedSignalTokenConsented" json:"encryptedSignalTokenConsented,omitempty"` + Parameters []*ContextInfo_DataSharingContext_Parameters `protobuf:"bytes,3,rep,name=parameters" json:"parameters,omitempty"` } func (x *ContextInfo_DataSharingContext) Reset() { *x = ContextInfo_DataSharingContext{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[131] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[144] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14818,7 +16382,7 @@ func (x *ContextInfo_DataSharingContext) String() string { func (*ContextInfo_DataSharingContext) ProtoMessage() {} func (x *ContextInfo_DataSharingContext) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[131] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[144] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14831,7 +16395,7 @@ func (x *ContextInfo_DataSharingContext) ProtoReflect() protoreflect.Message { // Deprecated: Use ContextInfo_DataSharingContext.ProtoReflect.Descriptor instead. func (*ContextInfo_DataSharingContext) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{27, 4} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{28, 4} } func (x *ContextInfo_DataSharingContext) GetShowMmDisclosure() bool { @@ -14848,6 +16412,13 @@ func (x *ContextInfo_DataSharingContext) GetEncryptedSignalTokenConsented() stri return "" } +func (x *ContextInfo_DataSharingContext) GetParameters() []*ContextInfo_DataSharingContext_Parameters { + if x != nil { + return x.Parameters + } + return nil +} + type ContextInfo_UTMInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -14860,7 +16431,7 @@ type ContextInfo_UTMInfo struct { func (x *ContextInfo_UTMInfo) Reset() { *x = ContextInfo_UTMInfo{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[132] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[145] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14873,7 +16444,7 @@ func (x *ContextInfo_UTMInfo) String() string { func (*ContextInfo_UTMInfo) ProtoMessage() {} func (x *ContextInfo_UTMInfo) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[132] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[145] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14886,7 +16457,7 @@ func (x *ContextInfo_UTMInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use ContextInfo_UTMInfo.ProtoReflect.Descriptor instead. func (*ContextInfo_UTMInfo) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{27, 5} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{28, 5} } func (x *ContextInfo_UTMInfo) GetUtmSource() string { @@ -14914,7 +16485,7 @@ type ContextInfo_BusinessMessageForwardInfo struct { func (x *ContextInfo_BusinessMessageForwardInfo) Reset() { *x = ContextInfo_BusinessMessageForwardInfo{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[133] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[146] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14927,7 +16498,7 @@ func (x *ContextInfo_BusinessMessageForwardInfo) String() string { func (*ContextInfo_BusinessMessageForwardInfo) ProtoMessage() {} func (x *ContextInfo_BusinessMessageForwardInfo) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[133] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[146] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14940,7 +16511,7 @@ func (x *ContextInfo_BusinessMessageForwardInfo) ProtoReflect() protoreflect.Mes // Deprecated: Use ContextInfo_BusinessMessageForwardInfo.ProtoReflect.Descriptor instead. func (*ContextInfo_BusinessMessageForwardInfo) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{27, 6} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{28, 6} } func (x *ContextInfo_BusinessMessageForwardInfo) GetBusinessOwnerJID() string { @@ -14950,6 +16521,85 @@ func (x *ContextInfo_BusinessMessageForwardInfo) GetBusinessOwnerJID() string { return "" } +type ContextInfo_DataSharingContext_Parameters struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + StringData *string `protobuf:"bytes,2,opt,name=stringData" json:"stringData,omitempty"` + IntData *int64 `protobuf:"varint,3,opt,name=intData" json:"intData,omitempty"` + FloatData *float32 `protobuf:"fixed32,4,opt,name=floatData" json:"floatData,omitempty"` + Contents *ContextInfo_DataSharingContext_Parameters `protobuf:"bytes,5,opt,name=contents" json:"contents,omitempty"` +} + +func (x *ContextInfo_DataSharingContext_Parameters) Reset() { + *x = ContextInfo_DataSharingContext_Parameters{} + if protoimpl.UnsafeEnabled { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[147] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ContextInfo_DataSharingContext_Parameters) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ContextInfo_DataSharingContext_Parameters) ProtoMessage() {} + +func (x *ContextInfo_DataSharingContext_Parameters) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[147] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ContextInfo_DataSharingContext_Parameters.ProtoReflect.Descriptor instead. +func (*ContextInfo_DataSharingContext_Parameters) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{28, 4, 0} +} + +func (x *ContextInfo_DataSharingContext_Parameters) GetKey() string { + if x != nil && x.Key != nil { + return *x.Key + } + return "" +} + +func (x *ContextInfo_DataSharingContext_Parameters) GetStringData() string { + if x != nil && x.StringData != nil { + return *x.StringData + } + return "" +} + +func (x *ContextInfo_DataSharingContext_Parameters) GetIntData() int64 { + if x != nil && x.IntData != nil { + return *x.IntData + } + return 0 +} + +func (x *ContextInfo_DataSharingContext_Parameters) GetFloatData() float32 { + if x != nil && x.FloatData != nil { + return *x.FloatData + } + return 0 +} + +func (x *ContextInfo_DataSharingContext_Parameters) GetContents() *ContextInfo_DataSharingContext_Parameters { + if x != nil { + return x.Contents + } + return nil +} + type HydratedTemplateButton_HydratedURLButton struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -14964,7 +16614,7 @@ type HydratedTemplateButton_HydratedURLButton struct { func (x *HydratedTemplateButton_HydratedURLButton) Reset() { *x = HydratedTemplateButton_HydratedURLButton{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[134] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[148] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14977,7 +16627,7 @@ func (x *HydratedTemplateButton_HydratedURLButton) String() string { func (*HydratedTemplateButton_HydratedURLButton) ProtoMessage() {} func (x *HydratedTemplateButton_HydratedURLButton) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[134] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[148] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14990,7 +16640,7 @@ func (x *HydratedTemplateButton_HydratedURLButton) ProtoReflect() protoreflect.M // Deprecated: Use HydratedTemplateButton_HydratedURLButton.ProtoReflect.Descriptor instead. func (*HydratedTemplateButton_HydratedURLButton) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{33, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{35, 0} } func (x *HydratedTemplateButton_HydratedURLButton) GetDisplayText() string { @@ -15033,7 +16683,7 @@ type HydratedTemplateButton_HydratedCallButton struct { func (x *HydratedTemplateButton_HydratedCallButton) Reset() { *x = HydratedTemplateButton_HydratedCallButton{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[135] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[149] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15046,7 +16696,7 @@ func (x *HydratedTemplateButton_HydratedCallButton) String() string { func (*HydratedTemplateButton_HydratedCallButton) ProtoMessage() {} func (x *HydratedTemplateButton_HydratedCallButton) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[135] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[149] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15059,7 +16709,7 @@ func (x *HydratedTemplateButton_HydratedCallButton) ProtoReflect() protoreflect. // Deprecated: Use HydratedTemplateButton_HydratedCallButton.ProtoReflect.Descriptor instead. func (*HydratedTemplateButton_HydratedCallButton) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{33, 1} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{35, 1} } func (x *HydratedTemplateButton_HydratedCallButton) GetDisplayText() string { @@ -15088,7 +16738,7 @@ type HydratedTemplateButton_HydratedQuickReplyButton struct { func (x *HydratedTemplateButton_HydratedQuickReplyButton) Reset() { *x = HydratedTemplateButton_HydratedQuickReplyButton{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[136] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[150] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15101,7 +16751,7 @@ func (x *HydratedTemplateButton_HydratedQuickReplyButton) String() string { func (*HydratedTemplateButton_HydratedQuickReplyButton) ProtoMessage() {} func (x *HydratedTemplateButton_HydratedQuickReplyButton) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[136] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[150] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15114,7 +16764,7 @@ func (x *HydratedTemplateButton_HydratedQuickReplyButton) ProtoReflect() protore // Deprecated: Use HydratedTemplateButton_HydratedQuickReplyButton.ProtoReflect.Descriptor instead. func (*HydratedTemplateButton_HydratedQuickReplyButton) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{33, 2} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{35, 2} } func (x *HydratedTemplateButton_HydratedQuickReplyButton) GetDisplayText() string { @@ -15146,7 +16796,7 @@ type PaymentBackground_MediaData struct { func (x *PaymentBackground_MediaData) Reset() { *x = PaymentBackground_MediaData{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[137] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[151] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15159,7 +16809,7 @@ func (x *PaymentBackground_MediaData) String() string { func (*PaymentBackground_MediaData) ProtoMessage() {} func (x *PaymentBackground_MediaData) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[137] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[151] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15172,7 +16822,7 @@ func (x *PaymentBackground_MediaData) ProtoReflect() protoreflect.Message { // Deprecated: Use PaymentBackground_MediaData.ProtoReflect.Descriptor instead. func (*PaymentBackground_MediaData) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{34, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{36, 0} } func (x *PaymentBackground_MediaData) GetMediaKey() []byte { @@ -15210,6 +16860,93 @@ func (x *PaymentBackground_MediaData) GetDirectPath() string { return "" } +type StickerPackMessage_Sticker struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FileName *string `protobuf:"bytes,1,opt,name=fileName" json:"fileName,omitempty"` + IsAnimated *bool `protobuf:"varint,2,opt,name=isAnimated" json:"isAnimated,omitempty"` + Emojis []string `protobuf:"bytes,3,rep,name=emojis" json:"emojis,omitempty"` + AccessibilityLabel *string `protobuf:"bytes,4,opt,name=accessibilityLabel" json:"accessibilityLabel,omitempty"` + IsLottie *bool `protobuf:"varint,5,opt,name=isLottie" json:"isLottie,omitempty"` + Mimetype *string `protobuf:"bytes,6,opt,name=mimetype" json:"mimetype,omitempty"` +} + +func (x *StickerPackMessage_Sticker) Reset() { + *x = StickerPackMessage_Sticker{} + if protoimpl.UnsafeEnabled { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[152] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StickerPackMessage_Sticker) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StickerPackMessage_Sticker) ProtoMessage() {} + +func (x *StickerPackMessage_Sticker) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[152] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StickerPackMessage_Sticker.ProtoReflect.Descriptor instead. +func (*StickerPackMessage_Sticker) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{40, 0} +} + +func (x *StickerPackMessage_Sticker) GetFileName() string { + if x != nil && x.FileName != nil { + return *x.FileName + } + return "" +} + +func (x *StickerPackMessage_Sticker) GetIsAnimated() bool { + if x != nil && x.IsAnimated != nil { + return *x.IsAnimated + } + return false +} + +func (x *StickerPackMessage_Sticker) GetEmojis() []string { + if x != nil { + return x.Emojis + } + return nil +} + +func (x *StickerPackMessage_Sticker) GetAccessibilityLabel() string { + if x != nil && x.AccessibilityLabel != nil { + return *x.AccessibilityLabel + } + return "" +} + +func (x *StickerPackMessage_Sticker) GetIsLottie() bool { + if x != nil && x.IsLottie != nil { + return *x.IsLottie + } + return false +} + +func (x *StickerPackMessage_Sticker) GetMimetype() string { + if x != nil && x.Mimetype != nil { + return *x.Mimetype + } + return "" +} + type PollResultSnapshotMessage_PollVote struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -15222,7 +16959,7 @@ type PollResultSnapshotMessage_PollVote struct { func (x *PollResultSnapshotMessage_PollVote) Reset() { *x = PollResultSnapshotMessage_PollVote{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[138] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[153] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15235,7 +16972,7 @@ func (x *PollResultSnapshotMessage_PollVote) String() string { func (*PollResultSnapshotMessage_PollVote) ProtoMessage() {} func (x *PollResultSnapshotMessage_PollVote) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[138] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[153] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15248,7 +16985,7 @@ func (x *PollResultSnapshotMessage_PollVote) ProtoReflect() protoreflect.Message // Deprecated: Use PollResultSnapshotMessage_PollVote.ProtoReflect.Descriptor instead. func (*PollResultSnapshotMessage_PollVote) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{46, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{49, 0} } func (x *PollResultSnapshotMessage_PollVote) GetOptionName() string { @@ -15276,7 +17013,7 @@ type PollCreationMessage_Option struct { func (x *PollCreationMessage_Option) Reset() { *x = PollCreationMessage_Option{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[139] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[154] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15289,7 +17026,7 @@ func (x *PollCreationMessage_Option) String() string { func (*PollCreationMessage_Option) ProtoMessage() {} func (x *PollCreationMessage_Option) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[139] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[154] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15302,7 +17039,7 @@ func (x *PollCreationMessage_Option) ProtoReflect() protoreflect.Message { // Deprecated: Use PollCreationMessage_Option.ProtoReflect.Descriptor instead. func (*PollCreationMessage_Option) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{51, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{54, 0} } func (x *PollCreationMessage_Option) GetOptionName() string { @@ -15333,7 +17070,7 @@ type ProductMessage_ProductSnapshot struct { func (x *ProductMessage_ProductSnapshot) Reset() { *x = ProductMessage_ProductSnapshot{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[140] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[155] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15346,7 +17083,7 @@ func (x *ProductMessage_ProductSnapshot) String() string { func (*ProductMessage_ProductSnapshot) ProtoMessage() {} func (x *ProductMessage_ProductSnapshot) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[140] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[155] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15359,7 +17096,7 @@ func (x *ProductMessage_ProductSnapshot) ProtoReflect() protoreflect.Message { // Deprecated: Use ProductMessage_ProductSnapshot.ProtoReflect.Descriptor instead. func (*ProductMessage_ProductSnapshot) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{58, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{61, 0} } func (x *ProductMessage_ProductSnapshot) GetProductImage() *ImageMessage { @@ -15452,7 +17189,7 @@ type ProductMessage_CatalogSnapshot struct { func (x *ProductMessage_CatalogSnapshot) Reset() { *x = ProductMessage_CatalogSnapshot{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[141] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[156] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15465,7 +17202,7 @@ func (x *ProductMessage_CatalogSnapshot) String() string { func (*ProductMessage_CatalogSnapshot) ProtoMessage() {} func (x *ProductMessage_CatalogSnapshot) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[141] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[156] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15478,7 +17215,7 @@ func (x *ProductMessage_CatalogSnapshot) ProtoReflect() protoreflect.Message { // Deprecated: Use ProductMessage_CatalogSnapshot.ProtoReflect.Descriptor instead. func (*ProductMessage_CatalogSnapshot) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{58, 1} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{61, 1} } func (x *ProductMessage_CatalogSnapshot) GetCatalogImage() *ImageMessage { @@ -15525,7 +17262,7 @@ type TemplateMessage_HydratedFourRowTemplate struct { func (x *TemplateMessage_HydratedFourRowTemplate) Reset() { *x = TemplateMessage_HydratedFourRowTemplate{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[142] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[157] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15538,7 +17275,7 @@ func (x *TemplateMessage_HydratedFourRowTemplate) String() string { func (*TemplateMessage_HydratedFourRowTemplate) ProtoMessage() {} func (x *TemplateMessage_HydratedFourRowTemplate) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[142] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[157] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15551,7 +17288,7 @@ func (x *TemplateMessage_HydratedFourRowTemplate) ProtoReflect() protoreflect.Me // Deprecated: Use TemplateMessage_HydratedFourRowTemplate.ProtoReflect.Descriptor instead. func (*TemplateMessage_HydratedFourRowTemplate) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{60, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{63, 0} } func (m *TemplateMessage_HydratedFourRowTemplate) GetTitle() isTemplateMessage_HydratedFourRowTemplate_Title { @@ -15691,7 +17428,7 @@ type TemplateMessage_FourRowTemplate struct { func (x *TemplateMessage_FourRowTemplate) Reset() { *x = TemplateMessage_FourRowTemplate{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[143] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[158] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15704,7 +17441,7 @@ func (x *TemplateMessage_FourRowTemplate) String() string { func (*TemplateMessage_FourRowTemplate) ProtoMessage() {} func (x *TemplateMessage_FourRowTemplate) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[143] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[158] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15717,7 +17454,7 @@ func (x *TemplateMessage_FourRowTemplate) ProtoReflect() protoreflect.Message { // Deprecated: Use TemplateMessage_FourRowTemplate.ProtoReflect.Descriptor instead. func (*TemplateMessage_FourRowTemplate) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{60, 1} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{63, 1} } func (m *TemplateMessage_FourRowTemplate) GetTitle() isTemplateMessage_FourRowTemplate_Title { @@ -15818,389 +17555,6 @@ func (*TemplateMessage_FourRowTemplate_VideoMessage) isTemplateMessage_FourRowTe func (*TemplateMessage_FourRowTemplate_LocationMessage) isTemplateMessage_FourRowTemplate_Title() {} -type PeerDataOperationRequestResponseMessage_PeerDataOperationResult struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MediaUploadResult *waMmsRetry.MediaRetryNotification_ResultType `protobuf:"varint,1,opt,name=mediaUploadResult,enum=WAMmsRetry.MediaRetryNotification_ResultType" json:"mediaUploadResult,omitempty"` - StickerMessage *StickerMessage `protobuf:"bytes,2,opt,name=stickerMessage" json:"stickerMessage,omitempty"` - LinkPreviewResponse *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse `protobuf:"bytes,3,opt,name=linkPreviewResponse" json:"linkPreviewResponse,omitempty"` - PlaceholderMessageResendResponse *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse `protobuf:"bytes,4,opt,name=placeholderMessageResendResponse" json:"placeholderMessageResendResponse,omitempty"` - WaffleNonceFetchRequestResponse *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse `protobuf:"bytes,5,opt,name=waffleNonceFetchRequestResponse" json:"waffleNonceFetchRequestResponse,omitempty"` -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) Reset() { - *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult{} - if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[144] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult) ProtoMessage() {} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[144] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PeerDataOperationRequestResponseMessage_PeerDataOperationResult.ProtoReflect.Descriptor instead. -func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{69, 0} -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) GetMediaUploadResult() waMmsRetry.MediaRetryNotification_ResultType { - if x != nil && x.MediaUploadResult != nil { - return *x.MediaUploadResult - } - return waMmsRetry.MediaRetryNotification_ResultType(0) -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) GetStickerMessage() *StickerMessage { - if x != nil { - return x.StickerMessage - } - return nil -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) GetLinkPreviewResponse() *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse { - if x != nil { - return x.LinkPreviewResponse - } - return nil -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) GetPlaceholderMessageResendResponse() *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse { - if x != nil { - return x.PlaceholderMessageResendResponse - } - return nil -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) GetWaffleNonceFetchRequestResponse() *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse { - if x != nil { - return x.WaffleNonceFetchRequestResponse - } - return nil -} - -type PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Nonce *string `protobuf:"bytes,1,opt,name=nonce" json:"nonce,omitempty"` - WaEntFbid *string `protobuf:"bytes,2,opt,name=waEntFbid" json:"waEntFbid,omitempty"` -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse) Reset() { - *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[145] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse) ProtoMessage() { -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[145] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse.ProtoReflect.Descriptor instead. -func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{69, 0, 0} -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse) GetNonce() string { - if x != nil && x.Nonce != nil { - return *x.Nonce - } - return "" -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse) GetWaEntFbid() string { - if x != nil && x.WaEntFbid != nil { - return *x.WaEntFbid - } - return "" -} - -type PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - WebMessageInfoBytes []byte `protobuf:"bytes,1,opt,name=webMessageInfoBytes" json:"webMessageInfoBytes,omitempty"` -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) Reset() { - *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[146] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) ProtoMessage() { -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[146] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse.ProtoReflect.Descriptor instead. -func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{69, 0, 1} -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) GetWebMessageInfoBytes() []byte { - if x != nil { - return x.WebMessageInfoBytes - } - return nil -} - -type PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - URL *string `protobuf:"bytes,1,opt,name=URL" json:"URL,omitempty"` - Title *string `protobuf:"bytes,2,opt,name=title" json:"title,omitempty"` - Description *string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` - ThumbData []byte `protobuf:"bytes,4,opt,name=thumbData" json:"thumbData,omitempty"` - CanonicalURL *string `protobuf:"bytes,5,opt,name=canonicalURL" json:"canonicalURL,omitempty"` - MatchText *string `protobuf:"bytes,6,opt,name=matchText" json:"matchText,omitempty"` - PreviewType *string `protobuf:"bytes,7,opt,name=previewType" json:"previewType,omitempty"` - HqThumbnail *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail `protobuf:"bytes,8,opt,name=hqThumbnail" json:"hqThumbnail,omitempty"` -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) Reset() { - *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[147] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) ProtoMessage() { -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[147] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse.ProtoReflect.Descriptor instead. -func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{69, 0, 2} -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetURL() string { - if x != nil && x.URL != nil { - return *x.URL - } - return "" -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetTitle() string { - if x != nil && x.Title != nil { - return *x.Title - } - return "" -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetDescription() string { - if x != nil && x.Description != nil { - return *x.Description - } - return "" -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetThumbData() []byte { - if x != nil { - return x.ThumbData - } - return nil -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetCanonicalURL() string { - if x != nil && x.CanonicalURL != nil { - return *x.CanonicalURL - } - return "" -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetMatchText() string { - if x != nil && x.MatchText != nil { - return *x.MatchText - } - return "" -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetPreviewType() string { - if x != nil && x.PreviewType != nil { - return *x.PreviewType - } - return "" -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetHqThumbnail() *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail { - if x != nil { - return x.HqThumbnail - } - return nil -} - -type PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - DirectPath *string `protobuf:"bytes,1,opt,name=directPath" json:"directPath,omitempty"` - ThumbHash *string `protobuf:"bytes,2,opt,name=thumbHash" json:"thumbHash,omitempty"` - EncThumbHash *string `protobuf:"bytes,3,opt,name=encThumbHash" json:"encThumbHash,omitempty"` - MediaKey []byte `protobuf:"bytes,4,opt,name=mediaKey" json:"mediaKey,omitempty"` - MediaKeyTimestampMS *int64 `protobuf:"varint,5,opt,name=mediaKeyTimestampMS" json:"mediaKeyTimestampMS,omitempty"` - ThumbWidth *int32 `protobuf:"varint,6,opt,name=thumbWidth" json:"thumbWidth,omitempty"` - ThumbHeight *int32 `protobuf:"varint,7,opt,name=thumbHeight" json:"thumbHeight,omitempty"` -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) Reset() { - *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail{} - if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[148] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) ProtoMessage() { -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[148] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail.ProtoReflect.Descriptor instead. -func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{69, 0, 2, 0} -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetDirectPath() string { - if x != nil && x.DirectPath != nil { - return *x.DirectPath - } - return "" -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetThumbHash() string { - if x != nil && x.ThumbHash != nil { - return *x.ThumbHash - } - return "" -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetEncThumbHash() string { - if x != nil && x.EncThumbHash != nil { - return *x.EncThumbHash - } - return "" -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetMediaKey() []byte { - if x != nil { - return x.MediaKey - } - return nil -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetMediaKeyTimestampMS() int64 { - if x != nil && x.MediaKeyTimestampMS != nil { - return *x.MediaKeyTimestampMS - } - return 0 -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetThumbWidth() int32 { - if x != nil && x.ThumbWidth != nil { - return *x.ThumbWidth - } - return 0 -} - -func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetThumbHeight() int32 { - if x != nil && x.ThumbHeight != nil { - return *x.ThumbHeight - } - return 0 -} - type PeerDataOperationRequestMessage_PlaceholderMessageResendRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -16212,7 +17566,7 @@ type PeerDataOperationRequestMessage_PlaceholderMessageResendRequest struct { func (x *PeerDataOperationRequestMessage_PlaceholderMessageResendRequest) Reset() { *x = PeerDataOperationRequestMessage_PlaceholderMessageResendRequest{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[149] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[159] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16225,7 +17579,7 @@ func (x *PeerDataOperationRequestMessage_PlaceholderMessageResendRequest) String func (*PeerDataOperationRequestMessage_PlaceholderMessageResendRequest) ProtoMessage() {} func (x *PeerDataOperationRequestMessage_PlaceholderMessageResendRequest) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[149] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[159] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16238,7 +17592,7 @@ func (x *PeerDataOperationRequestMessage_PlaceholderMessageResendRequest) ProtoR // Deprecated: Use PeerDataOperationRequestMessage_PlaceholderMessageResendRequest.ProtoReflect.Descriptor instead. func (*PeerDataOperationRequestMessage_PlaceholderMessageResendRequest) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{70, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{72, 0} } func (x *PeerDataOperationRequestMessage_PlaceholderMessageResendRequest) GetMessageKey() *waCommon.MessageKey { @@ -16248,6 +17602,61 @@ func (x *PeerDataOperationRequestMessage_PlaceholderMessageResendRequest) GetMes return nil } +type PeerDataOperationRequestMessage_FullHistorySyncOnDemandRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestMetadata *FullHistorySyncOnDemandRequestMetadata `protobuf:"bytes,1,opt,name=requestMetadata" json:"requestMetadata,omitempty"` + HistorySyncConfig *waCompanionReg.DeviceProps_HistorySyncConfig `protobuf:"bytes,2,opt,name=historySyncConfig" json:"historySyncConfig,omitempty"` +} + +func (x *PeerDataOperationRequestMessage_FullHistorySyncOnDemandRequest) Reset() { + *x = PeerDataOperationRequestMessage_FullHistorySyncOnDemandRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[160] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestMessage_FullHistorySyncOnDemandRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestMessage_FullHistorySyncOnDemandRequest) ProtoMessage() {} + +func (x *PeerDataOperationRequestMessage_FullHistorySyncOnDemandRequest) ProtoReflect() protoreflect.Message { + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[160] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestMessage_FullHistorySyncOnDemandRequest.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestMessage_FullHistorySyncOnDemandRequest) Descriptor() ([]byte, []int) { + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{72, 1} +} + +func (x *PeerDataOperationRequestMessage_FullHistorySyncOnDemandRequest) GetRequestMetadata() *FullHistorySyncOnDemandRequestMetadata { + if x != nil { + return x.RequestMetadata + } + return nil +} + +func (x *PeerDataOperationRequestMessage_FullHistorySyncOnDemandRequest) GetHistorySyncConfig() *waCompanionReg.DeviceProps_HistorySyncConfig { + if x != nil { + return x.HistorySyncConfig + } + return nil +} + type PeerDataOperationRequestMessage_HistorySyncOnDemandRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -16263,7 +17672,7 @@ type PeerDataOperationRequestMessage_HistorySyncOnDemandRequest struct { func (x *PeerDataOperationRequestMessage_HistorySyncOnDemandRequest) Reset() { *x = PeerDataOperationRequestMessage_HistorySyncOnDemandRequest{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[150] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[161] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16276,7 +17685,7 @@ func (x *PeerDataOperationRequestMessage_HistorySyncOnDemandRequest) String() st func (*PeerDataOperationRequestMessage_HistorySyncOnDemandRequest) ProtoMessage() {} func (x *PeerDataOperationRequestMessage_HistorySyncOnDemandRequest) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[150] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[161] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16289,7 +17698,7 @@ func (x *PeerDataOperationRequestMessage_HistorySyncOnDemandRequest) ProtoReflec // Deprecated: Use PeerDataOperationRequestMessage_HistorySyncOnDemandRequest.ProtoReflect.Descriptor instead. func (*PeerDataOperationRequestMessage_HistorySyncOnDemandRequest) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{70, 1} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{72, 2} } func (x *PeerDataOperationRequestMessage_HistorySyncOnDemandRequest) GetChatJID() string { @@ -16339,7 +17748,7 @@ type PeerDataOperationRequestMessage_RequestUrlPreview struct { func (x *PeerDataOperationRequestMessage_RequestUrlPreview) Reset() { *x = PeerDataOperationRequestMessage_RequestUrlPreview{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[151] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[162] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16352,7 +17761,7 @@ func (x *PeerDataOperationRequestMessage_RequestUrlPreview) String() string { func (*PeerDataOperationRequestMessage_RequestUrlPreview) ProtoMessage() {} func (x *PeerDataOperationRequestMessage_RequestUrlPreview) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[151] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[162] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16365,7 +17774,7 @@ func (x *PeerDataOperationRequestMessage_RequestUrlPreview) ProtoReflect() proto // Deprecated: Use PeerDataOperationRequestMessage_RequestUrlPreview.ProtoReflect.Descriptor instead. func (*PeerDataOperationRequestMessage_RequestUrlPreview) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{70, 2} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{72, 3} } func (x *PeerDataOperationRequestMessage_RequestUrlPreview) GetURL() string { @@ -16393,7 +17802,7 @@ type PeerDataOperationRequestMessage_RequestStickerReupload struct { func (x *PeerDataOperationRequestMessage_RequestStickerReupload) Reset() { *x = PeerDataOperationRequestMessage_RequestStickerReupload{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[152] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[163] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16406,7 +17815,7 @@ func (x *PeerDataOperationRequestMessage_RequestStickerReupload) String() string func (*PeerDataOperationRequestMessage_RequestStickerReupload) ProtoMessage() {} func (x *PeerDataOperationRequestMessage_RequestStickerReupload) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[152] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[163] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16419,7 +17828,7 @@ func (x *PeerDataOperationRequestMessage_RequestStickerReupload) ProtoReflect() // Deprecated: Use PeerDataOperationRequestMessage_RequestStickerReupload.ProtoReflect.Descriptor instead. func (*PeerDataOperationRequestMessage_RequestStickerReupload) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{70, 3} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{72, 4} } func (x *PeerDataOperationRequestMessage_RequestStickerReupload) GetFileSHA256() string { @@ -16441,7 +17850,7 @@ type TemplateButton_CallButton struct { func (x *TemplateButton_CallButton) Reset() { *x = TemplateButton_CallButton{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[153] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[164] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16454,7 +17863,7 @@ func (x *TemplateButton_CallButton) String() string { func (*TemplateButton_CallButton) ProtoMessage() {} func (x *TemplateButton_CallButton) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[153] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[164] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16467,7 +17876,7 @@ func (x *TemplateButton_CallButton) ProtoReflect() protoreflect.Message { // Deprecated: Use TemplateButton_CallButton.ProtoReflect.Descriptor instead. func (*TemplateButton_CallButton) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{94, 0} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{101, 0} } func (x *TemplateButton_CallButton) GetDisplayText() *HighlyStructuredMessage { @@ -16496,7 +17905,7 @@ type TemplateButton_URLButton struct { func (x *TemplateButton_URLButton) Reset() { *x = TemplateButton_URLButton{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[154] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[165] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16509,7 +17918,7 @@ func (x *TemplateButton_URLButton) String() string { func (*TemplateButton_URLButton) ProtoMessage() {} func (x *TemplateButton_URLButton) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[154] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[165] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16522,7 +17931,7 @@ func (x *TemplateButton_URLButton) ProtoReflect() protoreflect.Message { // Deprecated: Use TemplateButton_URLButton.ProtoReflect.Descriptor instead. func (*TemplateButton_URLButton) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{94, 1} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{101, 1} } func (x *TemplateButton_URLButton) GetDisplayText() *HighlyStructuredMessage { @@ -16551,7 +17960,7 @@ type TemplateButton_QuickReplyButton struct { func (x *TemplateButton_QuickReplyButton) Reset() { *x = TemplateButton_QuickReplyButton{} if protoimpl.UnsafeEnabled { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[155] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[166] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16564,7 +17973,7 @@ func (x *TemplateButton_QuickReplyButton) String() string { func (*TemplateButton_QuickReplyButton) ProtoMessage() {} func (x *TemplateButton_QuickReplyButton) ProtoReflect() protoreflect.Message { - mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[155] + mi := &file_waE2E_WAWebProtobufsE2E_proto_msgTypes[166] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16577,7 +17986,7 @@ func (x *TemplateButton_QuickReplyButton) ProtoReflect() protoreflect.Message { // Deprecated: Use TemplateButton_QuickReplyButton.ProtoReflect.Descriptor instead. func (*TemplateButton_QuickReplyButton) Descriptor() ([]byte, []int) { - return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{94, 2} + return file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP(), []int{101, 2} } func (x *TemplateButton_QuickReplyButton) GetDisplayText() *HighlyStructuredMessage { @@ -16611,546 +18020,586 @@ func file_waE2E_WAWebProtobufsE2E_proto_rawDescGZIP() []byte { return file_waE2E_WAWebProtobufsE2E_proto_rawDescData } -var file_waE2E_WAWebProtobufsE2E_proto_enumTypes = make([]protoimpl.EnumInfo, 53) -var file_waE2E_WAWebProtobufsE2E_proto_msgTypes = make([]protoimpl.MessageInfo, 156) -var file_waE2E_WAWebProtobufsE2E_proto_goTypes = []interface{}{ +var file_waE2E_WAWebProtobufsE2E_proto_enumTypes = make([]protoimpl.EnumInfo, 57) +var file_waE2E_WAWebProtobufsE2E_proto_msgTypes = make([]protoimpl.MessageInfo, 167) +var file_waE2E_WAWebProtobufsE2E_proto_goTypes = []any{ (PeerDataOperationRequestType)(0), // 0: WAWebProtobufsE2E.PeerDataOperationRequestType - (KeepType)(0), // 1: WAWebProtobufsE2E.KeepType - (PlaceholderMessage_PlaceholderType)(0), // 2: WAWebProtobufsE2E.PlaceholderMessage.PlaceholderType - (BCallMessage_MediaType)(0), // 3: WAWebProtobufsE2E.BCallMessage.MediaType - (CallLogMessage_CallOutcome)(0), // 4: WAWebProtobufsE2E.CallLogMessage.CallOutcome - (CallLogMessage_CallType)(0), // 5: WAWebProtobufsE2E.CallLogMessage.CallType - (ScheduledCallEditMessage_EditType)(0), // 6: WAWebProtobufsE2E.ScheduledCallEditMessage.EditType - (ScheduledCallCreationMessage_CallType)(0), // 7: WAWebProtobufsE2E.ScheduledCallCreationMessage.CallType - (EventResponseMessage_EventResponseType)(0), // 8: WAWebProtobufsE2E.EventResponseMessage.EventResponseType - (PinInChatMessage_Type)(0), // 9: WAWebProtobufsE2E.PinInChatMessage.Type - (ButtonsResponseMessage_Type)(0), // 10: WAWebProtobufsE2E.ButtonsResponseMessage.Type - (ButtonsMessage_HeaderType)(0), // 11: WAWebProtobufsE2E.ButtonsMessage.HeaderType - (ButtonsMessage_Button_Type)(0), // 12: WAWebProtobufsE2E.ButtonsMessage.Button.Type - (SecretEncryptedMessage_SecretEncType)(0), // 13: WAWebProtobufsE2E.SecretEncryptedMessage.SecretEncType - (GroupInviteMessage_GroupType)(0), // 14: WAWebProtobufsE2E.GroupInviteMessage.GroupType - (InteractiveResponseMessage_Body_Format)(0), // 15: WAWebProtobufsE2E.InteractiveResponseMessage.Body.Format - (InteractiveMessage_ShopMessage_Surface)(0), // 16: WAWebProtobufsE2E.InteractiveMessage.ShopMessage.Surface - (ListResponseMessage_ListType)(0), // 17: WAWebProtobufsE2E.ListResponseMessage.ListType - (ListMessage_ListType)(0), // 18: WAWebProtobufsE2E.ListMessage.ListType - (OrderMessage_OrderSurface)(0), // 19: WAWebProtobufsE2E.OrderMessage.OrderSurface - (OrderMessage_OrderStatus)(0), // 20: WAWebProtobufsE2E.OrderMessage.OrderStatus - (PaymentInviteMessage_ServiceType)(0), // 21: WAWebProtobufsE2E.PaymentInviteMessage.ServiceType - (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType)(0), // 22: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.CalendarType - (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType)(0), // 23: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.DayOfWeekType - (HistorySyncNotification_HistorySyncType)(0), // 24: WAWebProtobufsE2E.HistorySyncNotification.HistorySyncType - (RequestWelcomeMessageMetadata_LocalChatState)(0), // 25: WAWebProtobufsE2E.RequestWelcomeMessageMetadata.LocalChatState - (ProtocolMessage_Type)(0), // 26: WAWebProtobufsE2E.ProtocolMessage.Type - (CloudAPIThreadControlNotification_CloudAPIThreadControl)(0), // 27: WAWebProtobufsE2E.CloudAPIThreadControlNotification.CloudAPIThreadControl - (BotFeedbackMessage_ReportKind)(0), // 28: WAWebProtobufsE2E.BotFeedbackMessage.ReportKind - (BotFeedbackMessage_BotFeedbackKindMultiplePositive)(0), // 29: WAWebProtobufsE2E.BotFeedbackMessage.BotFeedbackKindMultiplePositive - (BotFeedbackMessage_BotFeedbackKindMultipleNegative)(0), // 30: WAWebProtobufsE2E.BotFeedbackMessage.BotFeedbackKindMultipleNegative - (BotFeedbackMessage_BotFeedbackKind)(0), // 31: WAWebProtobufsE2E.BotFeedbackMessage.BotFeedbackKind - (VideoMessage_Attribution)(0), // 32: WAWebProtobufsE2E.VideoMessage.Attribution - (ExtendedTextMessage_InviteLinkGroupType)(0), // 33: WAWebProtobufsE2E.ExtendedTextMessage.InviteLinkGroupType - (ExtendedTextMessage_PreviewType)(0), // 34: WAWebProtobufsE2E.ExtendedTextMessage.PreviewType - (ExtendedTextMessage_FontType)(0), // 35: WAWebProtobufsE2E.ExtendedTextMessage.FontType - (InvoiceMessage_AttachmentType)(0), // 36: WAWebProtobufsE2E.InvoiceMessage.AttachmentType - (ImageMessage_ImageSourceType)(0), // 37: WAWebProtobufsE2E.ImageMessage.ImageSourceType - (ContextInfo_ForwardedNewsletterMessageInfo_ContentType)(0), // 38: WAWebProtobufsE2E.ContextInfo.ForwardedNewsletterMessageInfo.ContentType - (ContextInfo_ExternalAdReplyInfo_MediaType)(0), // 39: WAWebProtobufsE2E.ContextInfo.ExternalAdReplyInfo.MediaType - (ContextInfo_AdReplyInfo_MediaType)(0), // 40: WAWebProtobufsE2E.ContextInfo.AdReplyInfo.MediaType - (BotPluginMetadata_PluginType)(0), // 41: WAWebProtobufsE2E.BotPluginMetadata.PluginType - (BotPluginMetadata_SearchProvider)(0), // 42: WAWebProtobufsE2E.BotPluginMetadata.SearchProvider - (BotSearchMetadata_SessionSource)(0), // 43: WAWebProtobufsE2E.BotSearchMetadata.SessionSource - (BotReminderMetadata_ReminderFrequency)(0), // 44: WAWebProtobufsE2E.BotReminderMetadata.ReminderFrequency - (BotReminderMetadata_ReminderAction)(0), // 45: WAWebProtobufsE2E.BotReminderMetadata.ReminderAction - (MessageAssociation_AssociationType)(0), // 46: WAWebProtobufsE2E.MessageAssociation.AssociationType - (MessageContextInfo_MessageAddonExpiryType)(0), // 47: WAWebProtobufsE2E.MessageContextInfo.MessageAddonExpiryType - (HydratedTemplateButton_HydratedURLButton_WebviewPresentationType)(0), // 48: WAWebProtobufsE2E.HydratedTemplateButton.HydratedURLButton.WebviewPresentationType - (PaymentBackground_Type)(0), // 49: WAWebProtobufsE2E.PaymentBackground.Type - (DisappearingMode_Trigger)(0), // 50: WAWebProtobufsE2E.DisappearingMode.Trigger - (DisappearingMode_Initiator)(0), // 51: WAWebProtobufsE2E.DisappearingMode.Initiator - (ProcessedVideo_VideoQuality)(0), // 52: WAWebProtobufsE2E.ProcessedVideo.VideoQuality - (*PlaceholderMessage)(nil), // 53: WAWebProtobufsE2E.PlaceholderMessage - (*BCallMessage)(nil), // 54: WAWebProtobufsE2E.BCallMessage - (*CallLogMessage)(nil), // 55: WAWebProtobufsE2E.CallLogMessage - (*ScheduledCallEditMessage)(nil), // 56: WAWebProtobufsE2E.ScheduledCallEditMessage - (*ScheduledCallCreationMessage)(nil), // 57: WAWebProtobufsE2E.ScheduledCallCreationMessage - (*EventResponseMessage)(nil), // 58: WAWebProtobufsE2E.EventResponseMessage - (*PinInChatMessage)(nil), // 59: WAWebProtobufsE2E.PinInChatMessage - (*ButtonsResponseMessage)(nil), // 60: WAWebProtobufsE2E.ButtonsResponseMessage - (*ButtonsMessage)(nil), // 61: WAWebProtobufsE2E.ButtonsMessage - (*SecretEncryptedMessage)(nil), // 62: WAWebProtobufsE2E.SecretEncryptedMessage - (*GroupInviteMessage)(nil), // 63: WAWebProtobufsE2E.GroupInviteMessage - (*InteractiveResponseMessage)(nil), // 64: WAWebProtobufsE2E.InteractiveResponseMessage - (*InteractiveMessage)(nil), // 65: WAWebProtobufsE2E.InteractiveMessage - (*ListResponseMessage)(nil), // 66: WAWebProtobufsE2E.ListResponseMessage - (*ListMessage)(nil), // 67: WAWebProtobufsE2E.ListMessage - (*OrderMessage)(nil), // 68: WAWebProtobufsE2E.OrderMessage - (*PaymentInviteMessage)(nil), // 69: WAWebProtobufsE2E.PaymentInviteMessage - (*HighlyStructuredMessage)(nil), // 70: WAWebProtobufsE2E.HighlyStructuredMessage - (*HistorySyncNotification)(nil), // 71: WAWebProtobufsE2E.HistorySyncNotification - (*RequestWelcomeMessageMetadata)(nil), // 72: WAWebProtobufsE2E.RequestWelcomeMessageMetadata - (*ProtocolMessage)(nil), // 73: WAWebProtobufsE2E.ProtocolMessage - (*CloudAPIThreadControlNotification)(nil), // 74: WAWebProtobufsE2E.CloudAPIThreadControlNotification - (*BotFeedbackMessage)(nil), // 75: WAWebProtobufsE2E.BotFeedbackMessage - (*VideoMessage)(nil), // 76: WAWebProtobufsE2E.VideoMessage - (*ExtendedTextMessage)(nil), // 77: WAWebProtobufsE2E.ExtendedTextMessage - (*InvoiceMessage)(nil), // 78: WAWebProtobufsE2E.InvoiceMessage - (*ImageMessage)(nil), // 79: WAWebProtobufsE2E.ImageMessage - (*ContextInfo)(nil), // 80: WAWebProtobufsE2E.ContextInfo - (*BotPluginMetadata)(nil), // 81: WAWebProtobufsE2E.BotPluginMetadata - (*BotSearchMetadata)(nil), // 82: WAWebProtobufsE2E.BotSearchMetadata - (*BotReminderMetadata)(nil), // 83: WAWebProtobufsE2E.BotReminderMetadata - (*MessageAssociation)(nil), // 84: WAWebProtobufsE2E.MessageAssociation - (*MessageContextInfo)(nil), // 85: WAWebProtobufsE2E.MessageContextInfo - (*HydratedTemplateButton)(nil), // 86: WAWebProtobufsE2E.HydratedTemplateButton - (*PaymentBackground)(nil), // 87: WAWebProtobufsE2E.PaymentBackground - (*DisappearingMode)(nil), // 88: WAWebProtobufsE2E.DisappearingMode - (*ProcessedVideo)(nil), // 89: WAWebProtobufsE2E.ProcessedVideo - (*Message)(nil), // 90: WAWebProtobufsE2E.Message - (*AlbumMessage)(nil), // 91: WAWebProtobufsE2E.AlbumMessage - (*MessageHistoryBundle)(nil), // 92: WAWebProtobufsE2E.MessageHistoryBundle - (*EncEventResponseMessage)(nil), // 93: WAWebProtobufsE2E.EncEventResponseMessage - (*EventMessage)(nil), // 94: WAWebProtobufsE2E.EventMessage - (*CommentMessage)(nil), // 95: WAWebProtobufsE2E.CommentMessage - (*EncCommentMessage)(nil), // 96: WAWebProtobufsE2E.EncCommentMessage - (*EncReactionMessage)(nil), // 97: WAWebProtobufsE2E.EncReactionMessage - (*KeepInChatMessage)(nil), // 98: WAWebProtobufsE2E.KeepInChatMessage - (*PollResultSnapshotMessage)(nil), // 99: WAWebProtobufsE2E.PollResultSnapshotMessage - (*PollVoteMessage)(nil), // 100: WAWebProtobufsE2E.PollVoteMessage - (*PollEncValue)(nil), // 101: WAWebProtobufsE2E.PollEncValue - (*PollUpdateMessageMetadata)(nil), // 102: WAWebProtobufsE2E.PollUpdateMessageMetadata - (*PollUpdateMessage)(nil), // 103: WAWebProtobufsE2E.PollUpdateMessage - (*PollCreationMessage)(nil), // 104: WAWebProtobufsE2E.PollCreationMessage - (*StickerSyncRMRMessage)(nil), // 105: WAWebProtobufsE2E.StickerSyncRMRMessage - (*ReactionMessage)(nil), // 106: WAWebProtobufsE2E.ReactionMessage - (*FutureProofMessage)(nil), // 107: WAWebProtobufsE2E.FutureProofMessage - (*DeviceSentMessage)(nil), // 108: WAWebProtobufsE2E.DeviceSentMessage - (*RequestPhoneNumberMessage)(nil), // 109: WAWebProtobufsE2E.RequestPhoneNumberMessage - (*NewsletterAdminInviteMessage)(nil), // 110: WAWebProtobufsE2E.NewsletterAdminInviteMessage - (*ProductMessage)(nil), // 111: WAWebProtobufsE2E.ProductMessage - (*TemplateButtonReplyMessage)(nil), // 112: WAWebProtobufsE2E.TemplateButtonReplyMessage - (*TemplateMessage)(nil), // 113: WAWebProtobufsE2E.TemplateMessage - (*StickerMessage)(nil), // 114: WAWebProtobufsE2E.StickerMessage - (*LiveLocationMessage)(nil), // 115: WAWebProtobufsE2E.LiveLocationMessage - (*CancelPaymentRequestMessage)(nil), // 116: WAWebProtobufsE2E.CancelPaymentRequestMessage - (*DeclinePaymentRequestMessage)(nil), // 117: WAWebProtobufsE2E.DeclinePaymentRequestMessage - (*RequestPaymentMessage)(nil), // 118: WAWebProtobufsE2E.RequestPaymentMessage - (*SendPaymentMessage)(nil), // 119: WAWebProtobufsE2E.SendPaymentMessage - (*ContactsArrayMessage)(nil), // 120: WAWebProtobufsE2E.ContactsArrayMessage - (*InitialSecurityNotificationSettingSync)(nil), // 121: WAWebProtobufsE2E.InitialSecurityNotificationSettingSync - (*PeerDataOperationRequestResponseMessage)(nil), // 122: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage - (*PeerDataOperationRequestMessage)(nil), // 123: WAWebProtobufsE2E.PeerDataOperationRequestMessage - (*AppStateFatalExceptionNotification)(nil), // 124: WAWebProtobufsE2E.AppStateFatalExceptionNotification - (*AppStateSyncKeyRequest)(nil), // 125: WAWebProtobufsE2E.AppStateSyncKeyRequest - (*AppStateSyncKeyShare)(nil), // 126: WAWebProtobufsE2E.AppStateSyncKeyShare - (*AppStateSyncKeyData)(nil), // 127: WAWebProtobufsE2E.AppStateSyncKeyData - (*AppStateSyncKeyFingerprint)(nil), // 128: WAWebProtobufsE2E.AppStateSyncKeyFingerprint - (*AppStateSyncKeyId)(nil), // 129: WAWebProtobufsE2E.AppStateSyncKeyId - (*AppStateSyncKey)(nil), // 130: WAWebProtobufsE2E.AppStateSyncKey - (*Chat)(nil), // 131: WAWebProtobufsE2E.Chat - (*Call)(nil), // 132: WAWebProtobufsE2E.Call - (*AudioMessage)(nil), // 133: WAWebProtobufsE2E.AudioMessage - (*DocumentMessage)(nil), // 134: WAWebProtobufsE2E.DocumentMessage - (*LocationMessage)(nil), // 135: WAWebProtobufsE2E.LocationMessage - (*ContactMessage)(nil), // 136: WAWebProtobufsE2E.ContactMessage - (*SenderKeyDistributionMessage)(nil), // 137: WAWebProtobufsE2E.SenderKeyDistributionMessage - (*BotAvatarMetadata)(nil), // 138: WAWebProtobufsE2E.BotAvatarMetadata - (*BotSuggestedPromptMetadata)(nil), // 139: WAWebProtobufsE2E.BotSuggestedPromptMetadata - (*BotMediaMetadata)(nil), // 140: WAWebProtobufsE2E.BotMediaMetadata - (*BotMemuMetadata)(nil), // 141: WAWebProtobufsE2E.BotMemuMetadata - (*BotMetadata)(nil), // 142: WAWebProtobufsE2E.BotMetadata - (*DeviceListMetadata)(nil), // 143: WAWebProtobufsE2E.DeviceListMetadata - (*InteractiveAnnotation)(nil), // 144: WAWebProtobufsE2E.InteractiveAnnotation - (*Point)(nil), // 145: WAWebProtobufsE2E.Point - (*Location)(nil), // 146: WAWebProtobufsE2E.Location - (*TemplateButton)(nil), // 147: WAWebProtobufsE2E.TemplateButton - (*Money)(nil), // 148: WAWebProtobufsE2E.Money - (*ActionLink)(nil), // 149: WAWebProtobufsE2E.ActionLink - (*GroupMention)(nil), // 150: WAWebProtobufsE2E.GroupMention - (*MessageSecretMessage)(nil), // 151: WAWebProtobufsE2E.MessageSecretMessage - (*MediaNotifyMessage)(nil), // 152: WAWebProtobufsE2E.MediaNotifyMessage - (*LIDMigrationMappingSyncMessage)(nil), // 153: WAWebProtobufsE2E.LIDMigrationMappingSyncMessage - (*CallLogMessage_CallParticipant)(nil), // 154: WAWebProtobufsE2E.CallLogMessage.CallParticipant - (*ButtonsMessage_Button)(nil), // 155: WAWebProtobufsE2E.ButtonsMessage.Button - (*ButtonsMessage_Button_NativeFlowInfo)(nil), // 156: WAWebProtobufsE2E.ButtonsMessage.Button.NativeFlowInfo - (*ButtonsMessage_Button_ButtonText)(nil), // 157: WAWebProtobufsE2E.ButtonsMessage.Button.ButtonText - (*InteractiveResponseMessage_Body)(nil), // 158: WAWebProtobufsE2E.InteractiveResponseMessage.Body - (*InteractiveResponseMessage_NativeFlowResponseMessage)(nil), // 159: WAWebProtobufsE2E.InteractiveResponseMessage.NativeFlowResponseMessage - (*InteractiveMessage_ShopMessage)(nil), // 160: WAWebProtobufsE2E.InteractiveMessage.ShopMessage - (*InteractiveMessage_CarouselMessage)(nil), // 161: WAWebProtobufsE2E.InteractiveMessage.CarouselMessage - (*InteractiveMessage_NativeFlowMessage)(nil), // 162: WAWebProtobufsE2E.InteractiveMessage.NativeFlowMessage - (*InteractiveMessage_CollectionMessage)(nil), // 163: WAWebProtobufsE2E.InteractiveMessage.CollectionMessage - (*InteractiveMessage_Footer)(nil), // 164: WAWebProtobufsE2E.InteractiveMessage.Footer - (*InteractiveMessage_Body)(nil), // 165: WAWebProtobufsE2E.InteractiveMessage.Body - (*InteractiveMessage_Header)(nil), // 166: WAWebProtobufsE2E.InteractiveMessage.Header - (*InteractiveMessage_NativeFlowMessage_NativeFlowButton)(nil), // 167: WAWebProtobufsE2E.InteractiveMessage.NativeFlowMessage.NativeFlowButton - (*ListResponseMessage_SingleSelectReply)(nil), // 168: WAWebProtobufsE2E.ListResponseMessage.SingleSelectReply - (*ListMessage_ProductListInfo)(nil), // 169: WAWebProtobufsE2E.ListMessage.ProductListInfo - (*ListMessage_ProductListHeaderImage)(nil), // 170: WAWebProtobufsE2E.ListMessage.ProductListHeaderImage - (*ListMessage_ProductSection)(nil), // 171: WAWebProtobufsE2E.ListMessage.ProductSection - (*ListMessage_Product)(nil), // 172: WAWebProtobufsE2E.ListMessage.Product - (*ListMessage_Section)(nil), // 173: WAWebProtobufsE2E.ListMessage.Section - (*ListMessage_Row)(nil), // 174: WAWebProtobufsE2E.ListMessage.Row - (*HighlyStructuredMessage_HSMLocalizableParameter)(nil), // 175: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter - (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime)(nil), // 176: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime - (*HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency)(nil), // 177: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency - (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent)(nil), // 178: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent - (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch)(nil), // 179: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch - (*ContextInfo_ForwardedNewsletterMessageInfo)(nil), // 180: WAWebProtobufsE2E.ContextInfo.ForwardedNewsletterMessageInfo - (*ContextInfo_ExternalAdReplyInfo)(nil), // 181: WAWebProtobufsE2E.ContextInfo.ExternalAdReplyInfo - (*ContextInfo_AdReplyInfo)(nil), // 182: WAWebProtobufsE2E.ContextInfo.AdReplyInfo - (*ContextInfo_FeatureEligibilities)(nil), // 183: WAWebProtobufsE2E.ContextInfo.FeatureEligibilities - (*ContextInfo_DataSharingContext)(nil), // 184: WAWebProtobufsE2E.ContextInfo.DataSharingContext - (*ContextInfo_UTMInfo)(nil), // 185: WAWebProtobufsE2E.ContextInfo.UTMInfo - (*ContextInfo_BusinessMessageForwardInfo)(nil), // 186: WAWebProtobufsE2E.ContextInfo.BusinessMessageForwardInfo - (*HydratedTemplateButton_HydratedURLButton)(nil), // 187: WAWebProtobufsE2E.HydratedTemplateButton.HydratedURLButton - (*HydratedTemplateButton_HydratedCallButton)(nil), // 188: WAWebProtobufsE2E.HydratedTemplateButton.HydratedCallButton - (*HydratedTemplateButton_HydratedQuickReplyButton)(nil), // 189: WAWebProtobufsE2E.HydratedTemplateButton.HydratedQuickReplyButton - (*PaymentBackground_MediaData)(nil), // 190: WAWebProtobufsE2E.PaymentBackground.MediaData - (*PollResultSnapshotMessage_PollVote)(nil), // 191: WAWebProtobufsE2E.PollResultSnapshotMessage.PollVote - (*PollCreationMessage_Option)(nil), // 192: WAWebProtobufsE2E.PollCreationMessage.Option - (*ProductMessage_ProductSnapshot)(nil), // 193: WAWebProtobufsE2E.ProductMessage.ProductSnapshot - (*ProductMessage_CatalogSnapshot)(nil), // 194: WAWebProtobufsE2E.ProductMessage.CatalogSnapshot - (*TemplateMessage_HydratedFourRowTemplate)(nil), // 195: WAWebProtobufsE2E.TemplateMessage.HydratedFourRowTemplate - (*TemplateMessage_FourRowTemplate)(nil), // 196: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate - (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult)(nil), // 197: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult - (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse)(nil), // 198: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.WaffleNonceFetchResponse - (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse)(nil), // 199: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.PlaceholderMessageResendResponse - (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse)(nil), // 200: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse - (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail)(nil), // 201: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.LinkPreviewHighQualityThumbnail - (*PeerDataOperationRequestMessage_PlaceholderMessageResendRequest)(nil), // 202: WAWebProtobufsE2E.PeerDataOperationRequestMessage.PlaceholderMessageResendRequest - (*PeerDataOperationRequestMessage_HistorySyncOnDemandRequest)(nil), // 203: WAWebProtobufsE2E.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest - (*PeerDataOperationRequestMessage_RequestUrlPreview)(nil), // 204: WAWebProtobufsE2E.PeerDataOperationRequestMessage.RequestUrlPreview - (*PeerDataOperationRequestMessage_RequestStickerReupload)(nil), // 205: WAWebProtobufsE2E.PeerDataOperationRequestMessage.RequestStickerReupload - (*TemplateButton_CallButton)(nil), // 206: WAWebProtobufsE2E.TemplateButton.CallButton - (*TemplateButton_URLButton)(nil), // 207: WAWebProtobufsE2E.TemplateButton.URLButton - (*TemplateButton_QuickReplyButton)(nil), // 208: WAWebProtobufsE2E.TemplateButton.QuickReplyButton - (*waCommon.MessageKey)(nil), // 209: WACommon.MessageKey - (waAdv.ADVEncryptionType)(0), // 210: WAAdv.ADVEncryptionType - (waMmsRetry.MediaRetryNotification_ResultType)(0), // 211: WAMmsRetry.MediaRetryNotification.ResultType + (BotSessionSource)(0), // 1: WAWebProtobufsE2E.BotSessionSource + (KeepType)(0), // 2: WAWebProtobufsE2E.KeepType + (PlaceholderMessage_PlaceholderType)(0), // 3: WAWebProtobufsE2E.PlaceholderMessage.PlaceholderType + (BCallMessage_MediaType)(0), // 4: WAWebProtobufsE2E.BCallMessage.MediaType + (CallLogMessage_CallOutcome)(0), // 5: WAWebProtobufsE2E.CallLogMessage.CallOutcome + (CallLogMessage_CallType)(0), // 6: WAWebProtobufsE2E.CallLogMessage.CallType + (ScheduledCallEditMessage_EditType)(0), // 7: WAWebProtobufsE2E.ScheduledCallEditMessage.EditType + (ScheduledCallCreationMessage_CallType)(0), // 8: WAWebProtobufsE2E.ScheduledCallCreationMessage.CallType + (EventResponseMessage_EventResponseType)(0), // 9: WAWebProtobufsE2E.EventResponseMessage.EventResponseType + (PinInChatMessage_Type)(0), // 10: WAWebProtobufsE2E.PinInChatMessage.Type + (ButtonsResponseMessage_Type)(0), // 11: WAWebProtobufsE2E.ButtonsResponseMessage.Type + (ButtonsMessage_HeaderType)(0), // 12: WAWebProtobufsE2E.ButtonsMessage.HeaderType + (ButtonsMessage_Button_Type)(0), // 13: WAWebProtobufsE2E.ButtonsMessage.Button.Type + (SecretEncryptedMessage_SecretEncType)(0), // 14: WAWebProtobufsE2E.SecretEncryptedMessage.SecretEncType + (GroupInviteMessage_GroupType)(0), // 15: WAWebProtobufsE2E.GroupInviteMessage.GroupType + (InteractiveResponseMessage_Body_Format)(0), // 16: WAWebProtobufsE2E.InteractiveResponseMessage.Body.Format + (InteractiveMessage_ShopMessage_Surface)(0), // 17: WAWebProtobufsE2E.InteractiveMessage.ShopMessage.Surface + (ListResponseMessage_ListType)(0), // 18: WAWebProtobufsE2E.ListResponseMessage.ListType + (ListMessage_ListType)(0), // 19: WAWebProtobufsE2E.ListMessage.ListType + (OrderMessage_OrderSurface)(0), // 20: WAWebProtobufsE2E.OrderMessage.OrderSurface + (OrderMessage_OrderStatus)(0), // 21: WAWebProtobufsE2E.OrderMessage.OrderStatus + (PaymentInviteMessage_ServiceType)(0), // 22: WAWebProtobufsE2E.PaymentInviteMessage.ServiceType + (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType)(0), // 23: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.CalendarType + (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType)(0), // 24: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.DayOfWeekType + (PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandResponseCode)(0), // 25: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.FullHistorySyncOnDemandResponseCode + (HistorySyncNotification_HistorySyncType)(0), // 26: WAWebProtobufsE2E.HistorySyncNotification.HistorySyncType + (RequestWelcomeMessageMetadata_LocalChatState)(0), // 27: WAWebProtobufsE2E.RequestWelcomeMessageMetadata.LocalChatState + (ProtocolMessage_Type)(0), // 28: WAWebProtobufsE2E.ProtocolMessage.Type + (CloudAPIThreadControlNotification_CloudAPIThreadControl)(0), // 29: WAWebProtobufsE2E.CloudAPIThreadControlNotification.CloudAPIThreadControl + (BotFeedbackMessage_ReportKind)(0), // 30: WAWebProtobufsE2E.BotFeedbackMessage.ReportKind + (BotFeedbackMessage_BotFeedbackKindMultiplePositive)(0), // 31: WAWebProtobufsE2E.BotFeedbackMessage.BotFeedbackKindMultiplePositive + (BotFeedbackMessage_BotFeedbackKindMultipleNegative)(0), // 32: WAWebProtobufsE2E.BotFeedbackMessage.BotFeedbackKindMultipleNegative + (BotFeedbackMessage_BotFeedbackKind)(0), // 33: WAWebProtobufsE2E.BotFeedbackMessage.BotFeedbackKind + (VideoMessage_Attribution)(0), // 34: WAWebProtobufsE2E.VideoMessage.Attribution + (ExtendedTextMessage_InviteLinkGroupType)(0), // 35: WAWebProtobufsE2E.ExtendedTextMessage.InviteLinkGroupType + (ExtendedTextMessage_PreviewType)(0), // 36: WAWebProtobufsE2E.ExtendedTextMessage.PreviewType + (ExtendedTextMessage_FontType)(0), // 37: WAWebProtobufsE2E.ExtendedTextMessage.FontType + (InvoiceMessage_AttachmentType)(0), // 38: WAWebProtobufsE2E.InvoiceMessage.AttachmentType + (ImageMessage_ImageSourceType)(0), // 39: WAWebProtobufsE2E.ImageMessage.ImageSourceType + (ContextInfo_ForwardedNewsletterMessageInfo_ContentType)(0), // 40: WAWebProtobufsE2E.ContextInfo.ForwardedNewsletterMessageInfo.ContentType + (ContextInfo_ExternalAdReplyInfo_MediaType)(0), // 41: WAWebProtobufsE2E.ContextInfo.ExternalAdReplyInfo.MediaType + (ContextInfo_AdReplyInfo_MediaType)(0), // 42: WAWebProtobufsE2E.ContextInfo.AdReplyInfo.MediaType + (BotPluginMetadata_PluginType)(0), // 43: WAWebProtobufsE2E.BotPluginMetadata.PluginType + (BotPluginMetadata_SearchProvider)(0), // 44: WAWebProtobufsE2E.BotPluginMetadata.SearchProvider + (BotMediaMetadata_OrientationType)(0), // 45: WAWebProtobufsE2E.BotMediaMetadata.OrientationType + (BotReminderMetadata_ReminderFrequency)(0), // 46: WAWebProtobufsE2E.BotReminderMetadata.ReminderFrequency + (BotReminderMetadata_ReminderAction)(0), // 47: WAWebProtobufsE2E.BotReminderMetadata.ReminderAction + (BotModelMetadata_PremiumModelStatus)(0), // 48: WAWebProtobufsE2E.BotModelMetadata.PremiumModelStatus + (BotModelMetadata_ModelType)(0), // 49: WAWebProtobufsE2E.BotModelMetadata.ModelType + (MessageAssociation_AssociationType)(0), // 50: WAWebProtobufsE2E.MessageAssociation.AssociationType + (MessageContextInfo_MessageAddonExpiryType)(0), // 51: WAWebProtobufsE2E.MessageContextInfo.MessageAddonExpiryType + (HydratedTemplateButton_HydratedURLButton_WebviewPresentationType)(0), // 52: WAWebProtobufsE2E.HydratedTemplateButton.HydratedURLButton.WebviewPresentationType + (PaymentBackground_Type)(0), // 53: WAWebProtobufsE2E.PaymentBackground.Type + (DisappearingMode_Trigger)(0), // 54: WAWebProtobufsE2E.DisappearingMode.Trigger + (DisappearingMode_Initiator)(0), // 55: WAWebProtobufsE2E.DisappearingMode.Initiator + (ProcessedVideo_VideoQuality)(0), // 56: WAWebProtobufsE2E.ProcessedVideo.VideoQuality + (*PlaceholderMessage)(nil), // 57: WAWebProtobufsE2E.PlaceholderMessage + (*BCallMessage)(nil), // 58: WAWebProtobufsE2E.BCallMessage + (*CallLogMessage)(nil), // 59: WAWebProtobufsE2E.CallLogMessage + (*ScheduledCallEditMessage)(nil), // 60: WAWebProtobufsE2E.ScheduledCallEditMessage + (*ScheduledCallCreationMessage)(nil), // 61: WAWebProtobufsE2E.ScheduledCallCreationMessage + (*EventResponseMessage)(nil), // 62: WAWebProtobufsE2E.EventResponseMessage + (*PinInChatMessage)(nil), // 63: WAWebProtobufsE2E.PinInChatMessage + (*ButtonsResponseMessage)(nil), // 64: WAWebProtobufsE2E.ButtonsResponseMessage + (*ButtonsMessage)(nil), // 65: WAWebProtobufsE2E.ButtonsMessage + (*SecretEncryptedMessage)(nil), // 66: WAWebProtobufsE2E.SecretEncryptedMessage + (*GroupInviteMessage)(nil), // 67: WAWebProtobufsE2E.GroupInviteMessage + (*InteractiveResponseMessage)(nil), // 68: WAWebProtobufsE2E.InteractiveResponseMessage + (*InteractiveMessage)(nil), // 69: WAWebProtobufsE2E.InteractiveMessage + (*ListResponseMessage)(nil), // 70: WAWebProtobufsE2E.ListResponseMessage + (*ListMessage)(nil), // 71: WAWebProtobufsE2E.ListMessage + (*OrderMessage)(nil), // 72: WAWebProtobufsE2E.OrderMessage + (*PaymentInviteMessage)(nil), // 73: WAWebProtobufsE2E.PaymentInviteMessage + (*HighlyStructuredMessage)(nil), // 74: WAWebProtobufsE2E.HighlyStructuredMessage + (*PeerDataOperationRequestResponseMessage)(nil), // 75: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage + (*HistorySyncNotification)(nil), // 76: WAWebProtobufsE2E.HistorySyncNotification + (*RequestWelcomeMessageMetadata)(nil), // 77: WAWebProtobufsE2E.RequestWelcomeMessageMetadata + (*ProtocolMessage)(nil), // 78: WAWebProtobufsE2E.ProtocolMessage + (*CloudAPIThreadControlNotification)(nil), // 79: WAWebProtobufsE2E.CloudAPIThreadControlNotification + (*BotFeedbackMessage)(nil), // 80: WAWebProtobufsE2E.BotFeedbackMessage + (*VideoMessage)(nil), // 81: WAWebProtobufsE2E.VideoMessage + (*ExtendedTextMessage)(nil), // 82: WAWebProtobufsE2E.ExtendedTextMessage + (*InvoiceMessage)(nil), // 83: WAWebProtobufsE2E.InvoiceMessage + (*ImageMessage)(nil), // 84: WAWebProtobufsE2E.ImageMessage + (*ContextInfo)(nil), // 85: WAWebProtobufsE2E.ContextInfo + (*BotPluginMetadata)(nil), // 86: WAWebProtobufsE2E.BotPluginMetadata + (*BotMediaMetadata)(nil), // 87: WAWebProtobufsE2E.BotMediaMetadata + (*BotReminderMetadata)(nil), // 88: WAWebProtobufsE2E.BotReminderMetadata + (*BotModelMetadata)(nil), // 89: WAWebProtobufsE2E.BotModelMetadata + (*MessageAssociation)(nil), // 90: WAWebProtobufsE2E.MessageAssociation + (*MessageContextInfo)(nil), // 91: WAWebProtobufsE2E.MessageContextInfo + (*HydratedTemplateButton)(nil), // 92: WAWebProtobufsE2E.HydratedTemplateButton + (*PaymentBackground)(nil), // 93: WAWebProtobufsE2E.PaymentBackground + (*DisappearingMode)(nil), // 94: WAWebProtobufsE2E.DisappearingMode + (*ProcessedVideo)(nil), // 95: WAWebProtobufsE2E.ProcessedVideo + (*Message)(nil), // 96: WAWebProtobufsE2E.Message + (*StickerPackMessage)(nil), // 97: WAWebProtobufsE2E.StickerPackMessage + (*AlbumMessage)(nil), // 98: WAWebProtobufsE2E.AlbumMessage + (*MessageHistoryBundle)(nil), // 99: WAWebProtobufsE2E.MessageHistoryBundle + (*EncEventResponseMessage)(nil), // 100: WAWebProtobufsE2E.EncEventResponseMessage + (*EventMessage)(nil), // 101: WAWebProtobufsE2E.EventMessage + (*CommentMessage)(nil), // 102: WAWebProtobufsE2E.CommentMessage + (*EncCommentMessage)(nil), // 103: WAWebProtobufsE2E.EncCommentMessage + (*EncReactionMessage)(nil), // 104: WAWebProtobufsE2E.EncReactionMessage + (*KeepInChatMessage)(nil), // 105: WAWebProtobufsE2E.KeepInChatMessage + (*PollResultSnapshotMessage)(nil), // 106: WAWebProtobufsE2E.PollResultSnapshotMessage + (*PollVoteMessage)(nil), // 107: WAWebProtobufsE2E.PollVoteMessage + (*PollEncValue)(nil), // 108: WAWebProtobufsE2E.PollEncValue + (*PollUpdateMessageMetadata)(nil), // 109: WAWebProtobufsE2E.PollUpdateMessageMetadata + (*PollUpdateMessage)(nil), // 110: WAWebProtobufsE2E.PollUpdateMessage + (*PollCreationMessage)(nil), // 111: WAWebProtobufsE2E.PollCreationMessage + (*StickerSyncRMRMessage)(nil), // 112: WAWebProtobufsE2E.StickerSyncRMRMessage + (*ReactionMessage)(nil), // 113: WAWebProtobufsE2E.ReactionMessage + (*FutureProofMessage)(nil), // 114: WAWebProtobufsE2E.FutureProofMessage + (*DeviceSentMessage)(nil), // 115: WAWebProtobufsE2E.DeviceSentMessage + (*RequestPhoneNumberMessage)(nil), // 116: WAWebProtobufsE2E.RequestPhoneNumberMessage + (*NewsletterAdminInviteMessage)(nil), // 117: WAWebProtobufsE2E.NewsletterAdminInviteMessage + (*ProductMessage)(nil), // 118: WAWebProtobufsE2E.ProductMessage + (*TemplateButtonReplyMessage)(nil), // 119: WAWebProtobufsE2E.TemplateButtonReplyMessage + (*TemplateMessage)(nil), // 120: WAWebProtobufsE2E.TemplateMessage + (*StickerMessage)(nil), // 121: WAWebProtobufsE2E.StickerMessage + (*LiveLocationMessage)(nil), // 122: WAWebProtobufsE2E.LiveLocationMessage + (*CancelPaymentRequestMessage)(nil), // 123: WAWebProtobufsE2E.CancelPaymentRequestMessage + (*DeclinePaymentRequestMessage)(nil), // 124: WAWebProtobufsE2E.DeclinePaymentRequestMessage + (*RequestPaymentMessage)(nil), // 125: WAWebProtobufsE2E.RequestPaymentMessage + (*SendPaymentMessage)(nil), // 126: WAWebProtobufsE2E.SendPaymentMessage + (*ContactsArrayMessage)(nil), // 127: WAWebProtobufsE2E.ContactsArrayMessage + (*InitialSecurityNotificationSettingSync)(nil), // 128: WAWebProtobufsE2E.InitialSecurityNotificationSettingSync + (*PeerDataOperationRequestMessage)(nil), // 129: WAWebProtobufsE2E.PeerDataOperationRequestMessage + (*FullHistorySyncOnDemandRequestMetadata)(nil), // 130: WAWebProtobufsE2E.FullHistorySyncOnDemandRequestMetadata + (*AppStateFatalExceptionNotification)(nil), // 131: WAWebProtobufsE2E.AppStateFatalExceptionNotification + (*AppStateSyncKeyRequest)(nil), // 132: WAWebProtobufsE2E.AppStateSyncKeyRequest + (*AppStateSyncKeyShare)(nil), // 133: WAWebProtobufsE2E.AppStateSyncKeyShare + (*AppStateSyncKeyData)(nil), // 134: WAWebProtobufsE2E.AppStateSyncKeyData + (*AppStateSyncKeyFingerprint)(nil), // 135: WAWebProtobufsE2E.AppStateSyncKeyFingerprint + (*AppStateSyncKeyId)(nil), // 136: WAWebProtobufsE2E.AppStateSyncKeyId + (*AppStateSyncKey)(nil), // 137: WAWebProtobufsE2E.AppStateSyncKey + (*Chat)(nil), // 138: WAWebProtobufsE2E.Chat + (*Call)(nil), // 139: WAWebProtobufsE2E.Call + (*AudioMessage)(nil), // 140: WAWebProtobufsE2E.AudioMessage + (*DocumentMessage)(nil), // 141: WAWebProtobufsE2E.DocumentMessage + (*LocationMessage)(nil), // 142: WAWebProtobufsE2E.LocationMessage + (*ContactMessage)(nil), // 143: WAWebProtobufsE2E.ContactMessage + (*SenderKeyDistributionMessage)(nil), // 144: WAWebProtobufsE2E.SenderKeyDistributionMessage + (*BotAvatarMetadata)(nil), // 145: WAWebProtobufsE2E.BotAvatarMetadata + (*BotSuggestedPromptMetadata)(nil), // 146: WAWebProtobufsE2E.BotSuggestedPromptMetadata + (*BotSessionMetadata)(nil), // 147: WAWebProtobufsE2E.BotSessionMetadata + (*BotMemuMetadata)(nil), // 148: WAWebProtobufsE2E.BotMemuMetadata + (*BotProgressIndicatorMetadata)(nil), // 149: WAWebProtobufsE2E.BotProgressIndicatorMetadata + (*BotMetadata)(nil), // 150: WAWebProtobufsE2E.BotMetadata + (*DeviceListMetadata)(nil), // 151: WAWebProtobufsE2E.DeviceListMetadata + (*EmbeddedMessage)(nil), // 152: WAWebProtobufsE2E.EmbeddedMessage + (*EmbeddedMusic)(nil), // 153: WAWebProtobufsE2E.EmbeddedMusic + (*EmbeddedContent)(nil), // 154: WAWebProtobufsE2E.EmbeddedContent + (*InteractiveAnnotation)(nil), // 155: WAWebProtobufsE2E.InteractiveAnnotation + (*Point)(nil), // 156: WAWebProtobufsE2E.Point + (*Location)(nil), // 157: WAWebProtobufsE2E.Location + (*TemplateButton)(nil), // 158: WAWebProtobufsE2E.TemplateButton + (*Money)(nil), // 159: WAWebProtobufsE2E.Money + (*ActionLink)(nil), // 160: WAWebProtobufsE2E.ActionLink + (*GroupMention)(nil), // 161: WAWebProtobufsE2E.GroupMention + (*MessageSecretMessage)(nil), // 162: WAWebProtobufsE2E.MessageSecretMessage + (*MediaNotifyMessage)(nil), // 163: WAWebProtobufsE2E.MediaNotifyMessage + (*LIDMigrationMappingSyncMessage)(nil), // 164: WAWebProtobufsE2E.LIDMigrationMappingSyncMessage + (*CallLogMessage_CallParticipant)(nil), // 165: WAWebProtobufsE2E.CallLogMessage.CallParticipant + (*ButtonsMessage_Button)(nil), // 166: WAWebProtobufsE2E.ButtonsMessage.Button + (*ButtonsMessage_Button_NativeFlowInfo)(nil), // 167: WAWebProtobufsE2E.ButtonsMessage.Button.NativeFlowInfo + (*ButtonsMessage_Button_ButtonText)(nil), // 168: WAWebProtobufsE2E.ButtonsMessage.Button.ButtonText + (*InteractiveResponseMessage_Body)(nil), // 169: WAWebProtobufsE2E.InteractiveResponseMessage.Body + (*InteractiveResponseMessage_NativeFlowResponseMessage)(nil), // 170: WAWebProtobufsE2E.InteractiveResponseMessage.NativeFlowResponseMessage + (*InteractiveMessage_ShopMessage)(nil), // 171: WAWebProtobufsE2E.InteractiveMessage.ShopMessage + (*InteractiveMessage_CarouselMessage)(nil), // 172: WAWebProtobufsE2E.InteractiveMessage.CarouselMessage + (*InteractiveMessage_NativeFlowMessage)(nil), // 173: WAWebProtobufsE2E.InteractiveMessage.NativeFlowMessage + (*InteractiveMessage_CollectionMessage)(nil), // 174: WAWebProtobufsE2E.InteractiveMessage.CollectionMessage + (*InteractiveMessage_Footer)(nil), // 175: WAWebProtobufsE2E.InteractiveMessage.Footer + (*InteractiveMessage_Body)(nil), // 176: WAWebProtobufsE2E.InteractiveMessage.Body + (*InteractiveMessage_Header)(nil), // 177: WAWebProtobufsE2E.InteractiveMessage.Header + (*InteractiveMessage_NativeFlowMessage_NativeFlowButton)(nil), // 178: WAWebProtobufsE2E.InteractiveMessage.NativeFlowMessage.NativeFlowButton + (*ListResponseMessage_SingleSelectReply)(nil), // 179: WAWebProtobufsE2E.ListResponseMessage.SingleSelectReply + (*ListMessage_ProductListInfo)(nil), // 180: WAWebProtobufsE2E.ListMessage.ProductListInfo + (*ListMessage_ProductListHeaderImage)(nil), // 181: WAWebProtobufsE2E.ListMessage.ProductListHeaderImage + (*ListMessage_ProductSection)(nil), // 182: WAWebProtobufsE2E.ListMessage.ProductSection + (*ListMessage_Product)(nil), // 183: WAWebProtobufsE2E.ListMessage.Product + (*ListMessage_Section)(nil), // 184: WAWebProtobufsE2E.ListMessage.Section + (*ListMessage_Row)(nil), // 185: WAWebProtobufsE2E.ListMessage.Row + (*HighlyStructuredMessage_HSMLocalizableParameter)(nil), // 186: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter + (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime)(nil), // 187: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + (*HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency)(nil), // 188: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency + (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent)(nil), // 189: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch)(nil), // 190: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch + (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult)(nil), // 191: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse)(nil), // 192: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.WaffleNonceFetchResponse + (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandRequestResponse)(nil), // 193: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.FullHistorySyncOnDemandRequestResponse + (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse)(nil), // 194: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.PlaceholderMessageResendResponse + (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse)(nil), // 195: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail)(nil), // 196: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.LinkPreviewHighQualityThumbnail + (*ContextInfo_ForwardedNewsletterMessageInfo)(nil), // 197: WAWebProtobufsE2E.ContextInfo.ForwardedNewsletterMessageInfo + (*ContextInfo_ExternalAdReplyInfo)(nil), // 198: WAWebProtobufsE2E.ContextInfo.ExternalAdReplyInfo + (*ContextInfo_AdReplyInfo)(nil), // 199: WAWebProtobufsE2E.ContextInfo.AdReplyInfo + (*ContextInfo_FeatureEligibilities)(nil), // 200: WAWebProtobufsE2E.ContextInfo.FeatureEligibilities + (*ContextInfo_DataSharingContext)(nil), // 201: WAWebProtobufsE2E.ContextInfo.DataSharingContext + (*ContextInfo_UTMInfo)(nil), // 202: WAWebProtobufsE2E.ContextInfo.UTMInfo + (*ContextInfo_BusinessMessageForwardInfo)(nil), // 203: WAWebProtobufsE2E.ContextInfo.BusinessMessageForwardInfo + (*ContextInfo_DataSharingContext_Parameters)(nil), // 204: WAWebProtobufsE2E.ContextInfo.DataSharingContext.Parameters + (*HydratedTemplateButton_HydratedURLButton)(nil), // 205: WAWebProtobufsE2E.HydratedTemplateButton.HydratedURLButton + (*HydratedTemplateButton_HydratedCallButton)(nil), // 206: WAWebProtobufsE2E.HydratedTemplateButton.HydratedCallButton + (*HydratedTemplateButton_HydratedQuickReplyButton)(nil), // 207: WAWebProtobufsE2E.HydratedTemplateButton.HydratedQuickReplyButton + (*PaymentBackground_MediaData)(nil), // 208: WAWebProtobufsE2E.PaymentBackground.MediaData + (*StickerPackMessage_Sticker)(nil), // 209: WAWebProtobufsE2E.StickerPackMessage.Sticker + (*PollResultSnapshotMessage_PollVote)(nil), // 210: WAWebProtobufsE2E.PollResultSnapshotMessage.PollVote + (*PollCreationMessage_Option)(nil), // 211: WAWebProtobufsE2E.PollCreationMessage.Option + (*ProductMessage_ProductSnapshot)(nil), // 212: WAWebProtobufsE2E.ProductMessage.ProductSnapshot + (*ProductMessage_CatalogSnapshot)(nil), // 213: WAWebProtobufsE2E.ProductMessage.CatalogSnapshot + (*TemplateMessage_HydratedFourRowTemplate)(nil), // 214: WAWebProtobufsE2E.TemplateMessage.HydratedFourRowTemplate + (*TemplateMessage_FourRowTemplate)(nil), // 215: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate + (*PeerDataOperationRequestMessage_PlaceholderMessageResendRequest)(nil), // 216: WAWebProtobufsE2E.PeerDataOperationRequestMessage.PlaceholderMessageResendRequest + (*PeerDataOperationRequestMessage_FullHistorySyncOnDemandRequest)(nil), // 217: WAWebProtobufsE2E.PeerDataOperationRequestMessage.FullHistorySyncOnDemandRequest + (*PeerDataOperationRequestMessage_HistorySyncOnDemandRequest)(nil), // 218: WAWebProtobufsE2E.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + (*PeerDataOperationRequestMessage_RequestUrlPreview)(nil), // 219: WAWebProtobufsE2E.PeerDataOperationRequestMessage.RequestUrlPreview + (*PeerDataOperationRequestMessage_RequestStickerReupload)(nil), // 220: WAWebProtobufsE2E.PeerDataOperationRequestMessage.RequestStickerReupload + (*TemplateButton_CallButton)(nil), // 221: WAWebProtobufsE2E.TemplateButton.CallButton + (*TemplateButton_URLButton)(nil), // 222: WAWebProtobufsE2E.TemplateButton.URLButton + (*TemplateButton_QuickReplyButton)(nil), // 223: WAWebProtobufsE2E.TemplateButton.QuickReplyButton + (*waCommon.MessageKey)(nil), // 224: WACommon.MessageKey + (waAdv.ADVEncryptionType)(0), // 225: WAAdv.ADVEncryptionType + (waMmsRetry.MediaRetryNotification_ResultType)(0), // 226: WAMmsRetry.MediaRetryNotification.ResultType + (*waCompanionReg.DeviceProps_HistorySyncConfig)(nil), // 227: WAWebProtobufsCompanionReg.DeviceProps.HistorySyncConfig } var file_waE2E_WAWebProtobufsE2E_proto_depIdxs = []int32{ - 2, // 0: WAWebProtobufsE2E.PlaceholderMessage.type:type_name -> WAWebProtobufsE2E.PlaceholderMessage.PlaceholderType - 3, // 1: WAWebProtobufsE2E.BCallMessage.mediaType:type_name -> WAWebProtobufsE2E.BCallMessage.MediaType - 4, // 2: WAWebProtobufsE2E.CallLogMessage.callOutcome:type_name -> WAWebProtobufsE2E.CallLogMessage.CallOutcome - 5, // 3: WAWebProtobufsE2E.CallLogMessage.callType:type_name -> WAWebProtobufsE2E.CallLogMessage.CallType - 154, // 4: WAWebProtobufsE2E.CallLogMessage.participants:type_name -> WAWebProtobufsE2E.CallLogMessage.CallParticipant - 209, // 5: WAWebProtobufsE2E.ScheduledCallEditMessage.key:type_name -> WACommon.MessageKey - 6, // 6: WAWebProtobufsE2E.ScheduledCallEditMessage.editType:type_name -> WAWebProtobufsE2E.ScheduledCallEditMessage.EditType - 7, // 7: WAWebProtobufsE2E.ScheduledCallCreationMessage.callType:type_name -> WAWebProtobufsE2E.ScheduledCallCreationMessage.CallType - 8, // 8: WAWebProtobufsE2E.EventResponseMessage.response:type_name -> WAWebProtobufsE2E.EventResponseMessage.EventResponseType - 209, // 9: WAWebProtobufsE2E.PinInChatMessage.key:type_name -> WACommon.MessageKey - 9, // 10: WAWebProtobufsE2E.PinInChatMessage.type:type_name -> WAWebProtobufsE2E.PinInChatMessage.Type - 80, // 11: WAWebProtobufsE2E.ButtonsResponseMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 10, // 12: WAWebProtobufsE2E.ButtonsResponseMessage.type:type_name -> WAWebProtobufsE2E.ButtonsResponseMessage.Type - 134, // 13: WAWebProtobufsE2E.ButtonsMessage.documentMessage:type_name -> WAWebProtobufsE2E.DocumentMessage - 79, // 14: WAWebProtobufsE2E.ButtonsMessage.imageMessage:type_name -> WAWebProtobufsE2E.ImageMessage - 76, // 15: WAWebProtobufsE2E.ButtonsMessage.videoMessage:type_name -> WAWebProtobufsE2E.VideoMessage - 135, // 16: WAWebProtobufsE2E.ButtonsMessage.locationMessage:type_name -> WAWebProtobufsE2E.LocationMessage - 80, // 17: WAWebProtobufsE2E.ButtonsMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 155, // 18: WAWebProtobufsE2E.ButtonsMessage.buttons:type_name -> WAWebProtobufsE2E.ButtonsMessage.Button - 11, // 19: WAWebProtobufsE2E.ButtonsMessage.headerType:type_name -> WAWebProtobufsE2E.ButtonsMessage.HeaderType - 209, // 20: WAWebProtobufsE2E.SecretEncryptedMessage.targetMessageKey:type_name -> WACommon.MessageKey - 13, // 21: WAWebProtobufsE2E.SecretEncryptedMessage.secretEncType:type_name -> WAWebProtobufsE2E.SecretEncryptedMessage.SecretEncType - 80, // 22: WAWebProtobufsE2E.GroupInviteMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 14, // 23: WAWebProtobufsE2E.GroupInviteMessage.groupType:type_name -> WAWebProtobufsE2E.GroupInviteMessage.GroupType - 159, // 24: WAWebProtobufsE2E.InteractiveResponseMessage.nativeFlowResponseMessage:type_name -> WAWebProtobufsE2E.InteractiveResponseMessage.NativeFlowResponseMessage - 158, // 25: WAWebProtobufsE2E.InteractiveResponseMessage.body:type_name -> WAWebProtobufsE2E.InteractiveResponseMessage.Body - 80, // 26: WAWebProtobufsE2E.InteractiveResponseMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 160, // 27: WAWebProtobufsE2E.InteractiveMessage.shopStorefrontMessage:type_name -> WAWebProtobufsE2E.InteractiveMessage.ShopMessage - 163, // 28: WAWebProtobufsE2E.InteractiveMessage.collectionMessage:type_name -> WAWebProtobufsE2E.InteractiveMessage.CollectionMessage - 162, // 29: WAWebProtobufsE2E.InteractiveMessage.nativeFlowMessage:type_name -> WAWebProtobufsE2E.InteractiveMessage.NativeFlowMessage - 161, // 30: WAWebProtobufsE2E.InteractiveMessage.carouselMessage:type_name -> WAWebProtobufsE2E.InteractiveMessage.CarouselMessage - 166, // 31: WAWebProtobufsE2E.InteractiveMessage.header:type_name -> WAWebProtobufsE2E.InteractiveMessage.Header - 165, // 32: WAWebProtobufsE2E.InteractiveMessage.body:type_name -> WAWebProtobufsE2E.InteractiveMessage.Body - 164, // 33: WAWebProtobufsE2E.InteractiveMessage.footer:type_name -> WAWebProtobufsE2E.InteractiveMessage.Footer - 80, // 34: WAWebProtobufsE2E.InteractiveMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 17, // 35: WAWebProtobufsE2E.ListResponseMessage.listType:type_name -> WAWebProtobufsE2E.ListResponseMessage.ListType - 168, // 36: WAWebProtobufsE2E.ListResponseMessage.singleSelectReply:type_name -> WAWebProtobufsE2E.ListResponseMessage.SingleSelectReply - 80, // 37: WAWebProtobufsE2E.ListResponseMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 18, // 38: WAWebProtobufsE2E.ListMessage.listType:type_name -> WAWebProtobufsE2E.ListMessage.ListType - 173, // 39: WAWebProtobufsE2E.ListMessage.sections:type_name -> WAWebProtobufsE2E.ListMessage.Section - 169, // 40: WAWebProtobufsE2E.ListMessage.productListInfo:type_name -> WAWebProtobufsE2E.ListMessage.ProductListInfo - 80, // 41: WAWebProtobufsE2E.ListMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 20, // 42: WAWebProtobufsE2E.OrderMessage.status:type_name -> WAWebProtobufsE2E.OrderMessage.OrderStatus - 19, // 43: WAWebProtobufsE2E.OrderMessage.surface:type_name -> WAWebProtobufsE2E.OrderMessage.OrderSurface - 80, // 44: WAWebProtobufsE2E.OrderMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 209, // 45: WAWebProtobufsE2E.OrderMessage.orderRequestMessageID:type_name -> WACommon.MessageKey - 21, // 46: WAWebProtobufsE2E.PaymentInviteMessage.serviceType:type_name -> WAWebProtobufsE2E.PaymentInviteMessage.ServiceType - 175, // 47: WAWebProtobufsE2E.HighlyStructuredMessage.localizableParams:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter - 113, // 48: WAWebProtobufsE2E.HighlyStructuredMessage.hydratedHsm:type_name -> WAWebProtobufsE2E.TemplateMessage - 24, // 49: WAWebProtobufsE2E.HistorySyncNotification.syncType:type_name -> WAWebProtobufsE2E.HistorySyncNotification.HistorySyncType - 25, // 50: WAWebProtobufsE2E.RequestWelcomeMessageMetadata.localChatState:type_name -> WAWebProtobufsE2E.RequestWelcomeMessageMetadata.LocalChatState - 209, // 51: WAWebProtobufsE2E.ProtocolMessage.key:type_name -> WACommon.MessageKey - 26, // 52: WAWebProtobufsE2E.ProtocolMessage.type:type_name -> WAWebProtobufsE2E.ProtocolMessage.Type - 71, // 53: WAWebProtobufsE2E.ProtocolMessage.historySyncNotification:type_name -> WAWebProtobufsE2E.HistorySyncNotification - 126, // 54: WAWebProtobufsE2E.ProtocolMessage.appStateSyncKeyShare:type_name -> WAWebProtobufsE2E.AppStateSyncKeyShare - 125, // 55: WAWebProtobufsE2E.ProtocolMessage.appStateSyncKeyRequest:type_name -> WAWebProtobufsE2E.AppStateSyncKeyRequest - 121, // 56: WAWebProtobufsE2E.ProtocolMessage.initialSecurityNotificationSettingSync:type_name -> WAWebProtobufsE2E.InitialSecurityNotificationSettingSync - 124, // 57: WAWebProtobufsE2E.ProtocolMessage.appStateFatalExceptionNotification:type_name -> WAWebProtobufsE2E.AppStateFatalExceptionNotification - 88, // 58: WAWebProtobufsE2E.ProtocolMessage.disappearingMode:type_name -> WAWebProtobufsE2E.DisappearingMode - 90, // 59: WAWebProtobufsE2E.ProtocolMessage.editedMessage:type_name -> WAWebProtobufsE2E.Message - 123, // 60: WAWebProtobufsE2E.ProtocolMessage.peerDataOperationRequestMessage:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestMessage - 122, // 61: WAWebProtobufsE2E.ProtocolMessage.peerDataOperationRequestResponseMessage:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage - 75, // 62: WAWebProtobufsE2E.ProtocolMessage.botFeedbackMessage:type_name -> WAWebProtobufsE2E.BotFeedbackMessage - 72, // 63: WAWebProtobufsE2E.ProtocolMessage.requestWelcomeMessageMetadata:type_name -> WAWebProtobufsE2E.RequestWelcomeMessageMetadata - 152, // 64: WAWebProtobufsE2E.ProtocolMessage.mediaNotifyMessage:type_name -> WAWebProtobufsE2E.MediaNotifyMessage - 74, // 65: WAWebProtobufsE2E.ProtocolMessage.cloudApiThreadControlNotification:type_name -> WAWebProtobufsE2E.CloudAPIThreadControlNotification - 153, // 66: WAWebProtobufsE2E.ProtocolMessage.lidMigrationMappingSyncMessage:type_name -> WAWebProtobufsE2E.LIDMigrationMappingSyncMessage - 27, // 67: WAWebProtobufsE2E.CloudAPIThreadControlNotification.status:type_name -> WAWebProtobufsE2E.CloudAPIThreadControlNotification.CloudAPIThreadControl - 209, // 68: WAWebProtobufsE2E.BotFeedbackMessage.messageKey:type_name -> WACommon.MessageKey - 31, // 69: WAWebProtobufsE2E.BotFeedbackMessage.kind:type_name -> WAWebProtobufsE2E.BotFeedbackMessage.BotFeedbackKind - 28, // 70: WAWebProtobufsE2E.BotFeedbackMessage.kindReport:type_name -> WAWebProtobufsE2E.BotFeedbackMessage.ReportKind - 144, // 71: WAWebProtobufsE2E.VideoMessage.interactiveAnnotations:type_name -> WAWebProtobufsE2E.InteractiveAnnotation - 80, // 72: WAWebProtobufsE2E.VideoMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 32, // 73: WAWebProtobufsE2E.VideoMessage.gifAttribution:type_name -> WAWebProtobufsE2E.VideoMessage.Attribution - 144, // 74: WAWebProtobufsE2E.VideoMessage.annotations:type_name -> WAWebProtobufsE2E.InteractiveAnnotation - 89, // 75: WAWebProtobufsE2E.VideoMessage.processedVideos:type_name -> WAWebProtobufsE2E.ProcessedVideo - 35, // 76: WAWebProtobufsE2E.ExtendedTextMessage.font:type_name -> WAWebProtobufsE2E.ExtendedTextMessage.FontType - 34, // 77: WAWebProtobufsE2E.ExtendedTextMessage.previewType:type_name -> WAWebProtobufsE2E.ExtendedTextMessage.PreviewType - 80, // 78: WAWebProtobufsE2E.ExtendedTextMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 33, // 79: WAWebProtobufsE2E.ExtendedTextMessage.inviteLinkGroupType:type_name -> WAWebProtobufsE2E.ExtendedTextMessage.InviteLinkGroupType - 33, // 80: WAWebProtobufsE2E.ExtendedTextMessage.inviteLinkGroupTypeV2:type_name -> WAWebProtobufsE2E.ExtendedTextMessage.InviteLinkGroupType - 36, // 81: WAWebProtobufsE2E.InvoiceMessage.attachmentType:type_name -> WAWebProtobufsE2E.InvoiceMessage.AttachmentType - 144, // 82: WAWebProtobufsE2E.ImageMessage.interactiveAnnotations:type_name -> WAWebProtobufsE2E.InteractiveAnnotation - 80, // 83: WAWebProtobufsE2E.ImageMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 144, // 84: WAWebProtobufsE2E.ImageMessage.annotations:type_name -> WAWebProtobufsE2E.InteractiveAnnotation - 37, // 85: WAWebProtobufsE2E.ImageMessage.imageSourceType:type_name -> WAWebProtobufsE2E.ImageMessage.ImageSourceType - 90, // 86: WAWebProtobufsE2E.ContextInfo.quotedMessage:type_name -> WAWebProtobufsE2E.Message - 182, // 87: WAWebProtobufsE2E.ContextInfo.quotedAd:type_name -> WAWebProtobufsE2E.ContextInfo.AdReplyInfo - 209, // 88: WAWebProtobufsE2E.ContextInfo.placeholderKey:type_name -> WACommon.MessageKey - 181, // 89: WAWebProtobufsE2E.ContextInfo.externalAdReply:type_name -> WAWebProtobufsE2E.ContextInfo.ExternalAdReplyInfo - 88, // 90: WAWebProtobufsE2E.ContextInfo.disappearingMode:type_name -> WAWebProtobufsE2E.DisappearingMode - 149, // 91: WAWebProtobufsE2E.ContextInfo.actionLink:type_name -> WAWebProtobufsE2E.ActionLink - 150, // 92: WAWebProtobufsE2E.ContextInfo.groupMentions:type_name -> WAWebProtobufsE2E.GroupMention - 185, // 93: WAWebProtobufsE2E.ContextInfo.utm:type_name -> WAWebProtobufsE2E.ContextInfo.UTMInfo - 180, // 94: WAWebProtobufsE2E.ContextInfo.forwardedNewsletterMessageInfo:type_name -> WAWebProtobufsE2E.ContextInfo.ForwardedNewsletterMessageInfo - 186, // 95: WAWebProtobufsE2E.ContextInfo.businessMessageForwardInfo:type_name -> WAWebProtobufsE2E.ContextInfo.BusinessMessageForwardInfo - 184, // 96: WAWebProtobufsE2E.ContextInfo.dataSharingContext:type_name -> WAWebProtobufsE2E.ContextInfo.DataSharingContext - 183, // 97: WAWebProtobufsE2E.ContextInfo.featureEligibilities:type_name -> WAWebProtobufsE2E.ContextInfo.FeatureEligibilities - 42, // 98: WAWebProtobufsE2E.BotPluginMetadata.provider:type_name -> WAWebProtobufsE2E.BotPluginMetadata.SearchProvider - 41, // 99: WAWebProtobufsE2E.BotPluginMetadata.pluginType:type_name -> WAWebProtobufsE2E.BotPluginMetadata.PluginType - 209, // 100: WAWebProtobufsE2E.BotPluginMetadata.parentPluginMessageKey:type_name -> WACommon.MessageKey - 41, // 101: WAWebProtobufsE2E.BotPluginMetadata.parentPluginType:type_name -> WAWebProtobufsE2E.BotPluginMetadata.PluginType - 43, // 102: WAWebProtobufsE2E.BotSearchMetadata.sessionSource:type_name -> WAWebProtobufsE2E.BotSearchMetadata.SessionSource - 209, // 103: WAWebProtobufsE2E.BotReminderMetadata.requestMessageKey:type_name -> WACommon.MessageKey - 45, // 104: WAWebProtobufsE2E.BotReminderMetadata.action:type_name -> WAWebProtobufsE2E.BotReminderMetadata.ReminderAction - 44, // 105: WAWebProtobufsE2E.BotReminderMetadata.frequency:type_name -> WAWebProtobufsE2E.BotReminderMetadata.ReminderFrequency - 46, // 106: WAWebProtobufsE2E.MessageAssociation.associationType:type_name -> WAWebProtobufsE2E.MessageAssociation.AssociationType - 209, // 107: WAWebProtobufsE2E.MessageAssociation.parentMessageKey:type_name -> WACommon.MessageKey - 143, // 108: WAWebProtobufsE2E.MessageContextInfo.deviceListMetadata:type_name -> WAWebProtobufsE2E.DeviceListMetadata - 142, // 109: WAWebProtobufsE2E.MessageContextInfo.botMetadata:type_name -> WAWebProtobufsE2E.BotMetadata - 47, // 110: WAWebProtobufsE2E.MessageContextInfo.messageAddOnExpiryType:type_name -> WAWebProtobufsE2E.MessageContextInfo.MessageAddonExpiryType - 84, // 111: WAWebProtobufsE2E.MessageContextInfo.messageAssociation:type_name -> WAWebProtobufsE2E.MessageAssociation - 189, // 112: WAWebProtobufsE2E.HydratedTemplateButton.quickReplyButton:type_name -> WAWebProtobufsE2E.HydratedTemplateButton.HydratedQuickReplyButton - 187, // 113: WAWebProtobufsE2E.HydratedTemplateButton.urlButton:type_name -> WAWebProtobufsE2E.HydratedTemplateButton.HydratedURLButton - 188, // 114: WAWebProtobufsE2E.HydratedTemplateButton.callButton:type_name -> WAWebProtobufsE2E.HydratedTemplateButton.HydratedCallButton - 190, // 115: WAWebProtobufsE2E.PaymentBackground.mediaData:type_name -> WAWebProtobufsE2E.PaymentBackground.MediaData - 49, // 116: WAWebProtobufsE2E.PaymentBackground.type:type_name -> WAWebProtobufsE2E.PaymentBackground.Type - 51, // 117: WAWebProtobufsE2E.DisappearingMode.initiator:type_name -> WAWebProtobufsE2E.DisappearingMode.Initiator - 50, // 118: WAWebProtobufsE2E.DisappearingMode.trigger:type_name -> WAWebProtobufsE2E.DisappearingMode.Trigger - 52, // 119: WAWebProtobufsE2E.ProcessedVideo.quality:type_name -> WAWebProtobufsE2E.ProcessedVideo.VideoQuality - 137, // 120: WAWebProtobufsE2E.Message.senderKeyDistributionMessage:type_name -> WAWebProtobufsE2E.SenderKeyDistributionMessage - 79, // 121: WAWebProtobufsE2E.Message.imageMessage:type_name -> WAWebProtobufsE2E.ImageMessage - 136, // 122: WAWebProtobufsE2E.Message.contactMessage:type_name -> WAWebProtobufsE2E.ContactMessage - 135, // 123: WAWebProtobufsE2E.Message.locationMessage:type_name -> WAWebProtobufsE2E.LocationMessage - 77, // 124: WAWebProtobufsE2E.Message.extendedTextMessage:type_name -> WAWebProtobufsE2E.ExtendedTextMessage - 134, // 125: WAWebProtobufsE2E.Message.documentMessage:type_name -> WAWebProtobufsE2E.DocumentMessage - 133, // 126: WAWebProtobufsE2E.Message.audioMessage:type_name -> WAWebProtobufsE2E.AudioMessage - 76, // 127: WAWebProtobufsE2E.Message.videoMessage:type_name -> WAWebProtobufsE2E.VideoMessage - 132, // 128: WAWebProtobufsE2E.Message.call:type_name -> WAWebProtobufsE2E.Call - 131, // 129: WAWebProtobufsE2E.Message.chat:type_name -> WAWebProtobufsE2E.Chat - 73, // 130: WAWebProtobufsE2E.Message.protocolMessage:type_name -> WAWebProtobufsE2E.ProtocolMessage - 120, // 131: WAWebProtobufsE2E.Message.contactsArrayMessage:type_name -> WAWebProtobufsE2E.ContactsArrayMessage - 70, // 132: WAWebProtobufsE2E.Message.highlyStructuredMessage:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage - 137, // 133: WAWebProtobufsE2E.Message.fastRatchetKeySenderKeyDistributionMessage:type_name -> WAWebProtobufsE2E.SenderKeyDistributionMessage - 119, // 134: WAWebProtobufsE2E.Message.sendPaymentMessage:type_name -> WAWebProtobufsE2E.SendPaymentMessage - 115, // 135: WAWebProtobufsE2E.Message.liveLocationMessage:type_name -> WAWebProtobufsE2E.LiveLocationMessage - 118, // 136: WAWebProtobufsE2E.Message.requestPaymentMessage:type_name -> WAWebProtobufsE2E.RequestPaymentMessage - 117, // 137: WAWebProtobufsE2E.Message.declinePaymentRequestMessage:type_name -> WAWebProtobufsE2E.DeclinePaymentRequestMessage - 116, // 138: WAWebProtobufsE2E.Message.cancelPaymentRequestMessage:type_name -> WAWebProtobufsE2E.CancelPaymentRequestMessage - 113, // 139: WAWebProtobufsE2E.Message.templateMessage:type_name -> WAWebProtobufsE2E.TemplateMessage - 114, // 140: WAWebProtobufsE2E.Message.stickerMessage:type_name -> WAWebProtobufsE2E.StickerMessage - 63, // 141: WAWebProtobufsE2E.Message.groupInviteMessage:type_name -> WAWebProtobufsE2E.GroupInviteMessage - 112, // 142: WAWebProtobufsE2E.Message.templateButtonReplyMessage:type_name -> WAWebProtobufsE2E.TemplateButtonReplyMessage - 111, // 143: WAWebProtobufsE2E.Message.productMessage:type_name -> WAWebProtobufsE2E.ProductMessage - 108, // 144: WAWebProtobufsE2E.Message.deviceSentMessage:type_name -> WAWebProtobufsE2E.DeviceSentMessage - 85, // 145: WAWebProtobufsE2E.Message.messageContextInfo:type_name -> WAWebProtobufsE2E.MessageContextInfo - 67, // 146: WAWebProtobufsE2E.Message.listMessage:type_name -> WAWebProtobufsE2E.ListMessage - 107, // 147: WAWebProtobufsE2E.Message.viewOnceMessage:type_name -> WAWebProtobufsE2E.FutureProofMessage - 68, // 148: WAWebProtobufsE2E.Message.orderMessage:type_name -> WAWebProtobufsE2E.OrderMessage - 66, // 149: WAWebProtobufsE2E.Message.listResponseMessage:type_name -> WAWebProtobufsE2E.ListResponseMessage - 107, // 150: WAWebProtobufsE2E.Message.ephemeralMessage:type_name -> WAWebProtobufsE2E.FutureProofMessage - 78, // 151: WAWebProtobufsE2E.Message.invoiceMessage:type_name -> WAWebProtobufsE2E.InvoiceMessage - 61, // 152: WAWebProtobufsE2E.Message.buttonsMessage:type_name -> WAWebProtobufsE2E.ButtonsMessage - 60, // 153: WAWebProtobufsE2E.Message.buttonsResponseMessage:type_name -> WAWebProtobufsE2E.ButtonsResponseMessage - 69, // 154: WAWebProtobufsE2E.Message.paymentInviteMessage:type_name -> WAWebProtobufsE2E.PaymentInviteMessage - 65, // 155: WAWebProtobufsE2E.Message.interactiveMessage:type_name -> WAWebProtobufsE2E.InteractiveMessage - 106, // 156: WAWebProtobufsE2E.Message.reactionMessage:type_name -> WAWebProtobufsE2E.ReactionMessage - 105, // 157: WAWebProtobufsE2E.Message.stickerSyncRmrMessage:type_name -> WAWebProtobufsE2E.StickerSyncRMRMessage - 64, // 158: WAWebProtobufsE2E.Message.interactiveResponseMessage:type_name -> WAWebProtobufsE2E.InteractiveResponseMessage - 104, // 159: WAWebProtobufsE2E.Message.pollCreationMessage:type_name -> WAWebProtobufsE2E.PollCreationMessage - 103, // 160: WAWebProtobufsE2E.Message.pollUpdateMessage:type_name -> WAWebProtobufsE2E.PollUpdateMessage - 98, // 161: WAWebProtobufsE2E.Message.keepInChatMessage:type_name -> WAWebProtobufsE2E.KeepInChatMessage - 107, // 162: WAWebProtobufsE2E.Message.documentWithCaptionMessage:type_name -> WAWebProtobufsE2E.FutureProofMessage - 109, // 163: WAWebProtobufsE2E.Message.requestPhoneNumberMessage:type_name -> WAWebProtobufsE2E.RequestPhoneNumberMessage - 107, // 164: WAWebProtobufsE2E.Message.viewOnceMessageV2:type_name -> WAWebProtobufsE2E.FutureProofMessage - 97, // 165: WAWebProtobufsE2E.Message.encReactionMessage:type_name -> WAWebProtobufsE2E.EncReactionMessage - 107, // 166: WAWebProtobufsE2E.Message.editedMessage:type_name -> WAWebProtobufsE2E.FutureProofMessage - 107, // 167: WAWebProtobufsE2E.Message.viewOnceMessageV2Extension:type_name -> WAWebProtobufsE2E.FutureProofMessage - 104, // 168: WAWebProtobufsE2E.Message.pollCreationMessageV2:type_name -> WAWebProtobufsE2E.PollCreationMessage - 57, // 169: WAWebProtobufsE2E.Message.scheduledCallCreationMessage:type_name -> WAWebProtobufsE2E.ScheduledCallCreationMessage - 107, // 170: WAWebProtobufsE2E.Message.groupMentionedMessage:type_name -> WAWebProtobufsE2E.FutureProofMessage - 59, // 171: WAWebProtobufsE2E.Message.pinInChatMessage:type_name -> WAWebProtobufsE2E.PinInChatMessage - 104, // 172: WAWebProtobufsE2E.Message.pollCreationMessageV3:type_name -> WAWebProtobufsE2E.PollCreationMessage - 56, // 173: WAWebProtobufsE2E.Message.scheduledCallEditMessage:type_name -> WAWebProtobufsE2E.ScheduledCallEditMessage - 76, // 174: WAWebProtobufsE2E.Message.ptvMessage:type_name -> WAWebProtobufsE2E.VideoMessage - 107, // 175: WAWebProtobufsE2E.Message.botInvokeMessage:type_name -> WAWebProtobufsE2E.FutureProofMessage - 55, // 176: WAWebProtobufsE2E.Message.callLogMesssage:type_name -> WAWebProtobufsE2E.CallLogMessage - 92, // 177: WAWebProtobufsE2E.Message.messageHistoryBundle:type_name -> WAWebProtobufsE2E.MessageHistoryBundle - 96, // 178: WAWebProtobufsE2E.Message.encCommentMessage:type_name -> WAWebProtobufsE2E.EncCommentMessage - 54, // 179: WAWebProtobufsE2E.Message.bcallMessage:type_name -> WAWebProtobufsE2E.BCallMessage - 107, // 180: WAWebProtobufsE2E.Message.lottieStickerMessage:type_name -> WAWebProtobufsE2E.FutureProofMessage - 94, // 181: WAWebProtobufsE2E.Message.eventMessage:type_name -> WAWebProtobufsE2E.EventMessage - 93, // 182: WAWebProtobufsE2E.Message.encEventResponseMessage:type_name -> WAWebProtobufsE2E.EncEventResponseMessage - 95, // 183: WAWebProtobufsE2E.Message.commentMessage:type_name -> WAWebProtobufsE2E.CommentMessage - 110, // 184: WAWebProtobufsE2E.Message.newsletterAdminInviteMessage:type_name -> WAWebProtobufsE2E.NewsletterAdminInviteMessage - 53, // 185: WAWebProtobufsE2E.Message.placeholderMessage:type_name -> WAWebProtobufsE2E.PlaceholderMessage - 62, // 186: WAWebProtobufsE2E.Message.secretEncryptedMessage:type_name -> WAWebProtobufsE2E.SecretEncryptedMessage - 91, // 187: WAWebProtobufsE2E.Message.albumMessage:type_name -> WAWebProtobufsE2E.AlbumMessage - 99, // 188: WAWebProtobufsE2E.Message.pollResultSnapshotMessage:type_name -> WAWebProtobufsE2E.PollResultSnapshotMessage - 107, // 189: WAWebProtobufsE2E.Message.eventCoverImage:type_name -> WAWebProtobufsE2E.FutureProofMessage - 80, // 190: WAWebProtobufsE2E.MessageHistoryBundle.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 209, // 191: WAWebProtobufsE2E.EncEventResponseMessage.eventCreationMessageKey:type_name -> WACommon.MessageKey - 80, // 192: WAWebProtobufsE2E.EventMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 135, // 193: WAWebProtobufsE2E.EventMessage.location:type_name -> WAWebProtobufsE2E.LocationMessage - 90, // 194: WAWebProtobufsE2E.CommentMessage.message:type_name -> WAWebProtobufsE2E.Message - 209, // 195: WAWebProtobufsE2E.CommentMessage.targetMessageKey:type_name -> WACommon.MessageKey - 209, // 196: WAWebProtobufsE2E.EncCommentMessage.targetMessageKey:type_name -> WACommon.MessageKey - 209, // 197: WAWebProtobufsE2E.EncReactionMessage.targetMessageKey:type_name -> WACommon.MessageKey - 209, // 198: WAWebProtobufsE2E.KeepInChatMessage.key:type_name -> WACommon.MessageKey - 1, // 199: WAWebProtobufsE2E.KeepInChatMessage.keepType:type_name -> WAWebProtobufsE2E.KeepType - 191, // 200: WAWebProtobufsE2E.PollResultSnapshotMessage.pollVotes:type_name -> WAWebProtobufsE2E.PollResultSnapshotMessage.PollVote - 80, // 201: WAWebProtobufsE2E.PollResultSnapshotMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 209, // 202: WAWebProtobufsE2E.PollUpdateMessage.pollCreationMessageKey:type_name -> WACommon.MessageKey - 101, // 203: WAWebProtobufsE2E.PollUpdateMessage.vote:type_name -> WAWebProtobufsE2E.PollEncValue - 102, // 204: WAWebProtobufsE2E.PollUpdateMessage.metadata:type_name -> WAWebProtobufsE2E.PollUpdateMessageMetadata - 192, // 205: WAWebProtobufsE2E.PollCreationMessage.options:type_name -> WAWebProtobufsE2E.PollCreationMessage.Option - 80, // 206: WAWebProtobufsE2E.PollCreationMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 209, // 207: WAWebProtobufsE2E.ReactionMessage.key:type_name -> WACommon.MessageKey - 90, // 208: WAWebProtobufsE2E.FutureProofMessage.message:type_name -> WAWebProtobufsE2E.Message - 90, // 209: WAWebProtobufsE2E.DeviceSentMessage.message:type_name -> WAWebProtobufsE2E.Message - 80, // 210: WAWebProtobufsE2E.RequestPhoneNumberMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 80, // 211: WAWebProtobufsE2E.NewsletterAdminInviteMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 193, // 212: WAWebProtobufsE2E.ProductMessage.product:type_name -> WAWebProtobufsE2E.ProductMessage.ProductSnapshot - 194, // 213: WAWebProtobufsE2E.ProductMessage.catalog:type_name -> WAWebProtobufsE2E.ProductMessage.CatalogSnapshot - 80, // 214: WAWebProtobufsE2E.ProductMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 80, // 215: WAWebProtobufsE2E.TemplateButtonReplyMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 196, // 216: WAWebProtobufsE2E.TemplateMessage.fourRowTemplate:type_name -> WAWebProtobufsE2E.TemplateMessage.FourRowTemplate - 195, // 217: WAWebProtobufsE2E.TemplateMessage.hydratedFourRowTemplate:type_name -> WAWebProtobufsE2E.TemplateMessage.HydratedFourRowTemplate - 65, // 218: WAWebProtobufsE2E.TemplateMessage.interactiveMessageTemplate:type_name -> WAWebProtobufsE2E.InteractiveMessage - 80, // 219: WAWebProtobufsE2E.TemplateMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 195, // 220: WAWebProtobufsE2E.TemplateMessage.hydratedTemplate:type_name -> WAWebProtobufsE2E.TemplateMessage.HydratedFourRowTemplate - 80, // 221: WAWebProtobufsE2E.StickerMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 80, // 222: WAWebProtobufsE2E.LiveLocationMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 209, // 223: WAWebProtobufsE2E.CancelPaymentRequestMessage.key:type_name -> WACommon.MessageKey - 209, // 224: WAWebProtobufsE2E.DeclinePaymentRequestMessage.key:type_name -> WACommon.MessageKey - 90, // 225: WAWebProtobufsE2E.RequestPaymentMessage.noteMessage:type_name -> WAWebProtobufsE2E.Message - 148, // 226: WAWebProtobufsE2E.RequestPaymentMessage.amount:type_name -> WAWebProtobufsE2E.Money - 87, // 227: WAWebProtobufsE2E.RequestPaymentMessage.background:type_name -> WAWebProtobufsE2E.PaymentBackground - 90, // 228: WAWebProtobufsE2E.SendPaymentMessage.noteMessage:type_name -> WAWebProtobufsE2E.Message - 209, // 229: WAWebProtobufsE2E.SendPaymentMessage.requestMessageKey:type_name -> WACommon.MessageKey - 87, // 230: WAWebProtobufsE2E.SendPaymentMessage.background:type_name -> WAWebProtobufsE2E.PaymentBackground - 136, // 231: WAWebProtobufsE2E.ContactsArrayMessage.contacts:type_name -> WAWebProtobufsE2E.ContactMessage - 80, // 232: WAWebProtobufsE2E.ContactsArrayMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 0, // 233: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.peerDataOperationRequestType:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestType - 197, // 234: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.peerDataOperationResult:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult - 0, // 235: WAWebProtobufsE2E.PeerDataOperationRequestMessage.peerDataOperationRequestType:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestType - 205, // 236: WAWebProtobufsE2E.PeerDataOperationRequestMessage.requestStickerReupload:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestMessage.RequestStickerReupload - 204, // 237: WAWebProtobufsE2E.PeerDataOperationRequestMessage.requestURLPreview:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestMessage.RequestUrlPreview - 203, // 238: WAWebProtobufsE2E.PeerDataOperationRequestMessage.historySyncOnDemandRequest:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest - 202, // 239: WAWebProtobufsE2E.PeerDataOperationRequestMessage.placeholderMessageResendRequest:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestMessage.PlaceholderMessageResendRequest - 129, // 240: WAWebProtobufsE2E.AppStateSyncKeyRequest.keyIDs:type_name -> WAWebProtobufsE2E.AppStateSyncKeyId - 130, // 241: WAWebProtobufsE2E.AppStateSyncKeyShare.keys:type_name -> WAWebProtobufsE2E.AppStateSyncKey - 128, // 242: WAWebProtobufsE2E.AppStateSyncKeyData.fingerprint:type_name -> WAWebProtobufsE2E.AppStateSyncKeyFingerprint - 129, // 243: WAWebProtobufsE2E.AppStateSyncKey.keyID:type_name -> WAWebProtobufsE2E.AppStateSyncKeyId - 127, // 244: WAWebProtobufsE2E.AppStateSyncKey.keyData:type_name -> WAWebProtobufsE2E.AppStateSyncKeyData - 80, // 245: WAWebProtobufsE2E.AudioMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 80, // 246: WAWebProtobufsE2E.DocumentMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 80, // 247: WAWebProtobufsE2E.LocationMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 80, // 248: WAWebProtobufsE2E.ContactMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo - 140, // 249: WAWebProtobufsE2E.BotMemuMetadata.faceImages:type_name -> WAWebProtobufsE2E.BotMediaMetadata - 138, // 250: WAWebProtobufsE2E.BotMetadata.avatarMetadata:type_name -> WAWebProtobufsE2E.BotAvatarMetadata - 81, // 251: WAWebProtobufsE2E.BotMetadata.pluginMetadata:type_name -> WAWebProtobufsE2E.BotPluginMetadata - 139, // 252: WAWebProtobufsE2E.BotMetadata.suggestedPromptMetadata:type_name -> WAWebProtobufsE2E.BotSuggestedPromptMetadata - 82, // 253: WAWebProtobufsE2E.BotMetadata.searchMetadata:type_name -> WAWebProtobufsE2E.BotSearchMetadata - 141, // 254: WAWebProtobufsE2E.BotMetadata.memuMetadata:type_name -> WAWebProtobufsE2E.BotMemuMetadata - 83, // 255: WAWebProtobufsE2E.BotMetadata.reminderMetadata:type_name -> WAWebProtobufsE2E.BotReminderMetadata - 210, // 256: WAWebProtobufsE2E.DeviceListMetadata.senderAccountType:type_name -> WAAdv.ADVEncryptionType - 210, // 257: WAWebProtobufsE2E.DeviceListMetadata.receiverAccountType:type_name -> WAAdv.ADVEncryptionType - 146, // 258: WAWebProtobufsE2E.InteractiveAnnotation.location:type_name -> WAWebProtobufsE2E.Location - 180, // 259: WAWebProtobufsE2E.InteractiveAnnotation.newsletter:type_name -> WAWebProtobufsE2E.ContextInfo.ForwardedNewsletterMessageInfo - 145, // 260: WAWebProtobufsE2E.InteractiveAnnotation.polygonVertices:type_name -> WAWebProtobufsE2E.Point - 208, // 261: WAWebProtobufsE2E.TemplateButton.quickReplyButton:type_name -> WAWebProtobufsE2E.TemplateButton.QuickReplyButton - 207, // 262: WAWebProtobufsE2E.TemplateButton.urlButton:type_name -> WAWebProtobufsE2E.TemplateButton.URLButton - 206, // 263: WAWebProtobufsE2E.TemplateButton.callButton:type_name -> WAWebProtobufsE2E.TemplateButton.CallButton - 4, // 264: WAWebProtobufsE2E.CallLogMessage.CallParticipant.callOutcome:type_name -> WAWebProtobufsE2E.CallLogMessage.CallOutcome - 157, // 265: WAWebProtobufsE2E.ButtonsMessage.Button.buttonText:type_name -> WAWebProtobufsE2E.ButtonsMessage.Button.ButtonText - 12, // 266: WAWebProtobufsE2E.ButtonsMessage.Button.type:type_name -> WAWebProtobufsE2E.ButtonsMessage.Button.Type - 156, // 267: WAWebProtobufsE2E.ButtonsMessage.Button.nativeFlowInfo:type_name -> WAWebProtobufsE2E.ButtonsMessage.Button.NativeFlowInfo - 15, // 268: WAWebProtobufsE2E.InteractiveResponseMessage.Body.format:type_name -> WAWebProtobufsE2E.InteractiveResponseMessage.Body.Format - 16, // 269: WAWebProtobufsE2E.InteractiveMessage.ShopMessage.surface:type_name -> WAWebProtobufsE2E.InteractiveMessage.ShopMessage.Surface - 65, // 270: WAWebProtobufsE2E.InteractiveMessage.CarouselMessage.cards:type_name -> WAWebProtobufsE2E.InteractiveMessage - 167, // 271: WAWebProtobufsE2E.InteractiveMessage.NativeFlowMessage.buttons:type_name -> WAWebProtobufsE2E.InteractiveMessage.NativeFlowMessage.NativeFlowButton - 134, // 272: WAWebProtobufsE2E.InteractiveMessage.Header.documentMessage:type_name -> WAWebProtobufsE2E.DocumentMessage - 79, // 273: WAWebProtobufsE2E.InteractiveMessage.Header.imageMessage:type_name -> WAWebProtobufsE2E.ImageMessage - 76, // 274: WAWebProtobufsE2E.InteractiveMessage.Header.videoMessage:type_name -> WAWebProtobufsE2E.VideoMessage - 135, // 275: WAWebProtobufsE2E.InteractiveMessage.Header.locationMessage:type_name -> WAWebProtobufsE2E.LocationMessage - 111, // 276: WAWebProtobufsE2E.InteractiveMessage.Header.productMessage:type_name -> WAWebProtobufsE2E.ProductMessage - 171, // 277: WAWebProtobufsE2E.ListMessage.ProductListInfo.productSections:type_name -> WAWebProtobufsE2E.ListMessage.ProductSection - 170, // 278: WAWebProtobufsE2E.ListMessage.ProductListInfo.headerImage:type_name -> WAWebProtobufsE2E.ListMessage.ProductListHeaderImage - 172, // 279: WAWebProtobufsE2E.ListMessage.ProductSection.products:type_name -> WAWebProtobufsE2E.ListMessage.Product - 174, // 280: WAWebProtobufsE2E.ListMessage.Section.rows:type_name -> WAWebProtobufsE2E.ListMessage.Row - 177, // 281: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.currency:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency - 176, // 282: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.dateTime:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime - 178, // 283: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.component:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent - 179, // 284: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.unixEpoch:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch - 23, // 285: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.dayOfWeek:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.DayOfWeekType - 22, // 286: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.calendar:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.CalendarType - 38, // 287: WAWebProtobufsE2E.ContextInfo.ForwardedNewsletterMessageInfo.contentType:type_name -> WAWebProtobufsE2E.ContextInfo.ForwardedNewsletterMessageInfo.ContentType - 39, // 288: WAWebProtobufsE2E.ContextInfo.ExternalAdReplyInfo.mediaType:type_name -> WAWebProtobufsE2E.ContextInfo.ExternalAdReplyInfo.MediaType - 40, // 289: WAWebProtobufsE2E.ContextInfo.AdReplyInfo.mediaType:type_name -> WAWebProtobufsE2E.ContextInfo.AdReplyInfo.MediaType - 48, // 290: WAWebProtobufsE2E.HydratedTemplateButton.HydratedURLButton.webviewPresentation:type_name -> WAWebProtobufsE2E.HydratedTemplateButton.HydratedURLButton.WebviewPresentationType - 79, // 291: WAWebProtobufsE2E.ProductMessage.ProductSnapshot.productImage:type_name -> WAWebProtobufsE2E.ImageMessage - 79, // 292: WAWebProtobufsE2E.ProductMessage.CatalogSnapshot.catalogImage:type_name -> WAWebProtobufsE2E.ImageMessage - 134, // 293: WAWebProtobufsE2E.TemplateMessage.HydratedFourRowTemplate.documentMessage:type_name -> WAWebProtobufsE2E.DocumentMessage - 79, // 294: WAWebProtobufsE2E.TemplateMessage.HydratedFourRowTemplate.imageMessage:type_name -> WAWebProtobufsE2E.ImageMessage - 76, // 295: WAWebProtobufsE2E.TemplateMessage.HydratedFourRowTemplate.videoMessage:type_name -> WAWebProtobufsE2E.VideoMessage - 135, // 296: WAWebProtobufsE2E.TemplateMessage.HydratedFourRowTemplate.locationMessage:type_name -> WAWebProtobufsE2E.LocationMessage - 86, // 297: WAWebProtobufsE2E.TemplateMessage.HydratedFourRowTemplate.hydratedButtons:type_name -> WAWebProtobufsE2E.HydratedTemplateButton - 134, // 298: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate.documentMessage:type_name -> WAWebProtobufsE2E.DocumentMessage - 70, // 299: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate.highlyStructuredMessage:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage - 79, // 300: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate.imageMessage:type_name -> WAWebProtobufsE2E.ImageMessage - 76, // 301: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate.videoMessage:type_name -> WAWebProtobufsE2E.VideoMessage - 135, // 302: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate.locationMessage:type_name -> WAWebProtobufsE2E.LocationMessage - 70, // 303: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate.content:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage - 70, // 304: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate.footer:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage - 147, // 305: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate.buttons:type_name -> WAWebProtobufsE2E.TemplateButton - 211, // 306: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.mediaUploadResult:type_name -> WAMmsRetry.MediaRetryNotification.ResultType - 114, // 307: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.stickerMessage:type_name -> WAWebProtobufsE2E.StickerMessage - 200, // 308: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.linkPreviewResponse:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse - 199, // 309: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.placeholderMessageResendResponse:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.PlaceholderMessageResendResponse - 198, // 310: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.waffleNonceFetchRequestResponse:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.WaffleNonceFetchResponse - 201, // 311: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.hqThumbnail:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.LinkPreviewHighQualityThumbnail - 209, // 312: WAWebProtobufsE2E.PeerDataOperationRequestMessage.PlaceholderMessageResendRequest.messageKey:type_name -> WACommon.MessageKey - 70, // 313: WAWebProtobufsE2E.TemplateButton.CallButton.displayText:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage - 70, // 314: WAWebProtobufsE2E.TemplateButton.CallButton.phoneNumber:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage - 70, // 315: WAWebProtobufsE2E.TemplateButton.URLButton.displayText:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage - 70, // 316: WAWebProtobufsE2E.TemplateButton.URLButton.URL:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage - 70, // 317: WAWebProtobufsE2E.TemplateButton.QuickReplyButton.displayText:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage - 318, // [318:318] is the sub-list for method output_type - 318, // [318:318] is the sub-list for method input_type - 318, // [318:318] is the sub-list for extension type_name - 318, // [318:318] is the sub-list for extension extendee - 0, // [0:318] is the sub-list for field type_name + 3, // 0: WAWebProtobufsE2E.PlaceholderMessage.type:type_name -> WAWebProtobufsE2E.PlaceholderMessage.PlaceholderType + 4, // 1: WAWebProtobufsE2E.BCallMessage.mediaType:type_name -> WAWebProtobufsE2E.BCallMessage.MediaType + 5, // 2: WAWebProtobufsE2E.CallLogMessage.callOutcome:type_name -> WAWebProtobufsE2E.CallLogMessage.CallOutcome + 6, // 3: WAWebProtobufsE2E.CallLogMessage.callType:type_name -> WAWebProtobufsE2E.CallLogMessage.CallType + 165, // 4: WAWebProtobufsE2E.CallLogMessage.participants:type_name -> WAWebProtobufsE2E.CallLogMessage.CallParticipant + 224, // 5: WAWebProtobufsE2E.ScheduledCallEditMessage.key:type_name -> WACommon.MessageKey + 7, // 6: WAWebProtobufsE2E.ScheduledCallEditMessage.editType:type_name -> WAWebProtobufsE2E.ScheduledCallEditMessage.EditType + 8, // 7: WAWebProtobufsE2E.ScheduledCallCreationMessage.callType:type_name -> WAWebProtobufsE2E.ScheduledCallCreationMessage.CallType + 9, // 8: WAWebProtobufsE2E.EventResponseMessage.response:type_name -> WAWebProtobufsE2E.EventResponseMessage.EventResponseType + 224, // 9: WAWebProtobufsE2E.PinInChatMessage.key:type_name -> WACommon.MessageKey + 10, // 10: WAWebProtobufsE2E.PinInChatMessage.type:type_name -> WAWebProtobufsE2E.PinInChatMessage.Type + 85, // 11: WAWebProtobufsE2E.ButtonsResponseMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 11, // 12: WAWebProtobufsE2E.ButtonsResponseMessage.type:type_name -> WAWebProtobufsE2E.ButtonsResponseMessage.Type + 141, // 13: WAWebProtobufsE2E.ButtonsMessage.documentMessage:type_name -> WAWebProtobufsE2E.DocumentMessage + 84, // 14: WAWebProtobufsE2E.ButtonsMessage.imageMessage:type_name -> WAWebProtobufsE2E.ImageMessage + 81, // 15: WAWebProtobufsE2E.ButtonsMessage.videoMessage:type_name -> WAWebProtobufsE2E.VideoMessage + 142, // 16: WAWebProtobufsE2E.ButtonsMessage.locationMessage:type_name -> WAWebProtobufsE2E.LocationMessage + 85, // 17: WAWebProtobufsE2E.ButtonsMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 166, // 18: WAWebProtobufsE2E.ButtonsMessage.buttons:type_name -> WAWebProtobufsE2E.ButtonsMessage.Button + 12, // 19: WAWebProtobufsE2E.ButtonsMessage.headerType:type_name -> WAWebProtobufsE2E.ButtonsMessage.HeaderType + 224, // 20: WAWebProtobufsE2E.SecretEncryptedMessage.targetMessageKey:type_name -> WACommon.MessageKey + 14, // 21: WAWebProtobufsE2E.SecretEncryptedMessage.secretEncType:type_name -> WAWebProtobufsE2E.SecretEncryptedMessage.SecretEncType + 85, // 22: WAWebProtobufsE2E.GroupInviteMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 15, // 23: WAWebProtobufsE2E.GroupInviteMessage.groupType:type_name -> WAWebProtobufsE2E.GroupInviteMessage.GroupType + 170, // 24: WAWebProtobufsE2E.InteractiveResponseMessage.nativeFlowResponseMessage:type_name -> WAWebProtobufsE2E.InteractiveResponseMessage.NativeFlowResponseMessage + 169, // 25: WAWebProtobufsE2E.InteractiveResponseMessage.body:type_name -> WAWebProtobufsE2E.InteractiveResponseMessage.Body + 85, // 26: WAWebProtobufsE2E.InteractiveResponseMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 171, // 27: WAWebProtobufsE2E.InteractiveMessage.shopStorefrontMessage:type_name -> WAWebProtobufsE2E.InteractiveMessage.ShopMessage + 174, // 28: WAWebProtobufsE2E.InteractiveMessage.collectionMessage:type_name -> WAWebProtobufsE2E.InteractiveMessage.CollectionMessage + 173, // 29: WAWebProtobufsE2E.InteractiveMessage.nativeFlowMessage:type_name -> WAWebProtobufsE2E.InteractiveMessage.NativeFlowMessage + 172, // 30: WAWebProtobufsE2E.InteractiveMessage.carouselMessage:type_name -> WAWebProtobufsE2E.InteractiveMessage.CarouselMessage + 177, // 31: WAWebProtobufsE2E.InteractiveMessage.header:type_name -> WAWebProtobufsE2E.InteractiveMessage.Header + 176, // 32: WAWebProtobufsE2E.InteractiveMessage.body:type_name -> WAWebProtobufsE2E.InteractiveMessage.Body + 175, // 33: WAWebProtobufsE2E.InteractiveMessage.footer:type_name -> WAWebProtobufsE2E.InteractiveMessage.Footer + 85, // 34: WAWebProtobufsE2E.InteractiveMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 18, // 35: WAWebProtobufsE2E.ListResponseMessage.listType:type_name -> WAWebProtobufsE2E.ListResponseMessage.ListType + 179, // 36: WAWebProtobufsE2E.ListResponseMessage.singleSelectReply:type_name -> WAWebProtobufsE2E.ListResponseMessage.SingleSelectReply + 85, // 37: WAWebProtobufsE2E.ListResponseMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 19, // 38: WAWebProtobufsE2E.ListMessage.listType:type_name -> WAWebProtobufsE2E.ListMessage.ListType + 184, // 39: WAWebProtobufsE2E.ListMessage.sections:type_name -> WAWebProtobufsE2E.ListMessage.Section + 180, // 40: WAWebProtobufsE2E.ListMessage.productListInfo:type_name -> WAWebProtobufsE2E.ListMessage.ProductListInfo + 85, // 41: WAWebProtobufsE2E.ListMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 21, // 42: WAWebProtobufsE2E.OrderMessage.status:type_name -> WAWebProtobufsE2E.OrderMessage.OrderStatus + 20, // 43: WAWebProtobufsE2E.OrderMessage.surface:type_name -> WAWebProtobufsE2E.OrderMessage.OrderSurface + 85, // 44: WAWebProtobufsE2E.OrderMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 224, // 45: WAWebProtobufsE2E.OrderMessage.orderRequestMessageID:type_name -> WACommon.MessageKey + 22, // 46: WAWebProtobufsE2E.PaymentInviteMessage.serviceType:type_name -> WAWebProtobufsE2E.PaymentInviteMessage.ServiceType + 186, // 47: WAWebProtobufsE2E.HighlyStructuredMessage.localizableParams:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter + 120, // 48: WAWebProtobufsE2E.HighlyStructuredMessage.hydratedHsm:type_name -> WAWebProtobufsE2E.TemplateMessage + 0, // 49: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.peerDataOperationRequestType:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestType + 191, // 50: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.peerDataOperationResult:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + 26, // 51: WAWebProtobufsE2E.HistorySyncNotification.syncType:type_name -> WAWebProtobufsE2E.HistorySyncNotification.HistorySyncType + 130, // 52: WAWebProtobufsE2E.HistorySyncNotification.fullHistorySyncOnDemandRequestMetadata:type_name -> WAWebProtobufsE2E.FullHistorySyncOnDemandRequestMetadata + 27, // 53: WAWebProtobufsE2E.RequestWelcomeMessageMetadata.localChatState:type_name -> WAWebProtobufsE2E.RequestWelcomeMessageMetadata.LocalChatState + 224, // 54: WAWebProtobufsE2E.ProtocolMessage.key:type_name -> WACommon.MessageKey + 28, // 55: WAWebProtobufsE2E.ProtocolMessage.type:type_name -> WAWebProtobufsE2E.ProtocolMessage.Type + 76, // 56: WAWebProtobufsE2E.ProtocolMessage.historySyncNotification:type_name -> WAWebProtobufsE2E.HistorySyncNotification + 133, // 57: WAWebProtobufsE2E.ProtocolMessage.appStateSyncKeyShare:type_name -> WAWebProtobufsE2E.AppStateSyncKeyShare + 132, // 58: WAWebProtobufsE2E.ProtocolMessage.appStateSyncKeyRequest:type_name -> WAWebProtobufsE2E.AppStateSyncKeyRequest + 128, // 59: WAWebProtobufsE2E.ProtocolMessage.initialSecurityNotificationSettingSync:type_name -> WAWebProtobufsE2E.InitialSecurityNotificationSettingSync + 131, // 60: WAWebProtobufsE2E.ProtocolMessage.appStateFatalExceptionNotification:type_name -> WAWebProtobufsE2E.AppStateFatalExceptionNotification + 94, // 61: WAWebProtobufsE2E.ProtocolMessage.disappearingMode:type_name -> WAWebProtobufsE2E.DisappearingMode + 96, // 62: WAWebProtobufsE2E.ProtocolMessage.editedMessage:type_name -> WAWebProtobufsE2E.Message + 129, // 63: WAWebProtobufsE2E.ProtocolMessage.peerDataOperationRequestMessage:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestMessage + 75, // 64: WAWebProtobufsE2E.ProtocolMessage.peerDataOperationRequestResponseMessage:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage + 80, // 65: WAWebProtobufsE2E.ProtocolMessage.botFeedbackMessage:type_name -> WAWebProtobufsE2E.BotFeedbackMessage + 77, // 66: WAWebProtobufsE2E.ProtocolMessage.requestWelcomeMessageMetadata:type_name -> WAWebProtobufsE2E.RequestWelcomeMessageMetadata + 163, // 67: WAWebProtobufsE2E.ProtocolMessage.mediaNotifyMessage:type_name -> WAWebProtobufsE2E.MediaNotifyMessage + 79, // 68: WAWebProtobufsE2E.ProtocolMessage.cloudApiThreadControlNotification:type_name -> WAWebProtobufsE2E.CloudAPIThreadControlNotification + 164, // 69: WAWebProtobufsE2E.ProtocolMessage.lidMigrationMappingSyncMessage:type_name -> WAWebProtobufsE2E.LIDMigrationMappingSyncMessage + 29, // 70: WAWebProtobufsE2E.CloudAPIThreadControlNotification.status:type_name -> WAWebProtobufsE2E.CloudAPIThreadControlNotification.CloudAPIThreadControl + 224, // 71: WAWebProtobufsE2E.BotFeedbackMessage.messageKey:type_name -> WACommon.MessageKey + 33, // 72: WAWebProtobufsE2E.BotFeedbackMessage.kind:type_name -> WAWebProtobufsE2E.BotFeedbackMessage.BotFeedbackKind + 30, // 73: WAWebProtobufsE2E.BotFeedbackMessage.kindReport:type_name -> WAWebProtobufsE2E.BotFeedbackMessage.ReportKind + 155, // 74: WAWebProtobufsE2E.VideoMessage.interactiveAnnotations:type_name -> WAWebProtobufsE2E.InteractiveAnnotation + 85, // 75: WAWebProtobufsE2E.VideoMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 34, // 76: WAWebProtobufsE2E.VideoMessage.gifAttribution:type_name -> WAWebProtobufsE2E.VideoMessage.Attribution + 155, // 77: WAWebProtobufsE2E.VideoMessage.annotations:type_name -> WAWebProtobufsE2E.InteractiveAnnotation + 95, // 78: WAWebProtobufsE2E.VideoMessage.processedVideos:type_name -> WAWebProtobufsE2E.ProcessedVideo + 37, // 79: WAWebProtobufsE2E.ExtendedTextMessage.font:type_name -> WAWebProtobufsE2E.ExtendedTextMessage.FontType + 36, // 80: WAWebProtobufsE2E.ExtendedTextMessage.previewType:type_name -> WAWebProtobufsE2E.ExtendedTextMessage.PreviewType + 85, // 81: WAWebProtobufsE2E.ExtendedTextMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 35, // 82: WAWebProtobufsE2E.ExtendedTextMessage.inviteLinkGroupType:type_name -> WAWebProtobufsE2E.ExtendedTextMessage.InviteLinkGroupType + 35, // 83: WAWebProtobufsE2E.ExtendedTextMessage.inviteLinkGroupTypeV2:type_name -> WAWebProtobufsE2E.ExtendedTextMessage.InviteLinkGroupType + 38, // 84: WAWebProtobufsE2E.InvoiceMessage.attachmentType:type_name -> WAWebProtobufsE2E.InvoiceMessage.AttachmentType + 155, // 85: WAWebProtobufsE2E.ImageMessage.interactiveAnnotations:type_name -> WAWebProtobufsE2E.InteractiveAnnotation + 85, // 86: WAWebProtobufsE2E.ImageMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 155, // 87: WAWebProtobufsE2E.ImageMessage.annotations:type_name -> WAWebProtobufsE2E.InteractiveAnnotation + 39, // 88: WAWebProtobufsE2E.ImageMessage.imageSourceType:type_name -> WAWebProtobufsE2E.ImageMessage.ImageSourceType + 96, // 89: WAWebProtobufsE2E.ContextInfo.quotedMessage:type_name -> WAWebProtobufsE2E.Message + 199, // 90: WAWebProtobufsE2E.ContextInfo.quotedAd:type_name -> WAWebProtobufsE2E.ContextInfo.AdReplyInfo + 224, // 91: WAWebProtobufsE2E.ContextInfo.placeholderKey:type_name -> WACommon.MessageKey + 198, // 92: WAWebProtobufsE2E.ContextInfo.externalAdReply:type_name -> WAWebProtobufsE2E.ContextInfo.ExternalAdReplyInfo + 94, // 93: WAWebProtobufsE2E.ContextInfo.disappearingMode:type_name -> WAWebProtobufsE2E.DisappearingMode + 160, // 94: WAWebProtobufsE2E.ContextInfo.actionLink:type_name -> WAWebProtobufsE2E.ActionLink + 161, // 95: WAWebProtobufsE2E.ContextInfo.groupMentions:type_name -> WAWebProtobufsE2E.GroupMention + 202, // 96: WAWebProtobufsE2E.ContextInfo.utm:type_name -> WAWebProtobufsE2E.ContextInfo.UTMInfo + 197, // 97: WAWebProtobufsE2E.ContextInfo.forwardedNewsletterMessageInfo:type_name -> WAWebProtobufsE2E.ContextInfo.ForwardedNewsletterMessageInfo + 203, // 98: WAWebProtobufsE2E.ContextInfo.businessMessageForwardInfo:type_name -> WAWebProtobufsE2E.ContextInfo.BusinessMessageForwardInfo + 201, // 99: WAWebProtobufsE2E.ContextInfo.dataSharingContext:type_name -> WAWebProtobufsE2E.ContextInfo.DataSharingContext + 200, // 100: WAWebProtobufsE2E.ContextInfo.featureEligibilities:type_name -> WAWebProtobufsE2E.ContextInfo.FeatureEligibilities + 44, // 101: WAWebProtobufsE2E.BotPluginMetadata.provider:type_name -> WAWebProtobufsE2E.BotPluginMetadata.SearchProvider + 43, // 102: WAWebProtobufsE2E.BotPluginMetadata.pluginType:type_name -> WAWebProtobufsE2E.BotPluginMetadata.PluginType + 224, // 103: WAWebProtobufsE2E.BotPluginMetadata.parentPluginMessageKey:type_name -> WACommon.MessageKey + 43, // 104: WAWebProtobufsE2E.BotPluginMetadata.deprecatedField:type_name -> WAWebProtobufsE2E.BotPluginMetadata.PluginType + 43, // 105: WAWebProtobufsE2E.BotPluginMetadata.parentPluginType:type_name -> WAWebProtobufsE2E.BotPluginMetadata.PluginType + 45, // 106: WAWebProtobufsE2E.BotMediaMetadata.orientationType:type_name -> WAWebProtobufsE2E.BotMediaMetadata.OrientationType + 224, // 107: WAWebProtobufsE2E.BotReminderMetadata.requestMessageKey:type_name -> WACommon.MessageKey + 47, // 108: WAWebProtobufsE2E.BotReminderMetadata.action:type_name -> WAWebProtobufsE2E.BotReminderMetadata.ReminderAction + 46, // 109: WAWebProtobufsE2E.BotReminderMetadata.frequency:type_name -> WAWebProtobufsE2E.BotReminderMetadata.ReminderFrequency + 49, // 110: WAWebProtobufsE2E.BotModelMetadata.modelType:type_name -> WAWebProtobufsE2E.BotModelMetadata.ModelType + 48, // 111: WAWebProtobufsE2E.BotModelMetadata.premiumModelStatus:type_name -> WAWebProtobufsE2E.BotModelMetadata.PremiumModelStatus + 50, // 112: WAWebProtobufsE2E.MessageAssociation.associationType:type_name -> WAWebProtobufsE2E.MessageAssociation.AssociationType + 224, // 113: WAWebProtobufsE2E.MessageAssociation.parentMessageKey:type_name -> WACommon.MessageKey + 151, // 114: WAWebProtobufsE2E.MessageContextInfo.deviceListMetadata:type_name -> WAWebProtobufsE2E.DeviceListMetadata + 150, // 115: WAWebProtobufsE2E.MessageContextInfo.botMetadata:type_name -> WAWebProtobufsE2E.BotMetadata + 51, // 116: WAWebProtobufsE2E.MessageContextInfo.messageAddOnExpiryType:type_name -> WAWebProtobufsE2E.MessageContextInfo.MessageAddonExpiryType + 90, // 117: WAWebProtobufsE2E.MessageContextInfo.messageAssociation:type_name -> WAWebProtobufsE2E.MessageAssociation + 207, // 118: WAWebProtobufsE2E.HydratedTemplateButton.quickReplyButton:type_name -> WAWebProtobufsE2E.HydratedTemplateButton.HydratedQuickReplyButton + 205, // 119: WAWebProtobufsE2E.HydratedTemplateButton.urlButton:type_name -> WAWebProtobufsE2E.HydratedTemplateButton.HydratedURLButton + 206, // 120: WAWebProtobufsE2E.HydratedTemplateButton.callButton:type_name -> WAWebProtobufsE2E.HydratedTemplateButton.HydratedCallButton + 208, // 121: WAWebProtobufsE2E.PaymentBackground.mediaData:type_name -> WAWebProtobufsE2E.PaymentBackground.MediaData + 53, // 122: WAWebProtobufsE2E.PaymentBackground.type:type_name -> WAWebProtobufsE2E.PaymentBackground.Type + 55, // 123: WAWebProtobufsE2E.DisappearingMode.initiator:type_name -> WAWebProtobufsE2E.DisappearingMode.Initiator + 54, // 124: WAWebProtobufsE2E.DisappearingMode.trigger:type_name -> WAWebProtobufsE2E.DisappearingMode.Trigger + 56, // 125: WAWebProtobufsE2E.ProcessedVideo.quality:type_name -> WAWebProtobufsE2E.ProcessedVideo.VideoQuality + 144, // 126: WAWebProtobufsE2E.Message.senderKeyDistributionMessage:type_name -> WAWebProtobufsE2E.SenderKeyDistributionMessage + 84, // 127: WAWebProtobufsE2E.Message.imageMessage:type_name -> WAWebProtobufsE2E.ImageMessage + 143, // 128: WAWebProtobufsE2E.Message.contactMessage:type_name -> WAWebProtobufsE2E.ContactMessage + 142, // 129: WAWebProtobufsE2E.Message.locationMessage:type_name -> WAWebProtobufsE2E.LocationMessage + 82, // 130: WAWebProtobufsE2E.Message.extendedTextMessage:type_name -> WAWebProtobufsE2E.ExtendedTextMessage + 141, // 131: WAWebProtobufsE2E.Message.documentMessage:type_name -> WAWebProtobufsE2E.DocumentMessage + 140, // 132: WAWebProtobufsE2E.Message.audioMessage:type_name -> WAWebProtobufsE2E.AudioMessage + 81, // 133: WAWebProtobufsE2E.Message.videoMessage:type_name -> WAWebProtobufsE2E.VideoMessage + 139, // 134: WAWebProtobufsE2E.Message.call:type_name -> WAWebProtobufsE2E.Call + 138, // 135: WAWebProtobufsE2E.Message.chat:type_name -> WAWebProtobufsE2E.Chat + 78, // 136: WAWebProtobufsE2E.Message.protocolMessage:type_name -> WAWebProtobufsE2E.ProtocolMessage + 127, // 137: WAWebProtobufsE2E.Message.contactsArrayMessage:type_name -> WAWebProtobufsE2E.ContactsArrayMessage + 74, // 138: WAWebProtobufsE2E.Message.highlyStructuredMessage:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage + 144, // 139: WAWebProtobufsE2E.Message.fastRatchetKeySenderKeyDistributionMessage:type_name -> WAWebProtobufsE2E.SenderKeyDistributionMessage + 126, // 140: WAWebProtobufsE2E.Message.sendPaymentMessage:type_name -> WAWebProtobufsE2E.SendPaymentMessage + 122, // 141: WAWebProtobufsE2E.Message.liveLocationMessage:type_name -> WAWebProtobufsE2E.LiveLocationMessage + 125, // 142: WAWebProtobufsE2E.Message.requestPaymentMessage:type_name -> WAWebProtobufsE2E.RequestPaymentMessage + 124, // 143: WAWebProtobufsE2E.Message.declinePaymentRequestMessage:type_name -> WAWebProtobufsE2E.DeclinePaymentRequestMessage + 123, // 144: WAWebProtobufsE2E.Message.cancelPaymentRequestMessage:type_name -> WAWebProtobufsE2E.CancelPaymentRequestMessage + 120, // 145: WAWebProtobufsE2E.Message.templateMessage:type_name -> WAWebProtobufsE2E.TemplateMessage + 121, // 146: WAWebProtobufsE2E.Message.stickerMessage:type_name -> WAWebProtobufsE2E.StickerMessage + 67, // 147: WAWebProtobufsE2E.Message.groupInviteMessage:type_name -> WAWebProtobufsE2E.GroupInviteMessage + 119, // 148: WAWebProtobufsE2E.Message.templateButtonReplyMessage:type_name -> WAWebProtobufsE2E.TemplateButtonReplyMessage + 118, // 149: WAWebProtobufsE2E.Message.productMessage:type_name -> WAWebProtobufsE2E.ProductMessage + 115, // 150: WAWebProtobufsE2E.Message.deviceSentMessage:type_name -> WAWebProtobufsE2E.DeviceSentMessage + 91, // 151: WAWebProtobufsE2E.Message.messageContextInfo:type_name -> WAWebProtobufsE2E.MessageContextInfo + 71, // 152: WAWebProtobufsE2E.Message.listMessage:type_name -> WAWebProtobufsE2E.ListMessage + 114, // 153: WAWebProtobufsE2E.Message.viewOnceMessage:type_name -> WAWebProtobufsE2E.FutureProofMessage + 72, // 154: WAWebProtobufsE2E.Message.orderMessage:type_name -> WAWebProtobufsE2E.OrderMessage + 70, // 155: WAWebProtobufsE2E.Message.listResponseMessage:type_name -> WAWebProtobufsE2E.ListResponseMessage + 114, // 156: WAWebProtobufsE2E.Message.ephemeralMessage:type_name -> WAWebProtobufsE2E.FutureProofMessage + 83, // 157: WAWebProtobufsE2E.Message.invoiceMessage:type_name -> WAWebProtobufsE2E.InvoiceMessage + 65, // 158: WAWebProtobufsE2E.Message.buttonsMessage:type_name -> WAWebProtobufsE2E.ButtonsMessage + 64, // 159: WAWebProtobufsE2E.Message.buttonsResponseMessage:type_name -> WAWebProtobufsE2E.ButtonsResponseMessage + 73, // 160: WAWebProtobufsE2E.Message.paymentInviteMessage:type_name -> WAWebProtobufsE2E.PaymentInviteMessage + 69, // 161: WAWebProtobufsE2E.Message.interactiveMessage:type_name -> WAWebProtobufsE2E.InteractiveMessage + 113, // 162: WAWebProtobufsE2E.Message.reactionMessage:type_name -> WAWebProtobufsE2E.ReactionMessage + 112, // 163: WAWebProtobufsE2E.Message.stickerSyncRmrMessage:type_name -> WAWebProtobufsE2E.StickerSyncRMRMessage + 68, // 164: WAWebProtobufsE2E.Message.interactiveResponseMessage:type_name -> WAWebProtobufsE2E.InteractiveResponseMessage + 111, // 165: WAWebProtobufsE2E.Message.pollCreationMessage:type_name -> WAWebProtobufsE2E.PollCreationMessage + 110, // 166: WAWebProtobufsE2E.Message.pollUpdateMessage:type_name -> WAWebProtobufsE2E.PollUpdateMessage + 105, // 167: WAWebProtobufsE2E.Message.keepInChatMessage:type_name -> WAWebProtobufsE2E.KeepInChatMessage + 114, // 168: WAWebProtobufsE2E.Message.documentWithCaptionMessage:type_name -> WAWebProtobufsE2E.FutureProofMessage + 116, // 169: WAWebProtobufsE2E.Message.requestPhoneNumberMessage:type_name -> WAWebProtobufsE2E.RequestPhoneNumberMessage + 114, // 170: WAWebProtobufsE2E.Message.viewOnceMessageV2:type_name -> WAWebProtobufsE2E.FutureProofMessage + 104, // 171: WAWebProtobufsE2E.Message.encReactionMessage:type_name -> WAWebProtobufsE2E.EncReactionMessage + 114, // 172: WAWebProtobufsE2E.Message.editedMessage:type_name -> WAWebProtobufsE2E.FutureProofMessage + 114, // 173: WAWebProtobufsE2E.Message.viewOnceMessageV2Extension:type_name -> WAWebProtobufsE2E.FutureProofMessage + 111, // 174: WAWebProtobufsE2E.Message.pollCreationMessageV2:type_name -> WAWebProtobufsE2E.PollCreationMessage + 61, // 175: WAWebProtobufsE2E.Message.scheduledCallCreationMessage:type_name -> WAWebProtobufsE2E.ScheduledCallCreationMessage + 114, // 176: WAWebProtobufsE2E.Message.groupMentionedMessage:type_name -> WAWebProtobufsE2E.FutureProofMessage + 63, // 177: WAWebProtobufsE2E.Message.pinInChatMessage:type_name -> WAWebProtobufsE2E.PinInChatMessage + 111, // 178: WAWebProtobufsE2E.Message.pollCreationMessageV3:type_name -> WAWebProtobufsE2E.PollCreationMessage + 60, // 179: WAWebProtobufsE2E.Message.scheduledCallEditMessage:type_name -> WAWebProtobufsE2E.ScheduledCallEditMessage + 81, // 180: WAWebProtobufsE2E.Message.ptvMessage:type_name -> WAWebProtobufsE2E.VideoMessage + 114, // 181: WAWebProtobufsE2E.Message.botInvokeMessage:type_name -> WAWebProtobufsE2E.FutureProofMessage + 59, // 182: WAWebProtobufsE2E.Message.callLogMesssage:type_name -> WAWebProtobufsE2E.CallLogMessage + 99, // 183: WAWebProtobufsE2E.Message.messageHistoryBundle:type_name -> WAWebProtobufsE2E.MessageHistoryBundle + 103, // 184: WAWebProtobufsE2E.Message.encCommentMessage:type_name -> WAWebProtobufsE2E.EncCommentMessage + 58, // 185: WAWebProtobufsE2E.Message.bcallMessage:type_name -> WAWebProtobufsE2E.BCallMessage + 114, // 186: WAWebProtobufsE2E.Message.lottieStickerMessage:type_name -> WAWebProtobufsE2E.FutureProofMessage + 101, // 187: WAWebProtobufsE2E.Message.eventMessage:type_name -> WAWebProtobufsE2E.EventMessage + 100, // 188: WAWebProtobufsE2E.Message.encEventResponseMessage:type_name -> WAWebProtobufsE2E.EncEventResponseMessage + 102, // 189: WAWebProtobufsE2E.Message.commentMessage:type_name -> WAWebProtobufsE2E.CommentMessage + 117, // 190: WAWebProtobufsE2E.Message.newsletterAdminInviteMessage:type_name -> WAWebProtobufsE2E.NewsletterAdminInviteMessage + 57, // 191: WAWebProtobufsE2E.Message.placeholderMessage:type_name -> WAWebProtobufsE2E.PlaceholderMessage + 66, // 192: WAWebProtobufsE2E.Message.secretEncryptedMessage:type_name -> WAWebProtobufsE2E.SecretEncryptedMessage + 98, // 193: WAWebProtobufsE2E.Message.albumMessage:type_name -> WAWebProtobufsE2E.AlbumMessage + 114, // 194: WAWebProtobufsE2E.Message.eventCoverImage:type_name -> WAWebProtobufsE2E.FutureProofMessage + 97, // 195: WAWebProtobufsE2E.Message.stickerPackMessage:type_name -> WAWebProtobufsE2E.StickerPackMessage + 114, // 196: WAWebProtobufsE2E.Message.statusMentionMessage:type_name -> WAWebProtobufsE2E.FutureProofMessage + 106, // 197: WAWebProtobufsE2E.Message.pollResultSnapshotMessage:type_name -> WAWebProtobufsE2E.PollResultSnapshotMessage + 209, // 198: WAWebProtobufsE2E.StickerPackMessage.stickers:type_name -> WAWebProtobufsE2E.StickerPackMessage.Sticker + 85, // 199: WAWebProtobufsE2E.StickerPackMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 85, // 200: WAWebProtobufsE2E.AlbumMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 85, // 201: WAWebProtobufsE2E.MessageHistoryBundle.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 224, // 202: WAWebProtobufsE2E.EncEventResponseMessage.eventCreationMessageKey:type_name -> WACommon.MessageKey + 85, // 203: WAWebProtobufsE2E.EventMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 142, // 204: WAWebProtobufsE2E.EventMessage.location:type_name -> WAWebProtobufsE2E.LocationMessage + 96, // 205: WAWebProtobufsE2E.CommentMessage.message:type_name -> WAWebProtobufsE2E.Message + 224, // 206: WAWebProtobufsE2E.CommentMessage.targetMessageKey:type_name -> WACommon.MessageKey + 224, // 207: WAWebProtobufsE2E.EncCommentMessage.targetMessageKey:type_name -> WACommon.MessageKey + 224, // 208: WAWebProtobufsE2E.EncReactionMessage.targetMessageKey:type_name -> WACommon.MessageKey + 224, // 209: WAWebProtobufsE2E.KeepInChatMessage.key:type_name -> WACommon.MessageKey + 2, // 210: WAWebProtobufsE2E.KeepInChatMessage.keepType:type_name -> WAWebProtobufsE2E.KeepType + 210, // 211: WAWebProtobufsE2E.PollResultSnapshotMessage.pollVotes:type_name -> WAWebProtobufsE2E.PollResultSnapshotMessage.PollVote + 85, // 212: WAWebProtobufsE2E.PollResultSnapshotMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 224, // 213: WAWebProtobufsE2E.PollUpdateMessage.pollCreationMessageKey:type_name -> WACommon.MessageKey + 108, // 214: WAWebProtobufsE2E.PollUpdateMessage.vote:type_name -> WAWebProtobufsE2E.PollEncValue + 109, // 215: WAWebProtobufsE2E.PollUpdateMessage.metadata:type_name -> WAWebProtobufsE2E.PollUpdateMessageMetadata + 211, // 216: WAWebProtobufsE2E.PollCreationMessage.options:type_name -> WAWebProtobufsE2E.PollCreationMessage.Option + 85, // 217: WAWebProtobufsE2E.PollCreationMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 224, // 218: WAWebProtobufsE2E.ReactionMessage.key:type_name -> WACommon.MessageKey + 96, // 219: WAWebProtobufsE2E.FutureProofMessage.message:type_name -> WAWebProtobufsE2E.Message + 96, // 220: WAWebProtobufsE2E.DeviceSentMessage.message:type_name -> WAWebProtobufsE2E.Message + 85, // 221: WAWebProtobufsE2E.RequestPhoneNumberMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 85, // 222: WAWebProtobufsE2E.NewsletterAdminInviteMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 212, // 223: WAWebProtobufsE2E.ProductMessage.product:type_name -> WAWebProtobufsE2E.ProductMessage.ProductSnapshot + 213, // 224: WAWebProtobufsE2E.ProductMessage.catalog:type_name -> WAWebProtobufsE2E.ProductMessage.CatalogSnapshot + 85, // 225: WAWebProtobufsE2E.ProductMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 85, // 226: WAWebProtobufsE2E.TemplateButtonReplyMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 215, // 227: WAWebProtobufsE2E.TemplateMessage.fourRowTemplate:type_name -> WAWebProtobufsE2E.TemplateMessage.FourRowTemplate + 214, // 228: WAWebProtobufsE2E.TemplateMessage.hydratedFourRowTemplate:type_name -> WAWebProtobufsE2E.TemplateMessage.HydratedFourRowTemplate + 69, // 229: WAWebProtobufsE2E.TemplateMessage.interactiveMessageTemplate:type_name -> WAWebProtobufsE2E.InteractiveMessage + 85, // 230: WAWebProtobufsE2E.TemplateMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 214, // 231: WAWebProtobufsE2E.TemplateMessage.hydratedTemplate:type_name -> WAWebProtobufsE2E.TemplateMessage.HydratedFourRowTemplate + 85, // 232: WAWebProtobufsE2E.StickerMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 85, // 233: WAWebProtobufsE2E.LiveLocationMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 224, // 234: WAWebProtobufsE2E.CancelPaymentRequestMessage.key:type_name -> WACommon.MessageKey + 224, // 235: WAWebProtobufsE2E.DeclinePaymentRequestMessage.key:type_name -> WACommon.MessageKey + 96, // 236: WAWebProtobufsE2E.RequestPaymentMessage.noteMessage:type_name -> WAWebProtobufsE2E.Message + 159, // 237: WAWebProtobufsE2E.RequestPaymentMessage.amount:type_name -> WAWebProtobufsE2E.Money + 93, // 238: WAWebProtobufsE2E.RequestPaymentMessage.background:type_name -> WAWebProtobufsE2E.PaymentBackground + 96, // 239: WAWebProtobufsE2E.SendPaymentMessage.noteMessage:type_name -> WAWebProtobufsE2E.Message + 224, // 240: WAWebProtobufsE2E.SendPaymentMessage.requestMessageKey:type_name -> WACommon.MessageKey + 93, // 241: WAWebProtobufsE2E.SendPaymentMessage.background:type_name -> WAWebProtobufsE2E.PaymentBackground + 143, // 242: WAWebProtobufsE2E.ContactsArrayMessage.contacts:type_name -> WAWebProtobufsE2E.ContactMessage + 85, // 243: WAWebProtobufsE2E.ContactsArrayMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 0, // 244: WAWebProtobufsE2E.PeerDataOperationRequestMessage.peerDataOperationRequestType:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestType + 220, // 245: WAWebProtobufsE2E.PeerDataOperationRequestMessage.requestStickerReupload:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestMessage.RequestStickerReupload + 219, // 246: WAWebProtobufsE2E.PeerDataOperationRequestMessage.requestURLPreview:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestMessage.RequestUrlPreview + 218, // 247: WAWebProtobufsE2E.PeerDataOperationRequestMessage.historySyncOnDemandRequest:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + 216, // 248: WAWebProtobufsE2E.PeerDataOperationRequestMessage.placeholderMessageResendRequest:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestMessage.PlaceholderMessageResendRequest + 217, // 249: WAWebProtobufsE2E.PeerDataOperationRequestMessage.fullHistorySyncOnDemandRequest:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestMessage.FullHistorySyncOnDemandRequest + 136, // 250: WAWebProtobufsE2E.AppStateSyncKeyRequest.keyIDs:type_name -> WAWebProtobufsE2E.AppStateSyncKeyId + 137, // 251: WAWebProtobufsE2E.AppStateSyncKeyShare.keys:type_name -> WAWebProtobufsE2E.AppStateSyncKey + 135, // 252: WAWebProtobufsE2E.AppStateSyncKeyData.fingerprint:type_name -> WAWebProtobufsE2E.AppStateSyncKeyFingerprint + 136, // 253: WAWebProtobufsE2E.AppStateSyncKey.keyID:type_name -> WAWebProtobufsE2E.AppStateSyncKeyId + 134, // 254: WAWebProtobufsE2E.AppStateSyncKey.keyData:type_name -> WAWebProtobufsE2E.AppStateSyncKeyData + 85, // 255: WAWebProtobufsE2E.AudioMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 85, // 256: WAWebProtobufsE2E.DocumentMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 85, // 257: WAWebProtobufsE2E.LocationMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 85, // 258: WAWebProtobufsE2E.ContactMessage.contextInfo:type_name -> WAWebProtobufsE2E.ContextInfo + 1, // 259: WAWebProtobufsE2E.BotSessionMetadata.sessionSource:type_name -> WAWebProtobufsE2E.BotSessionSource + 87, // 260: WAWebProtobufsE2E.BotMemuMetadata.faceImages:type_name -> WAWebProtobufsE2E.BotMediaMetadata + 145, // 261: WAWebProtobufsE2E.BotMetadata.avatarMetadata:type_name -> WAWebProtobufsE2E.BotAvatarMetadata + 86, // 262: WAWebProtobufsE2E.BotMetadata.pluginMetadata:type_name -> WAWebProtobufsE2E.BotPluginMetadata + 146, // 263: WAWebProtobufsE2E.BotMetadata.suggestedPromptMetadata:type_name -> WAWebProtobufsE2E.BotSuggestedPromptMetadata + 147, // 264: WAWebProtobufsE2E.BotMetadata.sessionMetadata:type_name -> WAWebProtobufsE2E.BotSessionMetadata + 148, // 265: WAWebProtobufsE2E.BotMetadata.memuMetadata:type_name -> WAWebProtobufsE2E.BotMemuMetadata + 88, // 266: WAWebProtobufsE2E.BotMetadata.reminderMetadata:type_name -> WAWebProtobufsE2E.BotReminderMetadata + 89, // 267: WAWebProtobufsE2E.BotMetadata.modelMetadata:type_name -> WAWebProtobufsE2E.BotModelMetadata + 149, // 268: WAWebProtobufsE2E.BotMetadata.progressIndicatorMetadata:type_name -> WAWebProtobufsE2E.BotProgressIndicatorMetadata + 225, // 269: WAWebProtobufsE2E.DeviceListMetadata.senderAccountType:type_name -> WAAdv.ADVEncryptionType + 225, // 270: WAWebProtobufsE2E.DeviceListMetadata.receiverAccountType:type_name -> WAAdv.ADVEncryptionType + 96, // 271: WAWebProtobufsE2E.EmbeddedMessage.message:type_name -> WAWebProtobufsE2E.Message + 152, // 272: WAWebProtobufsE2E.EmbeddedContent.embeddedMessage:type_name -> WAWebProtobufsE2E.EmbeddedMessage + 153, // 273: WAWebProtobufsE2E.EmbeddedContent.embeddedMusic:type_name -> WAWebProtobufsE2E.EmbeddedMusic + 157, // 274: WAWebProtobufsE2E.InteractiveAnnotation.location:type_name -> WAWebProtobufsE2E.Location + 197, // 275: WAWebProtobufsE2E.InteractiveAnnotation.newsletter:type_name -> WAWebProtobufsE2E.ContextInfo.ForwardedNewsletterMessageInfo + 156, // 276: WAWebProtobufsE2E.InteractiveAnnotation.polygonVertices:type_name -> WAWebProtobufsE2E.Point + 154, // 277: WAWebProtobufsE2E.InteractiveAnnotation.embeddedContent:type_name -> WAWebProtobufsE2E.EmbeddedContent + 223, // 278: WAWebProtobufsE2E.TemplateButton.quickReplyButton:type_name -> WAWebProtobufsE2E.TemplateButton.QuickReplyButton + 222, // 279: WAWebProtobufsE2E.TemplateButton.urlButton:type_name -> WAWebProtobufsE2E.TemplateButton.URLButton + 221, // 280: WAWebProtobufsE2E.TemplateButton.callButton:type_name -> WAWebProtobufsE2E.TemplateButton.CallButton + 5, // 281: WAWebProtobufsE2E.CallLogMessage.CallParticipant.callOutcome:type_name -> WAWebProtobufsE2E.CallLogMessage.CallOutcome + 168, // 282: WAWebProtobufsE2E.ButtonsMessage.Button.buttonText:type_name -> WAWebProtobufsE2E.ButtonsMessage.Button.ButtonText + 13, // 283: WAWebProtobufsE2E.ButtonsMessage.Button.type:type_name -> WAWebProtobufsE2E.ButtonsMessage.Button.Type + 167, // 284: WAWebProtobufsE2E.ButtonsMessage.Button.nativeFlowInfo:type_name -> WAWebProtobufsE2E.ButtonsMessage.Button.NativeFlowInfo + 16, // 285: WAWebProtobufsE2E.InteractiveResponseMessage.Body.format:type_name -> WAWebProtobufsE2E.InteractiveResponseMessage.Body.Format + 17, // 286: WAWebProtobufsE2E.InteractiveMessage.ShopMessage.surface:type_name -> WAWebProtobufsE2E.InteractiveMessage.ShopMessage.Surface + 69, // 287: WAWebProtobufsE2E.InteractiveMessage.CarouselMessage.cards:type_name -> WAWebProtobufsE2E.InteractiveMessage + 178, // 288: WAWebProtobufsE2E.InteractiveMessage.NativeFlowMessage.buttons:type_name -> WAWebProtobufsE2E.InteractiveMessage.NativeFlowMessage.NativeFlowButton + 141, // 289: WAWebProtobufsE2E.InteractiveMessage.Header.documentMessage:type_name -> WAWebProtobufsE2E.DocumentMessage + 84, // 290: WAWebProtobufsE2E.InteractiveMessage.Header.imageMessage:type_name -> WAWebProtobufsE2E.ImageMessage + 81, // 291: WAWebProtobufsE2E.InteractiveMessage.Header.videoMessage:type_name -> WAWebProtobufsE2E.VideoMessage + 142, // 292: WAWebProtobufsE2E.InteractiveMessage.Header.locationMessage:type_name -> WAWebProtobufsE2E.LocationMessage + 118, // 293: WAWebProtobufsE2E.InteractiveMessage.Header.productMessage:type_name -> WAWebProtobufsE2E.ProductMessage + 182, // 294: WAWebProtobufsE2E.ListMessage.ProductListInfo.productSections:type_name -> WAWebProtobufsE2E.ListMessage.ProductSection + 181, // 295: WAWebProtobufsE2E.ListMessage.ProductListInfo.headerImage:type_name -> WAWebProtobufsE2E.ListMessage.ProductListHeaderImage + 183, // 296: WAWebProtobufsE2E.ListMessage.ProductSection.products:type_name -> WAWebProtobufsE2E.ListMessage.Product + 185, // 297: WAWebProtobufsE2E.ListMessage.Section.rows:type_name -> WAWebProtobufsE2E.ListMessage.Row + 188, // 298: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.currency:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency + 187, // 299: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.dateTime:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + 189, // 300: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.component:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + 190, // 301: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.unixEpoch:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch + 24, // 302: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.dayOfWeek:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.DayOfWeekType + 23, // 303: WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.calendar:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.CalendarType + 226, // 304: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.mediaUploadResult:type_name -> WAMmsRetry.MediaRetryNotification.ResultType + 121, // 305: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.stickerMessage:type_name -> WAWebProtobufsE2E.StickerMessage + 195, // 306: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.linkPreviewResponse:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + 194, // 307: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.placeholderMessageResendResponse:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.PlaceholderMessageResendResponse + 192, // 308: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.waffleNonceFetchRequestResponse:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.WaffleNonceFetchResponse + 193, // 309: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.fullHistorySyncOnDemandRequestResponse:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.FullHistorySyncOnDemandRequestResponse + 130, // 310: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.FullHistorySyncOnDemandRequestResponse.requestMetadata:type_name -> WAWebProtobufsE2E.FullHistorySyncOnDemandRequestMetadata + 25, // 311: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.FullHistorySyncOnDemandRequestResponse.responseCode:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.FullHistorySyncOnDemandResponseCode + 196, // 312: WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.hqThumbnail:type_name -> WAWebProtobufsE2E.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.LinkPreviewHighQualityThumbnail + 40, // 313: WAWebProtobufsE2E.ContextInfo.ForwardedNewsletterMessageInfo.contentType:type_name -> WAWebProtobufsE2E.ContextInfo.ForwardedNewsletterMessageInfo.ContentType + 41, // 314: WAWebProtobufsE2E.ContextInfo.ExternalAdReplyInfo.mediaType:type_name -> WAWebProtobufsE2E.ContextInfo.ExternalAdReplyInfo.MediaType + 42, // 315: WAWebProtobufsE2E.ContextInfo.AdReplyInfo.mediaType:type_name -> WAWebProtobufsE2E.ContextInfo.AdReplyInfo.MediaType + 204, // 316: WAWebProtobufsE2E.ContextInfo.DataSharingContext.parameters:type_name -> WAWebProtobufsE2E.ContextInfo.DataSharingContext.Parameters + 204, // 317: WAWebProtobufsE2E.ContextInfo.DataSharingContext.Parameters.contents:type_name -> WAWebProtobufsE2E.ContextInfo.DataSharingContext.Parameters + 52, // 318: WAWebProtobufsE2E.HydratedTemplateButton.HydratedURLButton.webviewPresentation:type_name -> WAWebProtobufsE2E.HydratedTemplateButton.HydratedURLButton.WebviewPresentationType + 84, // 319: WAWebProtobufsE2E.ProductMessage.ProductSnapshot.productImage:type_name -> WAWebProtobufsE2E.ImageMessage + 84, // 320: WAWebProtobufsE2E.ProductMessage.CatalogSnapshot.catalogImage:type_name -> WAWebProtobufsE2E.ImageMessage + 141, // 321: WAWebProtobufsE2E.TemplateMessage.HydratedFourRowTemplate.documentMessage:type_name -> WAWebProtobufsE2E.DocumentMessage + 84, // 322: WAWebProtobufsE2E.TemplateMessage.HydratedFourRowTemplate.imageMessage:type_name -> WAWebProtobufsE2E.ImageMessage + 81, // 323: WAWebProtobufsE2E.TemplateMessage.HydratedFourRowTemplate.videoMessage:type_name -> WAWebProtobufsE2E.VideoMessage + 142, // 324: WAWebProtobufsE2E.TemplateMessage.HydratedFourRowTemplate.locationMessage:type_name -> WAWebProtobufsE2E.LocationMessage + 92, // 325: WAWebProtobufsE2E.TemplateMessage.HydratedFourRowTemplate.hydratedButtons:type_name -> WAWebProtobufsE2E.HydratedTemplateButton + 141, // 326: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate.documentMessage:type_name -> WAWebProtobufsE2E.DocumentMessage + 74, // 327: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate.highlyStructuredMessage:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage + 84, // 328: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate.imageMessage:type_name -> WAWebProtobufsE2E.ImageMessage + 81, // 329: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate.videoMessage:type_name -> WAWebProtobufsE2E.VideoMessage + 142, // 330: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate.locationMessage:type_name -> WAWebProtobufsE2E.LocationMessage + 74, // 331: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate.content:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage + 74, // 332: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate.footer:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage + 158, // 333: WAWebProtobufsE2E.TemplateMessage.FourRowTemplate.buttons:type_name -> WAWebProtobufsE2E.TemplateButton + 224, // 334: WAWebProtobufsE2E.PeerDataOperationRequestMessage.PlaceholderMessageResendRequest.messageKey:type_name -> WACommon.MessageKey + 130, // 335: WAWebProtobufsE2E.PeerDataOperationRequestMessage.FullHistorySyncOnDemandRequest.requestMetadata:type_name -> WAWebProtobufsE2E.FullHistorySyncOnDemandRequestMetadata + 227, // 336: WAWebProtobufsE2E.PeerDataOperationRequestMessage.FullHistorySyncOnDemandRequest.historySyncConfig:type_name -> WAWebProtobufsCompanionReg.DeviceProps.HistorySyncConfig + 74, // 337: WAWebProtobufsE2E.TemplateButton.CallButton.displayText:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage + 74, // 338: WAWebProtobufsE2E.TemplateButton.CallButton.phoneNumber:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage + 74, // 339: WAWebProtobufsE2E.TemplateButton.URLButton.displayText:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage + 74, // 340: WAWebProtobufsE2E.TemplateButton.URLButton.URL:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage + 74, // 341: WAWebProtobufsE2E.TemplateButton.QuickReplyButton.displayText:type_name -> WAWebProtobufsE2E.HighlyStructuredMessage + 342, // [342:342] is the sub-list for method output_type + 342, // [342:342] is the sub-list for method input_type + 342, // [342:342] is the sub-list for extension type_name + 342, // [342:342] is the sub-list for extension extendee + 0, // [0:342] is the sub-list for field type_name } func init() { file_waE2E_WAWebProtobufsE2E_proto_init() } @@ -17159,7 +18608,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*PlaceholderMessage); i { case 0: return &v.state @@ -17171,7 +18620,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*BCallMessage); i { case 0: return &v.state @@ -17183,7 +18632,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*CallLogMessage); i { case 0: return &v.state @@ -17195,7 +18644,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*ScheduledCallEditMessage); i { case 0: return &v.state @@ -17207,7 +18656,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*ScheduledCallCreationMessage); i { case 0: return &v.state @@ -17219,7 +18668,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*EventResponseMessage); i { case 0: return &v.state @@ -17231,7 +18680,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*PinInChatMessage); i { case 0: return &v.state @@ -17243,7 +18692,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*ButtonsResponseMessage); i { case 0: return &v.state @@ -17255,7 +18704,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*ButtonsMessage); i { case 0: return &v.state @@ -17267,7 +18716,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*SecretEncryptedMessage); i { case 0: return &v.state @@ -17279,7 +18728,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*GroupInviteMessage); i { case 0: return &v.state @@ -17291,7 +18740,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*InteractiveResponseMessage); i { case 0: return &v.state @@ -17303,7 +18752,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[12].Exporter = func(v any, i int) any { switch v := v.(*InteractiveMessage); i { case 0: return &v.state @@ -17315,7 +18764,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[13].Exporter = func(v any, i int) any { switch v := v.(*ListResponseMessage); i { case 0: return &v.state @@ -17327,7 +18776,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[14].Exporter = func(v any, i int) any { switch v := v.(*ListMessage); i { case 0: return &v.state @@ -17339,7 +18788,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[15].Exporter = func(v any, i int) any { switch v := v.(*OrderMessage); i { case 0: return &v.state @@ -17351,7 +18800,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[16].Exporter = func(v any, i int) any { switch v := v.(*PaymentInviteMessage); i { case 0: return &v.state @@ -17363,7 +18812,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[17].Exporter = func(v any, i int) any { switch v := v.(*HighlyStructuredMessage); i { case 0: return &v.state @@ -17375,619 +18824,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HistorySyncNotification); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RequestWelcomeMessageMetadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProtocolMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CloudAPIThreadControlNotification); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotFeedbackMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VideoMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExtendedTextMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InvoiceMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ImageMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContextInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotPluginMetadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotSearchMetadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotReminderMetadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageAssociation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageContextInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HydratedTemplateButton); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PaymentBackground); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DisappearingMode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProcessedVideo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Message); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AlbumMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageHistoryBundle); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EncEventResponseMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EventMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommentMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EncCommentMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EncReactionMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KeepInChatMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PollResultSnapshotMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PollVoteMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PollEncValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PollUpdateMessageMetadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PollUpdateMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PollCreationMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StickerSyncRMRMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReactionMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FutureProofMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeviceSentMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RequestPhoneNumberMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NewsletterAdminInviteMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[58].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProductMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[59].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TemplateButtonReplyMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[60].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TemplateMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[61].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StickerMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[62].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LiveLocationMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[63].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CancelPaymentRequestMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[64].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeclinePaymentRequestMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[65].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RequestPaymentMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[66].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SendPaymentMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[67].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactsArrayMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[68].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InitialSecurityNotificationSettingSync); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[69].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[18].Exporter = func(v any, i int) any { switch v := v.(*PeerDataOperationRequestResponseMessage); i { case 0: return &v.state @@ -17999,8 +18836,8 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[70].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeerDataOperationRequestMessage); i { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[19].Exporter = func(v any, i int) any { + switch v := v.(*HistorySyncNotification); i { case 0: return &v.state case 1: @@ -18011,8 +18848,8 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[71].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppStateFatalExceptionNotification); i { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[20].Exporter = func(v any, i int) any { + switch v := v.(*RequestWelcomeMessageMetadata); i { case 0: return &v.state case 1: @@ -18023,8 +18860,8 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[72].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppStateSyncKeyRequest); i { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[21].Exporter = func(v any, i int) any { + switch v := v.(*ProtocolMessage); i { case 0: return &v.state case 1: @@ -18035,8 +18872,8 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[73].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppStateSyncKeyShare); i { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[22].Exporter = func(v any, i int) any { + switch v := v.(*CloudAPIThreadControlNotification); i { case 0: return &v.state case 1: @@ -18047,8 +18884,8 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[74].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppStateSyncKeyData); i { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[23].Exporter = func(v any, i int) any { + switch v := v.(*BotFeedbackMessage); i { case 0: return &v.state case 1: @@ -18059,8 +18896,8 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[75].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppStateSyncKeyFingerprint); i { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[24].Exporter = func(v any, i int) any { + switch v := v.(*VideoMessage); i { case 0: return &v.state case 1: @@ -18071,8 +18908,8 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[76].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppStateSyncKeyId); i { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[25].Exporter = func(v any, i int) any { + switch v := v.(*ExtendedTextMessage); i { case 0: return &v.state case 1: @@ -18083,8 +18920,8 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[77].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppStateSyncKey); i { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[26].Exporter = func(v any, i int) any { + switch v := v.(*InvoiceMessage); i { case 0: return &v.state case 1: @@ -18095,8 +18932,8 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[78].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Chat); i { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[27].Exporter = func(v any, i int) any { + switch v := v.(*ImageMessage); i { case 0: return &v.state case 1: @@ -18107,8 +18944,8 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[79].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Call); i { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[28].Exporter = func(v any, i int) any { + switch v := v.(*ContextInfo); i { case 0: return &v.state case 1: @@ -18119,8 +18956,8 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[80].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AudioMessage); i { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[29].Exporter = func(v any, i int) any { + switch v := v.(*BotPluginMetadata); i { case 0: return &v.state case 1: @@ -18131,79 +18968,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[81].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[82].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LocationMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[83].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[84].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SenderKeyDistributionMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[85].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotAvatarMetadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[86].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotSuggestedPromptMetadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[87].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[30].Exporter = func(v any, i int) any { switch v := v.(*BotMediaMetadata); i { case 0: return &v.state @@ -18215,7 +18980,727 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[88].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[31].Exporter = func(v any, i int) any { + switch v := v.(*BotReminderMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[32].Exporter = func(v any, i int) any { + switch v := v.(*BotModelMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[33].Exporter = func(v any, i int) any { + switch v := v.(*MessageAssociation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[34].Exporter = func(v any, i int) any { + switch v := v.(*MessageContextInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[35].Exporter = func(v any, i int) any { + switch v := v.(*HydratedTemplateButton); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[36].Exporter = func(v any, i int) any { + switch v := v.(*PaymentBackground); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[37].Exporter = func(v any, i int) any { + switch v := v.(*DisappearingMode); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[38].Exporter = func(v any, i int) any { + switch v := v.(*ProcessedVideo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[39].Exporter = func(v any, i int) any { + switch v := v.(*Message); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[40].Exporter = func(v any, i int) any { + switch v := v.(*StickerPackMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[41].Exporter = func(v any, i int) any { + switch v := v.(*AlbumMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[42].Exporter = func(v any, i int) any { + switch v := v.(*MessageHistoryBundle); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[43].Exporter = func(v any, i int) any { + switch v := v.(*EncEventResponseMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[44].Exporter = func(v any, i int) any { + switch v := v.(*EventMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[45].Exporter = func(v any, i int) any { + switch v := v.(*CommentMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[46].Exporter = func(v any, i int) any { + switch v := v.(*EncCommentMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[47].Exporter = func(v any, i int) any { + switch v := v.(*EncReactionMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[48].Exporter = func(v any, i int) any { + switch v := v.(*KeepInChatMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[49].Exporter = func(v any, i int) any { + switch v := v.(*PollResultSnapshotMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[50].Exporter = func(v any, i int) any { + switch v := v.(*PollVoteMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[51].Exporter = func(v any, i int) any { + switch v := v.(*PollEncValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[52].Exporter = func(v any, i int) any { + switch v := v.(*PollUpdateMessageMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[53].Exporter = func(v any, i int) any { + switch v := v.(*PollUpdateMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[54].Exporter = func(v any, i int) any { + switch v := v.(*PollCreationMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[55].Exporter = func(v any, i int) any { + switch v := v.(*StickerSyncRMRMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[56].Exporter = func(v any, i int) any { + switch v := v.(*ReactionMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[57].Exporter = func(v any, i int) any { + switch v := v.(*FutureProofMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[58].Exporter = func(v any, i int) any { + switch v := v.(*DeviceSentMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[59].Exporter = func(v any, i int) any { + switch v := v.(*RequestPhoneNumberMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[60].Exporter = func(v any, i int) any { + switch v := v.(*NewsletterAdminInviteMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[61].Exporter = func(v any, i int) any { + switch v := v.(*ProductMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[62].Exporter = func(v any, i int) any { + switch v := v.(*TemplateButtonReplyMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[63].Exporter = func(v any, i int) any { + switch v := v.(*TemplateMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[64].Exporter = func(v any, i int) any { + switch v := v.(*StickerMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[65].Exporter = func(v any, i int) any { + switch v := v.(*LiveLocationMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[66].Exporter = func(v any, i int) any { + switch v := v.(*CancelPaymentRequestMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[67].Exporter = func(v any, i int) any { + switch v := v.(*DeclinePaymentRequestMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[68].Exporter = func(v any, i int) any { + switch v := v.(*RequestPaymentMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[69].Exporter = func(v any, i int) any { + switch v := v.(*SendPaymentMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[70].Exporter = func(v any, i int) any { + switch v := v.(*ContactsArrayMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[71].Exporter = func(v any, i int) any { + switch v := v.(*InitialSecurityNotificationSettingSync); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[72].Exporter = func(v any, i int) any { + switch v := v.(*PeerDataOperationRequestMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[73].Exporter = func(v any, i int) any { + switch v := v.(*FullHistorySyncOnDemandRequestMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[74].Exporter = func(v any, i int) any { + switch v := v.(*AppStateFatalExceptionNotification); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[75].Exporter = func(v any, i int) any { + switch v := v.(*AppStateSyncKeyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[76].Exporter = func(v any, i int) any { + switch v := v.(*AppStateSyncKeyShare); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[77].Exporter = func(v any, i int) any { + switch v := v.(*AppStateSyncKeyData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[78].Exporter = func(v any, i int) any { + switch v := v.(*AppStateSyncKeyFingerprint); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[79].Exporter = func(v any, i int) any { + switch v := v.(*AppStateSyncKeyId); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[80].Exporter = func(v any, i int) any { + switch v := v.(*AppStateSyncKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[81].Exporter = func(v any, i int) any { + switch v := v.(*Chat); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[82].Exporter = func(v any, i int) any { + switch v := v.(*Call); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[83].Exporter = func(v any, i int) any { + switch v := v.(*AudioMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[84].Exporter = func(v any, i int) any { + switch v := v.(*DocumentMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[85].Exporter = func(v any, i int) any { + switch v := v.(*LocationMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[86].Exporter = func(v any, i int) any { + switch v := v.(*ContactMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[87].Exporter = func(v any, i int) any { + switch v := v.(*SenderKeyDistributionMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[88].Exporter = func(v any, i int) any { + switch v := v.(*BotAvatarMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[89].Exporter = func(v any, i int) any { + switch v := v.(*BotSuggestedPromptMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[90].Exporter = func(v any, i int) any { + switch v := v.(*BotSessionMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[91].Exporter = func(v any, i int) any { switch v := v.(*BotMemuMetadata); i { case 0: return &v.state @@ -18227,7 +19712,19 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[89].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[92].Exporter = func(v any, i int) any { + switch v := v.(*BotProgressIndicatorMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[93].Exporter = func(v any, i int) any { switch v := v.(*BotMetadata); i { case 0: return &v.state @@ -18239,7 +19736,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[90].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[94].Exporter = func(v any, i int) any { switch v := v.(*DeviceListMetadata); i { case 0: return &v.state @@ -18251,7 +19748,43 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[91].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[95].Exporter = func(v any, i int) any { + switch v := v.(*EmbeddedMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[96].Exporter = func(v any, i int) any { + switch v := v.(*EmbeddedMusic); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[97].Exporter = func(v any, i int) any { + switch v := v.(*EmbeddedContent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[98].Exporter = func(v any, i int) any { switch v := v.(*InteractiveAnnotation); i { case 0: return &v.state @@ -18263,7 +19796,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[92].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[99].Exporter = func(v any, i int) any { switch v := v.(*Point); i { case 0: return &v.state @@ -18275,7 +19808,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[93].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[100].Exporter = func(v any, i int) any { switch v := v.(*Location); i { case 0: return &v.state @@ -18287,7 +19820,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[94].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[101].Exporter = func(v any, i int) any { switch v := v.(*TemplateButton); i { case 0: return &v.state @@ -18299,7 +19832,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[95].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[102].Exporter = func(v any, i int) any { switch v := v.(*Money); i { case 0: return &v.state @@ -18311,7 +19844,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[96].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[103].Exporter = func(v any, i int) any { switch v := v.(*ActionLink); i { case 0: return &v.state @@ -18323,7 +19856,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[97].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[104].Exporter = func(v any, i int) any { switch v := v.(*GroupMention); i { case 0: return &v.state @@ -18335,7 +19868,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[98].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[105].Exporter = func(v any, i int) any { switch v := v.(*MessageSecretMessage); i { case 0: return &v.state @@ -18347,7 +19880,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[99].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[106].Exporter = func(v any, i int) any { switch v := v.(*MediaNotifyMessage); i { case 0: return &v.state @@ -18359,7 +19892,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[100].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[107].Exporter = func(v any, i int) any { switch v := v.(*LIDMigrationMappingSyncMessage); i { case 0: return &v.state @@ -18371,7 +19904,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[101].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[108].Exporter = func(v any, i int) any { switch v := v.(*CallLogMessage_CallParticipant); i { case 0: return &v.state @@ -18383,7 +19916,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[102].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[109].Exporter = func(v any, i int) any { switch v := v.(*ButtonsMessage_Button); i { case 0: return &v.state @@ -18395,7 +19928,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[103].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[110].Exporter = func(v any, i int) any { switch v := v.(*ButtonsMessage_Button_NativeFlowInfo); i { case 0: return &v.state @@ -18407,7 +19940,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[104].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[111].Exporter = func(v any, i int) any { switch v := v.(*ButtonsMessage_Button_ButtonText); i { case 0: return &v.state @@ -18419,7 +19952,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[105].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[112].Exporter = func(v any, i int) any { switch v := v.(*InteractiveResponseMessage_Body); i { case 0: return &v.state @@ -18431,7 +19964,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[106].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[113].Exporter = func(v any, i int) any { switch v := v.(*InteractiveResponseMessage_NativeFlowResponseMessage); i { case 0: return &v.state @@ -18443,7 +19976,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[107].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[114].Exporter = func(v any, i int) any { switch v := v.(*InteractiveMessage_ShopMessage); i { case 0: return &v.state @@ -18455,7 +19988,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[108].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[115].Exporter = func(v any, i int) any { switch v := v.(*InteractiveMessage_CarouselMessage); i { case 0: return &v.state @@ -18467,7 +20000,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[109].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[116].Exporter = func(v any, i int) any { switch v := v.(*InteractiveMessage_NativeFlowMessage); i { case 0: return &v.state @@ -18479,7 +20012,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[110].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[117].Exporter = func(v any, i int) any { switch v := v.(*InteractiveMessage_CollectionMessage); i { case 0: return &v.state @@ -18491,7 +20024,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[111].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[118].Exporter = func(v any, i int) any { switch v := v.(*InteractiveMessage_Footer); i { case 0: return &v.state @@ -18503,7 +20036,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[112].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[119].Exporter = func(v any, i int) any { switch v := v.(*InteractiveMessage_Body); i { case 0: return &v.state @@ -18515,7 +20048,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[113].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[120].Exporter = func(v any, i int) any { switch v := v.(*InteractiveMessage_Header); i { case 0: return &v.state @@ -18527,7 +20060,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[114].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[121].Exporter = func(v any, i int) any { switch v := v.(*InteractiveMessage_NativeFlowMessage_NativeFlowButton); i { case 0: return &v.state @@ -18539,7 +20072,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[115].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[122].Exporter = func(v any, i int) any { switch v := v.(*ListResponseMessage_SingleSelectReply); i { case 0: return &v.state @@ -18551,7 +20084,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[116].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[123].Exporter = func(v any, i int) any { switch v := v.(*ListMessage_ProductListInfo); i { case 0: return &v.state @@ -18563,7 +20096,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[117].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[124].Exporter = func(v any, i int) any { switch v := v.(*ListMessage_ProductListHeaderImage); i { case 0: return &v.state @@ -18575,7 +20108,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[118].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[125].Exporter = func(v any, i int) any { switch v := v.(*ListMessage_ProductSection); i { case 0: return &v.state @@ -18587,7 +20120,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[119].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[126].Exporter = func(v any, i int) any { switch v := v.(*ListMessage_Product); i { case 0: return &v.state @@ -18599,7 +20132,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[120].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[127].Exporter = func(v any, i int) any { switch v := v.(*ListMessage_Section); i { case 0: return &v.state @@ -18611,7 +20144,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[121].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[128].Exporter = func(v any, i int) any { switch v := v.(*ListMessage_Row); i { case 0: return &v.state @@ -18623,7 +20156,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[122].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[129].Exporter = func(v any, i int) any { switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter); i { case 0: return &v.state @@ -18635,7 +20168,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[123].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[130].Exporter = func(v any, i int) any { switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime); i { case 0: return &v.state @@ -18647,7 +20180,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[124].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[131].Exporter = func(v any, i int) any { switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency); i { case 0: return &v.state @@ -18659,7 +20192,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[125].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[132].Exporter = func(v any, i int) any { switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent); i { case 0: return &v.state @@ -18671,7 +20204,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[126].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[133].Exporter = func(v any, i int) any { switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch); i { case 0: return &v.state @@ -18683,211 +20216,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[127].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContextInfo_ForwardedNewsletterMessageInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[128].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContextInfo_ExternalAdReplyInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[129].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContextInfo_AdReplyInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[130].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContextInfo_FeatureEligibilities); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[131].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContextInfo_DataSharingContext); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[132].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContextInfo_UTMInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[133].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContextInfo_BusinessMessageForwardInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[134].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HydratedTemplateButton_HydratedURLButton); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[135].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HydratedTemplateButton_HydratedCallButton); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[136].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HydratedTemplateButton_HydratedQuickReplyButton); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[137].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PaymentBackground_MediaData); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[138].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PollResultSnapshotMessage_PollVote); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[139].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PollCreationMessage_Option); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[140].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProductMessage_ProductSnapshot); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[141].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProductMessage_CatalogSnapshot); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[142].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TemplateMessage_HydratedFourRowTemplate); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[143].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TemplateMessage_FourRowTemplate); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[144].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[134].Exporter = func(v any, i int) any { switch v := v.(*PeerDataOperationRequestResponseMessage_PeerDataOperationResult); i { case 0: return &v.state @@ -18899,7 +20228,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[145].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[135].Exporter = func(v any, i int) any { switch v := v.(*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_WaffleNonceFetchResponse); i { case 0: return &v.state @@ -18911,7 +20240,19 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[146].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[136].Exporter = func(v any, i int) any { + switch v := v.(*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_FullHistorySyncOnDemandRequestResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[137].Exporter = func(v any, i int) any { switch v := v.(*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse); i { case 0: return &v.state @@ -18923,7 +20264,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[147].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[138].Exporter = func(v any, i int) any { switch v := v.(*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse); i { case 0: return &v.state @@ -18935,7 +20276,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[148].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[139].Exporter = func(v any, i int) any { switch v := v.(*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail); i { case 0: return &v.state @@ -18947,7 +20288,235 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[149].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[140].Exporter = func(v any, i int) any { + switch v := v.(*ContextInfo_ForwardedNewsletterMessageInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[141].Exporter = func(v any, i int) any { + switch v := v.(*ContextInfo_ExternalAdReplyInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[142].Exporter = func(v any, i int) any { + switch v := v.(*ContextInfo_AdReplyInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[143].Exporter = func(v any, i int) any { + switch v := v.(*ContextInfo_FeatureEligibilities); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[144].Exporter = func(v any, i int) any { + switch v := v.(*ContextInfo_DataSharingContext); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[145].Exporter = func(v any, i int) any { + switch v := v.(*ContextInfo_UTMInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[146].Exporter = func(v any, i int) any { + switch v := v.(*ContextInfo_BusinessMessageForwardInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[147].Exporter = func(v any, i int) any { + switch v := v.(*ContextInfo_DataSharingContext_Parameters); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[148].Exporter = func(v any, i int) any { + switch v := v.(*HydratedTemplateButton_HydratedURLButton); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[149].Exporter = func(v any, i int) any { + switch v := v.(*HydratedTemplateButton_HydratedCallButton); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[150].Exporter = func(v any, i int) any { + switch v := v.(*HydratedTemplateButton_HydratedQuickReplyButton); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[151].Exporter = func(v any, i int) any { + switch v := v.(*PaymentBackground_MediaData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[152].Exporter = func(v any, i int) any { + switch v := v.(*StickerPackMessage_Sticker); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[153].Exporter = func(v any, i int) any { + switch v := v.(*PollResultSnapshotMessage_PollVote); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[154].Exporter = func(v any, i int) any { + switch v := v.(*PollCreationMessage_Option); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[155].Exporter = func(v any, i int) any { + switch v := v.(*ProductMessage_ProductSnapshot); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[156].Exporter = func(v any, i int) any { + switch v := v.(*ProductMessage_CatalogSnapshot); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[157].Exporter = func(v any, i int) any { + switch v := v.(*TemplateMessage_HydratedFourRowTemplate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[158].Exporter = func(v any, i int) any { + switch v := v.(*TemplateMessage_FourRowTemplate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[159].Exporter = func(v any, i int) any { switch v := v.(*PeerDataOperationRequestMessage_PlaceholderMessageResendRequest); i { case 0: return &v.state @@ -18959,7 +20528,19 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[150].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[160].Exporter = func(v any, i int) any { + switch v := v.(*PeerDataOperationRequestMessage_FullHistorySyncOnDemandRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[161].Exporter = func(v any, i int) any { switch v := v.(*PeerDataOperationRequestMessage_HistorySyncOnDemandRequest); i { case 0: return &v.state @@ -18971,7 +20552,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[151].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[162].Exporter = func(v any, i int) any { switch v := v.(*PeerDataOperationRequestMessage_RequestUrlPreview); i { case 0: return &v.state @@ -18983,7 +20564,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[152].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[163].Exporter = func(v any, i int) any { switch v := v.(*PeerDataOperationRequestMessage_RequestStickerReupload); i { case 0: return &v.state @@ -18995,7 +20576,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[153].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[164].Exporter = func(v any, i int) any { switch v := v.(*TemplateButton_CallButton); i { case 0: return &v.state @@ -19007,7 +20588,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[154].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[165].Exporter = func(v any, i int) any { switch v := v.(*TemplateButton_URLButton); i { case 0: return &v.state @@ -19019,7 +20600,7 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { return nil } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[155].Exporter = func(v interface{}, i int) interface{} { + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[166].Exporter = func(v any, i int) any { switch v := v.(*TemplateButton_QuickReplyButton); i { case 0: return &v.state @@ -19032,45 +20613,50 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { } } } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[7].OneofWrappers = []interface{}{ + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[7].OneofWrappers = []any{ (*ButtonsResponseMessage_SelectedDisplayText)(nil), } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[8].OneofWrappers = []interface{}{ + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[8].OneofWrappers = []any{ (*ButtonsMessage_Text)(nil), (*ButtonsMessage_DocumentMessage)(nil), (*ButtonsMessage_ImageMessage)(nil), (*ButtonsMessage_VideoMessage)(nil), (*ButtonsMessage_LocationMessage)(nil), } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[11].OneofWrappers = []interface{}{ + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[11].OneofWrappers = []any{ (*InteractiveResponseMessage_NativeFlowResponseMessage_)(nil), } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[12].OneofWrappers = []interface{}{ + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[12].OneofWrappers = []any{ (*InteractiveMessage_ShopStorefrontMessage)(nil), (*InteractiveMessage_CollectionMessage_)(nil), (*InteractiveMessage_NativeFlowMessage_)(nil), (*InteractiveMessage_CarouselMessage_)(nil), } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[33].OneofWrappers = []interface{}{ + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[35].OneofWrappers = []any{ (*HydratedTemplateButton_QuickReplyButton)(nil), (*HydratedTemplateButton_UrlButton)(nil), (*HydratedTemplateButton_CallButton)(nil), } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[60].OneofWrappers = []interface{}{ + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[63].OneofWrappers = []any{ (*TemplateMessage_FourRowTemplate_)(nil), (*TemplateMessage_HydratedFourRowTemplate_)(nil), (*TemplateMessage_InteractiveMessageTemplate)(nil), } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[91].OneofWrappers = []interface{}{ + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[97].OneofWrappers = []any{ + (*EmbeddedContent_EmbeddedMessage)(nil), + (*EmbeddedContent_EmbeddedMusic)(nil), + } + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[98].OneofWrappers = []any{ (*InteractiveAnnotation_Location)(nil), (*InteractiveAnnotation_Newsletter)(nil), + (*InteractiveAnnotation_EmbeddedAction)(nil), } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[94].OneofWrappers = []interface{}{ + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[101].OneofWrappers = []any{ (*TemplateButton_QuickReplyButton_)(nil), (*TemplateButton_UrlButton)(nil), (*TemplateButton_CallButton_)(nil), } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[113].OneofWrappers = []interface{}{ + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[120].OneofWrappers = []any{ (*InteractiveMessage_Header_DocumentMessage)(nil), (*InteractiveMessage_Header_ImageMessage)(nil), (*InteractiveMessage_Header_JPEGThumbnail)(nil), @@ -19078,22 +20664,22 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { (*InteractiveMessage_Header_LocationMessage)(nil), (*InteractiveMessage_Header_ProductMessage)(nil), } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[122].OneofWrappers = []interface{}{ + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[129].OneofWrappers = []any{ (*HighlyStructuredMessage_HSMLocalizableParameter_Currency)(nil), (*HighlyStructuredMessage_HSMLocalizableParameter_DateTime)(nil), } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[123].OneofWrappers = []interface{}{ + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[130].OneofWrappers = []any{ (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_Component)(nil), (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_UnixEpoch)(nil), } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[142].OneofWrappers = []interface{}{ + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[157].OneofWrappers = []any{ (*TemplateMessage_HydratedFourRowTemplate_DocumentMessage)(nil), (*TemplateMessage_HydratedFourRowTemplate_HydratedTitleText)(nil), (*TemplateMessage_HydratedFourRowTemplate_ImageMessage)(nil), (*TemplateMessage_HydratedFourRowTemplate_VideoMessage)(nil), (*TemplateMessage_HydratedFourRowTemplate_LocationMessage)(nil), } - file_waE2E_WAWebProtobufsE2E_proto_msgTypes[143].OneofWrappers = []interface{}{ + file_waE2E_WAWebProtobufsE2E_proto_msgTypes[158].OneofWrappers = []any{ (*TemplateMessage_FourRowTemplate_DocumentMessage)(nil), (*TemplateMessage_FourRowTemplate_HighlyStructuredMessage)(nil), (*TemplateMessage_FourRowTemplate_ImageMessage)(nil), @@ -19105,8 +20691,8 @@ func file_waE2E_WAWebProtobufsE2E_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_waE2E_WAWebProtobufsE2E_proto_rawDesc, - NumEnums: 53, - NumMessages: 156, + NumEnums: 57, + NumMessages: 167, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.raw b/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.raw index def5a418..cd2ba936 100644 Binary files a/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.raw and b/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.raw differ diff --git a/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto b/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto index caf80eea..f9f49307 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto +++ b/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto @@ -3,6 +3,7 @@ package WAWebProtobufsE2E; option go_package = "go.mau.fi/whatsmeow/proto/waE2E"; import "waAdv/WAAdv.proto"; +import "waCompanionReg/WAWebProtobufsCompanionReg.proto"; import "waMmsRetry/WAMmsRetry.proto"; import "waCommon/WACommon.proto"; @@ -13,6 +14,16 @@ enum PeerDataOperationRequestType { HISTORY_SYNC_ON_DEMAND = 3; PLACEHOLDER_MESSAGE_RESEND = 4; WAFFLE_LINKING_NONCE_FETCH = 5; + FULL_HISTORY_SYNC_ON_DEMAND = 6; +} + +enum BotSessionSource { + NULL_STATE = 1; + TYPEAHEAD = 2; + USER_INPUT = 3; + EMU_FLASH = 4; + EMU_FLASH_FOLLOWUP = 5; + VOICE = 6; } enum KeepType { @@ -473,6 +484,66 @@ message HighlyStructuredMessage { optional TemplateMessage hydratedHsm = 9; } +message PeerDataOperationRequestResponseMessage { + message PeerDataOperationResult { + enum FullHistorySyncOnDemandResponseCode { + REQUEST_SUCCESS = 0; + REQUEST_TIME_EXPIRED = 1; + DECLINED_SHARING_HISTORY = 2; + GENERIC_ERROR = 3; + ERROR_REQUEST_ON_NON_SMB_PRIMARY = 4; + ERROR_HOSTED_DEVICE_NOT_CONNECTED = 5; + ERROR_HOSTED_DEVICE_LOGIN_TIME_NOT_SET = 6; + } + + message WaffleNonceFetchResponse { + optional string nonce = 1; + optional string waEntFbid = 2; + } + + message FullHistorySyncOnDemandRequestResponse { + optional FullHistorySyncOnDemandRequestMetadata requestMetadata = 1; + optional FullHistorySyncOnDemandResponseCode responseCode = 2; + } + + message PlaceholderMessageResendResponse { + optional bytes webMessageInfoBytes = 1; + } + + message LinkPreviewResponse { + message LinkPreviewHighQualityThumbnail { + optional string directPath = 1; + optional string thumbHash = 2; + optional string encThumbHash = 3; + optional bytes mediaKey = 4; + optional int64 mediaKeyTimestampMS = 5; + optional int32 thumbWidth = 6; + optional int32 thumbHeight = 7; + } + + optional string URL = 1; + optional string title = 2; + optional string description = 3; + optional bytes thumbData = 4; + optional string canonicalURL = 5; + optional string matchText = 6; + optional string previewType = 7; + optional LinkPreviewHighQualityThumbnail hqThumbnail = 8; + } + + optional WAMmsRetry.MediaRetryNotification.ResultType mediaUploadResult = 1; + optional StickerMessage stickerMessage = 2; + optional LinkPreviewResponse linkPreviewResponse = 3; + optional PlaceholderMessageResendResponse placeholderMessageResendResponse = 4; + optional WaffleNonceFetchResponse waffleNonceFetchRequestResponse = 5; + optional FullHistorySyncOnDemandRequestResponse fullHistorySyncOnDemandRequestResponse = 6; + } + + optional PeerDataOperationRequestType peerDataOperationRequestType = 1; + optional string stanzaID = 2; + repeated PeerDataOperationResult peerDataOperationResult = 3; +} + message HistorySyncNotification { enum HistorySyncType { INITIAL_BOOTSTRAP = 0; @@ -497,6 +568,8 @@ message HistorySyncNotification { optional int64 oldestMsgInChunkTimestampSec = 10; optional bytes initialHistBootstrapInlinePayload = 11; optional string peerDataRequestSessionID = 12; + optional FullHistorySyncOnDemandRequestMetadata fullHistorySyncOnDemandRequestMetadata = 13; + optional string encHandle = 14; } message RequestWelcomeMessageMetadata { @@ -530,6 +603,7 @@ message ProtocolMessage { LID_MIGRATION_MAPPING_SYNC = 22; REMINDER_MESSAGE = 23; BOT_MEMU_ONBOARDING_MESSAGE = 24; + STATUS_MENTION_MESSAGE = 25; } optional WACommon.MessageKey key = 1; @@ -793,6 +867,11 @@ message ContextInfo { optional string ref = 14; optional bool clickToWhatsappCall = 15; optional bool adContextPreviewDismissed = 16; + optional string sourceApp = 17; + optional bool automatedGreetingMessageShown = 18; + optional string greetingMessageBody = 19; + optional string ctaPayload = 20; + optional bool disableNudge = 21; } message AdReplyInfo { @@ -810,12 +889,22 @@ message ContextInfo { message FeatureEligibilities { optional bool cannotBeReactedTo = 1; - optional bool canRequestFeedback = 2; + optional bool cannotBeRanked = 2; + optional bool canRequestFeedback = 3; } message DataSharingContext { + message Parameters { + optional string key = 1; + optional string stringData = 2; + optional int64 intData = 3; + optional float floatData = 4; + optional Parameters contents = 5; + } + optional bool showMmDisclosure = 1; optional string encryptedSignalTokenConsented = 2; + repeated Parameters parameters = 3; } message UTMInfo { @@ -862,6 +951,10 @@ message ContextInfo { optional DataSharingContext dataSharingContext = 47; optional bool alwaysShowAdAttribution = 48; optional FeatureEligibilities featureEligibilities = 49; + optional string entryPointConversionExternalSource = 50; + optional string entryPointConversionExternalMedium = 51; + optional string ctwaSignals = 54; + optional bytes ctwaPayload = 55; } message BotPluginMetadata { @@ -873,6 +966,7 @@ message BotPluginMetadata { enum SearchProvider { BING = 1; GOOGLE = 2; + SUPPORT = 3; } optional SearchProvider provider = 1; @@ -884,20 +978,24 @@ message BotPluginMetadata { optional uint32 expectedLinksCount = 7; optional string searchQuery = 9; optional WACommon.MessageKey parentPluginMessageKey = 10; - optional PluginType parentPluginType = 11; + optional PluginType deprecatedField = 11; + optional PluginType parentPluginType = 12; } -message BotSearchMetadata { - enum SessionSource { - NULL_STATE = 1; - TYPEAHEAD = 2; - USER_INPUT = 3; - EMU_FLASH = 4; - EMU_FLASH_FOLLOWUP = 5; +message BotMediaMetadata { + enum OrientationType { + CENTER = 1; + LEFT = 2; + RIGHT = 3; } - optional string sessionID = 1; - optional SessionSource sessionSource = 2; + optional string fileSHA256 = 1; + optional string mediaKey = 2; + optional string fileEncSHA256 = 3; + optional string directPath = 4; + optional int64 mediaKeyTimestamp = 5; + optional string mimetype = 6; + optional OrientationType orientationType = 7; } message BotReminderMetadata { @@ -913,6 +1011,7 @@ message BotReminderMetadata { NOTIFY = 1; CREATE = 2; DELETE = 3; + UPDATE = 4; } optional WACommon.MessageKey requestMessageKey = 1; @@ -922,11 +1021,28 @@ message BotReminderMetadata { optional ReminderFrequency frequency = 5; } +message BotModelMetadata { + enum PremiumModelStatus { + AVAILABLE = 1; + QUOTA_EXCEED_LIMIT = 2; + } + + enum ModelType { + LLAMA_PROD = 1; + LLAMA_PROD_PREMIUM = 2; + } + + optional ModelType modelType = 1; + optional PremiumModelStatus premiumModelStatus = 2; +} + message MessageAssociation { enum AssociationType { + UNKNOWN = 0; MEDIA_ALBUM = 1; BOT_PLUGIN = 2; EVENT_COVER_IMAGE = 3; + STATUS_POLL = 4; } optional AssociationType associationType = 1; @@ -949,6 +1065,8 @@ message MessageContextInfo { optional int32 reportingTokenVersion = 8; optional MessageAddonExpiryType messageAddOnExpiryType = 9; optional MessageAssociation messageAssociation = 10; + optional bool capiCreatedGroup = 11; + optional string supportPayload = 12; } message HydratedTemplateButton { @@ -1017,6 +1135,7 @@ message DisappearingMode { ACCOUNT_SETTING = 2; BULK_CHANGE = 3; BIZ_SUPPORTS_FB_HOSTING = 4; + UNKNOWN_GROUPS = 5; } enum Initiator { @@ -1120,12 +1239,49 @@ message Message { optional PlaceholderMessage placeholderMessage = 80; optional SecretEncryptedMessage secretEncryptedMessage = 82; optional AlbumMessage albumMessage = 83; - optional PollResultSnapshotMessage pollResultSnapshotMessage = 84; optional FutureProofMessage eventCoverImage = 85; + optional StickerPackMessage stickerPackMessage = 86; + optional FutureProofMessage statusMentionMessage = 87; + optional PollResultSnapshotMessage pollResultSnapshotMessage = 88; +} + +message StickerPackMessage { + message Sticker { + optional string fileName = 1; + optional bool isAnimated = 2; + repeated string emojis = 3; + optional string accessibilityLabel = 4; + optional bool isLottie = 5; + optional string mimetype = 6; + } + + optional string stickerPackID = 1; + optional string name = 2; + optional string publisher = 3; + repeated Sticker stickers = 4; + optional uint64 fileLength = 5; + optional bytes fileSHA256 = 6; + optional bytes fileEncSHA256 = 7; + optional bytes mediaKey = 8; + optional string directPath = 9; + optional string caption = 10; + optional ContextInfo contextInfo = 11; + optional string packDescription = 12; + optional int64 mediaKeyTimestamp = 13; + optional string trayIconFileName = 14; + optional string thumbnailDirectPath = 15; + optional bytes thumbnailSHA256 = 16; + optional bytes thumbnailEncSHA256 = 17; + optional uint32 thumbnailHeight = 18; + optional uint32 thumbnailWidth = 19; + optional string imageDataHash = 20; } message AlbumMessage { optional string caption = 1; + optional uint32 expectedImageCount = 2; + optional uint32 expectedVideoCount = 3; + optional ContextInfo contextInfo = 17; } message MessageHistoryBundle { @@ -1407,55 +1563,16 @@ message InitialSecurityNotificationSettingSync { optional bool securityNotificationEnabled = 1; } -message PeerDataOperationRequestResponseMessage { - message PeerDataOperationResult { - message WaffleNonceFetchResponse { - optional string nonce = 1; - optional string waEntFbid = 2; - } - - message PlaceholderMessageResendResponse { - optional bytes webMessageInfoBytes = 1; - } - - message LinkPreviewResponse { - message LinkPreviewHighQualityThumbnail { - optional string directPath = 1; - optional string thumbHash = 2; - optional string encThumbHash = 3; - optional bytes mediaKey = 4; - optional int64 mediaKeyTimestampMS = 5; - optional int32 thumbWidth = 6; - optional int32 thumbHeight = 7; - } - - optional string URL = 1; - optional string title = 2; - optional string description = 3; - optional bytes thumbData = 4; - optional string canonicalURL = 5; - optional string matchText = 6; - optional string previewType = 7; - optional LinkPreviewHighQualityThumbnail hqThumbnail = 8; - } - - optional WAMmsRetry.MediaRetryNotification.ResultType mediaUploadResult = 1; - optional StickerMessage stickerMessage = 2; - optional LinkPreviewResponse linkPreviewResponse = 3; - optional PlaceholderMessageResendResponse placeholderMessageResendResponse = 4; - optional WaffleNonceFetchResponse waffleNonceFetchRequestResponse = 5; - } - - optional PeerDataOperationRequestType peerDataOperationRequestType = 1; - optional string stanzaID = 2; - repeated PeerDataOperationResult peerDataOperationResult = 3; -} - message PeerDataOperationRequestMessage { message PlaceholderMessageResendRequest { optional WACommon.MessageKey messageKey = 1; } + message FullHistorySyncOnDemandRequest { + optional FullHistorySyncOnDemandRequestMetadata requestMetadata = 1; + optional WAWebProtobufsCompanionReg.DeviceProps.HistorySyncConfig historySyncConfig = 2; + } + message HistorySyncOnDemandRequest { optional string chatJID = 1; optional string oldestMsgID = 2; @@ -1478,6 +1595,11 @@ message PeerDataOperationRequestMessage { repeated RequestUrlPreview requestURLPreview = 3; optional HistorySyncOnDemandRequest historySyncOnDemandRequest = 4; repeated PlaceholderMessageResendRequest placeholderMessageResendRequest = 5; + optional FullHistorySyncOnDemandRequest fullHistorySyncOnDemandRequest = 6; +} + +message FullHistorySyncOnDemandRequestMetadata { + optional string requestID = 1; } message AppStateFatalExceptionNotification { @@ -1524,6 +1646,8 @@ message Call { optional string conversionSource = 2; optional bytes conversionData = 3; optional uint32 conversionDelaySeconds = 4; + optional string ctwaSignals = 5; + optional bytes ctwaPayload = 6; } message AudioMessage { @@ -1608,29 +1732,32 @@ message BotSuggestedPromptMetadata { optional uint32 selectedPromptIndex = 2; } -message BotMediaMetadata { - optional bytes fileSHA256 = 1; - optional bytes mediaKey = 2; - optional bytes fileEncSHA256 = 3; - optional string directPath = 4; - optional int64 mediaKeyTimestamp = 5; - optional string mimetype = 6; +message BotSessionMetadata { + optional string sessionID = 1; + optional BotSessionSource sessionSource = 2; } message BotMemuMetadata { repeated BotMediaMetadata faceImages = 1; } +message BotProgressIndicatorMetadata { + optional string progressDescription = 1; +} + message BotMetadata { optional BotAvatarMetadata avatarMetadata = 1; optional string personaID = 2; optional BotPluginMetadata pluginMetadata = 3; optional BotSuggestedPromptMetadata suggestedPromptMetadata = 4; optional string invokerJID = 5; - optional BotSearchMetadata searchMetadata = 6; + optional BotSessionMetadata sessionMetadata = 6; optional BotMemuMetadata memuMetadata = 7; optional string timezone = 8; optional BotReminderMetadata reminderMetadata = 9; + optional BotModelMetadata modelMetadata = 10; + optional string messageDisclaimerText = 11; + optional BotProgressIndicatorMetadata progressIndicatorMetadata = 12; } message DeviceListMetadata { @@ -1644,14 +1771,42 @@ message DeviceListMetadata { repeated uint32 recipientKeyIndexes = 10 [packed=true]; } +message EmbeddedMessage { + optional string stanzaID = 1; + optional Message message = 2; +} + +message EmbeddedMusic { + optional string musicContentMediaID = 1; + optional string songID = 2; + optional string author = 3; + optional string title = 4; + optional string artworkDirectPath = 5; + optional bytes artworkSHA256 = 6; + optional bytes artworkEncSHA256 = 7; + optional bytes artworkMediaKey = 11; + optional string artistAttribution = 8; + optional bytes countryBlocklist = 9; + optional bool isExplicit = 10; +} + +message EmbeddedContent { + oneof content { + EmbeddedMessage embeddedMessage = 1; + EmbeddedMusic embeddedMusic = 2; + } +} + message InteractiveAnnotation { oneof action { Location location = 2; ContextInfo.ForwardedNewsletterMessageInfo newsletter = 3; + bool embeddedAction = 6; } repeated Point polygonVertices = 1; optional bool shouldSkipConfirmation = 4; + optional EmbeddedContent embeddedContent = 5; } message Point { diff --git a/vendor/go.mau.fi/whatsmeow/proto/waEphemeral/WAWebProtobufsEphemeral.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waEphemeral/WAWebProtobufsEphemeral.pb.go index 02e03dcd..25297719 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waEphemeral/WAWebProtobufsEphemeral.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waEphemeral/WAWebProtobufsEphemeral.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waEphemeral/WAWebProtobufsEphemeral.proto @@ -96,7 +96,7 @@ func file_waEphemeral_WAWebProtobufsEphemeral_proto_rawDescGZIP() []byte { } var file_waEphemeral_WAWebProtobufsEphemeral_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_waEphemeral_WAWebProtobufsEphemeral_proto_goTypes = []interface{}{ +var file_waEphemeral_WAWebProtobufsEphemeral_proto_goTypes = []any{ (*EphemeralSetting)(nil), // 0: WAWebProtobufsEphemeral.EphemeralSetting } var file_waEphemeral_WAWebProtobufsEphemeral_proto_depIdxs = []int32{ @@ -113,7 +113,7 @@ func file_waEphemeral_WAWebProtobufsEphemeral_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waEphemeral_WAWebProtobufsEphemeral_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waEphemeral_WAWebProtobufsEphemeral_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*EphemeralSetting); i { case 0: return &v.state diff --git a/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.go index 2bb00908..b27bcb56 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waHistorySync/WAWebProtobufsHistorySync.proto @@ -451,20 +451,22 @@ type HistorySync struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - SyncType *HistorySync_HistorySyncType `protobuf:"varint,1,req,name=syncType,enum=WAWebProtobufsHistorySync.HistorySync_HistorySyncType" json:"syncType,omitempty"` - Conversations []*Conversation `protobuf:"bytes,2,rep,name=conversations" json:"conversations,omitempty"` - StatusV3Messages []*waWeb.WebMessageInfo `protobuf:"bytes,3,rep,name=statusV3Messages" json:"statusV3Messages,omitempty"` - ChunkOrder *uint32 `protobuf:"varint,5,opt,name=chunkOrder" json:"chunkOrder,omitempty"` - Progress *uint32 `protobuf:"varint,6,opt,name=progress" json:"progress,omitempty"` - Pushnames []*Pushname `protobuf:"bytes,7,rep,name=pushnames" json:"pushnames,omitempty"` - GlobalSettings *GlobalSettings `protobuf:"bytes,8,opt,name=globalSettings" json:"globalSettings,omitempty"` - ThreadIDUserSecret []byte `protobuf:"bytes,9,opt,name=threadIDUserSecret" json:"threadIDUserSecret,omitempty"` - ThreadDsTimeframeOffset *uint32 `protobuf:"varint,10,opt,name=threadDsTimeframeOffset" json:"threadDsTimeframeOffset,omitempty"` - RecentStickers []*StickerMetadata `protobuf:"bytes,11,rep,name=recentStickers" json:"recentStickers,omitempty"` - PastParticipants []*PastParticipants `protobuf:"bytes,12,rep,name=pastParticipants" json:"pastParticipants,omitempty"` - CallLogRecords []*waSyncAction.CallLogRecord `protobuf:"bytes,13,rep,name=callLogRecords" json:"callLogRecords,omitempty"` - AiWaitListState *HistorySync_BotAIWaitListState `protobuf:"varint,14,opt,name=aiWaitListState,enum=WAWebProtobufsHistorySync.HistorySync_BotAIWaitListState" json:"aiWaitListState,omitempty"` - PhoneNumberToLidMappings []*PhoneNumberToLIDMapping `protobuf:"bytes,15,rep,name=phoneNumberToLidMappings" json:"phoneNumberToLidMappings,omitempty"` + SyncType *HistorySync_HistorySyncType `protobuf:"varint,1,req,name=syncType,enum=WAWebProtobufsHistorySync.HistorySync_HistorySyncType" json:"syncType,omitempty"` + Conversations []*Conversation `protobuf:"bytes,2,rep,name=conversations" json:"conversations,omitempty"` + StatusV3Messages []*waWeb.WebMessageInfo `protobuf:"bytes,3,rep,name=statusV3Messages" json:"statusV3Messages,omitempty"` + ChunkOrder *uint32 `protobuf:"varint,5,opt,name=chunkOrder" json:"chunkOrder,omitempty"` + Progress *uint32 `protobuf:"varint,6,opt,name=progress" json:"progress,omitempty"` + Pushnames []*Pushname `protobuf:"bytes,7,rep,name=pushnames" json:"pushnames,omitempty"` + GlobalSettings *GlobalSettings `protobuf:"bytes,8,opt,name=globalSettings" json:"globalSettings,omitempty"` + ThreadIDUserSecret []byte `protobuf:"bytes,9,opt,name=threadIDUserSecret" json:"threadIDUserSecret,omitempty"` + ThreadDsTimeframeOffset *uint32 `protobuf:"varint,10,opt,name=threadDsTimeframeOffset" json:"threadDsTimeframeOffset,omitempty"` + RecentStickers []*StickerMetadata `protobuf:"bytes,11,rep,name=recentStickers" json:"recentStickers,omitempty"` + PastParticipants []*PastParticipants `protobuf:"bytes,12,rep,name=pastParticipants" json:"pastParticipants,omitempty"` + CallLogRecords []*waSyncAction.CallLogRecord `protobuf:"bytes,13,rep,name=callLogRecords" json:"callLogRecords,omitempty"` + AiWaitListState *HistorySync_BotAIWaitListState `protobuf:"varint,14,opt,name=aiWaitListState,enum=WAWebProtobufsHistorySync.HistorySync_BotAIWaitListState" json:"aiWaitListState,omitempty"` + PhoneNumberToLidMappings []*PhoneNumberToLIDMapping `protobuf:"bytes,15,rep,name=phoneNumberToLidMappings" json:"phoneNumberToLidMappings,omitempty"` + CompanionMetaNonce *string `protobuf:"bytes,16,opt,name=companionMetaNonce" json:"companionMetaNonce,omitempty"` + ShareableChatIdentifierEncryptionKey []byte `protobuf:"bytes,17,opt,name=shareableChatIdentifierEncryptionKey" json:"shareableChatIdentifierEncryptionKey,omitempty"` } func (x *HistorySync) Reset() { @@ -597,6 +599,20 @@ func (x *HistorySync) GetPhoneNumberToLidMappings() []*PhoneNumberToLIDMapping { return nil } +func (x *HistorySync) GetCompanionMetaNonce() string { + if x != nil && x.CompanionMetaNonce != nil { + return *x.CompanionMetaNonce + } + return "" +} + +func (x *HistorySync) GetShareableChatIdentifierEncryptionKey() []byte { + if x != nil { + return x.ShareableChatIdentifierEncryptionKey + } + return nil +} + type Conversation struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -649,6 +665,7 @@ type Conversation struct { CommentsCount *uint32 `protobuf:"varint,45,opt,name=commentsCount" json:"commentsCount,omitempty"` Locked *bool `protobuf:"varint,46,opt,name=locked" json:"locked,omitempty"` SystemMessageToInsert *PrivacySystemMessage `protobuf:"varint,47,opt,name=systemMessageToInsert,enum=WAWebProtobufsHistorySync.PrivacySystemMessage" json:"systemMessageToInsert,omitempty"` + CapiCreatedGroup *bool `protobuf:"varint,48,opt,name=capiCreatedGroup" json:"capiCreatedGroup,omitempty"` } func (x *Conversation) Reset() { @@ -1012,6 +1029,13 @@ func (x *Conversation) GetSystemMessageToInsert() PrivacySystemMessage { return PrivacySystemMessage_E2EE_MSG } +func (x *Conversation) GetCapiCreatedGroup() bool { + if x != nil && x.CapiCreatedGroup != nil { + return *x.CapiCreatedGroup + } + return false +} + type GroupParticipant struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1963,7 +1987,7 @@ func file_waHistorySync_WAWebProtobufsHistorySync_proto_rawDescGZIP() []byte { var file_waHistorySync_WAWebProtobufsHistorySync_proto_enumTypes = make([]protoimpl.EnumInfo, 7) var file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes = make([]protoimpl.MessageInfo, 14) -var file_waHistorySync_WAWebProtobufsHistorySync_proto_goTypes = []interface{}{ +var file_waHistorySync_WAWebProtobufsHistorySync_proto_goTypes = []any{ (MediaVisibility)(0), // 0: WAWebProtobufsHistorySync.MediaVisibility (PrivacySystemMessage)(0), // 1: WAWebProtobufsHistorySync.PrivacySystemMessage (HistorySync_BotAIWaitListState)(0), // 2: WAWebProtobufsHistorySync.HistorySync.BotAIWaitListState @@ -2035,7 +2059,7 @@ func file_waHistorySync_WAWebProtobufsHistorySync_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*HistorySync); i { case 0: return &v.state @@ -2047,7 +2071,7 @@ func file_waHistorySync_WAWebProtobufsHistorySync_proto_init() { return nil } } - file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*Conversation); i { case 0: return &v.state @@ -2059,7 +2083,7 @@ func file_waHistorySync_WAWebProtobufsHistorySync_proto_init() { return nil } } - file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*GroupParticipant); i { case 0: return &v.state @@ -2071,7 +2095,7 @@ func file_waHistorySync_WAWebProtobufsHistorySync_proto_init() { return nil } } - file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*PastParticipant); i { case 0: return &v.state @@ -2083,7 +2107,7 @@ func file_waHistorySync_WAWebProtobufsHistorySync_proto_init() { return nil } } - file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*PhoneNumberToLIDMapping); i { case 0: return &v.state @@ -2095,7 +2119,7 @@ func file_waHistorySync_WAWebProtobufsHistorySync_proto_init() { return nil } } - file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*HistorySyncMsg); i { case 0: return &v.state @@ -2107,7 +2131,7 @@ func file_waHistorySync_WAWebProtobufsHistorySync_proto_init() { return nil } } - file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*Pushname); i { case 0: return &v.state @@ -2119,7 +2143,7 @@ func file_waHistorySync_WAWebProtobufsHistorySync_proto_init() { return nil } } - file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*WallpaperSettings); i { case 0: return &v.state @@ -2131,7 +2155,7 @@ func file_waHistorySync_WAWebProtobufsHistorySync_proto_init() { return nil } } - file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*GlobalSettings); i { case 0: return &v.state @@ -2143,7 +2167,7 @@ func file_waHistorySync_WAWebProtobufsHistorySync_proto_init() { return nil } } - file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*AutoDownloadSettings); i { case 0: return &v.state @@ -2155,7 +2179,7 @@ func file_waHistorySync_WAWebProtobufsHistorySync_proto_init() { return nil } } - file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*StickerMetadata); i { case 0: return &v.state @@ -2167,7 +2191,7 @@ func file_waHistorySync_WAWebProtobufsHistorySync_proto_init() { return nil } } - file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*PastParticipants); i { case 0: return &v.state @@ -2179,7 +2203,7 @@ func file_waHistorySync_WAWebProtobufsHistorySync_proto_init() { return nil } } - file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[12].Exporter = func(v any, i int) any { switch v := v.(*AvatarUserSettings); i { case 0: return &v.state @@ -2191,7 +2215,7 @@ func file_waHistorySync_WAWebProtobufsHistorySync_proto_init() { return nil } } - file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_waHistorySync_WAWebProtobufsHistorySync_proto_msgTypes[13].Exporter = func(v any, i int) any { switch v := v.(*NotificationSettings); i { case 0: return &v.state diff --git a/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.raw b/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.raw index 42902631..5269543d 100644 Binary files a/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.raw and b/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.raw differ diff --git a/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.proto b/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.proto index 6f854263..b13bb7f0 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.proto +++ b/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.proto @@ -49,6 +49,8 @@ message HistorySync { repeated WASyncAction.CallLogRecord callLogRecords = 13; optional BotAIWaitListState aiWaitListState = 14; repeated PhoneNumberToLIDMapping phoneNumberToLidMappings = 15; + optional string companionMetaNonce = 16; + optional bytes shareableChatIdentifierEncryptionKey = 17; } message Conversation { @@ -105,6 +107,7 @@ message Conversation { optional uint32 commentsCount = 45; optional bool locked = 46; optional PrivacySystemMessage systemMessageToInsert = 47; + optional bool capiCreatedGroup = 48; } message GroupParticipant { diff --git a/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.pb.go index 92d13e1a..363f0ba7 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waMediaTransport/WAMediaTransport.proto @@ -977,12 +977,14 @@ type ImageTransport_Ancillary struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Height *uint32 `protobuf:"varint,1,opt,name=height" json:"height,omitempty"` - Width *uint32 `protobuf:"varint,2,opt,name=width" json:"width,omitempty"` - ScansSidecar []byte `protobuf:"bytes,3,opt,name=scansSidecar" json:"scansSidecar,omitempty"` - ScanLengths []uint32 `protobuf:"varint,4,rep,name=scanLengths" json:"scanLengths,omitempty"` - MidQualityFileSHA256 []byte `protobuf:"bytes,5,opt,name=midQualityFileSHA256" json:"midQualityFileSHA256,omitempty"` - HdType *ImageTransport_Ancillary_HdType `protobuf:"varint,6,opt,name=hdType,enum=WAMediaTransport.ImageTransport_Ancillary_HdType" json:"hdType,omitempty"` + Height *uint32 `protobuf:"varint,1,opt,name=height" json:"height,omitempty"` + Width *uint32 `protobuf:"varint,2,opt,name=width" json:"width,omitempty"` + ScansSidecar []byte `protobuf:"bytes,3,opt,name=scansSidecar" json:"scansSidecar,omitempty"` + ScanLengths []uint32 `protobuf:"varint,4,rep,name=scanLengths" json:"scanLengths,omitempty"` + MidQualityFileSHA256 []byte `protobuf:"bytes,5,opt,name=midQualityFileSHA256" json:"midQualityFileSHA256,omitempty"` + HdType *ImageTransport_Ancillary_HdType `protobuf:"varint,6,opt,name=hdType,enum=WAMediaTransport.ImageTransport_Ancillary_HdType" json:"hdType,omitempty"` + MemoriesConceptScores []float32 `protobuf:"fixed32,7,rep,packed,name=memoriesConceptScores" json:"memoriesConceptScores,omitempty"` + MemoriesConceptIDs []uint32 `protobuf:"varint,8,rep,packed,name=memoriesConceptIDs" json:"memoriesConceptIDs,omitempty"` } func (x *ImageTransport_Ancillary) Reset() { @@ -1059,6 +1061,20 @@ func (x *ImageTransport_Ancillary) GetHdType() ImageTransport_Ancillary_HdType { return ImageTransport_Ancillary_NONE } +func (x *ImageTransport_Ancillary) GetMemoriesConceptScores() []float32 { + if x != nil { + return x.MemoriesConceptScores + } + return nil +} + +func (x *ImageTransport_Ancillary) GetMemoriesConceptIDs() []uint32 { + if x != nil { + return x.MemoriesConceptIDs + } + return nil +} + type ImageTransport_Integral struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1915,7 +1931,7 @@ func file_waMediaTransport_WAMediaTransport_proto_rawDescGZIP() []byte { var file_waMediaTransport_WAMediaTransport_proto_enumTypes = make([]protoimpl.EnumInfo, 4) var file_waMediaTransport_WAMediaTransport_proto_msgTypes = make([]protoimpl.MessageInfo, 25) -var file_waMediaTransport_WAMediaTransport_proto_goTypes = []interface{}{ +var file_waMediaTransport_WAMediaTransport_proto_goTypes = []any{ (ImageTransport_Ancillary_HdType)(0), // 0: WAMediaTransport.ImageTransport.Ancillary.HdType (VideoTransport_Ancillary_Attribution)(0), // 1: WAMediaTransport.VideoTransport.Ancillary.Attribution (AudioTransport_Ancillary_AvatarAudio_AnimationsType)(0), // 2: WAMediaTransport.AudioTransport.Ancillary.AvatarAudio.AnimationsType @@ -1990,7 +2006,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waMediaTransport_WAMediaTransport_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*WAMediaTransport); i { case 0: return &v.state @@ -2002,7 +2018,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*ImageTransport); i { case 0: return &v.state @@ -2014,7 +2030,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*VideoTransport); i { case 0: return &v.state @@ -2026,7 +2042,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*AudioTransport); i { case 0: return &v.state @@ -2038,7 +2054,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*DocumentTransport); i { case 0: return &v.state @@ -2050,7 +2066,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*StickerTransport); i { case 0: return &v.state @@ -2062,7 +2078,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*ContactTransport); i { case 0: return &v.state @@ -2074,7 +2090,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*WAMediaTransport_Ancillary); i { case 0: return &v.state @@ -2086,7 +2102,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*WAMediaTransport_Integral); i { case 0: return &v.state @@ -2098,7 +2114,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*WAMediaTransport_Ancillary_Thumbnail); i { case 0: return &v.state @@ -2110,7 +2126,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*WAMediaTransport_Ancillary_Thumbnail_DownloadableThumbnail); i { case 0: return &v.state @@ -2122,7 +2138,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*ImageTransport_Ancillary); i { case 0: return &v.state @@ -2134,7 +2150,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[12].Exporter = func(v any, i int) any { switch v := v.(*ImageTransport_Integral); i { case 0: return &v.state @@ -2146,7 +2162,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[13].Exporter = func(v any, i int) any { switch v := v.(*VideoTransport_Ancillary); i { case 0: return &v.state @@ -2158,7 +2174,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[14].Exporter = func(v any, i int) any { switch v := v.(*VideoTransport_Integral); i { case 0: return &v.state @@ -2170,7 +2186,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[15].Exporter = func(v any, i int) any { switch v := v.(*AudioTransport_Ancillary); i { case 0: return &v.state @@ -2182,7 +2198,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[16].Exporter = func(v any, i int) any { switch v := v.(*AudioTransport_Integral); i { case 0: return &v.state @@ -2194,7 +2210,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[17].Exporter = func(v any, i int) any { switch v := v.(*AudioTransport_Ancillary_AvatarAudio); i { case 0: return &v.state @@ -2206,7 +2222,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[18].Exporter = func(v any, i int) any { switch v := v.(*AudioTransport_Ancillary_AvatarAudio_DownloadableAvatarAnimations); i { case 0: return &v.state @@ -2218,7 +2234,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[19].Exporter = func(v any, i int) any { switch v := v.(*DocumentTransport_Ancillary); i { case 0: return &v.state @@ -2230,7 +2246,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[20].Exporter = func(v any, i int) any { switch v := v.(*DocumentTransport_Integral); i { case 0: return &v.state @@ -2242,7 +2258,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[21].Exporter = func(v any, i int) any { switch v := v.(*StickerTransport_Ancillary); i { case 0: return &v.state @@ -2254,7 +2270,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[22].Exporter = func(v any, i int) any { switch v := v.(*StickerTransport_Integral); i { case 0: return &v.state @@ -2266,7 +2282,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[23].Exporter = func(v any, i int) any { switch v := v.(*ContactTransport_Ancillary); i { case 0: return &v.state @@ -2278,7 +2294,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { return nil } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + file_waMediaTransport_WAMediaTransport_proto_msgTypes[24].Exporter = func(v any, i int) any { switch v := v.(*ContactTransport_Integral); i { case 0: return &v.state @@ -2291,7 +2307,7 @@ func file_waMediaTransport_WAMediaTransport_proto_init() { } } } - file_waMediaTransport_WAMediaTransport_proto_msgTypes[24].OneofWrappers = []interface{}{ + file_waMediaTransport_WAMediaTransport_proto_msgTypes[24].OneofWrappers = []any{ (*ContactTransport_Integral_Vcard)(nil), (*ContactTransport_Integral_DownloadableVcard)(nil), } diff --git a/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.pb.raw b/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.pb.raw index beb76546..ffb5cb20 100644 Binary files a/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.pb.raw and b/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.pb.raw differ diff --git a/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.proto b/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.proto index 3b924b9e..bf852db3 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.proto +++ b/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.proto @@ -56,6 +56,8 @@ message ImageTransport { repeated uint32 scanLengths = 4; optional bytes midQualityFileSHA256 = 5; optional HdType hdType = 6; + repeated float memoriesConceptScores = 7 [packed=true]; + repeated uint32 memoriesConceptIDs = 8 [packed=true]; } message Integral { diff --git a/vendor/go.mau.fi/whatsmeow/proto/waMmsRetry/WAMmsRetry.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waMmsRetry/WAMmsRetry.pb.go index 998d2f98..1529da67 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waMmsRetry/WAMmsRetry.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waMmsRetry/WAMmsRetry.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waMmsRetry/WAMmsRetry.proto @@ -214,7 +214,7 @@ func file_waMmsRetry_WAMmsRetry_proto_rawDescGZIP() []byte { var file_waMmsRetry_WAMmsRetry_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_waMmsRetry_WAMmsRetry_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_waMmsRetry_WAMmsRetry_proto_goTypes = []interface{}{ +var file_waMmsRetry_WAMmsRetry_proto_goTypes = []any{ (MediaRetryNotification_ResultType)(0), // 0: WAMmsRetry.MediaRetryNotification.ResultType (*MediaRetryNotification)(nil), // 1: WAMmsRetry.MediaRetryNotification (*ServerErrorReceipt)(nil), // 2: WAMmsRetry.ServerErrorReceipt @@ -234,7 +234,7 @@ func file_waMmsRetry_WAMmsRetry_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waMmsRetry_WAMmsRetry_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waMmsRetry_WAMmsRetry_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*MediaRetryNotification); i { case 0: return &v.state @@ -246,7 +246,7 @@ func file_waMmsRetry_WAMmsRetry_proto_init() { return nil } } - file_waMmsRetry_WAMmsRetry_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waMmsRetry_WAMmsRetry_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*ServerErrorReceipt); i { case 0: return &v.state diff --git a/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.pb.go index 3ea35ef5..84ac6cd0 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waMsgApplication/WAMsgApplication.proto @@ -162,6 +162,7 @@ type MessageApplication_Metadata struct { GroupIndex *uint32 `protobuf:"varint,15,opt,name=groupIndex" json:"groupIndex,omitempty"` BotResponseID *string `protobuf:"bytes,16,opt,name=botResponseID" json:"botResponseID,omitempty"` CollapsibleID *string `protobuf:"bytes,17,opt,name=collapsibleID" json:"collapsibleID,omitempty"` + SecondaryOtid *string `protobuf:"bytes,18,opt,name=secondaryOtid" json:"secondaryOtid,omitempty"` } func (x *MessageApplication_Metadata) Reset() { @@ -315,6 +316,13 @@ func (x *MessageApplication_Metadata) GetCollapsibleID() string { return "" } +func (x *MessageApplication_Metadata) GetSecondaryOtid() string { + if x != nil && x.SecondaryOtid != nil { + return *x.SecondaryOtid + } + return "" +} + type isMessageApplication_Metadata_Ephemeral interface { isMessageApplication_Metadata_Ephemeral() } @@ -919,7 +927,7 @@ func file_waMsgApplication_WAMsgApplication_proto_rawDescGZIP() []byte { var file_waMsgApplication_WAMsgApplication_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_waMsgApplication_WAMsgApplication_proto_msgTypes = make([]protoimpl.MessageInfo, 10) -var file_waMsgApplication_WAMsgApplication_proto_goTypes = []interface{}{ +var file_waMsgApplication_WAMsgApplication_proto_goTypes = []any{ (MessageApplication_Metadata_ThreadType)(0), // 0: WAMsgApplication.MessageApplication.Metadata.ThreadType (*MessageApplication)(nil), // 1: WAMsgApplication.MessageApplication (*MessageApplication_Metadata)(nil), // 2: WAMsgApplication.MessageApplication.Metadata @@ -968,7 +976,7 @@ func file_waMsgApplication_WAMsgApplication_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waMsgApplication_WAMsgApplication_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waMsgApplication_WAMsgApplication_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*MessageApplication); i { case 0: return &v.state @@ -980,7 +988,7 @@ func file_waMsgApplication_WAMsgApplication_proto_init() { return nil } } - file_waMsgApplication_WAMsgApplication_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waMsgApplication_WAMsgApplication_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*MessageApplication_Metadata); i { case 0: return &v.state @@ -992,7 +1000,7 @@ func file_waMsgApplication_WAMsgApplication_proto_init() { return nil } } - file_waMsgApplication_WAMsgApplication_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waMsgApplication_WAMsgApplication_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*MessageApplication_Payload); i { case 0: return &v.state @@ -1004,7 +1012,7 @@ func file_waMsgApplication_WAMsgApplication_proto_init() { return nil } } - file_waMsgApplication_WAMsgApplication_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waMsgApplication_WAMsgApplication_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*MessageApplication_SubProtocolPayload); i { case 0: return &v.state @@ -1016,7 +1024,7 @@ func file_waMsgApplication_WAMsgApplication_proto_init() { return nil } } - file_waMsgApplication_WAMsgApplication_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_waMsgApplication_WAMsgApplication_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*MessageApplication_ApplicationData); i { case 0: return &v.state @@ -1028,7 +1036,7 @@ func file_waMsgApplication_WAMsgApplication_proto_init() { return nil } } - file_waMsgApplication_WAMsgApplication_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_waMsgApplication_WAMsgApplication_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*MessageApplication_Signal); i { case 0: return &v.state @@ -1040,7 +1048,7 @@ func file_waMsgApplication_WAMsgApplication_proto_init() { return nil } } - file_waMsgApplication_WAMsgApplication_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_waMsgApplication_WAMsgApplication_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*MessageApplication_Content); i { case 0: return &v.state @@ -1052,7 +1060,7 @@ func file_waMsgApplication_WAMsgApplication_proto_init() { return nil } } - file_waMsgApplication_WAMsgApplication_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_waMsgApplication_WAMsgApplication_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*MessageApplication_EphemeralSetting); i { case 0: return &v.state @@ -1064,7 +1072,7 @@ func file_waMsgApplication_WAMsgApplication_proto_init() { return nil } } - file_waMsgApplication_WAMsgApplication_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_waMsgApplication_WAMsgApplication_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*MessageApplication_Metadata_QuotedMessage); i { case 0: return &v.state @@ -1076,7 +1084,7 @@ func file_waMsgApplication_WAMsgApplication_proto_init() { return nil } } - file_waMsgApplication_WAMsgApplication_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_waMsgApplication_WAMsgApplication_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*MessageApplication_Metadata_EphemeralSettingMap); i { case 0: return &v.state @@ -1089,18 +1097,18 @@ func file_waMsgApplication_WAMsgApplication_proto_init() { } } } - file_waMsgApplication_WAMsgApplication_proto_msgTypes[1].OneofWrappers = []interface{}{ + file_waMsgApplication_WAMsgApplication_proto_msgTypes[1].OneofWrappers = []any{ (*MessageApplication_Metadata_ChatEphemeralSetting)(nil), (*MessageApplication_Metadata_EphemeralSettingList)(nil), (*MessageApplication_Metadata_EphemeralSharedSecret)(nil), } - file_waMsgApplication_WAMsgApplication_proto_msgTypes[2].OneofWrappers = []interface{}{ + file_waMsgApplication_WAMsgApplication_proto_msgTypes[2].OneofWrappers = []any{ (*MessageApplication_Payload_CoreContent)(nil), (*MessageApplication_Payload_Signal)(nil), (*MessageApplication_Payload_ApplicationData)(nil), (*MessageApplication_Payload_SubProtocol)(nil), } - file_waMsgApplication_WAMsgApplication_proto_msgTypes[3].OneofWrappers = []interface{}{ + file_waMsgApplication_WAMsgApplication_proto_msgTypes[3].OneofWrappers = []any{ (*MessageApplication_SubProtocolPayload_ConsumerMessage)(nil), (*MessageApplication_SubProtocolPayload_BusinessMessage)(nil), (*MessageApplication_SubProtocolPayload_PaymentMessage)(nil), diff --git a/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.pb.raw b/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.pb.raw index d9bfeed9..6621be27 100644 Binary files a/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.pb.raw and b/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.pb.raw differ diff --git a/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.proto b/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.proto index 1bbe5330..54ee0cf0 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.proto +++ b/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.proto @@ -43,6 +43,7 @@ message MessageApplication { optional uint32 groupIndex = 15; optional string botResponseID = 16; optional string collapsibleID = 17; + optional string secondaryOtid = 18; } message Payload { diff --git a/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/WAMsgTransport.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/WAMsgTransport.pb.go index ff46f8d8..89394936 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/WAMsgTransport.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/WAMsgTransport.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waMsgTransport/WAMsgTransport.proto @@ -775,7 +775,7 @@ func file_waMsgTransport_WAMsgTransport_proto_rawDescGZIP() []byte { var file_waMsgTransport_WAMsgTransport_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_waMsgTransport_WAMsgTransport_proto_msgTypes = make([]protoimpl.MessageInfo, 11) -var file_waMsgTransport_WAMsgTransport_proto_goTypes = []interface{}{ +var file_waMsgTransport_WAMsgTransport_proto_goTypes = []any{ (MessageTransport_Protocol_Ancillary_BackupDirective_ActionType)(0), // 0: WAMsgTransport.MessageTransport.Protocol.Ancillary.BackupDirective.ActionType (*MessageTransport)(nil), // 1: WAMsgTransport.MessageTransport (*DeviceListMetadata)(nil), // 2: WAMsgTransport.DeviceListMetadata @@ -819,7 +819,7 @@ func file_waMsgTransport_WAMsgTransport_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waMsgTransport_WAMsgTransport_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waMsgTransport_WAMsgTransport_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*MessageTransport); i { case 0: return &v.state @@ -831,7 +831,7 @@ func file_waMsgTransport_WAMsgTransport_proto_init() { return nil } } - file_waMsgTransport_WAMsgTransport_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waMsgTransport_WAMsgTransport_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*DeviceListMetadata); i { case 0: return &v.state @@ -843,7 +843,7 @@ func file_waMsgTransport_WAMsgTransport_proto_init() { return nil } } - file_waMsgTransport_WAMsgTransport_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waMsgTransport_WAMsgTransport_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*MessageTransport_Payload); i { case 0: return &v.state @@ -855,7 +855,7 @@ func file_waMsgTransport_WAMsgTransport_proto_init() { return nil } } - file_waMsgTransport_WAMsgTransport_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waMsgTransport_WAMsgTransport_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*MessageTransport_Protocol); i { case 0: return &v.state @@ -867,7 +867,7 @@ func file_waMsgTransport_WAMsgTransport_proto_init() { return nil } } - file_waMsgTransport_WAMsgTransport_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_waMsgTransport_WAMsgTransport_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*MessageTransport_Protocol_Ancillary); i { case 0: return &v.state @@ -879,7 +879,7 @@ func file_waMsgTransport_WAMsgTransport_proto_init() { return nil } } - file_waMsgTransport_WAMsgTransport_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_waMsgTransport_WAMsgTransport_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*MessageTransport_Protocol_Integral); i { case 0: return &v.state @@ -891,7 +891,7 @@ func file_waMsgTransport_WAMsgTransport_proto_init() { return nil } } - file_waMsgTransport_WAMsgTransport_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_waMsgTransport_WAMsgTransport_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*MessageTransport_Protocol_Ancillary_BackupDirective); i { case 0: return &v.state @@ -903,7 +903,7 @@ func file_waMsgTransport_WAMsgTransport_proto_init() { return nil } } - file_waMsgTransport_WAMsgTransport_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_waMsgTransport_WAMsgTransport_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*MessageTransport_Protocol_Ancillary_ICDCParticipantDevices); i { case 0: return &v.state @@ -915,7 +915,7 @@ func file_waMsgTransport_WAMsgTransport_proto_init() { return nil } } - file_waMsgTransport_WAMsgTransport_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_waMsgTransport_WAMsgTransport_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*MessageTransport_Protocol_Ancillary_SenderKeyDistributionMessage); i { case 0: return &v.state @@ -927,7 +927,7 @@ func file_waMsgTransport_WAMsgTransport_proto_init() { return nil } } - file_waMsgTransport_WAMsgTransport_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_waMsgTransport_WAMsgTransport_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*MessageTransport_Protocol_Ancillary_ICDCParticipantDevices_ICDCIdentityListDescription); i { case 0: return &v.state @@ -939,7 +939,7 @@ func file_waMsgTransport_WAMsgTransport_proto_init() { return nil } } - file_waMsgTransport_WAMsgTransport_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_waMsgTransport_WAMsgTransport_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*MessageTransport_Protocol_Integral_DeviceSentMessage); i { case 0: return &v.state diff --git a/vendor/go.mau.fi/whatsmeow/proto/waMultiDevice/WAMultiDevice.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waMultiDevice/WAMultiDevice.pb.go index e4df33a8..1349093a 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waMultiDevice/WAMultiDevice.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waMultiDevice/WAMultiDevice.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waMultiDevice/WAMultiDevice.proto @@ -659,7 +659,7 @@ func file_waMultiDevice_WAMultiDevice_proto_rawDescGZIP() []byte { } var file_waMultiDevice_WAMultiDevice_proto_msgTypes = make([]protoimpl.MessageInfo, 11) -var file_waMultiDevice_WAMultiDevice_proto_goTypes = []interface{}{ +var file_waMultiDevice_WAMultiDevice_proto_goTypes = []any{ (*MultiDevice)(nil), // 0: WAMultiDevice.MultiDevice (*MultiDevice_Metadata)(nil), // 1: WAMultiDevice.MultiDevice.Metadata (*MultiDevice_Payload)(nil), // 2: WAMultiDevice.MultiDevice.Payload @@ -697,7 +697,7 @@ func file_waMultiDevice_WAMultiDevice_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waMultiDevice_WAMultiDevice_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waMultiDevice_WAMultiDevice_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*MultiDevice); i { case 0: return &v.state @@ -709,7 +709,7 @@ func file_waMultiDevice_WAMultiDevice_proto_init() { return nil } } - file_waMultiDevice_WAMultiDevice_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waMultiDevice_WAMultiDevice_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*MultiDevice_Metadata); i { case 0: return &v.state @@ -721,7 +721,7 @@ func file_waMultiDevice_WAMultiDevice_proto_init() { return nil } } - file_waMultiDevice_WAMultiDevice_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waMultiDevice_WAMultiDevice_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*MultiDevice_Payload); i { case 0: return &v.state @@ -733,7 +733,7 @@ func file_waMultiDevice_WAMultiDevice_proto_init() { return nil } } - file_waMultiDevice_WAMultiDevice_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waMultiDevice_WAMultiDevice_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*MultiDevice_ApplicationData); i { case 0: return &v.state @@ -745,7 +745,7 @@ func file_waMultiDevice_WAMultiDevice_proto_init() { return nil } } - file_waMultiDevice_WAMultiDevice_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_waMultiDevice_WAMultiDevice_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*MultiDevice_Signal); i { case 0: return &v.state @@ -757,7 +757,7 @@ func file_waMultiDevice_WAMultiDevice_proto_init() { return nil } } - file_waMultiDevice_WAMultiDevice_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_waMultiDevice_WAMultiDevice_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*MultiDevice_ApplicationData_AppStateSyncKeyRequestMessage); i { case 0: return &v.state @@ -769,7 +769,7 @@ func file_waMultiDevice_WAMultiDevice_proto_init() { return nil } } - file_waMultiDevice_WAMultiDevice_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_waMultiDevice_WAMultiDevice_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*MultiDevice_ApplicationData_AppStateSyncKeyShareMessage); i { case 0: return &v.state @@ -781,7 +781,7 @@ func file_waMultiDevice_WAMultiDevice_proto_init() { return nil } } - file_waMultiDevice_WAMultiDevice_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_waMultiDevice_WAMultiDevice_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*MultiDevice_ApplicationData_AppStateSyncKey); i { case 0: return &v.state @@ -793,7 +793,7 @@ func file_waMultiDevice_WAMultiDevice_proto_init() { return nil } } - file_waMultiDevice_WAMultiDevice_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_waMultiDevice_WAMultiDevice_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*MultiDevice_ApplicationData_AppStateSyncKeyId); i { case 0: return &v.state @@ -805,7 +805,7 @@ func file_waMultiDevice_WAMultiDevice_proto_init() { return nil } } - file_waMultiDevice_WAMultiDevice_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_waMultiDevice_WAMultiDevice_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*MultiDevice_ApplicationData_AppStateSyncKey_AppStateSyncKeyData); i { case 0: return &v.state @@ -817,7 +817,7 @@ func file_waMultiDevice_WAMultiDevice_proto_init() { return nil } } - file_waMultiDevice_WAMultiDevice_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_waMultiDevice_WAMultiDevice_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*MultiDevice_ApplicationData_AppStateSyncKey_AppStateSyncKeyData_AppStateSyncKeyFingerprint); i { case 0: return &v.state @@ -830,11 +830,11 @@ func file_waMultiDevice_WAMultiDevice_proto_init() { } } } - file_waMultiDevice_WAMultiDevice_proto_msgTypes[2].OneofWrappers = []interface{}{ + file_waMultiDevice_WAMultiDevice_proto_msgTypes[2].OneofWrappers = []any{ (*MultiDevice_Payload_ApplicationData)(nil), (*MultiDevice_Payload_Signal)(nil), } - file_waMultiDevice_WAMultiDevice_proto_msgTypes[3].OneofWrappers = []interface{}{ + file_waMultiDevice_WAMultiDevice_proto_msgTypes[3].OneofWrappers = []any{ (*MultiDevice_ApplicationData_AppStateSyncKeyShare)(nil), (*MultiDevice_ApplicationData_AppStateSyncKeyRequest)(nil), } diff --git a/vendor/go.mau.fi/whatsmeow/proto/waQuickPromotionSurfaces/WAWebProtobufsQuickPromotionSurfaces.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waQuickPromotionSurfaces/WAWebProtobufsQuickPromotionSurfaces.pb.go index e04a730a..3f2a3b4e 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waQuickPromotionSurfaces/WAWebProtobufsQuickPromotionSurfaces.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waQuickPromotionSurfaces/WAWebProtobufsQuickPromotionSurfaces.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waQuickPromotionSurfaces/WAWebProtobufsQuickPromotionSurfaces.proto @@ -443,7 +443,7 @@ func file_waQuickPromotionSurfaces_WAWebProtobufsQuickPromotionSurfaces_proto_ra var file_waQuickPromotionSurfaces_WAWebProtobufsQuickPromotionSurfaces_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_waQuickPromotionSurfaces_WAWebProtobufsQuickPromotionSurfaces_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_waQuickPromotionSurfaces_WAWebProtobufsQuickPromotionSurfaces_proto_goTypes = []interface{}{ +var file_waQuickPromotionSurfaces_WAWebProtobufsQuickPromotionSurfaces_proto_goTypes = []any{ (QP_FilterResult)(0), // 0: WAWebProtobufsQuickPromotionSurfaces.QP.FilterResult (QP_FilterClientNotSupportedConfig)(0), // 1: WAWebProtobufsQuickPromotionSurfaces.QP.FilterClientNotSupportedConfig (QP_ClauseType)(0), // 2: WAWebProtobufsQuickPromotionSurfaces.QP.ClauseType @@ -472,7 +472,7 @@ func file_waQuickPromotionSurfaces_WAWebProtobufsQuickPromotionSurfaces_proto_in return } if !protoimpl.UnsafeEnabled { - file_waQuickPromotionSurfaces_WAWebProtobufsQuickPromotionSurfaces_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waQuickPromotionSurfaces_WAWebProtobufsQuickPromotionSurfaces_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*QP); i { case 0: return &v.state @@ -484,7 +484,7 @@ func file_waQuickPromotionSurfaces_WAWebProtobufsQuickPromotionSurfaces_proto_in return nil } } - file_waQuickPromotionSurfaces_WAWebProtobufsQuickPromotionSurfaces_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waQuickPromotionSurfaces_WAWebProtobufsQuickPromotionSurfaces_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*QP_FilterClause); i { case 0: return &v.state @@ -496,7 +496,7 @@ func file_waQuickPromotionSurfaces_WAWebProtobufsQuickPromotionSurfaces_proto_in return nil } } - file_waQuickPromotionSurfaces_WAWebProtobufsQuickPromotionSurfaces_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waQuickPromotionSurfaces_WAWebProtobufsQuickPromotionSurfaces_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*QP_Filter); i { case 0: return &v.state @@ -508,7 +508,7 @@ func file_waQuickPromotionSurfaces_WAWebProtobufsQuickPromotionSurfaces_proto_in return nil } } - file_waQuickPromotionSurfaces_WAWebProtobufsQuickPromotionSurfaces_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waQuickPromotionSurfaces_WAWebProtobufsQuickPromotionSurfaces_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*QP_FilterParameters); i { case 0: return &v.state diff --git a/vendor/go.mau.fi/whatsmeow/proto/waServerSync/WAServerSync.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waServerSync/WAServerSync.pb.go index 5b89300d..9d496477 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waServerSync/WAServerSync.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waServerSync/WAServerSync.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waServerSync/WAServerSync.proto @@ -775,7 +775,7 @@ func file_waServerSync_WAServerSync_proto_rawDescGZIP() []byte { var file_waServerSync_WAServerSync_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_waServerSync_WAServerSync_proto_msgTypes = make([]protoimpl.MessageInfo, 11) -var file_waServerSync_WAServerSync_proto_goTypes = []interface{}{ +var file_waServerSync_WAServerSync_proto_goTypes = []any{ (SyncdMutation_SyncdOperation)(0), // 0: WAServerSync.SyncdMutation.SyncdOperation (*SyncdMutation)(nil), // 1: WAServerSync.SyncdMutation (*SyncdVersion)(nil), // 2: WAServerSync.SyncdVersion @@ -817,7 +817,7 @@ func file_waServerSync_WAServerSync_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waServerSync_WAServerSync_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waServerSync_WAServerSync_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*SyncdMutation); i { case 0: return &v.state @@ -829,7 +829,7 @@ func file_waServerSync_WAServerSync_proto_init() { return nil } } - file_waServerSync_WAServerSync_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waServerSync_WAServerSync_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*SyncdVersion); i { case 0: return &v.state @@ -841,7 +841,7 @@ func file_waServerSync_WAServerSync_proto_init() { return nil } } - file_waServerSync_WAServerSync_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waServerSync_WAServerSync_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*ExitCode); i { case 0: return &v.state @@ -853,7 +853,7 @@ func file_waServerSync_WAServerSync_proto_init() { return nil } } - file_waServerSync_WAServerSync_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waServerSync_WAServerSync_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*SyncdIndex); i { case 0: return &v.state @@ -865,7 +865,7 @@ func file_waServerSync_WAServerSync_proto_init() { return nil } } - file_waServerSync_WAServerSync_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_waServerSync_WAServerSync_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*SyncdValue); i { case 0: return &v.state @@ -877,7 +877,7 @@ func file_waServerSync_WAServerSync_proto_init() { return nil } } - file_waServerSync_WAServerSync_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_waServerSync_WAServerSync_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*KeyId); i { case 0: return &v.state @@ -889,7 +889,7 @@ func file_waServerSync_WAServerSync_proto_init() { return nil } } - file_waServerSync_WAServerSync_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_waServerSync_WAServerSync_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*SyncdRecord); i { case 0: return &v.state @@ -901,7 +901,7 @@ func file_waServerSync_WAServerSync_proto_init() { return nil } } - file_waServerSync_WAServerSync_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_waServerSync_WAServerSync_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*ExternalBlobReference); i { case 0: return &v.state @@ -913,7 +913,7 @@ func file_waServerSync_WAServerSync_proto_init() { return nil } } - file_waServerSync_WAServerSync_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_waServerSync_WAServerSync_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*SyncdSnapshot); i { case 0: return &v.state @@ -925,7 +925,7 @@ func file_waServerSync_WAServerSync_proto_init() { return nil } } - file_waServerSync_WAServerSync_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_waServerSync_WAServerSync_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*SyncdMutations); i { case 0: return &v.state @@ -937,7 +937,7 @@ func file_waServerSync_WAServerSync_proto_init() { return nil } } - file_waServerSync_WAServerSync_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_waServerSync_WAServerSync_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*SyncdPatch); i { case 0: return &v.state diff --git a/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go index 5a624316..aa218e3b 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waSyncAction/WASyncAction.proto @@ -233,22 +233,16 @@ func (CallLogRecord_CallResult) EnumDescriptor() ([]byte, []int) { type WaffleAccountLinkStateAction_AccountLinkState int32 const ( - WaffleAccountLinkStateAction_ACTIVE WaffleAccountLinkStateAction_AccountLinkState = 0 - WaffleAccountLinkStateAction_PAUSED WaffleAccountLinkStateAction_AccountLinkState = 1 - WaffleAccountLinkStateAction_UNLINKED WaffleAccountLinkStateAction_AccountLinkState = 2 + WaffleAccountLinkStateAction_ACTIVE WaffleAccountLinkStateAction_AccountLinkState = 0 ) // Enum value maps for WaffleAccountLinkStateAction_AccountLinkState. var ( WaffleAccountLinkStateAction_AccountLinkState_name = map[int32]string{ 0: "ACTIVE", - 1: "PAUSED", - 2: "UNLINKED", } WaffleAccountLinkStateAction_AccountLinkState_value = map[string]int32{ - "ACTIVE": 0, - "PAUSED": 1, - "UNLINKED": 2, + "ACTIVE": 0, } ) @@ -513,6 +507,130 @@ func (MarketingMessageAction_MarketingMessagePrototypeType) EnumDescriptor() ([] return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{5, 0} } +type UsernameChatStartModeAction_ChatStartMode int32 + +const ( + UsernameChatStartModeAction_LID UsernameChatStartModeAction_ChatStartMode = 1 + UsernameChatStartModeAction_PN UsernameChatStartModeAction_ChatStartMode = 2 +) + +// Enum value maps for UsernameChatStartModeAction_ChatStartMode. +var ( + UsernameChatStartModeAction_ChatStartMode_name = map[int32]string{ + 1: "LID", + 2: "PN", + } + UsernameChatStartModeAction_ChatStartMode_value = map[string]int32{ + "LID": 1, + "PN": 2, + } +) + +func (x UsernameChatStartModeAction_ChatStartMode) Enum() *UsernameChatStartModeAction_ChatStartMode { + p := new(UsernameChatStartModeAction_ChatStartMode) + *p = x + return p +} + +func (x UsernameChatStartModeAction_ChatStartMode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (UsernameChatStartModeAction_ChatStartMode) Descriptor() protoreflect.EnumDescriptor { + return file_waSyncAction_WASyncAction_proto_enumTypes[8].Descriptor() +} + +func (UsernameChatStartModeAction_ChatStartMode) Type() protoreflect.EnumType { + return &file_waSyncAction_WASyncAction_proto_enumTypes[8] +} + +func (x UsernameChatStartModeAction_ChatStartMode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *UsernameChatStartModeAction_ChatStartMode) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = UsernameChatStartModeAction_ChatStartMode(num) + return nil +} + +// Deprecated: Use UsernameChatStartModeAction_ChatStartMode.Descriptor instead. +func (UsernameChatStartModeAction_ChatStartMode) EnumDescriptor() ([]byte, []int) { + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{6, 0} +} + +type LabelEditAction_ListType int32 + +const ( + LabelEditAction_NONE LabelEditAction_ListType = 0 + LabelEditAction_UNREAD LabelEditAction_ListType = 1 + LabelEditAction_GROUPS LabelEditAction_ListType = 2 + LabelEditAction_FAVORITES LabelEditAction_ListType = 3 + LabelEditAction_PREDEFINED LabelEditAction_ListType = 4 + LabelEditAction_CUSTOM LabelEditAction_ListType = 5 +) + +// Enum value maps for LabelEditAction_ListType. +var ( + LabelEditAction_ListType_name = map[int32]string{ + 0: "NONE", + 1: "UNREAD", + 2: "GROUPS", + 3: "FAVORITES", + 4: "PREDEFINED", + 5: "CUSTOM", + } + LabelEditAction_ListType_value = map[string]int32{ + "NONE": 0, + "UNREAD": 1, + "GROUPS": 2, + "FAVORITES": 3, + "PREDEFINED": 4, + "CUSTOM": 5, + } +) + +func (x LabelEditAction_ListType) Enum() *LabelEditAction_ListType { + p := new(LabelEditAction_ListType) + *p = x + return p +} + +func (x LabelEditAction_ListType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (LabelEditAction_ListType) Descriptor() protoreflect.EnumDescriptor { + return file_waSyncAction_WASyncAction_proto_enumTypes[9].Descriptor() +} + +func (LabelEditAction_ListType) Type() protoreflect.EnumType { + return &file_waSyncAction_WASyncAction_proto_enumTypes[9] +} + +func (x LabelEditAction_ListType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *LabelEditAction_ListType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = LabelEditAction_ListType(num) + return nil +} + +// Deprecated: Use LabelEditAction_ListType.Descriptor instead. +func (LabelEditAction_ListType) EnumDescriptor() ([]byte, []int) { + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{7, 0} +} + type PatchDebugData_Platform int32 const ( @@ -558,11 +676,11 @@ func (x PatchDebugData_Platform) String() string { } func (PatchDebugData_Platform) Descriptor() protoreflect.EnumDescriptor { - return file_waSyncAction_WASyncAction_proto_enumTypes[8].Descriptor() + return file_waSyncAction_WASyncAction_proto_enumTypes[10].Descriptor() } func (PatchDebugData_Platform) Type() protoreflect.EnumType { - return &file_waSyncAction_WASyncAction_proto_enumTypes[8] + return &file_waSyncAction_WASyncAction_proto_enumTypes[10] } func (x PatchDebugData_Platform) Number() protoreflect.EnumNumber { @@ -581,7 +699,7 @@ func (x *PatchDebugData_Platform) UnmarshalJSON(b []byte) error { // Deprecated: Use PatchDebugData_Platform.Descriptor instead. func (PatchDebugData_Platform) EnumDescriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{6, 0} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{8, 0} } type CallLogRecord struct { @@ -1090,6 +1208,148 @@ func (x *MarketingMessageAction) GetMediaID() string { return "" } +type UsernameChatStartModeAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ChatStartMode *UsernameChatStartModeAction_ChatStartMode `protobuf:"varint,1,opt,name=chatStartMode,enum=WASyncAction.UsernameChatStartModeAction_ChatStartMode" json:"chatStartMode,omitempty"` +} + +func (x *UsernameChatStartModeAction) Reset() { + *x = UsernameChatStartModeAction{} + if protoimpl.UnsafeEnabled { + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UsernameChatStartModeAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UsernameChatStartModeAction) ProtoMessage() {} + +func (x *UsernameChatStartModeAction) ProtoReflect() protoreflect.Message { + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UsernameChatStartModeAction.ProtoReflect.Descriptor instead. +func (*UsernameChatStartModeAction) Descriptor() ([]byte, []int) { + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{6} +} + +func (x *UsernameChatStartModeAction) GetChatStartMode() UsernameChatStartModeAction_ChatStartMode { + if x != nil && x.ChatStartMode != nil { + return *x.ChatStartMode + } + return UsernameChatStartModeAction_LID +} + +type LabelEditAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Color *int32 `protobuf:"varint,2,opt,name=color" json:"color,omitempty"` + PredefinedID *int32 `protobuf:"varint,3,opt,name=predefinedID" json:"predefinedID,omitempty"` + Deleted *bool `protobuf:"varint,4,opt,name=deleted" json:"deleted,omitempty"` + OrderIndex *int32 `protobuf:"varint,5,opt,name=orderIndex" json:"orderIndex,omitempty"` + IsActive *bool `protobuf:"varint,6,opt,name=isActive" json:"isActive,omitempty"` + Type *LabelEditAction_ListType `protobuf:"varint,7,opt,name=type,enum=WASyncAction.LabelEditAction_ListType" json:"type,omitempty"` +} + +func (x *LabelEditAction) Reset() { + *x = LabelEditAction{} + if protoimpl.UnsafeEnabled { + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LabelEditAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LabelEditAction) ProtoMessage() {} + +func (x *LabelEditAction) ProtoReflect() protoreflect.Message { + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LabelEditAction.ProtoReflect.Descriptor instead. +func (*LabelEditAction) Descriptor() ([]byte, []int) { + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{7} +} + +func (x *LabelEditAction) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *LabelEditAction) GetColor() int32 { + if x != nil && x.Color != nil { + return *x.Color + } + return 0 +} + +func (x *LabelEditAction) GetPredefinedID() int32 { + if x != nil && x.PredefinedID != nil { + return *x.PredefinedID + } + return 0 +} + +func (x *LabelEditAction) GetDeleted() bool { + if x != nil && x.Deleted != nil { + return *x.Deleted + } + return false +} + +func (x *LabelEditAction) GetOrderIndex() int32 { + if x != nil && x.OrderIndex != nil { + return *x.OrderIndex + } + return 0 +} + +func (x *LabelEditAction) GetIsActive() bool { + if x != nil && x.IsActive != nil { + return *x.IsActive + } + return false +} + +func (x *LabelEditAction) GetType() LabelEditAction_ListType { + if x != nil && x.Type != nil { + return *x.Type + } + return LabelEditAction_NONE +} + type PatchDebugData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1111,7 +1371,7 @@ type PatchDebugData struct { func (x *PatchDebugData) Reset() { *x = PatchDebugData{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[6] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1124,7 +1384,7 @@ func (x *PatchDebugData) String() string { func (*PatchDebugData) ProtoMessage() {} func (x *PatchDebugData) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[6] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1137,7 +1397,7 @@ func (x *PatchDebugData) ProtoReflect() protoreflect.Message { // Deprecated: Use PatchDebugData.ProtoReflect.Descriptor instead. func (*PatchDebugData) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{6} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{8} } func (x *PatchDebugData) GetCurrentLthash() []byte { @@ -1229,7 +1489,7 @@ type RecentEmojiWeight struct { func (x *RecentEmojiWeight) Reset() { *x = RecentEmojiWeight{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[7] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1242,7 +1502,7 @@ func (x *RecentEmojiWeight) String() string { func (*RecentEmojiWeight) ProtoMessage() {} func (x *RecentEmojiWeight) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[7] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1255,7 +1515,7 @@ func (x *RecentEmojiWeight) ProtoReflect() protoreflect.Message { // Deprecated: Use RecentEmojiWeight.ProtoReflect.Descriptor instead. func (*RecentEmojiWeight) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{7} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{9} } func (x *RecentEmojiWeight) GetEmoji() string { @@ -1326,15 +1586,16 @@ type SyncActionValue struct { PrivacySettingDisableLinkPreviewsAction *PrivacySettingDisableLinkPreviewsAction `protobuf:"bytes,53,opt,name=privacySettingDisableLinkPreviewsAction" json:"privacySettingDisableLinkPreviewsAction,omitempty"` DeviceCapabilities *waDeviceCapabilities.DeviceCapabilities `protobuf:"bytes,54,opt,name=deviceCapabilities" json:"deviceCapabilities,omitempty"` NoteEditAction *NoteEditAction `protobuf:"bytes,55,opt,name=noteEditAction" json:"noteEditAction,omitempty"` - Favorites *FavoritesAction `protobuf:"bytes,56,opt,name=favorites" json:"favorites,omitempty"` + FavoritesAction *FavoritesAction `protobuf:"bytes,56,opt,name=favoritesAction" json:"favoritesAction,omitempty"` MerchantPaymentPartnerAction *MerchantPaymentPartnerAction `protobuf:"bytes,57,opt,name=merchantPaymentPartnerAction" json:"merchantPaymentPartnerAction,omitempty"` WaffleAccountLinkStateAction *WaffleAccountLinkStateAction `protobuf:"bytes,58,opt,name=waffleAccountLinkStateAction" json:"waffleAccountLinkStateAction,omitempty"` + UsernameChatStartMode *UsernameChatStartModeAction `protobuf:"bytes,59,opt,name=usernameChatStartMode" json:"usernameChatStartMode,omitempty"` } func (x *SyncActionValue) Reset() { *x = SyncActionValue{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[8] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1347,7 +1608,7 @@ func (x *SyncActionValue) String() string { func (*SyncActionValue) ProtoMessage() {} func (x *SyncActionValue) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[8] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1360,7 +1621,7 @@ func (x *SyncActionValue) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncActionValue.ProtoReflect.Descriptor instead. func (*SyncActionValue) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{8} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{10} } func (x *SyncActionValue) GetTimestamp() int64 { @@ -1706,9 +1967,9 @@ func (x *SyncActionValue) GetNoteEditAction() *NoteEditAction { return nil } -func (x *SyncActionValue) GetFavorites() *FavoritesAction { +func (x *SyncActionValue) GetFavoritesAction() *FavoritesAction { if x != nil { - return x.Favorites + return x.FavoritesAction } return nil } @@ -1727,6 +1988,13 @@ func (x *SyncActionValue) GetWaffleAccountLinkStateAction() *WaffleAccountLinkSt return nil } +func (x *SyncActionValue) GetUsernameChatStartMode() *UsernameChatStartModeAction { + if x != nil { + return x.UsernameChatStartMode + } + return nil +} + type FavoritesAction struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1738,7 +2006,7 @@ type FavoritesAction struct { func (x *FavoritesAction) Reset() { *x = FavoritesAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[9] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1751,7 +2019,7 @@ func (x *FavoritesAction) String() string { func (*FavoritesAction) ProtoMessage() {} func (x *FavoritesAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[9] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1764,7 +2032,7 @@ func (x *FavoritesAction) ProtoReflect() protoreflect.Message { // Deprecated: Use FavoritesAction.ProtoReflect.Descriptor instead. func (*FavoritesAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{9} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{11} } func (x *FavoritesAction) GetFavorites() []*FavoritesAction_Favorite { @@ -1785,7 +2053,7 @@ type PrivacySettingDisableLinkPreviewsAction struct { func (x *PrivacySettingDisableLinkPreviewsAction) Reset() { *x = PrivacySettingDisableLinkPreviewsAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[10] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1798,7 +2066,7 @@ func (x *PrivacySettingDisableLinkPreviewsAction) String() string { func (*PrivacySettingDisableLinkPreviewsAction) ProtoMessage() {} func (x *PrivacySettingDisableLinkPreviewsAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[10] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1811,7 +2079,7 @@ func (x *PrivacySettingDisableLinkPreviewsAction) ProtoReflect() protoreflect.Me // Deprecated: Use PrivacySettingDisableLinkPreviewsAction.ProtoReflect.Descriptor instead. func (*PrivacySettingDisableLinkPreviewsAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{10} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{12} } func (x *PrivacySettingDisableLinkPreviewsAction) GetIsPreviewsDisabled() bool { @@ -1832,7 +2100,7 @@ type WamoUserIdentifierAction struct { func (x *WamoUserIdentifierAction) Reset() { *x = WamoUserIdentifierAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[11] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1845,7 +2113,7 @@ func (x *WamoUserIdentifierAction) String() string { func (*WamoUserIdentifierAction) ProtoMessage() {} func (x *WamoUserIdentifierAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[11] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1858,7 +2126,7 @@ func (x *WamoUserIdentifierAction) ProtoReflect() protoreflect.Message { // Deprecated: Use WamoUserIdentifierAction.ProtoReflect.Descriptor instead. func (*WamoUserIdentifierAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{11} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{13} } func (x *WamoUserIdentifierAction) GetIdentifier() string { @@ -1879,7 +2147,7 @@ type LockChatAction struct { func (x *LockChatAction) Reset() { *x = LockChatAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[12] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1892,7 +2160,7 @@ func (x *LockChatAction) String() string { func (*LockChatAction) ProtoMessage() {} func (x *LockChatAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[12] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1905,7 +2173,7 @@ func (x *LockChatAction) ProtoReflect() protoreflect.Message { // Deprecated: Use LockChatAction.ProtoReflect.Descriptor instead. func (*LockChatAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{12} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{14} } func (x *LockChatAction) GetLocked() bool { @@ -1926,7 +2194,7 @@ type CustomPaymentMethodsAction struct { func (x *CustomPaymentMethodsAction) Reset() { *x = CustomPaymentMethodsAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[13] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1939,7 +2207,7 @@ func (x *CustomPaymentMethodsAction) String() string { func (*CustomPaymentMethodsAction) ProtoMessage() {} func (x *CustomPaymentMethodsAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[13] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1952,7 +2220,7 @@ func (x *CustomPaymentMethodsAction) ProtoReflect() protoreflect.Message { // Deprecated: Use CustomPaymentMethodsAction.ProtoReflect.Descriptor instead. func (*CustomPaymentMethodsAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{13} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{15} } func (x *CustomPaymentMethodsAction) GetCustomPaymentMethods() []*CustomPaymentMethod { @@ -1976,7 +2244,7 @@ type CustomPaymentMethod struct { func (x *CustomPaymentMethod) Reset() { *x = CustomPaymentMethod{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[14] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1989,7 +2257,7 @@ func (x *CustomPaymentMethod) String() string { func (*CustomPaymentMethod) ProtoMessage() {} func (x *CustomPaymentMethod) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[14] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2002,7 +2270,7 @@ func (x *CustomPaymentMethod) ProtoReflect() protoreflect.Message { // Deprecated: Use CustomPaymentMethod.ProtoReflect.Descriptor instead. func (*CustomPaymentMethod) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{14} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{16} } func (x *CustomPaymentMethod) GetCredentialID() string { @@ -2045,7 +2313,7 @@ type CustomPaymentMethodMetadata struct { func (x *CustomPaymentMethodMetadata) Reset() { *x = CustomPaymentMethodMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[15] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2058,7 +2326,7 @@ func (x *CustomPaymentMethodMetadata) String() string { func (*CustomPaymentMethodMetadata) ProtoMessage() {} func (x *CustomPaymentMethodMetadata) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[15] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2071,7 +2339,7 @@ func (x *CustomPaymentMethodMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use CustomPaymentMethodMetadata.ProtoReflect.Descriptor instead. func (*CustomPaymentMethodMetadata) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{15} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{17} } func (x *CustomPaymentMethodMetadata) GetKey() string { @@ -2099,7 +2367,7 @@ type PaymentInfoAction struct { func (x *PaymentInfoAction) Reset() { *x = PaymentInfoAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[16] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2112,7 +2380,7 @@ func (x *PaymentInfoAction) String() string { func (*PaymentInfoAction) ProtoMessage() {} func (x *PaymentInfoAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[16] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2125,7 +2393,7 @@ func (x *PaymentInfoAction) ProtoReflect() protoreflect.Message { // Deprecated: Use PaymentInfoAction.ProtoReflect.Descriptor instead. func (*PaymentInfoAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{16} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{18} } func (x *PaymentInfoAction) GetCpi() string { @@ -2146,7 +2414,7 @@ type LabelReorderingAction struct { func (x *LabelReorderingAction) Reset() { *x = LabelReorderingAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[17] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2159,7 +2427,7 @@ func (x *LabelReorderingAction) String() string { func (*LabelReorderingAction) ProtoMessage() {} func (x *LabelReorderingAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[17] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2172,7 +2440,7 @@ func (x *LabelReorderingAction) ProtoReflect() protoreflect.Message { // Deprecated: Use LabelReorderingAction.ProtoReflect.Descriptor instead. func (*LabelReorderingAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{17} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{19} } func (x *LabelReorderingAction) GetSortedLabelIDs() []int32 { @@ -2194,7 +2462,7 @@ type DeleteIndividualCallLogAction struct { func (x *DeleteIndividualCallLogAction) Reset() { *x = DeleteIndividualCallLogAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[18] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2207,7 +2475,7 @@ func (x *DeleteIndividualCallLogAction) String() string { func (*DeleteIndividualCallLogAction) ProtoMessage() {} func (x *DeleteIndividualCallLogAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[18] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2220,7 +2488,7 @@ func (x *DeleteIndividualCallLogAction) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteIndividualCallLogAction.ProtoReflect.Descriptor instead. func (*DeleteIndividualCallLogAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{18} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{20} } func (x *DeleteIndividualCallLogAction) GetPeerJID() string { @@ -2248,7 +2516,7 @@ type BotWelcomeRequestAction struct { func (x *BotWelcomeRequestAction) Reset() { *x = BotWelcomeRequestAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[19] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2261,7 +2529,7 @@ func (x *BotWelcomeRequestAction) String() string { func (*BotWelcomeRequestAction) ProtoMessage() {} func (x *BotWelcomeRequestAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[19] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2274,7 +2542,7 @@ func (x *BotWelcomeRequestAction) ProtoReflect() protoreflect.Message { // Deprecated: Use BotWelcomeRequestAction.ProtoReflect.Descriptor instead. func (*BotWelcomeRequestAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{19} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{21} } func (x *BotWelcomeRequestAction) GetIsSent() bool { @@ -2295,7 +2563,7 @@ type CallLogAction struct { func (x *CallLogAction) Reset() { *x = CallLogAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[20] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2308,7 +2576,7 @@ func (x *CallLogAction) String() string { func (*CallLogAction) ProtoMessage() {} func (x *CallLogAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[20] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2321,7 +2589,7 @@ func (x *CallLogAction) ProtoReflect() protoreflect.Message { // Deprecated: Use CallLogAction.ProtoReflect.Descriptor instead. func (*CallLogAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{20} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{22} } func (x *CallLogAction) GetCallLogRecord() *CallLogRecord { @@ -2342,7 +2610,7 @@ type PrivacySettingRelayAllCalls struct { func (x *PrivacySettingRelayAllCalls) Reset() { *x = PrivacySettingRelayAllCalls{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[21] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2355,7 +2623,7 @@ func (x *PrivacySettingRelayAllCalls) String() string { func (*PrivacySettingRelayAllCalls) ProtoMessage() {} func (x *PrivacySettingRelayAllCalls) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[21] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2368,7 +2636,7 @@ func (x *PrivacySettingRelayAllCalls) ProtoReflect() protoreflect.Message { // Deprecated: Use PrivacySettingRelayAllCalls.ProtoReflect.Descriptor instead. func (*PrivacySettingRelayAllCalls) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{21} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{23} } func (x *PrivacySettingRelayAllCalls) GetIsEnabled() bool { @@ -2389,7 +2657,7 @@ type ExternalWebBetaAction struct { func (x *ExternalWebBetaAction) Reset() { *x = ExternalWebBetaAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[22] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2402,7 +2670,7 @@ func (x *ExternalWebBetaAction) String() string { func (*ExternalWebBetaAction) ProtoMessage() {} func (x *ExternalWebBetaAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[22] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2415,7 +2683,7 @@ func (x *ExternalWebBetaAction) ProtoReflect() protoreflect.Message { // Deprecated: Use ExternalWebBetaAction.ProtoReflect.Descriptor instead. func (*ExternalWebBetaAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{22} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{24} } func (x *ExternalWebBetaAction) GetIsOptIn() bool { @@ -2436,7 +2704,7 @@ type MarketingMessageBroadcastAction struct { func (x *MarketingMessageBroadcastAction) Reset() { *x = MarketingMessageBroadcastAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[23] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2449,7 +2717,7 @@ func (x *MarketingMessageBroadcastAction) String() string { func (*MarketingMessageBroadcastAction) ProtoMessage() {} func (x *MarketingMessageBroadcastAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[23] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2462,7 +2730,7 @@ func (x *MarketingMessageBroadcastAction) ProtoReflect() protoreflect.Message { // Deprecated: Use MarketingMessageBroadcastAction.ProtoReflect.Descriptor instead. func (*MarketingMessageBroadcastAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{23} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{25} } func (x *MarketingMessageBroadcastAction) GetRepliedCount() int32 { @@ -2483,7 +2751,7 @@ type PnForLidChatAction struct { func (x *PnForLidChatAction) Reset() { *x = PnForLidChatAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[24] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2496,7 +2764,7 @@ func (x *PnForLidChatAction) String() string { func (*PnForLidChatAction) ProtoMessage() {} func (x *PnForLidChatAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[24] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2509,7 +2777,7 @@ func (x *PnForLidChatAction) ProtoReflect() protoreflect.Message { // Deprecated: Use PnForLidChatAction.ProtoReflect.Descriptor instead. func (*PnForLidChatAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{24} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{26} } func (x *PnForLidChatAction) GetPnJID() string { @@ -2530,7 +2798,7 @@ type ChatAssignmentOpenedStatusAction struct { func (x *ChatAssignmentOpenedStatusAction) Reset() { *x = ChatAssignmentOpenedStatusAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[25] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2543,7 +2811,7 @@ func (x *ChatAssignmentOpenedStatusAction) String() string { func (*ChatAssignmentOpenedStatusAction) ProtoMessage() {} func (x *ChatAssignmentOpenedStatusAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[25] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[27] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2556,7 +2824,7 @@ func (x *ChatAssignmentOpenedStatusAction) ProtoReflect() protoreflect.Message { // Deprecated: Use ChatAssignmentOpenedStatusAction.ProtoReflect.Descriptor instead. func (*ChatAssignmentOpenedStatusAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{25} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{27} } func (x *ChatAssignmentOpenedStatusAction) GetChatOpened() bool { @@ -2577,7 +2845,7 @@ type ChatAssignmentAction struct { func (x *ChatAssignmentAction) Reset() { *x = ChatAssignmentAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[26] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2590,7 +2858,7 @@ func (x *ChatAssignmentAction) String() string { func (*ChatAssignmentAction) ProtoMessage() {} func (x *ChatAssignmentAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[26] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[28] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2603,7 +2871,7 @@ func (x *ChatAssignmentAction) ProtoReflect() protoreflect.Message { // Deprecated: Use ChatAssignmentAction.ProtoReflect.Descriptor instead. func (*ChatAssignmentAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{26} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{28} } func (x *ChatAssignmentAction) GetDeviceAgentID() string { @@ -2634,7 +2902,7 @@ type StickerAction struct { func (x *StickerAction) Reset() { *x = StickerAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[27] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2647,7 +2915,7 @@ func (x *StickerAction) String() string { func (*StickerAction) ProtoMessage() {} func (x *StickerAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[27] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[29] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2660,7 +2928,7 @@ func (x *StickerAction) ProtoReflect() protoreflect.Message { // Deprecated: Use StickerAction.ProtoReflect.Descriptor instead. func (*StickerAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{27} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{29} } func (x *StickerAction) GetURL() string { @@ -2751,7 +3019,7 @@ type RemoveRecentStickerAction struct { func (x *RemoveRecentStickerAction) Reset() { *x = RemoveRecentStickerAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[28] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2764,7 +3032,7 @@ func (x *RemoveRecentStickerAction) String() string { func (*RemoveRecentStickerAction) ProtoMessage() {} func (x *RemoveRecentStickerAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[28] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[30] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2777,7 +3045,7 @@ func (x *RemoveRecentStickerAction) ProtoReflect() protoreflect.Message { // Deprecated: Use RemoveRecentStickerAction.ProtoReflect.Descriptor instead. func (*RemoveRecentStickerAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{28} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{30} } func (x *RemoveRecentStickerAction) GetLastStickerSentTS() int64 { @@ -2798,7 +3066,7 @@ type PrimaryVersionAction struct { func (x *PrimaryVersionAction) Reset() { *x = PrimaryVersionAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[29] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2811,7 +3079,7 @@ func (x *PrimaryVersionAction) String() string { func (*PrimaryVersionAction) ProtoMessage() {} func (x *PrimaryVersionAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[29] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[31] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2824,7 +3092,7 @@ func (x *PrimaryVersionAction) ProtoReflect() protoreflect.Message { // Deprecated: Use PrimaryVersionAction.ProtoReflect.Descriptor instead. func (*PrimaryVersionAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{29} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{31} } func (x *PrimaryVersionAction) GetVersion() string { @@ -2845,7 +3113,7 @@ type NuxAction struct { func (x *NuxAction) Reset() { *x = NuxAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[30] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2858,7 +3126,7 @@ func (x *NuxAction) String() string { func (*NuxAction) ProtoMessage() {} func (x *NuxAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[30] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[32] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2871,7 +3139,7 @@ func (x *NuxAction) ProtoReflect() protoreflect.Message { // Deprecated: Use NuxAction.ProtoReflect.Descriptor instead. func (*NuxAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{30} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{32} } func (x *NuxAction) GetAcknowledged() bool { @@ -2892,7 +3160,7 @@ type TimeFormatAction struct { func (x *TimeFormatAction) Reset() { *x = TimeFormatAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[31] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2905,7 +3173,7 @@ func (x *TimeFormatAction) String() string { func (*TimeFormatAction) ProtoMessage() {} func (x *TimeFormatAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[31] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[33] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2918,7 +3186,7 @@ func (x *TimeFormatAction) ProtoReflect() protoreflect.Message { // Deprecated: Use TimeFormatAction.ProtoReflect.Descriptor instead. func (*TimeFormatAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{31} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{33} } func (x *TimeFormatAction) GetIsTwentyFourHourFormatEnabled() bool { @@ -2939,7 +3207,7 @@ type UserStatusMuteAction struct { func (x *UserStatusMuteAction) Reset() { *x = UserStatusMuteAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[32] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2952,7 +3220,7 @@ func (x *UserStatusMuteAction) String() string { func (*UserStatusMuteAction) ProtoMessage() {} func (x *UserStatusMuteAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[32] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[34] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2965,7 +3233,7 @@ func (x *UserStatusMuteAction) ProtoReflect() protoreflect.Message { // Deprecated: Use UserStatusMuteAction.ProtoReflect.Descriptor instead. func (*UserStatusMuteAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{32} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{34} } func (x *UserStatusMuteAction) GetMuted() bool { @@ -2988,7 +3256,7 @@ type SubscriptionAction struct { func (x *SubscriptionAction) Reset() { *x = SubscriptionAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[33] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3001,7 +3269,7 @@ func (x *SubscriptionAction) String() string { func (*SubscriptionAction) ProtoMessage() {} func (x *SubscriptionAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[33] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[35] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3014,7 +3282,7 @@ func (x *SubscriptionAction) ProtoReflect() protoreflect.Message { // Deprecated: Use SubscriptionAction.ProtoReflect.Descriptor instead. func (*SubscriptionAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{33} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{35} } func (x *SubscriptionAction) GetIsDeactivated() bool { @@ -3051,7 +3319,7 @@ type AgentAction struct { func (x *AgentAction) Reset() { *x = AgentAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[34] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[36] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3064,7 +3332,7 @@ func (x *AgentAction) String() string { func (*AgentAction) ProtoMessage() {} func (x *AgentAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[34] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[36] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3077,7 +3345,7 @@ func (x *AgentAction) ProtoReflect() protoreflect.Message { // Deprecated: Use AgentAction.ProtoReflect.Descriptor instead. func (*AgentAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{34} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{36} } func (x *AgentAction) GetName() string { @@ -3112,7 +3380,7 @@ type AndroidUnsupportedActions struct { func (x *AndroidUnsupportedActions) Reset() { *x = AndroidUnsupportedActions{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[35] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[37] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3125,7 +3393,7 @@ func (x *AndroidUnsupportedActions) String() string { func (*AndroidUnsupportedActions) ProtoMessage() {} func (x *AndroidUnsupportedActions) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[35] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[37] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3138,7 +3406,7 @@ func (x *AndroidUnsupportedActions) ProtoReflect() protoreflect.Message { // Deprecated: Use AndroidUnsupportedActions.ProtoReflect.Descriptor instead. func (*AndroidUnsupportedActions) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{35} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{37} } func (x *AndroidUnsupportedActions) GetAllowed() bool { @@ -3159,7 +3427,7 @@ type PrimaryFeature struct { func (x *PrimaryFeature) Reset() { *x = PrimaryFeature{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[36] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[38] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3172,7 +3440,7 @@ func (x *PrimaryFeature) String() string { func (*PrimaryFeature) ProtoMessage() {} func (x *PrimaryFeature) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[36] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[38] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3185,7 +3453,7 @@ func (x *PrimaryFeature) ProtoReflect() protoreflect.Message { // Deprecated: Use PrimaryFeature.ProtoReflect.Descriptor instead. func (*PrimaryFeature) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{36} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{38} } func (x *PrimaryFeature) GetFlags() []string { @@ -3206,7 +3474,7 @@ type KeyExpiration struct { func (x *KeyExpiration) Reset() { *x = KeyExpiration{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[37] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[39] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3219,7 +3487,7 @@ func (x *KeyExpiration) String() string { func (*KeyExpiration) ProtoMessage() {} func (x *KeyExpiration) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[37] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[39] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3232,7 +3500,7 @@ func (x *KeyExpiration) ProtoReflect() protoreflect.Message { // Deprecated: Use KeyExpiration.ProtoReflect.Descriptor instead. func (*KeyExpiration) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{37} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{39} } func (x *KeyExpiration) GetExpiredKeyEpoch() int32 { @@ -3254,7 +3522,7 @@ type SyncActionMessage struct { func (x *SyncActionMessage) Reset() { *x = SyncActionMessage{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[38] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[40] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3267,7 +3535,7 @@ func (x *SyncActionMessage) String() string { func (*SyncActionMessage) ProtoMessage() {} func (x *SyncActionMessage) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[38] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[40] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3280,7 +3548,7 @@ func (x *SyncActionMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncActionMessage.ProtoReflect.Descriptor instead. func (*SyncActionMessage) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{38} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{40} } func (x *SyncActionMessage) GetKey() *waCommon.MessageKey { @@ -3310,7 +3578,7 @@ type SyncActionMessageRange struct { func (x *SyncActionMessageRange) Reset() { *x = SyncActionMessageRange{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[39] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[41] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3323,7 +3591,7 @@ func (x *SyncActionMessageRange) String() string { func (*SyncActionMessageRange) ProtoMessage() {} func (x *SyncActionMessageRange) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[39] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[41] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3336,7 +3604,7 @@ func (x *SyncActionMessageRange) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncActionMessageRange.ProtoReflect.Descriptor instead. func (*SyncActionMessageRange) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{39} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{41} } func (x *SyncActionMessageRange) GetLastMessageTimestamp() int64 { @@ -3371,7 +3639,7 @@ type UnarchiveChatsSetting struct { func (x *UnarchiveChatsSetting) Reset() { *x = UnarchiveChatsSetting{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[40] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[42] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3384,7 +3652,7 @@ func (x *UnarchiveChatsSetting) String() string { func (*UnarchiveChatsSetting) ProtoMessage() {} func (x *UnarchiveChatsSetting) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[40] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[42] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3397,7 +3665,7 @@ func (x *UnarchiveChatsSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use UnarchiveChatsSetting.ProtoReflect.Descriptor instead. func (*UnarchiveChatsSetting) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{40} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{42} } func (x *UnarchiveChatsSetting) GetUnarchiveChats() bool { @@ -3418,7 +3686,7 @@ type DeleteChatAction struct { func (x *DeleteChatAction) Reset() { *x = DeleteChatAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[41] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[43] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3431,7 +3699,7 @@ func (x *DeleteChatAction) String() string { func (*DeleteChatAction) ProtoMessage() {} func (x *DeleteChatAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[41] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[43] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3444,7 +3712,7 @@ func (x *DeleteChatAction) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteChatAction.ProtoReflect.Descriptor instead. func (*DeleteChatAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{41} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{43} } func (x *DeleteChatAction) GetMessageRange() *SyncActionMessageRange { @@ -3465,7 +3733,7 @@ type ClearChatAction struct { func (x *ClearChatAction) Reset() { *x = ClearChatAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[42] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[44] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3478,7 +3746,7 @@ func (x *ClearChatAction) String() string { func (*ClearChatAction) ProtoMessage() {} func (x *ClearChatAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[42] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[44] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3491,7 +3759,7 @@ func (x *ClearChatAction) ProtoReflect() protoreflect.Message { // Deprecated: Use ClearChatAction.ProtoReflect.Descriptor instead. func (*ClearChatAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{42} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{44} } func (x *ClearChatAction) GetMessageRange() *SyncActionMessageRange { @@ -3513,7 +3781,7 @@ type MarkChatAsReadAction struct { func (x *MarkChatAsReadAction) Reset() { *x = MarkChatAsReadAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[43] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[45] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3526,7 +3794,7 @@ func (x *MarkChatAsReadAction) String() string { func (*MarkChatAsReadAction) ProtoMessage() {} func (x *MarkChatAsReadAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[43] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[45] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3539,7 +3807,7 @@ func (x *MarkChatAsReadAction) ProtoReflect() protoreflect.Message { // Deprecated: Use MarkChatAsReadAction.ProtoReflect.Descriptor instead. func (*MarkChatAsReadAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{43} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{45} } func (x *MarkChatAsReadAction) GetRead() bool { @@ -3568,7 +3836,7 @@ type DeleteMessageForMeAction struct { func (x *DeleteMessageForMeAction) Reset() { *x = DeleteMessageForMeAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[44] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[46] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3581,7 +3849,7 @@ func (x *DeleteMessageForMeAction) String() string { func (*DeleteMessageForMeAction) ProtoMessage() {} func (x *DeleteMessageForMeAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[44] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[46] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3594,7 +3862,7 @@ func (x *DeleteMessageForMeAction) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteMessageForMeAction.ProtoReflect.Descriptor instead. func (*DeleteMessageForMeAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{44} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{46} } func (x *DeleteMessageForMeAction) GetDeleteMedia() bool { @@ -3623,7 +3891,7 @@ type ArchiveChatAction struct { func (x *ArchiveChatAction) Reset() { *x = ArchiveChatAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[45] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[47] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3636,7 +3904,7 @@ func (x *ArchiveChatAction) String() string { func (*ArchiveChatAction) ProtoMessage() {} func (x *ArchiveChatAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[45] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[47] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3649,7 +3917,7 @@ func (x *ArchiveChatAction) ProtoReflect() protoreflect.Message { // Deprecated: Use ArchiveChatAction.ProtoReflect.Descriptor instead. func (*ArchiveChatAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{45} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{47} } func (x *ArchiveChatAction) GetArchived() bool { @@ -3677,7 +3945,7 @@ type RecentEmojiWeightsAction struct { func (x *RecentEmojiWeightsAction) Reset() { *x = RecentEmojiWeightsAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[46] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[48] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3690,7 +3958,7 @@ func (x *RecentEmojiWeightsAction) String() string { func (*RecentEmojiWeightsAction) ProtoMessage() {} func (x *RecentEmojiWeightsAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[46] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[48] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3703,7 +3971,7 @@ func (x *RecentEmojiWeightsAction) ProtoReflect() protoreflect.Message { // Deprecated: Use RecentEmojiWeightsAction.ProtoReflect.Descriptor instead. func (*RecentEmojiWeightsAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{46} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{48} } func (x *RecentEmojiWeightsAction) GetWeights() []*RecentEmojiWeight { @@ -3713,85 +3981,6 @@ func (x *RecentEmojiWeightsAction) GetWeights() []*RecentEmojiWeight { return nil } -type LabelEditAction struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Color *int32 `protobuf:"varint,2,opt,name=color" json:"color,omitempty"` - PredefinedID *int32 `protobuf:"varint,3,opt,name=predefinedID" json:"predefinedID,omitempty"` - Deleted *bool `protobuf:"varint,4,opt,name=deleted" json:"deleted,omitempty"` - OrderIndex *int32 `protobuf:"varint,5,opt,name=orderIndex" json:"orderIndex,omitempty"` -} - -func (x *LabelEditAction) Reset() { - *x = LabelEditAction{} - if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[47] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LabelEditAction) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LabelEditAction) ProtoMessage() {} - -func (x *LabelEditAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[47] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LabelEditAction.ProtoReflect.Descriptor instead. -func (*LabelEditAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{47} -} - -func (x *LabelEditAction) GetName() string { - if x != nil && x.Name != nil { - return *x.Name - } - return "" -} - -func (x *LabelEditAction) GetColor() int32 { - if x != nil && x.Color != nil { - return *x.Color - } - return 0 -} - -func (x *LabelEditAction) GetPredefinedID() int32 { - if x != nil && x.PredefinedID != nil { - return *x.PredefinedID - } - return 0 -} - -func (x *LabelEditAction) GetDeleted() bool { - if x != nil && x.Deleted != nil { - return *x.Deleted - } - return false -} - -func (x *LabelEditAction) GetOrderIndex() int32 { - if x != nil && x.OrderIndex != nil { - return *x.OrderIndex - } - return 0 -} - type LabelAssociationAction struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3803,7 +3992,7 @@ type LabelAssociationAction struct { func (x *LabelAssociationAction) Reset() { *x = LabelAssociationAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[48] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[49] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3816,7 +4005,7 @@ func (x *LabelAssociationAction) String() string { func (*LabelAssociationAction) ProtoMessage() {} func (x *LabelAssociationAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[48] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[49] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3829,7 +4018,7 @@ func (x *LabelAssociationAction) ProtoReflect() protoreflect.Message { // Deprecated: Use LabelAssociationAction.ProtoReflect.Descriptor instead. func (*LabelAssociationAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{48} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{49} } func (x *LabelAssociationAction) GetLabeled() bool { @@ -3854,7 +4043,7 @@ type QuickReplyAction struct { func (x *QuickReplyAction) Reset() { *x = QuickReplyAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[49] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[50] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3867,7 +4056,7 @@ func (x *QuickReplyAction) String() string { func (*QuickReplyAction) ProtoMessage() {} func (x *QuickReplyAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[49] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[50] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3880,7 +4069,7 @@ func (x *QuickReplyAction) ProtoReflect() protoreflect.Message { // Deprecated: Use QuickReplyAction.ProtoReflect.Descriptor instead. func (*QuickReplyAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{49} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{50} } func (x *QuickReplyAction) GetShortcut() string { @@ -3929,7 +4118,7 @@ type LocaleSetting struct { func (x *LocaleSetting) Reset() { *x = LocaleSetting{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[50] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[51] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3942,7 +4131,7 @@ func (x *LocaleSetting) String() string { func (*LocaleSetting) ProtoMessage() {} func (x *LocaleSetting) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[50] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[51] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3955,7 +4144,7 @@ func (x *LocaleSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use LocaleSetting.ProtoReflect.Descriptor instead. func (*LocaleSetting) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{50} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{51} } func (x *LocaleSetting) GetLocale() string { @@ -3976,7 +4165,7 @@ type PushNameSetting struct { func (x *PushNameSetting) Reset() { *x = PushNameSetting{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[51] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[52] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3989,7 +4178,7 @@ func (x *PushNameSetting) String() string { func (*PushNameSetting) ProtoMessage() {} func (x *PushNameSetting) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[51] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[52] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4002,7 +4191,7 @@ func (x *PushNameSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use PushNameSetting.ProtoReflect.Descriptor instead. func (*PushNameSetting) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{51} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{52} } func (x *PushNameSetting) GetName() string { @@ -4023,7 +4212,7 @@ type SecurityNotificationSetting struct { func (x *SecurityNotificationSetting) Reset() { *x = SecurityNotificationSetting{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[52] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[53] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4036,7 +4225,7 @@ func (x *SecurityNotificationSetting) String() string { func (*SecurityNotificationSetting) ProtoMessage() {} func (x *SecurityNotificationSetting) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[52] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[53] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4049,7 +4238,7 @@ func (x *SecurityNotificationSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use SecurityNotificationSetting.ProtoReflect.Descriptor instead. func (*SecurityNotificationSetting) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{52} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{53} } func (x *SecurityNotificationSetting) GetShowNotification() bool { @@ -4070,7 +4259,7 @@ type PinAction struct { func (x *PinAction) Reset() { *x = PinAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[53] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[54] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4083,7 +4272,7 @@ func (x *PinAction) String() string { func (*PinAction) ProtoMessage() {} func (x *PinAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[53] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[54] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4096,7 +4285,7 @@ func (x *PinAction) ProtoReflect() protoreflect.Message { // Deprecated: Use PinAction.ProtoReflect.Descriptor instead. func (*PinAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{53} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{54} } func (x *PinAction) GetPinned() bool { @@ -4119,7 +4308,7 @@ type MuteAction struct { func (x *MuteAction) Reset() { *x = MuteAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[54] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[55] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4132,7 +4321,7 @@ func (x *MuteAction) String() string { func (*MuteAction) ProtoMessage() {} func (x *MuteAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[54] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[55] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4145,7 +4334,7 @@ func (x *MuteAction) ProtoReflect() protoreflect.Message { // Deprecated: Use MuteAction.ProtoReflect.Descriptor instead. func (*MuteAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{54} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{55} } func (x *MuteAction) GetMuted() bool { @@ -4183,7 +4372,7 @@ type ContactAction struct { func (x *ContactAction) Reset() { *x = ContactAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[55] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[56] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4196,7 +4385,7 @@ func (x *ContactAction) String() string { func (*ContactAction) ProtoMessage() {} func (x *ContactAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[55] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[56] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4209,7 +4398,7 @@ func (x *ContactAction) ProtoReflect() protoreflect.Message { // Deprecated: Use ContactAction.ProtoReflect.Descriptor instead. func (*ContactAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{55} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{56} } func (x *ContactAction) GetFullName() string { @@ -4251,7 +4440,7 @@ type StarAction struct { func (x *StarAction) Reset() { *x = StarAction{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[56] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[57] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4264,7 +4453,7 @@ func (x *StarAction) String() string { func (*StarAction) ProtoMessage() {} func (x *StarAction) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[56] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[57] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4277,7 +4466,7 @@ func (x *StarAction) ProtoReflect() protoreflect.Message { // Deprecated: Use StarAction.ProtoReflect.Descriptor instead. func (*StarAction) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{56} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{57} } func (x *StarAction) GetStarred() bool { @@ -4301,7 +4490,7 @@ type SyncActionData struct { func (x *SyncActionData) Reset() { *x = SyncActionData{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[57] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[58] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4314,7 +4503,7 @@ func (x *SyncActionData) String() string { func (*SyncActionData) ProtoMessage() {} func (x *SyncActionData) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[57] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[58] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4327,7 +4516,7 @@ func (x *SyncActionData) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncActionData.ProtoReflect.Descriptor instead. func (*SyncActionData) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{57} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{58} } func (x *SyncActionData) GetIndex() []byte { @@ -4370,7 +4559,7 @@ type CallLogRecord_ParticipantInfo struct { func (x *CallLogRecord_ParticipantInfo) Reset() { *x = CallLogRecord_ParticipantInfo{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[58] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[59] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4383,7 +4572,7 @@ func (x *CallLogRecord_ParticipantInfo) String() string { func (*CallLogRecord_ParticipantInfo) ProtoMessage() {} func (x *CallLogRecord_ParticipantInfo) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[58] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[59] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4424,7 +4613,7 @@ type FavoritesAction_Favorite struct { func (x *FavoritesAction_Favorite) Reset() { *x = FavoritesAction_Favorite{} if protoimpl.UnsafeEnabled { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[59] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[60] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4437,7 +4626,7 @@ func (x *FavoritesAction_Favorite) String() string { func (*FavoritesAction_Favorite) ProtoMessage() {} func (x *FavoritesAction_Favorite) ProtoReflect() protoreflect.Message { - mi := &file_waSyncAction_WASyncAction_proto_msgTypes[59] + mi := &file_waSyncAction_WASyncAction_proto_msgTypes[60] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4450,7 +4639,7 @@ func (x *FavoritesAction_Favorite) ProtoReflect() protoreflect.Message { // Deprecated: Use FavoritesAction_Favorite.ProtoReflect.Descriptor instead. func (*FavoritesAction_Favorite) Descriptor() ([]byte, []int) { - return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{9, 0} + return file_waSyncAction_WASyncAction_proto_rawDescGZIP(), []int{11, 0} } func (x *FavoritesAction_Favorite) GetID() string { @@ -4477,9 +4666,9 @@ func file_waSyncAction_WASyncAction_proto_rawDescGZIP() []byte { return file_waSyncAction_WASyncAction_proto_rawDescData } -var file_waSyncAction_WASyncAction_proto_enumTypes = make([]protoimpl.EnumInfo, 9) -var file_waSyncAction_WASyncAction_proto_msgTypes = make([]protoimpl.MessageInfo, 60) -var file_waSyncAction_WASyncAction_proto_goTypes = []interface{}{ +var file_waSyncAction_WASyncAction_proto_enumTypes = make([]protoimpl.EnumInfo, 11) +var file_waSyncAction_WASyncAction_proto_msgTypes = make([]protoimpl.MessageInfo, 61) +var file_waSyncAction_WASyncAction_proto_goTypes = []any{ (CallLogRecord_CallType)(0), // 0: WASyncAction.CallLogRecord.CallType (CallLogRecord_SilenceReason)(0), // 1: WASyncAction.CallLogRecord.SilenceReason (CallLogRecord_CallResult)(0), // 2: WASyncAction.CallLogRecord.CallResult @@ -4488,151 +4677,157 @@ var file_waSyncAction_WASyncAction_proto_goTypes = []interface{}{ (NoteEditAction_NoteType)(0), // 5: WASyncAction.NoteEditAction.NoteType (StatusPrivacyAction_StatusDistributionMode)(0), // 6: WASyncAction.StatusPrivacyAction.StatusDistributionMode (MarketingMessageAction_MarketingMessagePrototypeType)(0), // 7: WASyncAction.MarketingMessageAction.MarketingMessagePrototypeType - (PatchDebugData_Platform)(0), // 8: WASyncAction.PatchDebugData.Platform - (*CallLogRecord)(nil), // 9: WASyncAction.CallLogRecord - (*WaffleAccountLinkStateAction)(nil), // 10: WASyncAction.WaffleAccountLinkStateAction - (*MerchantPaymentPartnerAction)(nil), // 11: WASyncAction.MerchantPaymentPartnerAction - (*NoteEditAction)(nil), // 12: WASyncAction.NoteEditAction - (*StatusPrivacyAction)(nil), // 13: WASyncAction.StatusPrivacyAction - (*MarketingMessageAction)(nil), // 14: WASyncAction.MarketingMessageAction - (*PatchDebugData)(nil), // 15: WASyncAction.PatchDebugData - (*RecentEmojiWeight)(nil), // 16: WASyncAction.RecentEmojiWeight - (*SyncActionValue)(nil), // 17: WASyncAction.SyncActionValue - (*FavoritesAction)(nil), // 18: WASyncAction.FavoritesAction - (*PrivacySettingDisableLinkPreviewsAction)(nil), // 19: WASyncAction.PrivacySettingDisableLinkPreviewsAction - (*WamoUserIdentifierAction)(nil), // 20: WASyncAction.WamoUserIdentifierAction - (*LockChatAction)(nil), // 21: WASyncAction.LockChatAction - (*CustomPaymentMethodsAction)(nil), // 22: WASyncAction.CustomPaymentMethodsAction - (*CustomPaymentMethod)(nil), // 23: WASyncAction.CustomPaymentMethod - (*CustomPaymentMethodMetadata)(nil), // 24: WASyncAction.CustomPaymentMethodMetadata - (*PaymentInfoAction)(nil), // 25: WASyncAction.PaymentInfoAction - (*LabelReorderingAction)(nil), // 26: WASyncAction.LabelReorderingAction - (*DeleteIndividualCallLogAction)(nil), // 27: WASyncAction.DeleteIndividualCallLogAction - (*BotWelcomeRequestAction)(nil), // 28: WASyncAction.BotWelcomeRequestAction - (*CallLogAction)(nil), // 29: WASyncAction.CallLogAction - (*PrivacySettingRelayAllCalls)(nil), // 30: WASyncAction.PrivacySettingRelayAllCalls - (*ExternalWebBetaAction)(nil), // 31: WASyncAction.ExternalWebBetaAction - (*MarketingMessageBroadcastAction)(nil), // 32: WASyncAction.MarketingMessageBroadcastAction - (*PnForLidChatAction)(nil), // 33: WASyncAction.PnForLidChatAction - (*ChatAssignmentOpenedStatusAction)(nil), // 34: WASyncAction.ChatAssignmentOpenedStatusAction - (*ChatAssignmentAction)(nil), // 35: WASyncAction.ChatAssignmentAction - (*StickerAction)(nil), // 36: WASyncAction.StickerAction - (*RemoveRecentStickerAction)(nil), // 37: WASyncAction.RemoveRecentStickerAction - (*PrimaryVersionAction)(nil), // 38: WASyncAction.PrimaryVersionAction - (*NuxAction)(nil), // 39: WASyncAction.NuxAction - (*TimeFormatAction)(nil), // 40: WASyncAction.TimeFormatAction - (*UserStatusMuteAction)(nil), // 41: WASyncAction.UserStatusMuteAction - (*SubscriptionAction)(nil), // 42: WASyncAction.SubscriptionAction - (*AgentAction)(nil), // 43: WASyncAction.AgentAction - (*AndroidUnsupportedActions)(nil), // 44: WASyncAction.AndroidUnsupportedActions - (*PrimaryFeature)(nil), // 45: WASyncAction.PrimaryFeature - (*KeyExpiration)(nil), // 46: WASyncAction.KeyExpiration - (*SyncActionMessage)(nil), // 47: WASyncAction.SyncActionMessage - (*SyncActionMessageRange)(nil), // 48: WASyncAction.SyncActionMessageRange - (*UnarchiveChatsSetting)(nil), // 49: WASyncAction.UnarchiveChatsSetting - (*DeleteChatAction)(nil), // 50: WASyncAction.DeleteChatAction - (*ClearChatAction)(nil), // 51: WASyncAction.ClearChatAction - (*MarkChatAsReadAction)(nil), // 52: WASyncAction.MarkChatAsReadAction - (*DeleteMessageForMeAction)(nil), // 53: WASyncAction.DeleteMessageForMeAction - (*ArchiveChatAction)(nil), // 54: WASyncAction.ArchiveChatAction - (*RecentEmojiWeightsAction)(nil), // 55: WASyncAction.RecentEmojiWeightsAction - (*LabelEditAction)(nil), // 56: WASyncAction.LabelEditAction - (*LabelAssociationAction)(nil), // 57: WASyncAction.LabelAssociationAction - (*QuickReplyAction)(nil), // 58: WASyncAction.QuickReplyAction - (*LocaleSetting)(nil), // 59: WASyncAction.LocaleSetting - (*PushNameSetting)(nil), // 60: WASyncAction.PushNameSetting - (*SecurityNotificationSetting)(nil), // 61: WASyncAction.SecurityNotificationSetting - (*PinAction)(nil), // 62: WASyncAction.PinAction - (*MuteAction)(nil), // 63: WASyncAction.MuteAction - (*ContactAction)(nil), // 64: WASyncAction.ContactAction - (*StarAction)(nil), // 65: WASyncAction.StarAction - (*SyncActionData)(nil), // 66: WASyncAction.SyncActionData - (*CallLogRecord_ParticipantInfo)(nil), // 67: WASyncAction.CallLogRecord.ParticipantInfo - (*FavoritesAction_Favorite)(nil), // 68: WASyncAction.FavoritesAction.Favorite - (*waChatLockSettings.ChatLockSettings)(nil), // 69: WAProtobufsChatLockSettings.ChatLockSettings - (*waDeviceCapabilities.DeviceCapabilities)(nil), // 70: WAProtobufsDeviceCapabilities.DeviceCapabilities - (*waCommon.MessageKey)(nil), // 71: WACommon.MessageKey + (UsernameChatStartModeAction_ChatStartMode)(0), // 8: WASyncAction.UsernameChatStartModeAction.ChatStartMode + (LabelEditAction_ListType)(0), // 9: WASyncAction.LabelEditAction.ListType + (PatchDebugData_Platform)(0), // 10: WASyncAction.PatchDebugData.Platform + (*CallLogRecord)(nil), // 11: WASyncAction.CallLogRecord + (*WaffleAccountLinkStateAction)(nil), // 12: WASyncAction.WaffleAccountLinkStateAction + (*MerchantPaymentPartnerAction)(nil), // 13: WASyncAction.MerchantPaymentPartnerAction + (*NoteEditAction)(nil), // 14: WASyncAction.NoteEditAction + (*StatusPrivacyAction)(nil), // 15: WASyncAction.StatusPrivacyAction + (*MarketingMessageAction)(nil), // 16: WASyncAction.MarketingMessageAction + (*UsernameChatStartModeAction)(nil), // 17: WASyncAction.UsernameChatStartModeAction + (*LabelEditAction)(nil), // 18: WASyncAction.LabelEditAction + (*PatchDebugData)(nil), // 19: WASyncAction.PatchDebugData + (*RecentEmojiWeight)(nil), // 20: WASyncAction.RecentEmojiWeight + (*SyncActionValue)(nil), // 21: WASyncAction.SyncActionValue + (*FavoritesAction)(nil), // 22: WASyncAction.FavoritesAction + (*PrivacySettingDisableLinkPreviewsAction)(nil), // 23: WASyncAction.PrivacySettingDisableLinkPreviewsAction + (*WamoUserIdentifierAction)(nil), // 24: WASyncAction.WamoUserIdentifierAction + (*LockChatAction)(nil), // 25: WASyncAction.LockChatAction + (*CustomPaymentMethodsAction)(nil), // 26: WASyncAction.CustomPaymentMethodsAction + (*CustomPaymentMethod)(nil), // 27: WASyncAction.CustomPaymentMethod + (*CustomPaymentMethodMetadata)(nil), // 28: WASyncAction.CustomPaymentMethodMetadata + (*PaymentInfoAction)(nil), // 29: WASyncAction.PaymentInfoAction + (*LabelReorderingAction)(nil), // 30: WASyncAction.LabelReorderingAction + (*DeleteIndividualCallLogAction)(nil), // 31: WASyncAction.DeleteIndividualCallLogAction + (*BotWelcomeRequestAction)(nil), // 32: WASyncAction.BotWelcomeRequestAction + (*CallLogAction)(nil), // 33: WASyncAction.CallLogAction + (*PrivacySettingRelayAllCalls)(nil), // 34: WASyncAction.PrivacySettingRelayAllCalls + (*ExternalWebBetaAction)(nil), // 35: WASyncAction.ExternalWebBetaAction + (*MarketingMessageBroadcastAction)(nil), // 36: WASyncAction.MarketingMessageBroadcastAction + (*PnForLidChatAction)(nil), // 37: WASyncAction.PnForLidChatAction + (*ChatAssignmentOpenedStatusAction)(nil), // 38: WASyncAction.ChatAssignmentOpenedStatusAction + (*ChatAssignmentAction)(nil), // 39: WASyncAction.ChatAssignmentAction + (*StickerAction)(nil), // 40: WASyncAction.StickerAction + (*RemoveRecentStickerAction)(nil), // 41: WASyncAction.RemoveRecentStickerAction + (*PrimaryVersionAction)(nil), // 42: WASyncAction.PrimaryVersionAction + (*NuxAction)(nil), // 43: WASyncAction.NuxAction + (*TimeFormatAction)(nil), // 44: WASyncAction.TimeFormatAction + (*UserStatusMuteAction)(nil), // 45: WASyncAction.UserStatusMuteAction + (*SubscriptionAction)(nil), // 46: WASyncAction.SubscriptionAction + (*AgentAction)(nil), // 47: WASyncAction.AgentAction + (*AndroidUnsupportedActions)(nil), // 48: WASyncAction.AndroidUnsupportedActions + (*PrimaryFeature)(nil), // 49: WASyncAction.PrimaryFeature + (*KeyExpiration)(nil), // 50: WASyncAction.KeyExpiration + (*SyncActionMessage)(nil), // 51: WASyncAction.SyncActionMessage + (*SyncActionMessageRange)(nil), // 52: WASyncAction.SyncActionMessageRange + (*UnarchiveChatsSetting)(nil), // 53: WASyncAction.UnarchiveChatsSetting + (*DeleteChatAction)(nil), // 54: WASyncAction.DeleteChatAction + (*ClearChatAction)(nil), // 55: WASyncAction.ClearChatAction + (*MarkChatAsReadAction)(nil), // 56: WASyncAction.MarkChatAsReadAction + (*DeleteMessageForMeAction)(nil), // 57: WASyncAction.DeleteMessageForMeAction + (*ArchiveChatAction)(nil), // 58: WASyncAction.ArchiveChatAction + (*RecentEmojiWeightsAction)(nil), // 59: WASyncAction.RecentEmojiWeightsAction + (*LabelAssociationAction)(nil), // 60: WASyncAction.LabelAssociationAction + (*QuickReplyAction)(nil), // 61: WASyncAction.QuickReplyAction + (*LocaleSetting)(nil), // 62: WASyncAction.LocaleSetting + (*PushNameSetting)(nil), // 63: WASyncAction.PushNameSetting + (*SecurityNotificationSetting)(nil), // 64: WASyncAction.SecurityNotificationSetting + (*PinAction)(nil), // 65: WASyncAction.PinAction + (*MuteAction)(nil), // 66: WASyncAction.MuteAction + (*ContactAction)(nil), // 67: WASyncAction.ContactAction + (*StarAction)(nil), // 68: WASyncAction.StarAction + (*SyncActionData)(nil), // 69: WASyncAction.SyncActionData + (*CallLogRecord_ParticipantInfo)(nil), // 70: WASyncAction.CallLogRecord.ParticipantInfo + (*FavoritesAction_Favorite)(nil), // 71: WASyncAction.FavoritesAction.Favorite + (*waChatLockSettings.ChatLockSettings)(nil), // 72: WAProtobufsChatLockSettings.ChatLockSettings + (*waDeviceCapabilities.DeviceCapabilities)(nil), // 73: WAProtobufsDeviceCapabilities.DeviceCapabilities + (*waCommon.MessageKey)(nil), // 74: WACommon.MessageKey } var file_waSyncAction_WASyncAction_proto_depIdxs = []int32{ 2, // 0: WASyncAction.CallLogRecord.callResult:type_name -> WASyncAction.CallLogRecord.CallResult 1, // 1: WASyncAction.CallLogRecord.silenceReason:type_name -> WASyncAction.CallLogRecord.SilenceReason - 67, // 2: WASyncAction.CallLogRecord.participants:type_name -> WASyncAction.CallLogRecord.ParticipantInfo + 70, // 2: WASyncAction.CallLogRecord.participants:type_name -> WASyncAction.CallLogRecord.ParticipantInfo 0, // 3: WASyncAction.CallLogRecord.callType:type_name -> WASyncAction.CallLogRecord.CallType 3, // 4: WASyncAction.WaffleAccountLinkStateAction.linkState:type_name -> WASyncAction.WaffleAccountLinkStateAction.AccountLinkState 4, // 5: WASyncAction.MerchantPaymentPartnerAction.status:type_name -> WASyncAction.MerchantPaymentPartnerAction.Status 5, // 6: WASyncAction.NoteEditAction.type:type_name -> WASyncAction.NoteEditAction.NoteType 6, // 7: WASyncAction.StatusPrivacyAction.mode:type_name -> WASyncAction.StatusPrivacyAction.StatusDistributionMode 7, // 8: WASyncAction.MarketingMessageAction.type:type_name -> WASyncAction.MarketingMessageAction.MarketingMessagePrototypeType - 8, // 9: WASyncAction.PatchDebugData.senderPlatform:type_name -> WASyncAction.PatchDebugData.Platform - 65, // 10: WASyncAction.SyncActionValue.starAction:type_name -> WASyncAction.StarAction - 64, // 11: WASyncAction.SyncActionValue.contactAction:type_name -> WASyncAction.ContactAction - 63, // 12: WASyncAction.SyncActionValue.muteAction:type_name -> WASyncAction.MuteAction - 62, // 13: WASyncAction.SyncActionValue.pinAction:type_name -> WASyncAction.PinAction - 61, // 14: WASyncAction.SyncActionValue.securityNotificationSetting:type_name -> WASyncAction.SecurityNotificationSetting - 60, // 15: WASyncAction.SyncActionValue.pushNameSetting:type_name -> WASyncAction.PushNameSetting - 58, // 16: WASyncAction.SyncActionValue.quickReplyAction:type_name -> WASyncAction.QuickReplyAction - 55, // 17: WASyncAction.SyncActionValue.recentEmojiWeightsAction:type_name -> WASyncAction.RecentEmojiWeightsAction - 56, // 18: WASyncAction.SyncActionValue.labelEditAction:type_name -> WASyncAction.LabelEditAction - 57, // 19: WASyncAction.SyncActionValue.labelAssociationAction:type_name -> WASyncAction.LabelAssociationAction - 59, // 20: WASyncAction.SyncActionValue.localeSetting:type_name -> WASyncAction.LocaleSetting - 54, // 21: WASyncAction.SyncActionValue.archiveChatAction:type_name -> WASyncAction.ArchiveChatAction - 53, // 22: WASyncAction.SyncActionValue.deleteMessageForMeAction:type_name -> WASyncAction.DeleteMessageForMeAction - 46, // 23: WASyncAction.SyncActionValue.keyExpiration:type_name -> WASyncAction.KeyExpiration - 52, // 24: WASyncAction.SyncActionValue.markChatAsReadAction:type_name -> WASyncAction.MarkChatAsReadAction - 51, // 25: WASyncAction.SyncActionValue.clearChatAction:type_name -> WASyncAction.ClearChatAction - 50, // 26: WASyncAction.SyncActionValue.deleteChatAction:type_name -> WASyncAction.DeleteChatAction - 49, // 27: WASyncAction.SyncActionValue.unarchiveChatsSetting:type_name -> WASyncAction.UnarchiveChatsSetting - 45, // 28: WASyncAction.SyncActionValue.primaryFeature:type_name -> WASyncAction.PrimaryFeature - 44, // 29: WASyncAction.SyncActionValue.androidUnsupportedActions:type_name -> WASyncAction.AndroidUnsupportedActions - 43, // 30: WASyncAction.SyncActionValue.agentAction:type_name -> WASyncAction.AgentAction - 42, // 31: WASyncAction.SyncActionValue.subscriptionAction:type_name -> WASyncAction.SubscriptionAction - 41, // 32: WASyncAction.SyncActionValue.userStatusMuteAction:type_name -> WASyncAction.UserStatusMuteAction - 40, // 33: WASyncAction.SyncActionValue.timeFormatAction:type_name -> WASyncAction.TimeFormatAction - 39, // 34: WASyncAction.SyncActionValue.nuxAction:type_name -> WASyncAction.NuxAction - 38, // 35: WASyncAction.SyncActionValue.primaryVersionAction:type_name -> WASyncAction.PrimaryVersionAction - 36, // 36: WASyncAction.SyncActionValue.stickerAction:type_name -> WASyncAction.StickerAction - 37, // 37: WASyncAction.SyncActionValue.removeRecentStickerAction:type_name -> WASyncAction.RemoveRecentStickerAction - 35, // 38: WASyncAction.SyncActionValue.chatAssignment:type_name -> WASyncAction.ChatAssignmentAction - 34, // 39: WASyncAction.SyncActionValue.chatAssignmentOpenedStatus:type_name -> WASyncAction.ChatAssignmentOpenedStatusAction - 33, // 40: WASyncAction.SyncActionValue.pnForLidChatAction:type_name -> WASyncAction.PnForLidChatAction - 14, // 41: WASyncAction.SyncActionValue.marketingMessageAction:type_name -> WASyncAction.MarketingMessageAction - 32, // 42: WASyncAction.SyncActionValue.marketingMessageBroadcastAction:type_name -> WASyncAction.MarketingMessageBroadcastAction - 31, // 43: WASyncAction.SyncActionValue.externalWebBetaAction:type_name -> WASyncAction.ExternalWebBetaAction - 30, // 44: WASyncAction.SyncActionValue.privacySettingRelayAllCalls:type_name -> WASyncAction.PrivacySettingRelayAllCalls - 29, // 45: WASyncAction.SyncActionValue.callLogAction:type_name -> WASyncAction.CallLogAction - 13, // 46: WASyncAction.SyncActionValue.statusPrivacy:type_name -> WASyncAction.StatusPrivacyAction - 28, // 47: WASyncAction.SyncActionValue.botWelcomeRequestAction:type_name -> WASyncAction.BotWelcomeRequestAction - 27, // 48: WASyncAction.SyncActionValue.deleteIndividualCallLog:type_name -> WASyncAction.DeleteIndividualCallLogAction - 26, // 49: WASyncAction.SyncActionValue.labelReorderingAction:type_name -> WASyncAction.LabelReorderingAction - 25, // 50: WASyncAction.SyncActionValue.paymentInfoAction:type_name -> WASyncAction.PaymentInfoAction - 22, // 51: WASyncAction.SyncActionValue.customPaymentMethodsAction:type_name -> WASyncAction.CustomPaymentMethodsAction - 21, // 52: WASyncAction.SyncActionValue.lockChatAction:type_name -> WASyncAction.LockChatAction - 69, // 53: WASyncAction.SyncActionValue.chatLockSettings:type_name -> WAProtobufsChatLockSettings.ChatLockSettings - 20, // 54: WASyncAction.SyncActionValue.wamoUserIdentifierAction:type_name -> WASyncAction.WamoUserIdentifierAction - 19, // 55: WASyncAction.SyncActionValue.privacySettingDisableLinkPreviewsAction:type_name -> WASyncAction.PrivacySettingDisableLinkPreviewsAction - 70, // 56: WASyncAction.SyncActionValue.deviceCapabilities:type_name -> WAProtobufsDeviceCapabilities.DeviceCapabilities - 12, // 57: WASyncAction.SyncActionValue.noteEditAction:type_name -> WASyncAction.NoteEditAction - 18, // 58: WASyncAction.SyncActionValue.favorites:type_name -> WASyncAction.FavoritesAction - 11, // 59: WASyncAction.SyncActionValue.merchantPaymentPartnerAction:type_name -> WASyncAction.MerchantPaymentPartnerAction - 10, // 60: WASyncAction.SyncActionValue.waffleAccountLinkStateAction:type_name -> WASyncAction.WaffleAccountLinkStateAction - 68, // 61: WASyncAction.FavoritesAction.favorites:type_name -> WASyncAction.FavoritesAction.Favorite - 23, // 62: WASyncAction.CustomPaymentMethodsAction.customPaymentMethods:type_name -> WASyncAction.CustomPaymentMethod - 24, // 63: WASyncAction.CustomPaymentMethod.metadata:type_name -> WASyncAction.CustomPaymentMethodMetadata - 9, // 64: WASyncAction.CallLogAction.callLogRecord:type_name -> WASyncAction.CallLogRecord - 71, // 65: WASyncAction.SyncActionMessage.key:type_name -> WACommon.MessageKey - 47, // 66: WASyncAction.SyncActionMessageRange.messages:type_name -> WASyncAction.SyncActionMessage - 48, // 67: WASyncAction.DeleteChatAction.messageRange:type_name -> WASyncAction.SyncActionMessageRange - 48, // 68: WASyncAction.ClearChatAction.messageRange:type_name -> WASyncAction.SyncActionMessageRange - 48, // 69: WASyncAction.MarkChatAsReadAction.messageRange:type_name -> WASyncAction.SyncActionMessageRange - 48, // 70: WASyncAction.ArchiveChatAction.messageRange:type_name -> WASyncAction.SyncActionMessageRange - 16, // 71: WASyncAction.RecentEmojiWeightsAction.weights:type_name -> WASyncAction.RecentEmojiWeight - 17, // 72: WASyncAction.SyncActionData.value:type_name -> WASyncAction.SyncActionValue - 2, // 73: WASyncAction.CallLogRecord.ParticipantInfo.callResult:type_name -> WASyncAction.CallLogRecord.CallResult - 74, // [74:74] is the sub-list for method output_type - 74, // [74:74] is the sub-list for method input_type - 74, // [74:74] is the sub-list for extension type_name - 74, // [74:74] is the sub-list for extension extendee - 0, // [0:74] is the sub-list for field type_name + 8, // 9: WASyncAction.UsernameChatStartModeAction.chatStartMode:type_name -> WASyncAction.UsernameChatStartModeAction.ChatStartMode + 9, // 10: WASyncAction.LabelEditAction.type:type_name -> WASyncAction.LabelEditAction.ListType + 10, // 11: WASyncAction.PatchDebugData.senderPlatform:type_name -> WASyncAction.PatchDebugData.Platform + 68, // 12: WASyncAction.SyncActionValue.starAction:type_name -> WASyncAction.StarAction + 67, // 13: WASyncAction.SyncActionValue.contactAction:type_name -> WASyncAction.ContactAction + 66, // 14: WASyncAction.SyncActionValue.muteAction:type_name -> WASyncAction.MuteAction + 65, // 15: WASyncAction.SyncActionValue.pinAction:type_name -> WASyncAction.PinAction + 64, // 16: WASyncAction.SyncActionValue.securityNotificationSetting:type_name -> WASyncAction.SecurityNotificationSetting + 63, // 17: WASyncAction.SyncActionValue.pushNameSetting:type_name -> WASyncAction.PushNameSetting + 61, // 18: WASyncAction.SyncActionValue.quickReplyAction:type_name -> WASyncAction.QuickReplyAction + 59, // 19: WASyncAction.SyncActionValue.recentEmojiWeightsAction:type_name -> WASyncAction.RecentEmojiWeightsAction + 18, // 20: WASyncAction.SyncActionValue.labelEditAction:type_name -> WASyncAction.LabelEditAction + 60, // 21: WASyncAction.SyncActionValue.labelAssociationAction:type_name -> WASyncAction.LabelAssociationAction + 62, // 22: WASyncAction.SyncActionValue.localeSetting:type_name -> WASyncAction.LocaleSetting + 58, // 23: WASyncAction.SyncActionValue.archiveChatAction:type_name -> WASyncAction.ArchiveChatAction + 57, // 24: WASyncAction.SyncActionValue.deleteMessageForMeAction:type_name -> WASyncAction.DeleteMessageForMeAction + 50, // 25: WASyncAction.SyncActionValue.keyExpiration:type_name -> WASyncAction.KeyExpiration + 56, // 26: WASyncAction.SyncActionValue.markChatAsReadAction:type_name -> WASyncAction.MarkChatAsReadAction + 55, // 27: WASyncAction.SyncActionValue.clearChatAction:type_name -> WASyncAction.ClearChatAction + 54, // 28: WASyncAction.SyncActionValue.deleteChatAction:type_name -> WASyncAction.DeleteChatAction + 53, // 29: WASyncAction.SyncActionValue.unarchiveChatsSetting:type_name -> WASyncAction.UnarchiveChatsSetting + 49, // 30: WASyncAction.SyncActionValue.primaryFeature:type_name -> WASyncAction.PrimaryFeature + 48, // 31: WASyncAction.SyncActionValue.androidUnsupportedActions:type_name -> WASyncAction.AndroidUnsupportedActions + 47, // 32: WASyncAction.SyncActionValue.agentAction:type_name -> WASyncAction.AgentAction + 46, // 33: WASyncAction.SyncActionValue.subscriptionAction:type_name -> WASyncAction.SubscriptionAction + 45, // 34: WASyncAction.SyncActionValue.userStatusMuteAction:type_name -> WASyncAction.UserStatusMuteAction + 44, // 35: WASyncAction.SyncActionValue.timeFormatAction:type_name -> WASyncAction.TimeFormatAction + 43, // 36: WASyncAction.SyncActionValue.nuxAction:type_name -> WASyncAction.NuxAction + 42, // 37: WASyncAction.SyncActionValue.primaryVersionAction:type_name -> WASyncAction.PrimaryVersionAction + 40, // 38: WASyncAction.SyncActionValue.stickerAction:type_name -> WASyncAction.StickerAction + 41, // 39: WASyncAction.SyncActionValue.removeRecentStickerAction:type_name -> WASyncAction.RemoveRecentStickerAction + 39, // 40: WASyncAction.SyncActionValue.chatAssignment:type_name -> WASyncAction.ChatAssignmentAction + 38, // 41: WASyncAction.SyncActionValue.chatAssignmentOpenedStatus:type_name -> WASyncAction.ChatAssignmentOpenedStatusAction + 37, // 42: WASyncAction.SyncActionValue.pnForLidChatAction:type_name -> WASyncAction.PnForLidChatAction + 16, // 43: WASyncAction.SyncActionValue.marketingMessageAction:type_name -> WASyncAction.MarketingMessageAction + 36, // 44: WASyncAction.SyncActionValue.marketingMessageBroadcastAction:type_name -> WASyncAction.MarketingMessageBroadcastAction + 35, // 45: WASyncAction.SyncActionValue.externalWebBetaAction:type_name -> WASyncAction.ExternalWebBetaAction + 34, // 46: WASyncAction.SyncActionValue.privacySettingRelayAllCalls:type_name -> WASyncAction.PrivacySettingRelayAllCalls + 33, // 47: WASyncAction.SyncActionValue.callLogAction:type_name -> WASyncAction.CallLogAction + 15, // 48: WASyncAction.SyncActionValue.statusPrivacy:type_name -> WASyncAction.StatusPrivacyAction + 32, // 49: WASyncAction.SyncActionValue.botWelcomeRequestAction:type_name -> WASyncAction.BotWelcomeRequestAction + 31, // 50: WASyncAction.SyncActionValue.deleteIndividualCallLog:type_name -> WASyncAction.DeleteIndividualCallLogAction + 30, // 51: WASyncAction.SyncActionValue.labelReorderingAction:type_name -> WASyncAction.LabelReorderingAction + 29, // 52: WASyncAction.SyncActionValue.paymentInfoAction:type_name -> WASyncAction.PaymentInfoAction + 26, // 53: WASyncAction.SyncActionValue.customPaymentMethodsAction:type_name -> WASyncAction.CustomPaymentMethodsAction + 25, // 54: WASyncAction.SyncActionValue.lockChatAction:type_name -> WASyncAction.LockChatAction + 72, // 55: WASyncAction.SyncActionValue.chatLockSettings:type_name -> WAProtobufsChatLockSettings.ChatLockSettings + 24, // 56: WASyncAction.SyncActionValue.wamoUserIdentifierAction:type_name -> WASyncAction.WamoUserIdentifierAction + 23, // 57: WASyncAction.SyncActionValue.privacySettingDisableLinkPreviewsAction:type_name -> WASyncAction.PrivacySettingDisableLinkPreviewsAction + 73, // 58: WASyncAction.SyncActionValue.deviceCapabilities:type_name -> WAProtobufsDeviceCapabilities.DeviceCapabilities + 14, // 59: WASyncAction.SyncActionValue.noteEditAction:type_name -> WASyncAction.NoteEditAction + 22, // 60: WASyncAction.SyncActionValue.favoritesAction:type_name -> WASyncAction.FavoritesAction + 13, // 61: WASyncAction.SyncActionValue.merchantPaymentPartnerAction:type_name -> WASyncAction.MerchantPaymentPartnerAction + 12, // 62: WASyncAction.SyncActionValue.waffleAccountLinkStateAction:type_name -> WASyncAction.WaffleAccountLinkStateAction + 17, // 63: WASyncAction.SyncActionValue.usernameChatStartMode:type_name -> WASyncAction.UsernameChatStartModeAction + 71, // 64: WASyncAction.FavoritesAction.favorites:type_name -> WASyncAction.FavoritesAction.Favorite + 27, // 65: WASyncAction.CustomPaymentMethodsAction.customPaymentMethods:type_name -> WASyncAction.CustomPaymentMethod + 28, // 66: WASyncAction.CustomPaymentMethod.metadata:type_name -> WASyncAction.CustomPaymentMethodMetadata + 11, // 67: WASyncAction.CallLogAction.callLogRecord:type_name -> WASyncAction.CallLogRecord + 74, // 68: WASyncAction.SyncActionMessage.key:type_name -> WACommon.MessageKey + 51, // 69: WASyncAction.SyncActionMessageRange.messages:type_name -> WASyncAction.SyncActionMessage + 52, // 70: WASyncAction.DeleteChatAction.messageRange:type_name -> WASyncAction.SyncActionMessageRange + 52, // 71: WASyncAction.ClearChatAction.messageRange:type_name -> WASyncAction.SyncActionMessageRange + 52, // 72: WASyncAction.MarkChatAsReadAction.messageRange:type_name -> WASyncAction.SyncActionMessageRange + 52, // 73: WASyncAction.ArchiveChatAction.messageRange:type_name -> WASyncAction.SyncActionMessageRange + 20, // 74: WASyncAction.RecentEmojiWeightsAction.weights:type_name -> WASyncAction.RecentEmojiWeight + 21, // 75: WASyncAction.SyncActionData.value:type_name -> WASyncAction.SyncActionValue + 2, // 76: WASyncAction.CallLogRecord.ParticipantInfo.callResult:type_name -> WASyncAction.CallLogRecord.CallResult + 77, // [77:77] is the sub-list for method output_type + 77, // [77:77] is the sub-list for method input_type + 77, // [77:77] is the sub-list for extension type_name + 77, // [77:77] is the sub-list for extension extendee + 0, // [0:77] is the sub-list for field type_name } func init() { file_waSyncAction_WASyncAction_proto_init() } @@ -4641,7 +4836,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waSyncAction_WASyncAction_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*CallLogRecord); i { case 0: return &v.state @@ -4653,7 +4848,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*WaffleAccountLinkStateAction); i { case 0: return &v.state @@ -4665,7 +4860,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*MerchantPaymentPartnerAction); i { case 0: return &v.state @@ -4677,7 +4872,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*NoteEditAction); i { case 0: return &v.state @@ -4689,7 +4884,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*StatusPrivacyAction); i { case 0: return &v.state @@ -4701,7 +4896,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*MarketingMessageAction); i { case 0: return &v.state @@ -4713,8 +4908,8 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatchDebugData); i { + file_waSyncAction_WASyncAction_proto_msgTypes[6].Exporter = func(v any, i int) any { + switch v := v.(*UsernameChatStartModeAction); i { case 0: return &v.state case 1: @@ -4725,487 +4920,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RecentEmojiWeight); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncActionValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FavoritesAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PrivacySettingDisableLinkPreviewsAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WamoUserIdentifierAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LockChatAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CustomPaymentMethodsAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CustomPaymentMethod); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CustomPaymentMethodMetadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PaymentInfoAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LabelReorderingAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteIndividualCallLogAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotWelcomeRequestAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallLogAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PrivacySettingRelayAllCalls); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExternalWebBetaAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MarketingMessageBroadcastAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PnForLidChatAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChatAssignmentOpenedStatusAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChatAssignmentAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StickerAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RemoveRecentStickerAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PrimaryVersionAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NuxAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TimeFormatAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UserStatusMuteAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SubscriptionAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AgentAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AndroidUnsupportedActions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PrimaryFeature); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KeyExpiration); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncActionMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncActionMessageRange); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UnarchiveChatsSetting); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteChatAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClearChatAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MarkChatAsReadAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteMessageForMeAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ArchiveChatAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RecentEmojiWeightsAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_waSyncAction_WASyncAction_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*LabelEditAction); i { case 0: return &v.state @@ -5217,7 +4932,499 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[8].Exporter = func(v any, i int) any { + switch v := v.(*PatchDebugData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[9].Exporter = func(v any, i int) any { + switch v := v.(*RecentEmojiWeight); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[10].Exporter = func(v any, i int) any { + switch v := v.(*SyncActionValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[11].Exporter = func(v any, i int) any { + switch v := v.(*FavoritesAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[12].Exporter = func(v any, i int) any { + switch v := v.(*PrivacySettingDisableLinkPreviewsAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[13].Exporter = func(v any, i int) any { + switch v := v.(*WamoUserIdentifierAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[14].Exporter = func(v any, i int) any { + switch v := v.(*LockChatAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[15].Exporter = func(v any, i int) any { + switch v := v.(*CustomPaymentMethodsAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[16].Exporter = func(v any, i int) any { + switch v := v.(*CustomPaymentMethod); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[17].Exporter = func(v any, i int) any { + switch v := v.(*CustomPaymentMethodMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[18].Exporter = func(v any, i int) any { + switch v := v.(*PaymentInfoAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[19].Exporter = func(v any, i int) any { + switch v := v.(*LabelReorderingAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[20].Exporter = func(v any, i int) any { + switch v := v.(*DeleteIndividualCallLogAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[21].Exporter = func(v any, i int) any { + switch v := v.(*BotWelcomeRequestAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[22].Exporter = func(v any, i int) any { + switch v := v.(*CallLogAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[23].Exporter = func(v any, i int) any { + switch v := v.(*PrivacySettingRelayAllCalls); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[24].Exporter = func(v any, i int) any { + switch v := v.(*ExternalWebBetaAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[25].Exporter = func(v any, i int) any { + switch v := v.(*MarketingMessageBroadcastAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[26].Exporter = func(v any, i int) any { + switch v := v.(*PnForLidChatAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[27].Exporter = func(v any, i int) any { + switch v := v.(*ChatAssignmentOpenedStatusAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[28].Exporter = func(v any, i int) any { + switch v := v.(*ChatAssignmentAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[29].Exporter = func(v any, i int) any { + switch v := v.(*StickerAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[30].Exporter = func(v any, i int) any { + switch v := v.(*RemoveRecentStickerAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[31].Exporter = func(v any, i int) any { + switch v := v.(*PrimaryVersionAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[32].Exporter = func(v any, i int) any { + switch v := v.(*NuxAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[33].Exporter = func(v any, i int) any { + switch v := v.(*TimeFormatAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[34].Exporter = func(v any, i int) any { + switch v := v.(*UserStatusMuteAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[35].Exporter = func(v any, i int) any { + switch v := v.(*SubscriptionAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[36].Exporter = func(v any, i int) any { + switch v := v.(*AgentAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[37].Exporter = func(v any, i int) any { + switch v := v.(*AndroidUnsupportedActions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[38].Exporter = func(v any, i int) any { + switch v := v.(*PrimaryFeature); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[39].Exporter = func(v any, i int) any { + switch v := v.(*KeyExpiration); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[40].Exporter = func(v any, i int) any { + switch v := v.(*SyncActionMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[41].Exporter = func(v any, i int) any { + switch v := v.(*SyncActionMessageRange); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[42].Exporter = func(v any, i int) any { + switch v := v.(*UnarchiveChatsSetting); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[43].Exporter = func(v any, i int) any { + switch v := v.(*DeleteChatAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[44].Exporter = func(v any, i int) any { + switch v := v.(*ClearChatAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[45].Exporter = func(v any, i int) any { + switch v := v.(*MarkChatAsReadAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[46].Exporter = func(v any, i int) any { + switch v := v.(*DeleteMessageForMeAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[47].Exporter = func(v any, i int) any { + switch v := v.(*ArchiveChatAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[48].Exporter = func(v any, i int) any { + switch v := v.(*RecentEmojiWeightsAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waSyncAction_WASyncAction_proto_msgTypes[49].Exporter = func(v any, i int) any { switch v := v.(*LabelAssociationAction); i { case 0: return &v.state @@ -5229,7 +5436,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[50].Exporter = func(v any, i int) any { switch v := v.(*QuickReplyAction); i { case 0: return &v.state @@ -5241,7 +5448,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[51].Exporter = func(v any, i int) any { switch v := v.(*LocaleSetting); i { case 0: return &v.state @@ -5253,7 +5460,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[52].Exporter = func(v any, i int) any { switch v := v.(*PushNameSetting); i { case 0: return &v.state @@ -5265,7 +5472,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[53].Exporter = func(v any, i int) any { switch v := v.(*SecurityNotificationSetting); i { case 0: return &v.state @@ -5277,7 +5484,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[54].Exporter = func(v any, i int) any { switch v := v.(*PinAction); i { case 0: return &v.state @@ -5289,7 +5496,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[55].Exporter = func(v any, i int) any { switch v := v.(*MuteAction); i { case 0: return &v.state @@ -5301,7 +5508,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[56].Exporter = func(v any, i int) any { switch v := v.(*ContactAction); i { case 0: return &v.state @@ -5313,7 +5520,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[57].Exporter = func(v any, i int) any { switch v := v.(*StarAction); i { case 0: return &v.state @@ -5325,7 +5532,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[58].Exporter = func(v any, i int) any { switch v := v.(*SyncActionData); i { case 0: return &v.state @@ -5337,7 +5544,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[58].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[59].Exporter = func(v any, i int) any { switch v := v.(*CallLogRecord_ParticipantInfo); i { case 0: return &v.state @@ -5349,7 +5556,7 @@ func file_waSyncAction_WASyncAction_proto_init() { return nil } } - file_waSyncAction_WASyncAction_proto_msgTypes[59].Exporter = func(v interface{}, i int) interface{} { + file_waSyncAction_WASyncAction_proto_msgTypes[60].Exporter = func(v any, i int) any { switch v := v.(*FavoritesAction_Favorite); i { case 0: return &v.state @@ -5367,8 +5574,8 @@ func file_waSyncAction_WASyncAction_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_waSyncAction_WASyncAction_proto_rawDesc, - NumEnums: 9, - NumMessages: 60, + NumEnums: 11, + NumMessages: 61, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.raw b/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.raw index 8898a0aa..4cbc0aec 100644 Binary files a/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.raw and b/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.raw differ diff --git a/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto b/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto index 84330460..8dab7f66 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto +++ b/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto @@ -59,8 +59,6 @@ message CallLogRecord { message WaffleAccountLinkStateAction { enum AccountLinkState { ACTIVE = 0; - PAUSED = 1; - UNLINKED = 2; } optional AccountLinkState linkState = 2; @@ -116,6 +114,34 @@ message MarketingMessageAction { optional string mediaID = 7; } +message UsernameChatStartModeAction { + enum ChatStartMode { + LID = 1; + PN = 2; + } + + optional ChatStartMode chatStartMode = 1; +} + +message LabelEditAction { + enum ListType { + NONE = 0; + UNREAD = 1; + GROUPS = 2; + FAVORITES = 3; + PREDEFINED = 4; + CUSTOM = 5; + } + + optional string name = 1; + optional int32 color = 2; + optional int32 predefinedID = 3; + optional bool deleted = 4; + optional int32 orderIndex = 5; + optional bool isActive = 6; + optional ListType type = 7; +} + message PatchDebugData { enum Platform { ANDROID = 0; @@ -195,9 +221,10 @@ message SyncActionValue { optional PrivacySettingDisableLinkPreviewsAction privacySettingDisableLinkPreviewsAction = 53; optional WAProtobufsDeviceCapabilities.DeviceCapabilities deviceCapabilities = 54; optional NoteEditAction noteEditAction = 55; - optional FavoritesAction favorites = 56; + optional FavoritesAction favoritesAction = 56; optional MerchantPaymentPartnerAction merchantPaymentPartnerAction = 57; optional WaffleAccountLinkStateAction waffleAccountLinkStateAction = 58; + optional UsernameChatStartModeAction usernameChatStartMode = 59; } message FavoritesAction { @@ -381,14 +408,6 @@ message RecentEmojiWeightsAction { repeated RecentEmojiWeight weights = 1; } -message LabelEditAction { - optional string name = 1; - optional int32 color = 2; - optional int32 predefinedID = 3; - optional bool deleted = 4; - optional int32 orderIndex = 5; -} - message LabelAssociationAction { optional bool labeled = 1; } diff --git a/vendor/go.mau.fi/whatsmeow/proto/waUserPassword/WAProtobufsUserPassword.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waUserPassword/WAProtobufsUserPassword.pb.go index 6dd23882..bff8e175 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waUserPassword/WAProtobufsUserPassword.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waUserPassword/WAProtobufsUserPassword.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waUserPassword/WAProtobufsUserPassword.proto @@ -365,7 +365,7 @@ func file_waUserPassword_WAProtobufsUserPassword_proto_rawDescGZIP() []byte { var file_waUserPassword_WAProtobufsUserPassword_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_waUserPassword_WAProtobufsUserPassword_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_waUserPassword_WAProtobufsUserPassword_proto_goTypes = []interface{}{ +var file_waUserPassword_WAProtobufsUserPassword_proto_goTypes = []any{ (UserPassword_Transformer)(0), // 0: WAProtobufsUserPassword.UserPassword.Transformer (UserPassword_Encoding)(0), // 1: WAProtobufsUserPassword.UserPassword.Encoding (*UserPassword)(nil), // 2: WAProtobufsUserPassword.UserPassword @@ -390,7 +390,7 @@ func file_waUserPassword_WAProtobufsUserPassword_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waUserPassword_WAProtobufsUserPassword_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waUserPassword_WAProtobufsUserPassword_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*UserPassword); i { case 0: return &v.state @@ -402,7 +402,7 @@ func file_waUserPassword_WAProtobufsUserPassword_proto_init() { return nil } } - file_waUserPassword_WAProtobufsUserPassword_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waUserPassword_WAProtobufsUserPassword_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*UserPassword_TransformerArg); i { case 0: return &v.state @@ -414,7 +414,7 @@ func file_waUserPassword_WAProtobufsUserPassword_proto_init() { return nil } } - file_waUserPassword_WAProtobufsUserPassword_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waUserPassword_WAProtobufsUserPassword_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*UserPassword_TransformerArg_Value); i { case 0: return &v.state @@ -427,7 +427,7 @@ func file_waUserPassword_WAProtobufsUserPassword_proto_init() { } } } - file_waUserPassword_WAProtobufsUserPassword_proto_msgTypes[2].OneofWrappers = []interface{}{ + file_waUserPassword_WAProtobufsUserPassword_proto_msgTypes[2].OneofWrappers = []any{ (*UserPassword_TransformerArg_Value_AsBlob)(nil), (*UserPassword_TransformerArg_Value_AsUnsignedInteger)(nil), } diff --git a/vendor/go.mau.fi/whatsmeow/proto/waVnameCert/WAWebProtobufsVnameCert.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waVnameCert/WAWebProtobufsVnameCert.pb.go index 3722eeed..f642154d 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waVnameCert/WAWebProtobufsVnameCert.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waVnameCert/WAWebProtobufsVnameCert.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waVnameCert/WAWebProtobufsVnameCert.proto @@ -764,7 +764,7 @@ func file_waVnameCert_WAWebProtobufsVnameCert_proto_rawDescGZIP() []byte { var file_waVnameCert_WAWebProtobufsVnameCert_proto_enumTypes = make([]protoimpl.EnumInfo, 5) var file_waVnameCert_WAWebProtobufsVnameCert_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_waVnameCert_WAWebProtobufsVnameCert_proto_goTypes = []interface{}{ +var file_waVnameCert_WAWebProtobufsVnameCert_proto_goTypes = []any{ (BizAccountLinkInfo_AccountType)(0), // 0: WAWebProtobufsVnameCert.BizAccountLinkInfo.AccountType (BizAccountLinkInfo_HostStorageType)(0), // 1: WAWebProtobufsVnameCert.BizAccountLinkInfo.HostStorageType (BizIdentityInfo_ActualActorsType)(0), // 2: WAWebProtobufsVnameCert.BizIdentityInfo.ActualActorsType @@ -799,7 +799,7 @@ func file_waVnameCert_WAWebProtobufsVnameCert_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waVnameCert_WAWebProtobufsVnameCert_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waVnameCert_WAWebProtobufsVnameCert_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*BizAccountLinkInfo); i { case 0: return &v.state @@ -811,7 +811,7 @@ func file_waVnameCert_WAWebProtobufsVnameCert_proto_init() { return nil } } - file_waVnameCert_WAWebProtobufsVnameCert_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waVnameCert_WAWebProtobufsVnameCert_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*BizIdentityInfo); i { case 0: return &v.state @@ -823,7 +823,7 @@ func file_waVnameCert_WAWebProtobufsVnameCert_proto_init() { return nil } } - file_waVnameCert_WAWebProtobufsVnameCert_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waVnameCert_WAWebProtobufsVnameCert_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*LocalizedName); i { case 0: return &v.state @@ -835,7 +835,7 @@ func file_waVnameCert_WAWebProtobufsVnameCert_proto_init() { return nil } } - file_waVnameCert_WAWebProtobufsVnameCert_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waVnameCert_WAWebProtobufsVnameCert_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*VerifiedNameCertificate); i { case 0: return &v.state @@ -847,7 +847,7 @@ func file_waVnameCert_WAWebProtobufsVnameCert_proto_init() { return nil } } - file_waVnameCert_WAWebProtobufsVnameCert_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_waVnameCert_WAWebProtobufsVnameCert_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*BizAccountPayload); i { case 0: return &v.state @@ -859,7 +859,7 @@ func file_waVnameCert_WAWebProtobufsVnameCert_proto_init() { return nil } } - file_waVnameCert_WAWebProtobufsVnameCert_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_waVnameCert_WAWebProtobufsVnameCert_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*VerifiedNameCertificate_Details); i { case 0: return &v.state diff --git a/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.go index deefc404..156c74eb 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waWa6/WAWebProtobufsWa6.proto @@ -23,6 +23,62 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type ClientPayload_TrafficAnonymization int32 + +const ( + ClientPayload_OFF ClientPayload_TrafficAnonymization = 0 + ClientPayload_STANDARD ClientPayload_TrafficAnonymization = 1 +) + +// Enum value maps for ClientPayload_TrafficAnonymization. +var ( + ClientPayload_TrafficAnonymization_name = map[int32]string{ + 0: "OFF", + 1: "STANDARD", + } + ClientPayload_TrafficAnonymization_value = map[string]int32{ + "OFF": 0, + "STANDARD": 1, + } +) + +func (x ClientPayload_TrafficAnonymization) Enum() *ClientPayload_TrafficAnonymization { + p := new(ClientPayload_TrafficAnonymization) + *p = x + return p +} + +func (x ClientPayload_TrafficAnonymization) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ClientPayload_TrafficAnonymization) Descriptor() protoreflect.EnumDescriptor { + return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[0].Descriptor() +} + +func (ClientPayload_TrafficAnonymization) Type() protoreflect.EnumType { + return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[0] +} + +func (x ClientPayload_TrafficAnonymization) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ClientPayload_TrafficAnonymization) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ClientPayload_TrafficAnonymization(num) + return nil +} + +// Deprecated: Use ClientPayload_TrafficAnonymization.Descriptor instead. +func (ClientPayload_TrafficAnonymization) EnumDescriptor() ([]byte, []int) { + return file_waWa6_WAWebProtobufsWa6_proto_rawDescGZIP(), []int{0, 0} +} + type ClientPayload_Product int32 const ( @@ -59,11 +115,11 @@ func (x ClientPayload_Product) String() string { } func (ClientPayload_Product) Descriptor() protoreflect.EnumDescriptor { - return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[0].Descriptor() + return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[1].Descriptor() } func (ClientPayload_Product) Type() protoreflect.EnumType { - return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[0] + return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[1] } func (x ClientPayload_Product) Number() protoreflect.EnumNumber { @@ -82,7 +138,7 @@ func (x *ClientPayload_Product) UnmarshalJSON(b []byte) error { // Deprecated: Use ClientPayload_Product.Descriptor instead. func (ClientPayload_Product) EnumDescriptor() ([]byte, []int) { - return file_waWa6_WAWebProtobufsWa6_proto_rawDescGZIP(), []int{0, 0} + return file_waWa6_WAWebProtobufsWa6_proto_rawDescGZIP(), []int{0, 1} } type ClientPayload_ConnectType int32 @@ -154,11 +210,11 @@ func (x ClientPayload_ConnectType) String() string { } func (ClientPayload_ConnectType) Descriptor() protoreflect.EnumDescriptor { - return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[1].Descriptor() + return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[2].Descriptor() } func (ClientPayload_ConnectType) Type() protoreflect.EnumType { - return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[1] + return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[2] } func (x ClientPayload_ConnectType) Number() protoreflect.EnumNumber { @@ -177,7 +233,7 @@ func (x *ClientPayload_ConnectType) UnmarshalJSON(b []byte) error { // Deprecated: Use ClientPayload_ConnectType.Descriptor instead. func (ClientPayload_ConnectType) EnumDescriptor() ([]byte, []int) { - return file_waWa6_WAWebProtobufsWa6_proto_rawDescGZIP(), []int{0, 1} + return file_waWa6_WAWebProtobufsWa6_proto_rawDescGZIP(), []int{0, 2} } type ClientPayload_ConnectReason int32 @@ -225,11 +281,11 @@ func (x ClientPayload_ConnectReason) String() string { } func (ClientPayload_ConnectReason) Descriptor() protoreflect.EnumDescriptor { - return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[2].Descriptor() + return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[3].Descriptor() } func (ClientPayload_ConnectReason) Type() protoreflect.EnumType { - return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[2] + return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[3] } func (x ClientPayload_ConnectReason) Number() protoreflect.EnumNumber { @@ -248,7 +304,7 @@ func (x *ClientPayload_ConnectReason) UnmarshalJSON(b []byte) error { // Deprecated: Use ClientPayload_ConnectReason.Descriptor instead. func (ClientPayload_ConnectReason) EnumDescriptor() ([]byte, []int) { - return file_waWa6_WAWebProtobufsWa6_proto_rawDescGZIP(), []int{0, 2} + return file_waWa6_WAWebProtobufsWa6_proto_rawDescGZIP(), []int{0, 3} } type ClientPayload_IOSAppExtension int32 @@ -284,11 +340,11 @@ func (x ClientPayload_IOSAppExtension) String() string { } func (ClientPayload_IOSAppExtension) Descriptor() protoreflect.EnumDescriptor { - return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[3].Descriptor() + return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[4].Descriptor() } func (ClientPayload_IOSAppExtension) Type() protoreflect.EnumType { - return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[3] + return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[4] } func (x ClientPayload_IOSAppExtension) Number() protoreflect.EnumNumber { @@ -307,7 +363,7 @@ func (x *ClientPayload_IOSAppExtension) UnmarshalJSON(b []byte) error { // Deprecated: Use ClientPayload_IOSAppExtension.Descriptor instead. func (ClientPayload_IOSAppExtension) EnumDescriptor() ([]byte, []int) { - return file_waWa6_WAWebProtobufsWa6_proto_rawDescGZIP(), []int{0, 3} + return file_waWa6_WAWebProtobufsWa6_proto_rawDescGZIP(), []int{0, 4} } type ClientPayload_DNSSource_DNSResolutionMethod int32 @@ -349,11 +405,11 @@ func (x ClientPayload_DNSSource_DNSResolutionMethod) String() string { } func (ClientPayload_DNSSource_DNSResolutionMethod) Descriptor() protoreflect.EnumDescriptor { - return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[4].Descriptor() + return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[5].Descriptor() } func (ClientPayload_DNSSource_DNSResolutionMethod) Type() protoreflect.EnumType { - return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[4] + return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[5] } func (x ClientPayload_DNSSource_DNSResolutionMethod) Number() protoreflect.EnumNumber { @@ -414,11 +470,11 @@ func (x ClientPayload_WebInfo_WebSubPlatform) String() string { } func (ClientPayload_WebInfo_WebSubPlatform) Descriptor() protoreflect.EnumDescriptor { - return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[5].Descriptor() + return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[6].Descriptor() } func (ClientPayload_WebInfo_WebSubPlatform) Type() protoreflect.EnumType { - return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[5] + return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[6] } func (x ClientPayload_WebInfo_WebSubPlatform) Number() protoreflect.EnumNumber { @@ -479,11 +535,11 @@ func (x ClientPayload_UserAgent_DeviceType) String() string { } func (ClientPayload_UserAgent_DeviceType) Descriptor() protoreflect.EnumDescriptor { - return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[6].Descriptor() + return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[7].Descriptor() } func (ClientPayload_UserAgent_DeviceType) Type() protoreflect.EnumType { - return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[6] + return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[7] } func (x ClientPayload_UserAgent_DeviceType) Number() protoreflect.EnumNumber { @@ -541,11 +597,11 @@ func (x ClientPayload_UserAgent_ReleaseChannel) String() string { } func (ClientPayload_UserAgent_ReleaseChannel) Descriptor() protoreflect.EnumDescriptor { - return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[7].Descriptor() + return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[8].Descriptor() } func (ClientPayload_UserAgent_ReleaseChannel) Type() protoreflect.EnumType { - return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[7] + return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[8] } func (x ClientPayload_UserAgent_ReleaseChannel) Number() protoreflect.EnumNumber { @@ -699,11 +755,11 @@ func (x ClientPayload_UserAgent_Platform) String() string { } func (ClientPayload_UserAgent_Platform) Descriptor() protoreflect.EnumDescriptor { - return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[8].Descriptor() + return file_waWa6_WAWebProtobufsWa6_proto_enumTypes[9].Descriptor() } func (ClientPayload_UserAgent_Platform) Type() protoreflect.EnumType { - return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[8] + return &file_waWa6_WAWebProtobufsWa6_proto_enumTypes[9] } func (x ClientPayload_UserAgent_Platform) Number() protoreflect.EnumNumber { @@ -730,34 +786,35 @@ type ClientPayload struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Username *uint64 `protobuf:"varint,1,opt,name=username" json:"username,omitempty"` - Passive *bool `protobuf:"varint,3,opt,name=passive" json:"passive,omitempty"` - UserAgent *ClientPayload_UserAgent `protobuf:"bytes,5,opt,name=userAgent" json:"userAgent,omitempty"` - WebInfo *ClientPayload_WebInfo `protobuf:"bytes,6,opt,name=webInfo" json:"webInfo,omitempty"` - PushName *string `protobuf:"bytes,7,opt,name=pushName" json:"pushName,omitempty"` - SessionID *int32 `protobuf:"fixed32,9,opt,name=sessionID" json:"sessionID,omitempty"` - ShortConnect *bool `protobuf:"varint,10,opt,name=shortConnect" json:"shortConnect,omitempty"` - ConnectType *ClientPayload_ConnectType `protobuf:"varint,12,opt,name=connectType,enum=WAWebProtobufsWa6.ClientPayload_ConnectType" json:"connectType,omitempty"` - ConnectReason *ClientPayload_ConnectReason `protobuf:"varint,13,opt,name=connectReason,enum=WAWebProtobufsWa6.ClientPayload_ConnectReason" json:"connectReason,omitempty"` - Shards []int32 `protobuf:"varint,14,rep,name=shards" json:"shards,omitempty"` - DnsSource *ClientPayload_DNSSource `protobuf:"bytes,15,opt,name=dnsSource" json:"dnsSource,omitempty"` - ConnectAttemptCount *uint32 `protobuf:"varint,16,opt,name=connectAttemptCount" json:"connectAttemptCount,omitempty"` - Device *uint32 `protobuf:"varint,18,opt,name=device" json:"device,omitempty"` - DevicePairingData *ClientPayload_DevicePairingRegistrationData `protobuf:"bytes,19,opt,name=devicePairingData" json:"devicePairingData,omitempty"` - Product *ClientPayload_Product `protobuf:"varint,20,opt,name=product,enum=WAWebProtobufsWa6.ClientPayload_Product" json:"product,omitempty"` - FbCat []byte `protobuf:"bytes,21,opt,name=fbCat" json:"fbCat,omitempty"` - FbUserAgent []byte `protobuf:"bytes,22,opt,name=fbUserAgent" json:"fbUserAgent,omitempty"` - Oc *bool `protobuf:"varint,23,opt,name=oc" json:"oc,omitempty"` - Lc *int32 `protobuf:"varint,24,opt,name=lc" json:"lc,omitempty"` - IosAppExtension *ClientPayload_IOSAppExtension `protobuf:"varint,30,opt,name=iosAppExtension,enum=WAWebProtobufsWa6.ClientPayload_IOSAppExtension" json:"iosAppExtension,omitempty"` - FbAppID *uint64 `protobuf:"varint,31,opt,name=fbAppID" json:"fbAppID,omitempty"` - FbDeviceID []byte `protobuf:"bytes,32,opt,name=fbDeviceID" json:"fbDeviceID,omitempty"` - Pull *bool `protobuf:"varint,33,opt,name=pull" json:"pull,omitempty"` - PaddingBytes []byte `protobuf:"bytes,34,opt,name=paddingBytes" json:"paddingBytes,omitempty"` - YearClass *int32 `protobuf:"varint,36,opt,name=yearClass" json:"yearClass,omitempty"` - MemClass *int32 `protobuf:"varint,37,opt,name=memClass" json:"memClass,omitempty"` - InteropData *ClientPayload_InteropData `protobuf:"bytes,38,opt,name=interopData" json:"interopData,omitempty"` - IsPcr *bool `protobuf:"varint,39,opt,name=isPcr" json:"isPcr,omitempty"` + Username *uint64 `protobuf:"varint,1,opt,name=username" json:"username,omitempty"` + Passive *bool `protobuf:"varint,3,opt,name=passive" json:"passive,omitempty"` + UserAgent *ClientPayload_UserAgent `protobuf:"bytes,5,opt,name=userAgent" json:"userAgent,omitempty"` + WebInfo *ClientPayload_WebInfo `protobuf:"bytes,6,opt,name=webInfo" json:"webInfo,omitempty"` + PushName *string `protobuf:"bytes,7,opt,name=pushName" json:"pushName,omitempty"` + SessionID *int32 `protobuf:"fixed32,9,opt,name=sessionID" json:"sessionID,omitempty"` + ShortConnect *bool `protobuf:"varint,10,opt,name=shortConnect" json:"shortConnect,omitempty"` + ConnectType *ClientPayload_ConnectType `protobuf:"varint,12,opt,name=connectType,enum=WAWebProtobufsWa6.ClientPayload_ConnectType" json:"connectType,omitempty"` + ConnectReason *ClientPayload_ConnectReason `protobuf:"varint,13,opt,name=connectReason,enum=WAWebProtobufsWa6.ClientPayload_ConnectReason" json:"connectReason,omitempty"` + Shards []int32 `protobuf:"varint,14,rep,name=shards" json:"shards,omitempty"` + DnsSource *ClientPayload_DNSSource `protobuf:"bytes,15,opt,name=dnsSource" json:"dnsSource,omitempty"` + ConnectAttemptCount *uint32 `protobuf:"varint,16,opt,name=connectAttemptCount" json:"connectAttemptCount,omitempty"` + Device *uint32 `protobuf:"varint,18,opt,name=device" json:"device,omitempty"` + DevicePairingData *ClientPayload_DevicePairingRegistrationData `protobuf:"bytes,19,opt,name=devicePairingData" json:"devicePairingData,omitempty"` + Product *ClientPayload_Product `protobuf:"varint,20,opt,name=product,enum=WAWebProtobufsWa6.ClientPayload_Product" json:"product,omitempty"` + FbCat []byte `protobuf:"bytes,21,opt,name=fbCat" json:"fbCat,omitempty"` + FbUserAgent []byte `protobuf:"bytes,22,opt,name=fbUserAgent" json:"fbUserAgent,omitempty"` + Oc *bool `protobuf:"varint,23,opt,name=oc" json:"oc,omitempty"` + Lc *int32 `protobuf:"varint,24,opt,name=lc" json:"lc,omitempty"` + IosAppExtension *ClientPayload_IOSAppExtension `protobuf:"varint,30,opt,name=iosAppExtension,enum=WAWebProtobufsWa6.ClientPayload_IOSAppExtension" json:"iosAppExtension,omitempty"` + FbAppID *uint64 `protobuf:"varint,31,opt,name=fbAppID" json:"fbAppID,omitempty"` + FbDeviceID []byte `protobuf:"bytes,32,opt,name=fbDeviceID" json:"fbDeviceID,omitempty"` + Pull *bool `protobuf:"varint,33,opt,name=pull" json:"pull,omitempty"` + PaddingBytes []byte `protobuf:"bytes,34,opt,name=paddingBytes" json:"paddingBytes,omitempty"` + YearClass *int32 `protobuf:"varint,36,opt,name=yearClass" json:"yearClass,omitempty"` + MemClass *int32 `protobuf:"varint,37,opt,name=memClass" json:"memClass,omitempty"` + InteropData *ClientPayload_InteropData `protobuf:"bytes,38,opt,name=interopData" json:"interopData,omitempty"` + IsPcr *bool `protobuf:"varint,39,opt,name=isPcr" json:"isPcr,omitempty"` + TrafficAnonymization *ClientPayload_TrafficAnonymization `protobuf:"varint,40,opt,name=trafficAnonymization,enum=WAWebProtobufsWa6.ClientPayload_TrafficAnonymization" json:"trafficAnonymization,omitempty"` } func (x *ClientPayload) Reset() { @@ -988,6 +1045,13 @@ func (x *ClientPayload) GetIsPcr() bool { return false } +func (x *ClientPayload) GetTrafficAnonymization() ClientPayload_TrafficAnonymization { + if x != nil && x.TrafficAnonymization != nil { + return *x.TrafficAnonymization + } + return ClientPayload_OFF +} + type HandshakeMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1349,8 +1413,9 @@ type ClientPayload_InteropData struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - AccountID *uint64 `protobuf:"varint,1,opt,name=accountID" json:"accountID,omitempty"` - Token []byte `protobuf:"bytes,2,opt,name=token" json:"token,omitempty"` + AccountID *uint64 `protobuf:"varint,1,opt,name=accountID" json:"accountID,omitempty"` + Token []byte `protobuf:"bytes,2,opt,name=token" json:"token,omitempty"` + EnableReadReceipts *bool `protobuf:"varint,3,opt,name=enableReadReceipts" json:"enableReadReceipts,omitempty"` } func (x *ClientPayload_InteropData) Reset() { @@ -1399,6 +1464,13 @@ func (x *ClientPayload_InteropData) GetToken() []byte { return nil } +func (x *ClientPayload_InteropData) GetEnableReadReceipts() bool { + if x != nil && x.EnableReadReceipts != nil { + return *x.EnableReadReceipts + } + return false +} + type ClientPayload_DevicePairingRegistrationData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1906,56 +1978,58 @@ func file_waWa6_WAWebProtobufsWa6_proto_rawDescGZIP() []byte { return file_waWa6_WAWebProtobufsWa6_proto_rawDescData } -var file_waWa6_WAWebProtobufsWa6_proto_enumTypes = make([]protoimpl.EnumInfo, 9) +var file_waWa6_WAWebProtobufsWa6_proto_enumTypes = make([]protoimpl.EnumInfo, 10) var file_waWa6_WAWebProtobufsWa6_proto_msgTypes = make([]protoimpl.MessageInfo, 12) -var file_waWa6_WAWebProtobufsWa6_proto_goTypes = []interface{}{ - (ClientPayload_Product)(0), // 0: WAWebProtobufsWa6.ClientPayload.Product - (ClientPayload_ConnectType)(0), // 1: WAWebProtobufsWa6.ClientPayload.ConnectType - (ClientPayload_ConnectReason)(0), // 2: WAWebProtobufsWa6.ClientPayload.ConnectReason - (ClientPayload_IOSAppExtension)(0), // 3: WAWebProtobufsWa6.ClientPayload.IOSAppExtension - (ClientPayload_DNSSource_DNSResolutionMethod)(0), // 4: WAWebProtobufsWa6.ClientPayload.DNSSource.DNSResolutionMethod - (ClientPayload_WebInfo_WebSubPlatform)(0), // 5: WAWebProtobufsWa6.ClientPayload.WebInfo.WebSubPlatform - (ClientPayload_UserAgent_DeviceType)(0), // 6: WAWebProtobufsWa6.ClientPayload.UserAgent.DeviceType - (ClientPayload_UserAgent_ReleaseChannel)(0), // 7: WAWebProtobufsWa6.ClientPayload.UserAgent.ReleaseChannel - (ClientPayload_UserAgent_Platform)(0), // 8: WAWebProtobufsWa6.ClientPayload.UserAgent.Platform - (*ClientPayload)(nil), // 9: WAWebProtobufsWa6.ClientPayload - (*HandshakeMessage)(nil), // 10: WAWebProtobufsWa6.HandshakeMessage - (*ClientPayload_DNSSource)(nil), // 11: WAWebProtobufsWa6.ClientPayload.DNSSource - (*ClientPayload_WebInfo)(nil), // 12: WAWebProtobufsWa6.ClientPayload.WebInfo - (*ClientPayload_UserAgent)(nil), // 13: WAWebProtobufsWa6.ClientPayload.UserAgent - (*ClientPayload_InteropData)(nil), // 14: WAWebProtobufsWa6.ClientPayload.InteropData - (*ClientPayload_DevicePairingRegistrationData)(nil), // 15: WAWebProtobufsWa6.ClientPayload.DevicePairingRegistrationData - (*ClientPayload_WebInfo_WebdPayload)(nil), // 16: WAWebProtobufsWa6.ClientPayload.WebInfo.WebdPayload - (*ClientPayload_UserAgent_AppVersion)(nil), // 17: WAWebProtobufsWa6.ClientPayload.UserAgent.AppVersion - (*HandshakeMessage_ClientFinish)(nil), // 18: WAWebProtobufsWa6.HandshakeMessage.ClientFinish - (*HandshakeMessage_ServerHello)(nil), // 19: WAWebProtobufsWa6.HandshakeMessage.ServerHello - (*HandshakeMessage_ClientHello)(nil), // 20: WAWebProtobufsWa6.HandshakeMessage.ClientHello +var file_waWa6_WAWebProtobufsWa6_proto_goTypes = []any{ + (ClientPayload_TrafficAnonymization)(0), // 0: WAWebProtobufsWa6.ClientPayload.TrafficAnonymization + (ClientPayload_Product)(0), // 1: WAWebProtobufsWa6.ClientPayload.Product + (ClientPayload_ConnectType)(0), // 2: WAWebProtobufsWa6.ClientPayload.ConnectType + (ClientPayload_ConnectReason)(0), // 3: WAWebProtobufsWa6.ClientPayload.ConnectReason + (ClientPayload_IOSAppExtension)(0), // 4: WAWebProtobufsWa6.ClientPayload.IOSAppExtension + (ClientPayload_DNSSource_DNSResolutionMethod)(0), // 5: WAWebProtobufsWa6.ClientPayload.DNSSource.DNSResolutionMethod + (ClientPayload_WebInfo_WebSubPlatform)(0), // 6: WAWebProtobufsWa6.ClientPayload.WebInfo.WebSubPlatform + (ClientPayload_UserAgent_DeviceType)(0), // 7: WAWebProtobufsWa6.ClientPayload.UserAgent.DeviceType + (ClientPayload_UserAgent_ReleaseChannel)(0), // 8: WAWebProtobufsWa6.ClientPayload.UserAgent.ReleaseChannel + (ClientPayload_UserAgent_Platform)(0), // 9: WAWebProtobufsWa6.ClientPayload.UserAgent.Platform + (*ClientPayload)(nil), // 10: WAWebProtobufsWa6.ClientPayload + (*HandshakeMessage)(nil), // 11: WAWebProtobufsWa6.HandshakeMessage + (*ClientPayload_DNSSource)(nil), // 12: WAWebProtobufsWa6.ClientPayload.DNSSource + (*ClientPayload_WebInfo)(nil), // 13: WAWebProtobufsWa6.ClientPayload.WebInfo + (*ClientPayload_UserAgent)(nil), // 14: WAWebProtobufsWa6.ClientPayload.UserAgent + (*ClientPayload_InteropData)(nil), // 15: WAWebProtobufsWa6.ClientPayload.InteropData + (*ClientPayload_DevicePairingRegistrationData)(nil), // 16: WAWebProtobufsWa6.ClientPayload.DevicePairingRegistrationData + (*ClientPayload_WebInfo_WebdPayload)(nil), // 17: WAWebProtobufsWa6.ClientPayload.WebInfo.WebdPayload + (*ClientPayload_UserAgent_AppVersion)(nil), // 18: WAWebProtobufsWa6.ClientPayload.UserAgent.AppVersion + (*HandshakeMessage_ClientFinish)(nil), // 19: WAWebProtobufsWa6.HandshakeMessage.ClientFinish + (*HandshakeMessage_ServerHello)(nil), // 20: WAWebProtobufsWa6.HandshakeMessage.ServerHello + (*HandshakeMessage_ClientHello)(nil), // 21: WAWebProtobufsWa6.HandshakeMessage.ClientHello } var file_waWa6_WAWebProtobufsWa6_proto_depIdxs = []int32{ - 13, // 0: WAWebProtobufsWa6.ClientPayload.userAgent:type_name -> WAWebProtobufsWa6.ClientPayload.UserAgent - 12, // 1: WAWebProtobufsWa6.ClientPayload.webInfo:type_name -> WAWebProtobufsWa6.ClientPayload.WebInfo - 1, // 2: WAWebProtobufsWa6.ClientPayload.connectType:type_name -> WAWebProtobufsWa6.ClientPayload.ConnectType - 2, // 3: WAWebProtobufsWa6.ClientPayload.connectReason:type_name -> WAWebProtobufsWa6.ClientPayload.ConnectReason - 11, // 4: WAWebProtobufsWa6.ClientPayload.dnsSource:type_name -> WAWebProtobufsWa6.ClientPayload.DNSSource - 15, // 5: WAWebProtobufsWa6.ClientPayload.devicePairingData:type_name -> WAWebProtobufsWa6.ClientPayload.DevicePairingRegistrationData - 0, // 6: WAWebProtobufsWa6.ClientPayload.product:type_name -> WAWebProtobufsWa6.ClientPayload.Product - 3, // 7: WAWebProtobufsWa6.ClientPayload.iosAppExtension:type_name -> WAWebProtobufsWa6.ClientPayload.IOSAppExtension - 14, // 8: WAWebProtobufsWa6.ClientPayload.interopData:type_name -> WAWebProtobufsWa6.ClientPayload.InteropData - 20, // 9: WAWebProtobufsWa6.HandshakeMessage.clientHello:type_name -> WAWebProtobufsWa6.HandshakeMessage.ClientHello - 19, // 10: WAWebProtobufsWa6.HandshakeMessage.serverHello:type_name -> WAWebProtobufsWa6.HandshakeMessage.ServerHello - 18, // 11: WAWebProtobufsWa6.HandshakeMessage.clientFinish:type_name -> WAWebProtobufsWa6.HandshakeMessage.ClientFinish - 4, // 12: WAWebProtobufsWa6.ClientPayload.DNSSource.dnsMethod:type_name -> WAWebProtobufsWa6.ClientPayload.DNSSource.DNSResolutionMethod - 16, // 13: WAWebProtobufsWa6.ClientPayload.WebInfo.webdPayload:type_name -> WAWebProtobufsWa6.ClientPayload.WebInfo.WebdPayload - 5, // 14: WAWebProtobufsWa6.ClientPayload.WebInfo.webSubPlatform:type_name -> WAWebProtobufsWa6.ClientPayload.WebInfo.WebSubPlatform - 8, // 15: WAWebProtobufsWa6.ClientPayload.UserAgent.platform:type_name -> WAWebProtobufsWa6.ClientPayload.UserAgent.Platform - 17, // 16: WAWebProtobufsWa6.ClientPayload.UserAgent.appVersion:type_name -> WAWebProtobufsWa6.ClientPayload.UserAgent.AppVersion - 7, // 17: WAWebProtobufsWa6.ClientPayload.UserAgent.releaseChannel:type_name -> WAWebProtobufsWa6.ClientPayload.UserAgent.ReleaseChannel - 6, // 18: WAWebProtobufsWa6.ClientPayload.UserAgent.deviceType:type_name -> WAWebProtobufsWa6.ClientPayload.UserAgent.DeviceType - 19, // [19:19] is the sub-list for method output_type - 19, // [19:19] is the sub-list for method input_type - 19, // [19:19] is the sub-list for extension type_name - 19, // [19:19] is the sub-list for extension extendee - 0, // [0:19] is the sub-list for field type_name + 14, // 0: WAWebProtobufsWa6.ClientPayload.userAgent:type_name -> WAWebProtobufsWa6.ClientPayload.UserAgent + 13, // 1: WAWebProtobufsWa6.ClientPayload.webInfo:type_name -> WAWebProtobufsWa6.ClientPayload.WebInfo + 2, // 2: WAWebProtobufsWa6.ClientPayload.connectType:type_name -> WAWebProtobufsWa6.ClientPayload.ConnectType + 3, // 3: WAWebProtobufsWa6.ClientPayload.connectReason:type_name -> WAWebProtobufsWa6.ClientPayload.ConnectReason + 12, // 4: WAWebProtobufsWa6.ClientPayload.dnsSource:type_name -> WAWebProtobufsWa6.ClientPayload.DNSSource + 16, // 5: WAWebProtobufsWa6.ClientPayload.devicePairingData:type_name -> WAWebProtobufsWa6.ClientPayload.DevicePairingRegistrationData + 1, // 6: WAWebProtobufsWa6.ClientPayload.product:type_name -> WAWebProtobufsWa6.ClientPayload.Product + 4, // 7: WAWebProtobufsWa6.ClientPayload.iosAppExtension:type_name -> WAWebProtobufsWa6.ClientPayload.IOSAppExtension + 15, // 8: WAWebProtobufsWa6.ClientPayload.interopData:type_name -> WAWebProtobufsWa6.ClientPayload.InteropData + 0, // 9: WAWebProtobufsWa6.ClientPayload.trafficAnonymization:type_name -> WAWebProtobufsWa6.ClientPayload.TrafficAnonymization + 21, // 10: WAWebProtobufsWa6.HandshakeMessage.clientHello:type_name -> WAWebProtobufsWa6.HandshakeMessage.ClientHello + 20, // 11: WAWebProtobufsWa6.HandshakeMessage.serverHello:type_name -> WAWebProtobufsWa6.HandshakeMessage.ServerHello + 19, // 12: WAWebProtobufsWa6.HandshakeMessage.clientFinish:type_name -> WAWebProtobufsWa6.HandshakeMessage.ClientFinish + 5, // 13: WAWebProtobufsWa6.ClientPayload.DNSSource.dnsMethod:type_name -> WAWebProtobufsWa6.ClientPayload.DNSSource.DNSResolutionMethod + 17, // 14: WAWebProtobufsWa6.ClientPayload.WebInfo.webdPayload:type_name -> WAWebProtobufsWa6.ClientPayload.WebInfo.WebdPayload + 6, // 15: WAWebProtobufsWa6.ClientPayload.WebInfo.webSubPlatform:type_name -> WAWebProtobufsWa6.ClientPayload.WebInfo.WebSubPlatform + 9, // 16: WAWebProtobufsWa6.ClientPayload.UserAgent.platform:type_name -> WAWebProtobufsWa6.ClientPayload.UserAgent.Platform + 18, // 17: WAWebProtobufsWa6.ClientPayload.UserAgent.appVersion:type_name -> WAWebProtobufsWa6.ClientPayload.UserAgent.AppVersion + 8, // 18: WAWebProtobufsWa6.ClientPayload.UserAgent.releaseChannel:type_name -> WAWebProtobufsWa6.ClientPayload.UserAgent.ReleaseChannel + 7, // 19: WAWebProtobufsWa6.ClientPayload.UserAgent.deviceType:type_name -> WAWebProtobufsWa6.ClientPayload.UserAgent.DeviceType + 20, // [20:20] is the sub-list for method output_type + 20, // [20:20] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name } func init() { file_waWa6_WAWebProtobufsWa6_proto_init() } @@ -1964,7 +2038,7 @@ func file_waWa6_WAWebProtobufsWa6_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waWa6_WAWebProtobufsWa6_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waWa6_WAWebProtobufsWa6_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*ClientPayload); i { case 0: return &v.state @@ -1976,7 +2050,7 @@ func file_waWa6_WAWebProtobufsWa6_proto_init() { return nil } } - file_waWa6_WAWebProtobufsWa6_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waWa6_WAWebProtobufsWa6_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*HandshakeMessage); i { case 0: return &v.state @@ -1988,7 +2062,7 @@ func file_waWa6_WAWebProtobufsWa6_proto_init() { return nil } } - file_waWa6_WAWebProtobufsWa6_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waWa6_WAWebProtobufsWa6_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*ClientPayload_DNSSource); i { case 0: return &v.state @@ -2000,7 +2074,7 @@ func file_waWa6_WAWebProtobufsWa6_proto_init() { return nil } } - file_waWa6_WAWebProtobufsWa6_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waWa6_WAWebProtobufsWa6_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*ClientPayload_WebInfo); i { case 0: return &v.state @@ -2012,7 +2086,7 @@ func file_waWa6_WAWebProtobufsWa6_proto_init() { return nil } } - file_waWa6_WAWebProtobufsWa6_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_waWa6_WAWebProtobufsWa6_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*ClientPayload_UserAgent); i { case 0: return &v.state @@ -2024,7 +2098,7 @@ func file_waWa6_WAWebProtobufsWa6_proto_init() { return nil } } - file_waWa6_WAWebProtobufsWa6_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_waWa6_WAWebProtobufsWa6_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*ClientPayload_InteropData); i { case 0: return &v.state @@ -2036,7 +2110,7 @@ func file_waWa6_WAWebProtobufsWa6_proto_init() { return nil } } - file_waWa6_WAWebProtobufsWa6_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_waWa6_WAWebProtobufsWa6_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*ClientPayload_DevicePairingRegistrationData); i { case 0: return &v.state @@ -2048,7 +2122,7 @@ func file_waWa6_WAWebProtobufsWa6_proto_init() { return nil } } - file_waWa6_WAWebProtobufsWa6_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_waWa6_WAWebProtobufsWa6_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*ClientPayload_WebInfo_WebdPayload); i { case 0: return &v.state @@ -2060,7 +2134,7 @@ func file_waWa6_WAWebProtobufsWa6_proto_init() { return nil } } - file_waWa6_WAWebProtobufsWa6_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_waWa6_WAWebProtobufsWa6_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*ClientPayload_UserAgent_AppVersion); i { case 0: return &v.state @@ -2072,7 +2146,7 @@ func file_waWa6_WAWebProtobufsWa6_proto_init() { return nil } } - file_waWa6_WAWebProtobufsWa6_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_waWa6_WAWebProtobufsWa6_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*HandshakeMessage_ClientFinish); i { case 0: return &v.state @@ -2084,7 +2158,7 @@ func file_waWa6_WAWebProtobufsWa6_proto_init() { return nil } } - file_waWa6_WAWebProtobufsWa6_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_waWa6_WAWebProtobufsWa6_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*HandshakeMessage_ServerHello); i { case 0: return &v.state @@ -2096,7 +2170,7 @@ func file_waWa6_WAWebProtobufsWa6_proto_init() { return nil } } - file_waWa6_WAWebProtobufsWa6_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_waWa6_WAWebProtobufsWa6_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*HandshakeMessage_ClientHello); i { case 0: return &v.state @@ -2114,7 +2188,7 @@ func file_waWa6_WAWebProtobufsWa6_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_waWa6_WAWebProtobufsWa6_proto_rawDesc, - NumEnums: 9, + NumEnums: 10, NumMessages: 12, NumExtensions: 0, NumServices: 0, diff --git a/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.raw b/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.raw index 322a7d4f..96b4ca81 100644 Binary files a/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.raw and b/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.raw differ diff --git a/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.proto b/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.proto index 568c3cf8..77879247 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.proto +++ b/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.proto @@ -3,6 +3,11 @@ package WAWebProtobufsWa6; option go_package = "go.mau.fi/whatsmeow/proto/waWa6"; message ClientPayload { + enum TrafficAnonymization { + OFF = 0; + STANDARD = 1; + } + enum Product { WHATSAPP = 0; MESSENGER = 1; @@ -170,6 +175,7 @@ message ClientPayload { message InteropData { optional uint64 accountID = 1; optional bytes token = 2; + optional bool enableReadReceipts = 3; } message DevicePairingRegistrationData { @@ -211,6 +217,7 @@ message ClientPayload { optional int32 memClass = 37; optional InteropData interopData = 38; optional bool isPcr = 39; + optional TrafficAnonymization trafficAnonymization = 40; } message HandshakeMessage { diff --git a/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.go b/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.go index 48912456..cfc7d810 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.go +++ b/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: waWeb/WAWebProtobufsWeb.proto @@ -298,6 +298,9 @@ const ( WebMessageInfo_EVENT_UPDATED WebMessageInfo_StubType = 205 WebMessageInfo_EVENT_CANCELED WebMessageInfo_StubType = 206 WebMessageInfo_COMMUNITY_OWNER_UPDATED WebMessageInfo_StubType = 207 + WebMessageInfo_COMMUNITY_SUB_GROUP_VISIBILITY_HIDDEN WebMessageInfo_StubType = 208 + WebMessageInfo_CAPI_GROUP_NE2EE_SYSTEM_MESSAGE WebMessageInfo_StubType = 209 + WebMessageInfo_STATUS_MENTION WebMessageInfo_StubType = 210 ) // Enum value maps for WebMessageInfo_StubType. @@ -511,6 +514,9 @@ var ( 205: "EVENT_UPDATED", 206: "EVENT_CANCELED", 207: "COMMUNITY_OWNER_UPDATED", + 208: "COMMUNITY_SUB_GROUP_VISIBILITY_HIDDEN", + 209: "CAPI_GROUP_NE2EE_SYSTEM_MESSAGE", + 210: "STATUS_MENTION", } WebMessageInfo_StubType_value = map[string]int32{ "UNKNOWN": 0, @@ -721,6 +727,9 @@ var ( "EVENT_UPDATED": 205, "EVENT_CANCELED": 206, "COMMUNITY_OWNER_UPDATED": 207, + "COMMUNITY_SUB_GROUP_VISIBILITY_HIDDEN": 208, + "CAPI_GROUP_NE2EE_SYSTEM_MESSAGE": 209, + "STATUS_MENTION": 210, } ) @@ -1365,6 +1374,7 @@ type WebMessageInfo struct { StatusMentions []string `protobuf:"bytes,66,rep,name=statusMentions" json:"statusMentions,omitempty"` TargetMessageID *waCommon.MessageKey `protobuf:"bytes,67,opt,name=targetMessageID" json:"targetMessageID,omitempty"` MessageAddOns []*MessageAddOn `protobuf:"bytes,68,rep,name=messageAddOns" json:"messageAddOns,omitempty"` + StatusMentionMessageInfo *StatusMentionMessage `protobuf:"bytes,69,opt,name=statusMentionMessageInfo" json:"statusMentionMessageInfo,omitempty"` } func (x *WebMessageInfo) Reset() { @@ -1798,6 +1808,13 @@ func (x *WebMessageInfo) GetMessageAddOns() []*MessageAddOn { return nil } +func (x *WebMessageInfo) GetStatusMentionMessageInfo() *StatusMentionMessage { + if x != nil { + return x.StatusMentionMessageInfo + } + return nil +} + type PaymentInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2430,6 +2447,8 @@ type MessageAddOn struct { ServerTimestampMS *int64 `protobuf:"varint,4,opt,name=serverTimestampMS" json:"serverTimestampMS,omitempty"` Status *WebMessageInfo_Status `protobuf:"varint,5,opt,name=status,enum=WAWebProtobufsWeb.WebMessageInfo_Status" json:"status,omitempty"` AddOnContextInfo *MessageAddOnContextInfo `protobuf:"bytes,6,opt,name=addOnContextInfo" json:"addOnContextInfo,omitempty"` + MessageAddOnKey *waCommon.MessageKey `protobuf:"bytes,7,opt,name=messageAddOnKey" json:"messageAddOnKey,omitempty"` + LegacyMessage *LegacyMessage `protobuf:"bytes,8,opt,name=legacyMessage" json:"legacyMessage,omitempty"` } func (x *MessageAddOn) Reset() { @@ -2506,6 +2525,20 @@ func (x *MessageAddOn) GetAddOnContextInfo() *MessageAddOnContextInfo { return nil } +func (x *MessageAddOn) GetMessageAddOnKey() *waCommon.MessageKey { + if x != nil { + return x.MessageAddOnKey + } + return nil +} + +func (x *MessageAddOn) GetLegacyMessage() *LegacyMessage { + if x != nil { + return x.LegacyMessage + } + return nil +} + type CommentMetadata struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3514,6 +3547,108 @@ func (x *EventResponse) GetUnread() bool { return false } +type LegacyMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + EventResponseMessage *waE2E.EventResponseMessage `protobuf:"bytes,1,opt,name=eventResponseMessage" json:"eventResponseMessage,omitempty"` + PollVote *waE2E.PollVoteMessage `protobuf:"bytes,2,opt,name=pollVote" json:"pollVote,omitempty"` +} + +func (x *LegacyMessage) Reset() { + *x = LegacyMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_waWeb_WAWebProtobufsWeb_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LegacyMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LegacyMessage) ProtoMessage() {} + +func (x *LegacyMessage) ProtoReflect() protoreflect.Message { + mi := &file_waWeb_WAWebProtobufsWeb_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LegacyMessage.ProtoReflect.Descriptor instead. +func (*LegacyMessage) Descriptor() ([]byte, []int) { + return file_waWeb_WAWebProtobufsWeb_proto_rawDescGZIP(), []int{21} +} + +func (x *LegacyMessage) GetEventResponseMessage() *waE2E.EventResponseMessage { + if x != nil { + return x.EventResponseMessage + } + return nil +} + +func (x *LegacyMessage) GetPollVote() *waE2E.PollVoteMessage { + if x != nil { + return x.PollVote + } + return nil +} + +type StatusMentionMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + QuotedStatus *waE2E.Message `protobuf:"bytes,1,opt,name=quotedStatus" json:"quotedStatus,omitempty"` +} + +func (x *StatusMentionMessage) Reset() { + *x = StatusMentionMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_waWeb_WAWebProtobufsWeb_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatusMentionMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatusMentionMessage) ProtoMessage() {} + +func (x *StatusMentionMessage) ProtoReflect() protoreflect.Message { + mi := &file_waWeb_WAWebProtobufsWeb_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatusMentionMessage.ProtoReflect.Descriptor instead. +func (*StatusMentionMessage) Descriptor() ([]byte, []int) { + return file_waWeb_WAWebProtobufsWeb_proto_rawDescGZIP(), []int{22} +} + +func (x *StatusMentionMessage) GetQuotedStatus() *waE2E.Message { + if x != nil { + return x.QuotedStatus + } + return nil +} + var File_waWeb_WAWebProtobufsWeb_proto protoreflect.FileDescriptor //go:embed WAWebProtobufsWeb.pb.raw @@ -3532,8 +3667,8 @@ func file_waWeb_WAWebProtobufsWeb_proto_rawDescGZIP() []byte { } var file_waWeb_WAWebProtobufsWeb_proto_enumTypes = make([]protoimpl.EnumInfo, 9) -var file_waWeb_WAWebProtobufsWeb_proto_msgTypes = make([]protoimpl.MessageInfo, 21) -var file_waWeb_WAWebProtobufsWeb_proto_goTypes = []interface{}{ +var file_waWeb_WAWebProtobufsWeb_proto_msgTypes = make([]protoimpl.MessageInfo, 23) +var file_waWeb_WAWebProtobufsWeb_proto_goTypes = []any{ (WebMessageInfo_BizPrivacyStatus)(0), // 0: WAWebProtobufsWeb.WebMessageInfo.BizPrivacyStatus (WebMessageInfo_StubType)(0), // 1: WAWebProtobufsWeb.WebMessageInfo.StubType (WebMessageInfo_Status)(0), // 2: WAWebProtobufsWeb.WebMessageInfo.Status @@ -3564,116 +3699,124 @@ var file_waWeb_WAWebProtobufsWeb_proto_goTypes = []interface{}{ (*MessageAddOnContextInfo)(nil), // 27: WAWebProtobufsWeb.MessageAddOnContextInfo (*PremiumMessageInfo)(nil), // 28: WAWebProtobufsWeb.PremiumMessageInfo (*EventResponse)(nil), // 29: WAWebProtobufsWeb.EventResponse - (*waCommon.MessageKey)(nil), // 30: WACommon.MessageKey - (*waE2E.Message)(nil), // 31: WAWebProtobufsE2E.Message - (*waE2E.LiveLocationMessage)(nil), // 32: WAWebProtobufsE2E.LiveLocationMessage - (*waE2E.Money)(nil), // 33: WAWebProtobufsE2E.Money - (*waE2E.PollVoteMessage)(nil), // 34: WAWebProtobufsE2E.PollVoteMessage - (waE2E.KeepType)(0), // 35: WAWebProtobufsE2E.KeepType - (waE2E.MessageContextInfo_MessageAddonExpiryType)(0), // 36: WAWebProtobufsE2E.MessageContextInfo.MessageAddonExpiryType - (*waE2E.EventResponseMessage)(nil), // 37: WAWebProtobufsE2E.EventResponseMessage + (*LegacyMessage)(nil), // 30: WAWebProtobufsWeb.LegacyMessage + (*StatusMentionMessage)(nil), // 31: WAWebProtobufsWeb.StatusMentionMessage + (*waCommon.MessageKey)(nil), // 32: WACommon.MessageKey + (*waE2E.Message)(nil), // 33: WAWebProtobufsE2E.Message + (*waE2E.LiveLocationMessage)(nil), // 34: WAWebProtobufsE2E.LiveLocationMessage + (*waE2E.Money)(nil), // 35: WAWebProtobufsE2E.Money + (*waE2E.PollVoteMessage)(nil), // 36: WAWebProtobufsE2E.PollVoteMessage + (waE2E.KeepType)(0), // 37: WAWebProtobufsE2E.KeepType + (waE2E.MessageContextInfo_MessageAddonExpiryType)(0), // 38: WAWebProtobufsE2E.MessageContextInfo.MessageAddonExpiryType + (*waE2E.EventResponseMessage)(nil), // 39: WAWebProtobufsE2E.EventResponseMessage } var file_waWeb_WAWebProtobufsWeb_proto_depIdxs = []int32{ - 30, // 0: WAWebProtobufsWeb.WebMessageInfo.key:type_name -> WACommon.MessageKey - 31, // 1: WAWebProtobufsWeb.WebMessageInfo.message:type_name -> WAWebProtobufsE2E.Message - 2, // 2: WAWebProtobufsWeb.WebMessageInfo.status:type_name -> WAWebProtobufsWeb.WebMessageInfo.Status - 1, // 3: WAWebProtobufsWeb.WebMessageInfo.messageStubType:type_name -> WAWebProtobufsWeb.WebMessageInfo.StubType - 10, // 4: WAWebProtobufsWeb.WebMessageInfo.paymentInfo:type_name -> WAWebProtobufsWeb.PaymentInfo - 32, // 5: WAWebProtobufsWeb.WebMessageInfo.finalLiveLocation:type_name -> WAWebProtobufsE2E.LiveLocationMessage - 10, // 6: WAWebProtobufsWeb.WebMessageInfo.quotedPaymentInfo:type_name -> WAWebProtobufsWeb.PaymentInfo - 0, // 7: WAWebProtobufsWeb.WebMessageInfo.bizPrivacyStatus:type_name -> WAWebProtobufsWeb.WebMessageInfo.BizPrivacyStatus - 18, // 8: WAWebProtobufsWeb.WebMessageInfo.mediaData:type_name -> WAWebProtobufsWeb.MediaData - 19, // 9: WAWebProtobufsWeb.WebMessageInfo.photoChange:type_name -> WAWebProtobufsWeb.PhotoChange - 21, // 10: WAWebProtobufsWeb.WebMessageInfo.userReceipt:type_name -> WAWebProtobufsWeb.UserReceipt - 22, // 11: WAWebProtobufsWeb.WebMessageInfo.reactions:type_name -> WAWebProtobufsWeb.Reaction - 18, // 12: WAWebProtobufsWeb.WebMessageInfo.quotedStickerData:type_name -> WAWebProtobufsWeb.MediaData - 20, // 13: WAWebProtobufsWeb.WebMessageInfo.statusPsa:type_name -> WAWebProtobufsWeb.StatusPSA - 23, // 14: WAWebProtobufsWeb.WebMessageInfo.pollUpdates:type_name -> WAWebProtobufsWeb.PollUpdate - 24, // 15: WAWebProtobufsWeb.WebMessageInfo.pollAdditionalMetadata:type_name -> WAWebProtobufsWeb.PollAdditionalMetadata - 26, // 16: WAWebProtobufsWeb.WebMessageInfo.keepInChat:type_name -> WAWebProtobufsWeb.KeepInChat - 12, // 17: WAWebProtobufsWeb.WebMessageInfo.pinInChat:type_name -> WAWebProtobufsWeb.PinInChat - 28, // 18: WAWebProtobufsWeb.WebMessageInfo.premiumMessageInfo:type_name -> WAWebProtobufsWeb.PremiumMessageInfo - 14, // 19: WAWebProtobufsWeb.WebMessageInfo.commentMetadata:type_name -> WAWebProtobufsWeb.CommentMetadata - 29, // 20: WAWebProtobufsWeb.WebMessageInfo.eventResponses:type_name -> WAWebProtobufsWeb.EventResponse - 17, // 21: WAWebProtobufsWeb.WebMessageInfo.reportingTokenInfo:type_name -> WAWebProtobufsWeb.ReportingTokenInfo - 25, // 22: WAWebProtobufsWeb.WebMessageInfo.eventAdditionalMetadata:type_name -> WAWebProtobufsWeb.EventAdditionalMetadata - 30, // 23: WAWebProtobufsWeb.WebMessageInfo.targetMessageID:type_name -> WACommon.MessageKey - 13, // 24: WAWebProtobufsWeb.WebMessageInfo.messageAddOns:type_name -> WAWebProtobufsWeb.MessageAddOn - 5, // 25: WAWebProtobufsWeb.PaymentInfo.currencyDeprecated:type_name -> WAWebProtobufsWeb.PaymentInfo.Currency - 4, // 26: WAWebProtobufsWeb.PaymentInfo.status:type_name -> WAWebProtobufsWeb.PaymentInfo.Status - 30, // 27: WAWebProtobufsWeb.PaymentInfo.requestMessageKey:type_name -> WACommon.MessageKey - 3, // 28: WAWebProtobufsWeb.PaymentInfo.txnStatus:type_name -> WAWebProtobufsWeb.PaymentInfo.TxnStatus - 33, // 29: WAWebProtobufsWeb.PaymentInfo.primaryAmount:type_name -> WAWebProtobufsE2E.Money - 33, // 30: WAWebProtobufsWeb.PaymentInfo.exchangeAmount:type_name -> WAWebProtobufsE2E.Money - 6, // 31: WAWebProtobufsWeb.WebFeatures.labelsDisplay:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 32: WAWebProtobufsWeb.WebFeatures.voipIndividualOutgoing:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 33: WAWebProtobufsWeb.WebFeatures.groupsV3:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 34: WAWebProtobufsWeb.WebFeatures.groupsV3Create:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 35: WAWebProtobufsWeb.WebFeatures.changeNumberV2:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 36: WAWebProtobufsWeb.WebFeatures.queryStatusV3Thumbnail:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 37: WAWebProtobufsWeb.WebFeatures.liveLocations:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 38: WAWebProtobufsWeb.WebFeatures.queryVname:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 39: WAWebProtobufsWeb.WebFeatures.voipIndividualIncoming:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 40: WAWebProtobufsWeb.WebFeatures.quickRepliesQuery:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 41: WAWebProtobufsWeb.WebFeatures.payments:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 42: WAWebProtobufsWeb.WebFeatures.stickerPackQuery:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 43: WAWebProtobufsWeb.WebFeatures.liveLocationsFinal:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 44: WAWebProtobufsWeb.WebFeatures.labelsEdit:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 45: WAWebProtobufsWeb.WebFeatures.mediaUpload:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 46: WAWebProtobufsWeb.WebFeatures.mediaUploadRichQuickReplies:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 47: WAWebProtobufsWeb.WebFeatures.vnameV2:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 48: WAWebProtobufsWeb.WebFeatures.videoPlaybackURL:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 49: WAWebProtobufsWeb.WebFeatures.statusRanking:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 50: WAWebProtobufsWeb.WebFeatures.voipIndividualVideo:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 51: WAWebProtobufsWeb.WebFeatures.thirdPartyStickers:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 52: WAWebProtobufsWeb.WebFeatures.frequentlyForwardedSetting:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 53: WAWebProtobufsWeb.WebFeatures.groupsV4JoinPermission:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 54: WAWebProtobufsWeb.WebFeatures.recentStickers:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 55: WAWebProtobufsWeb.WebFeatures.catalog:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 56: WAWebProtobufsWeb.WebFeatures.starredStickers:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 57: WAWebProtobufsWeb.WebFeatures.voipGroupCall:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 58: WAWebProtobufsWeb.WebFeatures.templateMessage:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 59: WAWebProtobufsWeb.WebFeatures.templateMessageInteractivity:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 60: WAWebProtobufsWeb.WebFeatures.ephemeralMessages:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 61: WAWebProtobufsWeb.WebFeatures.e2ENotificationSync:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 62: WAWebProtobufsWeb.WebFeatures.recentStickersV2:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 63: WAWebProtobufsWeb.WebFeatures.recentStickersV3:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 64: WAWebProtobufsWeb.WebFeatures.userNotice:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 65: WAWebProtobufsWeb.WebFeatures.support:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 66: WAWebProtobufsWeb.WebFeatures.groupUiiCleanup:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 67: WAWebProtobufsWeb.WebFeatures.groupDogfoodingInternalOnly:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 68: WAWebProtobufsWeb.WebFeatures.settingsSync:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 69: WAWebProtobufsWeb.WebFeatures.archiveV2:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 70: WAWebProtobufsWeb.WebFeatures.ephemeralAllowGroupMembers:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 71: WAWebProtobufsWeb.WebFeatures.ephemeral24HDuration:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 72: WAWebProtobufsWeb.WebFeatures.mdForceUpgrade:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 73: WAWebProtobufsWeb.WebFeatures.disappearingMode:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 74: WAWebProtobufsWeb.WebFeatures.externalMdOptInAvailable:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 6, // 75: WAWebProtobufsWeb.WebFeatures.noDeleteMessageTimeLimit:type_name -> WAWebProtobufsWeb.WebFeatures.Flag - 7, // 76: WAWebProtobufsWeb.PinInChat.type:type_name -> WAWebProtobufsWeb.PinInChat.Type - 30, // 77: WAWebProtobufsWeb.PinInChat.key:type_name -> WACommon.MessageKey - 27, // 78: WAWebProtobufsWeb.PinInChat.messageAddOnContextInfo:type_name -> WAWebProtobufsWeb.MessageAddOnContextInfo - 8, // 79: WAWebProtobufsWeb.MessageAddOn.messageAddOnType:type_name -> WAWebProtobufsWeb.MessageAddOn.MessageAddOnType - 31, // 80: WAWebProtobufsWeb.MessageAddOn.messageAddOn:type_name -> WAWebProtobufsE2E.Message - 2, // 81: WAWebProtobufsWeb.MessageAddOn.status:type_name -> WAWebProtobufsWeb.WebMessageInfo.Status - 27, // 82: WAWebProtobufsWeb.MessageAddOn.addOnContextInfo:type_name -> WAWebProtobufsWeb.MessageAddOnContextInfo - 30, // 83: WAWebProtobufsWeb.CommentMetadata.commentParentKey:type_name -> WACommon.MessageKey - 9, // 84: WAWebProtobufsWeb.WebNotificationsInfo.notifyMessages:type_name -> WAWebProtobufsWeb.WebMessageInfo - 30, // 85: WAWebProtobufsWeb.NotificationMessageInfo.key:type_name -> WACommon.MessageKey - 31, // 86: WAWebProtobufsWeb.NotificationMessageInfo.message:type_name -> WAWebProtobufsE2E.Message - 30, // 87: WAWebProtobufsWeb.Reaction.key:type_name -> WACommon.MessageKey - 30, // 88: WAWebProtobufsWeb.PollUpdate.pollUpdateMessageKey:type_name -> WACommon.MessageKey - 34, // 89: WAWebProtobufsWeb.PollUpdate.vote:type_name -> WAWebProtobufsE2E.PollVoteMessage - 35, // 90: WAWebProtobufsWeb.KeepInChat.keepType:type_name -> WAWebProtobufsE2E.KeepType - 30, // 91: WAWebProtobufsWeb.KeepInChat.key:type_name -> WACommon.MessageKey - 36, // 92: WAWebProtobufsWeb.MessageAddOnContextInfo.messageAddOnExpiryType:type_name -> WAWebProtobufsE2E.MessageContextInfo.MessageAddonExpiryType - 30, // 93: WAWebProtobufsWeb.EventResponse.eventResponseMessageKey:type_name -> WACommon.MessageKey - 37, // 94: WAWebProtobufsWeb.EventResponse.eventResponseMessage:type_name -> WAWebProtobufsE2E.EventResponseMessage - 95, // [95:95] is the sub-list for method output_type - 95, // [95:95] is the sub-list for method input_type - 95, // [95:95] is the sub-list for extension type_name - 95, // [95:95] is the sub-list for extension extendee - 0, // [0:95] is the sub-list for field type_name + 32, // 0: WAWebProtobufsWeb.WebMessageInfo.key:type_name -> WACommon.MessageKey + 33, // 1: WAWebProtobufsWeb.WebMessageInfo.message:type_name -> WAWebProtobufsE2E.Message + 2, // 2: WAWebProtobufsWeb.WebMessageInfo.status:type_name -> WAWebProtobufsWeb.WebMessageInfo.Status + 1, // 3: WAWebProtobufsWeb.WebMessageInfo.messageStubType:type_name -> WAWebProtobufsWeb.WebMessageInfo.StubType + 10, // 4: WAWebProtobufsWeb.WebMessageInfo.paymentInfo:type_name -> WAWebProtobufsWeb.PaymentInfo + 34, // 5: WAWebProtobufsWeb.WebMessageInfo.finalLiveLocation:type_name -> WAWebProtobufsE2E.LiveLocationMessage + 10, // 6: WAWebProtobufsWeb.WebMessageInfo.quotedPaymentInfo:type_name -> WAWebProtobufsWeb.PaymentInfo + 0, // 7: WAWebProtobufsWeb.WebMessageInfo.bizPrivacyStatus:type_name -> WAWebProtobufsWeb.WebMessageInfo.BizPrivacyStatus + 18, // 8: WAWebProtobufsWeb.WebMessageInfo.mediaData:type_name -> WAWebProtobufsWeb.MediaData + 19, // 9: WAWebProtobufsWeb.WebMessageInfo.photoChange:type_name -> WAWebProtobufsWeb.PhotoChange + 21, // 10: WAWebProtobufsWeb.WebMessageInfo.userReceipt:type_name -> WAWebProtobufsWeb.UserReceipt + 22, // 11: WAWebProtobufsWeb.WebMessageInfo.reactions:type_name -> WAWebProtobufsWeb.Reaction + 18, // 12: WAWebProtobufsWeb.WebMessageInfo.quotedStickerData:type_name -> WAWebProtobufsWeb.MediaData + 20, // 13: WAWebProtobufsWeb.WebMessageInfo.statusPsa:type_name -> WAWebProtobufsWeb.StatusPSA + 23, // 14: WAWebProtobufsWeb.WebMessageInfo.pollUpdates:type_name -> WAWebProtobufsWeb.PollUpdate + 24, // 15: WAWebProtobufsWeb.WebMessageInfo.pollAdditionalMetadata:type_name -> WAWebProtobufsWeb.PollAdditionalMetadata + 26, // 16: WAWebProtobufsWeb.WebMessageInfo.keepInChat:type_name -> WAWebProtobufsWeb.KeepInChat + 12, // 17: WAWebProtobufsWeb.WebMessageInfo.pinInChat:type_name -> WAWebProtobufsWeb.PinInChat + 28, // 18: WAWebProtobufsWeb.WebMessageInfo.premiumMessageInfo:type_name -> WAWebProtobufsWeb.PremiumMessageInfo + 14, // 19: WAWebProtobufsWeb.WebMessageInfo.commentMetadata:type_name -> WAWebProtobufsWeb.CommentMetadata + 29, // 20: WAWebProtobufsWeb.WebMessageInfo.eventResponses:type_name -> WAWebProtobufsWeb.EventResponse + 17, // 21: WAWebProtobufsWeb.WebMessageInfo.reportingTokenInfo:type_name -> WAWebProtobufsWeb.ReportingTokenInfo + 25, // 22: WAWebProtobufsWeb.WebMessageInfo.eventAdditionalMetadata:type_name -> WAWebProtobufsWeb.EventAdditionalMetadata + 32, // 23: WAWebProtobufsWeb.WebMessageInfo.targetMessageID:type_name -> WACommon.MessageKey + 13, // 24: WAWebProtobufsWeb.WebMessageInfo.messageAddOns:type_name -> WAWebProtobufsWeb.MessageAddOn + 31, // 25: WAWebProtobufsWeb.WebMessageInfo.statusMentionMessageInfo:type_name -> WAWebProtobufsWeb.StatusMentionMessage + 5, // 26: WAWebProtobufsWeb.PaymentInfo.currencyDeprecated:type_name -> WAWebProtobufsWeb.PaymentInfo.Currency + 4, // 27: WAWebProtobufsWeb.PaymentInfo.status:type_name -> WAWebProtobufsWeb.PaymentInfo.Status + 32, // 28: WAWebProtobufsWeb.PaymentInfo.requestMessageKey:type_name -> WACommon.MessageKey + 3, // 29: WAWebProtobufsWeb.PaymentInfo.txnStatus:type_name -> WAWebProtobufsWeb.PaymentInfo.TxnStatus + 35, // 30: WAWebProtobufsWeb.PaymentInfo.primaryAmount:type_name -> WAWebProtobufsE2E.Money + 35, // 31: WAWebProtobufsWeb.PaymentInfo.exchangeAmount:type_name -> WAWebProtobufsE2E.Money + 6, // 32: WAWebProtobufsWeb.WebFeatures.labelsDisplay:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 33: WAWebProtobufsWeb.WebFeatures.voipIndividualOutgoing:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 34: WAWebProtobufsWeb.WebFeatures.groupsV3:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 35: WAWebProtobufsWeb.WebFeatures.groupsV3Create:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 36: WAWebProtobufsWeb.WebFeatures.changeNumberV2:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 37: WAWebProtobufsWeb.WebFeatures.queryStatusV3Thumbnail:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 38: WAWebProtobufsWeb.WebFeatures.liveLocations:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 39: WAWebProtobufsWeb.WebFeatures.queryVname:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 40: WAWebProtobufsWeb.WebFeatures.voipIndividualIncoming:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 41: WAWebProtobufsWeb.WebFeatures.quickRepliesQuery:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 42: WAWebProtobufsWeb.WebFeatures.payments:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 43: WAWebProtobufsWeb.WebFeatures.stickerPackQuery:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 44: WAWebProtobufsWeb.WebFeatures.liveLocationsFinal:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 45: WAWebProtobufsWeb.WebFeatures.labelsEdit:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 46: WAWebProtobufsWeb.WebFeatures.mediaUpload:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 47: WAWebProtobufsWeb.WebFeatures.mediaUploadRichQuickReplies:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 48: WAWebProtobufsWeb.WebFeatures.vnameV2:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 49: WAWebProtobufsWeb.WebFeatures.videoPlaybackURL:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 50: WAWebProtobufsWeb.WebFeatures.statusRanking:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 51: WAWebProtobufsWeb.WebFeatures.voipIndividualVideo:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 52: WAWebProtobufsWeb.WebFeatures.thirdPartyStickers:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 53: WAWebProtobufsWeb.WebFeatures.frequentlyForwardedSetting:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 54: WAWebProtobufsWeb.WebFeatures.groupsV4JoinPermission:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 55: WAWebProtobufsWeb.WebFeatures.recentStickers:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 56: WAWebProtobufsWeb.WebFeatures.catalog:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 57: WAWebProtobufsWeb.WebFeatures.starredStickers:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 58: WAWebProtobufsWeb.WebFeatures.voipGroupCall:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 59: WAWebProtobufsWeb.WebFeatures.templateMessage:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 60: WAWebProtobufsWeb.WebFeatures.templateMessageInteractivity:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 61: WAWebProtobufsWeb.WebFeatures.ephemeralMessages:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 62: WAWebProtobufsWeb.WebFeatures.e2ENotificationSync:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 63: WAWebProtobufsWeb.WebFeatures.recentStickersV2:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 64: WAWebProtobufsWeb.WebFeatures.recentStickersV3:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 65: WAWebProtobufsWeb.WebFeatures.userNotice:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 66: WAWebProtobufsWeb.WebFeatures.support:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 67: WAWebProtobufsWeb.WebFeatures.groupUiiCleanup:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 68: WAWebProtobufsWeb.WebFeatures.groupDogfoodingInternalOnly:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 69: WAWebProtobufsWeb.WebFeatures.settingsSync:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 70: WAWebProtobufsWeb.WebFeatures.archiveV2:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 71: WAWebProtobufsWeb.WebFeatures.ephemeralAllowGroupMembers:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 72: WAWebProtobufsWeb.WebFeatures.ephemeral24HDuration:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 73: WAWebProtobufsWeb.WebFeatures.mdForceUpgrade:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 74: WAWebProtobufsWeb.WebFeatures.disappearingMode:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 75: WAWebProtobufsWeb.WebFeatures.externalMdOptInAvailable:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 6, // 76: WAWebProtobufsWeb.WebFeatures.noDeleteMessageTimeLimit:type_name -> WAWebProtobufsWeb.WebFeatures.Flag + 7, // 77: WAWebProtobufsWeb.PinInChat.type:type_name -> WAWebProtobufsWeb.PinInChat.Type + 32, // 78: WAWebProtobufsWeb.PinInChat.key:type_name -> WACommon.MessageKey + 27, // 79: WAWebProtobufsWeb.PinInChat.messageAddOnContextInfo:type_name -> WAWebProtobufsWeb.MessageAddOnContextInfo + 8, // 80: WAWebProtobufsWeb.MessageAddOn.messageAddOnType:type_name -> WAWebProtobufsWeb.MessageAddOn.MessageAddOnType + 33, // 81: WAWebProtobufsWeb.MessageAddOn.messageAddOn:type_name -> WAWebProtobufsE2E.Message + 2, // 82: WAWebProtobufsWeb.MessageAddOn.status:type_name -> WAWebProtobufsWeb.WebMessageInfo.Status + 27, // 83: WAWebProtobufsWeb.MessageAddOn.addOnContextInfo:type_name -> WAWebProtobufsWeb.MessageAddOnContextInfo + 32, // 84: WAWebProtobufsWeb.MessageAddOn.messageAddOnKey:type_name -> WACommon.MessageKey + 30, // 85: WAWebProtobufsWeb.MessageAddOn.legacyMessage:type_name -> WAWebProtobufsWeb.LegacyMessage + 32, // 86: WAWebProtobufsWeb.CommentMetadata.commentParentKey:type_name -> WACommon.MessageKey + 9, // 87: WAWebProtobufsWeb.WebNotificationsInfo.notifyMessages:type_name -> WAWebProtobufsWeb.WebMessageInfo + 32, // 88: WAWebProtobufsWeb.NotificationMessageInfo.key:type_name -> WACommon.MessageKey + 33, // 89: WAWebProtobufsWeb.NotificationMessageInfo.message:type_name -> WAWebProtobufsE2E.Message + 32, // 90: WAWebProtobufsWeb.Reaction.key:type_name -> WACommon.MessageKey + 32, // 91: WAWebProtobufsWeb.PollUpdate.pollUpdateMessageKey:type_name -> WACommon.MessageKey + 36, // 92: WAWebProtobufsWeb.PollUpdate.vote:type_name -> WAWebProtobufsE2E.PollVoteMessage + 37, // 93: WAWebProtobufsWeb.KeepInChat.keepType:type_name -> WAWebProtobufsE2E.KeepType + 32, // 94: WAWebProtobufsWeb.KeepInChat.key:type_name -> WACommon.MessageKey + 38, // 95: WAWebProtobufsWeb.MessageAddOnContextInfo.messageAddOnExpiryType:type_name -> WAWebProtobufsE2E.MessageContextInfo.MessageAddonExpiryType + 32, // 96: WAWebProtobufsWeb.EventResponse.eventResponseMessageKey:type_name -> WACommon.MessageKey + 39, // 97: WAWebProtobufsWeb.EventResponse.eventResponseMessage:type_name -> WAWebProtobufsE2E.EventResponseMessage + 39, // 98: WAWebProtobufsWeb.LegacyMessage.eventResponseMessage:type_name -> WAWebProtobufsE2E.EventResponseMessage + 36, // 99: WAWebProtobufsWeb.LegacyMessage.pollVote:type_name -> WAWebProtobufsE2E.PollVoteMessage + 33, // 100: WAWebProtobufsWeb.StatusMentionMessage.quotedStatus:type_name -> WAWebProtobufsE2E.Message + 101, // [101:101] is the sub-list for method output_type + 101, // [101:101] is the sub-list for method input_type + 101, // [101:101] is the sub-list for extension type_name + 101, // [101:101] is the sub-list for extension extendee + 0, // [0:101] is the sub-list for field type_name } func init() { file_waWeb_WAWebProtobufsWeb_proto_init() } @@ -3682,7 +3825,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*WebMessageInfo); i { case 0: return &v.state @@ -3694,7 +3837,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*PaymentInfo); i { case 0: return &v.state @@ -3706,7 +3849,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*WebFeatures); i { case 0: return &v.state @@ -3718,7 +3861,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*PinInChat); i { case 0: return &v.state @@ -3730,7 +3873,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*MessageAddOn); i { case 0: return &v.state @@ -3742,7 +3885,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*CommentMetadata); i { case 0: return &v.state @@ -3754,7 +3897,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*WebNotificationsInfo); i { case 0: return &v.state @@ -3766,7 +3909,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*NotificationMessageInfo); i { case 0: return &v.state @@ -3778,7 +3921,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*ReportingTokenInfo); i { case 0: return &v.state @@ -3790,7 +3933,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*MediaData); i { case 0: return &v.state @@ -3802,7 +3945,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*PhotoChange); i { case 0: return &v.state @@ -3814,7 +3957,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*StatusPSA); i { case 0: return &v.state @@ -3826,7 +3969,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[12].Exporter = func(v any, i int) any { switch v := v.(*UserReceipt); i { case 0: return &v.state @@ -3838,7 +3981,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[13].Exporter = func(v any, i int) any { switch v := v.(*Reaction); i { case 0: return &v.state @@ -3850,7 +3993,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[14].Exporter = func(v any, i int) any { switch v := v.(*PollUpdate); i { case 0: return &v.state @@ -3862,7 +4005,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[15].Exporter = func(v any, i int) any { switch v := v.(*PollAdditionalMetadata); i { case 0: return &v.state @@ -3874,7 +4017,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[16].Exporter = func(v any, i int) any { switch v := v.(*EventAdditionalMetadata); i { case 0: return &v.state @@ -3886,7 +4029,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[17].Exporter = func(v any, i int) any { switch v := v.(*KeepInChat); i { case 0: return &v.state @@ -3898,7 +4041,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[18].Exporter = func(v any, i int) any { switch v := v.(*MessageAddOnContextInfo); i { case 0: return &v.state @@ -3910,7 +4053,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[19].Exporter = func(v any, i int) any { switch v := v.(*PremiumMessageInfo); i { case 0: return &v.state @@ -3922,7 +4065,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } - file_waWeb_WAWebProtobufsWeb_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[20].Exporter = func(v any, i int) any { switch v := v.(*EventResponse); i { case 0: return &v.state @@ -3934,6 +4077,30 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { return nil } } + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[21].Exporter = func(v any, i int) any { + switch v := v.(*LegacyMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waWeb_WAWebProtobufsWeb_proto_msgTypes[22].Exporter = func(v any, i int) any { + switch v := v.(*StatusMentionMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -3941,7 +4108,7 @@ func file_waWeb_WAWebProtobufsWeb_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_waWeb_WAWebProtobufsWeb_proto_rawDesc, NumEnums: 9, - NumMessages: 21, + NumMessages: 23, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.raw b/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.raw index 8dac51f5..4c90259a 100644 Binary files a/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.raw and b/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.raw differ diff --git a/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.proto b/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.proto index 61e1219b..079b2988 100644 --- a/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.proto +++ b/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.proto @@ -222,6 +222,9 @@ message WebMessageInfo { EVENT_UPDATED = 205; EVENT_CANCELED = 206; COMMUNITY_OWNER_UPDATED = 207; + COMMUNITY_SUB_GROUP_VISIBILITY_HIDDEN = 208; + CAPI_GROUP_NE2EE_SYSTEM_MESSAGE = 209; + STATUS_MENTION = 210; } enum Status { @@ -290,6 +293,7 @@ message WebMessageInfo { repeated string statusMentions = 66; optional WACommon.MessageKey targetMessageID = 67; repeated MessageAddOn messageAddOns = 68; + optional StatusMentionMessage statusMentionMessageInfo = 69; } message PaymentInfo { @@ -447,6 +451,8 @@ message MessageAddOn { optional int64 serverTimestampMS = 4; optional WebMessageInfo.Status status = 5; optional MessageAddOnContextInfo addOnContextInfo = 6; + optional WACommon.MessageKey messageAddOnKey = 7; + optional LegacyMessage legacyMessage = 8; } message CommentMetadata { @@ -544,3 +550,12 @@ message EventResponse { optional WAWebProtobufsE2E.EventResponseMessage eventResponseMessage = 3; optional bool unread = 4; } + +message LegacyMessage { + optional WAWebProtobufsE2E.EventResponseMessage eventResponseMessage = 1; + optional WAWebProtobufsE2E.PollVoteMessage pollVote = 2; +} + +message StatusMentionMessage { + optional WAWebProtobufsE2E.Message quotedStatus = 1; +} diff --git a/vendor/go.mau.fi/whatsmeow/retry.go b/vendor/go.mau.fi/whatsmeow/retry.go index 6400abd2..509282dd 100644 --- a/vendor/go.mau.fi/whatsmeow/retry.go +++ b/vendor/go.mau.fi/whatsmeow/retry.go @@ -280,7 +280,7 @@ func (cli *Client) handleRetryReceipt(receipt *events.Receipt, node *waBinary.No } var content []waBinary.Node if msg.wa != nil { - content = cli.getMessageContent(*encrypted, msg.wa, attrs, includeDeviceIdentity) + content = cli.getMessageContent(*encrypted, msg.wa, attrs, includeDeviceIdentity, nil) } else { content = []waBinary.Node{ *encrypted, diff --git a/vendor/go.mau.fi/whatsmeow/send.go b/vendor/go.mau.fi/whatsmeow/send.go index 9c2a3a18..ae5b0ba0 100644 --- a/vendor/go.mau.fi/whatsmeow/send.go +++ b/vendor/go.mau.fi/whatsmeow/send.go @@ -130,6 +130,8 @@ type SendResponse struct { type SendRequestExtra struct { // The message ID to use when sending. If this is not provided, a random message ID will be generated ID types.MessageID + // JID of the bot to be invoked (optional) + InlineBotJID types.JID // Should the message be sent as a peer message (protocol messages to your own devices, e.g. app state key requests) Peer bool // A timeout for the send request. Unlike timeouts using the context parameter, this only applies @@ -164,7 +166,7 @@ type SendRequestExtra struct { // in binary/proto/def.proto may be useful to find out all the allowed fields. Printing the RawMessage // field in incoming message events to figure out what it contains is also a good way to learn how to // send the same kind of message. -func (cli *Client) SendMessage(ctx context.Context, to types.JID, message *waProto.Message, extra ...SendRequestExtra) (resp SendResponse, err error) { +func (cli *Client) SendMessage(ctx context.Context, to types.JID, message *waE2E.Message, extra ...SendRequestExtra) (resp SendResponse, err error) { var req SendRequestExtra if len(extra) > 1 { err = errors.New("only one extra parameter may be provided to SendMessage") @@ -198,6 +200,72 @@ func (cli *Client) SendMessage(ctx context.Context, to types.JID, message *waPro } resp.ID = req.ID + isInlineBotMode := false + + if !req.InlineBotJID.IsEmpty() { + if !req.InlineBotJID.IsBot() { + err = ErrInvalidInlineBotID + return + } + isInlineBotMode = true + } + + isBotMode := isInlineBotMode || to.IsBot() + var botNode *waBinary.Node + + if isBotMode { + if message.MessageContextInfo == nil { + message.MessageContextInfo = &waE2E.MessageContextInfo{} + } + + if message.MessageContextInfo.MessageSecret == nil { + message.MessageContextInfo.MessageSecret = random.Bytes(32) + } + + if message.MessageContextInfo.BotMetadata == nil { + message.MessageContextInfo.BotMetadata = &waE2E.BotMetadata{ + PersonaID: proto.String("867051314767696$760019659443059"), + } + } + + if isInlineBotMode { + // inline mode specific code + messageSecret := message.GetMessageContextInfo().GetMessageSecret() + message = &waE2E.Message{ + BotInvokeMessage: &waE2E.FutureProofMessage{ + Message: &waE2E.Message{ + ExtendedTextMessage: message.ExtendedTextMessage, + MessageContextInfo: &waE2E.MessageContextInfo{ + BotMetadata: message.MessageContextInfo.BotMetadata, + }, + }, + }, + MessageContextInfo: message.MessageContextInfo, + } + + botMessage := &waE2E.Message{ + BotInvokeMessage: message.BotInvokeMessage, + MessageContextInfo: &waE2E.MessageContextInfo{ + BotMetadata: message.MessageContextInfo.BotMetadata, + BotMessageSecret: applyBotMessageHKDF(messageSecret), + }, + } + + messagePlaintext, _, marshalErr := marshalMessage(req.InlineBotJID, botMessage) + if marshalErr != nil { + err = marshalErr + return + } + + participantNodes, _ := cli.encryptMessageForDevices(ctx, []types.JID{req.InlineBotJID}, ownID, resp.ID, messagePlaintext, nil, waBinary.Attrs{}) + botNode = &waBinary.Node{ + Tag: "bot", + Attrs: nil, + Content: participantNodes, + } + } + } + start := time.Now() // Sending multiple messages at a time can cause weird issues and makes it harder to retry safely cli.messageSendLock.Lock() @@ -209,6 +277,7 @@ func (cli *Client) SendMessage(ctx context.Context, to types.JID, message *waPro if !req.Peer { cli.addRecentMessage(to, req.ID, message, nil) } + if message.GetMessageContextInfo().GetMessageSecret() != nil { err = cli.Store.MsgSecrets.PutMessageSecret(to, ownID, req.ID, message.GetMessageContextInfo().GetMessageSecret()) if err != nil { @@ -221,12 +290,12 @@ func (cli *Client) SendMessage(ctx context.Context, to types.JID, message *waPro var data []byte switch to.Server { case types.GroupServer, types.BroadcastServer: - phash, data, err = cli.sendGroup(ctx, to, ownID, req.ID, message, &resp.DebugTimings) + phash, data, err = cli.sendGroup(ctx, to, ownID, req.ID, message, &resp.DebugTimings, botNode) case types.DefaultUserServer: if req.Peer { data, err = cli.sendPeerMessage(to, req.ID, message, &resp.DebugTimings) } else { - data, err = cli.sendDM(ctx, to, ownID, req.ID, message, &resp.DebugTimings) + data, err = cli.sendDM(ctx, to, ownID, req.ID, message, &resp.DebugTimings, botNode) } case types.NewsletterServer: data, err = cli.sendNewsletter(to, req.ID, message, req.MediaHandle, &resp.DebugTimings) @@ -532,7 +601,7 @@ func (cli *Client) sendNewsletter(to types.JID, id types.MessageID, message *waP return data, nil } -func (cli *Client) sendGroup(ctx context.Context, to, ownID types.JID, id types.MessageID, message *waProto.Message, timings *MessageDebugTimings) (string, []byte, error) { +func (cli *Client) sendGroup(ctx context.Context, to, ownID types.JID, id types.MessageID, message *waProto.Message, timings *MessageDebugTimings, botNode *waBinary.Node) (string, []byte, error) { var participants []types.JID var err error start := time.Now() @@ -563,8 +632,8 @@ func (cli *Client) sendGroup(ctx context.Context, to, ownID types.JID, id types. if err != nil { return "", nil, fmt.Errorf("failed to create sender key distribution message to send %s to %s: %w", id, to, err) } - skdMessage := &waProto.Message{ - SenderKeyDistributionMessage: &waProto.SenderKeyDistributionMessage{ + skdMessage := &waE2E.Message{ + SenderKeyDistributionMessage: &waE2E.SenderKeyDistributionMessage{ GroupID: proto.String(to.String()), AxolotlSenderKeyDistributionMessage: signalSKDMessage.Serialize(), }, @@ -582,7 +651,7 @@ func (cli *Client) sendGroup(ctx context.Context, to, ownID types.JID, id types. ciphertext := encrypted.SignedSerialize() timings.GroupEncrypt = time.Since(start) - node, allDevices, err := cli.prepareMessageNode(ctx, to, ownID, id, message, participants, skdPlaintext, nil, timings) + node, allDevices, err := cli.prepareMessageNode(ctx, to, ownID, id, message, participants, skdPlaintext, nil, timings, botNode) if err != nil { return "", nil, err } @@ -608,7 +677,7 @@ func (cli *Client) sendGroup(ctx context.Context, to, ownID types.JID, id types. return phash, data, nil } -func (cli *Client) sendPeerMessage(to types.JID, id types.MessageID, message *waProto.Message, timings *MessageDebugTimings) ([]byte, error) { +func (cli *Client) sendPeerMessage(to types.JID, id types.MessageID, message *waE2E.Message, timings *MessageDebugTimings) ([]byte, error) { node, err := cli.preparePeerMessageNode(to, id, message, timings) if err != nil { return nil, err @@ -622,7 +691,7 @@ func (cli *Client) sendPeerMessage(to types.JID, id types.MessageID, message *wa return data, nil } -func (cli *Client) sendDM(ctx context.Context, to, ownID types.JID, id types.MessageID, message *waProto.Message, timings *MessageDebugTimings) ([]byte, error) { +func (cli *Client) sendDM(ctx context.Context, to, ownID types.JID, id types.MessageID, message *waE2E.Message, timings *MessageDebugTimings, botNode *waBinary.Node) ([]byte, error) { start := time.Now() messagePlaintext, deviceSentMessagePlaintext, err := marshalMessage(to, message) timings.Marshal = time.Since(start) @@ -630,7 +699,7 @@ func (cli *Client) sendDM(ctx context.Context, to, ownID types.JID, id types.Mes return nil, err } - node, _, err := cli.prepareMessageNode(ctx, to, ownID, id, message, []types.JID{to, ownID.ToNonAD()}, messagePlaintext, deviceSentMessagePlaintext, timings) + node, _, err := cli.prepareMessageNode(ctx, to, ownID, id, message, []types.JID{to, ownID.ToNonAD()}, messagePlaintext, deviceSentMessagePlaintext, timings, botNode) if err != nil { return nil, err } @@ -829,7 +898,7 @@ func (cli *Client) preparePeerMessageNode(to types.JID, id types.MessageID, mess }, nil } -func (cli *Client) getMessageContent(baseNode waBinary.Node, message *waProto.Message, msgAttrs waBinary.Attrs, includeIdentity bool) []waBinary.Node { +func (cli *Client) getMessageContent(baseNode waBinary.Node, message *waE2E.Message, msgAttrs waBinary.Attrs, includeIdentity bool, botNode *waBinary.Node) []waBinary.Node { content := []waBinary.Node{baseNode} if includeIdentity { content = append(content, cli.makeDeviceIdentityNode()) @@ -846,6 +915,11 @@ func (cli *Client) getMessageContent(baseNode waBinary.Node, message *waProto.Me }, }) } + + if botNode != nil { + content = append(content, *botNode) + } + if buttonType := getButtonTypeFromMessage(message); buttonType != "" { content = append(content, waBinary.Node{ Tag: "biz", @@ -858,7 +932,7 @@ func (cli *Client) getMessageContent(baseNode waBinary.Node, message *waProto.Me return content } -func (cli *Client) prepareMessageNode(ctx context.Context, to, ownID types.JID, id types.MessageID, message *waProto.Message, participants []types.JID, plaintext, dsmPlaintext []byte, timings *MessageDebugTimings) (*waBinary.Node, []types.JID, error) { +func (cli *Client) prepareMessageNode(ctx context.Context, to, ownID types.JID, id types.MessageID, message *waE2E.Message, participants []types.JID, plaintext, dsmPlaintext []byte, timings *MessageDebugTimings, botNode *waBinary.Node) (*waBinary.Node, []types.JID, error) { start := time.Now() allDevices, err := cli.GetUserDevicesContext(ctx, participants) timings.GetDevices = time.Since(start) @@ -895,7 +969,7 @@ func (cli *Client) prepareMessageNode(ctx context.Context, to, ownID types.JID, return &waBinary.Node{ Tag: "message", Attrs: attrs, - Content: cli.getMessageContent(participantNode, message, attrs, includeIdentity), + Content: cli.getMessageContent(participantNode, message, attrs, includeIdentity, botNode), }, allDevices, nil } @@ -956,6 +1030,7 @@ func (cli *Client) encryptMessageForDevices(ctx context.Context, allDevices []ty cli.Log.Warnf("Failed to encrypt %s for %s: %v", id, jid, err) continue } + participantNodes = append(participantNodes, *encrypted) if isPreKey { includeIdentity = true diff --git a/vendor/go.mau.fi/whatsmeow/sendfb.go b/vendor/go.mau.fi/whatsmeow/sendfb.go index 0f61c9c1..660d2669 100644 --- a/vendor/go.mau.fi/whatsmeow/sendfb.go +++ b/vendor/go.mau.fi/whatsmeow/sendfb.go @@ -24,6 +24,8 @@ import ( "google.golang.org/protobuf/proto" waBinary "go.mau.fi/whatsmeow/binary" + armadillo "go.mau.fi/whatsmeow/proto" + "go.mau.fi/whatsmeow/proto/waArmadilloApplication" "go.mau.fi/whatsmeow/proto/waCommon" "go.mau.fi/whatsmeow/proto/waConsumerApplication" "go.mau.fi/whatsmeow/proto/waMsgApplication" @@ -35,12 +37,13 @@ import ( const FBMessageVersion = 3 const FBMessageApplicationVersion = 2 const FBConsumerMessageVersion = 1 +const FBArmadilloMessageVersion = 1 // SendFBMessage sends the given v3 message to the given JID. func (cli *Client) SendFBMessage( ctx context.Context, to types.JID, - message *waConsumerApplication.ConsumerApplication, + message armadillo.RealMessageApplicationSub, metadata *waMsgApplication.MessageApplication_Metadata, extra ...SendRequestExtra, ) (resp SendResponse, err error) { @@ -51,9 +54,37 @@ func (cli *Client) SendFBMessage( } else if len(extra) == 1 { req = extra[0] } - consumerMessage, err := proto.Marshal(message) - if err != nil { - err = fmt.Errorf("failed to marshal consumer message: %w", err) + var subproto waMsgApplication.MessageApplication_SubProtocolPayload + subproto.FutureProof = waCommon.FutureProofBehavior_PLACEHOLDER.Enum() + switch typedMsg := message.(type) { + case *waConsumerApplication.ConsumerApplication: + var consumerMessage []byte + consumerMessage, err = proto.Marshal(typedMsg) + if err != nil { + err = fmt.Errorf("failed to marshal consumer message: %w", err) + return + } + subproto.SubProtocol = &waMsgApplication.MessageApplication_SubProtocolPayload_ConsumerMessage{ + ConsumerMessage: &waCommon.SubProtocol{ + Payload: consumerMessage, + Version: proto.Int32(FBConsumerMessageVersion), + }, + } + case *waArmadilloApplication.Armadillo: + var armadilloMessage []byte + armadilloMessage, err = proto.Marshal(typedMsg) + if err != nil { + err = fmt.Errorf("failed to marshal armadillo message: %w", err) + return + } + subproto.SubProtocol = &waMsgApplication.MessageApplication_SubProtocolPayload_Armadillo{ + Armadillo: &waCommon.SubProtocol{ + Payload: armadilloMessage, + Version: proto.Int32(FBArmadilloMessageVersion), + }, + } + default: + err = fmt.Errorf("unsupported message type %T", message) return } if metadata == nil { @@ -65,15 +96,7 @@ func (cli *Client) SendFBMessage( messageAppProto := &waMsgApplication.MessageApplication{ Payload: &waMsgApplication.MessageApplication_Payload{ Content: &waMsgApplication.MessageApplication_Payload_SubProtocol{ - SubProtocol: &waMsgApplication.MessageApplication_SubProtocolPayload{ - SubProtocol: &waMsgApplication.MessageApplication_SubProtocolPayload_ConsumerMessage{ - ConsumerMessage: &waCommon.SubProtocol{ - Payload: consumerMessage, - Version: proto.Int32(FBConsumerMessageVersion), - }, - }, - FutureProof: waCommon.FutureProofBehavior_PLACEHOLDER.Enum(), - }, + SubProtocol: &subproto, }, }, Metadata: metadata, @@ -310,7 +333,20 @@ type messageAttrs struct { PollType string } -func getAttrsFromFBMessage(msg *waConsumerApplication.ConsumerApplication) (attrs messageAttrs) { +func getAttrsFromFBMessage(msg armadillo.MessageApplicationSub) (attrs messageAttrs) { + switch typedMsg := msg.(type) { + case *waConsumerApplication.ConsumerApplication: + return getAttrsFromFBConsumerMessage(typedMsg) + case *waArmadilloApplication.Armadillo: + attrs.Type = "media" + attrs.MediaType = "document" + default: + attrs.Type = "text" + } + return +} + +func getAttrsFromFBConsumerMessage(msg *waConsumerApplication.ConsumerApplication) (attrs messageAttrs) { switch payload := msg.GetPayload().GetPayload().(type) { case *waConsumerApplication.ConsumerApplication_Payload_Content: switch content := payload.Content.GetContent().(type) { diff --git a/vendor/go.mau.fi/whatsmeow/store/clientpayload.go b/vendor/go.mau.fi/whatsmeow/store/clientpayload.go index 8d2ed6bd..eeac68b9 100644 --- a/vendor/go.mau.fi/whatsmeow/store/clientpayload.go +++ b/vendor/go.mau.fi/whatsmeow/store/clientpayload.go @@ -74,7 +74,7 @@ func (vc WAVersionContainer) ProtoAppVersion() *waProto.ClientPayload_UserAgent_ } // waVersion is the WhatsApp web client version -var waVersion = WAVersionContainer{2, 3000, 1014340090} +var waVersion = WAVersionContainer{2, 3000, 1016748013} // waVersionHash is the md5 hash of a dot-separated waVersion var waVersionHash [16]byte diff --git a/vendor/go.mau.fi/whatsmeow/types/events/call.go b/vendor/go.mau.fi/whatsmeow/types/events/call.go index 8ced457c..c1cf2b2c 100644 --- a/vendor/go.mau.fi/whatsmeow/types/events/call.go +++ b/vendor/go.mau.fi/whatsmeow/types/events/call.go @@ -65,6 +65,12 @@ type CallTerminate struct { Data *waBinary.Node } +// CallReject is sent when the other party rejects the call on WhatsApp. +type CallReject struct { + types.BasicCallMeta + Data *waBinary.Node +} + // UnknownCallEvent is emitted when a call element with unknown content is received. type UnknownCallEvent struct { Node *waBinary.Node diff --git a/vendor/go.mau.fi/whatsmeow/types/events/events.go b/vendor/go.mau.fi/whatsmeow/types/events/events.go index 7467ad6f..f50e4638 100644 --- a/vendor/go.mau.fi/whatsmeow/types/events/events.go +++ b/vendor/go.mau.fi/whatsmeow/types/events/events.go @@ -15,6 +15,8 @@ import ( waBinary "go.mau.fi/whatsmeow/binary" waProto "go.mau.fi/whatsmeow/binary/proto" armadillo "go.mau.fi/whatsmeow/proto" + "go.mau.fi/whatsmeow/proto/waArmadilloApplication" + "go.mau.fi/whatsmeow/proto/waConsumerApplication" "go.mau.fi/whatsmeow/proto/waMsgApplication" "go.mau.fi/whatsmeow/proto/waMsgTransport" "go.mau.fi/whatsmeow/types" @@ -108,6 +110,9 @@ type LoggedOut struct { // or otherwise try to connect twice with the same session. type StreamReplaced struct{} +// ManualLoginReconnect is emitted after login if DisableLoginAutoReconnect is set. +type ManualLoginReconnect struct{} + // TempBanReason is an error code included in temp ban error events. type TempBanReason int @@ -301,6 +306,20 @@ type FBMessage struct { Application *waMsgApplication.MessageApplication // The second level of wrapping the message was in } +func (evt *FBMessage) GetConsumerApplication() *waConsumerApplication.ConsumerApplication { + if consumerApp, ok := evt.Message.(*waConsumerApplication.ConsumerApplication); ok { + return consumerApp + } + return nil +} + +func (evt *FBMessage) GetArmadillo() *waArmadilloApplication.Armadillo { + if armadillo, ok := evt.Message.(*waArmadilloApplication.Armadillo); ok { + return armadillo + } + return nil +} + // UnwrapRaw fills the Message, IsEphemeral and IsViewOnce fields based on the raw message in the RawMessage field. func (evt *Message) UnwrapRaw() *Message { evt.Message = evt.RawMessage @@ -414,6 +433,8 @@ type GroupInfo struct { Announce *types.GroupAnnounce // Group announce status change (can only admins send messages?) Ephemeral *types.GroupEphemeral // Disappearing messages change + MembershipApprovalMode *types.GroupMembershipApprovalMode // Membership approval mode change + Delete *types.GroupDelete Link *types.GroupLinkChange diff --git a/vendor/go.mau.fi/whatsmeow/types/group.go b/vendor/go.mau.fi/whatsmeow/types/group.go index 9fd97675..4e301379 100644 --- a/vendor/go.mau.fi/whatsmeow/types/group.go +++ b/vendor/go.mau.fi/whatsmeow/types/group.go @@ -13,7 +13,8 @@ import ( type GroupMemberAddMode string const ( - GroupMemberAddModeAdmin GroupMemberAddMode = "admin_add" + GroupMemberAddModeAdmin GroupMemberAddMode = "admin_add" + GroupMemberAddModeAllMember GroupMemberAddMode = "all_member_add" ) // GroupInfo contains basic information about a group chat on WhatsApp. @@ -31,6 +32,7 @@ type GroupInfo struct { GroupParent GroupLinkedParent GroupIsDefaultSub + GroupMembershipApprovalMode GroupCreated time.Time @@ -40,6 +42,10 @@ type GroupInfo struct { MemberAddMode GroupMemberAddMode } +type GroupMembershipApprovalMode struct { + IsJoinApprovalRequired bool +} + type GroupParent struct { IsParent bool DefaultMembershipApprovalMode string // request_required diff --git a/vendor/go.mau.fi/whatsmeow/types/jid.go b/vendor/go.mau.fi/whatsmeow/types/jid.go index 31c9bed6..d4d22fbd 100644 --- a/vendor/go.mau.fi/whatsmeow/types/jid.go +++ b/vendor/go.mau.fi/whatsmeow/types/jid.go @@ -11,6 +11,7 @@ import ( "database/sql" "database/sql/driver" "fmt" + "regexp" "strconv" "strings" @@ -39,6 +40,7 @@ var ( StatusBroadcastJID = NewJID("status", BroadcastServer) PSAJID = NewJID("0", LegacyUserServer) OfficialBusinessJID = NewJID("16505361212", LegacyUserServer) + MetaAIJID = NewJID("13135550002", DefaultUserServer) ) // MessageID is the internal ID of a WhatsApp message. @@ -107,6 +109,12 @@ func (jid JID) IsBroadcastList() bool { return jid.Server == BroadcastServer && jid.User != StatusBroadcastJID.User } +var botUserRegex = regexp.MustCompile(`^1313555\d{4}$|^131655500\d{2}$`) + +func (jid JID) IsBot() bool { + return jid.Server == DefaultUserServer && botUserRegex.MatchString(jid.User) && jid.Device == 0 +} + // NewADJID creates a new AD JID. func NewADJID(user string, agent, device uint8) JID { var server string diff --git a/vendor/go.mau.fi/whatsmeow/types/message.go b/vendor/go.mau.fi/whatsmeow/types/message.go index 815291d0..ff13f79c 100644 --- a/vendor/go.mau.fi/whatsmeow/types/message.go +++ b/vendor/go.mau.fi/whatsmeow/types/message.go @@ -47,6 +47,27 @@ const ( EditAttributeAdminRevoke EditAttribute = "8" ) +type BotEditType string + +const ( + EditTypeFirst BotEditType = "first" + EditTypeInner BotEditType = "inner" + EditTypeLast BotEditType = "last" +) + +// MsgBotInfo targets +type MsgBotInfo struct { + EditType BotEditType + EditTargetID MessageID + EditSenderTimestampMS time.Time +} + +// MsgMetaInfo targets +type MsgMetaInfo struct { + TargetID MessageID + TargetSender JID +} + // MessageInfo contains metadata about an incoming message. type MessageInfo struct { MessageSource @@ -60,6 +81,9 @@ type MessageInfo struct { MediaType string Edit EditAttribute + MsgBotInfo MsgBotInfo + MsgMetaInfo MsgMetaInfo + VerifiedName *VerifiedName DeviceSentMeta *DeviceSentMeta // Metadata for direct messages sent from another one of the user's own devices. } diff --git a/vendor/go.mau.fi/whatsmeow/types/user.go b/vendor/go.mau.fi/whatsmeow/types/user.go index eba11cd6..81ef8bde 100644 --- a/vendor/go.mau.fi/whatsmeow/types/user.go +++ b/vendor/go.mau.fi/whatsmeow/types/user.go @@ -26,6 +26,29 @@ type UserInfo struct { Devices []JID } +type BotListInfo struct { + BotJID JID + PersonaID string +} + +type BotProfileInfo struct { + JID JID + Name string + Attributes string + Description string + Category string + IsDefault bool + Prompts []string + PersonaID string + Commands []BotProfileCommand + CommandsDescription string +} + +type BotProfileCommand struct { + Name string + Description string +} + // ProfilePictureInfo contains the ID and URL for a WhatsApp user's profile picture or group's photo. type ProfilePictureInfo struct { URL string `json:"url"` // The full URL for the image, can be downloaded with a simple HTTP request. diff --git a/vendor/go.mau.fi/whatsmeow/upload.go b/vendor/go.mau.fi/whatsmeow/upload.go index b410a6fb..ddd69bd0 100644 --- a/vendor/go.mau.fi/whatsmeow/upload.go +++ b/vendor/go.mau.fi/whatsmeow/upload.go @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Tulir Asokan +// Copyright (c) 2024 Tulir Asokan // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -14,8 +14,10 @@ import ( "encoding/base64" "encoding/json" "fmt" + "io" "net/http" "net/url" + "os" "go.mau.fi/util/random" @@ -45,19 +47,19 @@ type UploadResponse struct { // resp, err := cli.Upload(context.Background(), yourImageBytes, whatsmeow.MediaImage) // // handle error // -// imageMsg := &waProto.ImageMessage{ +// imageMsg := &waE2E.ImageMessage{ // Caption: proto.String("Hello, world!"), // Mimetype: proto.String("image/png"), // replace this with the actual mime type // // you can also optionally add other fields like ContextInfo and JpegThumbnail here // -// Url: &resp.URL, +// URL: &resp.URL, // DirectPath: &resp.DirectPath, // MediaKey: resp.MediaKey, -// FileEncSha256: resp.FileEncSHA256, -// FileSha256: resp.FileSha256, +// FileEncSHA256: resp.FileEncSHA256, +// FileSHA256: resp.FileSHA256, // FileLength: &resp.FileLength, // } -// _, err = cli.SendMessage(context.Background(), targetJID, &waProto.Message{ +// _, err = cli.SendMessage(context.Background(), targetJID, &waE2E.Message{ // ImageMessage: imageMsg, // }) // // handle error again @@ -87,14 +89,50 @@ func (cli *Client) Upload(ctx context.Context, plaintext []byte, appInfo MediaTy dataHash := sha256.Sum256(dataToUpload) resp.FileEncSHA256 = dataHash[:] - err = cli.rawUpload(ctx, dataToUpload, resp.FileEncSHA256, appInfo, false, &resp) + err = cli.rawUpload(ctx, bytes.NewReader(dataToUpload), resp.FileEncSHA256, appInfo, false, &resp) + return +} + +// UploadReader uploads the given attachment to WhatsApp servers. +// +// This is otherwise identical to [Upload], but it reads the plaintext from an [io.Reader] instead of a byte slice. +// A temporary file is required for the encryption process. If tempFile is nil, a temporary file will be created +// and deleted after the upload. +// +// To use only one file, pass the same file as both plaintext and tempFile. This will cause the file to be overwritten with encrypted data. +func (cli *Client) UploadReader(ctx context.Context, plaintext io.Reader, tempFile io.ReadWriteSeeker, appInfo MediaType) (resp UploadResponse, err error) { + resp.MediaKey = random.Bytes(32) + iv, cipherKey, macKey, _ := getMediaKeys(resp.MediaKey, appInfo) + if tempFile == nil { + tempFile, err = os.CreateTemp("", "whatsmeow-upload-*") + if err != nil { + err = fmt.Errorf("failed to create temporary file: %w", err) + return + } + defer func() { + tempFileFile := tempFile.(*os.File) + _ = tempFileFile.Close() + _ = os.Remove(tempFileFile.Name()) + }() + } + resp.FileSHA256, resp.FileEncSHA256, resp.FileLength, err = cbcutil.EncryptStream(cipherKey, iv, macKey, plaintext, tempFile) + if err != nil { + err = fmt.Errorf("failed to encrypt file: %w", err) + return + } + _, err = tempFile.Seek(0, io.SeekStart) + if err != nil { + err = fmt.Errorf("failed to seek to start of temporary file: %w", err) + return + } + err = cli.rawUpload(ctx, tempFile, resp.FileEncSHA256, appInfo, false, &resp) return } // UploadNewsletter uploads the given attachment to WhatsApp servers without encrypting it first. // // Newsletter media works mostly the same way as normal media, with a few differences: -// * Since it's unencrypted, there's no MediaKey or FileEncSha256 fields. +// * Since it's unencrypted, there's no MediaKey or FileEncSHA256 fields. // * There's a "media handle" that needs to be passed in SendRequestExtra. // // Example: @@ -102,19 +140,19 @@ func (cli *Client) Upload(ctx context.Context, plaintext []byte, appInfo MediaTy // resp, err := cli.UploadNewsletter(context.Background(), yourImageBytes, whatsmeow.MediaImage) // // handle error // -// imageMsg := &waProto.ImageMessage{ +// imageMsg := &waE2E.ImageMessage{ // // Caption, mime type and other such fields work like normal // Caption: proto.String("Hello, world!"), // Mimetype: proto.String("image/png"), // // // URL and direct path are also there like normal media -// Url: &resp.URL, +// URL: &resp.URL, // DirectPath: &resp.DirectPath, -// FileSha256: resp.FileSha256, +// FileSHA256: resp.FileSHA256, // FileLength: &resp.FileLength, // // Newsletter media isn't encrypted, so the media key and file enc sha fields are not applicable // } -// _, err = cli.SendMessage(context.Background(), newsletterJID, &waProto.Message{ +// _, err = cli.SendMessage(context.Background(), newsletterJID, &waE2E.Message{ // ImageMessage: imageMsg, // }, whatsmeow.SendRequestExtra{ // // Unlike normal media, newsletters also include a "media handle" in the send request. @@ -125,11 +163,31 @@ func (cli *Client) UploadNewsletter(ctx context.Context, data []byte, appInfo Me resp.FileLength = uint64(len(data)) hash := sha256.Sum256(data) resp.FileSHA256 = hash[:] + err = cli.rawUpload(ctx, bytes.NewReader(data), resp.FileSHA256, appInfo, true, &resp) + return +} + +// UploadNewsletterReader uploads the given attachment to WhatsApp servers without encrypting it first. +// +// This is otherwise identical to [UploadNewsletter], but it reads the plaintext from an [io.Reader] instead of a byte slice. +// Unlike [UploadReader], this does not require a temporary file. However, the data needs to be hashed first, +// so an [io.ReadSeeker] is required to be able to read the data twice. +func (cli *Client) UploadNewsletterReader(ctx context.Context, data io.ReadSeeker, appInfo MediaType) (resp UploadResponse, err error) { + hasher := sha256.New() + var fileLength int64 + fileLength, err = io.Copy(hasher, data) + resp.FileLength = uint64(fileLength) + resp.FileSHA256 = hasher.Sum(nil) + _, err = data.Seek(0, io.SeekStart) + if err != nil { + err = fmt.Errorf("failed to seek to start of data: %w", err) + return + } err = cli.rawUpload(ctx, data, resp.FileSHA256, appInfo, true, &resp) return } -func (cli *Client) rawUpload(ctx context.Context, dataToUpload, fileHash []byte, appInfo MediaType, newsletter bool, resp *UploadResponse) error { +func (cli *Client) rawUpload(ctx context.Context, dataToUpload io.Reader, fileHash []byte, appInfo MediaType, newsletter bool, resp *UploadResponse) error { mediaConn, err := cli.refreshMediaConn(false) if err != nil { return fmt.Errorf("failed to refresh media connections: %w", err) @@ -168,7 +226,7 @@ func (cli *Client) rawUpload(ctx context.Context, dataToUpload, fileHash []byte, RawQuery: q.Encode(), } - req, err := http.NewRequestWithContext(ctx, http.MethodPost, uploadURL.String(), bytes.NewReader(dataToUpload)) + req, err := http.NewRequestWithContext(ctx, http.MethodPost, uploadURL.String(), dataToUpload) if err != nil { return fmt.Errorf("failed to prepare request: %w", err) } diff --git a/vendor/go.mau.fi/whatsmeow/user.go b/vendor/go.mau.fi/whatsmeow/user.go index 7e6aaded..58fb6328 100644 --- a/vendor/go.mau.fi/whatsmeow/user.go +++ b/vendor/go.mau.fi/whatsmeow/user.go @@ -227,6 +227,107 @@ func (cli *Client) GetUserInfo(jids []types.JID) (map[types.JID]types.UserInfo, return respData, nil } +func (cli *Client) GetBotListV2() ([]types.BotListInfo, error) { + resp, err := cli.sendIQ(infoQuery{ + To: types.ServerJID, + Namespace: "bot", + Type: iqGet, + Content: []waBinary.Node{ + {Tag: "bot", Attrs: waBinary.Attrs{"v": "2"}}, + }, + }) + if err != nil { + return nil, err + } + botNode, ok := resp.GetOptionalChildByTag("bot") + if !ok { + return nil, &ElementMissingError{Tag: "bot", In: "response to bot list query"} + } + + var list []types.BotListInfo + + for _, section := range botNode.GetChildrenByTag("section") { + if section.AttrGetter().String("type") == "all" { + for _, bot := range section.GetChildrenByTag("bot") { + ag := bot.AttrGetter() + list = append(list, types.BotListInfo{ + PersonaID: ag.String("persona_id"), + BotJID: ag.JID("jid"), + }) + } + } + } + + return list, nil +} + +func (cli *Client) GetBotProfiles(botInfo []types.BotListInfo) ([]types.BotProfileInfo, error) { + jids := make([]types.JID, len(botInfo)) + for i, bot := range botInfo { + jids[i] = bot.BotJID + } + + list, err := cli.usync(context.TODO(), jids, "query", "interactive", []waBinary.Node{ + {Tag: "bot", Content: []waBinary.Node{{Tag: "profile", Attrs: waBinary.Attrs{"v": "1"}}}}, + }, UsyncQueryExtras{ + BotListInfo: botInfo, + }) + + if err != nil { + return nil, err + } + + var profiles []types.BotProfileInfo + for _, user := range list.GetChildren() { + jid := user.AttrGetter().JID("jid") + bot := user.GetChildByTag("bot") + profile := bot.GetChildByTag("profile") + name := string(profile.GetChildByTag("name").Content.([]byte)) + attributes := string(profile.GetChildByTag("attributes").Content.([]byte)) + description := string(profile.GetChildByTag("description").Content.([]byte)) + category := string(profile.GetChildByTag("category").Content.([]byte)) + _, isDefault := profile.GetOptionalChildByTag("default") + personaID := profile.AttrGetter().String("persona_id") + commandsNode := profile.GetChildByTag("commands") + commandDescription := string(commandsNode.GetChildByTag("description").Content.([]byte)) + var commands []types.BotProfileCommand + for _, commandNode := range commandsNode.GetChildrenByTag("command") { + commands = append(commands, types.BotProfileCommand{ + Name: string(commandNode.GetChildByTag("name").Content.([]byte)), + Description: string(commandNode.GetChildByTag("description").Content.([]byte)), + }) + } + + promptsNode := profile.GetChildByTag("prompts") + var prompts []string + for _, promptNode := range promptsNode.GetChildrenByTag("prompt") { + prompts = append( + prompts, + fmt.Sprintf( + "%s %s", + string(promptNode.GetChildByTag("emoji").Content.([]byte)), + string(promptNode.GetChildByTag("text").Content.([]byte)), + ), + ) + } + + profiles = append(profiles, types.BotProfileInfo{ + JID: jid, + Name: name, + Attributes: attributes, + Description: description, + Category: category, + IsDefault: isDefault, + Prompts: prompts, + PersonaID: personaID, + Commands: commands, + CommandsDescription: commandDescription, + }) + } + + return profiles, nil +} + func (cli *Client) parseBusinessProfile(node *waBinary.Node) (*types.BusinessProfile, error) { profileNode := node.GetChildByTag("profile") jid, ok := profileNode.AttrGetter().GetJID("jid", true) @@ -330,6 +431,9 @@ func (cli *Client) GetUserDevicesContext(ctx context.Context, jids []types.JID) devices = append(devices, cached.devices...) } else if jid.Server == types.MessengerServer { fbJIDsToSync = append(fbJIDsToSync, jid) + } else if jid.IsBot() { + // Bot JIDs do not have devices, the usync query is empty + devices = append(devices, jid) } else { jidsToSync = append(jidsToSync, jid) } @@ -619,11 +723,23 @@ func (cli *Client) getFBIDDevices(ctx context.Context, jids []types.JID) (*waBin } } -func (cli *Client) usync(ctx context.Context, jids []types.JID, mode, context string, query []waBinary.Node) (*waBinary.Node, error) { +type UsyncQueryExtras struct { + BotListInfo []types.BotListInfo +} + +func (cli *Client) usync(ctx context.Context, jids []types.JID, mode, context string, query []waBinary.Node, extra ...UsyncQueryExtras) (*waBinary.Node, error) { + var extras UsyncQueryExtras + if len(extra) > 1 { + return nil, errors.New("only one extra parameter may be provided to usync()") + } else if len(extra) == 1 { + extras = extra[0] + } + userList := make([]waBinary.Node, len(jids)) for i, jid := range jids { userList[i].Tag = "user" jid = jid.ToNonAD() + switch jid.Server { case types.LegacyUserServer: userList[i].Content = []waBinary.Node{{ @@ -632,6 +748,21 @@ func (cli *Client) usync(ctx context.Context, jids []types.JID, mode, context st }} case types.DefaultUserServer: userList[i].Attrs = waBinary.Attrs{"jid": jid} + if jid.IsBot() { + var personaId string + for _, bot := range extras.BotListInfo { + if bot.BotJID.User == jid.User { + personaId = bot.PersonaID + } + } + userList[i].Content = []waBinary.Node{{ + Tag: "bot", + Content: []waBinary.Node{{ + Tag: "profile", + Attrs: waBinary.Attrs{"persona_id": personaId}, + }}, + }} + } default: return nil, fmt.Errorf("unknown user server '%s'", jid.Server) } diff --git a/vendor/go.mau.fi/whatsmeow/util/cbcutil/cbc.go b/vendor/go.mau.fi/whatsmeow/util/cbcutil/cbc.go index 05fa8577..ef03b4c0 100644 --- a/vendor/go.mau.fi/whatsmeow/util/cbcutil/cbc.go +++ b/vendor/go.mau.fi/whatsmeow/util/cbcutil/cbc.go @@ -18,9 +18,13 @@ import ( "bytes" "crypto/aes" "crypto/cipher" + "crypto/hmac" "crypto/rand" + "crypto/sha256" + "errors" "fmt" "io" + "os" ) /* @@ -28,26 +32,78 @@ Decrypt is a function that decrypts a given cipher text with a provided key and */ func Decrypt(key, iv, ciphertext []byte) ([]byte, error) { block, err := aes.NewCipher(key) - if err != nil { return nil, err - } - - if len(ciphertext) < aes.BlockSize { + } else if len(ciphertext) < aes.BlockSize { return nil, fmt.Errorf("ciphertext is shorter then block size: %d / %d", len(ciphertext), aes.BlockSize) } - if iv == nil { - iv = ciphertext[:aes.BlockSize] - ciphertext = ciphertext[aes.BlockSize:] - } - cbc := cipher.NewCBCDecrypter(block, iv) cbc.CryptBlocks(ciphertext, ciphertext) return unpad(ciphertext) } +type File interface { + io.Reader + io.WriterAt + Truncate(size int64) error + Stat() (os.FileInfo, error) +} + +func DecryptFile(key, iv []byte, file File) error { + block, err := aes.NewCipher(key) + if err != nil { + return err + } + cbc := cipher.NewCBCDecrypter(block, iv) + stat, err := file.Stat() + if err != nil { + return fmt.Errorf("failed to stat file: %w", err) + } + fileSize := stat.Size() + if fileSize%aes.BlockSize != 0 { + return fmt.Errorf("file size is not a multiple of the block size: %d / %d", fileSize, aes.BlockSize) + } + + var bufSize int64 = 32 * 1024 + if fileSize < bufSize { + bufSize = fileSize + } + buf := make([]byte, bufSize) + var writePtr int64 + var lastByte byte + for writePtr < fileSize { + if writePtr+bufSize > fileSize { + buf = buf[:fileSize-writePtr] + } + var n int + n, err = io.ReadFull(file, buf) + if err != nil { + return fmt.Errorf("failed to read file: %w", err) + } else if n != len(buf) { + return fmt.Errorf("failed to read full buffer: %d / %d", n, len(buf)) + } + cbc.CryptBlocks(buf, buf) + n, err = file.WriteAt(buf, writePtr) + if err != nil { + return fmt.Errorf("failed to write file: %w", err) + } else if n != len(buf) { + return fmt.Errorf("failed to write full buffer: %d / %d", n, len(buf)) + } + writePtr += int64(len(buf)) + lastByte = buf[len(buf)-1] + } + if int64(lastByte) > fileSize { + return fmt.Errorf("padding is greater then the length: %d / %d", lastByte, fileSize) + } + err = file.Truncate(fileSize - int64(lastByte)) + if err != nil { + return fmt.Errorf("failed to truncate file to remove padding: %w", err) + } + return nil +} + /* Encrypt is a function that encrypts plaintext with a given key and an optional initialization vector(iv). */ @@ -99,3 +155,59 @@ func unpad(src []byte) ([]byte, error) { return src[:(length - padLen)], nil } + +func EncryptStream(key, iv, macKey []byte, plaintext io.Reader, ciphertext io.Writer) ([]byte, []byte, uint64, error) { + block, err := aes.NewCipher(key) + if err != nil { + return nil, nil, 0, fmt.Errorf("failed to create cipher: %w", err) + } + cbc := cipher.NewCBCEncrypter(block, iv) + + plainHasher := sha256.New() + cipherHasher := sha256.New() + cipherMAC := hmac.New(sha256.New, macKey) + cipherMAC.Write(iv) + + writerAt, hasWriterAt := ciphertext.(io.WriterAt) + + buf := make([]byte, 32*1024) + var size int + var writePtr int64 + hasMore := true + for hasMore { + var n int + n, err = io.ReadFull(plaintext, buf) + plainHasher.Write(buf[:n]) + size += n + if errors.Is(err, io.EOF) || errors.Is(err, io.ErrUnexpectedEOF) { + padding := aes.BlockSize - size%aes.BlockSize + buf = append(buf[:n], bytes.Repeat([]byte{byte(padding)}, padding)...) + hasMore = false + } else if err != nil { + return nil, nil, 0, fmt.Errorf("failed to read file: %w", err) + } + cbc.CryptBlocks(buf, buf) + cipherMAC.Write(buf) + cipherHasher.Write(buf) + if hasWriterAt { + _, err = writerAt.WriteAt(buf, writePtr) + writePtr += int64(len(buf)) + } else { + _, err = ciphertext.Write(buf) + } + if err != nil { + return nil, nil, 0, fmt.Errorf("failed to write file: %w", err) + } + } + mac := cipherMAC.Sum(nil)[:10] + cipherHasher.Write(mac) + if hasWriterAt { + _, err = writerAt.WriteAt(mac, writePtr) + } else { + _, err = ciphertext.Write(mac) + } + if err != nil { + return nil, nil, 0, fmt.Errorf("failed to write checksum to file: %w", err) + } + return plainHasher.Sum(nil), cipherHasher.Sum(nil), uint64(size), nil +} diff --git a/vendor/go.opentelemetry.io/otel/codes/codes.go b/vendor/go.opentelemetry.io/otel/codes/codes.go index df29d96a..2acbac35 100644 --- a/vendor/go.opentelemetry.io/otel/codes/codes.go +++ b/vendor/go.opentelemetry.io/otel/codes/codes.go @@ -83,7 +83,7 @@ func (c *Code) UnmarshalJSON(b []byte) error { return fmt.Errorf("invalid code: %q", ci) } - *c = Code(ci) + *c = Code(ci) // nolint: gosec // Bit size of 32 check above. return nil } return fmt.Errorf("invalid code: %q", string(b)) diff --git a/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go b/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go index f32766e5..822d8479 100644 --- a/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go +++ b/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go @@ -14,33 +14,33 @@ import ( // BoolSliceValue converts a bool slice into an array with same elements as slice. func BoolSliceValue(v []bool) interface{} { var zero bool - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) - copy(cp.Elem().Slice(0, len(v)).Interface().([]bool), v) - return cp.Elem().Interface() + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem() + reflect.Copy(cp, reflect.ValueOf(v)) + return cp.Interface() } // Int64SliceValue converts an int64 slice into an array with same elements as slice. func Int64SliceValue(v []int64) interface{} { var zero int64 - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) - copy(cp.Elem().Slice(0, len(v)).Interface().([]int64), v) - return cp.Elem().Interface() + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem() + reflect.Copy(cp, reflect.ValueOf(v)) + return cp.Interface() } // Float64SliceValue converts a float64 slice into an array with same elements as slice. func Float64SliceValue(v []float64) interface{} { var zero float64 - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) - copy(cp.Elem().Slice(0, len(v)).Interface().([]float64), v) - return cp.Elem().Interface() + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem() + reflect.Copy(cp, reflect.ValueOf(v)) + return cp.Interface() } // StringSliceValue converts a string slice into an array with same elements as slice. func StringSliceValue(v []string) interface{} { var zero string - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) - copy(cp.Elem().Slice(0, len(v)).Interface().([]string), v) - return cp.Elem().Interface() + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem() + reflect.Copy(cp, reflect.ValueOf(v)) + return cp.Interface() } // AsBoolSlice converts a bool array into a slice into with same elements as array. diff --git a/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go b/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go index 3e7bb3b3..9b1da2c0 100644 --- a/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go +++ b/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go @@ -24,7 +24,8 @@ func Int64ToRaw(i int64) uint64 { } func RawToInt64(r uint64) int64 { - return int64(r) + // Assumes original was a valid int64 (overflow not checked). + return int64(r) // nolint: gosec } func Float64ToRaw(f float64) uint64 { @@ -36,9 +37,11 @@ func RawToFloat64(r uint64) float64 { } func RawPtrToFloat64Ptr(r *uint64) *float64 { - return (*float64)(unsafe.Pointer(r)) + // Assumes original was a valid *float64 (overflow not checked). + return (*float64)(unsafe.Pointer(r)) // nolint: gosec } func RawPtrToInt64Ptr(r *uint64) *int64 { - return (*int64)(unsafe.Pointer(r)) + // Assumes original was a valid *int64 (overflow not checked). + return (*int64)(unsafe.Pointer(r)) // nolint: gosec } diff --git a/vendor/go.opentelemetry.io/otel/trace/context.go b/vendor/go.opentelemetry.io/otel/trace/context.go index 5650a174..8c45a710 100644 --- a/vendor/go.opentelemetry.io/otel/trace/context.go +++ b/vendor/go.opentelemetry.io/otel/trace/context.go @@ -22,7 +22,7 @@ func ContextWithSpanContext(parent context.Context, sc SpanContext) context.Cont return ContextWithSpan(parent, nonRecordingSpan{sc: sc}) } -// ContextWithRemoteSpanContext returns a copy of parent with rsc set explicly +// ContextWithRemoteSpanContext returns a copy of parent with rsc set explicitly // as a remote SpanContext and as the current Span. The Span implementation // that wraps rsc is non-recording and performs no operations other than to // return rsc as the SpanContext from the SpanContext method. diff --git a/vendor/go.opentelemetry.io/otel/trace/doc.go b/vendor/go.opentelemetry.io/otel/trace/doc.go index d661c5d1..cdbf41d6 100644 --- a/vendor/go.opentelemetry.io/otel/trace/doc.go +++ b/vendor/go.opentelemetry.io/otel/trace/doc.go @@ -96,7 +96,7 @@ can embed the API interface directly. This option is not recommended. It will lead to publishing packages that contain runtime panics when users update to newer versions of -[go.opentelemetry.io/otel/trace], which may be done with a trasitive +[go.opentelemetry.io/otel/trace], which may be done with a transitive dependency. Finally, an author can embed another implementation in theirs. The embedded diff --git a/vendor/go.opentelemetry.io/otel/trace/provider.go b/vendor/go.opentelemetry.io/otel/trace/provider.go new file mode 100644 index 00000000..ef85cb70 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/provider.go @@ -0,0 +1,59 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package trace // import "go.opentelemetry.io/otel/trace" + +import "go.opentelemetry.io/otel/trace/embedded" + +// TracerProvider provides Tracers that are used by instrumentation code to +// trace computational workflows. +// +// A TracerProvider is the collection destination of all Spans from Tracers it +// provides, it represents a unique telemetry collection pipeline. How that +// pipeline is defined, meaning how those Spans are collected, processed, and +// where they are exported, depends on its implementation. Instrumentation +// authors do not need to define this implementation, rather just use the +// provided Tracers to instrument code. +// +// Commonly, instrumentation code will accept a TracerProvider implementation +// at runtime from its users or it can simply use the globally registered one +// (see https://pkg.go.dev/go.opentelemetry.io/otel#GetTracerProvider). +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type TracerProvider interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.TracerProvider + + // Tracer returns a unique Tracer scoped to be used by instrumentation code + // to trace computational workflows. The scope and identity of that + // instrumentation code is uniquely defined by the name and options passed. + // + // The passed name needs to uniquely identify instrumentation code. + // Therefore, it is recommended that name is the Go package name of the + // library providing instrumentation (note: not the code being + // instrumented). Instrumentation libraries can have multiple versions, + // therefore, the WithInstrumentationVersion option should be used to + // distinguish these different codebases. Additionally, instrumentation + // libraries may sometimes use traces to communicate different domains of + // workflow data (i.e. using spans to communicate workflow events only). If + // this is the case, the WithScopeAttributes option should be used to + // uniquely identify Tracers that handle the different domains of workflow + // data. + // + // If the same name and options are passed multiple times, the same Tracer + // will be returned (it is up to the implementation if this will be the + // same underlying instance of that Tracer or not). It is not necessary to + // call this multiple times with the same name and options to get an + // up-to-date Tracer. All implementations will ensure any TracerProvider + // configuration changes are propagated to all provided Tracers. + // + // If name is empty, then an implementation defined default name will be + // used instead. + // + // This method is safe to call concurrently. + Tracer(name string, options ...TracerOption) Tracer +} diff --git a/vendor/go.opentelemetry.io/otel/trace/span.go b/vendor/go.opentelemetry.io/otel/trace/span.go new file mode 100644 index 00000000..d3aa476e --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/span.go @@ -0,0 +1,177 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package trace // import "go.opentelemetry.io/otel/trace" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace/embedded" +) + +// Span is the individual component of a trace. It represents a single named +// and timed operation of a workflow that is traced. A Tracer is used to +// create a Span and it is then up to the operation the Span represents to +// properly end the Span when the operation itself ends. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Span interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Span + + // End completes the Span. The Span is considered complete and ready to be + // delivered through the rest of the telemetry pipeline after this method + // is called. Therefore, updates to the Span are not allowed after this + // method has been called. + End(options ...SpanEndOption) + + // AddEvent adds an event with the provided name and options. + AddEvent(name string, options ...EventOption) + + // AddLink adds a link. + // Adding links at span creation using WithLinks is preferred to calling AddLink + // later, for contexts that are available during span creation, because head + // sampling decisions can only consider information present during span creation. + AddLink(link Link) + + // IsRecording returns the recording state of the Span. It will return + // true if the Span is active and events can be recorded. + IsRecording() bool + + // RecordError will record err as an exception span event for this span. An + // additional call to SetStatus is required if the Status of the Span should + // be set to Error, as this method does not change the Span status. If this + // span is not being recorded or err is nil then this method does nothing. + RecordError(err error, options ...EventOption) + + // SpanContext returns the SpanContext of the Span. The returned SpanContext + // is usable even after the End method has been called for the Span. + SpanContext() SpanContext + + // SetStatus sets the status of the Span in the form of a code and a + // description, provided the status hasn't already been set to a higher + // value before (OK > Error > Unset). The description is only included in a + // status when the code is for an error. + SetStatus(code codes.Code, description string) + + // SetName sets the Span name. + SetName(name string) + + // SetAttributes sets kv as attributes of the Span. If a key from kv + // already exists for an attribute of the Span it will be overwritten with + // the value contained in kv. + SetAttributes(kv ...attribute.KeyValue) + + // TracerProvider returns a TracerProvider that can be used to generate + // additional Spans on the same telemetry pipeline as the current Span. + TracerProvider() TracerProvider +} + +// Link is the relationship between two Spans. The relationship can be within +// the same Trace or across different Traces. +// +// For example, a Link is used in the following situations: +// +// 1. Batch Processing: A batch of operations may contain operations +// associated with one or more traces/spans. Since there can only be one +// parent SpanContext, a Link is used to keep reference to the +// SpanContext of all operations in the batch. +// 2. Public Endpoint: A SpanContext for an in incoming client request on a +// public endpoint should be considered untrusted. In such a case, a new +// trace with its own identity and sampling decision needs to be created, +// but this new trace needs to be related to the original trace in some +// form. A Link is used to keep reference to the original SpanContext and +// track the relationship. +type Link struct { + // SpanContext of the linked Span. + SpanContext SpanContext + + // Attributes describe the aspects of the link. + Attributes []attribute.KeyValue +} + +// LinkFromContext returns a link encapsulating the SpanContext in the provided +// ctx. +func LinkFromContext(ctx context.Context, attrs ...attribute.KeyValue) Link { + return Link{ + SpanContext: SpanContextFromContext(ctx), + Attributes: attrs, + } +} + +// SpanKind is the role a Span plays in a Trace. +type SpanKind int + +// As a convenience, these match the proto definition, see +// https://github.com/open-telemetry/opentelemetry-proto/blob/30d237e1ff3ab7aa50e0922b5bebdd93505090af/opentelemetry/proto/trace/v1/trace.proto#L101-L129 +// +// The unspecified value is not a valid `SpanKind`. Use `ValidateSpanKind()` +// to coerce a span kind to a valid value. +const ( + // SpanKindUnspecified is an unspecified SpanKind and is not a valid + // SpanKind. SpanKindUnspecified should be replaced with SpanKindInternal + // if it is received. + SpanKindUnspecified SpanKind = 0 + // SpanKindInternal is a SpanKind for a Span that represents an internal + // operation within an application. + SpanKindInternal SpanKind = 1 + // SpanKindServer is a SpanKind for a Span that represents the operation + // of handling a request from a client. + SpanKindServer SpanKind = 2 + // SpanKindClient is a SpanKind for a Span that represents the operation + // of client making a request to a server. + SpanKindClient SpanKind = 3 + // SpanKindProducer is a SpanKind for a Span that represents the operation + // of a producer sending a message to a message broker. Unlike + // SpanKindClient and SpanKindServer, there is often no direct + // relationship between this kind of Span and a SpanKindConsumer kind. A + // SpanKindProducer Span will end once the message is accepted by the + // message broker which might not overlap with the processing of that + // message. + SpanKindProducer SpanKind = 4 + // SpanKindConsumer is a SpanKind for a Span that represents the operation + // of a consumer receiving a message from a message broker. Like + // SpanKindProducer Spans, there is often no direct relationship between + // this Span and the Span that produced the message. + SpanKindConsumer SpanKind = 5 +) + +// ValidateSpanKind returns a valid span kind value. This will coerce +// invalid values into the default value, SpanKindInternal. +func ValidateSpanKind(spanKind SpanKind) SpanKind { + switch spanKind { + case SpanKindInternal, + SpanKindServer, + SpanKindClient, + SpanKindProducer, + SpanKindConsumer: + // valid + return spanKind + default: + return SpanKindInternal + } +} + +// String returns the specified name of the SpanKind in lower-case. +func (sk SpanKind) String() string { + switch sk { + case SpanKindInternal: + return "internal" + case SpanKindServer: + return "server" + case SpanKindClient: + return "client" + case SpanKindProducer: + return "producer" + case SpanKindConsumer: + return "consumer" + default: + return "unspecified" + } +} diff --git a/vendor/go.opentelemetry.io/otel/trace/trace.go b/vendor/go.opentelemetry.io/otel/trace/trace.go index 28877d4a..d49adf67 100644 --- a/vendor/go.opentelemetry.io/otel/trace/trace.go +++ b/vendor/go.opentelemetry.io/otel/trace/trace.go @@ -5,13 +5,8 @@ package trace // import "go.opentelemetry.io/otel/trace" import ( "bytes" - "context" "encoding/hex" "encoding/json" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/trace/embedded" ) const ( @@ -326,247 +321,3 @@ func (sc SpanContext) MarshalJSON() ([]byte, error) { Remote: sc.remote, }) } - -// Span is the individual component of a trace. It represents a single named -// and timed operation of a workflow that is traced. A Tracer is used to -// create a Span and it is then up to the operation the Span represents to -// properly end the Span when the operation itself ends. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Span interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Span - - // End completes the Span. The Span is considered complete and ready to be - // delivered through the rest of the telemetry pipeline after this method - // is called. Therefore, updates to the Span are not allowed after this - // method has been called. - End(options ...SpanEndOption) - - // AddEvent adds an event with the provided name and options. - AddEvent(name string, options ...EventOption) - - // AddLink adds a link. - // Adding links at span creation using WithLinks is preferred to calling AddLink - // later, for contexts that are available during span creation, because head - // sampling decisions can only consider information present during span creation. - AddLink(link Link) - - // IsRecording returns the recording state of the Span. It will return - // true if the Span is active and events can be recorded. - IsRecording() bool - - // RecordError will record err as an exception span event for this span. An - // additional call to SetStatus is required if the Status of the Span should - // be set to Error, as this method does not change the Span status. If this - // span is not being recorded or err is nil then this method does nothing. - RecordError(err error, options ...EventOption) - - // SpanContext returns the SpanContext of the Span. The returned SpanContext - // is usable even after the End method has been called for the Span. - SpanContext() SpanContext - - // SetStatus sets the status of the Span in the form of a code and a - // description, provided the status hasn't already been set to a higher - // value before (OK > Error > Unset). The description is only included in a - // status when the code is for an error. - SetStatus(code codes.Code, description string) - - // SetName sets the Span name. - SetName(name string) - - // SetAttributes sets kv as attributes of the Span. If a key from kv - // already exists for an attribute of the Span it will be overwritten with - // the value contained in kv. - SetAttributes(kv ...attribute.KeyValue) - - // TracerProvider returns a TracerProvider that can be used to generate - // additional Spans on the same telemetry pipeline as the current Span. - TracerProvider() TracerProvider -} - -// Link is the relationship between two Spans. The relationship can be within -// the same Trace or across different Traces. -// -// For example, a Link is used in the following situations: -// -// 1. Batch Processing: A batch of operations may contain operations -// associated with one or more traces/spans. Since there can only be one -// parent SpanContext, a Link is used to keep reference to the -// SpanContext of all operations in the batch. -// 2. Public Endpoint: A SpanContext for an in incoming client request on a -// public endpoint should be considered untrusted. In such a case, a new -// trace with its own identity and sampling decision needs to be created, -// but this new trace needs to be related to the original trace in some -// form. A Link is used to keep reference to the original SpanContext and -// track the relationship. -type Link struct { - // SpanContext of the linked Span. - SpanContext SpanContext - - // Attributes describe the aspects of the link. - Attributes []attribute.KeyValue -} - -// LinkFromContext returns a link encapsulating the SpanContext in the provided ctx. -func LinkFromContext(ctx context.Context, attrs ...attribute.KeyValue) Link { - return Link{ - SpanContext: SpanContextFromContext(ctx), - Attributes: attrs, - } -} - -// SpanKind is the role a Span plays in a Trace. -type SpanKind int - -// As a convenience, these match the proto definition, see -// https://github.com/open-telemetry/opentelemetry-proto/blob/30d237e1ff3ab7aa50e0922b5bebdd93505090af/opentelemetry/proto/trace/v1/trace.proto#L101-L129 -// -// The unspecified value is not a valid `SpanKind`. Use `ValidateSpanKind()` -// to coerce a span kind to a valid value. -const ( - // SpanKindUnspecified is an unspecified SpanKind and is not a valid - // SpanKind. SpanKindUnspecified should be replaced with SpanKindInternal - // if it is received. - SpanKindUnspecified SpanKind = 0 - // SpanKindInternal is a SpanKind for a Span that represents an internal - // operation within an application. - SpanKindInternal SpanKind = 1 - // SpanKindServer is a SpanKind for a Span that represents the operation - // of handling a request from a client. - SpanKindServer SpanKind = 2 - // SpanKindClient is a SpanKind for a Span that represents the operation - // of client making a request to a server. - SpanKindClient SpanKind = 3 - // SpanKindProducer is a SpanKind for a Span that represents the operation - // of a producer sending a message to a message broker. Unlike - // SpanKindClient and SpanKindServer, there is often no direct - // relationship between this kind of Span and a SpanKindConsumer kind. A - // SpanKindProducer Span will end once the message is accepted by the - // message broker which might not overlap with the processing of that - // message. - SpanKindProducer SpanKind = 4 - // SpanKindConsumer is a SpanKind for a Span that represents the operation - // of a consumer receiving a message from a message broker. Like - // SpanKindProducer Spans, there is often no direct relationship between - // this Span and the Span that produced the message. - SpanKindConsumer SpanKind = 5 -) - -// ValidateSpanKind returns a valid span kind value. This will coerce -// invalid values into the default value, SpanKindInternal. -func ValidateSpanKind(spanKind SpanKind) SpanKind { - switch spanKind { - case SpanKindInternal, - SpanKindServer, - SpanKindClient, - SpanKindProducer, - SpanKindConsumer: - // valid - return spanKind - default: - return SpanKindInternal - } -} - -// String returns the specified name of the SpanKind in lower-case. -func (sk SpanKind) String() string { - switch sk { - case SpanKindInternal: - return "internal" - case SpanKindServer: - return "server" - case SpanKindClient: - return "client" - case SpanKindProducer: - return "producer" - case SpanKindConsumer: - return "consumer" - default: - return "unspecified" - } -} - -// Tracer is the creator of Spans. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Tracer interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Tracer - - // Start creates a span and a context.Context containing the newly-created span. - // - // If the context.Context provided in `ctx` contains a Span then the newly-created - // Span will be a child of that span, otherwise it will be a root span. This behavior - // can be overridden by providing `WithNewRoot()` as a SpanOption, causing the - // newly-created Span to be a root span even if `ctx` contains a Span. - // - // When creating a Span it is recommended to provide all known span attributes using - // the `WithAttributes()` SpanOption as samplers will only have access to the - // attributes provided when a Span is created. - // - // Any Span that is created MUST also be ended. This is the responsibility of the user. - // Implementations of this API may leak memory or other resources if Spans are not ended. - Start(ctx context.Context, spanName string, opts ...SpanStartOption) (context.Context, Span) -} - -// TracerProvider provides Tracers that are used by instrumentation code to -// trace computational workflows. -// -// A TracerProvider is the collection destination of all Spans from Tracers it -// provides, it represents a unique telemetry collection pipeline. How that -// pipeline is defined, meaning how those Spans are collected, processed, and -// where they are exported, depends on its implementation. Instrumentation -// authors do not need to define this implementation, rather just use the -// provided Tracers to instrument code. -// -// Commonly, instrumentation code will accept a TracerProvider implementation -// at runtime from its users or it can simply use the globally registered one -// (see https://pkg.go.dev/go.opentelemetry.io/otel#GetTracerProvider). -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type TracerProvider interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.TracerProvider - - // Tracer returns a unique Tracer scoped to be used by instrumentation code - // to trace computational workflows. The scope and identity of that - // instrumentation code is uniquely defined by the name and options passed. - // - // The passed name needs to uniquely identify instrumentation code. - // Therefore, it is recommended that name is the Go package name of the - // library providing instrumentation (note: not the code being - // instrumented). Instrumentation libraries can have multiple versions, - // therefore, the WithInstrumentationVersion option should be used to - // distinguish these different codebases. Additionally, instrumentation - // libraries may sometimes use traces to communicate different domains of - // workflow data (i.e. using spans to communicate workflow events only). If - // this is the case, the WithScopeAttributes option should be used to - // uniquely identify Tracers that handle the different domains of workflow - // data. - // - // If the same name and options are passed multiple times, the same Tracer - // will be returned (it is up to the implementation if this will be the - // same underlying instance of that Tracer or not). It is not necessary to - // call this multiple times with the same name and options to get an - // up-to-date Tracer. All implementations will ensure any TracerProvider - // configuration changes are propagated to all provided Tracers. - // - // If name is empty, then an implementation defined default name will be - // used instead. - // - // This method is safe to call concurrently. - Tracer(name string, options ...TracerOption) Tracer -} diff --git a/vendor/go.opentelemetry.io/otel/trace/tracer.go b/vendor/go.opentelemetry.io/otel/trace/tracer.go new file mode 100644 index 00000000..77952d2a --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/tracer.go @@ -0,0 +1,37 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package trace // import "go.opentelemetry.io/otel/trace" + +import ( + "context" + + "go.opentelemetry.io/otel/trace/embedded" +) + +// Tracer is the creator of Spans. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Tracer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Tracer + + // Start creates a span and a context.Context containing the newly-created span. + // + // If the context.Context provided in `ctx` contains a Span then the newly-created + // Span will be a child of that span, otherwise it will be a root span. This behavior + // can be overridden by providing `WithNewRoot()` as a SpanOption, causing the + // newly-created Span to be a root span even if `ctx` contains a Span. + // + // When creating a Span it is recommended to provide all known span attributes using + // the `WithAttributes()` SpanOption as samplers will only have access to the + // attributes provided when a Span is created. + // + // Any Span that is created MUST also be ended. This is the responsibility of the user. + // Implementations of this API may leak memory or other resources if Spans are not ended. + Start(ctx context.Context, spanName string, opts ...SpanStartOption) (context.Context, Span) +} diff --git a/vendor/go.opentelemetry.io/otel/trace/tracestate.go b/vendor/go.opentelemetry.io/otel/trace/tracestate.go index 20b5cf24..dc5e34ca 100644 --- a/vendor/go.opentelemetry.io/otel/trace/tracestate.go +++ b/vendor/go.opentelemetry.io/otel/trace/tracestate.go @@ -260,6 +260,16 @@ func (ts TraceState) Get(key string) string { return "" } +// Walk walks all key value pairs in the TraceState by calling f +// Iteration stops if f returns false. +func (ts TraceState) Walk(f func(key, value string) bool) { + for _, m := range ts.list { + if !f(m.Key, m.Value) { + break + } + } +} + // Insert adds a new list-member defined by the key/value pair to the // TraceState. If a list-member already exists for the given key, that // list-member's value is updated. The new or updated list-member is always diff --git a/vendor/golang.org/x/crypto/LICENSE b/vendor/golang.org/x/crypto/LICENSE index 6a66aea5..2a7cf70d 100644 --- a/vendor/golang.org/x/crypto/LICENSE +++ b/vendor/golang.org/x/crypto/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/crypto/argon2/blamka_amd64.s b/vendor/golang.org/x/crypto/argon2/blamka_amd64.s index 6713acca..c3895478 100644 --- a/vendor/golang.org/x/crypto/argon2/blamka_amd64.s +++ b/vendor/golang.org/x/crypto/argon2/blamka_amd64.s @@ -1,243 +1,2791 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. +// Code generated by command: go run blamka_amd64.go -out ../blamka_amd64.s -pkg argon2. DO NOT EDIT. //go:build amd64 && gc && !purego #include "textflag.h" -DATA ·c40<>+0x00(SB)/8, $0x0201000706050403 -DATA ·c40<>+0x08(SB)/8, $0x0a09080f0e0d0c0b -GLOBL ·c40<>(SB), (NOPTR+RODATA), $16 - -DATA ·c48<>+0x00(SB)/8, $0x0100070605040302 -DATA ·c48<>+0x08(SB)/8, $0x09080f0e0d0c0b0a -GLOBL ·c48<>(SB), (NOPTR+RODATA), $16 - -#define SHUFFLE(v2, v3, v4, v5, v6, v7, t1, t2) \ - MOVO v4, t1; \ - MOVO v5, v4; \ - MOVO t1, v5; \ - MOVO v6, t1; \ - PUNPCKLQDQ v6, t2; \ - PUNPCKHQDQ v7, v6; \ - PUNPCKHQDQ t2, v6; \ - PUNPCKLQDQ v7, t2; \ - MOVO t1, v7; \ - MOVO v2, t1; \ - PUNPCKHQDQ t2, v7; \ - PUNPCKLQDQ v3, t2; \ - PUNPCKHQDQ t2, v2; \ - PUNPCKLQDQ t1, t2; \ - PUNPCKHQDQ t2, v3 - -#define SHUFFLE_INV(v2, v3, v4, v5, v6, v7, t1, t2) \ - MOVO v4, t1; \ - MOVO v5, v4; \ - MOVO t1, v5; \ - MOVO v2, t1; \ - PUNPCKLQDQ v2, t2; \ - PUNPCKHQDQ v3, v2; \ - PUNPCKHQDQ t2, v2; \ - PUNPCKLQDQ v3, t2; \ - MOVO t1, v3; \ - MOVO v6, t1; \ - PUNPCKHQDQ t2, v3; \ - PUNPCKLQDQ v7, t2; \ - PUNPCKHQDQ t2, v6; \ - PUNPCKLQDQ t1, t2; \ - PUNPCKHQDQ t2, v7 - -#define HALF_ROUND(v0, v1, v2, v3, v4, v5, v6, v7, t0, c40, c48) \ - MOVO v0, t0; \ - PMULULQ v2, t0; \ - PADDQ v2, v0; \ - PADDQ t0, v0; \ - PADDQ t0, v0; \ - PXOR v0, v6; \ - PSHUFD $0xB1, v6, v6; \ - MOVO v4, t0; \ - PMULULQ v6, t0; \ - PADDQ v6, v4; \ - PADDQ t0, v4; \ - PADDQ t0, v4; \ - PXOR v4, v2; \ - PSHUFB c40, v2; \ - MOVO v0, t0; \ - PMULULQ v2, t0; \ - PADDQ v2, v0; \ - PADDQ t0, v0; \ - PADDQ t0, v0; \ - PXOR v0, v6; \ - PSHUFB c48, v6; \ - MOVO v4, t0; \ - PMULULQ v6, t0; \ - PADDQ v6, v4; \ - PADDQ t0, v4; \ - PADDQ t0, v4; \ - PXOR v4, v2; \ - MOVO v2, t0; \ - PADDQ v2, t0; \ - PSRLQ $63, v2; \ - PXOR t0, v2; \ - MOVO v1, t0; \ - PMULULQ v3, t0; \ - PADDQ v3, v1; \ - PADDQ t0, v1; \ - PADDQ t0, v1; \ - PXOR v1, v7; \ - PSHUFD $0xB1, v7, v7; \ - MOVO v5, t0; \ - PMULULQ v7, t0; \ - PADDQ v7, v5; \ - PADDQ t0, v5; \ - PADDQ t0, v5; \ - PXOR v5, v3; \ - PSHUFB c40, v3; \ - MOVO v1, t0; \ - PMULULQ v3, t0; \ - PADDQ v3, v1; \ - PADDQ t0, v1; \ - PADDQ t0, v1; \ - PXOR v1, v7; \ - PSHUFB c48, v7; \ - MOVO v5, t0; \ - PMULULQ v7, t0; \ - PADDQ v7, v5; \ - PADDQ t0, v5; \ - PADDQ t0, v5; \ - PXOR v5, v3; \ - MOVO v3, t0; \ - PADDQ v3, t0; \ - PSRLQ $63, v3; \ - PXOR t0, v3 - -#define LOAD_MSG_0(block, off) \ - MOVOU 8*(off+0)(block), X0; \ - MOVOU 8*(off+2)(block), X1; \ - MOVOU 8*(off+4)(block), X2; \ - MOVOU 8*(off+6)(block), X3; \ - MOVOU 8*(off+8)(block), X4; \ - MOVOU 8*(off+10)(block), X5; \ - MOVOU 8*(off+12)(block), X6; \ - MOVOU 8*(off+14)(block), X7 - -#define STORE_MSG_0(block, off) \ - MOVOU X0, 8*(off+0)(block); \ - MOVOU X1, 8*(off+2)(block); \ - MOVOU X2, 8*(off+4)(block); \ - MOVOU X3, 8*(off+6)(block); \ - MOVOU X4, 8*(off+8)(block); \ - MOVOU X5, 8*(off+10)(block); \ - MOVOU X6, 8*(off+12)(block); \ - MOVOU X7, 8*(off+14)(block) - -#define LOAD_MSG_1(block, off) \ - MOVOU 8*off+0*8(block), X0; \ - MOVOU 8*off+16*8(block), X1; \ - MOVOU 8*off+32*8(block), X2; \ - MOVOU 8*off+48*8(block), X3; \ - MOVOU 8*off+64*8(block), X4; \ - MOVOU 8*off+80*8(block), X5; \ - MOVOU 8*off+96*8(block), X6; \ - MOVOU 8*off+112*8(block), X7 - -#define STORE_MSG_1(block, off) \ - MOVOU X0, 8*off+0*8(block); \ - MOVOU X1, 8*off+16*8(block); \ - MOVOU X2, 8*off+32*8(block); \ - MOVOU X3, 8*off+48*8(block); \ - MOVOU X4, 8*off+64*8(block); \ - MOVOU X5, 8*off+80*8(block); \ - MOVOU X6, 8*off+96*8(block); \ - MOVOU X7, 8*off+112*8(block) - -#define BLAMKA_ROUND_0(block, off, t0, t1, c40, c48) \ - LOAD_MSG_0(block, off); \ - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, t0, c40, c48); \ - SHUFFLE(X2, X3, X4, X5, X6, X7, t0, t1); \ - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, t0, c40, c48); \ - SHUFFLE_INV(X2, X3, X4, X5, X6, X7, t0, t1); \ - STORE_MSG_0(block, off) - -#define BLAMKA_ROUND_1(block, off, t0, t1, c40, c48) \ - LOAD_MSG_1(block, off); \ - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, t0, c40, c48); \ - SHUFFLE(X2, X3, X4, X5, X6, X7, t0, t1); \ - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, t0, c40, c48); \ - SHUFFLE_INV(X2, X3, X4, X5, X6, X7, t0, t1); \ - STORE_MSG_1(block, off) - // func blamkaSSE4(b *block) -TEXT ·blamkaSSE4(SB), 4, $0-8 - MOVQ b+0(FP), AX - - MOVOU ·c40<>(SB), X10 - MOVOU ·c48<>(SB), X11 - - BLAMKA_ROUND_0(AX, 0, X8, X9, X10, X11) - BLAMKA_ROUND_0(AX, 16, X8, X9, X10, X11) - BLAMKA_ROUND_0(AX, 32, X8, X9, X10, X11) - BLAMKA_ROUND_0(AX, 48, X8, X9, X10, X11) - BLAMKA_ROUND_0(AX, 64, X8, X9, X10, X11) - BLAMKA_ROUND_0(AX, 80, X8, X9, X10, X11) - BLAMKA_ROUND_0(AX, 96, X8, X9, X10, X11) - BLAMKA_ROUND_0(AX, 112, X8, X9, X10, X11) - - BLAMKA_ROUND_1(AX, 0, X8, X9, X10, X11) - BLAMKA_ROUND_1(AX, 2, X8, X9, X10, X11) - BLAMKA_ROUND_1(AX, 4, X8, X9, X10, X11) - BLAMKA_ROUND_1(AX, 6, X8, X9, X10, X11) - BLAMKA_ROUND_1(AX, 8, X8, X9, X10, X11) - BLAMKA_ROUND_1(AX, 10, X8, X9, X10, X11) - BLAMKA_ROUND_1(AX, 12, X8, X9, X10, X11) - BLAMKA_ROUND_1(AX, 14, X8, X9, X10, X11) +// Requires: SSE2, SSSE3 +TEXT ·blamkaSSE4(SB), NOSPLIT, $0-8 + MOVQ b+0(FP), AX + MOVOU ·c40<>+0(SB), X10 + MOVOU ·c48<>+0(SB), X11 + MOVOU (AX), X0 + MOVOU 16(AX), X1 + MOVOU 32(AX), X2 + MOVOU 48(AX), X3 + MOVOU 64(AX), X4 + MOVOU 80(AX), X5 + MOVOU 96(AX), X6 + MOVOU 112(AX), X7 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVOU X0, (AX) + MOVOU X1, 16(AX) + MOVOU X2, 32(AX) + MOVOU X3, 48(AX) + MOVOU X4, 64(AX) + MOVOU X5, 80(AX) + MOVOU X6, 96(AX) + MOVOU X7, 112(AX) + MOVOU 128(AX), X0 + MOVOU 144(AX), X1 + MOVOU 160(AX), X2 + MOVOU 176(AX), X3 + MOVOU 192(AX), X4 + MOVOU 208(AX), X5 + MOVOU 224(AX), X6 + MOVOU 240(AX), X7 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVOU X0, 128(AX) + MOVOU X1, 144(AX) + MOVOU X2, 160(AX) + MOVOU X3, 176(AX) + MOVOU X4, 192(AX) + MOVOU X5, 208(AX) + MOVOU X6, 224(AX) + MOVOU X7, 240(AX) + MOVOU 256(AX), X0 + MOVOU 272(AX), X1 + MOVOU 288(AX), X2 + MOVOU 304(AX), X3 + MOVOU 320(AX), X4 + MOVOU 336(AX), X5 + MOVOU 352(AX), X6 + MOVOU 368(AX), X7 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVOU X0, 256(AX) + MOVOU X1, 272(AX) + MOVOU X2, 288(AX) + MOVOU X3, 304(AX) + MOVOU X4, 320(AX) + MOVOU X5, 336(AX) + MOVOU X6, 352(AX) + MOVOU X7, 368(AX) + MOVOU 384(AX), X0 + MOVOU 400(AX), X1 + MOVOU 416(AX), X2 + MOVOU 432(AX), X3 + MOVOU 448(AX), X4 + MOVOU 464(AX), X5 + MOVOU 480(AX), X6 + MOVOU 496(AX), X7 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVOU X0, 384(AX) + MOVOU X1, 400(AX) + MOVOU X2, 416(AX) + MOVOU X3, 432(AX) + MOVOU X4, 448(AX) + MOVOU X5, 464(AX) + MOVOU X6, 480(AX) + MOVOU X7, 496(AX) + MOVOU 512(AX), X0 + MOVOU 528(AX), X1 + MOVOU 544(AX), X2 + MOVOU 560(AX), X3 + MOVOU 576(AX), X4 + MOVOU 592(AX), X5 + MOVOU 608(AX), X6 + MOVOU 624(AX), X7 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVOU X0, 512(AX) + MOVOU X1, 528(AX) + MOVOU X2, 544(AX) + MOVOU X3, 560(AX) + MOVOU X4, 576(AX) + MOVOU X5, 592(AX) + MOVOU X6, 608(AX) + MOVOU X7, 624(AX) + MOVOU 640(AX), X0 + MOVOU 656(AX), X1 + MOVOU 672(AX), X2 + MOVOU 688(AX), X3 + MOVOU 704(AX), X4 + MOVOU 720(AX), X5 + MOVOU 736(AX), X6 + MOVOU 752(AX), X7 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVOU X0, 640(AX) + MOVOU X1, 656(AX) + MOVOU X2, 672(AX) + MOVOU X3, 688(AX) + MOVOU X4, 704(AX) + MOVOU X5, 720(AX) + MOVOU X6, 736(AX) + MOVOU X7, 752(AX) + MOVOU 768(AX), X0 + MOVOU 784(AX), X1 + MOVOU 800(AX), X2 + MOVOU 816(AX), X3 + MOVOU 832(AX), X4 + MOVOU 848(AX), X5 + MOVOU 864(AX), X6 + MOVOU 880(AX), X7 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVOU X0, 768(AX) + MOVOU X1, 784(AX) + MOVOU X2, 800(AX) + MOVOU X3, 816(AX) + MOVOU X4, 832(AX) + MOVOU X5, 848(AX) + MOVOU X6, 864(AX) + MOVOU X7, 880(AX) + MOVOU 896(AX), X0 + MOVOU 912(AX), X1 + MOVOU 928(AX), X2 + MOVOU 944(AX), X3 + MOVOU 960(AX), X4 + MOVOU 976(AX), X5 + MOVOU 992(AX), X6 + MOVOU 1008(AX), X7 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVOU X0, 896(AX) + MOVOU X1, 912(AX) + MOVOU X2, 928(AX) + MOVOU X3, 944(AX) + MOVOU X4, 960(AX) + MOVOU X5, 976(AX) + MOVOU X6, 992(AX) + MOVOU X7, 1008(AX) + MOVOU (AX), X0 + MOVOU 128(AX), X1 + MOVOU 256(AX), X2 + MOVOU 384(AX), X3 + MOVOU 512(AX), X4 + MOVOU 640(AX), X5 + MOVOU 768(AX), X6 + MOVOU 896(AX), X7 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVOU X0, (AX) + MOVOU X1, 128(AX) + MOVOU X2, 256(AX) + MOVOU X3, 384(AX) + MOVOU X4, 512(AX) + MOVOU X5, 640(AX) + MOVOU X6, 768(AX) + MOVOU X7, 896(AX) + MOVOU 16(AX), X0 + MOVOU 144(AX), X1 + MOVOU 272(AX), X2 + MOVOU 400(AX), X3 + MOVOU 528(AX), X4 + MOVOU 656(AX), X5 + MOVOU 784(AX), X6 + MOVOU 912(AX), X7 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVOU X0, 16(AX) + MOVOU X1, 144(AX) + MOVOU X2, 272(AX) + MOVOU X3, 400(AX) + MOVOU X4, 528(AX) + MOVOU X5, 656(AX) + MOVOU X6, 784(AX) + MOVOU X7, 912(AX) + MOVOU 32(AX), X0 + MOVOU 160(AX), X1 + MOVOU 288(AX), X2 + MOVOU 416(AX), X3 + MOVOU 544(AX), X4 + MOVOU 672(AX), X5 + MOVOU 800(AX), X6 + MOVOU 928(AX), X7 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVOU X0, 32(AX) + MOVOU X1, 160(AX) + MOVOU X2, 288(AX) + MOVOU X3, 416(AX) + MOVOU X4, 544(AX) + MOVOU X5, 672(AX) + MOVOU X6, 800(AX) + MOVOU X7, 928(AX) + MOVOU 48(AX), X0 + MOVOU 176(AX), X1 + MOVOU 304(AX), X2 + MOVOU 432(AX), X3 + MOVOU 560(AX), X4 + MOVOU 688(AX), X5 + MOVOU 816(AX), X6 + MOVOU 944(AX), X7 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVOU X0, 48(AX) + MOVOU X1, 176(AX) + MOVOU X2, 304(AX) + MOVOU X3, 432(AX) + MOVOU X4, 560(AX) + MOVOU X5, 688(AX) + MOVOU X6, 816(AX) + MOVOU X7, 944(AX) + MOVOU 64(AX), X0 + MOVOU 192(AX), X1 + MOVOU 320(AX), X2 + MOVOU 448(AX), X3 + MOVOU 576(AX), X4 + MOVOU 704(AX), X5 + MOVOU 832(AX), X6 + MOVOU 960(AX), X7 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVOU X0, 64(AX) + MOVOU X1, 192(AX) + MOVOU X2, 320(AX) + MOVOU X3, 448(AX) + MOVOU X4, 576(AX) + MOVOU X5, 704(AX) + MOVOU X6, 832(AX) + MOVOU X7, 960(AX) + MOVOU 80(AX), X0 + MOVOU 208(AX), X1 + MOVOU 336(AX), X2 + MOVOU 464(AX), X3 + MOVOU 592(AX), X4 + MOVOU 720(AX), X5 + MOVOU 848(AX), X6 + MOVOU 976(AX), X7 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVOU X0, 80(AX) + MOVOU X1, 208(AX) + MOVOU X2, 336(AX) + MOVOU X3, 464(AX) + MOVOU X4, 592(AX) + MOVOU X5, 720(AX) + MOVOU X6, 848(AX) + MOVOU X7, 976(AX) + MOVOU 96(AX), X0 + MOVOU 224(AX), X1 + MOVOU 352(AX), X2 + MOVOU 480(AX), X3 + MOVOU 608(AX), X4 + MOVOU 736(AX), X5 + MOVOU 864(AX), X6 + MOVOU 992(AX), X7 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVOU X0, 96(AX) + MOVOU X1, 224(AX) + MOVOU X2, 352(AX) + MOVOU X3, 480(AX) + MOVOU X4, 608(AX) + MOVOU X5, 736(AX) + MOVOU X6, 864(AX) + MOVOU X7, 992(AX) + MOVOU 112(AX), X0 + MOVOU 240(AX), X1 + MOVOU 368(AX), X2 + MOVOU 496(AX), X3 + MOVOU 624(AX), X4 + MOVOU 752(AX), X5 + MOVOU 880(AX), X6 + MOVOU 1008(AX), X7 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFD $0xb1, X6, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + PSHUFB X10, X2 + MOVO X0, X8 + PMULULQ X2, X8 + PADDQ X2, X0 + PADDQ X8, X0 + PADDQ X8, X0 + PXOR X0, X6 + PSHUFB X11, X6 + MOVO X4, X8 + PMULULQ X6, X8 + PADDQ X6, X4 + PADDQ X8, X4 + PADDQ X8, X4 + PXOR X4, X2 + MOVO X2, X8 + PADDQ X2, X8 + PSRLQ $0x3f, X2 + PXOR X8, X2 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFD $0xb1, X7, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + PSHUFB X10, X3 + MOVO X1, X8 + PMULULQ X3, X8 + PADDQ X3, X1 + PADDQ X8, X1 + PADDQ X8, X1 + PXOR X1, X7 + PSHUFB X11, X7 + MOVO X5, X8 + PMULULQ X7, X8 + PADDQ X7, X5 + PADDQ X8, X5 + PADDQ X8, X5 + PXOR X5, X3 + MOVO X3, X8 + PADDQ X3, X8 + PSRLQ $0x3f, X3 + PXOR X8, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVOU X0, 112(AX) + MOVOU X1, 240(AX) + MOVOU X2, 368(AX) + MOVOU X3, 496(AX) + MOVOU X4, 624(AX) + MOVOU X5, 752(AX) + MOVOU X6, 880(AX) + MOVOU X7, 1008(AX) RET -// func mixBlocksSSE2(out, a, b, c *block) -TEXT ·mixBlocksSSE2(SB), 4, $0-32 +DATA ·c40<>+0(SB)/8, $0x0201000706050403 +DATA ·c40<>+8(SB)/8, $0x0a09080f0e0d0c0b +GLOBL ·c40<>(SB), RODATA|NOPTR, $16 + +DATA ·c48<>+0(SB)/8, $0x0100070605040302 +DATA ·c48<>+8(SB)/8, $0x09080f0e0d0c0b0a +GLOBL ·c48<>(SB), RODATA|NOPTR, $16 + +// func mixBlocksSSE2(out *block, a *block, b *block, c *block) +// Requires: SSE2 +TEXT ·mixBlocksSSE2(SB), NOSPLIT, $0-32 MOVQ out+0(FP), DX MOVQ a+8(FP), AX MOVQ b+16(FP), BX MOVQ c+24(FP), CX - MOVQ $128, DI + MOVQ $0x00000080, DI loop: - MOVOU 0(AX), X0 - MOVOU 0(BX), X1 - MOVOU 0(CX), X2 + MOVOU (AX), X0 + MOVOU (BX), X1 + MOVOU (CX), X2 PXOR X1, X0 PXOR X2, X0 - MOVOU X0, 0(DX) - ADDQ $16, AX - ADDQ $16, BX - ADDQ $16, CX - ADDQ $16, DX - SUBQ $2, DI + MOVOU X0, (DX) + ADDQ $0x10, AX + ADDQ $0x10, BX + ADDQ $0x10, CX + ADDQ $0x10, DX + SUBQ $0x02, DI JA loop RET -// func xorBlocksSSE2(out, a, b, c *block) -TEXT ·xorBlocksSSE2(SB), 4, $0-32 +// func xorBlocksSSE2(out *block, a *block, b *block, c *block) +// Requires: SSE2 +TEXT ·xorBlocksSSE2(SB), NOSPLIT, $0-32 MOVQ out+0(FP), DX MOVQ a+8(FP), AX MOVQ b+16(FP), BX MOVQ c+24(FP), CX - MOVQ $128, DI + MOVQ $0x00000080, DI loop: - MOVOU 0(AX), X0 - MOVOU 0(BX), X1 - MOVOU 0(CX), X2 - MOVOU 0(DX), X3 + MOVOU (AX), X0 + MOVOU (BX), X1 + MOVOU (CX), X2 + MOVOU (DX), X3 PXOR X1, X0 PXOR X2, X0 PXOR X3, X0 - MOVOU X0, 0(DX) - ADDQ $16, AX - ADDQ $16, BX - ADDQ $16, CX - ADDQ $16, DX - SUBQ $2, DI + MOVOU X0, (DX) + ADDQ $0x10, AX + ADDQ $0x10, BX + ADDQ $0x10, CX + ADDQ $0x10, DX + SUBQ $0x02, DI JA loop RET diff --git a/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s b/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s index 9ae8206c..f75162e0 100644 --- a/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s +++ b/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s @@ -1,722 +1,4517 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. +// Code generated by command: go run blake2bAVX2_amd64_asm.go -out ../../blake2bAVX2_amd64.s -pkg blake2b. DO NOT EDIT. //go:build amd64 && gc && !purego #include "textflag.h" -DATA ·AVX2_iv0<>+0x00(SB)/8, $0x6a09e667f3bcc908 -DATA ·AVX2_iv0<>+0x08(SB)/8, $0xbb67ae8584caa73b -DATA ·AVX2_iv0<>+0x10(SB)/8, $0x3c6ef372fe94f82b -DATA ·AVX2_iv0<>+0x18(SB)/8, $0xa54ff53a5f1d36f1 -GLOBL ·AVX2_iv0<>(SB), (NOPTR+RODATA), $32 - -DATA ·AVX2_iv1<>+0x00(SB)/8, $0x510e527fade682d1 -DATA ·AVX2_iv1<>+0x08(SB)/8, $0x9b05688c2b3e6c1f -DATA ·AVX2_iv1<>+0x10(SB)/8, $0x1f83d9abfb41bd6b -DATA ·AVX2_iv1<>+0x18(SB)/8, $0x5be0cd19137e2179 -GLOBL ·AVX2_iv1<>(SB), (NOPTR+RODATA), $32 - -DATA ·AVX2_c40<>+0x00(SB)/8, $0x0201000706050403 -DATA ·AVX2_c40<>+0x08(SB)/8, $0x0a09080f0e0d0c0b -DATA ·AVX2_c40<>+0x10(SB)/8, $0x0201000706050403 -DATA ·AVX2_c40<>+0x18(SB)/8, $0x0a09080f0e0d0c0b -GLOBL ·AVX2_c40<>(SB), (NOPTR+RODATA), $32 - -DATA ·AVX2_c48<>+0x00(SB)/8, $0x0100070605040302 -DATA ·AVX2_c48<>+0x08(SB)/8, $0x09080f0e0d0c0b0a -DATA ·AVX2_c48<>+0x10(SB)/8, $0x0100070605040302 -DATA ·AVX2_c48<>+0x18(SB)/8, $0x09080f0e0d0c0b0a -GLOBL ·AVX2_c48<>(SB), (NOPTR+RODATA), $32 - -DATA ·AVX_iv0<>+0x00(SB)/8, $0x6a09e667f3bcc908 -DATA ·AVX_iv0<>+0x08(SB)/8, $0xbb67ae8584caa73b -GLOBL ·AVX_iv0<>(SB), (NOPTR+RODATA), $16 - -DATA ·AVX_iv1<>+0x00(SB)/8, $0x3c6ef372fe94f82b -DATA ·AVX_iv1<>+0x08(SB)/8, $0xa54ff53a5f1d36f1 -GLOBL ·AVX_iv1<>(SB), (NOPTR+RODATA), $16 - -DATA ·AVX_iv2<>+0x00(SB)/8, $0x510e527fade682d1 -DATA ·AVX_iv2<>+0x08(SB)/8, $0x9b05688c2b3e6c1f -GLOBL ·AVX_iv2<>(SB), (NOPTR+RODATA), $16 - -DATA ·AVX_iv3<>+0x00(SB)/8, $0x1f83d9abfb41bd6b -DATA ·AVX_iv3<>+0x08(SB)/8, $0x5be0cd19137e2179 -GLOBL ·AVX_iv3<>(SB), (NOPTR+RODATA), $16 - -DATA ·AVX_c40<>+0x00(SB)/8, $0x0201000706050403 -DATA ·AVX_c40<>+0x08(SB)/8, $0x0a09080f0e0d0c0b -GLOBL ·AVX_c40<>(SB), (NOPTR+RODATA), $16 - -DATA ·AVX_c48<>+0x00(SB)/8, $0x0100070605040302 -DATA ·AVX_c48<>+0x08(SB)/8, $0x09080f0e0d0c0b0a -GLOBL ·AVX_c48<>(SB), (NOPTR+RODATA), $16 - -#define VPERMQ_0x39_Y1_Y1 BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xc9; BYTE $0x39 -#define VPERMQ_0x93_Y1_Y1 BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xc9; BYTE $0x93 -#define VPERMQ_0x4E_Y2_Y2 BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xd2; BYTE $0x4e -#define VPERMQ_0x93_Y3_Y3 BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xdb; BYTE $0x93 -#define VPERMQ_0x39_Y3_Y3 BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xdb; BYTE $0x39 - -#define ROUND_AVX2(m0, m1, m2, m3, t, c40, c48) \ - VPADDQ m0, Y0, Y0; \ - VPADDQ Y1, Y0, Y0; \ - VPXOR Y0, Y3, Y3; \ - VPSHUFD $-79, Y3, Y3; \ - VPADDQ Y3, Y2, Y2; \ - VPXOR Y2, Y1, Y1; \ - VPSHUFB c40, Y1, Y1; \ - VPADDQ m1, Y0, Y0; \ - VPADDQ Y1, Y0, Y0; \ - VPXOR Y0, Y3, Y3; \ - VPSHUFB c48, Y3, Y3; \ - VPADDQ Y3, Y2, Y2; \ - VPXOR Y2, Y1, Y1; \ - VPADDQ Y1, Y1, t; \ - VPSRLQ $63, Y1, Y1; \ - VPXOR t, Y1, Y1; \ - VPERMQ_0x39_Y1_Y1; \ - VPERMQ_0x4E_Y2_Y2; \ - VPERMQ_0x93_Y3_Y3; \ - VPADDQ m2, Y0, Y0; \ - VPADDQ Y1, Y0, Y0; \ - VPXOR Y0, Y3, Y3; \ - VPSHUFD $-79, Y3, Y3; \ - VPADDQ Y3, Y2, Y2; \ - VPXOR Y2, Y1, Y1; \ - VPSHUFB c40, Y1, Y1; \ - VPADDQ m3, Y0, Y0; \ - VPADDQ Y1, Y0, Y0; \ - VPXOR Y0, Y3, Y3; \ - VPSHUFB c48, Y3, Y3; \ - VPADDQ Y3, Y2, Y2; \ - VPXOR Y2, Y1, Y1; \ - VPADDQ Y1, Y1, t; \ - VPSRLQ $63, Y1, Y1; \ - VPXOR t, Y1, Y1; \ - VPERMQ_0x39_Y3_Y3; \ - VPERMQ_0x4E_Y2_Y2; \ - VPERMQ_0x93_Y1_Y1 - -#define VMOVQ_SI_X11_0 BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x1E -#define VMOVQ_SI_X12_0 BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x26 -#define VMOVQ_SI_X13_0 BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x2E -#define VMOVQ_SI_X14_0 BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x36 -#define VMOVQ_SI_X15_0 BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x3E - -#define VMOVQ_SI_X11(n) BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x5E; BYTE $n -#define VMOVQ_SI_X12(n) BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x66; BYTE $n -#define VMOVQ_SI_X13(n) BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x6E; BYTE $n -#define VMOVQ_SI_X14(n) BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x76; BYTE $n -#define VMOVQ_SI_X15(n) BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x7E; BYTE $n - -#define VPINSRQ_1_SI_X11_0 BYTE $0xC4; BYTE $0x63; BYTE $0xA1; BYTE $0x22; BYTE $0x1E; BYTE $0x01 -#define VPINSRQ_1_SI_X12_0 BYTE $0xC4; BYTE $0x63; BYTE $0x99; BYTE $0x22; BYTE $0x26; BYTE $0x01 -#define VPINSRQ_1_SI_X13_0 BYTE $0xC4; BYTE $0x63; BYTE $0x91; BYTE $0x22; BYTE $0x2E; BYTE $0x01 -#define VPINSRQ_1_SI_X14_0 BYTE $0xC4; BYTE $0x63; BYTE $0x89; BYTE $0x22; BYTE $0x36; BYTE $0x01 -#define VPINSRQ_1_SI_X15_0 BYTE $0xC4; BYTE $0x63; BYTE $0x81; BYTE $0x22; BYTE $0x3E; BYTE $0x01 - -#define VPINSRQ_1_SI_X11(n) BYTE $0xC4; BYTE $0x63; BYTE $0xA1; BYTE $0x22; BYTE $0x5E; BYTE $n; BYTE $0x01 -#define VPINSRQ_1_SI_X12(n) BYTE $0xC4; BYTE $0x63; BYTE $0x99; BYTE $0x22; BYTE $0x66; BYTE $n; BYTE $0x01 -#define VPINSRQ_1_SI_X13(n) BYTE $0xC4; BYTE $0x63; BYTE $0x91; BYTE $0x22; BYTE $0x6E; BYTE $n; BYTE $0x01 -#define VPINSRQ_1_SI_X14(n) BYTE $0xC4; BYTE $0x63; BYTE $0x89; BYTE $0x22; BYTE $0x76; BYTE $n; BYTE $0x01 -#define VPINSRQ_1_SI_X15(n) BYTE $0xC4; BYTE $0x63; BYTE $0x81; BYTE $0x22; BYTE $0x7E; BYTE $n; BYTE $0x01 - -#define VMOVQ_R8_X15 BYTE $0xC4; BYTE $0x41; BYTE $0xF9; BYTE $0x6E; BYTE $0xF8 -#define VPINSRQ_1_R9_X15 BYTE $0xC4; BYTE $0x43; BYTE $0x81; BYTE $0x22; BYTE $0xF9; BYTE $0x01 - -// load msg: Y12 = (i0, i1, i2, i3) -// i0, i1, i2, i3 must not be 0 -#define LOAD_MSG_AVX2_Y12(i0, i1, i2, i3) \ - VMOVQ_SI_X12(i0*8); \ - VMOVQ_SI_X11(i2*8); \ - VPINSRQ_1_SI_X12(i1*8); \ - VPINSRQ_1_SI_X11(i3*8); \ - VINSERTI128 $1, X11, Y12, Y12 - -// load msg: Y13 = (i0, i1, i2, i3) -// i0, i1, i2, i3 must not be 0 -#define LOAD_MSG_AVX2_Y13(i0, i1, i2, i3) \ - VMOVQ_SI_X13(i0*8); \ - VMOVQ_SI_X11(i2*8); \ - VPINSRQ_1_SI_X13(i1*8); \ - VPINSRQ_1_SI_X11(i3*8); \ - VINSERTI128 $1, X11, Y13, Y13 - -// load msg: Y14 = (i0, i1, i2, i3) -// i0, i1, i2, i3 must not be 0 -#define LOAD_MSG_AVX2_Y14(i0, i1, i2, i3) \ - VMOVQ_SI_X14(i0*8); \ - VMOVQ_SI_X11(i2*8); \ - VPINSRQ_1_SI_X14(i1*8); \ - VPINSRQ_1_SI_X11(i3*8); \ - VINSERTI128 $1, X11, Y14, Y14 - -// load msg: Y15 = (i0, i1, i2, i3) -// i0, i1, i2, i3 must not be 0 -#define LOAD_MSG_AVX2_Y15(i0, i1, i2, i3) \ - VMOVQ_SI_X15(i0*8); \ - VMOVQ_SI_X11(i2*8); \ - VPINSRQ_1_SI_X15(i1*8); \ - VPINSRQ_1_SI_X11(i3*8); \ - VINSERTI128 $1, X11, Y15, Y15 - -#define LOAD_MSG_AVX2_0_2_4_6_1_3_5_7_8_10_12_14_9_11_13_15() \ - VMOVQ_SI_X12_0; \ - VMOVQ_SI_X11(4*8); \ - VPINSRQ_1_SI_X12(2*8); \ - VPINSRQ_1_SI_X11(6*8); \ - VINSERTI128 $1, X11, Y12, Y12; \ - LOAD_MSG_AVX2_Y13(1, 3, 5, 7); \ - LOAD_MSG_AVX2_Y14(8, 10, 12, 14); \ - LOAD_MSG_AVX2_Y15(9, 11, 13, 15) - -#define LOAD_MSG_AVX2_14_4_9_13_10_8_15_6_1_0_11_5_12_2_7_3() \ - LOAD_MSG_AVX2_Y12(14, 4, 9, 13); \ - LOAD_MSG_AVX2_Y13(10, 8, 15, 6); \ - VMOVQ_SI_X11(11*8); \ - VPSHUFD $0x4E, 0*8(SI), X14; \ - VPINSRQ_1_SI_X11(5*8); \ - VINSERTI128 $1, X11, Y14, Y14; \ - LOAD_MSG_AVX2_Y15(12, 2, 7, 3) - -#define LOAD_MSG_AVX2_11_12_5_15_8_0_2_13_10_3_7_9_14_6_1_4() \ - VMOVQ_SI_X11(5*8); \ - VMOVDQU 11*8(SI), X12; \ - VPINSRQ_1_SI_X11(15*8); \ - VINSERTI128 $1, X11, Y12, Y12; \ - VMOVQ_SI_X13(8*8); \ - VMOVQ_SI_X11(2*8); \ - VPINSRQ_1_SI_X13_0; \ - VPINSRQ_1_SI_X11(13*8); \ - VINSERTI128 $1, X11, Y13, Y13; \ - LOAD_MSG_AVX2_Y14(10, 3, 7, 9); \ - LOAD_MSG_AVX2_Y15(14, 6, 1, 4) - -#define LOAD_MSG_AVX2_7_3_13_11_9_1_12_14_2_5_4_15_6_10_0_8() \ - LOAD_MSG_AVX2_Y12(7, 3, 13, 11); \ - LOAD_MSG_AVX2_Y13(9, 1, 12, 14); \ - LOAD_MSG_AVX2_Y14(2, 5, 4, 15); \ - VMOVQ_SI_X15(6*8); \ - VMOVQ_SI_X11_0; \ - VPINSRQ_1_SI_X15(10*8); \ - VPINSRQ_1_SI_X11(8*8); \ - VINSERTI128 $1, X11, Y15, Y15 - -#define LOAD_MSG_AVX2_9_5_2_10_0_7_4_15_14_11_6_3_1_12_8_13() \ - LOAD_MSG_AVX2_Y12(9, 5, 2, 10); \ - VMOVQ_SI_X13_0; \ - VMOVQ_SI_X11(4*8); \ - VPINSRQ_1_SI_X13(7*8); \ - VPINSRQ_1_SI_X11(15*8); \ - VINSERTI128 $1, X11, Y13, Y13; \ - LOAD_MSG_AVX2_Y14(14, 11, 6, 3); \ - LOAD_MSG_AVX2_Y15(1, 12, 8, 13) - -#define LOAD_MSG_AVX2_2_6_0_8_12_10_11_3_4_7_15_1_13_5_14_9() \ - VMOVQ_SI_X12(2*8); \ - VMOVQ_SI_X11_0; \ - VPINSRQ_1_SI_X12(6*8); \ - VPINSRQ_1_SI_X11(8*8); \ - VINSERTI128 $1, X11, Y12, Y12; \ - LOAD_MSG_AVX2_Y13(12, 10, 11, 3); \ - LOAD_MSG_AVX2_Y14(4, 7, 15, 1); \ - LOAD_MSG_AVX2_Y15(13, 5, 14, 9) - -#define LOAD_MSG_AVX2_12_1_14_4_5_15_13_10_0_6_9_8_7_3_2_11() \ - LOAD_MSG_AVX2_Y12(12, 1, 14, 4); \ - LOAD_MSG_AVX2_Y13(5, 15, 13, 10); \ - VMOVQ_SI_X14_0; \ - VPSHUFD $0x4E, 8*8(SI), X11; \ - VPINSRQ_1_SI_X14(6*8); \ - VINSERTI128 $1, X11, Y14, Y14; \ - LOAD_MSG_AVX2_Y15(7, 3, 2, 11) - -#define LOAD_MSG_AVX2_13_7_12_3_11_14_1_9_5_15_8_2_0_4_6_10() \ - LOAD_MSG_AVX2_Y12(13, 7, 12, 3); \ - LOAD_MSG_AVX2_Y13(11, 14, 1, 9); \ - LOAD_MSG_AVX2_Y14(5, 15, 8, 2); \ - VMOVQ_SI_X15_0; \ - VMOVQ_SI_X11(6*8); \ - VPINSRQ_1_SI_X15(4*8); \ - VPINSRQ_1_SI_X11(10*8); \ - VINSERTI128 $1, X11, Y15, Y15 - -#define LOAD_MSG_AVX2_6_14_11_0_15_9_3_8_12_13_1_10_2_7_4_5() \ - VMOVQ_SI_X12(6*8); \ - VMOVQ_SI_X11(11*8); \ - VPINSRQ_1_SI_X12(14*8); \ - VPINSRQ_1_SI_X11_0; \ - VINSERTI128 $1, X11, Y12, Y12; \ - LOAD_MSG_AVX2_Y13(15, 9, 3, 8); \ - VMOVQ_SI_X11(1*8); \ - VMOVDQU 12*8(SI), X14; \ - VPINSRQ_1_SI_X11(10*8); \ - VINSERTI128 $1, X11, Y14, Y14; \ - VMOVQ_SI_X15(2*8); \ - VMOVDQU 4*8(SI), X11; \ - VPINSRQ_1_SI_X15(7*8); \ - VINSERTI128 $1, X11, Y15, Y15 - -#define LOAD_MSG_AVX2_10_8_7_1_2_4_6_5_15_9_3_13_11_14_12_0() \ - LOAD_MSG_AVX2_Y12(10, 8, 7, 1); \ - VMOVQ_SI_X13(2*8); \ - VPSHUFD $0x4E, 5*8(SI), X11; \ - VPINSRQ_1_SI_X13(4*8); \ - VINSERTI128 $1, X11, Y13, Y13; \ - LOAD_MSG_AVX2_Y14(15, 9, 3, 13); \ - VMOVQ_SI_X15(11*8); \ - VMOVQ_SI_X11(12*8); \ - VPINSRQ_1_SI_X15(14*8); \ - VPINSRQ_1_SI_X11_0; \ - VINSERTI128 $1, X11, Y15, Y15 - // func hashBlocksAVX2(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) -TEXT ·hashBlocksAVX2(SB), 4, $320-48 // frame size = 288 + 32 byte alignment - MOVQ h+0(FP), AX - MOVQ c+8(FP), BX - MOVQ flag+16(FP), CX - MOVQ blocks_base+24(FP), SI - MOVQ blocks_len+32(FP), DI - - MOVQ SP, DX - ADDQ $31, DX - ANDQ $~31, DX - - MOVQ CX, 16(DX) - XORQ CX, CX - MOVQ CX, 24(DX) - - VMOVDQU ·AVX2_c40<>(SB), Y4 - VMOVDQU ·AVX2_c48<>(SB), Y5 - - VMOVDQU 0(AX), Y8 +// Requires: AVX, AVX2 +TEXT ·hashBlocksAVX2(SB), NOSPLIT, $320-48 + MOVQ h+0(FP), AX + MOVQ c+8(FP), BX + MOVQ flag+16(FP), CX + MOVQ blocks_base+24(FP), SI + MOVQ blocks_len+32(FP), DI + MOVQ SP, DX + ADDQ $+31, DX + ANDQ $-32, DX + MOVQ CX, 16(DX) + XORQ CX, CX + MOVQ CX, 24(DX) + VMOVDQU ·AVX2_c40<>+0(SB), Y4 + VMOVDQU ·AVX2_c48<>+0(SB), Y5 + VMOVDQU (AX), Y8 VMOVDQU 32(AX), Y9 - VMOVDQU ·AVX2_iv0<>(SB), Y6 - VMOVDQU ·AVX2_iv1<>(SB), Y7 - - MOVQ 0(BX), R8 - MOVQ 8(BX), R9 - MOVQ R9, 8(DX) + VMOVDQU ·AVX2_iv0<>+0(SB), Y6 + VMOVDQU ·AVX2_iv1<>+0(SB), Y7 + MOVQ (BX), R8 + MOVQ 8(BX), R9 + MOVQ R9, 8(DX) loop: - ADDQ $128, R8 - MOVQ R8, 0(DX) - CMPQ R8, $128 + ADDQ $0x80, R8 + MOVQ R8, (DX) + CMPQ R8, $0x80 JGE noinc INCQ R9 MOVQ R9, 8(DX) noinc: - VMOVDQA Y8, Y0 - VMOVDQA Y9, Y1 - VMOVDQA Y6, Y2 - VPXOR 0(DX), Y7, Y3 - - LOAD_MSG_AVX2_0_2_4_6_1_3_5_7_8_10_12_14_9_11_13_15() - VMOVDQA Y12, 32(DX) - VMOVDQA Y13, 64(DX) - VMOVDQA Y14, 96(DX) - VMOVDQA Y15, 128(DX) - ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) - LOAD_MSG_AVX2_14_4_9_13_10_8_15_6_1_0_11_5_12_2_7_3() - VMOVDQA Y12, 160(DX) - VMOVDQA Y13, 192(DX) - VMOVDQA Y14, 224(DX) - VMOVDQA Y15, 256(DX) - - ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) - LOAD_MSG_AVX2_11_12_5_15_8_0_2_13_10_3_7_9_14_6_1_4() - ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) - LOAD_MSG_AVX2_7_3_13_11_9_1_12_14_2_5_4_15_6_10_0_8() - ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) - LOAD_MSG_AVX2_9_5_2_10_0_7_4_15_14_11_6_3_1_12_8_13() - ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) - LOAD_MSG_AVX2_2_6_0_8_12_10_11_3_4_7_15_1_13_5_14_9() - ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) - LOAD_MSG_AVX2_12_1_14_4_5_15_13_10_0_6_9_8_7_3_2_11() - ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) - LOAD_MSG_AVX2_13_7_12_3_11_14_1_9_5_15_8_2_0_4_6_10() - ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) - LOAD_MSG_AVX2_6_14_11_0_15_9_3_8_12_13_1_10_2_7_4_5() - ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) - LOAD_MSG_AVX2_10_8_7_1_2_4_6_5_15_9_3_13_11_14_12_0() - ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) - - ROUND_AVX2(32(DX), 64(DX), 96(DX), 128(DX), Y10, Y4, Y5) - ROUND_AVX2(160(DX), 192(DX), 224(DX), 256(DX), Y10, Y4, Y5) - - VPXOR Y0, Y8, Y8 - VPXOR Y1, Y9, Y9 - VPXOR Y2, Y8, Y8 - VPXOR Y3, Y9, Y9 - - LEAQ 128(SI), SI - SUBQ $128, DI - JNE loop - - MOVQ R8, 0(BX) - MOVQ R9, 8(BX) - - VMOVDQU Y8, 0(AX) - VMOVDQU Y9, 32(AX) + VMOVDQA Y8, Y0 + VMOVDQA Y9, Y1 + VMOVDQA Y6, Y2 + VPXOR (DX), Y7, Y3 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x26 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x20 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x10 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x30 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y12, Y12 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x08 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x28 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x18 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x38 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y13, Y13 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x40 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x60 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x50 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x70 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y14, Y14 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x48 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x68 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x58 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x78 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y15, Y15 + VMOVDQA Y12, 32(DX) + VMOVDQA Y13, 64(DX) + VMOVDQA Y14, 96(DX) + VMOVDQA Y15, 128(DX) + VPADDQ Y12, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y13, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x93 + VPADDQ Y14, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y15, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x93 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x70 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x48 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x20 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x68 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y12, Y12 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x50 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x78 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x40 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x30 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y13, Y13 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x58 + VPSHUFD $0x4e, (SI), X14 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x28 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y14, Y14 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x60 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x38 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x10 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x18 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y15, Y15 + VMOVDQA Y12, 160(DX) + VMOVDQA Y13, 192(DX) + VMOVDQA Y14, 224(DX) + VMOVDQA Y15, 256(DX) + VPADDQ Y12, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y13, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x93 + VPADDQ Y14, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y15, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x93 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x28 + VMOVDQU 88(SI), X12 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x78 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y12, Y12 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x40 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x10 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x2e + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x68 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y13, Y13 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x50 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x38 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x18 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x48 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y14, Y14 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x70 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x08 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x30 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x20 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y15, Y15 + VPADDQ Y12, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y13, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x93 + VPADDQ Y14, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y15, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x93 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x38 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x68 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x18 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x58 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y12, Y12 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x48 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x60 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x08 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x70 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y13, Y13 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x10 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x20 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x28 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x78 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y14, Y14 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x30 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x1e + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x50 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x40 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y15, Y15 + VPADDQ Y12, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y13, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x93 + VPADDQ Y14, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y15, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x93 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x48 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x10 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x28 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x50 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y12, Y12 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x2e + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x20 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x38 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x78 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y13, Y13 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x70 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x30 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x58 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x18 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y14, Y14 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x08 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x40 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x60 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x68 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y15, Y15 + VPADDQ Y12, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y13, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x93 + VPADDQ Y14, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y15, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x93 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x10 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x1e + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x30 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x40 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y12, Y12 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x60 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x58 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x50 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x18 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y13, Y13 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x20 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x78 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x38 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x08 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y14, Y14 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x68 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x70 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x28 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x48 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y15, Y15 + VPADDQ Y12, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y13, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x93 + VPADDQ Y14, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y15, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x93 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x60 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x70 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x08 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x20 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y12, Y12 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x28 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x68 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x78 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x50 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y13, Y13 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x36 + VPSHUFD $0x4e, 64(SI), X11 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x30 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y14, Y14 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x38 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x10 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x18 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x58 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y15, Y15 + VPADDQ Y12, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y13, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x93 + VPADDQ Y14, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y15, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x93 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x68 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x60 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x38 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x18 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y12, Y12 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x58 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x08 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x70 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x48 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y13, Y13 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x28 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x40 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x78 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x10 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y14, Y14 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x3e + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x30 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x20 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x50 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y15, Y15 + VPADDQ Y12, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y13, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x93 + VPADDQ Y14, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y15, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x93 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x30 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x58 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x70 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x1e + BYTE $0x01 + VINSERTI128 $0x01, X11, Y12, Y12 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x78 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x18 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x48 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x40 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y13, Y13 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x08 + VMOVDQU 96(SI), X14 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x50 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y14, Y14 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x10 + VMOVDQU 32(SI), X11 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x38 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y15, Y15 + VPADDQ Y12, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y13, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x93 + VPADDQ Y14, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y15, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x93 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x50 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x38 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x40 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x08 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y12, Y12 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x10 + VPSHUFD $0x4e, 40(SI), X11 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x20 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y13, Y13 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x78 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x18 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x48 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x5e + BYTE $0x68 + BYTE $0x01 + VINSERTI128 $0x01, X11, Y14, Y14 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x58 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x5e + BYTE $0x60 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x70 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0xa1 + BYTE $0x22 + BYTE $0x1e + BYTE $0x01 + VINSERTI128 $0x01, X11, Y15, Y15 + VPADDQ Y12, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y13, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x93 + VPADDQ Y14, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ Y15, Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x93 + VPADDQ 32(DX), Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ 64(DX), Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x93 + VPADDQ 96(DX), Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ 128(DX), Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x93 + VPADDQ 160(DX), Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ 192(DX), Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x93 + VPADDQ 224(DX), Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFD $-79, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPSHUFB Y4, Y1, Y1 + VPADDQ 256(DX), Y0, Y0 + VPADDQ Y1, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSHUFB Y5, Y3, Y3 + VPADDQ Y3, Y2, Y2 + VPXOR Y2, Y1, Y1 + VPADDQ Y1, Y1, Y10 + VPSRLQ $0x3f, Y1, Y1 + VPXOR Y10, Y1, Y1 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xdb + BYTE $0x39 + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xd2 + BYTE $0x4e + BYTE $0xc4 + BYTE $0xe3 + BYTE $0xfd + BYTE $0x00 + BYTE $0xc9 + BYTE $0x93 + VPXOR Y0, Y8, Y8 + VPXOR Y1, Y9, Y9 + VPXOR Y2, Y8, Y8 + VPXOR Y3, Y9, Y9 + LEAQ 128(SI), SI + SUBQ $0x80, DI + JNE loop + MOVQ R8, (BX) + MOVQ R9, 8(BX) + VMOVDQU Y8, (AX) + VMOVDQU Y9, 32(AX) VZEROUPPER - RET -#define VPUNPCKLQDQ_X2_X2_X15 BYTE $0xC5; BYTE $0x69; BYTE $0x6C; BYTE $0xFA -#define VPUNPCKLQDQ_X3_X3_X15 BYTE $0xC5; BYTE $0x61; BYTE $0x6C; BYTE $0xFB -#define VPUNPCKLQDQ_X7_X7_X15 BYTE $0xC5; BYTE $0x41; BYTE $0x6C; BYTE $0xFF -#define VPUNPCKLQDQ_X13_X13_X15 BYTE $0xC4; BYTE $0x41; BYTE $0x11; BYTE $0x6C; BYTE $0xFD -#define VPUNPCKLQDQ_X14_X14_X15 BYTE $0xC4; BYTE $0x41; BYTE $0x09; BYTE $0x6C; BYTE $0xFE +DATA ·AVX2_c40<>+0(SB)/8, $0x0201000706050403 +DATA ·AVX2_c40<>+8(SB)/8, $0x0a09080f0e0d0c0b +DATA ·AVX2_c40<>+16(SB)/8, $0x0201000706050403 +DATA ·AVX2_c40<>+24(SB)/8, $0x0a09080f0e0d0c0b +GLOBL ·AVX2_c40<>(SB), RODATA|NOPTR, $32 -#define VPUNPCKHQDQ_X15_X2_X2 BYTE $0xC4; BYTE $0xC1; BYTE $0x69; BYTE $0x6D; BYTE $0xD7 -#define VPUNPCKHQDQ_X15_X3_X3 BYTE $0xC4; BYTE $0xC1; BYTE $0x61; BYTE $0x6D; BYTE $0xDF -#define VPUNPCKHQDQ_X15_X6_X6 BYTE $0xC4; BYTE $0xC1; BYTE $0x49; BYTE $0x6D; BYTE $0xF7 -#define VPUNPCKHQDQ_X15_X7_X7 BYTE $0xC4; BYTE $0xC1; BYTE $0x41; BYTE $0x6D; BYTE $0xFF -#define VPUNPCKHQDQ_X15_X3_X2 BYTE $0xC4; BYTE $0xC1; BYTE $0x61; BYTE $0x6D; BYTE $0xD7 -#define VPUNPCKHQDQ_X15_X7_X6 BYTE $0xC4; BYTE $0xC1; BYTE $0x41; BYTE $0x6D; BYTE $0xF7 -#define VPUNPCKHQDQ_X15_X13_X3 BYTE $0xC4; BYTE $0xC1; BYTE $0x11; BYTE $0x6D; BYTE $0xDF -#define VPUNPCKHQDQ_X15_X13_X7 BYTE $0xC4; BYTE $0xC1; BYTE $0x11; BYTE $0x6D; BYTE $0xFF +DATA ·AVX2_c48<>+0(SB)/8, $0x0100070605040302 +DATA ·AVX2_c48<>+8(SB)/8, $0x09080f0e0d0c0b0a +DATA ·AVX2_c48<>+16(SB)/8, $0x0100070605040302 +DATA ·AVX2_c48<>+24(SB)/8, $0x09080f0e0d0c0b0a +GLOBL ·AVX2_c48<>(SB), RODATA|NOPTR, $32 -#define SHUFFLE_AVX() \ - VMOVDQA X6, X13; \ - VMOVDQA X2, X14; \ - VMOVDQA X4, X6; \ - VPUNPCKLQDQ_X13_X13_X15; \ - VMOVDQA X5, X4; \ - VMOVDQA X6, X5; \ - VPUNPCKHQDQ_X15_X7_X6; \ - VPUNPCKLQDQ_X7_X7_X15; \ - VPUNPCKHQDQ_X15_X13_X7; \ - VPUNPCKLQDQ_X3_X3_X15; \ - VPUNPCKHQDQ_X15_X2_X2; \ - VPUNPCKLQDQ_X14_X14_X15; \ - VPUNPCKHQDQ_X15_X3_X3; \ +DATA ·AVX2_iv0<>+0(SB)/8, $0x6a09e667f3bcc908 +DATA ·AVX2_iv0<>+8(SB)/8, $0xbb67ae8584caa73b +DATA ·AVX2_iv0<>+16(SB)/8, $0x3c6ef372fe94f82b +DATA ·AVX2_iv0<>+24(SB)/8, $0xa54ff53a5f1d36f1 +GLOBL ·AVX2_iv0<>(SB), RODATA|NOPTR, $32 -#define SHUFFLE_AVX_INV() \ - VMOVDQA X2, X13; \ - VMOVDQA X4, X14; \ - VPUNPCKLQDQ_X2_X2_X15; \ - VMOVDQA X5, X4; \ - VPUNPCKHQDQ_X15_X3_X2; \ - VMOVDQA X14, X5; \ - VPUNPCKLQDQ_X3_X3_X15; \ - VMOVDQA X6, X14; \ - VPUNPCKHQDQ_X15_X13_X3; \ - VPUNPCKLQDQ_X7_X7_X15; \ - VPUNPCKHQDQ_X15_X6_X6; \ - VPUNPCKLQDQ_X14_X14_X15; \ - VPUNPCKHQDQ_X15_X7_X7; \ - -#define HALF_ROUND_AVX(v0, v1, v2, v3, v4, v5, v6, v7, m0, m1, m2, m3, t0, c40, c48) \ - VPADDQ m0, v0, v0; \ - VPADDQ v2, v0, v0; \ - VPADDQ m1, v1, v1; \ - VPADDQ v3, v1, v1; \ - VPXOR v0, v6, v6; \ - VPXOR v1, v7, v7; \ - VPSHUFD $-79, v6, v6; \ - VPSHUFD $-79, v7, v7; \ - VPADDQ v6, v4, v4; \ - VPADDQ v7, v5, v5; \ - VPXOR v4, v2, v2; \ - VPXOR v5, v3, v3; \ - VPSHUFB c40, v2, v2; \ - VPSHUFB c40, v3, v3; \ - VPADDQ m2, v0, v0; \ - VPADDQ v2, v0, v0; \ - VPADDQ m3, v1, v1; \ - VPADDQ v3, v1, v1; \ - VPXOR v0, v6, v6; \ - VPXOR v1, v7, v7; \ - VPSHUFB c48, v6, v6; \ - VPSHUFB c48, v7, v7; \ - VPADDQ v6, v4, v4; \ - VPADDQ v7, v5, v5; \ - VPXOR v4, v2, v2; \ - VPXOR v5, v3, v3; \ - VPADDQ v2, v2, t0; \ - VPSRLQ $63, v2, v2; \ - VPXOR t0, v2, v2; \ - VPADDQ v3, v3, t0; \ - VPSRLQ $63, v3, v3; \ - VPXOR t0, v3, v3 - -// load msg: X12 = (i0, i1), X13 = (i2, i3), X14 = (i4, i5), X15 = (i6, i7) -// i0, i1, i2, i3, i4, i5, i6, i7 must not be 0 -#define LOAD_MSG_AVX(i0, i1, i2, i3, i4, i5, i6, i7) \ - VMOVQ_SI_X12(i0*8); \ - VMOVQ_SI_X13(i2*8); \ - VMOVQ_SI_X14(i4*8); \ - VMOVQ_SI_X15(i6*8); \ - VPINSRQ_1_SI_X12(i1*8); \ - VPINSRQ_1_SI_X13(i3*8); \ - VPINSRQ_1_SI_X14(i5*8); \ - VPINSRQ_1_SI_X15(i7*8) - -// load msg: X12 = (0, 2), X13 = (4, 6), X14 = (1, 3), X15 = (5, 7) -#define LOAD_MSG_AVX_0_2_4_6_1_3_5_7() \ - VMOVQ_SI_X12_0; \ - VMOVQ_SI_X13(4*8); \ - VMOVQ_SI_X14(1*8); \ - VMOVQ_SI_X15(5*8); \ - VPINSRQ_1_SI_X12(2*8); \ - VPINSRQ_1_SI_X13(6*8); \ - VPINSRQ_1_SI_X14(3*8); \ - VPINSRQ_1_SI_X15(7*8) - -// load msg: X12 = (1, 0), X13 = (11, 5), X14 = (12, 2), X15 = (7, 3) -#define LOAD_MSG_AVX_1_0_11_5_12_2_7_3() \ - VPSHUFD $0x4E, 0*8(SI), X12; \ - VMOVQ_SI_X13(11*8); \ - VMOVQ_SI_X14(12*8); \ - VMOVQ_SI_X15(7*8); \ - VPINSRQ_1_SI_X13(5*8); \ - VPINSRQ_1_SI_X14(2*8); \ - VPINSRQ_1_SI_X15(3*8) - -// load msg: X12 = (11, 12), X13 = (5, 15), X14 = (8, 0), X15 = (2, 13) -#define LOAD_MSG_AVX_11_12_5_15_8_0_2_13() \ - VMOVDQU 11*8(SI), X12; \ - VMOVQ_SI_X13(5*8); \ - VMOVQ_SI_X14(8*8); \ - VMOVQ_SI_X15(2*8); \ - VPINSRQ_1_SI_X13(15*8); \ - VPINSRQ_1_SI_X14_0; \ - VPINSRQ_1_SI_X15(13*8) - -// load msg: X12 = (2, 5), X13 = (4, 15), X14 = (6, 10), X15 = (0, 8) -#define LOAD_MSG_AVX_2_5_4_15_6_10_0_8() \ - VMOVQ_SI_X12(2*8); \ - VMOVQ_SI_X13(4*8); \ - VMOVQ_SI_X14(6*8); \ - VMOVQ_SI_X15_0; \ - VPINSRQ_1_SI_X12(5*8); \ - VPINSRQ_1_SI_X13(15*8); \ - VPINSRQ_1_SI_X14(10*8); \ - VPINSRQ_1_SI_X15(8*8) - -// load msg: X12 = (9, 5), X13 = (2, 10), X14 = (0, 7), X15 = (4, 15) -#define LOAD_MSG_AVX_9_5_2_10_0_7_4_15() \ - VMOVQ_SI_X12(9*8); \ - VMOVQ_SI_X13(2*8); \ - VMOVQ_SI_X14_0; \ - VMOVQ_SI_X15(4*8); \ - VPINSRQ_1_SI_X12(5*8); \ - VPINSRQ_1_SI_X13(10*8); \ - VPINSRQ_1_SI_X14(7*8); \ - VPINSRQ_1_SI_X15(15*8) - -// load msg: X12 = (2, 6), X13 = (0, 8), X14 = (12, 10), X15 = (11, 3) -#define LOAD_MSG_AVX_2_6_0_8_12_10_11_3() \ - VMOVQ_SI_X12(2*8); \ - VMOVQ_SI_X13_0; \ - VMOVQ_SI_X14(12*8); \ - VMOVQ_SI_X15(11*8); \ - VPINSRQ_1_SI_X12(6*8); \ - VPINSRQ_1_SI_X13(8*8); \ - VPINSRQ_1_SI_X14(10*8); \ - VPINSRQ_1_SI_X15(3*8) - -// load msg: X12 = (0, 6), X13 = (9, 8), X14 = (7, 3), X15 = (2, 11) -#define LOAD_MSG_AVX_0_6_9_8_7_3_2_11() \ - MOVQ 0*8(SI), X12; \ - VPSHUFD $0x4E, 8*8(SI), X13; \ - MOVQ 7*8(SI), X14; \ - MOVQ 2*8(SI), X15; \ - VPINSRQ_1_SI_X12(6*8); \ - VPINSRQ_1_SI_X14(3*8); \ - VPINSRQ_1_SI_X15(11*8) - -// load msg: X12 = (6, 14), X13 = (11, 0), X14 = (15, 9), X15 = (3, 8) -#define LOAD_MSG_AVX_6_14_11_0_15_9_3_8() \ - MOVQ 6*8(SI), X12; \ - MOVQ 11*8(SI), X13; \ - MOVQ 15*8(SI), X14; \ - MOVQ 3*8(SI), X15; \ - VPINSRQ_1_SI_X12(14*8); \ - VPINSRQ_1_SI_X13_0; \ - VPINSRQ_1_SI_X14(9*8); \ - VPINSRQ_1_SI_X15(8*8) - -// load msg: X12 = (5, 15), X13 = (8, 2), X14 = (0, 4), X15 = (6, 10) -#define LOAD_MSG_AVX_5_15_8_2_0_4_6_10() \ - MOVQ 5*8(SI), X12; \ - MOVQ 8*8(SI), X13; \ - MOVQ 0*8(SI), X14; \ - MOVQ 6*8(SI), X15; \ - VPINSRQ_1_SI_X12(15*8); \ - VPINSRQ_1_SI_X13(2*8); \ - VPINSRQ_1_SI_X14(4*8); \ - VPINSRQ_1_SI_X15(10*8) - -// load msg: X12 = (12, 13), X13 = (1, 10), X14 = (2, 7), X15 = (4, 5) -#define LOAD_MSG_AVX_12_13_1_10_2_7_4_5() \ - VMOVDQU 12*8(SI), X12; \ - MOVQ 1*8(SI), X13; \ - MOVQ 2*8(SI), X14; \ - VPINSRQ_1_SI_X13(10*8); \ - VPINSRQ_1_SI_X14(7*8); \ - VMOVDQU 4*8(SI), X15 - -// load msg: X12 = (15, 9), X13 = (3, 13), X14 = (11, 14), X15 = (12, 0) -#define LOAD_MSG_AVX_15_9_3_13_11_14_12_0() \ - MOVQ 15*8(SI), X12; \ - MOVQ 3*8(SI), X13; \ - MOVQ 11*8(SI), X14; \ - MOVQ 12*8(SI), X15; \ - VPINSRQ_1_SI_X12(9*8); \ - VPINSRQ_1_SI_X13(13*8); \ - VPINSRQ_1_SI_X14(14*8); \ - VPINSRQ_1_SI_X15_0 +DATA ·AVX2_iv1<>+0(SB)/8, $0x510e527fade682d1 +DATA ·AVX2_iv1<>+8(SB)/8, $0x9b05688c2b3e6c1f +DATA ·AVX2_iv1<>+16(SB)/8, $0x1f83d9abfb41bd6b +DATA ·AVX2_iv1<>+24(SB)/8, $0x5be0cd19137e2179 +GLOBL ·AVX2_iv1<>(SB), RODATA|NOPTR, $32 // func hashBlocksAVX(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) -TEXT ·hashBlocksAVX(SB), 4, $288-48 // frame size = 272 + 16 byte alignment - MOVQ h+0(FP), AX - MOVQ c+8(FP), BX - MOVQ flag+16(FP), CX - MOVQ blocks_base+24(FP), SI - MOVQ blocks_len+32(FP), DI - - MOVQ SP, R10 - ADDQ $15, R10 - ANDQ $~15, R10 - - VMOVDQU ·AVX_c40<>(SB), X0 - VMOVDQU ·AVX_c48<>(SB), X1 +// Requires: AVX, SSE2 +TEXT ·hashBlocksAVX(SB), NOSPLIT, $288-48 + MOVQ h+0(FP), AX + MOVQ c+8(FP), BX + MOVQ flag+16(FP), CX + MOVQ blocks_base+24(FP), SI + MOVQ blocks_len+32(FP), DI + MOVQ SP, R10 + ADDQ $0x0f, R10 + ANDQ $-16, R10 + VMOVDQU ·AVX_c40<>+0(SB), X0 + VMOVDQU ·AVX_c48<>+0(SB), X1 VMOVDQA X0, X8 VMOVDQA X1, X9 - - VMOVDQU ·AVX_iv3<>(SB), X0 - VMOVDQA X0, 0(R10) - XORQ CX, 0(R10) // 0(R10) = ·AVX_iv3 ^ (CX || 0) - - VMOVDQU 0(AX), X10 + VMOVDQU ·AVX_iv3<>+0(SB), X0 + VMOVDQA X0, (R10) + XORQ CX, (R10) + VMOVDQU (AX), X10 VMOVDQU 16(AX), X11 VMOVDQU 32(AX), X2 VMOVDQU 48(AX), X3 - - MOVQ 0(BX), R8 - MOVQ 8(BX), R9 + MOVQ (BX), R8 + MOVQ 8(BX), R9 loop: - ADDQ $128, R8 - CMPQ R8, $128 + ADDQ $0x80, R8 + CMPQ R8, $0x80 JGE noinc INCQ R9 noinc: - VMOVQ_R8_X15 - VPINSRQ_1_R9_X15 - + BYTE $0xc4 + BYTE $0x41 + BYTE $0xf9 + BYTE $0x6e + BYTE $0xf8 + BYTE $0xc4 + BYTE $0x43 + BYTE $0x81 + BYTE $0x22 + BYTE $0xf9 + BYTE $0x01 VMOVDQA X10, X0 VMOVDQA X11, X1 - VMOVDQU ·AVX_iv0<>(SB), X4 - VMOVDQU ·AVX_iv1<>(SB), X5 - VMOVDQU ·AVX_iv2<>(SB), X6 - + VMOVDQU ·AVX_iv0<>+0(SB), X4 + VMOVDQU ·AVX_iv1<>+0(SB), X5 + VMOVDQU ·AVX_iv2<>+0(SB), X6 VPXOR X15, X6, X6 - VMOVDQA 0(R10), X7 - - LOAD_MSG_AVX_0_2_4_6_1_3_5_7() + VMOVDQA (R10), X7 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x26 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x20 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x08 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x28 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x10 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x30 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x18 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x38 + BYTE $0x01 VMOVDQA X12, 16(R10) VMOVDQA X13, 32(R10) VMOVDQA X14, 48(R10) VMOVDQA X15, 64(R10) - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX() - LOAD_MSG_AVX(8, 10, 12, 14, 9, 11, 13, 15) + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X6, X13 + VMOVDQA X2, X14 + VMOVDQA X4, X6 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x11 + BYTE $0x6c + BYTE $0xfd + VMOVDQA X5, X4 + VMOVDQA X6, X5 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x69 + BYTE $0x6d + BYTE $0xd7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xdf + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x40 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x60 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x48 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x68 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x50 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x70 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x58 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x78 + BYTE $0x01 VMOVDQA X12, 80(R10) VMOVDQA X13, 96(R10) VMOVDQA X14, 112(R10) VMOVDQA X15, 128(R10) - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX_INV() - - LOAD_MSG_AVX(14, 4, 9, 13, 10, 8, 15, 6) + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X2, X13 + VMOVDQA X4, X14 + BYTE $0xc5 + BYTE $0x69 + BYTE $0x6c + BYTE $0xfa + VMOVDQA X5, X4 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xd7 + VMOVDQA X14, X5 + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + VMOVDQA X6, X14 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xdf + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x49 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x70 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x48 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x50 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x78 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x20 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x68 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x40 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x30 + BYTE $0x01 VMOVDQA X12, 144(R10) VMOVDQA X13, 160(R10) VMOVDQA X14, 176(R10) VMOVDQA X15, 192(R10) - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX() - LOAD_MSG_AVX_1_0_11_5_12_2_7_3() + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X6, X13 + VMOVDQA X2, X14 + VMOVDQA X4, X6 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x11 + BYTE $0x6c + BYTE $0xfd + VMOVDQA X5, X4 + VMOVDQA X6, X5 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x69 + BYTE $0x6d + BYTE $0xd7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xdf + VPSHUFD $0x4e, (SI), X12 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x58 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x60 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x38 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x28 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x10 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x18 + BYTE $0x01 VMOVDQA X12, 208(R10) VMOVDQA X13, 224(R10) VMOVDQA X14, 240(R10) VMOVDQA X15, 256(R10) - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX_INV() - - LOAD_MSG_AVX_11_12_5_15_8_0_2_13() - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX() - LOAD_MSG_AVX(10, 3, 7, 9, 14, 6, 1, 4) - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX_INV() - - LOAD_MSG_AVX(7, 3, 13, 11, 9, 1, 12, 14) - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX() - LOAD_MSG_AVX_2_5_4_15_6_10_0_8() - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX_INV() - - LOAD_MSG_AVX_9_5_2_10_0_7_4_15() - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX() - LOAD_MSG_AVX(14, 11, 6, 3, 1, 12, 8, 13) - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX_INV() - - LOAD_MSG_AVX_2_6_0_8_12_10_11_3() - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX() - LOAD_MSG_AVX(4, 7, 15, 1, 13, 5, 14, 9) - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX_INV() - - LOAD_MSG_AVX(12, 1, 14, 4, 5, 15, 13, 10) - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX() - LOAD_MSG_AVX_0_6_9_8_7_3_2_11() - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX_INV() - - LOAD_MSG_AVX(13, 7, 12, 3, 11, 14, 1, 9) - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX() - LOAD_MSG_AVX_5_15_8_2_0_4_6_10() - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX_INV() - - LOAD_MSG_AVX_6_14_11_0_15_9_3_8() - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX() - LOAD_MSG_AVX_12_13_1_10_2_7_4_5() - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX_INV() - - LOAD_MSG_AVX(10, 8, 7, 1, 2, 4, 6, 5) - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX() - LOAD_MSG_AVX_15_9_3_13_11_14_12_0() - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) - SHUFFLE_AVX_INV() - - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, 16(R10), 32(R10), 48(R10), 64(R10), X15, X8, X9) - SHUFFLE_AVX() - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, 80(R10), 96(R10), 112(R10), 128(R10), X15, X8, X9) - SHUFFLE_AVX_INV() - - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, 144(R10), 160(R10), 176(R10), 192(R10), X15, X8, X9) - SHUFFLE_AVX() - HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, 208(R10), 224(R10), 240(R10), 256(R10), X15, X8, X9) - SHUFFLE_AVX_INV() - + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X2, X13 + VMOVDQA X4, X14 + BYTE $0xc5 + BYTE $0x69 + BYTE $0x6c + BYTE $0xfa + VMOVDQA X5, X4 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xd7 + VMOVDQA X14, X5 + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + VMOVDQA X6, X14 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xdf + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x49 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xff + VMOVDQU 88(SI), X12 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x28 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x40 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x10 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x78 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x36 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x68 + BYTE $0x01 + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X6, X13 + VMOVDQA X2, X14 + VMOVDQA X4, X6 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x11 + BYTE $0x6c + BYTE $0xfd + VMOVDQA X5, X4 + VMOVDQA X6, X5 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x69 + BYTE $0x6d + BYTE $0xd7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xdf + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x50 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x38 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x70 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x08 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x18 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x48 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x30 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x20 + BYTE $0x01 + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X2, X13 + VMOVDQA X4, X14 + BYTE $0xc5 + BYTE $0x69 + BYTE $0x6c + BYTE $0xfa + VMOVDQA X5, X4 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xd7 + VMOVDQA X14, X5 + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + VMOVDQA X6, X14 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xdf + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x49 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x38 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x68 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x48 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x60 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x18 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x58 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x08 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x70 + BYTE $0x01 + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X6, X13 + VMOVDQA X2, X14 + VMOVDQA X4, X6 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x11 + BYTE $0x6c + BYTE $0xfd + VMOVDQA X5, X4 + VMOVDQA X6, X5 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x69 + BYTE $0x6d + BYTE $0xd7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xdf + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x10 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x20 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x30 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x3e + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x28 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x78 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x50 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x40 + BYTE $0x01 + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X2, X13 + VMOVDQA X4, X14 + BYTE $0xc5 + BYTE $0x69 + BYTE $0x6c + BYTE $0xfa + VMOVDQA X5, X4 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xd7 + VMOVDQA X14, X5 + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + VMOVDQA X6, X14 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xdf + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x49 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x48 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x10 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x36 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x20 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x28 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x50 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x38 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x78 + BYTE $0x01 + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X6, X13 + VMOVDQA X2, X14 + VMOVDQA X4, X6 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x11 + BYTE $0x6c + BYTE $0xfd + VMOVDQA X5, X4 + VMOVDQA X6, X5 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x69 + BYTE $0x6d + BYTE $0xd7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xdf + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x70 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x30 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x08 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x40 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x58 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x18 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x60 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x68 + BYTE $0x01 + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X2, X13 + VMOVDQA X4, X14 + BYTE $0xc5 + BYTE $0x69 + BYTE $0x6c + BYTE $0xfa + VMOVDQA X5, X4 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xd7 + VMOVDQA X14, X5 + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + VMOVDQA X6, X14 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xdf + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x49 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x10 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x2e + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x60 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x58 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x30 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x40 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x50 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x18 + BYTE $0x01 + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X6, X13 + VMOVDQA X2, X14 + VMOVDQA X4, X6 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x11 + BYTE $0x6c + BYTE $0xfd + VMOVDQA X5, X4 + VMOVDQA X6, X5 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x69 + BYTE $0x6d + BYTE $0xd7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xdf + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x20 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x78 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x68 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x70 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x38 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x08 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x28 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x48 + BYTE $0x01 + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X2, X13 + VMOVDQA X4, X14 + BYTE $0xc5 + BYTE $0x69 + BYTE $0x6c + BYTE $0xfa + VMOVDQA X5, X4 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xd7 + VMOVDQA X14, X5 + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + VMOVDQA X6, X14 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xdf + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x49 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x60 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x70 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x28 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x68 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x08 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x20 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x78 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x50 + BYTE $0x01 + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X6, X13 + VMOVDQA X2, X14 + VMOVDQA X4, X6 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x11 + BYTE $0x6c + BYTE $0xfd + VMOVDQA X5, X4 + VMOVDQA X6, X5 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x69 + BYTE $0x6d + BYTE $0xd7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xdf + MOVQ (SI), X12 + VPSHUFD $0x4e, 64(SI), X13 + MOVQ 56(SI), X14 + MOVQ 16(SI), X15 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x30 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x18 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x58 + BYTE $0x01 + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X2, X13 + VMOVDQA X4, X14 + BYTE $0xc5 + BYTE $0x69 + BYTE $0x6c + BYTE $0xfa + VMOVDQA X5, X4 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xd7 + VMOVDQA X14, X5 + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + VMOVDQA X6, X14 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xdf + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x49 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x68 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x60 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x58 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x08 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x38 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x18 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x70 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x48 + BYTE $0x01 + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X6, X13 + VMOVDQA X2, X14 + VMOVDQA X4, X6 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x11 + BYTE $0x6c + BYTE $0xfd + VMOVDQA X5, X4 + VMOVDQA X6, X5 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x69 + BYTE $0x6d + BYTE $0xd7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xdf + MOVQ 40(SI), X12 + MOVQ 64(SI), X13 + MOVQ (SI), X14 + MOVQ 48(SI), X15 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x78 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x10 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x20 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x50 + BYTE $0x01 + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X2, X13 + VMOVDQA X4, X14 + BYTE $0xc5 + BYTE $0x69 + BYTE $0x6c + BYTE $0xfa + VMOVDQA X5, X4 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xd7 + VMOVDQA X14, X5 + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + VMOVDQA X6, X14 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xdf + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x49 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xff + MOVQ 48(SI), X12 + MOVQ 88(SI), X13 + MOVQ 120(SI), X14 + MOVQ 24(SI), X15 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x70 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x2e + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x48 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x40 + BYTE $0x01 + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X6, X13 + VMOVDQA X2, X14 + VMOVDQA X4, X6 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x11 + BYTE $0x6c + BYTE $0xfd + VMOVDQA X5, X4 + VMOVDQA X6, X5 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x69 + BYTE $0x6d + BYTE $0xd7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xdf + VMOVDQU 96(SI), X12 + MOVQ 8(SI), X13 + MOVQ 16(SI), X14 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x50 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x38 + BYTE $0x01 + VMOVDQU 32(SI), X15 + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X2, X13 + VMOVDQA X4, X14 + BYTE $0xc5 + BYTE $0x69 + BYTE $0x6c + BYTE $0xfa + VMOVDQA X5, X4 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xd7 + VMOVDQA X14, X5 + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + VMOVDQA X6, X14 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xdf + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x49 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x66 + BYTE $0x50 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x6e + BYTE $0x38 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x76 + BYTE $0x10 + BYTE $0xc5 + BYTE $0x7a + BYTE $0x7e + BYTE $0x7e + BYTE $0x30 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x40 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x08 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x20 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x7e + BYTE $0x28 + BYTE $0x01 + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X6, X13 + VMOVDQA X2, X14 + VMOVDQA X4, X6 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x11 + BYTE $0x6c + BYTE $0xfd + VMOVDQA X5, X4 + VMOVDQA X6, X5 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x69 + BYTE $0x6d + BYTE $0xd7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xdf + MOVQ 120(SI), X12 + MOVQ 24(SI), X13 + MOVQ 88(SI), X14 + MOVQ 96(SI), X15 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x99 + BYTE $0x22 + BYTE $0x66 + BYTE $0x48 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x91 + BYTE $0x22 + BYTE $0x6e + BYTE $0x68 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x89 + BYTE $0x22 + BYTE $0x76 + BYTE $0x70 + BYTE $0x01 + BYTE $0xc4 + BYTE $0x63 + BYTE $0x81 + BYTE $0x22 + BYTE $0x3e + BYTE $0x01 + VPADDQ X12, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X13, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ X14, X0, X0 + VPADDQ X2, X0, X0 + VPADDQ X15, X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X2, X13 + VMOVDQA X4, X14 + BYTE $0xc5 + BYTE $0x69 + BYTE $0x6c + BYTE $0xfa + VMOVDQA X5, X4 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xd7 + VMOVDQA X14, X5 + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + VMOVDQA X6, X14 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xdf + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x49 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xff + VPADDQ 16(R10), X0, X0 + VPADDQ X2, X0, X0 + VPADDQ 32(R10), X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ 48(R10), X0, X0 + VPADDQ X2, X0, X0 + VPADDQ 64(R10), X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X6, X13 + VMOVDQA X2, X14 + VMOVDQA X4, X6 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x11 + BYTE $0x6c + BYTE $0xfd + VMOVDQA X5, X4 + VMOVDQA X6, X5 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x69 + BYTE $0x6d + BYTE $0xd7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xdf + VPADDQ 80(R10), X0, X0 + VPADDQ X2, X0, X0 + VPADDQ 96(R10), X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ 112(R10), X0, X0 + VPADDQ X2, X0, X0 + VPADDQ 128(R10), X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X2, X13 + VMOVDQA X4, X14 + BYTE $0xc5 + BYTE $0x69 + BYTE $0x6c + BYTE $0xfa + VMOVDQA X5, X4 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xd7 + VMOVDQA X14, X5 + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + VMOVDQA X6, X14 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xdf + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x49 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xff + VPADDQ 144(R10), X0, X0 + VPADDQ X2, X0, X0 + VPADDQ 160(R10), X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ 176(R10), X0, X0 + VPADDQ X2, X0, X0 + VPADDQ 192(R10), X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X6, X13 + VMOVDQA X2, X14 + VMOVDQA X4, X6 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x11 + BYTE $0x6c + BYTE $0xfd + VMOVDQA X5, X4 + VMOVDQA X6, X5 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xff + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x69 + BYTE $0x6d + BYTE $0xd7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xdf + VPADDQ 208(R10), X0, X0 + VPADDQ X2, X0, X0 + VPADDQ 224(R10), X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFD $-79, X6, X6 + VPSHUFD $-79, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPSHUFB X8, X2, X2 + VPSHUFB X8, X3, X3 + VPADDQ 240(R10), X0, X0 + VPADDQ X2, X0, X0 + VPADDQ 256(R10), X1, X1 + VPADDQ X3, X1, X1 + VPXOR X0, X6, X6 + VPXOR X1, X7, X7 + VPSHUFB X9, X6, X6 + VPSHUFB X9, X7, X7 + VPADDQ X6, X4, X4 + VPADDQ X7, X5, X5 + VPXOR X4, X2, X2 + VPXOR X5, X3, X3 + VPADDQ X2, X2, X15 + VPSRLQ $0x3f, X2, X2 + VPXOR X15, X2, X2 + VPADDQ X3, X3, X15 + VPSRLQ $0x3f, X3, X3 + VPXOR X15, X3, X3 + VMOVDQA X2, X13 + VMOVDQA X4, X14 + BYTE $0xc5 + BYTE $0x69 + BYTE $0x6c + BYTE $0xfa + VMOVDQA X5, X4 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x61 + BYTE $0x6d + BYTE $0xd7 + VMOVDQA X14, X5 + BYTE $0xc5 + BYTE $0x61 + BYTE $0x6c + BYTE $0xfb + VMOVDQA X6, X14 + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x11 + BYTE $0x6d + BYTE $0xdf + BYTE $0xc5 + BYTE $0x41 + BYTE $0x6c + BYTE $0xff + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x49 + BYTE $0x6d + BYTE $0xf7 + BYTE $0xc4 + BYTE $0x41 + BYTE $0x09 + BYTE $0x6c + BYTE $0xfe + BYTE $0xc4 + BYTE $0xc1 + BYTE $0x41 + BYTE $0x6d + BYTE $0xff VMOVDQU 32(AX), X14 VMOVDQU 48(AX), X15 VPXOR X0, X10, X10 @@ -729,16 +4524,36 @@ noinc: VPXOR X7, X15, X3 VMOVDQU X2, 32(AX) VMOVDQU X3, 48(AX) - - LEAQ 128(SI), SI - SUBQ $128, DI - JNE loop - - VMOVDQU X10, 0(AX) + LEAQ 128(SI), SI + SUBQ $0x80, DI + JNE loop + VMOVDQU X10, (AX) VMOVDQU X11, 16(AX) - - MOVQ R8, 0(BX) - MOVQ R9, 8(BX) + MOVQ R8, (BX) + MOVQ R9, 8(BX) VZEROUPPER - RET + +DATA ·AVX_c40<>+0(SB)/8, $0x0201000706050403 +DATA ·AVX_c40<>+8(SB)/8, $0x0a09080f0e0d0c0b +GLOBL ·AVX_c40<>(SB), RODATA|NOPTR, $16 + +DATA ·AVX_c48<>+0(SB)/8, $0x0100070605040302 +DATA ·AVX_c48<>+8(SB)/8, $0x09080f0e0d0c0b0a +GLOBL ·AVX_c48<>(SB), RODATA|NOPTR, $16 + +DATA ·AVX_iv3<>+0(SB)/8, $0x1f83d9abfb41bd6b +DATA ·AVX_iv3<>+8(SB)/8, $0x5be0cd19137e2179 +GLOBL ·AVX_iv3<>(SB), RODATA|NOPTR, $16 + +DATA ·AVX_iv0<>+0(SB)/8, $0x6a09e667f3bcc908 +DATA ·AVX_iv0<>+8(SB)/8, $0xbb67ae8584caa73b +GLOBL ·AVX_iv0<>(SB), RODATA|NOPTR, $16 + +DATA ·AVX_iv1<>+0(SB)/8, $0x3c6ef372fe94f82b +DATA ·AVX_iv1<>+8(SB)/8, $0xa54ff53a5f1d36f1 +GLOBL ·AVX_iv1<>(SB), RODATA|NOPTR, $16 + +DATA ·AVX_iv2<>+0(SB)/8, $0x510e527fade682d1 +DATA ·AVX_iv2<>+8(SB)/8, $0x9b05688c2b3e6c1f +GLOBL ·AVX_iv2<>(SB), RODATA|NOPTR, $16 diff --git a/vendor/golang.org/x/crypto/blake2b/blake2b_amd64.s b/vendor/golang.org/x/crypto/blake2b/blake2b_amd64.s index adfac00c..9a0ce212 100644 --- a/vendor/golang.org/x/crypto/blake2b/blake2b_amd64.s +++ b/vendor/golang.org/x/crypto/blake2b/blake2b_amd64.s @@ -1,278 +1,1441 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. +// Code generated by command: go run blake2b_amd64_asm.go -out ../../blake2b_amd64.s -pkg blake2b. DO NOT EDIT. //go:build amd64 && gc && !purego #include "textflag.h" -DATA ·iv0<>+0x00(SB)/8, $0x6a09e667f3bcc908 -DATA ·iv0<>+0x08(SB)/8, $0xbb67ae8584caa73b -GLOBL ·iv0<>(SB), (NOPTR+RODATA), $16 - -DATA ·iv1<>+0x00(SB)/8, $0x3c6ef372fe94f82b -DATA ·iv1<>+0x08(SB)/8, $0xa54ff53a5f1d36f1 -GLOBL ·iv1<>(SB), (NOPTR+RODATA), $16 - -DATA ·iv2<>+0x00(SB)/8, $0x510e527fade682d1 -DATA ·iv2<>+0x08(SB)/8, $0x9b05688c2b3e6c1f -GLOBL ·iv2<>(SB), (NOPTR+RODATA), $16 - -DATA ·iv3<>+0x00(SB)/8, $0x1f83d9abfb41bd6b -DATA ·iv3<>+0x08(SB)/8, $0x5be0cd19137e2179 -GLOBL ·iv3<>(SB), (NOPTR+RODATA), $16 - -DATA ·c40<>+0x00(SB)/8, $0x0201000706050403 -DATA ·c40<>+0x08(SB)/8, $0x0a09080f0e0d0c0b -GLOBL ·c40<>(SB), (NOPTR+RODATA), $16 - -DATA ·c48<>+0x00(SB)/8, $0x0100070605040302 -DATA ·c48<>+0x08(SB)/8, $0x09080f0e0d0c0b0a -GLOBL ·c48<>(SB), (NOPTR+RODATA), $16 - -#define SHUFFLE(v2, v3, v4, v5, v6, v7, t1, t2) \ - MOVO v4, t1; \ - MOVO v5, v4; \ - MOVO t1, v5; \ - MOVO v6, t1; \ - PUNPCKLQDQ v6, t2; \ - PUNPCKHQDQ v7, v6; \ - PUNPCKHQDQ t2, v6; \ - PUNPCKLQDQ v7, t2; \ - MOVO t1, v7; \ - MOVO v2, t1; \ - PUNPCKHQDQ t2, v7; \ - PUNPCKLQDQ v3, t2; \ - PUNPCKHQDQ t2, v2; \ - PUNPCKLQDQ t1, t2; \ - PUNPCKHQDQ t2, v3 - -#define SHUFFLE_INV(v2, v3, v4, v5, v6, v7, t1, t2) \ - MOVO v4, t1; \ - MOVO v5, v4; \ - MOVO t1, v5; \ - MOVO v2, t1; \ - PUNPCKLQDQ v2, t2; \ - PUNPCKHQDQ v3, v2; \ - PUNPCKHQDQ t2, v2; \ - PUNPCKLQDQ v3, t2; \ - MOVO t1, v3; \ - MOVO v6, t1; \ - PUNPCKHQDQ t2, v3; \ - PUNPCKLQDQ v7, t2; \ - PUNPCKHQDQ t2, v6; \ - PUNPCKLQDQ t1, t2; \ - PUNPCKHQDQ t2, v7 - -#define HALF_ROUND(v0, v1, v2, v3, v4, v5, v6, v7, m0, m1, m2, m3, t0, c40, c48) \ - PADDQ m0, v0; \ - PADDQ m1, v1; \ - PADDQ v2, v0; \ - PADDQ v3, v1; \ - PXOR v0, v6; \ - PXOR v1, v7; \ - PSHUFD $0xB1, v6, v6; \ - PSHUFD $0xB1, v7, v7; \ - PADDQ v6, v4; \ - PADDQ v7, v5; \ - PXOR v4, v2; \ - PXOR v5, v3; \ - PSHUFB c40, v2; \ - PSHUFB c40, v3; \ - PADDQ m2, v0; \ - PADDQ m3, v1; \ - PADDQ v2, v0; \ - PADDQ v3, v1; \ - PXOR v0, v6; \ - PXOR v1, v7; \ - PSHUFB c48, v6; \ - PSHUFB c48, v7; \ - PADDQ v6, v4; \ - PADDQ v7, v5; \ - PXOR v4, v2; \ - PXOR v5, v3; \ - MOVOU v2, t0; \ - PADDQ v2, t0; \ - PSRLQ $63, v2; \ - PXOR t0, v2; \ - MOVOU v3, t0; \ - PADDQ v3, t0; \ - PSRLQ $63, v3; \ - PXOR t0, v3 - -#define LOAD_MSG(m0, m1, m2, m3, src, i0, i1, i2, i3, i4, i5, i6, i7) \ - MOVQ i0*8(src), m0; \ - PINSRQ $1, i1*8(src), m0; \ - MOVQ i2*8(src), m1; \ - PINSRQ $1, i3*8(src), m1; \ - MOVQ i4*8(src), m2; \ - PINSRQ $1, i5*8(src), m2; \ - MOVQ i6*8(src), m3; \ - PINSRQ $1, i7*8(src), m3 - // func hashBlocksSSE4(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) -TEXT ·hashBlocksSSE4(SB), 4, $288-48 // frame size = 272 + 16 byte alignment - MOVQ h+0(FP), AX - MOVQ c+8(FP), BX - MOVQ flag+16(FP), CX - MOVQ blocks_base+24(FP), SI - MOVQ blocks_len+32(FP), DI - - MOVQ SP, R10 - ADDQ $15, R10 - ANDQ $~15, R10 - - MOVOU ·iv3<>(SB), X0 - MOVO X0, 0(R10) - XORQ CX, 0(R10) // 0(R10) = ·iv3 ^ (CX || 0) - - MOVOU ·c40<>(SB), X13 - MOVOU ·c48<>(SB), X14 - - MOVOU 0(AX), X12 +// Requires: SSE2, SSE4.1, SSSE3 +TEXT ·hashBlocksSSE4(SB), NOSPLIT, $288-48 + MOVQ h+0(FP), AX + MOVQ c+8(FP), BX + MOVQ flag+16(FP), CX + MOVQ blocks_base+24(FP), SI + MOVQ blocks_len+32(FP), DI + MOVQ SP, R10 + ADDQ $0x0f, R10 + ANDQ $-16, R10 + MOVOU ·iv3<>+0(SB), X0 + MOVO X0, (R10) + XORQ CX, (R10) + MOVOU ·c40<>+0(SB), X13 + MOVOU ·c48<>+0(SB), X14 + MOVOU (AX), X12 MOVOU 16(AX), X15 - - MOVQ 0(BX), R8 - MOVQ 8(BX), R9 + MOVQ (BX), R8 + MOVQ 8(BX), R9 loop: - ADDQ $128, R8 - CMPQ R8, $128 + ADDQ $0x80, R8 + CMPQ R8, $0x80 JGE noinc INCQ R9 noinc: - MOVQ R8, X8 - PINSRQ $1, R9, X8 - - MOVO X12, X0 - MOVO X15, X1 - MOVOU 32(AX), X2 - MOVOU 48(AX), X3 - MOVOU ·iv0<>(SB), X4 - MOVOU ·iv1<>(SB), X5 - MOVOU ·iv2<>(SB), X6 - - PXOR X8, X6 - MOVO 0(R10), X7 - - LOAD_MSG(X8, X9, X10, X11, SI, 0, 2, 4, 6, 1, 3, 5, 7) - MOVO X8, 16(R10) - MOVO X9, 32(R10) - MOVO X10, 48(R10) - MOVO X11, 64(R10) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) - LOAD_MSG(X8, X9, X10, X11, SI, 8, 10, 12, 14, 9, 11, 13, 15) - MOVO X8, 80(R10) - MOVO X9, 96(R10) - MOVO X10, 112(R10) - MOVO X11, 128(R10) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) - - LOAD_MSG(X8, X9, X10, X11, SI, 14, 4, 9, 13, 10, 8, 15, 6) - MOVO X8, 144(R10) - MOVO X9, 160(R10) - MOVO X10, 176(R10) - MOVO X11, 192(R10) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) - LOAD_MSG(X8, X9, X10, X11, SI, 1, 0, 11, 5, 12, 2, 7, 3) - MOVO X8, 208(R10) - MOVO X9, 224(R10) - MOVO X10, 240(R10) - MOVO X11, 256(R10) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) - - LOAD_MSG(X8, X9, X10, X11, SI, 11, 12, 5, 15, 8, 0, 2, 13) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) - LOAD_MSG(X8, X9, X10, X11, SI, 10, 3, 7, 9, 14, 6, 1, 4) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) - - LOAD_MSG(X8, X9, X10, X11, SI, 7, 3, 13, 11, 9, 1, 12, 14) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) - LOAD_MSG(X8, X9, X10, X11, SI, 2, 5, 4, 15, 6, 10, 0, 8) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) - - LOAD_MSG(X8, X9, X10, X11, SI, 9, 5, 2, 10, 0, 7, 4, 15) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) - LOAD_MSG(X8, X9, X10, X11, SI, 14, 11, 6, 3, 1, 12, 8, 13) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) - - LOAD_MSG(X8, X9, X10, X11, SI, 2, 6, 0, 8, 12, 10, 11, 3) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) - LOAD_MSG(X8, X9, X10, X11, SI, 4, 7, 15, 1, 13, 5, 14, 9) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) - - LOAD_MSG(X8, X9, X10, X11, SI, 12, 1, 14, 4, 5, 15, 13, 10) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) - LOAD_MSG(X8, X9, X10, X11, SI, 0, 6, 9, 8, 7, 3, 2, 11) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) - - LOAD_MSG(X8, X9, X10, X11, SI, 13, 7, 12, 3, 11, 14, 1, 9) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) - LOAD_MSG(X8, X9, X10, X11, SI, 5, 15, 8, 2, 0, 4, 6, 10) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) - - LOAD_MSG(X8, X9, X10, X11, SI, 6, 14, 11, 0, 15, 9, 3, 8) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) - LOAD_MSG(X8, X9, X10, X11, SI, 12, 13, 1, 10, 2, 7, 4, 5) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) - - LOAD_MSG(X8, X9, X10, X11, SI, 10, 8, 7, 1, 2, 4, 6, 5) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) - LOAD_MSG(X8, X9, X10, X11, SI, 15, 9, 3, 13, 11, 14, 12, 0) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) - SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) - - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, 16(R10), 32(R10), 48(R10), 64(R10), X11, X13, X14) - SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, 80(R10), 96(R10), 112(R10), 128(R10), X11, X13, X14) - SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) - - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, 144(R10), 160(R10), 176(R10), 192(R10), X11, X13, X14) - SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) - HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, 208(R10), 224(R10), 240(R10), 256(R10), X11, X13, X14) - SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) - - MOVOU 32(AX), X10 - MOVOU 48(AX), X11 - PXOR X0, X12 - PXOR X1, X15 - PXOR X2, X10 - PXOR X3, X11 - PXOR X4, X12 - PXOR X5, X15 - PXOR X6, X10 - PXOR X7, X11 - MOVOU X10, 32(AX) - MOVOU X11, 48(AX) - - LEAQ 128(SI), SI - SUBQ $128, DI - JNE loop - - MOVOU X12, 0(AX) - MOVOU X15, 16(AX) - - MOVQ R8, 0(BX) - MOVQ R9, 8(BX) - + MOVQ R8, X8 + PINSRQ $0x01, R9, X8 + MOVO X12, X0 + MOVO X15, X1 + MOVOU 32(AX), X2 + MOVOU 48(AX), X3 + MOVOU ·iv0<>+0(SB), X4 + MOVOU ·iv1<>+0(SB), X5 + MOVOU ·iv2<>+0(SB), X6 + PXOR X8, X6 + MOVO (R10), X7 + MOVQ (SI), X8 + PINSRQ $0x01, 16(SI), X8 + MOVQ 32(SI), X9 + PINSRQ $0x01, 48(SI), X9 + MOVQ 8(SI), X10 + PINSRQ $0x01, 24(SI), X10 + MOVQ 40(SI), X11 + PINSRQ $0x01, 56(SI), X11 + MOVO X8, 16(R10) + MOVO X9, 32(R10) + MOVO X10, 48(R10) + MOVO X11, 64(R10) + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVQ 64(SI), X8 + PINSRQ $0x01, 80(SI), X8 + MOVQ 96(SI), X9 + PINSRQ $0x01, 112(SI), X9 + MOVQ 72(SI), X10 + PINSRQ $0x01, 88(SI), X10 + MOVQ 104(SI), X11 + PINSRQ $0x01, 120(SI), X11 + MOVO X8, 80(R10) + MOVO X9, 96(R10) + MOVO X10, 112(R10) + MOVO X11, 128(R10) + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVQ 112(SI), X8 + PINSRQ $0x01, 32(SI), X8 + MOVQ 72(SI), X9 + PINSRQ $0x01, 104(SI), X9 + MOVQ 80(SI), X10 + PINSRQ $0x01, 64(SI), X10 + MOVQ 120(SI), X11 + PINSRQ $0x01, 48(SI), X11 + MOVO X8, 144(R10) + MOVO X9, 160(R10) + MOVO X10, 176(R10) + MOVO X11, 192(R10) + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVQ 8(SI), X8 + PINSRQ $0x01, (SI), X8 + MOVQ 88(SI), X9 + PINSRQ $0x01, 40(SI), X9 + MOVQ 96(SI), X10 + PINSRQ $0x01, 16(SI), X10 + MOVQ 56(SI), X11 + PINSRQ $0x01, 24(SI), X11 + MOVO X8, 208(R10) + MOVO X9, 224(R10) + MOVO X10, 240(R10) + MOVO X11, 256(R10) + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVQ 88(SI), X8 + PINSRQ $0x01, 96(SI), X8 + MOVQ 40(SI), X9 + PINSRQ $0x01, 120(SI), X9 + MOVQ 64(SI), X10 + PINSRQ $0x01, (SI), X10 + MOVQ 16(SI), X11 + PINSRQ $0x01, 104(SI), X11 + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVQ 80(SI), X8 + PINSRQ $0x01, 24(SI), X8 + MOVQ 56(SI), X9 + PINSRQ $0x01, 72(SI), X9 + MOVQ 112(SI), X10 + PINSRQ $0x01, 48(SI), X10 + MOVQ 8(SI), X11 + PINSRQ $0x01, 32(SI), X11 + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVQ 56(SI), X8 + PINSRQ $0x01, 24(SI), X8 + MOVQ 104(SI), X9 + PINSRQ $0x01, 88(SI), X9 + MOVQ 72(SI), X10 + PINSRQ $0x01, 8(SI), X10 + MOVQ 96(SI), X11 + PINSRQ $0x01, 112(SI), X11 + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVQ 16(SI), X8 + PINSRQ $0x01, 40(SI), X8 + MOVQ 32(SI), X9 + PINSRQ $0x01, 120(SI), X9 + MOVQ 48(SI), X10 + PINSRQ $0x01, 80(SI), X10 + MOVQ (SI), X11 + PINSRQ $0x01, 64(SI), X11 + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVQ 72(SI), X8 + PINSRQ $0x01, 40(SI), X8 + MOVQ 16(SI), X9 + PINSRQ $0x01, 80(SI), X9 + MOVQ (SI), X10 + PINSRQ $0x01, 56(SI), X10 + MOVQ 32(SI), X11 + PINSRQ $0x01, 120(SI), X11 + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVQ 112(SI), X8 + PINSRQ $0x01, 88(SI), X8 + MOVQ 48(SI), X9 + PINSRQ $0x01, 24(SI), X9 + MOVQ 8(SI), X10 + PINSRQ $0x01, 96(SI), X10 + MOVQ 64(SI), X11 + PINSRQ $0x01, 104(SI), X11 + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVQ 16(SI), X8 + PINSRQ $0x01, 48(SI), X8 + MOVQ (SI), X9 + PINSRQ $0x01, 64(SI), X9 + MOVQ 96(SI), X10 + PINSRQ $0x01, 80(SI), X10 + MOVQ 88(SI), X11 + PINSRQ $0x01, 24(SI), X11 + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVQ 32(SI), X8 + PINSRQ $0x01, 56(SI), X8 + MOVQ 120(SI), X9 + PINSRQ $0x01, 8(SI), X9 + MOVQ 104(SI), X10 + PINSRQ $0x01, 40(SI), X10 + MOVQ 112(SI), X11 + PINSRQ $0x01, 72(SI), X11 + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVQ 96(SI), X8 + PINSRQ $0x01, 8(SI), X8 + MOVQ 112(SI), X9 + PINSRQ $0x01, 32(SI), X9 + MOVQ 40(SI), X10 + PINSRQ $0x01, 120(SI), X10 + MOVQ 104(SI), X11 + PINSRQ $0x01, 80(SI), X11 + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVQ (SI), X8 + PINSRQ $0x01, 48(SI), X8 + MOVQ 72(SI), X9 + PINSRQ $0x01, 64(SI), X9 + MOVQ 56(SI), X10 + PINSRQ $0x01, 24(SI), X10 + MOVQ 16(SI), X11 + PINSRQ $0x01, 88(SI), X11 + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVQ 104(SI), X8 + PINSRQ $0x01, 56(SI), X8 + MOVQ 96(SI), X9 + PINSRQ $0x01, 24(SI), X9 + MOVQ 88(SI), X10 + PINSRQ $0x01, 112(SI), X10 + MOVQ 8(SI), X11 + PINSRQ $0x01, 72(SI), X11 + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVQ 40(SI), X8 + PINSRQ $0x01, 120(SI), X8 + MOVQ 64(SI), X9 + PINSRQ $0x01, 16(SI), X9 + MOVQ (SI), X10 + PINSRQ $0x01, 32(SI), X10 + MOVQ 48(SI), X11 + PINSRQ $0x01, 80(SI), X11 + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVQ 48(SI), X8 + PINSRQ $0x01, 112(SI), X8 + MOVQ 88(SI), X9 + PINSRQ $0x01, (SI), X9 + MOVQ 120(SI), X10 + PINSRQ $0x01, 72(SI), X10 + MOVQ 24(SI), X11 + PINSRQ $0x01, 64(SI), X11 + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVQ 96(SI), X8 + PINSRQ $0x01, 104(SI), X8 + MOVQ 8(SI), X9 + PINSRQ $0x01, 80(SI), X9 + MOVQ 16(SI), X10 + PINSRQ $0x01, 56(SI), X10 + MOVQ 32(SI), X11 + PINSRQ $0x01, 40(SI), X11 + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVQ 80(SI), X8 + PINSRQ $0x01, 64(SI), X8 + MOVQ 56(SI), X9 + PINSRQ $0x01, 8(SI), X9 + MOVQ 16(SI), X10 + PINSRQ $0x01, 32(SI), X10 + MOVQ 48(SI), X11 + PINSRQ $0x01, 40(SI), X11 + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + MOVQ 120(SI), X8 + PINSRQ $0x01, 72(SI), X8 + MOVQ 24(SI), X9 + PINSRQ $0x01, 104(SI), X9 + MOVQ 88(SI), X10 + PINSRQ $0x01, 112(SI), X10 + MOVQ 96(SI), X11 + PINSRQ $0x01, (SI), X11 + PADDQ X8, X0 + PADDQ X9, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ X10, X0 + PADDQ X11, X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + PADDQ 16(R10), X0 + PADDQ 32(R10), X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ 48(R10), X0 + PADDQ 64(R10), X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + PADDQ 80(R10), X0 + PADDQ 96(R10), X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ 112(R10), X0 + PADDQ 128(R10), X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + PADDQ 144(R10), X0 + PADDQ 160(R10), X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ 176(R10), X0 + PADDQ 192(R10), X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X6, X8 + PUNPCKLQDQ X6, X9 + PUNPCKHQDQ X7, X6 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X7, X9 + MOVO X8, X7 + MOVO X2, X8 + PUNPCKHQDQ X9, X7 + PUNPCKLQDQ X3, X9 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X3 + PADDQ 208(R10), X0 + PADDQ 224(R10), X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFD $0xb1, X6, X6 + PSHUFD $0xb1, X7, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + PSHUFB X13, X2 + PSHUFB X13, X3 + PADDQ 240(R10), X0 + PADDQ 256(R10), X1 + PADDQ X2, X0 + PADDQ X3, X1 + PXOR X0, X6 + PXOR X1, X7 + PSHUFB X14, X6 + PSHUFB X14, X7 + PADDQ X6, X4 + PADDQ X7, X5 + PXOR X4, X2 + PXOR X5, X3 + MOVOU X2, X11 + PADDQ X2, X11 + PSRLQ $0x3f, X2 + PXOR X11, X2 + MOVOU X3, X11 + PADDQ X3, X11 + PSRLQ $0x3f, X3 + PXOR X11, X3 + MOVO X4, X8 + MOVO X5, X4 + MOVO X8, X5 + MOVO X2, X8 + PUNPCKLQDQ X2, X9 + PUNPCKHQDQ X3, X2 + PUNPCKHQDQ X9, X2 + PUNPCKLQDQ X3, X9 + MOVO X8, X3 + MOVO X6, X8 + PUNPCKHQDQ X9, X3 + PUNPCKLQDQ X7, X9 + PUNPCKHQDQ X9, X6 + PUNPCKLQDQ X8, X9 + PUNPCKHQDQ X9, X7 + MOVOU 32(AX), X10 + MOVOU 48(AX), X11 + PXOR X0, X12 + PXOR X1, X15 + PXOR X2, X10 + PXOR X3, X11 + PXOR X4, X12 + PXOR X5, X15 + PXOR X6, X10 + PXOR X7, X11 + MOVOU X10, 32(AX) + MOVOU X11, 48(AX) + LEAQ 128(SI), SI + SUBQ $0x80, DI + JNE loop + MOVOU X12, (AX) + MOVOU X15, 16(AX) + MOVQ R8, (BX) + MOVQ R9, 8(BX) RET + +DATA ·iv3<>+0(SB)/8, $0x1f83d9abfb41bd6b +DATA ·iv3<>+8(SB)/8, $0x5be0cd19137e2179 +GLOBL ·iv3<>(SB), RODATA|NOPTR, $16 + +DATA ·c40<>+0(SB)/8, $0x0201000706050403 +DATA ·c40<>+8(SB)/8, $0x0a09080f0e0d0c0b +GLOBL ·c40<>(SB), RODATA|NOPTR, $16 + +DATA ·c48<>+0(SB)/8, $0x0100070605040302 +DATA ·c48<>+8(SB)/8, $0x09080f0e0d0c0b0a +GLOBL ·c48<>(SB), RODATA|NOPTR, $16 + +DATA ·iv0<>+0(SB)/8, $0x6a09e667f3bcc908 +DATA ·iv0<>+8(SB)/8, $0xbb67ae8584caa73b +GLOBL ·iv0<>(SB), RODATA|NOPTR, $16 + +DATA ·iv1<>+0(SB)/8, $0x3c6ef372fe94f82b +DATA ·iv1<>+8(SB)/8, $0xa54ff53a5f1d36f1 +GLOBL ·iv1<>(SB), RODATA|NOPTR, $16 + +DATA ·iv2<>+0(SB)/8, $0x510e527fade682d1 +DATA ·iv2<>+8(SB)/8, $0x9b05688c2b3e6c1f +GLOBL ·iv2<>(SB), RODATA|NOPTR, $16 diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519.go b/vendor/golang.org/x/crypto/curve25519/curve25519.go index 00f963ea..21ca3b2e 100644 --- a/vendor/golang.org/x/crypto/curve25519/curve25519.go +++ b/vendor/golang.org/x/crypto/curve25519/curve25519.go @@ -6,9 +6,11 @@ // performs scalar multiplication on the elliptic curve known as Curve25519. // See RFC 7748. // -// Starting in Go 1.20, this package is a wrapper for the X25519 implementation +// This package is a wrapper for the X25519 implementation // in the crypto/ecdh package. -package curve25519 // import "golang.org/x/crypto/curve25519" +package curve25519 + +import "crypto/ecdh" // ScalarMult sets dst to the product scalar * point. // @@ -16,7 +18,13 @@ package curve25519 // import "golang.org/x/crypto/curve25519" // zeroes, irrespective of the scalar. Instead, use the X25519 function, which // will return an error. func ScalarMult(dst, scalar, point *[32]byte) { - scalarMult(dst, scalar, point) + if _, err := x25519(dst, scalar[:], point[:]); err != nil { + // The only error condition for x25519 when the inputs are 32 bytes long + // is if the output would have been the all-zero value. + for i := range dst { + dst[i] = 0 + } + } } // ScalarBaseMult sets dst to the product scalar * base where base is the @@ -25,7 +33,12 @@ func ScalarMult(dst, scalar, point *[32]byte) { // It is recommended to use the X25519 function with Basepoint instead, as // copying into fixed size arrays can lead to unexpected bugs. func ScalarBaseMult(dst, scalar *[32]byte) { - scalarBaseMult(dst, scalar) + curve := ecdh.X25519() + priv, err := curve.NewPrivateKey(scalar[:]) + if err != nil { + panic("curve25519: internal error: scalarBaseMult was not 32 bytes") + } + copy(dst[:], priv.PublicKey().Bytes()) } const ( @@ -57,3 +70,21 @@ func X25519(scalar, point []byte) ([]byte, error) { var dst [32]byte return x25519(&dst, scalar, point) } + +func x25519(dst *[32]byte, scalar, point []byte) ([]byte, error) { + curve := ecdh.X25519() + pub, err := curve.NewPublicKey(point) + if err != nil { + return nil, err + } + priv, err := curve.NewPrivateKey(scalar) + if err != nil { + return nil, err + } + out, err := priv.ECDH(pub) + if err != nil { + return nil, err + } + copy(dst[:], out) + return dst[:], nil +} diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519_compat.go b/vendor/golang.org/x/crypto/curve25519/curve25519_compat.go deleted file mode 100644 index ba647e8d..00000000 --- a/vendor/golang.org/x/crypto/curve25519/curve25519_compat.go +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !go1.20 - -package curve25519 - -import ( - "crypto/subtle" - "errors" - "strconv" - - "golang.org/x/crypto/curve25519/internal/field" -) - -func scalarMult(dst, scalar, point *[32]byte) { - var e [32]byte - - copy(e[:], scalar[:]) - e[0] &= 248 - e[31] &= 127 - e[31] |= 64 - - var x1, x2, z2, x3, z3, tmp0, tmp1 field.Element - x1.SetBytes(point[:]) - x2.One() - x3.Set(&x1) - z3.One() - - swap := 0 - for pos := 254; pos >= 0; pos-- { - b := e[pos/8] >> uint(pos&7) - b &= 1 - swap ^= int(b) - x2.Swap(&x3, swap) - z2.Swap(&z3, swap) - swap = int(b) - - tmp0.Subtract(&x3, &z3) - tmp1.Subtract(&x2, &z2) - x2.Add(&x2, &z2) - z2.Add(&x3, &z3) - z3.Multiply(&tmp0, &x2) - z2.Multiply(&z2, &tmp1) - tmp0.Square(&tmp1) - tmp1.Square(&x2) - x3.Add(&z3, &z2) - z2.Subtract(&z3, &z2) - x2.Multiply(&tmp1, &tmp0) - tmp1.Subtract(&tmp1, &tmp0) - z2.Square(&z2) - - z3.Mult32(&tmp1, 121666) - x3.Square(&x3) - tmp0.Add(&tmp0, &z3) - z3.Multiply(&x1, &z2) - z2.Multiply(&tmp1, &tmp0) - } - - x2.Swap(&x3, swap) - z2.Swap(&z3, swap) - - z2.Invert(&z2) - x2.Multiply(&x2, &z2) - copy(dst[:], x2.Bytes()) -} - -func scalarBaseMult(dst, scalar *[32]byte) { - checkBasepoint() - scalarMult(dst, scalar, &basePoint) -} - -func x25519(dst *[32]byte, scalar, point []byte) ([]byte, error) { - var in [32]byte - if l := len(scalar); l != 32 { - return nil, errors.New("bad scalar length: " + strconv.Itoa(l) + ", expected 32") - } - if l := len(point); l != 32 { - return nil, errors.New("bad point length: " + strconv.Itoa(l) + ", expected 32") - } - copy(in[:], scalar) - if &point[0] == &Basepoint[0] { - scalarBaseMult(dst, &in) - } else { - var base, zero [32]byte - copy(base[:], point) - scalarMult(dst, &in, &base) - if subtle.ConstantTimeCompare(dst[:], zero[:]) == 1 { - return nil, errors.New("bad input point: low order point") - } - } - return dst[:], nil -} - -func checkBasepoint() { - if subtle.ConstantTimeCompare(Basepoint, []byte{ - 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }) != 1 { - panic("curve25519: global Basepoint value was modified") - } -} diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519_go120.go b/vendor/golang.org/x/crypto/curve25519/curve25519_go120.go deleted file mode 100644 index 627df497..00000000 --- a/vendor/golang.org/x/crypto/curve25519/curve25519_go120.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2022 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build go1.20 - -package curve25519 - -import "crypto/ecdh" - -func x25519(dst *[32]byte, scalar, point []byte) ([]byte, error) { - curve := ecdh.X25519() - pub, err := curve.NewPublicKey(point) - if err != nil { - return nil, err - } - priv, err := curve.NewPrivateKey(scalar) - if err != nil { - return nil, err - } - out, err := priv.ECDH(pub) - if err != nil { - return nil, err - } - copy(dst[:], out) - return dst[:], nil -} - -func scalarMult(dst, scalar, point *[32]byte) { - if _, err := x25519(dst, scalar[:], point[:]); err != nil { - // The only error condition for x25519 when the inputs are 32 bytes long - // is if the output would have been the all-zero value. - for i := range dst { - dst[i] = 0 - } - } -} - -func scalarBaseMult(dst, scalar *[32]byte) { - curve := ecdh.X25519() - priv, err := curve.NewPrivateKey(scalar[:]) - if err != nil { - panic("curve25519: internal error: scalarBaseMult was not 32 bytes") - } - copy(dst[:], priv.PublicKey().Bytes()) -} diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/README b/vendor/golang.org/x/crypto/curve25519/internal/field/README deleted file mode 100644 index e25bca7d..00000000 --- a/vendor/golang.org/x/crypto/curve25519/internal/field/README +++ /dev/null @@ -1,7 +0,0 @@ -This package is kept in sync with crypto/ed25519/internal/edwards25519/field in -the standard library. - -If there are any changes in the standard library that need to be synced to this -package, run sync.sh. It will not overwrite any local changes made since the -previous sync, so it's ok to land changes in this package first, and then sync -to the standard library later. diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe.go deleted file mode 100644 index ca841ad9..00000000 --- a/vendor/golang.org/x/crypto/curve25519/internal/field/fe.go +++ /dev/null @@ -1,416 +0,0 @@ -// Copyright (c) 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package field implements fast arithmetic modulo 2^255-19. -package field - -import ( - "crypto/subtle" - "encoding/binary" - "math/bits" -) - -// Element represents an element of the field GF(2^255-19). Note that this -// is not a cryptographically secure group, and should only be used to interact -// with edwards25519.Point coordinates. -// -// This type works similarly to math/big.Int, and all arguments and receivers -// are allowed to alias. -// -// The zero value is a valid zero element. -type Element struct { - // An element t represents the integer - // t.l0 + t.l1*2^51 + t.l2*2^102 + t.l3*2^153 + t.l4*2^204 - // - // Between operations, all limbs are expected to be lower than 2^52. - l0 uint64 - l1 uint64 - l2 uint64 - l3 uint64 - l4 uint64 -} - -const maskLow51Bits uint64 = (1 << 51) - 1 - -var feZero = &Element{0, 0, 0, 0, 0} - -// Zero sets v = 0, and returns v. -func (v *Element) Zero() *Element { - *v = *feZero - return v -} - -var feOne = &Element{1, 0, 0, 0, 0} - -// One sets v = 1, and returns v. -func (v *Element) One() *Element { - *v = *feOne - return v -} - -// reduce reduces v modulo 2^255 - 19 and returns it. -func (v *Element) reduce() *Element { - v.carryPropagate() - - // After the light reduction we now have a field element representation - // v < 2^255 + 2^13 * 19, but need v < 2^255 - 19. - - // If v >= 2^255 - 19, then v + 19 >= 2^255, which would overflow 2^255 - 1, - // generating a carry. That is, c will be 0 if v < 2^255 - 19, and 1 otherwise. - c := (v.l0 + 19) >> 51 - c = (v.l1 + c) >> 51 - c = (v.l2 + c) >> 51 - c = (v.l3 + c) >> 51 - c = (v.l4 + c) >> 51 - - // If v < 2^255 - 19 and c = 0, this will be a no-op. Otherwise, it's - // effectively applying the reduction identity to the carry. - v.l0 += 19 * c - - v.l1 += v.l0 >> 51 - v.l0 = v.l0 & maskLow51Bits - v.l2 += v.l1 >> 51 - v.l1 = v.l1 & maskLow51Bits - v.l3 += v.l2 >> 51 - v.l2 = v.l2 & maskLow51Bits - v.l4 += v.l3 >> 51 - v.l3 = v.l3 & maskLow51Bits - // no additional carry - v.l4 = v.l4 & maskLow51Bits - - return v -} - -// Add sets v = a + b, and returns v. -func (v *Element) Add(a, b *Element) *Element { - v.l0 = a.l0 + b.l0 - v.l1 = a.l1 + b.l1 - v.l2 = a.l2 + b.l2 - v.l3 = a.l3 + b.l3 - v.l4 = a.l4 + b.l4 - // Using the generic implementation here is actually faster than the - // assembly. Probably because the body of this function is so simple that - // the compiler can figure out better optimizations by inlining the carry - // propagation. TODO - return v.carryPropagateGeneric() -} - -// Subtract sets v = a - b, and returns v. -func (v *Element) Subtract(a, b *Element) *Element { - // We first add 2 * p, to guarantee the subtraction won't underflow, and - // then subtract b (which can be up to 2^255 + 2^13 * 19). - v.l0 = (a.l0 + 0xFFFFFFFFFFFDA) - b.l0 - v.l1 = (a.l1 + 0xFFFFFFFFFFFFE) - b.l1 - v.l2 = (a.l2 + 0xFFFFFFFFFFFFE) - b.l2 - v.l3 = (a.l3 + 0xFFFFFFFFFFFFE) - b.l3 - v.l4 = (a.l4 + 0xFFFFFFFFFFFFE) - b.l4 - return v.carryPropagate() -} - -// Negate sets v = -a, and returns v. -func (v *Element) Negate(a *Element) *Element { - return v.Subtract(feZero, a) -} - -// Invert sets v = 1/z mod p, and returns v. -// -// If z == 0, Invert returns v = 0. -func (v *Element) Invert(z *Element) *Element { - // Inversion is implemented as exponentiation with exponent p − 2. It uses the - // same sequence of 255 squarings and 11 multiplications as [Curve25519]. - var z2, z9, z11, z2_5_0, z2_10_0, z2_20_0, z2_50_0, z2_100_0, t Element - - z2.Square(z) // 2 - t.Square(&z2) // 4 - t.Square(&t) // 8 - z9.Multiply(&t, z) // 9 - z11.Multiply(&z9, &z2) // 11 - t.Square(&z11) // 22 - z2_5_0.Multiply(&t, &z9) // 31 = 2^5 - 2^0 - - t.Square(&z2_5_0) // 2^6 - 2^1 - for i := 0; i < 4; i++ { - t.Square(&t) // 2^10 - 2^5 - } - z2_10_0.Multiply(&t, &z2_5_0) // 2^10 - 2^0 - - t.Square(&z2_10_0) // 2^11 - 2^1 - for i := 0; i < 9; i++ { - t.Square(&t) // 2^20 - 2^10 - } - z2_20_0.Multiply(&t, &z2_10_0) // 2^20 - 2^0 - - t.Square(&z2_20_0) // 2^21 - 2^1 - for i := 0; i < 19; i++ { - t.Square(&t) // 2^40 - 2^20 - } - t.Multiply(&t, &z2_20_0) // 2^40 - 2^0 - - t.Square(&t) // 2^41 - 2^1 - for i := 0; i < 9; i++ { - t.Square(&t) // 2^50 - 2^10 - } - z2_50_0.Multiply(&t, &z2_10_0) // 2^50 - 2^0 - - t.Square(&z2_50_0) // 2^51 - 2^1 - for i := 0; i < 49; i++ { - t.Square(&t) // 2^100 - 2^50 - } - z2_100_0.Multiply(&t, &z2_50_0) // 2^100 - 2^0 - - t.Square(&z2_100_0) // 2^101 - 2^1 - for i := 0; i < 99; i++ { - t.Square(&t) // 2^200 - 2^100 - } - t.Multiply(&t, &z2_100_0) // 2^200 - 2^0 - - t.Square(&t) // 2^201 - 2^1 - for i := 0; i < 49; i++ { - t.Square(&t) // 2^250 - 2^50 - } - t.Multiply(&t, &z2_50_0) // 2^250 - 2^0 - - t.Square(&t) // 2^251 - 2^1 - t.Square(&t) // 2^252 - 2^2 - t.Square(&t) // 2^253 - 2^3 - t.Square(&t) // 2^254 - 2^4 - t.Square(&t) // 2^255 - 2^5 - - return v.Multiply(&t, &z11) // 2^255 - 21 -} - -// Set sets v = a, and returns v. -func (v *Element) Set(a *Element) *Element { - *v = *a - return v -} - -// SetBytes sets v to x, which must be a 32-byte little-endian encoding. -// -// Consistent with RFC 7748, the most significant bit (the high bit of the -// last byte) is ignored, and non-canonical values (2^255-19 through 2^255-1) -// are accepted. Note that this is laxer than specified by RFC 8032. -func (v *Element) SetBytes(x []byte) *Element { - if len(x) != 32 { - panic("edwards25519: invalid field element input size") - } - - // Bits 0:51 (bytes 0:8, bits 0:64, shift 0, mask 51). - v.l0 = binary.LittleEndian.Uint64(x[0:8]) - v.l0 &= maskLow51Bits - // Bits 51:102 (bytes 6:14, bits 48:112, shift 3, mask 51). - v.l1 = binary.LittleEndian.Uint64(x[6:14]) >> 3 - v.l1 &= maskLow51Bits - // Bits 102:153 (bytes 12:20, bits 96:160, shift 6, mask 51). - v.l2 = binary.LittleEndian.Uint64(x[12:20]) >> 6 - v.l2 &= maskLow51Bits - // Bits 153:204 (bytes 19:27, bits 152:216, shift 1, mask 51). - v.l3 = binary.LittleEndian.Uint64(x[19:27]) >> 1 - v.l3 &= maskLow51Bits - // Bits 204:251 (bytes 24:32, bits 192:256, shift 12, mask 51). - // Note: not bytes 25:33, shift 4, to avoid overread. - v.l4 = binary.LittleEndian.Uint64(x[24:32]) >> 12 - v.l4 &= maskLow51Bits - - return v -} - -// Bytes returns the canonical 32-byte little-endian encoding of v. -func (v *Element) Bytes() []byte { - // This function is outlined to make the allocations inline in the caller - // rather than happen on the heap. - var out [32]byte - return v.bytes(&out) -} - -func (v *Element) bytes(out *[32]byte) []byte { - t := *v - t.reduce() - - var buf [8]byte - for i, l := range [5]uint64{t.l0, t.l1, t.l2, t.l3, t.l4} { - bitsOffset := i * 51 - binary.LittleEndian.PutUint64(buf[:], l<= len(out) { - break - } - out[off] |= bb - } - } - - return out[:] -} - -// Equal returns 1 if v and u are equal, and 0 otherwise. -func (v *Element) Equal(u *Element) int { - sa, sv := u.Bytes(), v.Bytes() - return subtle.ConstantTimeCompare(sa, sv) -} - -// mask64Bits returns 0xffffffff if cond is 1, and 0 otherwise. -func mask64Bits(cond int) uint64 { return ^(uint64(cond) - 1) } - -// Select sets v to a if cond == 1, and to b if cond == 0. -func (v *Element) Select(a, b *Element, cond int) *Element { - m := mask64Bits(cond) - v.l0 = (m & a.l0) | (^m & b.l0) - v.l1 = (m & a.l1) | (^m & b.l1) - v.l2 = (m & a.l2) | (^m & b.l2) - v.l3 = (m & a.l3) | (^m & b.l3) - v.l4 = (m & a.l4) | (^m & b.l4) - return v -} - -// Swap swaps v and u if cond == 1 or leaves them unchanged if cond == 0, and returns v. -func (v *Element) Swap(u *Element, cond int) { - m := mask64Bits(cond) - t := m & (v.l0 ^ u.l0) - v.l0 ^= t - u.l0 ^= t - t = m & (v.l1 ^ u.l1) - v.l1 ^= t - u.l1 ^= t - t = m & (v.l2 ^ u.l2) - v.l2 ^= t - u.l2 ^= t - t = m & (v.l3 ^ u.l3) - v.l3 ^= t - u.l3 ^= t - t = m & (v.l4 ^ u.l4) - v.l4 ^= t - u.l4 ^= t -} - -// IsNegative returns 1 if v is negative, and 0 otherwise. -func (v *Element) IsNegative() int { - return int(v.Bytes()[0] & 1) -} - -// Absolute sets v to |u|, and returns v. -func (v *Element) Absolute(u *Element) *Element { - return v.Select(new(Element).Negate(u), u, u.IsNegative()) -} - -// Multiply sets v = x * y, and returns v. -func (v *Element) Multiply(x, y *Element) *Element { - feMul(v, x, y) - return v -} - -// Square sets v = x * x, and returns v. -func (v *Element) Square(x *Element) *Element { - feSquare(v, x) - return v -} - -// Mult32 sets v = x * y, and returns v. -func (v *Element) Mult32(x *Element, y uint32) *Element { - x0lo, x0hi := mul51(x.l0, y) - x1lo, x1hi := mul51(x.l1, y) - x2lo, x2hi := mul51(x.l2, y) - x3lo, x3hi := mul51(x.l3, y) - x4lo, x4hi := mul51(x.l4, y) - v.l0 = x0lo + 19*x4hi // carried over per the reduction identity - v.l1 = x1lo + x0hi - v.l2 = x2lo + x1hi - v.l3 = x3lo + x2hi - v.l4 = x4lo + x3hi - // The hi portions are going to be only 32 bits, plus any previous excess, - // so we can skip the carry propagation. - return v -} - -// mul51 returns lo + hi * 2⁵¹ = a * b. -func mul51(a uint64, b uint32) (lo uint64, hi uint64) { - mh, ml := bits.Mul64(a, uint64(b)) - lo = ml & maskLow51Bits - hi = (mh << 13) | (ml >> 51) - return -} - -// Pow22523 set v = x^((p-5)/8), and returns v. (p-5)/8 is 2^252-3. -func (v *Element) Pow22523(x *Element) *Element { - var t0, t1, t2 Element - - t0.Square(x) // x^2 - t1.Square(&t0) // x^4 - t1.Square(&t1) // x^8 - t1.Multiply(x, &t1) // x^9 - t0.Multiply(&t0, &t1) // x^11 - t0.Square(&t0) // x^22 - t0.Multiply(&t1, &t0) // x^31 - t1.Square(&t0) // x^62 - for i := 1; i < 5; i++ { // x^992 - t1.Square(&t1) - } - t0.Multiply(&t1, &t0) // x^1023 -> 1023 = 2^10 - 1 - t1.Square(&t0) // 2^11 - 2 - for i := 1; i < 10; i++ { // 2^20 - 2^10 - t1.Square(&t1) - } - t1.Multiply(&t1, &t0) // 2^20 - 1 - t2.Square(&t1) // 2^21 - 2 - for i := 1; i < 20; i++ { // 2^40 - 2^20 - t2.Square(&t2) - } - t1.Multiply(&t2, &t1) // 2^40 - 1 - t1.Square(&t1) // 2^41 - 2 - for i := 1; i < 10; i++ { // 2^50 - 2^10 - t1.Square(&t1) - } - t0.Multiply(&t1, &t0) // 2^50 - 1 - t1.Square(&t0) // 2^51 - 2 - for i := 1; i < 50; i++ { // 2^100 - 2^50 - t1.Square(&t1) - } - t1.Multiply(&t1, &t0) // 2^100 - 1 - t2.Square(&t1) // 2^101 - 2 - for i := 1; i < 100; i++ { // 2^200 - 2^100 - t2.Square(&t2) - } - t1.Multiply(&t2, &t1) // 2^200 - 1 - t1.Square(&t1) // 2^201 - 2 - for i := 1; i < 50; i++ { // 2^250 - 2^50 - t1.Square(&t1) - } - t0.Multiply(&t1, &t0) // 2^250 - 1 - t0.Square(&t0) // 2^251 - 2 - t0.Square(&t0) // 2^252 - 4 - return v.Multiply(&t0, x) // 2^252 - 3 -> x^(2^252-3) -} - -// sqrtM1 is 2^((p-1)/4), which squared is equal to -1 by Euler's Criterion. -var sqrtM1 = &Element{1718705420411056, 234908883556509, - 2233514472574048, 2117202627021982, 765476049583133} - -// SqrtRatio sets r to the non-negative square root of the ratio of u and v. -// -// If u/v is square, SqrtRatio returns r and 1. If u/v is not square, SqrtRatio -// sets r according to Section 4.3 of draft-irtf-cfrg-ristretto255-decaf448-00, -// and returns r and 0. -func (r *Element) SqrtRatio(u, v *Element) (rr *Element, wasSquare int) { - var a, b Element - - // r = (u * v3) * (u * v7)^((p-5)/8) - v2 := a.Square(v) - uv3 := b.Multiply(u, b.Multiply(v2, v)) - uv7 := a.Multiply(uv3, a.Square(v2)) - r.Multiply(uv3, r.Pow22523(uv7)) - - check := a.Multiply(v, a.Square(r)) // check = v * r^2 - - uNeg := b.Negate(u) - correctSignSqrt := check.Equal(u) - flippedSignSqrt := check.Equal(uNeg) - flippedSignSqrtI := check.Equal(uNeg.Multiply(uNeg, sqrtM1)) - - rPrime := b.Multiply(r, sqrtM1) // r_prime = SQRT_M1 * r - // r = CT_SELECT(r_prime IF flipped_sign_sqrt | flipped_sign_sqrt_i ELSE r) - r.Select(rPrime, r, flippedSignSqrt|flippedSignSqrtI) - - r.Absolute(r) // Choose the nonnegative square root. - return r, correctSignSqrt | flippedSignSqrt -} diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go deleted file mode 100644 index 70c54169..00000000 --- a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by command: go run fe_amd64_asm.go -out ../fe_amd64.s -stubs ../fe_amd64.go -pkg field. DO NOT EDIT. - -//go:build amd64 && gc && !purego - -package field - -// feMul sets out = a * b. It works like feMulGeneric. -// -//go:noescape -func feMul(out *Element, a *Element, b *Element) - -// feSquare sets out = a * a. It works like feSquareGeneric. -// -//go:noescape -func feSquare(out *Element, a *Element) diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s deleted file mode 100644 index 60817acc..00000000 --- a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s +++ /dev/null @@ -1,378 +0,0 @@ -// Code generated by command: go run fe_amd64_asm.go -out ../fe_amd64.s -stubs ../fe_amd64.go -pkg field. DO NOT EDIT. - -//go:build amd64 && gc && !purego - -#include "textflag.h" - -// func feMul(out *Element, a *Element, b *Element) -TEXT ·feMul(SB), NOSPLIT, $0-24 - MOVQ a+8(FP), CX - MOVQ b+16(FP), BX - - // r0 = a0×b0 - MOVQ (CX), AX - MULQ (BX) - MOVQ AX, DI - MOVQ DX, SI - - // r0 += 19×a1×b4 - MOVQ 8(CX), AX - IMUL3Q $0x13, AX, AX - MULQ 32(BX) - ADDQ AX, DI - ADCQ DX, SI - - // r0 += 19×a2×b3 - MOVQ 16(CX), AX - IMUL3Q $0x13, AX, AX - MULQ 24(BX) - ADDQ AX, DI - ADCQ DX, SI - - // r0 += 19×a3×b2 - MOVQ 24(CX), AX - IMUL3Q $0x13, AX, AX - MULQ 16(BX) - ADDQ AX, DI - ADCQ DX, SI - - // r0 += 19×a4×b1 - MOVQ 32(CX), AX - IMUL3Q $0x13, AX, AX - MULQ 8(BX) - ADDQ AX, DI - ADCQ DX, SI - - // r1 = a0×b1 - MOVQ (CX), AX - MULQ 8(BX) - MOVQ AX, R9 - MOVQ DX, R8 - - // r1 += a1×b0 - MOVQ 8(CX), AX - MULQ (BX) - ADDQ AX, R9 - ADCQ DX, R8 - - // r1 += 19×a2×b4 - MOVQ 16(CX), AX - IMUL3Q $0x13, AX, AX - MULQ 32(BX) - ADDQ AX, R9 - ADCQ DX, R8 - - // r1 += 19×a3×b3 - MOVQ 24(CX), AX - IMUL3Q $0x13, AX, AX - MULQ 24(BX) - ADDQ AX, R9 - ADCQ DX, R8 - - // r1 += 19×a4×b2 - MOVQ 32(CX), AX - IMUL3Q $0x13, AX, AX - MULQ 16(BX) - ADDQ AX, R9 - ADCQ DX, R8 - - // r2 = a0×b2 - MOVQ (CX), AX - MULQ 16(BX) - MOVQ AX, R11 - MOVQ DX, R10 - - // r2 += a1×b1 - MOVQ 8(CX), AX - MULQ 8(BX) - ADDQ AX, R11 - ADCQ DX, R10 - - // r2 += a2×b0 - MOVQ 16(CX), AX - MULQ (BX) - ADDQ AX, R11 - ADCQ DX, R10 - - // r2 += 19×a3×b4 - MOVQ 24(CX), AX - IMUL3Q $0x13, AX, AX - MULQ 32(BX) - ADDQ AX, R11 - ADCQ DX, R10 - - // r2 += 19×a4×b3 - MOVQ 32(CX), AX - IMUL3Q $0x13, AX, AX - MULQ 24(BX) - ADDQ AX, R11 - ADCQ DX, R10 - - // r3 = a0×b3 - MOVQ (CX), AX - MULQ 24(BX) - MOVQ AX, R13 - MOVQ DX, R12 - - // r3 += a1×b2 - MOVQ 8(CX), AX - MULQ 16(BX) - ADDQ AX, R13 - ADCQ DX, R12 - - // r3 += a2×b1 - MOVQ 16(CX), AX - MULQ 8(BX) - ADDQ AX, R13 - ADCQ DX, R12 - - // r3 += a3×b0 - MOVQ 24(CX), AX - MULQ (BX) - ADDQ AX, R13 - ADCQ DX, R12 - - // r3 += 19×a4×b4 - MOVQ 32(CX), AX - IMUL3Q $0x13, AX, AX - MULQ 32(BX) - ADDQ AX, R13 - ADCQ DX, R12 - - // r4 = a0×b4 - MOVQ (CX), AX - MULQ 32(BX) - MOVQ AX, R15 - MOVQ DX, R14 - - // r4 += a1×b3 - MOVQ 8(CX), AX - MULQ 24(BX) - ADDQ AX, R15 - ADCQ DX, R14 - - // r4 += a2×b2 - MOVQ 16(CX), AX - MULQ 16(BX) - ADDQ AX, R15 - ADCQ DX, R14 - - // r4 += a3×b1 - MOVQ 24(CX), AX - MULQ 8(BX) - ADDQ AX, R15 - ADCQ DX, R14 - - // r4 += a4×b0 - MOVQ 32(CX), AX - MULQ (BX) - ADDQ AX, R15 - ADCQ DX, R14 - - // First reduction chain - MOVQ $0x0007ffffffffffff, AX - SHLQ $0x0d, DI, SI - SHLQ $0x0d, R9, R8 - SHLQ $0x0d, R11, R10 - SHLQ $0x0d, R13, R12 - SHLQ $0x0d, R15, R14 - ANDQ AX, DI - IMUL3Q $0x13, R14, R14 - ADDQ R14, DI - ANDQ AX, R9 - ADDQ SI, R9 - ANDQ AX, R11 - ADDQ R8, R11 - ANDQ AX, R13 - ADDQ R10, R13 - ANDQ AX, R15 - ADDQ R12, R15 - - // Second reduction chain (carryPropagate) - MOVQ DI, SI - SHRQ $0x33, SI - MOVQ R9, R8 - SHRQ $0x33, R8 - MOVQ R11, R10 - SHRQ $0x33, R10 - MOVQ R13, R12 - SHRQ $0x33, R12 - MOVQ R15, R14 - SHRQ $0x33, R14 - ANDQ AX, DI - IMUL3Q $0x13, R14, R14 - ADDQ R14, DI - ANDQ AX, R9 - ADDQ SI, R9 - ANDQ AX, R11 - ADDQ R8, R11 - ANDQ AX, R13 - ADDQ R10, R13 - ANDQ AX, R15 - ADDQ R12, R15 - - // Store output - MOVQ out+0(FP), AX - MOVQ DI, (AX) - MOVQ R9, 8(AX) - MOVQ R11, 16(AX) - MOVQ R13, 24(AX) - MOVQ R15, 32(AX) - RET - -// func feSquare(out *Element, a *Element) -TEXT ·feSquare(SB), NOSPLIT, $0-16 - MOVQ a+8(FP), CX - - // r0 = l0×l0 - MOVQ (CX), AX - MULQ (CX) - MOVQ AX, SI - MOVQ DX, BX - - // r0 += 38×l1×l4 - MOVQ 8(CX), AX - IMUL3Q $0x26, AX, AX - MULQ 32(CX) - ADDQ AX, SI - ADCQ DX, BX - - // r0 += 38×l2×l3 - MOVQ 16(CX), AX - IMUL3Q $0x26, AX, AX - MULQ 24(CX) - ADDQ AX, SI - ADCQ DX, BX - - // r1 = 2×l0×l1 - MOVQ (CX), AX - SHLQ $0x01, AX - MULQ 8(CX) - MOVQ AX, R8 - MOVQ DX, DI - - // r1 += 38×l2×l4 - MOVQ 16(CX), AX - IMUL3Q $0x26, AX, AX - MULQ 32(CX) - ADDQ AX, R8 - ADCQ DX, DI - - // r1 += 19×l3×l3 - MOVQ 24(CX), AX - IMUL3Q $0x13, AX, AX - MULQ 24(CX) - ADDQ AX, R8 - ADCQ DX, DI - - // r2 = 2×l0×l2 - MOVQ (CX), AX - SHLQ $0x01, AX - MULQ 16(CX) - MOVQ AX, R10 - MOVQ DX, R9 - - // r2 += l1×l1 - MOVQ 8(CX), AX - MULQ 8(CX) - ADDQ AX, R10 - ADCQ DX, R9 - - // r2 += 38×l3×l4 - MOVQ 24(CX), AX - IMUL3Q $0x26, AX, AX - MULQ 32(CX) - ADDQ AX, R10 - ADCQ DX, R9 - - // r3 = 2×l0×l3 - MOVQ (CX), AX - SHLQ $0x01, AX - MULQ 24(CX) - MOVQ AX, R12 - MOVQ DX, R11 - - // r3 += 2×l1×l2 - MOVQ 8(CX), AX - IMUL3Q $0x02, AX, AX - MULQ 16(CX) - ADDQ AX, R12 - ADCQ DX, R11 - - // r3 += 19×l4×l4 - MOVQ 32(CX), AX - IMUL3Q $0x13, AX, AX - MULQ 32(CX) - ADDQ AX, R12 - ADCQ DX, R11 - - // r4 = 2×l0×l4 - MOVQ (CX), AX - SHLQ $0x01, AX - MULQ 32(CX) - MOVQ AX, R14 - MOVQ DX, R13 - - // r4 += 2×l1×l3 - MOVQ 8(CX), AX - IMUL3Q $0x02, AX, AX - MULQ 24(CX) - ADDQ AX, R14 - ADCQ DX, R13 - - // r4 += l2×l2 - MOVQ 16(CX), AX - MULQ 16(CX) - ADDQ AX, R14 - ADCQ DX, R13 - - // First reduction chain - MOVQ $0x0007ffffffffffff, AX - SHLQ $0x0d, SI, BX - SHLQ $0x0d, R8, DI - SHLQ $0x0d, R10, R9 - SHLQ $0x0d, R12, R11 - SHLQ $0x0d, R14, R13 - ANDQ AX, SI - IMUL3Q $0x13, R13, R13 - ADDQ R13, SI - ANDQ AX, R8 - ADDQ BX, R8 - ANDQ AX, R10 - ADDQ DI, R10 - ANDQ AX, R12 - ADDQ R9, R12 - ANDQ AX, R14 - ADDQ R11, R14 - - // Second reduction chain (carryPropagate) - MOVQ SI, BX - SHRQ $0x33, BX - MOVQ R8, DI - SHRQ $0x33, DI - MOVQ R10, R9 - SHRQ $0x33, R9 - MOVQ R12, R11 - SHRQ $0x33, R11 - MOVQ R14, R13 - SHRQ $0x33, R13 - ANDQ AX, SI - IMUL3Q $0x13, R13, R13 - ADDQ R13, SI - ANDQ AX, R8 - ADDQ BX, R8 - ANDQ AX, R10 - ADDQ DI, R10 - ANDQ AX, R12 - ADDQ R9, R12 - ANDQ AX, R14 - ADDQ R11, R14 - - // Store output - MOVQ out+0(FP), AX - MOVQ SI, (AX) - MOVQ R8, 8(AX) - MOVQ R10, 16(AX) - MOVQ R12, 24(AX) - MOVQ R14, 32(AX) - RET diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go deleted file mode 100644 index 9da280d1..00000000 --- a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !amd64 || !gc || purego - -package field - -func feMul(v, x, y *Element) { feMulGeneric(v, x, y) } - -func feSquare(v, x *Element) { feSquareGeneric(v, x) } diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go deleted file mode 100644 index 075fe9b9..00000000 --- a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build arm64 && gc && !purego - -package field - -//go:noescape -func carryPropagate(v *Element) - -func (v *Element) carryPropagate() *Element { - carryPropagate(v) - return v -} diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s deleted file mode 100644 index 3126a434..00000000 --- a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build arm64 && gc && !purego - -#include "textflag.h" - -// carryPropagate works exactly like carryPropagateGeneric and uses the -// same AND, ADD, and LSR+MADD instructions emitted by the compiler, but -// avoids loading R0-R4 twice and uses LDP and STP. -// -// See https://golang.org/issues/43145 for the main compiler issue. -// -// func carryPropagate(v *Element) -TEXT ·carryPropagate(SB),NOFRAME|NOSPLIT,$0-8 - MOVD v+0(FP), R20 - - LDP 0(R20), (R0, R1) - LDP 16(R20), (R2, R3) - MOVD 32(R20), R4 - - AND $0x7ffffffffffff, R0, R10 - AND $0x7ffffffffffff, R1, R11 - AND $0x7ffffffffffff, R2, R12 - AND $0x7ffffffffffff, R3, R13 - AND $0x7ffffffffffff, R4, R14 - - ADD R0>>51, R11, R11 - ADD R1>>51, R12, R12 - ADD R2>>51, R13, R13 - ADD R3>>51, R14, R14 - // R4>>51 * 19 + R10 -> R10 - LSR $51, R4, R21 - MOVD $19, R22 - MADD R22, R10, R21, R10 - - STP (R10, R11), 0(R20) - STP (R12, R13), 16(R20) - MOVD R14, 32(R20) - - RET diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go deleted file mode 100644 index fc029ac1..00000000 --- a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !arm64 || !gc || purego - -package field - -func (v *Element) carryPropagate() *Element { - return v.carryPropagateGeneric() -} diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_generic.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_generic.go deleted file mode 100644 index 2671217d..00000000 --- a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_generic.go +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright (c) 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package field - -import "math/bits" - -// uint128 holds a 128-bit number as two 64-bit limbs, for use with the -// bits.Mul64 and bits.Add64 intrinsics. -type uint128 struct { - lo, hi uint64 -} - -// mul64 returns a * b. -func mul64(a, b uint64) uint128 { - hi, lo := bits.Mul64(a, b) - return uint128{lo, hi} -} - -// addMul64 returns v + a * b. -func addMul64(v uint128, a, b uint64) uint128 { - hi, lo := bits.Mul64(a, b) - lo, c := bits.Add64(lo, v.lo, 0) - hi, _ = bits.Add64(hi, v.hi, c) - return uint128{lo, hi} -} - -// shiftRightBy51 returns a >> 51. a is assumed to be at most 115 bits. -func shiftRightBy51(a uint128) uint64 { - return (a.hi << (64 - 51)) | (a.lo >> 51) -} - -func feMulGeneric(v, a, b *Element) { - a0 := a.l0 - a1 := a.l1 - a2 := a.l2 - a3 := a.l3 - a4 := a.l4 - - b0 := b.l0 - b1 := b.l1 - b2 := b.l2 - b3 := b.l3 - b4 := b.l4 - - // Limb multiplication works like pen-and-paper columnar multiplication, but - // with 51-bit limbs instead of digits. - // - // a4 a3 a2 a1 a0 x - // b4 b3 b2 b1 b0 = - // ------------------------ - // a4b0 a3b0 a2b0 a1b0 a0b0 + - // a4b1 a3b1 a2b1 a1b1 a0b1 + - // a4b2 a3b2 a2b2 a1b2 a0b2 + - // a4b3 a3b3 a2b3 a1b3 a0b3 + - // a4b4 a3b4 a2b4 a1b4 a0b4 = - // ---------------------------------------------- - // r8 r7 r6 r5 r4 r3 r2 r1 r0 - // - // We can then use the reduction identity (a * 2²⁵⁵ + b = a * 19 + b) to - // reduce the limbs that would overflow 255 bits. r5 * 2²⁵⁵ becomes 19 * r5, - // r6 * 2³⁰⁶ becomes 19 * r6 * 2⁵¹, etc. - // - // Reduction can be carried out simultaneously to multiplication. For - // example, we do not compute r5: whenever the result of a multiplication - // belongs to r5, like a1b4, we multiply it by 19 and add the result to r0. - // - // a4b0 a3b0 a2b0 a1b0 a0b0 + - // a3b1 a2b1 a1b1 a0b1 19×a4b1 + - // a2b2 a1b2 a0b2 19×a4b2 19×a3b2 + - // a1b3 a0b3 19×a4b3 19×a3b3 19×a2b3 + - // a0b4 19×a4b4 19×a3b4 19×a2b4 19×a1b4 = - // -------------------------------------- - // r4 r3 r2 r1 r0 - // - // Finally we add up the columns into wide, overlapping limbs. - - a1_19 := a1 * 19 - a2_19 := a2 * 19 - a3_19 := a3 * 19 - a4_19 := a4 * 19 - - // r0 = a0×b0 + 19×(a1×b4 + a2×b3 + a3×b2 + a4×b1) - r0 := mul64(a0, b0) - r0 = addMul64(r0, a1_19, b4) - r0 = addMul64(r0, a2_19, b3) - r0 = addMul64(r0, a3_19, b2) - r0 = addMul64(r0, a4_19, b1) - - // r1 = a0×b1 + a1×b0 + 19×(a2×b4 + a3×b3 + a4×b2) - r1 := mul64(a0, b1) - r1 = addMul64(r1, a1, b0) - r1 = addMul64(r1, a2_19, b4) - r1 = addMul64(r1, a3_19, b3) - r1 = addMul64(r1, a4_19, b2) - - // r2 = a0×b2 + a1×b1 + a2×b0 + 19×(a3×b4 + a4×b3) - r2 := mul64(a0, b2) - r2 = addMul64(r2, a1, b1) - r2 = addMul64(r2, a2, b0) - r2 = addMul64(r2, a3_19, b4) - r2 = addMul64(r2, a4_19, b3) - - // r3 = a0×b3 + a1×b2 + a2×b1 + a3×b0 + 19×a4×b4 - r3 := mul64(a0, b3) - r3 = addMul64(r3, a1, b2) - r3 = addMul64(r3, a2, b1) - r3 = addMul64(r3, a3, b0) - r3 = addMul64(r3, a4_19, b4) - - // r4 = a0×b4 + a1×b3 + a2×b2 + a3×b1 + a4×b0 - r4 := mul64(a0, b4) - r4 = addMul64(r4, a1, b3) - r4 = addMul64(r4, a2, b2) - r4 = addMul64(r4, a3, b1) - r4 = addMul64(r4, a4, b0) - - // After the multiplication, we need to reduce (carry) the five coefficients - // to obtain a result with limbs that are at most slightly larger than 2⁵¹, - // to respect the Element invariant. - // - // Overall, the reduction works the same as carryPropagate, except with - // wider inputs: we take the carry for each coefficient by shifting it right - // by 51, and add it to the limb above it. The top carry is multiplied by 19 - // according to the reduction identity and added to the lowest limb. - // - // The largest coefficient (r0) will be at most 111 bits, which guarantees - // that all carries are at most 111 - 51 = 60 bits, which fits in a uint64. - // - // r0 = a0×b0 + 19×(a1×b4 + a2×b3 + a3×b2 + a4×b1) - // r0 < 2⁵²×2⁵² + 19×(2⁵²×2⁵² + 2⁵²×2⁵² + 2⁵²×2⁵² + 2⁵²×2⁵²) - // r0 < (1 + 19 × 4) × 2⁵² × 2⁵² - // r0 < 2⁷ × 2⁵² × 2⁵² - // r0 < 2¹¹¹ - // - // Moreover, the top coefficient (r4) is at most 107 bits, so c4 is at most - // 56 bits, and c4 * 19 is at most 61 bits, which again fits in a uint64 and - // allows us to easily apply the reduction identity. - // - // r4 = a0×b4 + a1×b3 + a2×b2 + a3×b1 + a4×b0 - // r4 < 5 × 2⁵² × 2⁵² - // r4 < 2¹⁰⁷ - // - - c0 := shiftRightBy51(r0) - c1 := shiftRightBy51(r1) - c2 := shiftRightBy51(r2) - c3 := shiftRightBy51(r3) - c4 := shiftRightBy51(r4) - - rr0 := r0.lo&maskLow51Bits + c4*19 - rr1 := r1.lo&maskLow51Bits + c0 - rr2 := r2.lo&maskLow51Bits + c1 - rr3 := r3.lo&maskLow51Bits + c2 - rr4 := r4.lo&maskLow51Bits + c3 - - // Now all coefficients fit into 64-bit registers but are still too large to - // be passed around as a Element. We therefore do one last carry chain, - // where the carries will be small enough to fit in the wiggle room above 2⁵¹. - *v = Element{rr0, rr1, rr2, rr3, rr4} - v.carryPropagate() -} - -func feSquareGeneric(v, a *Element) { - l0 := a.l0 - l1 := a.l1 - l2 := a.l2 - l3 := a.l3 - l4 := a.l4 - - // Squaring works precisely like multiplication above, but thanks to its - // symmetry we get to group a few terms together. - // - // l4 l3 l2 l1 l0 x - // l4 l3 l2 l1 l0 = - // ------------------------ - // l4l0 l3l0 l2l0 l1l0 l0l0 + - // l4l1 l3l1 l2l1 l1l1 l0l1 + - // l4l2 l3l2 l2l2 l1l2 l0l2 + - // l4l3 l3l3 l2l3 l1l3 l0l3 + - // l4l4 l3l4 l2l4 l1l4 l0l4 = - // ---------------------------------------------- - // r8 r7 r6 r5 r4 r3 r2 r1 r0 - // - // l4l0 l3l0 l2l0 l1l0 l0l0 + - // l3l1 l2l1 l1l1 l0l1 19×l4l1 + - // l2l2 l1l2 l0l2 19×l4l2 19×l3l2 + - // l1l3 l0l3 19×l4l3 19×l3l3 19×l2l3 + - // l0l4 19×l4l4 19×l3l4 19×l2l4 19×l1l4 = - // -------------------------------------- - // r4 r3 r2 r1 r0 - // - // With precomputed 2×, 19×, and 2×19× terms, we can compute each limb with - // only three Mul64 and four Add64, instead of five and eight. - - l0_2 := l0 * 2 - l1_2 := l1 * 2 - - l1_38 := l1 * 38 - l2_38 := l2 * 38 - l3_38 := l3 * 38 - - l3_19 := l3 * 19 - l4_19 := l4 * 19 - - // r0 = l0×l0 + 19×(l1×l4 + l2×l3 + l3×l2 + l4×l1) = l0×l0 + 19×2×(l1×l4 + l2×l3) - r0 := mul64(l0, l0) - r0 = addMul64(r0, l1_38, l4) - r0 = addMul64(r0, l2_38, l3) - - // r1 = l0×l1 + l1×l0 + 19×(l2×l4 + l3×l3 + l4×l2) = 2×l0×l1 + 19×2×l2×l4 + 19×l3×l3 - r1 := mul64(l0_2, l1) - r1 = addMul64(r1, l2_38, l4) - r1 = addMul64(r1, l3_19, l3) - - // r2 = l0×l2 + l1×l1 + l2×l0 + 19×(l3×l4 + l4×l3) = 2×l0×l2 + l1×l1 + 19×2×l3×l4 - r2 := mul64(l0_2, l2) - r2 = addMul64(r2, l1, l1) - r2 = addMul64(r2, l3_38, l4) - - // r3 = l0×l3 + l1×l2 + l2×l1 + l3×l0 + 19×l4×l4 = 2×l0×l3 + 2×l1×l2 + 19×l4×l4 - r3 := mul64(l0_2, l3) - r3 = addMul64(r3, l1_2, l2) - r3 = addMul64(r3, l4_19, l4) - - // r4 = l0×l4 + l1×l3 + l2×l2 + l3×l1 + l4×l0 = 2×l0×l4 + 2×l1×l3 + l2×l2 - r4 := mul64(l0_2, l4) - r4 = addMul64(r4, l1_2, l3) - r4 = addMul64(r4, l2, l2) - - c0 := shiftRightBy51(r0) - c1 := shiftRightBy51(r1) - c2 := shiftRightBy51(r2) - c3 := shiftRightBy51(r3) - c4 := shiftRightBy51(r4) - - rr0 := r0.lo&maskLow51Bits + c4*19 - rr1 := r1.lo&maskLow51Bits + c0 - rr2 := r2.lo&maskLow51Bits + c1 - rr3 := r3.lo&maskLow51Bits + c2 - rr4 := r4.lo&maskLow51Bits + c3 - - *v = Element{rr0, rr1, rr2, rr3, rr4} - v.carryPropagate() -} - -// carryPropagateGeneric brings the limbs below 52 bits by applying the reduction -// identity (a * 2²⁵⁵ + b = a * 19 + b) to the l4 carry. TODO inline -func (v *Element) carryPropagateGeneric() *Element { - c0 := v.l0 >> 51 - c1 := v.l1 >> 51 - c2 := v.l2 >> 51 - c3 := v.l3 >> 51 - c4 := v.l4 >> 51 - - v.l0 = v.l0&maskLow51Bits + c4*19 - v.l1 = v.l1&maskLow51Bits + c0 - v.l2 = v.l2&maskLow51Bits + c1 - v.l3 = v.l3&maskLow51Bits + c2 - v.l4 = v.l4&maskLow51Bits + c3 - - return v -} diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/sync.checkpoint b/vendor/golang.org/x/crypto/curve25519/internal/field/sync.checkpoint deleted file mode 100644 index e3685f95..00000000 --- a/vendor/golang.org/x/crypto/curve25519/internal/field/sync.checkpoint +++ /dev/null @@ -1 +0,0 @@ -b0c49ae9f59d233526f8934262c5bbbe14d4358d diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/sync.sh b/vendor/golang.org/x/crypto/curve25519/internal/field/sync.sh deleted file mode 100644 index 1ba22a8b..00000000 --- a/vendor/golang.org/x/crypto/curve25519/internal/field/sync.sh +++ /dev/null @@ -1,19 +0,0 @@ -#! /bin/bash -set -euo pipefail - -cd "$(git rev-parse --show-toplevel)" - -STD_PATH=src/crypto/ed25519/internal/edwards25519/field -LOCAL_PATH=curve25519/internal/field -LAST_SYNC_REF=$(cat $LOCAL_PATH/sync.checkpoint) - -git fetch https://go.googlesource.com/go master - -if git diff --quiet $LAST_SYNC_REF:$STD_PATH FETCH_HEAD:$STD_PATH; then - echo "No changes." -else - NEW_REF=$(git rev-parse FETCH_HEAD | tee $LOCAL_PATH/sync.checkpoint) - echo "Applying changes from $LAST_SYNC_REF to $NEW_REF..." - git diff $LAST_SYNC_REF:$STD_PATH FETCH_HEAD:$STD_PATH | \ - git apply -3 --directory=$LOCAL_PATH -fi diff --git a/vendor/golang.org/x/crypto/ed25519/ed25519.go b/vendor/golang.org/x/crypto/ed25519/ed25519.go index a7828345..59b3a95a 100644 --- a/vendor/golang.org/x/crypto/ed25519/ed25519.go +++ b/vendor/golang.org/x/crypto/ed25519/ed25519.go @@ -11,9 +11,7 @@ // operations with the same key more efficient. This package refers to the RFC // 8032 private key as the “seed”. // -// Beginning with Go 1.13, the functionality of this package was moved to the -// standard library as crypto/ed25519. This package only acts as a compatibility -// wrapper. +// This package is a wrapper around the standard library crypto/ed25519 package. package ed25519 import ( diff --git a/vendor/golang.org/x/crypto/hkdf/hkdf.go b/vendor/golang.org/x/crypto/hkdf/hkdf.go index f4ded5fe..3bee6629 100644 --- a/vendor/golang.org/x/crypto/hkdf/hkdf.go +++ b/vendor/golang.org/x/crypto/hkdf/hkdf.go @@ -8,7 +8,7 @@ // HKDF is a cryptographic key derivation function (KDF) with the goal of // expanding limited input keying material into one or more cryptographically // strong secret keys. -package hkdf // import "golang.org/x/crypto/hkdf" +package hkdf import ( "crypto/hmac" diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.s b/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.s index e0d3c647..13375738 100644 --- a/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.s +++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.s @@ -1,108 +1,93 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. +// Code generated by command: go run sum_amd64_asm.go -out ../sum_amd64.s -pkg poly1305. DO NOT EDIT. //go:build gc && !purego -#include "textflag.h" - -#define POLY1305_ADD(msg, h0, h1, h2) \ - ADDQ 0(msg), h0; \ - ADCQ 8(msg), h1; \ - ADCQ $1, h2; \ - LEAQ 16(msg), msg - -#define POLY1305_MUL(h0, h1, h2, r0, r1, t0, t1, t2, t3) \ - MOVQ r0, AX; \ - MULQ h0; \ - MOVQ AX, t0; \ - MOVQ DX, t1; \ - MOVQ r0, AX; \ - MULQ h1; \ - ADDQ AX, t1; \ - ADCQ $0, DX; \ - MOVQ r0, t2; \ - IMULQ h2, t2; \ - ADDQ DX, t2; \ - \ - MOVQ r1, AX; \ - MULQ h0; \ - ADDQ AX, t1; \ - ADCQ $0, DX; \ - MOVQ DX, h0; \ - MOVQ r1, t3; \ - IMULQ h2, t3; \ - MOVQ r1, AX; \ - MULQ h1; \ - ADDQ AX, t2; \ - ADCQ DX, t3; \ - ADDQ h0, t2; \ - ADCQ $0, t3; \ - \ - MOVQ t0, h0; \ - MOVQ t1, h1; \ - MOVQ t2, h2; \ - ANDQ $3, h2; \ - MOVQ t2, t0; \ - ANDQ $0xFFFFFFFFFFFFFFFC, t0; \ - ADDQ t0, h0; \ - ADCQ t3, h1; \ - ADCQ $0, h2; \ - SHRQ $2, t3, t2; \ - SHRQ $2, t3; \ - ADDQ t2, h0; \ - ADCQ t3, h1; \ - ADCQ $0, h2 - -// func update(state *[7]uint64, msg []byte) +// func update(state *macState, msg []byte) TEXT ·update(SB), $0-32 MOVQ state+0(FP), DI MOVQ msg_base+8(FP), SI MOVQ msg_len+16(FP), R15 - - MOVQ 0(DI), R8 // h0 - MOVQ 8(DI), R9 // h1 - MOVQ 16(DI), R10 // h2 - MOVQ 24(DI), R11 // r0 - MOVQ 32(DI), R12 // r1 - - CMPQ R15, $16 + MOVQ (DI), R8 + MOVQ 8(DI), R9 + MOVQ 16(DI), R10 + MOVQ 24(DI), R11 + MOVQ 32(DI), R12 + CMPQ R15, $0x10 JB bytes_between_0_and_15 loop: - POLY1305_ADD(SI, R8, R9, R10) + ADDQ (SI), R8 + ADCQ 8(SI), R9 + ADCQ $0x01, R10 + LEAQ 16(SI), SI multiply: - POLY1305_MUL(R8, R9, R10, R11, R12, BX, CX, R13, R14) - SUBQ $16, R15 - CMPQ R15, $16 - JAE loop + MOVQ R11, AX + MULQ R8 + MOVQ AX, BX + MOVQ DX, CX + MOVQ R11, AX + MULQ R9 + ADDQ AX, CX + ADCQ $0x00, DX + MOVQ R11, R13 + IMULQ R10, R13 + ADDQ DX, R13 + MOVQ R12, AX + MULQ R8 + ADDQ AX, CX + ADCQ $0x00, DX + MOVQ DX, R8 + MOVQ R12, R14 + IMULQ R10, R14 + MOVQ R12, AX + MULQ R9 + ADDQ AX, R13 + ADCQ DX, R14 + ADDQ R8, R13 + ADCQ $0x00, R14 + MOVQ BX, R8 + MOVQ CX, R9 + MOVQ R13, R10 + ANDQ $0x03, R10 + MOVQ R13, BX + ANDQ $-4, BX + ADDQ BX, R8 + ADCQ R14, R9 + ADCQ $0x00, R10 + SHRQ $0x02, R14, R13 + SHRQ $0x02, R14 + ADDQ R13, R8 + ADCQ R14, R9 + ADCQ $0x00, R10 + SUBQ $0x10, R15 + CMPQ R15, $0x10 + JAE loop bytes_between_0_and_15: TESTQ R15, R15 JZ done - MOVQ $1, BX + MOVQ $0x00000001, BX XORQ CX, CX XORQ R13, R13 ADDQ R15, SI flush_buffer: - SHLQ $8, BX, CX - SHLQ $8, BX + SHLQ $0x08, BX, CX + SHLQ $0x08, BX MOVB -1(SI), R13 XORQ R13, BX DECQ SI DECQ R15 JNZ flush_buffer - ADDQ BX, R8 ADCQ CX, R9 - ADCQ $0, R10 - MOVQ $16, R15 + ADCQ $0x00, R10 + MOVQ $0x00000010, R15 JMP multiply done: - MOVQ R8, 0(DI) + MOVQ R8, (DI) MOVQ R9, 8(DI) MOVQ R10, 16(DI) RET diff --git a/vendor/golang.org/x/crypto/md4/md4.go b/vendor/golang.org/x/crypto/md4/md4.go index d1911c2e..7d9281e0 100644 --- a/vendor/golang.org/x/crypto/md4/md4.go +++ b/vendor/golang.org/x/crypto/md4/md4.go @@ -7,7 +7,7 @@ // Deprecated: MD4 is cryptographically broken and should only be used // where compatibility with legacy systems, not security, is the goal. Instead, // use a secure hash like SHA-256 (from crypto/sha256). -package md4 // import "golang.org/x/crypto/md4" +package md4 import ( "crypto" diff --git a/vendor/golang.org/x/crypto/nacl/box/box.go b/vendor/golang.org/x/crypto/nacl/box/box.go index 7f3b830e..357bdc77 100644 --- a/vendor/golang.org/x/crypto/nacl/box/box.go +++ b/vendor/golang.org/x/crypto/nacl/box/box.go @@ -35,7 +35,7 @@ Anonymous sealing/opening is an extension of NaCl defined by and interoperable with libsodium: https://libsodium.gitbook.io/doc/public-key_cryptography/sealed_boxes. */ -package box // import "golang.org/x/crypto/nacl/box" +package box import ( cryptorand "crypto/rand" diff --git a/vendor/golang.org/x/crypto/nacl/secretbox/secretbox.go b/vendor/golang.org/x/crypto/nacl/secretbox/secretbox.go index f3c3242a..1fe600ad 100644 --- a/vendor/golang.org/x/crypto/nacl/secretbox/secretbox.go +++ b/vendor/golang.org/x/crypto/nacl/secretbox/secretbox.go @@ -32,7 +32,7 @@ chunk size. This package is interoperable with NaCl: https://nacl.cr.yp.to/secretbox.html. */ -package secretbox // import "golang.org/x/crypto/nacl/secretbox" +package secretbox import ( "golang.org/x/crypto/internal/alias" diff --git a/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go b/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go index 904b57e0..28cd99c7 100644 --- a/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go +++ b/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go @@ -16,7 +16,7 @@ Hash Functions SHA-1, SHA-224, SHA-256, SHA-384 and SHA-512 for HMAC. To choose, you can pass the `New` functions from the different SHA packages to pbkdf2.Key. */ -package pbkdf2 // import "golang.org/x/crypto/pbkdf2" +package pbkdf2 import ( "crypto/hmac" diff --git a/vendor/golang.org/x/crypto/salsa20/salsa/hsalsa20.go b/vendor/golang.org/x/crypto/salsa20/salsa/hsalsa20.go index 3fd05b27..3685b344 100644 --- a/vendor/golang.org/x/crypto/salsa20/salsa/hsalsa20.go +++ b/vendor/golang.org/x/crypto/salsa20/salsa/hsalsa20.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // Package salsa provides low-level access to functions in the Salsa family. -package salsa // import "golang.org/x/crypto/salsa20/salsa" +package salsa import "math/bits" diff --git a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.s b/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.s index fcce0234..3883e0ec 100644 --- a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.s +++ b/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.s @@ -1,880 +1,880 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. +// Code generated by command: go run salsa20_amd64_asm.go -out ../salsa20_amd64.s -pkg salsa. DO NOT EDIT. //go:build amd64 && !purego && gc -// This code was translated into a form compatible with 6a from the public -// domain sources in SUPERCOP: https://bench.cr.yp.to/supercop.html +// func salsa2020XORKeyStream(out *byte, in *byte, n uint64, nonce *byte, key *byte) +// Requires: SSE2 +TEXT ·salsa2020XORKeyStream(SB), $456-40 + // This needs up to 64 bytes at 360(R12); hence the non-obvious frame size. + MOVQ out+0(FP), DI + MOVQ in+8(FP), SI + MOVQ n+16(FP), DX + MOVQ nonce+24(FP), CX + MOVQ key+32(FP), R8 + MOVQ SP, R12 + ADDQ $0x1f, R12 + ANDQ $-32, R12 + MOVQ DX, R9 + MOVQ CX, DX + MOVQ R8, R10 + CMPQ R9, $0x00 + JBE DONE + MOVL 20(R10), CX + MOVL (R10), R8 + MOVL (DX), AX + MOVL 16(R10), R11 + MOVL CX, (R12) + MOVL R8, 4(R12) + MOVL AX, 8(R12) + MOVL R11, 12(R12) + MOVL 8(DX), CX + MOVL 24(R10), R8 + MOVL 4(R10), AX + MOVL 4(DX), R11 + MOVL CX, 16(R12) + MOVL R8, 20(R12) + MOVL AX, 24(R12) + MOVL R11, 28(R12) + MOVL 12(DX), CX + MOVL 12(R10), DX + MOVL 28(R10), R8 + MOVL 8(R10), AX + MOVL DX, 32(R12) + MOVL CX, 36(R12) + MOVL R8, 40(R12) + MOVL AX, 44(R12) + MOVQ $0x61707865, DX + MOVQ $0x3320646e, CX + MOVQ $0x79622d32, R8 + MOVQ $0x6b206574, AX + MOVL DX, 48(R12) + MOVL CX, 52(R12) + MOVL R8, 56(R12) + MOVL AX, 60(R12) + CMPQ R9, $0x00000100 + JB BYTESBETWEEN1AND255 + MOVOA 48(R12), X0 + PSHUFL $0x55, X0, X1 + PSHUFL $0xaa, X0, X2 + PSHUFL $0xff, X0, X3 + PSHUFL $0x00, X0, X0 + MOVOA X1, 64(R12) + MOVOA X2, 80(R12) + MOVOA X3, 96(R12) + MOVOA X0, 112(R12) + MOVOA (R12), X0 + PSHUFL $0xaa, X0, X1 + PSHUFL $0xff, X0, X2 + PSHUFL $0x00, X0, X3 + PSHUFL $0x55, X0, X0 + MOVOA X1, 128(R12) + MOVOA X2, 144(R12) + MOVOA X3, 160(R12) + MOVOA X0, 176(R12) + MOVOA 16(R12), X0 + PSHUFL $0xff, X0, X1 + PSHUFL $0x55, X0, X2 + PSHUFL $0xaa, X0, X0 + MOVOA X1, 192(R12) + MOVOA X2, 208(R12) + MOVOA X0, 224(R12) + MOVOA 32(R12), X0 + PSHUFL $0x00, X0, X1 + PSHUFL $0xaa, X0, X2 + PSHUFL $0xff, X0, X0 + MOVOA X1, 240(R12) + MOVOA X2, 256(R12) + MOVOA X0, 272(R12) -// func salsa2020XORKeyStream(out, in *byte, n uint64, nonce, key *byte) -// This needs up to 64 bytes at 360(R12); hence the non-obvious frame size. -TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment - MOVQ out+0(FP),DI - MOVQ in+8(FP),SI - MOVQ n+16(FP),DX - MOVQ nonce+24(FP),CX - MOVQ key+32(FP),R8 +BYTESATLEAST256: + MOVL 16(R12), DX + MOVL 36(R12), CX + MOVL DX, 288(R12) + MOVL CX, 304(R12) + SHLQ $0x20, CX + ADDQ CX, DX + ADDQ $0x01, DX + MOVQ DX, CX + SHRQ $0x20, CX + MOVL DX, 292(R12) + MOVL CX, 308(R12) + ADDQ $0x01, DX + MOVQ DX, CX + SHRQ $0x20, CX + MOVL DX, 296(R12) + MOVL CX, 312(R12) + ADDQ $0x01, DX + MOVQ DX, CX + SHRQ $0x20, CX + MOVL DX, 300(R12) + MOVL CX, 316(R12) + ADDQ $0x01, DX + MOVQ DX, CX + SHRQ $0x20, CX + MOVL DX, 16(R12) + MOVL CX, 36(R12) + MOVQ R9, 352(R12) + MOVQ $0x00000014, DX + MOVOA 64(R12), X0 + MOVOA 80(R12), X1 + MOVOA 96(R12), X2 + MOVOA 256(R12), X3 + MOVOA 272(R12), X4 + MOVOA 128(R12), X5 + MOVOA 144(R12), X6 + MOVOA 176(R12), X7 + MOVOA 192(R12), X8 + MOVOA 208(R12), X9 + MOVOA 224(R12), X10 + MOVOA 304(R12), X11 + MOVOA 112(R12), X12 + MOVOA 160(R12), X13 + MOVOA 240(R12), X14 + MOVOA 288(R12), X15 - MOVQ SP,R12 - ADDQ $31, R12 - ANDQ $~31, R12 +MAINLOOP1: + MOVOA X1, 320(R12) + MOVOA X2, 336(R12) + MOVOA X13, X1 + PADDL X12, X1 + MOVOA X1, X2 + PSLLL $0x07, X1 + PXOR X1, X14 + PSRLL $0x19, X2 + PXOR X2, X14 + MOVOA X7, X1 + PADDL X0, X1 + MOVOA X1, X2 + PSLLL $0x07, X1 + PXOR X1, X11 + PSRLL $0x19, X2 + PXOR X2, X11 + MOVOA X12, X1 + PADDL X14, X1 + MOVOA X1, X2 + PSLLL $0x09, X1 + PXOR X1, X15 + PSRLL $0x17, X2 + PXOR X2, X15 + MOVOA X0, X1 + PADDL X11, X1 + MOVOA X1, X2 + PSLLL $0x09, X1 + PXOR X1, X9 + PSRLL $0x17, X2 + PXOR X2, X9 + MOVOA X14, X1 + PADDL X15, X1 + MOVOA X1, X2 + PSLLL $0x0d, X1 + PXOR X1, X13 + PSRLL $0x13, X2 + PXOR X2, X13 + MOVOA X11, X1 + PADDL X9, X1 + MOVOA X1, X2 + PSLLL $0x0d, X1 + PXOR X1, X7 + PSRLL $0x13, X2 + PXOR X2, X7 + MOVOA X15, X1 + PADDL X13, X1 + MOVOA X1, X2 + PSLLL $0x12, X1 + PXOR X1, X12 + PSRLL $0x0e, X2 + PXOR X2, X12 + MOVOA 320(R12), X1 + MOVOA X12, 320(R12) + MOVOA X9, X2 + PADDL X7, X2 + MOVOA X2, X12 + PSLLL $0x12, X2 + PXOR X2, X0 + PSRLL $0x0e, X12 + PXOR X12, X0 + MOVOA X5, X2 + PADDL X1, X2 + MOVOA X2, X12 + PSLLL $0x07, X2 + PXOR X2, X3 + PSRLL $0x19, X12 + PXOR X12, X3 + MOVOA 336(R12), X2 + MOVOA X0, 336(R12) + MOVOA X6, X0 + PADDL X2, X0 + MOVOA X0, X12 + PSLLL $0x07, X0 + PXOR X0, X4 + PSRLL $0x19, X12 + PXOR X12, X4 + MOVOA X1, X0 + PADDL X3, X0 + MOVOA X0, X12 + PSLLL $0x09, X0 + PXOR X0, X10 + PSRLL $0x17, X12 + PXOR X12, X10 + MOVOA X2, X0 + PADDL X4, X0 + MOVOA X0, X12 + PSLLL $0x09, X0 + PXOR X0, X8 + PSRLL $0x17, X12 + PXOR X12, X8 + MOVOA X3, X0 + PADDL X10, X0 + MOVOA X0, X12 + PSLLL $0x0d, X0 + PXOR X0, X5 + PSRLL $0x13, X12 + PXOR X12, X5 + MOVOA X4, X0 + PADDL X8, X0 + MOVOA X0, X12 + PSLLL $0x0d, X0 + PXOR X0, X6 + PSRLL $0x13, X12 + PXOR X12, X6 + MOVOA X10, X0 + PADDL X5, X0 + MOVOA X0, X12 + PSLLL $0x12, X0 + PXOR X0, X1 + PSRLL $0x0e, X12 + PXOR X12, X1 + MOVOA 320(R12), X0 + MOVOA X1, 320(R12) + MOVOA X4, X1 + PADDL X0, X1 + MOVOA X1, X12 + PSLLL $0x07, X1 + PXOR X1, X7 + PSRLL $0x19, X12 + PXOR X12, X7 + MOVOA X8, X1 + PADDL X6, X1 + MOVOA X1, X12 + PSLLL $0x12, X1 + PXOR X1, X2 + PSRLL $0x0e, X12 + PXOR X12, X2 + MOVOA 336(R12), X12 + MOVOA X2, 336(R12) + MOVOA X14, X1 + PADDL X12, X1 + MOVOA X1, X2 + PSLLL $0x07, X1 + PXOR X1, X5 + PSRLL $0x19, X2 + PXOR X2, X5 + MOVOA X0, X1 + PADDL X7, X1 + MOVOA X1, X2 + PSLLL $0x09, X1 + PXOR X1, X10 + PSRLL $0x17, X2 + PXOR X2, X10 + MOVOA X12, X1 + PADDL X5, X1 + MOVOA X1, X2 + PSLLL $0x09, X1 + PXOR X1, X8 + PSRLL $0x17, X2 + PXOR X2, X8 + MOVOA X7, X1 + PADDL X10, X1 + MOVOA X1, X2 + PSLLL $0x0d, X1 + PXOR X1, X4 + PSRLL $0x13, X2 + PXOR X2, X4 + MOVOA X5, X1 + PADDL X8, X1 + MOVOA X1, X2 + PSLLL $0x0d, X1 + PXOR X1, X14 + PSRLL $0x13, X2 + PXOR X2, X14 + MOVOA X10, X1 + PADDL X4, X1 + MOVOA X1, X2 + PSLLL $0x12, X1 + PXOR X1, X0 + PSRLL $0x0e, X2 + PXOR X2, X0 + MOVOA 320(R12), X1 + MOVOA X0, 320(R12) + MOVOA X8, X0 + PADDL X14, X0 + MOVOA X0, X2 + PSLLL $0x12, X0 + PXOR X0, X12 + PSRLL $0x0e, X2 + PXOR X2, X12 + MOVOA X11, X0 + PADDL X1, X0 + MOVOA X0, X2 + PSLLL $0x07, X0 + PXOR X0, X6 + PSRLL $0x19, X2 + PXOR X2, X6 + MOVOA 336(R12), X2 + MOVOA X12, 336(R12) + MOVOA X3, X0 + PADDL X2, X0 + MOVOA X0, X12 + PSLLL $0x07, X0 + PXOR X0, X13 + PSRLL $0x19, X12 + PXOR X12, X13 + MOVOA X1, X0 + PADDL X6, X0 + MOVOA X0, X12 + PSLLL $0x09, X0 + PXOR X0, X15 + PSRLL $0x17, X12 + PXOR X12, X15 + MOVOA X2, X0 + PADDL X13, X0 + MOVOA X0, X12 + PSLLL $0x09, X0 + PXOR X0, X9 + PSRLL $0x17, X12 + PXOR X12, X9 + MOVOA X6, X0 + PADDL X15, X0 + MOVOA X0, X12 + PSLLL $0x0d, X0 + PXOR X0, X11 + PSRLL $0x13, X12 + PXOR X12, X11 + MOVOA X13, X0 + PADDL X9, X0 + MOVOA X0, X12 + PSLLL $0x0d, X0 + PXOR X0, X3 + PSRLL $0x13, X12 + PXOR X12, X3 + MOVOA X15, X0 + PADDL X11, X0 + MOVOA X0, X12 + PSLLL $0x12, X0 + PXOR X0, X1 + PSRLL $0x0e, X12 + PXOR X12, X1 + MOVOA X9, X0 + PADDL X3, X0 + MOVOA X0, X12 + PSLLL $0x12, X0 + PXOR X0, X2 + PSRLL $0x0e, X12 + PXOR X12, X2 + MOVOA 320(R12), X12 + MOVOA 336(R12), X0 + SUBQ $0x02, DX + JA MAINLOOP1 + PADDL 112(R12), X12 + PADDL 176(R12), X7 + PADDL 224(R12), X10 + PADDL 272(R12), X4 + MOVD X12, DX + MOVD X7, CX + MOVD X10, R8 + MOVD X4, R9 + PSHUFL $0x39, X12, X12 + PSHUFL $0x39, X7, X7 + PSHUFL $0x39, X10, X10 + PSHUFL $0x39, X4, X4 + XORL (SI), DX + XORL 4(SI), CX + XORL 8(SI), R8 + XORL 12(SI), R9 + MOVL DX, (DI) + MOVL CX, 4(DI) + MOVL R8, 8(DI) + MOVL R9, 12(DI) + MOVD X12, DX + MOVD X7, CX + MOVD X10, R8 + MOVD X4, R9 + PSHUFL $0x39, X12, X12 + PSHUFL $0x39, X7, X7 + PSHUFL $0x39, X10, X10 + PSHUFL $0x39, X4, X4 + XORL 64(SI), DX + XORL 68(SI), CX + XORL 72(SI), R8 + XORL 76(SI), R9 + MOVL DX, 64(DI) + MOVL CX, 68(DI) + MOVL R8, 72(DI) + MOVL R9, 76(DI) + MOVD X12, DX + MOVD X7, CX + MOVD X10, R8 + MOVD X4, R9 + PSHUFL $0x39, X12, X12 + PSHUFL $0x39, X7, X7 + PSHUFL $0x39, X10, X10 + PSHUFL $0x39, X4, X4 + XORL 128(SI), DX + XORL 132(SI), CX + XORL 136(SI), R8 + XORL 140(SI), R9 + MOVL DX, 128(DI) + MOVL CX, 132(DI) + MOVL R8, 136(DI) + MOVL R9, 140(DI) + MOVD X12, DX + MOVD X7, CX + MOVD X10, R8 + MOVD X4, R9 + XORL 192(SI), DX + XORL 196(SI), CX + XORL 200(SI), R8 + XORL 204(SI), R9 + MOVL DX, 192(DI) + MOVL CX, 196(DI) + MOVL R8, 200(DI) + MOVL R9, 204(DI) + PADDL 240(R12), X14 + PADDL 64(R12), X0 + PADDL 128(R12), X5 + PADDL 192(R12), X8 + MOVD X14, DX + MOVD X0, CX + MOVD X5, R8 + MOVD X8, R9 + PSHUFL $0x39, X14, X14 + PSHUFL $0x39, X0, X0 + PSHUFL $0x39, X5, X5 + PSHUFL $0x39, X8, X8 + XORL 16(SI), DX + XORL 20(SI), CX + XORL 24(SI), R8 + XORL 28(SI), R9 + MOVL DX, 16(DI) + MOVL CX, 20(DI) + MOVL R8, 24(DI) + MOVL R9, 28(DI) + MOVD X14, DX + MOVD X0, CX + MOVD X5, R8 + MOVD X8, R9 + PSHUFL $0x39, X14, X14 + PSHUFL $0x39, X0, X0 + PSHUFL $0x39, X5, X5 + PSHUFL $0x39, X8, X8 + XORL 80(SI), DX + XORL 84(SI), CX + XORL 88(SI), R8 + XORL 92(SI), R9 + MOVL DX, 80(DI) + MOVL CX, 84(DI) + MOVL R8, 88(DI) + MOVL R9, 92(DI) + MOVD X14, DX + MOVD X0, CX + MOVD X5, R8 + MOVD X8, R9 + PSHUFL $0x39, X14, X14 + PSHUFL $0x39, X0, X0 + PSHUFL $0x39, X5, X5 + PSHUFL $0x39, X8, X8 + XORL 144(SI), DX + XORL 148(SI), CX + XORL 152(SI), R8 + XORL 156(SI), R9 + MOVL DX, 144(DI) + MOVL CX, 148(DI) + MOVL R8, 152(DI) + MOVL R9, 156(DI) + MOVD X14, DX + MOVD X0, CX + MOVD X5, R8 + MOVD X8, R9 + XORL 208(SI), DX + XORL 212(SI), CX + XORL 216(SI), R8 + XORL 220(SI), R9 + MOVL DX, 208(DI) + MOVL CX, 212(DI) + MOVL R8, 216(DI) + MOVL R9, 220(DI) + PADDL 288(R12), X15 + PADDL 304(R12), X11 + PADDL 80(R12), X1 + PADDL 144(R12), X6 + MOVD X15, DX + MOVD X11, CX + MOVD X1, R8 + MOVD X6, R9 + PSHUFL $0x39, X15, X15 + PSHUFL $0x39, X11, X11 + PSHUFL $0x39, X1, X1 + PSHUFL $0x39, X6, X6 + XORL 32(SI), DX + XORL 36(SI), CX + XORL 40(SI), R8 + XORL 44(SI), R9 + MOVL DX, 32(DI) + MOVL CX, 36(DI) + MOVL R8, 40(DI) + MOVL R9, 44(DI) + MOVD X15, DX + MOVD X11, CX + MOVD X1, R8 + MOVD X6, R9 + PSHUFL $0x39, X15, X15 + PSHUFL $0x39, X11, X11 + PSHUFL $0x39, X1, X1 + PSHUFL $0x39, X6, X6 + XORL 96(SI), DX + XORL 100(SI), CX + XORL 104(SI), R8 + XORL 108(SI), R9 + MOVL DX, 96(DI) + MOVL CX, 100(DI) + MOVL R8, 104(DI) + MOVL R9, 108(DI) + MOVD X15, DX + MOVD X11, CX + MOVD X1, R8 + MOVD X6, R9 + PSHUFL $0x39, X15, X15 + PSHUFL $0x39, X11, X11 + PSHUFL $0x39, X1, X1 + PSHUFL $0x39, X6, X6 + XORL 160(SI), DX + XORL 164(SI), CX + XORL 168(SI), R8 + XORL 172(SI), R9 + MOVL DX, 160(DI) + MOVL CX, 164(DI) + MOVL R8, 168(DI) + MOVL R9, 172(DI) + MOVD X15, DX + MOVD X11, CX + MOVD X1, R8 + MOVD X6, R9 + XORL 224(SI), DX + XORL 228(SI), CX + XORL 232(SI), R8 + XORL 236(SI), R9 + MOVL DX, 224(DI) + MOVL CX, 228(DI) + MOVL R8, 232(DI) + MOVL R9, 236(DI) + PADDL 160(R12), X13 + PADDL 208(R12), X9 + PADDL 256(R12), X3 + PADDL 96(R12), X2 + MOVD X13, DX + MOVD X9, CX + MOVD X3, R8 + MOVD X2, R9 + PSHUFL $0x39, X13, X13 + PSHUFL $0x39, X9, X9 + PSHUFL $0x39, X3, X3 + PSHUFL $0x39, X2, X2 + XORL 48(SI), DX + XORL 52(SI), CX + XORL 56(SI), R8 + XORL 60(SI), R9 + MOVL DX, 48(DI) + MOVL CX, 52(DI) + MOVL R8, 56(DI) + MOVL R9, 60(DI) + MOVD X13, DX + MOVD X9, CX + MOVD X3, R8 + MOVD X2, R9 + PSHUFL $0x39, X13, X13 + PSHUFL $0x39, X9, X9 + PSHUFL $0x39, X3, X3 + PSHUFL $0x39, X2, X2 + XORL 112(SI), DX + XORL 116(SI), CX + XORL 120(SI), R8 + XORL 124(SI), R9 + MOVL DX, 112(DI) + MOVL CX, 116(DI) + MOVL R8, 120(DI) + MOVL R9, 124(DI) + MOVD X13, DX + MOVD X9, CX + MOVD X3, R8 + MOVD X2, R9 + PSHUFL $0x39, X13, X13 + PSHUFL $0x39, X9, X9 + PSHUFL $0x39, X3, X3 + PSHUFL $0x39, X2, X2 + XORL 176(SI), DX + XORL 180(SI), CX + XORL 184(SI), R8 + XORL 188(SI), R9 + MOVL DX, 176(DI) + MOVL CX, 180(DI) + MOVL R8, 184(DI) + MOVL R9, 188(DI) + MOVD X13, DX + MOVD X9, CX + MOVD X3, R8 + MOVD X2, R9 + XORL 240(SI), DX + XORL 244(SI), CX + XORL 248(SI), R8 + XORL 252(SI), R9 + MOVL DX, 240(DI) + MOVL CX, 244(DI) + MOVL R8, 248(DI) + MOVL R9, 252(DI) + MOVQ 352(R12), R9 + SUBQ $0x00000100, R9 + ADDQ $0x00000100, SI + ADDQ $0x00000100, DI + CMPQ R9, $0x00000100 + JAE BYTESATLEAST256 + CMPQ R9, $0x00 + JBE DONE - MOVQ DX,R9 - MOVQ CX,DX - MOVQ R8,R10 - CMPQ R9,$0 - JBE DONE - START: - MOVL 20(R10),CX - MOVL 0(R10),R8 - MOVL 0(DX),AX - MOVL 16(R10),R11 - MOVL CX,0(R12) - MOVL R8, 4 (R12) - MOVL AX, 8 (R12) - MOVL R11, 12 (R12) - MOVL 8(DX),CX - MOVL 24(R10),R8 - MOVL 4(R10),AX - MOVL 4(DX),R11 - MOVL CX,16(R12) - MOVL R8, 20 (R12) - MOVL AX, 24 (R12) - MOVL R11, 28 (R12) - MOVL 12(DX),CX - MOVL 12(R10),DX - MOVL 28(R10),R8 - MOVL 8(R10),AX - MOVL DX,32(R12) - MOVL CX, 36 (R12) - MOVL R8, 40 (R12) - MOVL AX, 44 (R12) - MOVQ $1634760805,DX - MOVQ $857760878,CX - MOVQ $2036477234,R8 - MOVQ $1797285236,AX - MOVL DX,48(R12) - MOVL CX, 52 (R12) - MOVL R8, 56 (R12) - MOVL AX, 60 (R12) - CMPQ R9,$256 - JB BYTESBETWEEN1AND255 - MOVOA 48(R12),X0 - PSHUFL $0X55,X0,X1 - PSHUFL $0XAA,X0,X2 - PSHUFL $0XFF,X0,X3 - PSHUFL $0X00,X0,X0 - MOVOA X1,64(R12) - MOVOA X2,80(R12) - MOVOA X3,96(R12) - MOVOA X0,112(R12) - MOVOA 0(R12),X0 - PSHUFL $0XAA,X0,X1 - PSHUFL $0XFF,X0,X2 - PSHUFL $0X00,X0,X3 - PSHUFL $0X55,X0,X0 - MOVOA X1,128(R12) - MOVOA X2,144(R12) - MOVOA X3,160(R12) - MOVOA X0,176(R12) - MOVOA 16(R12),X0 - PSHUFL $0XFF,X0,X1 - PSHUFL $0X55,X0,X2 - PSHUFL $0XAA,X0,X0 - MOVOA X1,192(R12) - MOVOA X2,208(R12) - MOVOA X0,224(R12) - MOVOA 32(R12),X0 - PSHUFL $0X00,X0,X1 - PSHUFL $0XAA,X0,X2 - PSHUFL $0XFF,X0,X0 - MOVOA X1,240(R12) - MOVOA X2,256(R12) - MOVOA X0,272(R12) - BYTESATLEAST256: - MOVL 16(R12),DX - MOVL 36 (R12),CX - MOVL DX,288(R12) - MOVL CX,304(R12) - SHLQ $32,CX - ADDQ CX,DX - ADDQ $1,DX - MOVQ DX,CX - SHRQ $32,CX - MOVL DX, 292 (R12) - MOVL CX, 308 (R12) - ADDQ $1,DX - MOVQ DX,CX - SHRQ $32,CX - MOVL DX, 296 (R12) - MOVL CX, 312 (R12) - ADDQ $1,DX - MOVQ DX,CX - SHRQ $32,CX - MOVL DX, 300 (R12) - MOVL CX, 316 (R12) - ADDQ $1,DX - MOVQ DX,CX - SHRQ $32,CX - MOVL DX,16(R12) - MOVL CX, 36 (R12) - MOVQ R9,352(R12) - MOVQ $20,DX - MOVOA 64(R12),X0 - MOVOA 80(R12),X1 - MOVOA 96(R12),X2 - MOVOA 256(R12),X3 - MOVOA 272(R12),X4 - MOVOA 128(R12),X5 - MOVOA 144(R12),X6 - MOVOA 176(R12),X7 - MOVOA 192(R12),X8 - MOVOA 208(R12),X9 - MOVOA 224(R12),X10 - MOVOA 304(R12),X11 - MOVOA 112(R12),X12 - MOVOA 160(R12),X13 - MOVOA 240(R12),X14 - MOVOA 288(R12),X15 - MAINLOOP1: - MOVOA X1,320(R12) - MOVOA X2,336(R12) - MOVOA X13,X1 - PADDL X12,X1 - MOVOA X1,X2 - PSLLL $7,X1 - PXOR X1,X14 - PSRLL $25,X2 - PXOR X2,X14 - MOVOA X7,X1 - PADDL X0,X1 - MOVOA X1,X2 - PSLLL $7,X1 - PXOR X1,X11 - PSRLL $25,X2 - PXOR X2,X11 - MOVOA X12,X1 - PADDL X14,X1 - MOVOA X1,X2 - PSLLL $9,X1 - PXOR X1,X15 - PSRLL $23,X2 - PXOR X2,X15 - MOVOA X0,X1 - PADDL X11,X1 - MOVOA X1,X2 - PSLLL $9,X1 - PXOR X1,X9 - PSRLL $23,X2 - PXOR X2,X9 - MOVOA X14,X1 - PADDL X15,X1 - MOVOA X1,X2 - PSLLL $13,X1 - PXOR X1,X13 - PSRLL $19,X2 - PXOR X2,X13 - MOVOA X11,X1 - PADDL X9,X1 - MOVOA X1,X2 - PSLLL $13,X1 - PXOR X1,X7 - PSRLL $19,X2 - PXOR X2,X7 - MOVOA X15,X1 - PADDL X13,X1 - MOVOA X1,X2 - PSLLL $18,X1 - PXOR X1,X12 - PSRLL $14,X2 - PXOR X2,X12 - MOVOA 320(R12),X1 - MOVOA X12,320(R12) - MOVOA X9,X2 - PADDL X7,X2 - MOVOA X2,X12 - PSLLL $18,X2 - PXOR X2,X0 - PSRLL $14,X12 - PXOR X12,X0 - MOVOA X5,X2 - PADDL X1,X2 - MOVOA X2,X12 - PSLLL $7,X2 - PXOR X2,X3 - PSRLL $25,X12 - PXOR X12,X3 - MOVOA 336(R12),X2 - MOVOA X0,336(R12) - MOVOA X6,X0 - PADDL X2,X0 - MOVOA X0,X12 - PSLLL $7,X0 - PXOR X0,X4 - PSRLL $25,X12 - PXOR X12,X4 - MOVOA X1,X0 - PADDL X3,X0 - MOVOA X0,X12 - PSLLL $9,X0 - PXOR X0,X10 - PSRLL $23,X12 - PXOR X12,X10 - MOVOA X2,X0 - PADDL X4,X0 - MOVOA X0,X12 - PSLLL $9,X0 - PXOR X0,X8 - PSRLL $23,X12 - PXOR X12,X8 - MOVOA X3,X0 - PADDL X10,X0 - MOVOA X0,X12 - PSLLL $13,X0 - PXOR X0,X5 - PSRLL $19,X12 - PXOR X12,X5 - MOVOA X4,X0 - PADDL X8,X0 - MOVOA X0,X12 - PSLLL $13,X0 - PXOR X0,X6 - PSRLL $19,X12 - PXOR X12,X6 - MOVOA X10,X0 - PADDL X5,X0 - MOVOA X0,X12 - PSLLL $18,X0 - PXOR X0,X1 - PSRLL $14,X12 - PXOR X12,X1 - MOVOA 320(R12),X0 - MOVOA X1,320(R12) - MOVOA X4,X1 - PADDL X0,X1 - MOVOA X1,X12 - PSLLL $7,X1 - PXOR X1,X7 - PSRLL $25,X12 - PXOR X12,X7 - MOVOA X8,X1 - PADDL X6,X1 - MOVOA X1,X12 - PSLLL $18,X1 - PXOR X1,X2 - PSRLL $14,X12 - PXOR X12,X2 - MOVOA 336(R12),X12 - MOVOA X2,336(R12) - MOVOA X14,X1 - PADDL X12,X1 - MOVOA X1,X2 - PSLLL $7,X1 - PXOR X1,X5 - PSRLL $25,X2 - PXOR X2,X5 - MOVOA X0,X1 - PADDL X7,X1 - MOVOA X1,X2 - PSLLL $9,X1 - PXOR X1,X10 - PSRLL $23,X2 - PXOR X2,X10 - MOVOA X12,X1 - PADDL X5,X1 - MOVOA X1,X2 - PSLLL $9,X1 - PXOR X1,X8 - PSRLL $23,X2 - PXOR X2,X8 - MOVOA X7,X1 - PADDL X10,X1 - MOVOA X1,X2 - PSLLL $13,X1 - PXOR X1,X4 - PSRLL $19,X2 - PXOR X2,X4 - MOVOA X5,X1 - PADDL X8,X1 - MOVOA X1,X2 - PSLLL $13,X1 - PXOR X1,X14 - PSRLL $19,X2 - PXOR X2,X14 - MOVOA X10,X1 - PADDL X4,X1 - MOVOA X1,X2 - PSLLL $18,X1 - PXOR X1,X0 - PSRLL $14,X2 - PXOR X2,X0 - MOVOA 320(R12),X1 - MOVOA X0,320(R12) - MOVOA X8,X0 - PADDL X14,X0 - MOVOA X0,X2 - PSLLL $18,X0 - PXOR X0,X12 - PSRLL $14,X2 - PXOR X2,X12 - MOVOA X11,X0 - PADDL X1,X0 - MOVOA X0,X2 - PSLLL $7,X0 - PXOR X0,X6 - PSRLL $25,X2 - PXOR X2,X6 - MOVOA 336(R12),X2 - MOVOA X12,336(R12) - MOVOA X3,X0 - PADDL X2,X0 - MOVOA X0,X12 - PSLLL $7,X0 - PXOR X0,X13 - PSRLL $25,X12 - PXOR X12,X13 - MOVOA X1,X0 - PADDL X6,X0 - MOVOA X0,X12 - PSLLL $9,X0 - PXOR X0,X15 - PSRLL $23,X12 - PXOR X12,X15 - MOVOA X2,X0 - PADDL X13,X0 - MOVOA X0,X12 - PSLLL $9,X0 - PXOR X0,X9 - PSRLL $23,X12 - PXOR X12,X9 - MOVOA X6,X0 - PADDL X15,X0 - MOVOA X0,X12 - PSLLL $13,X0 - PXOR X0,X11 - PSRLL $19,X12 - PXOR X12,X11 - MOVOA X13,X0 - PADDL X9,X0 - MOVOA X0,X12 - PSLLL $13,X0 - PXOR X0,X3 - PSRLL $19,X12 - PXOR X12,X3 - MOVOA X15,X0 - PADDL X11,X0 - MOVOA X0,X12 - PSLLL $18,X0 - PXOR X0,X1 - PSRLL $14,X12 - PXOR X12,X1 - MOVOA X9,X0 - PADDL X3,X0 - MOVOA X0,X12 - PSLLL $18,X0 - PXOR X0,X2 - PSRLL $14,X12 - PXOR X12,X2 - MOVOA 320(R12),X12 - MOVOA 336(R12),X0 - SUBQ $2,DX - JA MAINLOOP1 - PADDL 112(R12),X12 - PADDL 176(R12),X7 - PADDL 224(R12),X10 - PADDL 272(R12),X4 - MOVD X12,DX - MOVD X7,CX - MOVD X10,R8 - MOVD X4,R9 - PSHUFL $0X39,X12,X12 - PSHUFL $0X39,X7,X7 - PSHUFL $0X39,X10,X10 - PSHUFL $0X39,X4,X4 - XORL 0(SI),DX - XORL 4(SI),CX - XORL 8(SI),R8 - XORL 12(SI),R9 - MOVL DX,0(DI) - MOVL CX,4(DI) - MOVL R8,8(DI) - MOVL R9,12(DI) - MOVD X12,DX - MOVD X7,CX - MOVD X10,R8 - MOVD X4,R9 - PSHUFL $0X39,X12,X12 - PSHUFL $0X39,X7,X7 - PSHUFL $0X39,X10,X10 - PSHUFL $0X39,X4,X4 - XORL 64(SI),DX - XORL 68(SI),CX - XORL 72(SI),R8 - XORL 76(SI),R9 - MOVL DX,64(DI) - MOVL CX,68(DI) - MOVL R8,72(DI) - MOVL R9,76(DI) - MOVD X12,DX - MOVD X7,CX - MOVD X10,R8 - MOVD X4,R9 - PSHUFL $0X39,X12,X12 - PSHUFL $0X39,X7,X7 - PSHUFL $0X39,X10,X10 - PSHUFL $0X39,X4,X4 - XORL 128(SI),DX - XORL 132(SI),CX - XORL 136(SI),R8 - XORL 140(SI),R9 - MOVL DX,128(DI) - MOVL CX,132(DI) - MOVL R8,136(DI) - MOVL R9,140(DI) - MOVD X12,DX - MOVD X7,CX - MOVD X10,R8 - MOVD X4,R9 - XORL 192(SI),DX - XORL 196(SI),CX - XORL 200(SI),R8 - XORL 204(SI),R9 - MOVL DX,192(DI) - MOVL CX,196(DI) - MOVL R8,200(DI) - MOVL R9,204(DI) - PADDL 240(R12),X14 - PADDL 64(R12),X0 - PADDL 128(R12),X5 - PADDL 192(R12),X8 - MOVD X14,DX - MOVD X0,CX - MOVD X5,R8 - MOVD X8,R9 - PSHUFL $0X39,X14,X14 - PSHUFL $0X39,X0,X0 - PSHUFL $0X39,X5,X5 - PSHUFL $0X39,X8,X8 - XORL 16(SI),DX - XORL 20(SI),CX - XORL 24(SI),R8 - XORL 28(SI),R9 - MOVL DX,16(DI) - MOVL CX,20(DI) - MOVL R8,24(DI) - MOVL R9,28(DI) - MOVD X14,DX - MOVD X0,CX - MOVD X5,R8 - MOVD X8,R9 - PSHUFL $0X39,X14,X14 - PSHUFL $0X39,X0,X0 - PSHUFL $0X39,X5,X5 - PSHUFL $0X39,X8,X8 - XORL 80(SI),DX - XORL 84(SI),CX - XORL 88(SI),R8 - XORL 92(SI),R9 - MOVL DX,80(DI) - MOVL CX,84(DI) - MOVL R8,88(DI) - MOVL R9,92(DI) - MOVD X14,DX - MOVD X0,CX - MOVD X5,R8 - MOVD X8,R9 - PSHUFL $0X39,X14,X14 - PSHUFL $0X39,X0,X0 - PSHUFL $0X39,X5,X5 - PSHUFL $0X39,X8,X8 - XORL 144(SI),DX - XORL 148(SI),CX - XORL 152(SI),R8 - XORL 156(SI),R9 - MOVL DX,144(DI) - MOVL CX,148(DI) - MOVL R8,152(DI) - MOVL R9,156(DI) - MOVD X14,DX - MOVD X0,CX - MOVD X5,R8 - MOVD X8,R9 - XORL 208(SI),DX - XORL 212(SI),CX - XORL 216(SI),R8 - XORL 220(SI),R9 - MOVL DX,208(DI) - MOVL CX,212(DI) - MOVL R8,216(DI) - MOVL R9,220(DI) - PADDL 288(R12),X15 - PADDL 304(R12),X11 - PADDL 80(R12),X1 - PADDL 144(R12),X6 - MOVD X15,DX - MOVD X11,CX - MOVD X1,R8 - MOVD X6,R9 - PSHUFL $0X39,X15,X15 - PSHUFL $0X39,X11,X11 - PSHUFL $0X39,X1,X1 - PSHUFL $0X39,X6,X6 - XORL 32(SI),DX - XORL 36(SI),CX - XORL 40(SI),R8 - XORL 44(SI),R9 - MOVL DX,32(DI) - MOVL CX,36(DI) - MOVL R8,40(DI) - MOVL R9,44(DI) - MOVD X15,DX - MOVD X11,CX - MOVD X1,R8 - MOVD X6,R9 - PSHUFL $0X39,X15,X15 - PSHUFL $0X39,X11,X11 - PSHUFL $0X39,X1,X1 - PSHUFL $0X39,X6,X6 - XORL 96(SI),DX - XORL 100(SI),CX - XORL 104(SI),R8 - XORL 108(SI),R9 - MOVL DX,96(DI) - MOVL CX,100(DI) - MOVL R8,104(DI) - MOVL R9,108(DI) - MOVD X15,DX - MOVD X11,CX - MOVD X1,R8 - MOVD X6,R9 - PSHUFL $0X39,X15,X15 - PSHUFL $0X39,X11,X11 - PSHUFL $0X39,X1,X1 - PSHUFL $0X39,X6,X6 - XORL 160(SI),DX - XORL 164(SI),CX - XORL 168(SI),R8 - XORL 172(SI),R9 - MOVL DX,160(DI) - MOVL CX,164(DI) - MOVL R8,168(DI) - MOVL R9,172(DI) - MOVD X15,DX - MOVD X11,CX - MOVD X1,R8 - MOVD X6,R9 - XORL 224(SI),DX - XORL 228(SI),CX - XORL 232(SI),R8 - XORL 236(SI),R9 - MOVL DX,224(DI) - MOVL CX,228(DI) - MOVL R8,232(DI) - MOVL R9,236(DI) - PADDL 160(R12),X13 - PADDL 208(R12),X9 - PADDL 256(R12),X3 - PADDL 96(R12),X2 - MOVD X13,DX - MOVD X9,CX - MOVD X3,R8 - MOVD X2,R9 - PSHUFL $0X39,X13,X13 - PSHUFL $0X39,X9,X9 - PSHUFL $0X39,X3,X3 - PSHUFL $0X39,X2,X2 - XORL 48(SI),DX - XORL 52(SI),CX - XORL 56(SI),R8 - XORL 60(SI),R9 - MOVL DX,48(DI) - MOVL CX,52(DI) - MOVL R8,56(DI) - MOVL R9,60(DI) - MOVD X13,DX - MOVD X9,CX - MOVD X3,R8 - MOVD X2,R9 - PSHUFL $0X39,X13,X13 - PSHUFL $0X39,X9,X9 - PSHUFL $0X39,X3,X3 - PSHUFL $0X39,X2,X2 - XORL 112(SI),DX - XORL 116(SI),CX - XORL 120(SI),R8 - XORL 124(SI),R9 - MOVL DX,112(DI) - MOVL CX,116(DI) - MOVL R8,120(DI) - MOVL R9,124(DI) - MOVD X13,DX - MOVD X9,CX - MOVD X3,R8 - MOVD X2,R9 - PSHUFL $0X39,X13,X13 - PSHUFL $0X39,X9,X9 - PSHUFL $0X39,X3,X3 - PSHUFL $0X39,X2,X2 - XORL 176(SI),DX - XORL 180(SI),CX - XORL 184(SI),R8 - XORL 188(SI),R9 - MOVL DX,176(DI) - MOVL CX,180(DI) - MOVL R8,184(DI) - MOVL R9,188(DI) - MOVD X13,DX - MOVD X9,CX - MOVD X3,R8 - MOVD X2,R9 - XORL 240(SI),DX - XORL 244(SI),CX - XORL 248(SI),R8 - XORL 252(SI),R9 - MOVL DX,240(DI) - MOVL CX,244(DI) - MOVL R8,248(DI) - MOVL R9,252(DI) - MOVQ 352(R12),R9 - SUBQ $256,R9 - ADDQ $256,SI - ADDQ $256,DI - CMPQ R9,$256 - JAE BYTESATLEAST256 - CMPQ R9,$0 - JBE DONE - BYTESBETWEEN1AND255: - CMPQ R9,$64 - JAE NOCOPY - MOVQ DI,DX - LEAQ 360(R12),DI - MOVQ R9,CX +BYTESBETWEEN1AND255: + CMPQ R9, $0x40 + JAE NOCOPY + MOVQ DI, DX + LEAQ 360(R12), DI + MOVQ R9, CX REP; MOVSB - LEAQ 360(R12),DI - LEAQ 360(R12),SI - NOCOPY: - MOVQ R9,352(R12) - MOVOA 48(R12),X0 - MOVOA 0(R12),X1 - MOVOA 16(R12),X2 - MOVOA 32(R12),X3 - MOVOA X1,X4 - MOVQ $20,CX - MAINLOOP2: - PADDL X0,X4 - MOVOA X0,X5 - MOVOA X4,X6 - PSLLL $7,X4 - PSRLL $25,X6 - PXOR X4,X3 - PXOR X6,X3 - PADDL X3,X5 - MOVOA X3,X4 - MOVOA X5,X6 - PSLLL $9,X5 - PSRLL $23,X6 - PXOR X5,X2 - PSHUFL $0X93,X3,X3 - PXOR X6,X2 - PADDL X2,X4 - MOVOA X2,X5 - MOVOA X4,X6 - PSLLL $13,X4 - PSRLL $19,X6 - PXOR X4,X1 - PSHUFL $0X4E,X2,X2 - PXOR X6,X1 - PADDL X1,X5 - MOVOA X3,X4 - MOVOA X5,X6 - PSLLL $18,X5 - PSRLL $14,X6 - PXOR X5,X0 - PSHUFL $0X39,X1,X1 - PXOR X6,X0 - PADDL X0,X4 - MOVOA X0,X5 - MOVOA X4,X6 - PSLLL $7,X4 - PSRLL $25,X6 - PXOR X4,X1 - PXOR X6,X1 - PADDL X1,X5 - MOVOA X1,X4 - MOVOA X5,X6 - PSLLL $9,X5 - PSRLL $23,X6 - PXOR X5,X2 - PSHUFL $0X93,X1,X1 - PXOR X6,X2 - PADDL X2,X4 - MOVOA X2,X5 - MOVOA X4,X6 - PSLLL $13,X4 - PSRLL $19,X6 - PXOR X4,X3 - PSHUFL $0X4E,X2,X2 - PXOR X6,X3 - PADDL X3,X5 - MOVOA X1,X4 - MOVOA X5,X6 - PSLLL $18,X5 - PSRLL $14,X6 - PXOR X5,X0 - PSHUFL $0X39,X3,X3 - PXOR X6,X0 - PADDL X0,X4 - MOVOA X0,X5 - MOVOA X4,X6 - PSLLL $7,X4 - PSRLL $25,X6 - PXOR X4,X3 - PXOR X6,X3 - PADDL X3,X5 - MOVOA X3,X4 - MOVOA X5,X6 - PSLLL $9,X5 - PSRLL $23,X6 - PXOR X5,X2 - PSHUFL $0X93,X3,X3 - PXOR X6,X2 - PADDL X2,X4 - MOVOA X2,X5 - MOVOA X4,X6 - PSLLL $13,X4 - PSRLL $19,X6 - PXOR X4,X1 - PSHUFL $0X4E,X2,X2 - PXOR X6,X1 - PADDL X1,X5 - MOVOA X3,X4 - MOVOA X5,X6 - PSLLL $18,X5 - PSRLL $14,X6 - PXOR X5,X0 - PSHUFL $0X39,X1,X1 - PXOR X6,X0 - PADDL X0,X4 - MOVOA X0,X5 - MOVOA X4,X6 - PSLLL $7,X4 - PSRLL $25,X6 - PXOR X4,X1 - PXOR X6,X1 - PADDL X1,X5 - MOVOA X1,X4 - MOVOA X5,X6 - PSLLL $9,X5 - PSRLL $23,X6 - PXOR X5,X2 - PSHUFL $0X93,X1,X1 - PXOR X6,X2 - PADDL X2,X4 - MOVOA X2,X5 - MOVOA X4,X6 - PSLLL $13,X4 - PSRLL $19,X6 - PXOR X4,X3 - PSHUFL $0X4E,X2,X2 - PXOR X6,X3 - SUBQ $4,CX - PADDL X3,X5 - MOVOA X1,X4 - MOVOA X5,X6 - PSLLL $18,X5 - PXOR X7,X7 - PSRLL $14,X6 - PXOR X5,X0 - PSHUFL $0X39,X3,X3 - PXOR X6,X0 - JA MAINLOOP2 - PADDL 48(R12),X0 - PADDL 0(R12),X1 - PADDL 16(R12),X2 - PADDL 32(R12),X3 - MOVD X0,CX - MOVD X1,R8 - MOVD X2,R9 - MOVD X3,AX - PSHUFL $0X39,X0,X0 - PSHUFL $0X39,X1,X1 - PSHUFL $0X39,X2,X2 - PSHUFL $0X39,X3,X3 - XORL 0(SI),CX - XORL 48(SI),R8 - XORL 32(SI),R9 - XORL 16(SI),AX - MOVL CX,0(DI) - MOVL R8,48(DI) - MOVL R9,32(DI) - MOVL AX,16(DI) - MOVD X0,CX - MOVD X1,R8 - MOVD X2,R9 - MOVD X3,AX - PSHUFL $0X39,X0,X0 - PSHUFL $0X39,X1,X1 - PSHUFL $0X39,X2,X2 - PSHUFL $0X39,X3,X3 - XORL 20(SI),CX - XORL 4(SI),R8 - XORL 52(SI),R9 - XORL 36(SI),AX - MOVL CX,20(DI) - MOVL R8,4(DI) - MOVL R9,52(DI) - MOVL AX,36(DI) - MOVD X0,CX - MOVD X1,R8 - MOVD X2,R9 - MOVD X3,AX - PSHUFL $0X39,X0,X0 - PSHUFL $0X39,X1,X1 - PSHUFL $0X39,X2,X2 - PSHUFL $0X39,X3,X3 - XORL 40(SI),CX - XORL 24(SI),R8 - XORL 8(SI),R9 - XORL 56(SI),AX - MOVL CX,40(DI) - MOVL R8,24(DI) - MOVL R9,8(DI) - MOVL AX,56(DI) - MOVD X0,CX - MOVD X1,R8 - MOVD X2,R9 - MOVD X3,AX - XORL 60(SI),CX - XORL 44(SI),R8 - XORL 28(SI),R9 - XORL 12(SI),AX - MOVL CX,60(DI) - MOVL R8,44(DI) - MOVL R9,28(DI) - MOVL AX,12(DI) - MOVQ 352(R12),R9 - MOVL 16(R12),CX - MOVL 36 (R12),R8 - ADDQ $1,CX - SHLQ $32,R8 - ADDQ R8,CX - MOVQ CX,R8 - SHRQ $32,R8 - MOVL CX,16(R12) - MOVL R8, 36 (R12) - CMPQ R9,$64 - JA BYTESATLEAST65 - JAE BYTESATLEAST64 - MOVQ DI,SI - MOVQ DX,DI - MOVQ R9,CX + LEAQ 360(R12), DI + LEAQ 360(R12), SI + +NOCOPY: + MOVQ R9, 352(R12) + MOVOA 48(R12), X0 + MOVOA (R12), X1 + MOVOA 16(R12), X2 + MOVOA 32(R12), X3 + MOVOA X1, X4 + MOVQ $0x00000014, CX + +MAINLOOP2: + PADDL X0, X4 + MOVOA X0, X5 + MOVOA X4, X6 + PSLLL $0x07, X4 + PSRLL $0x19, X6 + PXOR X4, X3 + PXOR X6, X3 + PADDL X3, X5 + MOVOA X3, X4 + MOVOA X5, X6 + PSLLL $0x09, X5 + PSRLL $0x17, X6 + PXOR X5, X2 + PSHUFL $0x93, X3, X3 + PXOR X6, X2 + PADDL X2, X4 + MOVOA X2, X5 + MOVOA X4, X6 + PSLLL $0x0d, X4 + PSRLL $0x13, X6 + PXOR X4, X1 + PSHUFL $0x4e, X2, X2 + PXOR X6, X1 + PADDL X1, X5 + MOVOA X3, X4 + MOVOA X5, X6 + PSLLL $0x12, X5 + PSRLL $0x0e, X6 + PXOR X5, X0 + PSHUFL $0x39, X1, X1 + PXOR X6, X0 + PADDL X0, X4 + MOVOA X0, X5 + MOVOA X4, X6 + PSLLL $0x07, X4 + PSRLL $0x19, X6 + PXOR X4, X1 + PXOR X6, X1 + PADDL X1, X5 + MOVOA X1, X4 + MOVOA X5, X6 + PSLLL $0x09, X5 + PSRLL $0x17, X6 + PXOR X5, X2 + PSHUFL $0x93, X1, X1 + PXOR X6, X2 + PADDL X2, X4 + MOVOA X2, X5 + MOVOA X4, X6 + PSLLL $0x0d, X4 + PSRLL $0x13, X6 + PXOR X4, X3 + PSHUFL $0x4e, X2, X2 + PXOR X6, X3 + PADDL X3, X5 + MOVOA X1, X4 + MOVOA X5, X6 + PSLLL $0x12, X5 + PSRLL $0x0e, X6 + PXOR X5, X0 + PSHUFL $0x39, X3, X3 + PXOR X6, X0 + PADDL X0, X4 + MOVOA X0, X5 + MOVOA X4, X6 + PSLLL $0x07, X4 + PSRLL $0x19, X6 + PXOR X4, X3 + PXOR X6, X3 + PADDL X3, X5 + MOVOA X3, X4 + MOVOA X5, X6 + PSLLL $0x09, X5 + PSRLL $0x17, X6 + PXOR X5, X2 + PSHUFL $0x93, X3, X3 + PXOR X6, X2 + PADDL X2, X4 + MOVOA X2, X5 + MOVOA X4, X6 + PSLLL $0x0d, X4 + PSRLL $0x13, X6 + PXOR X4, X1 + PSHUFL $0x4e, X2, X2 + PXOR X6, X1 + PADDL X1, X5 + MOVOA X3, X4 + MOVOA X5, X6 + PSLLL $0x12, X5 + PSRLL $0x0e, X6 + PXOR X5, X0 + PSHUFL $0x39, X1, X1 + PXOR X6, X0 + PADDL X0, X4 + MOVOA X0, X5 + MOVOA X4, X6 + PSLLL $0x07, X4 + PSRLL $0x19, X6 + PXOR X4, X1 + PXOR X6, X1 + PADDL X1, X5 + MOVOA X1, X4 + MOVOA X5, X6 + PSLLL $0x09, X5 + PSRLL $0x17, X6 + PXOR X5, X2 + PSHUFL $0x93, X1, X1 + PXOR X6, X2 + PADDL X2, X4 + MOVOA X2, X5 + MOVOA X4, X6 + PSLLL $0x0d, X4 + PSRLL $0x13, X6 + PXOR X4, X3 + PSHUFL $0x4e, X2, X2 + PXOR X6, X3 + SUBQ $0x04, CX + PADDL X3, X5 + MOVOA X1, X4 + MOVOA X5, X6 + PSLLL $0x12, X5 + PXOR X7, X7 + PSRLL $0x0e, X6 + PXOR X5, X0 + PSHUFL $0x39, X3, X3 + PXOR X6, X0 + JA MAINLOOP2 + PADDL 48(R12), X0 + PADDL (R12), X1 + PADDL 16(R12), X2 + PADDL 32(R12), X3 + MOVD X0, CX + MOVD X1, R8 + MOVD X2, R9 + MOVD X3, AX + PSHUFL $0x39, X0, X0 + PSHUFL $0x39, X1, X1 + PSHUFL $0x39, X2, X2 + PSHUFL $0x39, X3, X3 + XORL (SI), CX + XORL 48(SI), R8 + XORL 32(SI), R9 + XORL 16(SI), AX + MOVL CX, (DI) + MOVL R8, 48(DI) + MOVL R9, 32(DI) + MOVL AX, 16(DI) + MOVD X0, CX + MOVD X1, R8 + MOVD X2, R9 + MOVD X3, AX + PSHUFL $0x39, X0, X0 + PSHUFL $0x39, X1, X1 + PSHUFL $0x39, X2, X2 + PSHUFL $0x39, X3, X3 + XORL 20(SI), CX + XORL 4(SI), R8 + XORL 52(SI), R9 + XORL 36(SI), AX + MOVL CX, 20(DI) + MOVL R8, 4(DI) + MOVL R9, 52(DI) + MOVL AX, 36(DI) + MOVD X0, CX + MOVD X1, R8 + MOVD X2, R9 + MOVD X3, AX + PSHUFL $0x39, X0, X0 + PSHUFL $0x39, X1, X1 + PSHUFL $0x39, X2, X2 + PSHUFL $0x39, X3, X3 + XORL 40(SI), CX + XORL 24(SI), R8 + XORL 8(SI), R9 + XORL 56(SI), AX + MOVL CX, 40(DI) + MOVL R8, 24(DI) + MOVL R9, 8(DI) + MOVL AX, 56(DI) + MOVD X0, CX + MOVD X1, R8 + MOVD X2, R9 + MOVD X3, AX + XORL 60(SI), CX + XORL 44(SI), R8 + XORL 28(SI), R9 + XORL 12(SI), AX + MOVL CX, 60(DI) + MOVL R8, 44(DI) + MOVL R9, 28(DI) + MOVL AX, 12(DI) + MOVQ 352(R12), R9 + MOVL 16(R12), CX + MOVL 36(R12), R8 + ADDQ $0x01, CX + SHLQ $0x20, R8 + ADDQ R8, CX + MOVQ CX, R8 + SHRQ $0x20, R8 + MOVL CX, 16(R12) + MOVL R8, 36(R12) + CMPQ R9, $0x40 + JA BYTESATLEAST65 + JAE BYTESATLEAST64 + MOVQ DI, SI + MOVQ DX, DI + MOVQ R9, CX REP; MOVSB - BYTESATLEAST64: - DONE: + +BYTESATLEAST64: +DONE: RET - BYTESATLEAST65: - SUBQ $64,R9 - ADDQ $64,DI - ADDQ $64,SI - JMP BYTESBETWEEN1AND255 + +BYTESATLEAST65: + SUBQ $0x40, R9 + ADDQ $0x40, DI + ADDQ $0x40, SI + JMP BYTESBETWEEN1AND255 diff --git a/vendor/golang.org/x/exp/LICENSE b/vendor/golang.org/x/exp/LICENSE index 6a66aea5..2a7cf70d 100644 --- a/vendor/golang.org/x/exp/LICENSE +++ b/vendor/golang.org/x/exp/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/net/LICENSE b/vendor/golang.org/x/net/LICENSE index 6a66aea5..2a7cf70d 100644 --- a/vendor/golang.org/x/net/LICENSE +++ b/vendor/golang.org/x/net/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go index 98a49c6b..61f511f9 100644 --- a/vendor/golang.org/x/net/http2/transport.go +++ b/vendor/golang.org/x/net/http2/transport.go @@ -827,10 +827,6 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro cc.henc.SetMaxDynamicTableSizeLimit(t.maxEncoderHeaderTableSize()) cc.peerMaxHeaderTableSize = initialHeaderTableSize - if t.AllowHTTP { - cc.nextStreamID = 3 - } - if cs, ok := c.(connectionStater); ok { state := cs.ConnectionState() cc.tlsState = &state diff --git a/vendor/golang.org/x/oauth2/LICENSE b/vendor/golang.org/x/oauth2/LICENSE index 6a66aea5..2a7cf70d 100644 --- a/vendor/golang.org/x/oauth2/LICENSE +++ b/vendor/golang.org/x/oauth2/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/oauth2/token.go b/vendor/golang.org/x/oauth2/token.go index 5bbb3321..109997d7 100644 --- a/vendor/golang.org/x/oauth2/token.go +++ b/vendor/golang.org/x/oauth2/token.go @@ -49,6 +49,13 @@ type Token struct { // mechanisms for that TokenSource will not be used. Expiry time.Time `json:"expiry,omitempty"` + // ExpiresIn is the OAuth2 wire format "expires_in" field, + // which specifies how many seconds later the token expires, + // relative to an unknown time base approximately around "now". + // It is the application's responsibility to populate + // `Expiry` from `ExpiresIn` when required. + ExpiresIn int64 `json:"expires_in,omitempty"` + // raw optionally contains extra metadata from the server // when updating a token. raw interface{} diff --git a/vendor/golang.org/x/sync/LICENSE b/vendor/golang.org/x/sync/LICENSE index 6a66aea5..2a7cf70d 100644 --- a/vendor/golang.org/x/sync/LICENSE +++ b/vendor/golang.org/x/sync/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/sys/LICENSE b/vendor/golang.org/x/sys/LICENSE index 6a66aea5..2a7cf70d 100644 --- a/vendor/golang.org/x/sys/LICENSE +++ b/vendor/golang.org/x/sys/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/sys/cpu/cpu.go b/vendor/golang.org/x/sys/cpu/cpu.go index 8fa707aa..02609d5b 100644 --- a/vendor/golang.org/x/sys/cpu/cpu.go +++ b/vendor/golang.org/x/sys/cpu/cpu.go @@ -105,6 +105,8 @@ var ARM64 struct { HasSVE bool // Scalable Vector Extensions HasSVE2 bool // Scalable Vector Extensions 2 HasASIMDFHM bool // Advanced SIMD multiplication FP16 to FP32 + HasDIT bool // Data Independent Timing support + HasI8MM bool // Advanced SIMD Int8 matrix multiplication instructions _ CacheLinePad } @@ -199,6 +201,25 @@ var S390X struct { _ CacheLinePad } +// RISCV64 contains the supported CPU features and performance characteristics for riscv64 +// platforms. The booleans in RISCV64, with the exception of HasFastMisaligned, indicate +// the presence of RISC-V extensions. +// +// It is safe to assume that all the RV64G extensions are supported and so they are omitted from +// this structure. As riscv64 Go programs require at least RV64G, the code that populates +// this structure cannot run successfully if some of the RV64G extensions are missing. +// The struct is padded to avoid false sharing. +var RISCV64 struct { + _ CacheLinePad + HasFastMisaligned bool // Fast misaligned accesses + HasC bool // Compressed instruction-set extension + HasV bool // Vector extension compatible with RVV 1.0 + HasZba bool // Address generation instructions extension + HasZbb bool // Basic bit-manipulation extension + HasZbs bool // Single-bit instructions extension + _ CacheLinePad +} + func init() { archInit() initOptions() diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_arm64.go index 0e27a21e..af2aa99f 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_arm64.go @@ -38,6 +38,8 @@ func initOptions() { {Name: "dcpop", Feature: &ARM64.HasDCPOP}, {Name: "asimddp", Feature: &ARM64.HasASIMDDP}, {Name: "asimdfhm", Feature: &ARM64.HasASIMDFHM}, + {Name: "dit", Feature: &ARM64.HasDIT}, + {Name: "i8mm", Feature: &ARM64.HasI8MM}, } } @@ -145,6 +147,11 @@ func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) { ARM64.HasLRCPC = true } + switch extractBits(isar1, 52, 55) { + case 1: + ARM64.HasI8MM = true + } + // ID_AA64PFR0_EL1 switch extractBits(pfr0, 16, 19) { case 0: @@ -168,6 +175,11 @@ func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) { parseARM64SVERegister(getzfr0()) } + + switch extractBits(pfr0, 48, 51) { + case 1: + ARM64.HasDIT = true + } } func parseARM64SVERegister(zfr0 uint64) { diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go index 3d386d0f..08f35ea1 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go @@ -35,8 +35,10 @@ const ( hwcap_SHA512 = 1 << 21 hwcap_SVE = 1 << 22 hwcap_ASIMDFHM = 1 << 23 + hwcap_DIT = 1 << 24 hwcap2_SVE2 = 1 << 1 + hwcap2_I8MM = 1 << 13 ) // linuxKernelCanEmulateCPUID reports whether we're running @@ -106,9 +108,12 @@ func doinit() { ARM64.HasSHA512 = isSet(hwCap, hwcap_SHA512) ARM64.HasSVE = isSet(hwCap, hwcap_SVE) ARM64.HasASIMDFHM = isSet(hwCap, hwcap_ASIMDFHM) + ARM64.HasDIT = isSet(hwCap, hwcap_DIT) + // HWCAP2 feature bits ARM64.HasSVE2 = isSet(hwCap2, hwcap2_SVE2) + ARM64.HasI8MM = isSet(hwCap2, hwcap2_I8MM) } func isSet(hwc uint, value uint) bool { diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go b/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go index cd63e733..7d902b68 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build linux && !arm && !arm64 && !mips64 && !mips64le && !ppc64 && !ppc64le && !s390x +//go:build linux && !arm && !arm64 && !mips64 && !mips64le && !ppc64 && !ppc64le && !s390x && !riscv64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_riscv64.go b/vendor/golang.org/x/sys/cpu/cpu_linux_riscv64.go new file mode 100644 index 00000000..cb4a0c57 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_riscv64.go @@ -0,0 +1,137 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +import ( + "syscall" + "unsafe" +) + +// RISC-V extension discovery code for Linux. The approach here is to first try the riscv_hwprobe +// syscall falling back to HWCAP to check for the C extension if riscv_hwprobe is not available. +// +// A note on detection of the Vector extension using HWCAP. +// +// Support for the Vector extension version 1.0 was added to the Linux kernel in release 6.5. +// Support for the riscv_hwprobe syscall was added in 6.4. It follows that if the riscv_hwprobe +// syscall is not available then neither is the Vector extension (which needs kernel support). +// The riscv_hwprobe syscall should then be all we need to detect the Vector extension. +// However, some RISC-V board manufacturers ship boards with an older kernel on top of which +// they have back-ported various versions of the Vector extension patches but not the riscv_hwprobe +// patches. These kernels advertise support for the Vector extension using HWCAP. Falling +// back to HWCAP to detect the Vector extension, if riscv_hwprobe is not available, or simply not +// bothering with riscv_hwprobe at all and just using HWCAP may then seem like an attractive option. +// +// Unfortunately, simply checking the 'V' bit in AT_HWCAP will not work as this bit is used by +// RISC-V board and cloud instance providers to mean different things. The Lichee Pi 4A board +// and the Scaleway RV1 cloud instances use the 'V' bit to advertise their support for the unratified +// 0.7.1 version of the Vector Specification. The Banana Pi BPI-F3 and the CanMV-K230 board use +// it to advertise support for 1.0 of the Vector extension. Versions 0.7.1 and 1.0 of the Vector +// extension are binary incompatible. HWCAP can then not be used in isolation to populate the +// HasV field as this field indicates that the underlying CPU is compatible with RVV 1.0. +// +// There is a way at runtime to distinguish between versions 0.7.1 and 1.0 of the Vector +// specification by issuing a RVV 1.0 vsetvli instruction and checking the vill bit of the vtype +// register. This check would allow us to safely detect version 1.0 of the Vector extension +// with HWCAP, if riscv_hwprobe were not available. However, the check cannot +// be added until the assembler supports the Vector instructions. +// +// Note the riscv_hwprobe syscall does not suffer from these ambiguities by design as all of the +// extensions it advertises support for are explicitly versioned. It's also worth noting that +// the riscv_hwprobe syscall is the only way to detect multi-letter RISC-V extensions, e.g., Zba. +// These cannot be detected using HWCAP and so riscv_hwprobe must be used to detect the majority +// of RISC-V extensions. +// +// Please see https://docs.kernel.org/arch/riscv/hwprobe.html for more information. + +// golang.org/x/sys/cpu is not allowed to depend on golang.org/x/sys/unix so we must +// reproduce the constants, types and functions needed to make the riscv_hwprobe syscall +// here. + +const ( + // Copied from golang.org/x/sys/unix/ztypes_linux_riscv64.go. + riscv_HWPROBE_KEY_IMA_EXT_0 = 0x4 + riscv_HWPROBE_IMA_C = 0x2 + riscv_HWPROBE_IMA_V = 0x4 + riscv_HWPROBE_EXT_ZBA = 0x8 + riscv_HWPROBE_EXT_ZBB = 0x10 + riscv_HWPROBE_EXT_ZBS = 0x20 + riscv_HWPROBE_KEY_CPUPERF_0 = 0x5 + riscv_HWPROBE_MISALIGNED_FAST = 0x3 + riscv_HWPROBE_MISALIGNED_MASK = 0x7 +) + +const ( + // sys_RISCV_HWPROBE is copied from golang.org/x/sys/unix/zsysnum_linux_riscv64.go. + sys_RISCV_HWPROBE = 258 +) + +// riscvHWProbePairs is copied from golang.org/x/sys/unix/ztypes_linux_riscv64.go. +type riscvHWProbePairs struct { + key int64 + value uint64 +} + +const ( + // CPU features + hwcap_RISCV_ISA_C = 1 << ('C' - 'A') +) + +func doinit() { + // A slice of key/value pair structures is passed to the RISCVHWProbe syscall. The key + // field should be initialised with one of the key constants defined above, e.g., + // RISCV_HWPROBE_KEY_IMA_EXT_0. The syscall will set the value field to the appropriate value. + // If the kernel does not recognise a key it will set the key field to -1 and the value field to 0. + + pairs := []riscvHWProbePairs{ + {riscv_HWPROBE_KEY_IMA_EXT_0, 0}, + {riscv_HWPROBE_KEY_CPUPERF_0, 0}, + } + + // This call only indicates that extensions are supported if they are implemented on all cores. + if riscvHWProbe(pairs, 0) { + if pairs[0].key != -1 { + v := uint(pairs[0].value) + RISCV64.HasC = isSet(v, riscv_HWPROBE_IMA_C) + RISCV64.HasV = isSet(v, riscv_HWPROBE_IMA_V) + RISCV64.HasZba = isSet(v, riscv_HWPROBE_EXT_ZBA) + RISCV64.HasZbb = isSet(v, riscv_HWPROBE_EXT_ZBB) + RISCV64.HasZbs = isSet(v, riscv_HWPROBE_EXT_ZBS) + } + if pairs[1].key != -1 { + v := pairs[1].value & riscv_HWPROBE_MISALIGNED_MASK + RISCV64.HasFastMisaligned = v == riscv_HWPROBE_MISALIGNED_FAST + } + } + + // Let's double check with HWCAP if the C extension does not appear to be supported. + // This may happen if we're running on a kernel older than 6.4. + + if !RISCV64.HasC { + RISCV64.HasC = isSet(hwCap, hwcap_RISCV_ISA_C) + } +} + +func isSet(hwc uint, value uint) bool { + return hwc&value != 0 +} + +// riscvHWProbe is a simplified version of the generated wrapper function found in +// golang.org/x/sys/unix/zsyscall_linux_riscv64.go. We simplify it by removing the +// cpuCount and cpus parameters which we do not need. We always want to pass 0 for +// these parameters here so the kernel only reports the extensions that are present +// on all cores. +func riscvHWProbe(pairs []riscvHWProbePairs, flags uint) bool { + var _zero uintptr + var p0 unsafe.Pointer + if len(pairs) > 0 { + p0 = unsafe.Pointer(&pairs[0]) + } else { + p0 = unsafe.Pointer(&_zero) + } + + _, _, e1 := syscall.Syscall6(sys_RISCV_HWPROBE, uintptr(p0), uintptr(len(pairs)), uintptr(0), uintptr(0), uintptr(flags), 0) + return e1 == 0 +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_riscv64.go b/vendor/golang.org/x/sys/cpu/cpu_riscv64.go index 7f0c79c0..aca3199c 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_riscv64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_riscv64.go @@ -8,4 +8,13 @@ package cpu const cacheLineSize = 64 -func initOptions() {} +func initOptions() { + options = []option{ + {Name: "fastmisaligned", Feature: &RISCV64.HasFastMisaligned}, + {Name: "c", Feature: &RISCV64.HasC}, + {Name: "v", Feature: &RISCV64.HasV}, + {Name: "zba", Feature: &RISCV64.HasZba}, + {Name: "zbb", Feature: &RISCV64.HasZbb}, + {Name: "zbs", Feature: &RISCV64.HasZbs}, + } +} diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 4ed2e488..e14b766a 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -58,6 +58,7 @@ includes_Darwin=' #define _DARWIN_USE_64_BIT_INODE #define __APPLE_USE_RFC_3542 #include +#include #include #include #include @@ -551,6 +552,7 @@ ccflags="$@" $2 !~ /^RTC_VL_(ACCURACY|BACKUP|DATA)/ && $2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ || $2 ~ /^SOCK_|SK_DIAG_|SKNLGRP_$/ || + $2 ~ /^(CONNECT|SAE)_/ || $2 ~ /^FIORDCHK$/ || $2 ~ /^SIOC/ || $2 ~ /^TIOC/ || diff --git a/vendor/golang.org/x/sys/unix/mremap.go b/vendor/golang.org/x/sys/unix/mremap.go index fd45fe52..3a5e776f 100644 --- a/vendor/golang.org/x/sys/unix/mremap.go +++ b/vendor/golang.org/x/sys/unix/mremap.go @@ -50,3 +50,8 @@ func (m *mremapMmapper) Mremap(oldData []byte, newLength int, flags int) (data [ func Mremap(oldData []byte, newLength int, flags int) (data []byte, err error) { return mapper.Mremap(oldData, newLength, flags) } + +func MremapPtr(oldAddr unsafe.Pointer, oldSize uintptr, newAddr unsafe.Pointer, newSize uintptr, flags int) (ret unsafe.Pointer, err error) { + xaddr, err := mapper.mremap(uintptr(oldAddr), oldSize, newSize, flags, uintptr(newAddr)) + return unsafe.Pointer(xaddr), err +} diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 59542a89..099867de 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -402,6 +402,18 @@ func IoctlSetIfreqMTU(fd int, ifreq *IfreqMTU) error { return ioctlPtr(fd, SIOCSIFMTU, unsafe.Pointer(ifreq)) } +//sys renamexNp(from string, to string, flag uint32) (err error) + +func RenamexNp(from string, to string, flag uint32) (err error) { + return renamexNp(from, to, flag) +} + +//sys renameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error) + +func RenameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error) { + return renameatxNp(fromfd, from, tofd, to, flag) +} + //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL func Uname(uname *Utsname) error { @@ -542,6 +554,55 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) { } } +//sys pthread_chdir_np(path string) (err error) + +func PthreadChdir(path string) (err error) { + return pthread_chdir_np(path) +} + +//sys pthread_fchdir_np(fd int) (err error) + +func PthreadFchdir(fd int) (err error) { + return pthread_fchdir_np(fd) +} + +// Connectx calls connectx(2) to initiate a connection on a socket. +// +// srcIf, srcAddr, and dstAddr are filled into a [SaEndpoints] struct and passed as the endpoints argument. +// +// - srcIf is the optional source interface index. 0 means unspecified. +// - srcAddr is the optional source address. nil means unspecified. +// - dstAddr is the destination address. +// +// On success, Connectx returns the number of bytes enqueued for transmission. +func Connectx(fd int, srcIf uint32, srcAddr, dstAddr Sockaddr, associd SaeAssocID, flags uint32, iov []Iovec, connid *SaeConnID) (n uintptr, err error) { + endpoints := SaEndpoints{ + Srcif: srcIf, + } + + if srcAddr != nil { + addrp, addrlen, err := srcAddr.sockaddr() + if err != nil { + return 0, err + } + endpoints.Srcaddr = (*RawSockaddr)(addrp) + endpoints.Srcaddrlen = uint32(addrlen) + } + + if dstAddr != nil { + addrp, addrlen, err := dstAddr.sockaddr() + if err != nil { + return 0, err + } + endpoints.Dstaddr = (*RawSockaddr)(addrp) + endpoints.Dstaddrlen = uint32(addrlen) + } + + err = connectx(fd, &endpoints, associd, flags, iov, &n, connid) + return +} + +//sys connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error) //sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) //sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_hurd.go b/vendor/golang.org/x/sys/unix/syscall_hurd.go index ba46651f..a6a2d2fc 100644 --- a/vendor/golang.org/x/sys/unix/syscall_hurd.go +++ b/vendor/golang.org/x/sys/unix/syscall_hurd.go @@ -11,6 +11,7 @@ package unix int ioctl(int, unsigned long int, uintptr_t); */ import "C" +import "unsafe" func ioctl(fd int, req uint, arg uintptr) (err error) { r0, er := C.ioctl(C.int(fd), C.ulong(req), C.uintptr_t(arg)) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 5682e262..3f1d3d4c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -2592,3 +2592,4 @@ func SchedGetAttr(pid int, flags uint) (*SchedAttr, error) { } //sys Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error) +//sys Mseal(b []byte, flags uint) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index b25343c7..b86ded54 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -293,6 +293,7 @@ func Uname(uname *Utsname) error { //sys Mkfifoat(dirfd int, path string, mode uint32) (err error) //sys Mknod(path string, mode uint32, dev int) (err error) //sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error) +//sys Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys Open(path string, mode int, perm uint32) (fd int, err error) //sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index 77081de8..4e92e5aa 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -154,6 +154,15 @@ func Munmap(b []byte) (err error) { return mapper.Munmap(b) } +func MmapPtr(fd int, offset int64, addr unsafe.Pointer, length uintptr, prot int, flags int) (ret unsafe.Pointer, err error) { + xaddr, err := mapper.mmap(uintptr(addr), length, prot, flags, fd, offset) + return unsafe.Pointer(xaddr), err +} + +func MunmapPtr(addr unsafe.Pointer, length uintptr) (err error) { + return mapper.munmap(uintptr(addr), length) +} + func Read(fd int, p []byte) (n int, err error) { n, err = read(fd, p) if raceenabled { diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go index e40fa852..d73c4652 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go @@ -237,6 +237,9 @@ const ( CLOCK_UPTIME_RAW_APPROX = 0x9 CLONE_NOFOLLOW = 0x1 CLONE_NOOWNERCOPY = 0x2 + CONNECT_DATA_AUTHENTICATED = 0x4 + CONNECT_DATA_IDEMPOTENT = 0x2 + CONNECT_RESUME_ON_READ_WRITE = 0x1 CR0 = 0x0 CR1 = 0x1000 CR2 = 0x2000 @@ -1169,6 +1172,11 @@ const ( PT_WRITE_D = 0x5 PT_WRITE_I = 0x4 PT_WRITE_U = 0x6 + RENAME_EXCL = 0x4 + RENAME_NOFOLLOW_ANY = 0x10 + RENAME_RESERVED1 = 0x8 + RENAME_SECLUDE = 0x1 + RENAME_SWAP = 0x2 RLIMIT_AS = 0x5 RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 @@ -1260,6 +1268,10 @@ const ( RTV_SSTHRESH = 0x20 RUSAGE_CHILDREN = -0x1 RUSAGE_SELF = 0x0 + SAE_ASSOCID_ALL = 0xffffffff + SAE_ASSOCID_ANY = 0x0 + SAE_CONNID_ALL = 0xffffffff + SAE_CONNID_ANY = 0x0 SCM_CREDS = 0x3 SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go index bb02aa6c..4a55a400 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go @@ -237,6 +237,9 @@ const ( CLOCK_UPTIME_RAW_APPROX = 0x9 CLONE_NOFOLLOW = 0x1 CLONE_NOOWNERCOPY = 0x2 + CONNECT_DATA_AUTHENTICATED = 0x4 + CONNECT_DATA_IDEMPOTENT = 0x2 + CONNECT_RESUME_ON_READ_WRITE = 0x1 CR0 = 0x0 CR1 = 0x1000 CR2 = 0x2000 @@ -1169,6 +1172,11 @@ const ( PT_WRITE_D = 0x5 PT_WRITE_I = 0x4 PT_WRITE_U = 0x6 + RENAME_EXCL = 0x4 + RENAME_NOFOLLOW_ANY = 0x10 + RENAME_RESERVED1 = 0x8 + RENAME_SECLUDE = 0x1 + RENAME_SWAP = 0x2 RLIMIT_AS = 0x5 RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 @@ -1260,6 +1268,10 @@ const ( RTV_SSTHRESH = 0x20 RUSAGE_CHILDREN = -0x1 RUSAGE_SELF = 0x0 + SAE_ASSOCID_ALL = 0xffffffff + SAE_ASSOCID_ANY = 0x0 + SAE_CONNID_ALL = 0xffffffff + SAE_CONNID_ANY = 0x0 SCM_CREDS = 0x3 SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index 877a62b4..01a70b24 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -457,6 +457,7 @@ const ( B600 = 0x8 B75 = 0x2 B9600 = 0xd + BCACHEFS_SUPER_MAGIC = 0xca451a4e BDEVFS_MAGIC = 0x62646576 BINDERFS_SUPER_MAGIC = 0x6c6f6f70 BINFMTFS_MAGIC = 0x42494e4d @@ -928,6 +929,7 @@ const ( EPOLL_CTL_ADD = 0x1 EPOLL_CTL_DEL = 0x2 EPOLL_CTL_MOD = 0x3 + EPOLL_IOC_TYPE = 0x8a EROFS_SUPER_MAGIC_V1 = 0xe0f5e1e2 ESP_V4_FLOW = 0xa ESP_V6_FLOW = 0xc @@ -941,9 +943,6 @@ const ( ETHTOOL_FEC_OFF = 0x4 ETHTOOL_FEC_RS = 0x8 ETHTOOL_FLAG_ALL = 0x7 - ETHTOOL_FLAG_COMPACT_BITSETS = 0x1 - ETHTOOL_FLAG_OMIT_REPLY = 0x2 - ETHTOOL_FLAG_STATS = 0x4 ETHTOOL_FLASHDEV = 0x33 ETHTOOL_FLASH_MAX_FILENAME = 0x80 ETHTOOL_FWVERS_LEN = 0x20 @@ -1705,6 +1704,7 @@ const ( KEXEC_ARCH_S390 = 0x160000 KEXEC_ARCH_SH = 0x2a0000 KEXEC_ARCH_X86_64 = 0x3e0000 + KEXEC_CRASH_HOTPLUG_SUPPORT = 0x8 KEXEC_FILE_DEBUG = 0x8 KEXEC_FILE_NO_INITRAMFS = 0x4 KEXEC_FILE_ON_CRASH = 0x2 @@ -1780,6 +1780,7 @@ const ( KEY_SPEC_USER_KEYRING = -0x4 KEY_SPEC_USER_SESSION_KEYRING = -0x5 LANDLOCK_ACCESS_FS_EXECUTE = 0x1 + LANDLOCK_ACCESS_FS_IOCTL_DEV = 0x8000 LANDLOCK_ACCESS_FS_MAKE_BLOCK = 0x800 LANDLOCK_ACCESS_FS_MAKE_CHAR = 0x40 LANDLOCK_ACCESS_FS_MAKE_DIR = 0x80 @@ -1861,6 +1862,19 @@ const ( MAP_FILE = 0x0 MAP_FIXED = 0x10 MAP_FIXED_NOREPLACE = 0x100000 + MAP_HUGE_16GB = 0x88000000 + MAP_HUGE_16KB = 0x38000000 + MAP_HUGE_16MB = 0x60000000 + MAP_HUGE_1GB = 0x78000000 + MAP_HUGE_1MB = 0x50000000 + MAP_HUGE_256MB = 0x70000000 + MAP_HUGE_2GB = 0x7c000000 + MAP_HUGE_2MB = 0x54000000 + MAP_HUGE_32MB = 0x64000000 + MAP_HUGE_512KB = 0x4c000000 + MAP_HUGE_512MB = 0x74000000 + MAP_HUGE_64KB = 0x40000000 + MAP_HUGE_8MB = 0x5c000000 MAP_HUGE_MASK = 0x3f MAP_HUGE_SHIFT = 0x1a MAP_PRIVATE = 0x2 @@ -2498,6 +2512,23 @@ const ( PR_PAC_GET_ENABLED_KEYS = 0x3d PR_PAC_RESET_KEYS = 0x36 PR_PAC_SET_ENABLED_KEYS = 0x3c + PR_PPC_DEXCR_CTRL_CLEAR = 0x4 + PR_PPC_DEXCR_CTRL_CLEAR_ONEXEC = 0x10 + PR_PPC_DEXCR_CTRL_EDITABLE = 0x1 + PR_PPC_DEXCR_CTRL_MASK = 0x1f + PR_PPC_DEXCR_CTRL_SET = 0x2 + PR_PPC_DEXCR_CTRL_SET_ONEXEC = 0x8 + PR_PPC_DEXCR_IBRTPD = 0x1 + PR_PPC_DEXCR_NPHIE = 0x3 + PR_PPC_DEXCR_SBHE = 0x0 + PR_PPC_DEXCR_SRAPD = 0x2 + PR_PPC_GET_DEXCR = 0x48 + PR_PPC_SET_DEXCR = 0x49 + PR_RISCV_CTX_SW_FENCEI_OFF = 0x1 + PR_RISCV_CTX_SW_FENCEI_ON = 0x0 + PR_RISCV_SCOPE_PER_PROCESS = 0x0 + PR_RISCV_SCOPE_PER_THREAD = 0x1 + PR_RISCV_SET_ICACHE_FLUSH_CTX = 0x47 PR_RISCV_V_GET_CONTROL = 0x46 PR_RISCV_V_SET_CONTROL = 0x45 PR_RISCV_V_VSTATE_CTRL_CUR_MASK = 0x3 @@ -3192,6 +3223,7 @@ const ( STATX_MTIME = 0x40 STATX_NLINK = 0x4 STATX_SIZE = 0x200 + STATX_SUBVOL = 0x8000 STATX_TYPE = 0x1 STATX_UID = 0x8 STATX__RESERVED = 0x80000000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index e4bc0bd5..684a5168 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 689317af..61d74b59 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index 5cca668a..a28c9e3e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 14270508..ab5d1fe8 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 ESR_MAGIC = 0x45535201 EXTPROC = 0x10000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go index 28e39afd..c523090e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index cd66e92c..01e6ea78 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x80 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index c1595eba..7aa610b1 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x80 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index ee9456b0..92af771b 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x80 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 8cfca81e..b27ef5e6 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x80 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go index 60b0deb3..237a2cef 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x20 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000000 FF1 = 0x4000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index f90aa728..4a5c555a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x20 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000000 FF1 = 0x4000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index ba9e0150..a02fb49a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x20 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000000 FF1 = 0x4000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index 07cdfd6e..e26a7c61 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 2f1dd214..c48f7c21 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index f40519d9..ad4b9aac 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -82,6 +82,8 @@ const ( EFD_CLOEXEC = 0x400000 EFD_NONBLOCK = 0x4000 EMT_TAGOVF = 0x1 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x400000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go index da08b2ab..1ec2b140 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go @@ -581,6 +581,8 @@ const ( AT_EMPTY_PATH = 0x1000 AT_REMOVEDIR = 0x200 RENAME_NOREPLACE = 1 << 0 + ST_RDONLY = 1 + ST_NOSUID = 2 ) const ( diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index ccb02f24..24b346e1 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -740,6 +740,54 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func renamexNp(from string, to string, flag uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_renamex_np_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flag)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renamex_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renamex_np renamex_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func renameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_renameatx_np_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), uintptr(flag), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renameatx_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renameatx_np renameatx_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { @@ -760,6 +808,59 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pthread_chdir_np(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_pthread_chdir_np_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pthread_chdir_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pthread_chdir_np pthread_chdir_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pthread_fchdir_np(fd int) (err error) { + _, _, e1 := syscall_syscall(libc_pthread_fchdir_np_trampoline_addr, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pthread_fchdir_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pthread_fchdir_np pthread_fchdir_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error) { + var _p0 unsafe.Pointer + if len(iov) > 0 { + _p0 = unsafe.Pointer(&iov[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall9(libc_connectx_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(endpoints)), uintptr(associd), uintptr(flags), uintptr(_p0), uintptr(len(iov)), uintptr(unsafe.Pointer(n)), uintptr(unsafe.Pointer(connid)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_connectx_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_connectx connectx "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { _, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s index 8b8bb284..ebd21310 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s @@ -223,11 +223,36 @@ TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) +TEXT libc_renamex_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renamex_np(SB) +GLOBL ·libc_renamex_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renamex_np_trampoline_addr(SB)/8, $libc_renamex_np_trampoline<>(SB) + +TEXT libc_renameatx_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renameatx_np(SB) +GLOBL ·libc_renameatx_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renameatx_np_trampoline_addr(SB)/8, $libc_renameatx_np_trampoline<>(SB) + TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_pthread_chdir_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pthread_chdir_np(SB) +GLOBL ·libc_pthread_chdir_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pthread_chdir_np_trampoline_addr(SB)/8, $libc_pthread_chdir_np_trampoline<>(SB) + +TEXT libc_pthread_fchdir_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pthread_fchdir_np(SB) +GLOBL ·libc_pthread_fchdir_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pthread_fchdir_np_trampoline_addr(SB)/8, $libc_pthread_fchdir_np_trampoline<>(SB) + +TEXT libc_connectx_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_connectx(SB) +GLOBL ·libc_connectx_trampoline_addr(SB), RODATA, $8 +DATA ·libc_connectx_trampoline_addr(SB)/8, $libc_connectx_trampoline<>(SB) + TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendfile(SB) GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index 1b40b997..824b9c2d 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -740,6 +740,54 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func renamexNp(from string, to string, flag uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_renamex_np_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flag)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renamex_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renamex_np renamex_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func renameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_renameatx_np_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), uintptr(flag), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renameatx_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renameatx_np renameatx_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { @@ -760,6 +808,59 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pthread_chdir_np(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_pthread_chdir_np_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pthread_chdir_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pthread_chdir_np pthread_chdir_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pthread_fchdir_np(fd int) (err error) { + _, _, e1 := syscall_syscall(libc_pthread_fchdir_np_trampoline_addr, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pthread_fchdir_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pthread_fchdir_np pthread_fchdir_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error) { + var _p0 unsafe.Pointer + if len(iov) > 0 { + _p0 = unsafe.Pointer(&iov[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall9(libc_connectx_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(endpoints)), uintptr(associd), uintptr(flags), uintptr(_p0), uintptr(len(iov)), uintptr(unsafe.Pointer(n)), uintptr(unsafe.Pointer(connid)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_connectx_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_connectx connectx "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { _, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s index 08362c1a..4f178a22 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s @@ -223,11 +223,36 @@ TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) +TEXT libc_renamex_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renamex_np(SB) +GLOBL ·libc_renamex_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renamex_np_trampoline_addr(SB)/8, $libc_renamex_np_trampoline<>(SB) + +TEXT libc_renameatx_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renameatx_np(SB) +GLOBL ·libc_renameatx_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renameatx_np_trampoline_addr(SB)/8, $libc_renameatx_np_trampoline<>(SB) + TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_pthread_chdir_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pthread_chdir_np(SB) +GLOBL ·libc_pthread_chdir_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pthread_chdir_np_trampoline_addr(SB)/8, $libc_pthread_chdir_np_trampoline<>(SB) + +TEXT libc_pthread_fchdir_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pthread_fchdir_np(SB) +GLOBL ·libc_pthread_fchdir_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pthread_fchdir_np_trampoline_addr(SB)/8, $libc_pthread_fchdir_np_trampoline<>(SB) + +TEXT libc_connectx_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_connectx(SB) +GLOBL ·libc_connectx_trampoline_addr(SB), RODATA, $8 +DATA ·libc_connectx_trampoline_addr(SB)/8, $libc_connectx_trampoline<>(SB) + TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendfile(SB) GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index 87d8612a..1bc1a5ad 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -2229,3 +2229,19 @@ func Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mseal(b []byte, flags uint) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MSEAL, uintptr(_p0), uintptr(len(b)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go index 9dc42410..1851df14 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s index 41b56173..0b43c693 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $4 DATA ·libc_mknodat_trampoline_addr(SB)/4, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mount_trampoline_addr(SB)/4, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $4 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go index 0d3a0751..e1ec0dbe 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s index 4019a656..880c6d6e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go index c39f7776..7c8452a6 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s index ac4af24f..b8ef95b0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $4 DATA ·libc_mknodat_trampoline_addr(SB)/4, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mount_trampoline_addr(SB)/4, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $4 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go index 57571d07..2ffdf861 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s index f77d5321..2af3b5c7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go index e62963e6..1da08d52 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s index fae140b6..b7a25135 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go index 00831354..6e85b0aa 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s index 9d1e0ff0..f15dadf0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s @@ -555,6 +555,12 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_mount(SB) + RET +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 CALL libc_nanosleep(SB) RET diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go index 79029ed5..28b487df 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s index da115f9a..1e7f321e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index 53aef5dc..524b0820 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -457,4 +457,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index 71d52476..d3e38f68 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -379,4 +379,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index c7477061..70b35bf3 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -421,4 +421,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index f96e214f..6c778c23 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -324,4 +324,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go index 28425346..37281cf5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go @@ -318,4 +318,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index d0953018..7e567f1e 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -441,4 +441,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 4459 SYS_LSM_SET_SELF_ATTR = 4460 SYS_LSM_LIST_MODULES = 4461 + SYS_MSEAL = 4462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index 295c7f4b..38ae55e5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -371,4 +371,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 5459 SYS_LSM_SET_SELF_ATTR = 5460 SYS_LSM_LIST_MODULES = 5461 + SYS_MSEAL = 5462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index d1a9eaca..55e92e60 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -371,4 +371,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 5459 SYS_LSM_SET_SELF_ATTR = 5460 SYS_LSM_LIST_MODULES = 5461 + SYS_MSEAL = 5462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index bec157c3..60658d6a 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -441,4 +441,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 4459 SYS_LSM_SET_SELF_ATTR = 4460 SYS_LSM_LIST_MODULES = 4461 + SYS_MSEAL = 4462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go index 7ee7bdc4..e203e8a7 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go @@ -448,4 +448,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index fad1f25b..5944b97d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -420,4 +420,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index 7d3e1635..c66d416d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -420,4 +420,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index 0ed53ad9..9889f6a5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -325,4 +325,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index 2fba04ad..01d86825 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -386,4 +386,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 621d00d7..7b703e77 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -399,4 +399,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index 091d107f..d003c3d4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -306,6 +306,19 @@ type XVSockPgen struct { type _Socklen uint32 +type SaeAssocID uint32 + +type SaeConnID uint32 + +type SaEndpoints struct { + Srcif uint32 + Srcaddr *RawSockaddr + Srcaddrlen uint32 + Dstaddr *RawSockaddr + Dstaddrlen uint32 + _ [4]byte +} + type Xucred struct { Version uint32 Uid uint32 diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index 28ff4ef7..0d45a941 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -306,6 +306,19 @@ type XVSockPgen struct { type _Socklen uint32 +type SaeAssocID uint32 + +type SaeConnID uint32 + +type SaEndpoints struct { + Srcif uint32 + Srcaddr *RawSockaddr + Srcaddrlen uint32 + Dstaddr *RawSockaddr + Dstaddrlen uint32 + _ [4]byte +} + type Xucred struct { Version uint32 Uid uint32 diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go index 6cbd094a..51e13eb0 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go @@ -625,6 +625,7 @@ const ( POLLRDNORM = 0x40 POLLWRBAND = 0x100 POLLWRNORM = 0x4 + POLLRDHUP = 0x4000 ) type CapRights struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go index 7c03b6ee..d002d8ef 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go @@ -630,6 +630,7 @@ const ( POLLRDNORM = 0x40 POLLWRBAND = 0x100 POLLWRNORM = 0x4 + POLLRDHUP = 0x4000 ) type CapRights struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go index 422107ee..3f863d89 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go @@ -616,6 +616,7 @@ const ( POLLRDNORM = 0x40 POLLWRBAND = 0x100 POLLWRNORM = 0x4 + POLLRDHUP = 0x4000 ) type CapRights struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go index 505a12ac..61c72931 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go @@ -610,6 +610,7 @@ const ( POLLRDNORM = 0x40 POLLWRBAND = 0x100 POLLWRNORM = 0x4 + POLLRDHUP = 0x4000 ) type CapRights struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go index cc986c79..b5d17414 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go @@ -612,6 +612,7 @@ const ( POLLRDNORM = 0x40 POLLWRBAND = 0x100 POLLWRNORM = 0x4 + POLLRDHUP = 0x4000 ) type CapRights struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index 4740b834..9f2550dc 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -110,7 +110,8 @@ type Statx_t struct { Mnt_id uint64 Dio_mem_align uint32 Dio_offset_align uint32 - _ [12]uint64 + Subvol uint64 + _ [11]uint64 } type Fsid struct { @@ -2485,7 +2486,7 @@ type XDPMmapOffsets struct { type XDPUmemReg struct { Addr uint64 Len uint64 - Chunk_size uint32 + Size uint32 Headroom uint32 Flags uint32 Tx_metadata_len uint32 @@ -3473,7 +3474,7 @@ const ( DEVLINK_PORT_FN_ATTR_STATE = 0x2 DEVLINK_PORT_FN_ATTR_OPSTATE = 0x3 DEVLINK_PORT_FN_ATTR_CAPS = 0x4 - DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x5 + DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x6 ) type FsverityDigest struct { @@ -3806,6 +3807,9 @@ const ( ETHTOOL_MSG_PSE_GET_REPLY = 0x25 ETHTOOL_MSG_RSS_GET_REPLY = 0x26 ETHTOOL_MSG_KERNEL_MAX = 0x2b + ETHTOOL_FLAG_COMPACT_BITSETS = 0x1 + ETHTOOL_FLAG_OMIT_REPLY = 0x2 + ETHTOOL_FLAG_STATS = 0x4 ETHTOOL_A_HEADER_UNSPEC = 0x0 ETHTOOL_A_HEADER_DEV_INDEX = 0x1 ETHTOOL_A_HEADER_DEV_NAME = 0x2 @@ -3975,7 +3979,7 @@ const ( ETHTOOL_A_TSINFO_TX_TYPES = 0x3 ETHTOOL_A_TSINFO_RX_FILTERS = 0x4 ETHTOOL_A_TSINFO_PHC_INDEX = 0x5 - ETHTOOL_A_TSINFO_MAX = 0x5 + ETHTOOL_A_TSINFO_MAX = 0x6 ETHTOOL_A_CABLE_TEST_UNSPEC = 0x0 ETHTOOL_A_CABLE_TEST_HEADER = 0x1 ETHTOOL_A_CABLE_TEST_MAX = 0x1 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index 15adc041..ad05b51a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -727,6 +727,37 @@ const ( RISCV_HWPROBE_EXT_ZBA = 0x8 RISCV_HWPROBE_EXT_ZBB = 0x10 RISCV_HWPROBE_EXT_ZBS = 0x20 + RISCV_HWPROBE_EXT_ZICBOZ = 0x40 + RISCV_HWPROBE_EXT_ZBC = 0x80 + RISCV_HWPROBE_EXT_ZBKB = 0x100 + RISCV_HWPROBE_EXT_ZBKC = 0x200 + RISCV_HWPROBE_EXT_ZBKX = 0x400 + RISCV_HWPROBE_EXT_ZKND = 0x800 + RISCV_HWPROBE_EXT_ZKNE = 0x1000 + RISCV_HWPROBE_EXT_ZKNH = 0x2000 + RISCV_HWPROBE_EXT_ZKSED = 0x4000 + RISCV_HWPROBE_EXT_ZKSH = 0x8000 + RISCV_HWPROBE_EXT_ZKT = 0x10000 + RISCV_HWPROBE_EXT_ZVBB = 0x20000 + RISCV_HWPROBE_EXT_ZVBC = 0x40000 + RISCV_HWPROBE_EXT_ZVKB = 0x80000 + RISCV_HWPROBE_EXT_ZVKG = 0x100000 + RISCV_HWPROBE_EXT_ZVKNED = 0x200000 + RISCV_HWPROBE_EXT_ZVKNHA = 0x400000 + RISCV_HWPROBE_EXT_ZVKNHB = 0x800000 + RISCV_HWPROBE_EXT_ZVKSED = 0x1000000 + RISCV_HWPROBE_EXT_ZVKSH = 0x2000000 + RISCV_HWPROBE_EXT_ZVKT = 0x4000000 + RISCV_HWPROBE_EXT_ZFH = 0x8000000 + RISCV_HWPROBE_EXT_ZFHMIN = 0x10000000 + RISCV_HWPROBE_EXT_ZIHINTNTL = 0x20000000 + RISCV_HWPROBE_EXT_ZVFH = 0x40000000 + RISCV_HWPROBE_EXT_ZVFHMIN = 0x80000000 + RISCV_HWPROBE_EXT_ZFA = 0x100000000 + RISCV_HWPROBE_EXT_ZTSO = 0x200000000 + RISCV_HWPROBE_EXT_ZACAS = 0x400000000 + RISCV_HWPROBE_EXT_ZICOND = 0x800000000 + RISCV_HWPROBE_EXT_ZIHINTPAUSE = 0x1000000000 RISCV_HWPROBE_KEY_CPUPERF_0 = 0x5 RISCV_HWPROBE_MISALIGNED_UNKNOWN = 0x0 RISCV_HWPROBE_MISALIGNED_EMULATED = 0x1 @@ -734,4 +765,6 @@ const ( RISCV_HWPROBE_MISALIGNED_FAST = 0x3 RISCV_HWPROBE_MISALIGNED_UNSUPPORTED = 0x4 RISCV_HWPROBE_MISALIGNED_MASK = 0x7 + RISCV_HWPROBE_KEY_ZICBOZ_BLOCK_SIZE = 0x6 + RISCV_HWPROBE_WHICH_CPUS = 0x1 ) diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go index 6f7d2ac7..b6e1ab76 100644 --- a/vendor/golang.org/x/sys/windows/security_windows.go +++ b/vendor/golang.org/x/sys/windows/security_windows.go @@ -894,7 +894,7 @@ type ACL struct { aclRevision byte sbz1 byte aclSize uint16 - aceCount uint16 + AceCount uint16 sbz2 uint16 } @@ -1087,6 +1087,27 @@ type EXPLICIT_ACCESS struct { Trustee TRUSTEE } +// https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-ace_header +type ACE_HEADER struct { + AceType uint8 + AceFlags uint8 + AceSize uint16 +} + +// https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-access_allowed_ace +type ACCESS_ALLOWED_ACE struct { + Header ACE_HEADER + Mask ACCESS_MASK + SidStart uint32 +} + +const ( + // Constants for AceType + // https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-ace_header + ACCESS_ALLOWED_ACE_TYPE = 0 + ACCESS_DENIED_ACE_TYPE = 1 +) + // This type is the union inside of TRUSTEE and must be created using one of the TrusteeValueFrom* functions. type TrusteeValue uintptr @@ -1158,6 +1179,7 @@ type OBJECTS_AND_NAME struct { //sys makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) = advapi32.MakeSelfRelativeSD //sys setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) = advapi32.SetEntriesInAclW +//sys GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) = advapi32.GetAce // Control returns the security descriptor control bits. func (sd *SECURITY_DESCRIPTOR) Control() (control SECURITY_DESCRIPTOR_CONTROL, revision uint32, err error) { diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index 6525c62f..5cee9a31 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -17,8 +17,10 @@ import ( "unsafe" ) -type Handle uintptr -type HWND uintptr +type ( + Handle uintptr + HWND uintptr +) const ( InvalidHandle = ^Handle(0) @@ -211,6 +213,10 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) //sys ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) [failretval<=32] = shell32.ShellExecuteW //sys GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) = user32.GetWindowThreadProcessId +//sys LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) [failretval==0] = user32.LoadKeyboardLayoutW +//sys UnloadKeyboardLayout(hkl Handle) (err error) = user32.UnloadKeyboardLayout +//sys GetKeyboardLayout(tid uint32) (hkl Handle) = user32.GetKeyboardLayout +//sys ToUnicodeEx(vkey uint32, scancode uint32, keystate *byte, pwszBuff *uint16, cchBuff int32, flags uint32, hkl Handle) (ret int32) = user32.ToUnicodeEx //sys GetShellWindow() (shellWindow HWND) = user32.GetShellWindow //sys MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) [failretval==0] = user32.MessageBoxW //sys ExitWindowsEx(flags uint32, reason uint32) (err error) = user32.ExitWindowsEx @@ -307,6 +313,10 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode //sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo //sys setConsoleCursorPosition(console Handle, position uint32) (err error) = kernel32.SetConsoleCursorPosition +//sys GetConsoleCP() (cp uint32, err error) = kernel32.GetConsoleCP +//sys GetConsoleOutputCP() (cp uint32, err error) = kernel32.GetConsoleOutputCP +//sys SetConsoleCP(cp uint32) (err error) = kernel32.SetConsoleCP +//sys SetConsoleOutputCP(cp uint32) (err error) = kernel32.SetConsoleOutputCP //sys WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) = kernel32.WriteConsoleW //sys ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) = kernel32.ReadConsoleW //sys resizePseudoConsole(pconsole Handle, size uint32) (hr error) = kernel32.ResizePseudoConsole @@ -1368,9 +1378,11 @@ func SetsockoptLinger(fd Handle, level, opt int, l *Linger) (err error) { func SetsockoptInet4Addr(fd Handle, level, opt int, value [4]byte) (err error) { return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(&value[0])), 4) } + func SetsockoptIPMreq(fd Handle, level, opt int, mreq *IPMreq) (err error) { return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(mreq)), int32(unsafe.Sizeof(*mreq))) } + func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) { return syscall.EWINDOWS } diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index d8cb71db..7b97a154 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -1060,6 +1060,7 @@ const ( SIO_GET_EXTENSION_FUNCTION_POINTER = IOC_INOUT | IOC_WS2 | 6 SIO_KEEPALIVE_VALS = IOC_IN | IOC_VENDOR | 4 SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12 + SIO_UDP_NETRESET = IOC_IN | IOC_VENDOR | 15 // cf. http://support.microsoft.com/default.aspx?scid=kb;en-us;257460 @@ -2003,7 +2004,21 @@ const ( MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x20 ) -const GAA_FLAG_INCLUDE_PREFIX = 0x00000010 +// Flags for GetAdaptersAddresses, see +// https://learn.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-getadaptersaddresses. +const ( + GAA_FLAG_SKIP_UNICAST = 0x1 + GAA_FLAG_SKIP_ANYCAST = 0x2 + GAA_FLAG_SKIP_MULTICAST = 0x4 + GAA_FLAG_SKIP_DNS_SERVER = 0x8 + GAA_FLAG_INCLUDE_PREFIX = 0x10 + GAA_FLAG_SKIP_FRIENDLY_NAME = 0x20 + GAA_FLAG_INCLUDE_WINS_INFO = 0x40 + GAA_FLAG_INCLUDE_GATEWAYS = 0x80 + GAA_FLAG_INCLUDE_ALL_INTERFACES = 0x100 + GAA_FLAG_INCLUDE_ALL_COMPARTMENTS = 0x200 + GAA_FLAG_INCLUDE_TUNNEL_BINDINGORDER = 0x400 +) const ( IF_TYPE_OTHER = 1 @@ -2017,6 +2032,50 @@ const ( IF_TYPE_IEEE1394 = 144 ) +// Enum NL_PREFIX_ORIGIN for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_prefix_origin +const ( + IpPrefixOriginOther = 0 + IpPrefixOriginManual = 1 + IpPrefixOriginWellKnown = 2 + IpPrefixOriginDhcp = 3 + IpPrefixOriginRouterAdvertisement = 4 + IpPrefixOriginUnchanged = 1 << 4 +) + +// Enum NL_SUFFIX_ORIGIN for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_suffix_origin +const ( + NlsoOther = 0 + NlsoManual = 1 + NlsoWellKnown = 2 + NlsoDhcp = 3 + NlsoLinkLayerAddress = 4 + NlsoRandom = 5 + IpSuffixOriginOther = 0 + IpSuffixOriginManual = 1 + IpSuffixOriginWellKnown = 2 + IpSuffixOriginDhcp = 3 + IpSuffixOriginLinkLayerAddress = 4 + IpSuffixOriginRandom = 5 + IpSuffixOriginUnchanged = 1 << 4 +) + +// Enum NL_DAD_STATE for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_dad_state +const ( + NldsInvalid = 0 + NldsTentative = 1 + NldsDuplicate = 2 + NldsDeprecated = 3 + NldsPreferred = 4 + IpDadStateInvalid = 0 + IpDadStateTentative = 1 + IpDadStateDuplicate = 2 + IpDadStateDeprecated = 3 + IpDadStatePreferred = 4 +) + type SocketAddress struct { Sockaddr *syscall.RawSockaddrAny SockaddrLength int32 @@ -3404,3 +3463,14 @@ type DCB struct { EvtChar byte wReserved1 uint16 } + +// Keyboard Layout Flags. +// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadkeyboardlayoutw +const ( + KLF_ACTIVATE = 0x00000001 + KLF_SUBSTITUTE_OK = 0x00000002 + KLF_REORDER = 0x00000008 + KLF_REPLACELANG = 0x00000010 + KLF_NOTELLSHELL = 0x00000080 + KLF_SETFORPROCESS = 0x00000100 +) diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index 9f73df75..4c2e1bdc 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -91,6 +91,7 @@ var ( procEnumServicesStatusExW = modadvapi32.NewProc("EnumServicesStatusExW") procEqualSid = modadvapi32.NewProc("EqualSid") procFreeSid = modadvapi32.NewProc("FreeSid") + procGetAce = modadvapi32.NewProc("GetAce") procGetLengthSid = modadvapi32.NewProc("GetLengthSid") procGetNamedSecurityInfoW = modadvapi32.NewProc("GetNamedSecurityInfoW") procGetSecurityDescriptorControl = modadvapi32.NewProc("GetSecurityDescriptorControl") @@ -246,7 +247,9 @@ var ( procGetCommandLineW = modkernel32.NewProc("GetCommandLineW") procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW") procGetComputerNameW = modkernel32.NewProc("GetComputerNameW") + procGetConsoleCP = modkernel32.NewProc("GetConsoleCP") procGetConsoleMode = modkernel32.NewProc("GetConsoleMode") + procGetConsoleOutputCP = modkernel32.NewProc("GetConsoleOutputCP") procGetConsoleScreenBufferInfo = modkernel32.NewProc("GetConsoleScreenBufferInfo") procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW") procGetCurrentProcessId = modkernel32.NewProc("GetCurrentProcessId") @@ -346,8 +349,10 @@ var ( procSetCommMask = modkernel32.NewProc("SetCommMask") procSetCommState = modkernel32.NewProc("SetCommState") procSetCommTimeouts = modkernel32.NewProc("SetCommTimeouts") + procSetConsoleCP = modkernel32.NewProc("SetConsoleCP") procSetConsoleCursorPosition = modkernel32.NewProc("SetConsoleCursorPosition") procSetConsoleMode = modkernel32.NewProc("SetConsoleMode") + procSetConsoleOutputCP = modkernel32.NewProc("SetConsoleOutputCP") procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW") procSetDefaultDllDirectories = modkernel32.NewProc("SetDefaultDllDirectories") procSetDllDirectoryW = modkernel32.NewProc("SetDllDirectoryW") @@ -477,12 +482,16 @@ var ( procGetDesktopWindow = moduser32.NewProc("GetDesktopWindow") procGetForegroundWindow = moduser32.NewProc("GetForegroundWindow") procGetGUIThreadInfo = moduser32.NewProc("GetGUIThreadInfo") + procGetKeyboardLayout = moduser32.NewProc("GetKeyboardLayout") procGetShellWindow = moduser32.NewProc("GetShellWindow") procGetWindowThreadProcessId = moduser32.NewProc("GetWindowThreadProcessId") procIsWindow = moduser32.NewProc("IsWindow") procIsWindowUnicode = moduser32.NewProc("IsWindowUnicode") procIsWindowVisible = moduser32.NewProc("IsWindowVisible") + procLoadKeyboardLayoutW = moduser32.NewProc("LoadKeyboardLayoutW") procMessageBoxW = moduser32.NewProc("MessageBoxW") + procToUnicodeEx = moduser32.NewProc("ToUnicodeEx") + procUnloadKeyboardLayout = moduser32.NewProc("UnloadKeyboardLayout") procCreateEnvironmentBlock = moduserenv.NewProc("CreateEnvironmentBlock") procDestroyEnvironmentBlock = moduserenv.NewProc("DestroyEnvironmentBlock") procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW") @@ -788,6 +797,14 @@ func FreeSid(sid *SID) (err error) { return } +func GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) { + r1, _, e1 := syscall.Syscall(procGetAce.Addr(), 3, uintptr(unsafe.Pointer(acl)), uintptr(aceIndex), uintptr(unsafe.Pointer(pAce))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func GetLengthSid(sid *SID) (len uint32) { r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) len = uint32(r0) @@ -2149,6 +2166,15 @@ func GetComputerName(buf *uint16, n *uint32) (err error) { return } +func GetConsoleCP() (cp uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetConsoleCP.Addr(), 0, 0, 0, 0) + cp = uint32(r0) + if cp == 0 { + err = errnoErr(e1) + } + return +} + func GetConsoleMode(console Handle, mode *uint32) (err error) { r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0) if r1 == 0 { @@ -2157,6 +2183,15 @@ func GetConsoleMode(console Handle, mode *uint32) (err error) { return } +func GetConsoleOutputCP() (cp uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetConsoleOutputCP.Addr(), 0, 0, 0, 0) + cp = uint32(r0) + if cp == 0 { + err = errnoErr(e1) + } + return +} + func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) { r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0) if r1 == 0 { @@ -3025,6 +3060,14 @@ func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { return } +func SetConsoleCP(cp uint32) (err error) { + r1, _, e1 := syscall.Syscall(procSetConsoleCP.Addr(), 1, uintptr(cp), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func setConsoleCursorPosition(console Handle, position uint32) (err error) { r1, _, e1 := syscall.Syscall(procSetConsoleCursorPosition.Addr(), 2, uintptr(console), uintptr(position), 0) if r1 == 0 { @@ -3041,6 +3084,14 @@ func SetConsoleMode(console Handle, mode uint32) (err error) { return } +func SetConsoleOutputCP(cp uint32) (err error) { + r1, _, e1 := syscall.Syscall(procSetConsoleOutputCP.Addr(), 1, uintptr(cp), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func SetCurrentDirectory(path *uint16) (err error) { r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) if r1 == 0 { @@ -4073,6 +4124,12 @@ func GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) { return } +func GetKeyboardLayout(tid uint32) (hkl Handle) { + r0, _, _ := syscall.Syscall(procGetKeyboardLayout.Addr(), 1, uintptr(tid), 0, 0) + hkl = Handle(r0) + return +} + func GetShellWindow() (shellWindow HWND) { r0, _, _ := syscall.Syscall(procGetShellWindow.Addr(), 0, 0, 0, 0) shellWindow = HWND(r0) @@ -4106,6 +4163,15 @@ func IsWindowVisible(hwnd HWND) (isVisible bool) { return } +func LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) { + r0, _, e1 := syscall.Syscall(procLoadKeyboardLayoutW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(flags), 0) + hkl = Handle(r0) + if hkl == 0 { + err = errnoErr(e1) + } + return +} + func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) { r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0) ret = int32(r0) @@ -4115,6 +4181,20 @@ func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret i return } +func ToUnicodeEx(vkey uint32, scancode uint32, keystate *byte, pwszBuff *uint16, cchBuff int32, flags uint32, hkl Handle) (ret int32) { + r0, _, _ := syscall.Syscall9(procToUnicodeEx.Addr(), 7, uintptr(vkey), uintptr(scancode), uintptr(unsafe.Pointer(keystate)), uintptr(unsafe.Pointer(pwszBuff)), uintptr(cchBuff), uintptr(flags), uintptr(hkl), 0, 0) + ret = int32(r0) + return +} + +func UnloadKeyboardLayout(hkl Handle) (err error) { + r1, _, e1 := syscall.Syscall(procUnloadKeyboardLayout.Addr(), 1, uintptr(hkl), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) { var _p0 uint32 if inheritExisting { diff --git a/vendor/golang.org/x/term/LICENSE b/vendor/golang.org/x/term/LICENSE index 6a66aea5..2a7cf70d 100644 --- a/vendor/golang.org/x/term/LICENSE +++ b/vendor/golang.org/x/term/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/term/term_windows.go b/vendor/golang.org/x/term/term_windows.go index 465f5606..df6bf948 100644 --- a/vendor/golang.org/x/term/term_windows.go +++ b/vendor/golang.org/x/term/term_windows.go @@ -26,6 +26,7 @@ func makeRaw(fd int) (*State, error) { return nil, err } raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT) + raw |= windows.ENABLE_VIRTUAL_TERMINAL_INPUT if err := windows.SetConsoleMode(windows.Handle(fd), raw); err != nil { return nil, err } diff --git a/vendor/golang.org/x/text/LICENSE b/vendor/golang.org/x/text/LICENSE index 6a66aea5..2a7cf70d 100644 --- a/vendor/golang.org/x/text/LICENSE +++ b/vendor/golang.org/x/text/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/time/PATENTS b/vendor/golang.org/x/time/PATENTS deleted file mode 100644 index 73309904..00000000 --- a/vendor/golang.org/x/time/PATENTS +++ /dev/null @@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the Go project. - -Google hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) -patent license to make, have made, use, offer to sell, sell, import, -transfer and otherwise run, modify and propagate the contents of this -implementation of Go, where such license applies only to those patent -claims, both currently owned or controlled by Google and acquired in -the future, licensable by Google that are necessarily infringed by this -implementation of Go. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute or -order or agree to the institution of patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging -that this implementation of Go or any code incorporated within this -implementation of Go constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of Go -shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/time/rate/rate.go b/vendor/golang.org/x/time/rate/rate.go deleted file mode 100644 index 8f6c7f49..00000000 --- a/vendor/golang.org/x/time/rate/rate.go +++ /dev/null @@ -1,430 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package rate provides a rate limiter. -package rate - -import ( - "context" - "fmt" - "math" - "sync" - "time" -) - -// Limit defines the maximum frequency of some events. -// Limit is represented as number of events per second. -// A zero Limit allows no events. -type Limit float64 - -// Inf is the infinite rate limit; it allows all events (even if burst is zero). -const Inf = Limit(math.MaxFloat64) - -// Every converts a minimum time interval between events to a Limit. -func Every(interval time.Duration) Limit { - if interval <= 0 { - return Inf - } - return 1 / Limit(interval.Seconds()) -} - -// A Limiter controls how frequently events are allowed to happen. -// It implements a "token bucket" of size b, initially full and refilled -// at rate r tokens per second. -// Informally, in any large enough time interval, the Limiter limits the -// rate to r tokens per second, with a maximum burst size of b events. -// As a special case, if r == Inf (the infinite rate), b is ignored. -// See https://en.wikipedia.org/wiki/Token_bucket for more about token buckets. -// -// The zero value is a valid Limiter, but it will reject all events. -// Use NewLimiter to create non-zero Limiters. -// -// Limiter has three main methods, Allow, Reserve, and Wait. -// Most callers should use Wait. -// -// Each of the three methods consumes a single token. -// They differ in their behavior when no token is available. -// If no token is available, Allow returns false. -// If no token is available, Reserve returns a reservation for a future token -// and the amount of time the caller must wait before using it. -// If no token is available, Wait blocks until one can be obtained -// or its associated context.Context is canceled. -// -// The methods AllowN, ReserveN, and WaitN consume n tokens. -// -// Limiter is safe for simultaneous use by multiple goroutines. -type Limiter struct { - mu sync.Mutex - limit Limit - burst int - tokens float64 - // last is the last time the limiter's tokens field was updated - last time.Time - // lastEvent is the latest time of a rate-limited event (past or future) - lastEvent time.Time -} - -// Limit returns the maximum overall event rate. -func (lim *Limiter) Limit() Limit { - lim.mu.Lock() - defer lim.mu.Unlock() - return lim.limit -} - -// Burst returns the maximum burst size. Burst is the maximum number of tokens -// that can be consumed in a single call to Allow, Reserve, or Wait, so higher -// Burst values allow more events to happen at once. -// A zero Burst allows no events, unless limit == Inf. -func (lim *Limiter) Burst() int { - lim.mu.Lock() - defer lim.mu.Unlock() - return lim.burst -} - -// TokensAt returns the number of tokens available at time t. -func (lim *Limiter) TokensAt(t time.Time) float64 { - lim.mu.Lock() - _, tokens := lim.advance(t) // does not mutate lim - lim.mu.Unlock() - return tokens -} - -// Tokens returns the number of tokens available now. -func (lim *Limiter) Tokens() float64 { - return lim.TokensAt(time.Now()) -} - -// NewLimiter returns a new Limiter that allows events up to rate r and permits -// bursts of at most b tokens. -func NewLimiter(r Limit, b int) *Limiter { - return &Limiter{ - limit: r, - burst: b, - } -} - -// Allow reports whether an event may happen now. -func (lim *Limiter) Allow() bool { - return lim.AllowN(time.Now(), 1) -} - -// AllowN reports whether n events may happen at time t. -// Use this method if you intend to drop / skip events that exceed the rate limit. -// Otherwise use Reserve or Wait. -func (lim *Limiter) AllowN(t time.Time, n int) bool { - return lim.reserveN(t, n, 0).ok -} - -// A Reservation holds information about events that are permitted by a Limiter to happen after a delay. -// A Reservation may be canceled, which may enable the Limiter to permit additional events. -type Reservation struct { - ok bool - lim *Limiter - tokens int - timeToAct time.Time - // This is the Limit at reservation time, it can change later. - limit Limit -} - -// OK returns whether the limiter can provide the requested number of tokens -// within the maximum wait time. If OK is false, Delay returns InfDuration, and -// Cancel does nothing. -func (r *Reservation) OK() bool { - return r.ok -} - -// Delay is shorthand for DelayFrom(time.Now()). -func (r *Reservation) Delay() time.Duration { - return r.DelayFrom(time.Now()) -} - -// InfDuration is the duration returned by Delay when a Reservation is not OK. -const InfDuration = time.Duration(math.MaxInt64) - -// DelayFrom returns the duration for which the reservation holder must wait -// before taking the reserved action. Zero duration means act immediately. -// InfDuration means the limiter cannot grant the tokens requested in this -// Reservation within the maximum wait time. -func (r *Reservation) DelayFrom(t time.Time) time.Duration { - if !r.ok { - return InfDuration - } - delay := r.timeToAct.Sub(t) - if delay < 0 { - return 0 - } - return delay -} - -// Cancel is shorthand for CancelAt(time.Now()). -func (r *Reservation) Cancel() { - r.CancelAt(time.Now()) -} - -// CancelAt indicates that the reservation holder will not perform the reserved action -// and reverses the effects of this Reservation on the rate limit as much as possible, -// considering that other reservations may have already been made. -func (r *Reservation) CancelAt(t time.Time) { - if !r.ok { - return - } - - r.lim.mu.Lock() - defer r.lim.mu.Unlock() - - if r.lim.limit == Inf || r.tokens == 0 || r.timeToAct.Before(t) { - return - } - - // calculate tokens to restore - // The duration between lim.lastEvent and r.timeToAct tells us how many tokens were reserved - // after r was obtained. These tokens should not be restored. - restoreTokens := float64(r.tokens) - r.limit.tokensFromDuration(r.lim.lastEvent.Sub(r.timeToAct)) - if restoreTokens <= 0 { - return - } - // advance time to now - t, tokens := r.lim.advance(t) - // calculate new number of tokens - tokens += restoreTokens - if burst := float64(r.lim.burst); tokens > burst { - tokens = burst - } - // update state - r.lim.last = t - r.lim.tokens = tokens - if r.timeToAct == r.lim.lastEvent { - prevEvent := r.timeToAct.Add(r.limit.durationFromTokens(float64(-r.tokens))) - if !prevEvent.Before(t) { - r.lim.lastEvent = prevEvent - } - } -} - -// Reserve is shorthand for ReserveN(time.Now(), 1). -func (lim *Limiter) Reserve() *Reservation { - return lim.ReserveN(time.Now(), 1) -} - -// ReserveN returns a Reservation that indicates how long the caller must wait before n events happen. -// The Limiter takes this Reservation into account when allowing future events. -// The returned Reservation’s OK() method returns false if n exceeds the Limiter's burst size. -// Usage example: -// -// r := lim.ReserveN(time.Now(), 1) -// if !r.OK() { -// // Not allowed to act! Did you remember to set lim.burst to be > 0 ? -// return -// } -// time.Sleep(r.Delay()) -// Act() -// -// Use this method if you wish to wait and slow down in accordance with the rate limit without dropping events. -// If you need to respect a deadline or cancel the delay, use Wait instead. -// To drop or skip events exceeding rate limit, use Allow instead. -func (lim *Limiter) ReserveN(t time.Time, n int) *Reservation { - r := lim.reserveN(t, n, InfDuration) - return &r -} - -// Wait is shorthand for WaitN(ctx, 1). -func (lim *Limiter) Wait(ctx context.Context) (err error) { - return lim.WaitN(ctx, 1) -} - -// WaitN blocks until lim permits n events to happen. -// It returns an error if n exceeds the Limiter's burst size, the Context is -// canceled, or the expected wait time exceeds the Context's Deadline. -// The burst limit is ignored if the rate limit is Inf. -func (lim *Limiter) WaitN(ctx context.Context, n int) (err error) { - // The test code calls lim.wait with a fake timer generator. - // This is the real timer generator. - newTimer := func(d time.Duration) (<-chan time.Time, func() bool, func()) { - timer := time.NewTimer(d) - return timer.C, timer.Stop, func() {} - } - - return lim.wait(ctx, n, time.Now(), newTimer) -} - -// wait is the internal implementation of WaitN. -func (lim *Limiter) wait(ctx context.Context, n int, t time.Time, newTimer func(d time.Duration) (<-chan time.Time, func() bool, func())) error { - lim.mu.Lock() - burst := lim.burst - limit := lim.limit - lim.mu.Unlock() - - if n > burst && limit != Inf { - return fmt.Errorf("rate: Wait(n=%d) exceeds limiter's burst %d", n, burst) - } - // Check if ctx is already cancelled - select { - case <-ctx.Done(): - return ctx.Err() - default: - } - // Determine wait limit - waitLimit := InfDuration - if deadline, ok := ctx.Deadline(); ok { - waitLimit = deadline.Sub(t) - } - // Reserve - r := lim.reserveN(t, n, waitLimit) - if !r.ok { - return fmt.Errorf("rate: Wait(n=%d) would exceed context deadline", n) - } - // Wait if necessary - delay := r.DelayFrom(t) - if delay == 0 { - return nil - } - ch, stop, advance := newTimer(delay) - defer stop() - advance() // only has an effect when testing - select { - case <-ch: - // We can proceed. - return nil - case <-ctx.Done(): - // Context was canceled before we could proceed. Cancel the - // reservation, which may permit other events to proceed sooner. - r.Cancel() - return ctx.Err() - } -} - -// SetLimit is shorthand for SetLimitAt(time.Now(), newLimit). -func (lim *Limiter) SetLimit(newLimit Limit) { - lim.SetLimitAt(time.Now(), newLimit) -} - -// SetLimitAt sets a new Limit for the limiter. The new Limit, and Burst, may be violated -// or underutilized by those which reserved (using Reserve or Wait) but did not yet act -// before SetLimitAt was called. -func (lim *Limiter) SetLimitAt(t time.Time, newLimit Limit) { - lim.mu.Lock() - defer lim.mu.Unlock() - - t, tokens := lim.advance(t) - - lim.last = t - lim.tokens = tokens - lim.limit = newLimit -} - -// SetBurst is shorthand for SetBurstAt(time.Now(), newBurst). -func (lim *Limiter) SetBurst(newBurst int) { - lim.SetBurstAt(time.Now(), newBurst) -} - -// SetBurstAt sets a new burst size for the limiter. -func (lim *Limiter) SetBurstAt(t time.Time, newBurst int) { - lim.mu.Lock() - defer lim.mu.Unlock() - - t, tokens := lim.advance(t) - - lim.last = t - lim.tokens = tokens - lim.burst = newBurst -} - -// reserveN is a helper method for AllowN, ReserveN, and WaitN. -// maxFutureReserve specifies the maximum reservation wait duration allowed. -// reserveN returns Reservation, not *Reservation, to avoid allocation in AllowN and WaitN. -func (lim *Limiter) reserveN(t time.Time, n int, maxFutureReserve time.Duration) Reservation { - lim.mu.Lock() - defer lim.mu.Unlock() - - if lim.limit == Inf { - return Reservation{ - ok: true, - lim: lim, - tokens: n, - timeToAct: t, - } - } else if lim.limit == 0 { - var ok bool - if lim.burst >= n { - ok = true - lim.burst -= n - } - return Reservation{ - ok: ok, - lim: lim, - tokens: lim.burst, - timeToAct: t, - } - } - - t, tokens := lim.advance(t) - - // Calculate the remaining number of tokens resulting from the request. - tokens -= float64(n) - - // Calculate the wait duration - var waitDuration time.Duration - if tokens < 0 { - waitDuration = lim.limit.durationFromTokens(-tokens) - } - - // Decide result - ok := n <= lim.burst && waitDuration <= maxFutureReserve - - // Prepare reservation - r := Reservation{ - ok: ok, - lim: lim, - limit: lim.limit, - } - if ok { - r.tokens = n - r.timeToAct = t.Add(waitDuration) - - // Update state - lim.last = t - lim.tokens = tokens - lim.lastEvent = r.timeToAct - } - - return r -} - -// advance calculates and returns an updated state for lim resulting from the passage of time. -// lim is not changed. -// advance requires that lim.mu is held. -func (lim *Limiter) advance(t time.Time) (newT time.Time, newTokens float64) { - last := lim.last - if t.Before(last) { - last = t - } - - // Calculate the new number of tokens, due to time that passed. - elapsed := t.Sub(last) - delta := lim.limit.tokensFromDuration(elapsed) - tokens := lim.tokens + delta - if burst := float64(lim.burst); tokens > burst { - tokens = burst - } - return t, tokens -} - -// durationFromTokens is a unit conversion function from the number of tokens to the duration -// of time it takes to accumulate them at a rate of limit tokens per second. -func (limit Limit) durationFromTokens(tokens float64) time.Duration { - if limit <= 0 { - return InfDuration - } - seconds := tokens / float64(limit) - return time.Duration(float64(time.Second) * seconds) -} - -// tokensFromDuration is a unit conversion function from a time duration to the number of tokens -// which could be accumulated during that duration at a rate of limit tokens per second. -func (limit Limit) tokensFromDuration(d time.Duration) float64 { - if limit <= 0 { - return 0 - } - return d.Seconds() * float64(limit) -} diff --git a/vendor/golang.org/x/time/rate/sometimes.go b/vendor/golang.org/x/time/rate/sometimes.go deleted file mode 100644 index 6ba99ddb..00000000 --- a/vendor/golang.org/x/time/rate/sometimes.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package rate - -import ( - "sync" - "time" -) - -// Sometimes will perform an action occasionally. The First, Every, and -// Interval fields govern the behavior of Do, which performs the action. -// A zero Sometimes value will perform an action exactly once. -// -// # Example: logging with rate limiting -// -// var sometimes = rate.Sometimes{First: 3, Interval: 10*time.Second} -// func Spammy() { -// sometimes.Do(func() { log.Info("here I am!") }) -// } -type Sometimes struct { - First int // if non-zero, the first N calls to Do will run f. - Every int // if non-zero, every Nth call to Do will run f. - Interval time.Duration // if non-zero and Interval has elapsed since f's last run, Do will run f. - - mu sync.Mutex - count int // number of Do calls - last time.Time // last time f was run -} - -// Do runs the function f as allowed by First, Every, and Interval. -// -// The model is a union (not intersection) of filters. The first call to Do -// always runs f. Subsequent calls to Do run f if allowed by First or Every or -// Interval. -// -// A non-zero First:N causes the first N Do(f) calls to run f. -// -// A non-zero Every:M causes every Mth Do(f) call, starting with the first, to -// run f. -// -// A non-zero Interval causes Do(f) to run f if Interval has elapsed since -// Do last ran f. -// -// Specifying multiple filters produces the union of these execution streams. -// For example, specifying both First:N and Every:M causes the first N Do(f) -// calls and every Mth Do(f) call, starting with the first, to run f. See -// Examples for more. -// -// If Do is called multiple times simultaneously, the calls will block and run -// serially. Therefore, Do is intended for lightweight operations. -// -// Because a call to Do may block until f returns, if f causes Do to be called, -// it will deadlock. -func (s *Sometimes) Do(f func()) { - s.mu.Lock() - defer s.mu.Unlock() - if s.count == 0 || - (s.First > 0 && s.count < s.First) || - (s.Every > 0 && s.count%s.Every == 0) || - (s.Interval > 0 && time.Since(s.last) >= s.Interval) { - f() - s.last = time.Now() - } - s.count++ -} diff --git a/vendor/google.golang.org/grpc/MAINTAINERS.md b/vendor/google.golang.org/grpc/MAINTAINERS.md index 6a8a0778..5d4096d4 100644 --- a/vendor/google.golang.org/grpc/MAINTAINERS.md +++ b/vendor/google.golang.org/grpc/MAINTAINERS.md @@ -9,21 +9,28 @@ for general contribution guidelines. ## Maintainers (in alphabetical order) +- [aranjans](https://github.com/aranjans), Google LLC +- [arjan-bal](https://github.com/arjan-bal), Google LLC +- [arvindbr8](https://github.com/arvindbr8), Google LLC - [atollena](https://github.com/atollena), Datadog, Inc. -- [cesarghali](https://github.com/cesarghali), Google LLC - [dfawley](https://github.com/dfawley), Google LLC - [easwars](https://github.com/easwars), Google LLC -- [menghanl](https://github.com/menghanl), Google LLC -- [srini100](https://github.com/srini100), Google LLC +- [erm-g](https://github.com/erm-g), Google LLC +- [gtcooke94](https://github.com/gtcooke94), Google LLC +- [purnesh42h](https://github.com/purnesh42h), Google LLC +- [zasweq](https://github.com/zasweq), Google LLC ## Emeritus Maintainers (in alphabetical order) -- [adelez](https://github.com/adelez), Google LLC -- [canguler](https://github.com/canguler), Google LLC -- [iamqizhao](https://github.com/iamqizhao), Google LLC -- [jadekler](https://github.com/jadekler), Google LLC -- [jtattermusch](https://github.com/jtattermusch), Google LLC -- [lyuxuan](https://github.com/lyuxuan), Google LLC -- [makmukhi](https://github.com/makmukhi), Google LLC -- [matt-kwong](https://github.com/matt-kwong), Google LLC -- [nicolasnoble](https://github.com/nicolasnoble), Google LLC -- [yongni](https://github.com/yongni), Google LLC +- [adelez](https://github.com/adelez) +- [canguler](https://github.com/canguler) +- [cesarghali](https://github.com/cesarghali) +- [iamqizhao](https://github.com/iamqizhao) +- [jeanbza](https://github.com/jeanbza) +- [jtattermusch](https://github.com/jtattermusch) +- [lyuxuan](https://github.com/lyuxuan) +- [makmukhi](https://github.com/makmukhi) +- [matt-kwong](https://github.com/matt-kwong) +- [menghanl](https://github.com/menghanl) +- [nicolasnoble](https://github.com/nicolasnoble) +- [srini100](https://github.com/srini100) +- [yongni](https://github.com/yongni) diff --git a/vendor/google.golang.org/grpc/README.md b/vendor/google.golang.org/grpc/README.md index ab0fbb79..b572707c 100644 --- a/vendor/google.golang.org/grpc/README.md +++ b/vendor/google.golang.org/grpc/README.md @@ -10,7 +10,7 @@ RPC framework that puts mobile and HTTP/2 first. For more information see the ## Prerequisites -- **[Go][]**: any one of the **three latest major** [releases][go-releases]. +- **[Go][]**: any one of the **two latest major** [releases][go-releases]. ## Installation diff --git a/vendor/google.golang.org/grpc/SECURITY.md b/vendor/google.golang.org/grpc/SECURITY.md index be6e1087..abab2793 100644 --- a/vendor/google.golang.org/grpc/SECURITY.md +++ b/vendor/google.golang.org/grpc/SECURITY.md @@ -1,3 +1,3 @@ # Security Policy -For information on gRPC Security Policy and reporting potentional security issues, please see [gRPC CVE Process](https://github.com/grpc/proposal/blob/master/P4-grpc-cve-process.md). +For information on gRPC Security Policy and reporting potential security issues, please see [gRPC CVE Process](https://github.com/grpc/proposal/blob/master/P4-grpc-cve-process.md). diff --git a/vendor/google.golang.org/grpc/backoff/backoff.go b/vendor/google.golang.org/grpc/backoff/backoff.go index 0787d0b5..d7b40b7c 100644 --- a/vendor/google.golang.org/grpc/backoff/backoff.go +++ b/vendor/google.golang.org/grpc/backoff/backoff.go @@ -39,7 +39,7 @@ type Config struct { MaxDelay time.Duration } -// DefaultConfig is a backoff configuration with the default values specfied +// DefaultConfig is a backoff configuration with the default values specified // at https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. // // This should be useful for callers who want to configure backoff with diff --git a/vendor/google.golang.org/grpc/balancer/balancer.go b/vendor/google.golang.org/grpc/balancer/balancer.go index f391744f..b181f386 100644 --- a/vendor/google.golang.org/grpc/balancer/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/balancer.go @@ -30,6 +30,7 @@ import ( "google.golang.org/grpc/channelz" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/credentials" + estats "google.golang.org/grpc/experimental/stats" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal" "google.golang.org/grpc/metadata" @@ -72,8 +73,21 @@ func unregisterForTesting(name string) { delete(m, name) } +// connectedAddress returns the connected address for a SubConnState. The +// address is only valid if the state is READY. +func connectedAddress(scs SubConnState) resolver.Address { + return scs.connectedAddress +} + +// setConnectedAddress sets the connected address for a SubConnState. +func setConnectedAddress(scs *SubConnState, addr resolver.Address) { + scs.connectedAddress = addr +} + func init() { internal.BalancerUnregister = unregisterForTesting + internal.ConnectedAddress = connectedAddress + internal.SetConnectedAddress = setConnectedAddress } // Get returns the resolver builder registered with the given name. @@ -243,6 +257,10 @@ type BuildOptions struct { // same resolver.Target as passed to the resolver. See the documentation for // the resolver.Target type for details about what it contains. Target resolver.Target + // MetricsRecorder is the metrics recorder that balancers can use to record + // metrics. Balancer implementations which do not register metrics on + // metrics registry and record on them can ignore this field. + MetricsRecorder estats.MetricsRecorder } // Builder creates a balancer. @@ -410,6 +428,9 @@ type SubConnState struct { // ConnectionError is set if the ConnectivityState is TransientFailure, // describing the reason the SubConn failed. Otherwise, it is nil. ConnectionError error + // connectedAddr contains the connected address when ConnectivityState is + // Ready. Otherwise, it is indeterminate. + connectedAddress resolver.Address } // ClientConnState describes the state of a ClientConn relevant to the diff --git a/vendor/google.golang.org/grpc/balancer/base/balancer.go b/vendor/google.golang.org/grpc/balancer/base/balancer.go index a7f1eeec..2b87bd79 100644 --- a/vendor/google.golang.org/grpc/balancer/base/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/base/balancer.go @@ -36,7 +36,7 @@ type baseBuilder struct { config Config } -func (bb *baseBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) balancer.Balancer { +func (bb *baseBuilder) Build(cc balancer.ClientConn, _ balancer.BuildOptions) balancer.Balancer { bal := &baseBalancer{ cc: cc, pickerBuilder: bb.pickerBuilder, @@ -259,6 +259,6 @@ type errPicker struct { err error // Pick() always returns this err. } -func (p *errPicker) Pick(info balancer.PickInfo) (balancer.PickResult, error) { +func (p *errPicker) Pick(balancer.PickInfo) (balancer.PickResult, error) { return balancer.PickResult{}, p.err } diff --git a/vendor/google.golang.org/grpc/pickfirst.go b/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go similarity index 87% rename from vendor/google.golang.org/grpc/pickfirst.go rename to vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go index 88536266..4d69b405 100644 --- a/vendor/google.golang.org/grpc/pickfirst.go +++ b/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go @@ -16,38 +16,48 @@ * */ -package grpc +// Package pickfirst contains the pick_first load balancing policy. +package pickfirst import ( "encoding/json" "errors" "fmt" + "math/rand" "google.golang.org/grpc/balancer" "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal" internalgrpclog "google.golang.org/grpc/internal/grpclog" - "google.golang.org/grpc/internal/grpcrand" "google.golang.org/grpc/internal/pretty" "google.golang.org/grpc/resolver" "google.golang.org/grpc/serviceconfig" ) +func init() { + balancer.Register(pickfirstBuilder{}) + internal.ShuffleAddressListForTesting = func(n int, swap func(i, j int)) { rand.Shuffle(n, swap) } +} + +var logger = grpclog.Component("pick-first-lb") + const ( - // PickFirstBalancerName is the name of the pick_first balancer. - PickFirstBalancerName = "pick_first" - logPrefix = "[pick-first-lb %p] " + // Name is the name of the pick_first balancer. + Name = "pick_first" + logPrefix = "[pick-first-lb %p] " ) type pickfirstBuilder struct{} -func (pickfirstBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) balancer.Balancer { +func (pickfirstBuilder) Build(cc balancer.ClientConn, _ balancer.BuildOptions) balancer.Balancer { b := &pickfirstBalancer{cc: cc} b.logger = internalgrpclog.NewPrefixLogger(logger, fmt.Sprintf(logPrefix, b)) return b } func (pickfirstBuilder) Name() string { - return PickFirstBalancerName + return Name } type pfConfig struct { @@ -93,6 +103,12 @@ func (b *pickfirstBalancer) ResolverError(err error) { }) } +type Shuffler interface { + ShuffleAddressListForTesting(n int, swap func(i, j int)) +} + +func ShuffleAddressListForTesting(n int, swap func(i, j int)) { rand.Shuffle(n, swap) } + func (b *pickfirstBalancer) UpdateClientConnState(state balancer.ClientConnState) error { if len(state.ResolverState.Addresses) == 0 && len(state.ResolverState.Endpoints) == 0 { // The resolver reported an empty address list. Treat it like an error by @@ -124,7 +140,7 @@ func (b *pickfirstBalancer) UpdateClientConnState(state balancer.ClientConnState // within each endpoint. - A61 if cfg.ShuffleAddressList { endpoints = append([]resolver.Endpoint{}, endpoints...) - grpcrand.Shuffle(len(endpoints), func(i, j int) { endpoints[i], endpoints[j] = endpoints[j], endpoints[i] }) + internal.ShuffleAddressListForTesting.(func(int, func(int, int)))(len(endpoints), func(i, j int) { endpoints[i], endpoints[j] = endpoints[j], endpoints[i] }) } // "Flatten the list by concatenating the ordered list of addresses for each @@ -139,13 +155,13 @@ func (b *pickfirstBalancer) UpdateClientConnState(state balancer.ClientConnState // Endpoints not set, process addresses until we migrate resolver // emissions fully to Endpoints. The top channel does wrap emitted // addresses with endpoints, however some balancers such as weighted - // target do not forwarrd the corresponding correct endpoints down/split + // target do not forward the corresponding correct endpoints down/split // endpoints properly. Once all balancers correctly forward endpoints // down, can delete this else conditional. addrs = state.ResolverState.Addresses if cfg.ShuffleAddressList { addrs = append([]resolver.Address{}, addrs...) - grpcrand.Shuffle(len(addrs), func(i, j int) { addrs[i], addrs[j] = addrs[j], addrs[i] }) + rand.Shuffle(len(addrs), func(i, j int) { addrs[i], addrs[j] = addrs[j], addrs[i] }) } } diff --git a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go b/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go index f7031ad2..260255d3 100644 --- a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go +++ b/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go @@ -22,12 +22,12 @@ package roundrobin import ( + "math/rand" "sync/atomic" "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/internal/grpcrand" ) // Name is the name of round_robin balancer. @@ -60,7 +60,7 @@ func (*rrPickerBuilder) Build(info base.PickerBuildInfo) balancer.Picker { // Start at a random index, as the same RR balancer rebuilds a new // picker when SubConn states change, and we don't want to apply excess // load to the first server in the list. - next: uint32(grpcrand.Intn(len(scs))), + next: uint32(rand.Intn(len(scs))), } } diff --git a/vendor/google.golang.org/grpc/balancer_wrapper.go b/vendor/google.golang.org/grpc/balancer_wrapper.go index af39b8a4..8ad6ce2f 100644 --- a/vendor/google.golang.org/grpc/balancer_wrapper.go +++ b/vendor/google.golang.org/grpc/balancer_wrapper.go @@ -25,12 +25,15 @@ import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/internal" "google.golang.org/grpc/internal/balancer/gracefulswitch" "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/resolver" ) +var setConnectedAddress = internal.SetConnectedAddress.(func(*balancer.SubConnState, resolver.Address)) + // ccBalancerWrapper sits between the ClientConn and the Balancer. // // ccBalancerWrapper implements methods corresponding to the ones on the @@ -79,6 +82,7 @@ func newCCBalancerWrapper(cc *ClientConn) *ccBalancerWrapper { CustomUserAgent: cc.dopts.copts.UserAgent, ChannelzParent: cc.channelz, Target: cc.parsedTarget, + MetricsRecorder: cc.metricsRecorderList, }, serializer: grpcsync.NewCallbackSerializer(ctx), serializerCancel: cancel, @@ -92,7 +96,7 @@ func newCCBalancerWrapper(cc *ClientConn) *ccBalancerWrapper { // it is safe to call into the balancer here. func (ccb *ccBalancerWrapper) updateClientConnState(ccs *balancer.ClientConnState) error { errCh := make(chan error) - ok := ccb.serializer.Schedule(func(ctx context.Context) { + uccs := func(ctx context.Context) { defer close(errCh) if ctx.Err() != nil || ccb.balancer == nil { return @@ -107,17 +111,23 @@ func (ccb *ccBalancerWrapper) updateClientConnState(ccs *balancer.ClientConnStat logger.Infof("error from balancer.UpdateClientConnState: %v", err) } errCh <- err - }) - if !ok { - return nil } + onFailure := func() { close(errCh) } + + // UpdateClientConnState can race with Close, and when the latter wins, the + // serializer is closed, and the attempt to schedule the callback will fail. + // It is acceptable to ignore this failure. But since we want to handle the + // state update in a blocking fashion (when we successfully schedule the + // callback), we have to use the ScheduleOr method and not the MaybeSchedule + // method on the serializer. + ccb.serializer.ScheduleOr(uccs, onFailure) return <-errCh } // resolverError is invoked by grpc to push a resolver error to the underlying // balancer. The call to the balancer is executed from the serializer. func (ccb *ccBalancerWrapper) resolverError(err error) { - ccb.serializer.Schedule(func(ctx context.Context) { + ccb.serializer.TrySchedule(func(ctx context.Context) { if ctx.Err() != nil || ccb.balancer == nil { return } @@ -133,7 +143,7 @@ func (ccb *ccBalancerWrapper) close() { ccb.closed = true ccb.mu.Unlock() channelz.Info(logger, ccb.cc.channelz, "ccBalancerWrapper: closing") - ccb.serializer.Schedule(func(context.Context) { + ccb.serializer.TrySchedule(func(context.Context) { if ccb.balancer == nil { return } @@ -145,7 +155,7 @@ func (ccb *ccBalancerWrapper) close() { // exitIdle invokes the balancer's exitIdle method in the serializer. func (ccb *ccBalancerWrapper) exitIdle() { - ccb.serializer.Schedule(func(ctx context.Context) { + ccb.serializer.TrySchedule(func(ctx context.Context) { if ctx.Err() != nil || ccb.balancer == nil { return } @@ -182,7 +192,7 @@ func (ccb *ccBalancerWrapper) NewSubConn(addrs []resolver.Address, opts balancer return acbw, nil } -func (ccb *ccBalancerWrapper) RemoveSubConn(sc balancer.SubConn) { +func (ccb *ccBalancerWrapper) RemoveSubConn(balancer.SubConn) { // The graceful switch balancer will never call this. logger.Errorf("ccb RemoveSubConn(%v) called unexpectedly, sc") } @@ -198,6 +208,10 @@ func (ccb *ccBalancerWrapper) UpdateAddresses(sc balancer.SubConn, addrs []resol func (ccb *ccBalancerWrapper) UpdateState(s balancer.State) { ccb.cc.mu.Lock() defer ccb.cc.mu.Unlock() + if ccb.cc.conns == nil { + // The CC has been closed; ignore this update. + return + } ccb.mu.Lock() if ccb.closed { @@ -248,15 +262,29 @@ type acBalancerWrapper struct { // updateState is invoked by grpc to push a subConn state update to the // underlying balancer. -func (acbw *acBalancerWrapper) updateState(s connectivity.State, err error) { - acbw.ccb.serializer.Schedule(func(ctx context.Context) { +func (acbw *acBalancerWrapper) updateState(s connectivity.State, curAddr resolver.Address, err error) { + acbw.ccb.serializer.TrySchedule(func(ctx context.Context) { if ctx.Err() != nil || acbw.ccb.balancer == nil { return } // Even though it is optional for balancers, gracefulswitch ensures // opts.StateListener is set, so this cannot ever be nil. // TODO: delete this comment when UpdateSubConnState is removed. - acbw.stateListener(balancer.SubConnState{ConnectivityState: s, ConnectionError: err}) + scs := balancer.SubConnState{ConnectivityState: s, ConnectionError: err} + if s == connectivity.Ready { + setConnectedAddress(&scs, curAddr) + } + acbw.stateListener(scs) + acbw.ac.mu.Lock() + defer acbw.ac.mu.Unlock() + if s == connectivity.Ready { + // When changing states to READY, reset stateReadyChan. Wait until + // after we notify the LB policy's listener(s) in order to prevent + // ac.getTransport() from unblocking before the LB policy starts + // tracking the subchannel as READY. + close(acbw.ac.stateReadyChan) + acbw.ac.stateReadyChan = make(chan struct{}) + } }) } @@ -314,8 +342,8 @@ func (acbw *acBalancerWrapper) GetOrBuildProducer(pb balancer.ProducerBuilder) ( pData := acbw.producers[pb] if pData == nil { // Not found; create a new one and add it to the producers map. - p, close := pb.Build(acbw) - pData = &refCountedProducer{producer: p, close: close} + p, closeFn := pb.Build(acbw) + pData = &refCountedProducer{producer: p, close: closeFn} acbw.producers[pb] = pData } // Account for this new reference. diff --git a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go index 1afb1e84..55bffaa7 100644 --- a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go +++ b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go @@ -18,8 +18,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v4.25.2 +// protoc-gen-go v1.34.2 +// protoc v5.27.1 // source: grpc/binlog/v1/binarylog.proto package grpc_binarylog_v1 @@ -1015,7 +1015,7 @@ func file_grpc_binlog_v1_binarylog_proto_rawDescGZIP() []byte { var file_grpc_binlog_v1_binarylog_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_grpc_binlog_v1_binarylog_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_grpc_binlog_v1_binarylog_proto_goTypes = []interface{}{ +var file_grpc_binlog_v1_binarylog_proto_goTypes = []any{ (GrpcLogEntry_EventType)(0), // 0: grpc.binarylog.v1.GrpcLogEntry.EventType (GrpcLogEntry_Logger)(0), // 1: grpc.binarylog.v1.GrpcLogEntry.Logger (Address_Type)(0), // 2: grpc.binarylog.v1.Address.Type @@ -1058,7 +1058,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_grpc_binlog_v1_binarylog_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_grpc_binlog_v1_binarylog_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*GrpcLogEntry); i { case 0: return &v.state @@ -1070,7 +1070,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { return nil } } - file_grpc_binlog_v1_binarylog_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_grpc_binlog_v1_binarylog_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*ClientHeader); i { case 0: return &v.state @@ -1082,7 +1082,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { return nil } } - file_grpc_binlog_v1_binarylog_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_grpc_binlog_v1_binarylog_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*ServerHeader); i { case 0: return &v.state @@ -1094,7 +1094,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { return nil } } - file_grpc_binlog_v1_binarylog_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_grpc_binlog_v1_binarylog_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*Trailer); i { case 0: return &v.state @@ -1106,7 +1106,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { return nil } } - file_grpc_binlog_v1_binarylog_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_grpc_binlog_v1_binarylog_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*Message); i { case 0: return &v.state @@ -1118,7 +1118,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { return nil } } - file_grpc_binlog_v1_binarylog_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_grpc_binlog_v1_binarylog_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*Metadata); i { case 0: return &v.state @@ -1130,7 +1130,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { return nil } } - file_grpc_binlog_v1_binarylog_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_grpc_binlog_v1_binarylog_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*MetadataEntry); i { case 0: return &v.state @@ -1142,7 +1142,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { return nil } } - file_grpc_binlog_v1_binarylog_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_grpc_binlog_v1_binarylog_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*Address); i { case 0: return &v.state @@ -1155,7 +1155,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { } } } - file_grpc_binlog_v1_binarylog_proto_msgTypes[0].OneofWrappers = []interface{}{ + file_grpc_binlog_v1_binarylog_proto_msgTypes[0].OneofWrappers = []any{ (*GrpcLogEntry_ClientHeader)(nil), (*GrpcLogEntry_ServerHeader)(nil), (*GrpcLogEntry_Message)(nil), diff --git a/vendor/google.golang.org/grpc/clientconn.go b/vendor/google.golang.org/grpc/clientconn.go index 2359f94b..9c8850e3 100644 --- a/vendor/google.golang.org/grpc/clientconn.go +++ b/vendor/google.golang.org/grpc/clientconn.go @@ -24,6 +24,7 @@ import ( "fmt" "math" "net/url" + "slices" "strings" "sync" "sync/atomic" @@ -31,6 +32,7 @@ import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" + "google.golang.org/grpc/balancer/pickfirst" "google.golang.org/grpc/codes" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/internal" @@ -38,6 +40,7 @@ import ( "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/internal/idle" iresolver "google.golang.org/grpc/internal/resolver" + "google.golang.org/grpc/internal/stats" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/resolver" @@ -72,6 +75,8 @@ var ( // invalidDefaultServiceConfigErrPrefix is used to prefix the json parsing error for the default // service config. invalidDefaultServiceConfigErrPrefix = "grpc: the provided default service config is invalid" + // PickFirstBalancerName is the name of the pick_first balancer. + PickFirstBalancerName = pickfirst.Name ) // The following errors are returned from Dial and DialContext @@ -152,6 +157,16 @@ func NewClient(target string, opts ...DialOption) (conn *ClientConn, err error) for _, opt := range opts { opt.apply(&cc.dopts) } + + // Determine the resolver to use. + if err := cc.initParsedTargetAndResolverBuilder(); err != nil { + return nil, err + } + + for _, opt := range globalPerTargetDialOptions { + opt.DialOptionForTarget(cc.parsedTarget.URL).apply(&cc.dopts) + } + chainUnaryClientInterceptors(cc) chainStreamClientInterceptors(cc) @@ -160,7 +175,7 @@ func NewClient(target string, opts ...DialOption) (conn *ClientConn, err error) } if cc.dopts.defaultServiceConfigRawJSON != nil { - scpr := parseServiceConfig(*cc.dopts.defaultServiceConfigRawJSON) + scpr := parseServiceConfig(*cc.dopts.defaultServiceConfigRawJSON, cc.dopts.maxCallAttempts) if scpr.Err != nil { return nil, fmt.Errorf("%s: %v", invalidDefaultServiceConfigErrPrefix, scpr.Err) } @@ -168,30 +183,24 @@ func NewClient(target string, opts ...DialOption) (conn *ClientConn, err error) } cc.mkp = cc.dopts.copts.KeepaliveParams - // Register ClientConn with channelz. + if err = cc.initAuthority(); err != nil { + return nil, err + } + + // Register ClientConn with channelz. Note that this is only done after + // channel creation cannot fail. cc.channelzRegistration(target) - - // TODO: Ideally it should be impossible to error from this function after - // channelz registration. This will require removing some channelz logs - // from the following functions that can error. Errors can be returned to - // the user, and successful logs can be emitted here, after the checks have - // passed and channelz is subsequently registered. - - // Determine the resolver to use. - if err := cc.parseTargetAndFindResolver(); err != nil { - channelz.RemoveEntry(cc.channelz.ID) - return nil, err - } - if err = cc.determineAuthority(); err != nil { - channelz.RemoveEntry(cc.channelz.ID) - return nil, err - } + channelz.Infof(logger, cc.channelz, "parsed dial target is: %#v", cc.parsedTarget) + channelz.Infof(logger, cc.channelz, "Channel authority set to %q", cc.authority) cc.csMgr = newConnectivityStateManager(cc.ctx, cc.channelz) cc.pickerWrapper = newPickerWrapper(cc.dopts.copts.StatsHandlers) + cc.metricsRecorderList = stats.NewMetricsRecorderList(cc.dopts.copts.StatsHandlers) + cc.initIdleStateLocked() // Safe to call without the lock, since nothing else has a reference to cc. cc.idlenessMgr = idle.NewManager((*idler)(cc), cc.dopts.idleTimeout) + return cc, nil } @@ -586,13 +595,14 @@ type ClientConn struct { cancel context.CancelFunc // Cancelled on close. // The following are initialized at dial time, and are read-only after that. - target string // User's dial target. - parsedTarget resolver.Target // See parseTargetAndFindResolver(). - authority string // See determineAuthority(). - dopts dialOptions // Default and user specified dial options. - channelz *channelz.Channel // Channelz object. - resolverBuilder resolver.Builder // See parseTargetAndFindResolver(). - idlenessMgr *idle.Manager + target string // User's dial target. + parsedTarget resolver.Target // See initParsedTargetAndResolverBuilder(). + authority string // See initAuthority(). + dopts dialOptions // Default and user specified dial options. + channelz *channelz.Channel // Channelz object. + resolverBuilder resolver.Builder // See initParsedTargetAndResolverBuilder(). + idlenessMgr *idle.Manager + metricsRecorderList *stats.MetricsRecorderList // The following provide their own synchronization, and therefore don't // require cc.mu to be held to access them. @@ -622,11 +632,6 @@ type ClientConn struct { // WaitForStateChange waits until the connectivity.State of ClientConn changes from sourceState or // ctx expires. A true value is returned in former case and false in latter. -// -// # Experimental -// -// Notice: This API is EXPERIMENTAL and may be changed or removed in a -// later release. func (cc *ClientConn) WaitForStateChange(ctx context.Context, sourceState connectivity.State) bool { ch := cc.csMgr.getNotifyChan() if cc.csMgr.getState() != sourceState { @@ -641,11 +646,6 @@ func (cc *ClientConn) WaitForStateChange(ctx context.Context, sourceState connec } // GetState returns the connectivity.State of ClientConn. -// -// # Experimental -// -// Notice: This API is EXPERIMENTAL and may be changed or removed in a later -// release. func (cc *ClientConn) GetState() connectivity.State { return cc.csMgr.getState() } @@ -692,8 +692,7 @@ func (cc *ClientConn) waitForResolvedAddrs(ctx context.Context) error { var emptyServiceConfig *ServiceConfig func init() { - balancer.Register(pickfirstBuilder{}) - cfg := parseServiceConfig("{}") + cfg := parseServiceConfig("{}", defaultMaxCallAttempts) if cfg.Err != nil { panic(fmt.Sprintf("impossible error parsing empty service config: %v", cfg.Err)) } @@ -809,17 +808,11 @@ func (cc *ClientConn) applyFailingLBLocked(sc *serviceconfig.ParseResult) { cc.csMgr.updateState(connectivity.TransientFailure) } -// Makes a copy of the input addresses slice and clears out the balancer -// attributes field. Addresses are passed during subconn creation and address -// update operations. In both cases, we will clear the balancer attributes by -// calling this function, and therefore we will be able to use the Equal method -// provided by the resolver.Address type for comparison. -func copyAddressesWithoutBalancerAttributes(in []resolver.Address) []resolver.Address { +// Makes a copy of the input addresses slice. Addresses are passed during +// subconn creation and address update operations. +func copyAddresses(in []resolver.Address) []resolver.Address { out := make([]resolver.Address, len(in)) - for i := range in { - out[i] = in[i] - out[i].BalancerAttributes = nil - } + copy(out, in) return out } @@ -832,14 +825,14 @@ func (cc *ClientConn) newAddrConnLocked(addrs []resolver.Address, opts balancer. } ac := &addrConn{ - state: connectivity.Idle, - cc: cc, - addrs: copyAddressesWithoutBalancerAttributes(addrs), - scopts: opts, - dopts: cc.dopts, - channelz: channelz.RegisterSubChannel(cc.channelz, ""), - resetBackoff: make(chan struct{}), - stateChan: make(chan struct{}), + state: connectivity.Idle, + cc: cc, + addrs: copyAddresses(addrs), + scopts: opts, + dopts: cc.dopts, + channelz: channelz.RegisterSubChannel(cc.channelz, ""), + resetBackoff: make(chan struct{}), + stateReadyChan: make(chan struct{}), } ac.ctx, ac.cancel = context.WithCancel(cc.ctx) // Start with our address set to the first address; this may be updated if @@ -915,28 +908,29 @@ func (ac *addrConn) connect() error { ac.mu.Unlock() return nil } - ac.mu.Unlock() - ac.resetTransport() + ac.resetTransportAndUnlock() return nil } -func equalAddresses(a, b []resolver.Address) bool { - if len(a) != len(b) { - return false - } - for i, v := range a { - if !v.Equal(b[i]) { - return false - } - } - return true +// equalAddressIgnoringBalAttributes returns true is a and b are considered equal. +// This is different from the Equal method on the resolver.Address type which +// considers all fields to determine equality. Here, we only consider fields +// that are meaningful to the subConn. +func equalAddressIgnoringBalAttributes(a, b *resolver.Address) bool { + return a.Addr == b.Addr && a.ServerName == b.ServerName && + a.Attributes.Equal(b.Attributes) && + a.Metadata == b.Metadata +} + +func equalAddressesIgnoringBalAttributes(a, b []resolver.Address) bool { + return slices.EqualFunc(a, b, func(a, b resolver.Address) bool { return equalAddressIgnoringBalAttributes(&a, &b) }) } // updateAddrs updates ac.addrs with the new addresses list and handles active // connections or connection attempts. func (ac *addrConn) updateAddrs(addrs []resolver.Address) { - addrs = copyAddressesWithoutBalancerAttributes(addrs) + addrs = copyAddresses(addrs) limit := len(addrs) if limit > 5 { limit = 5 @@ -944,7 +938,7 @@ func (ac *addrConn) updateAddrs(addrs []resolver.Address) { channelz.Infof(logger, ac.channelz, "addrConn: updateAddrs addrs (%d of %d): %v", limit, len(addrs), addrs[:limit]) ac.mu.Lock() - if equalAddresses(ac.addrs, addrs) { + if equalAddressesIgnoringBalAttributes(ac.addrs, addrs) { ac.mu.Unlock() return } @@ -963,7 +957,7 @@ func (ac *addrConn) updateAddrs(addrs []resolver.Address) { // Try to find the connected address. for _, a := range addrs { a.ServerName = ac.cc.getServerName(a) - if a.Equal(ac.curAddr) { + if equalAddressIgnoringBalAttributes(&a, &ac.curAddr) { // We are connected to a valid address, so do nothing but // update the addresses. ac.mu.Unlock() @@ -989,11 +983,9 @@ func (ac *addrConn) updateAddrs(addrs []resolver.Address) { ac.updateConnectivityState(connectivity.Idle, nil) } - ac.mu.Unlock() - // Since we were connecting/connected, we should start a new connection // attempt. - go ac.resetTransport() + go ac.resetTransportAndUnlock() } // getServerName determines the serverName to be used in the connection @@ -1187,8 +1179,8 @@ type addrConn struct { addrs []resolver.Address // All addresses that the resolver resolved to. // Use updateConnectivityState for updating addrConn's connectivity state. - state connectivity.State - stateChan chan struct{} // closed and recreated on every state change. + state connectivity.State + stateReadyChan chan struct{} // closed and recreated on every READY state change. backoffIdx int // Needs to be stateful for resetConnectBackoff. resetBackoff chan struct{} @@ -1201,9 +1193,6 @@ func (ac *addrConn) updateConnectivityState(s connectivity.State, lastErr error) if ac.state == s { return } - // When changing states, reset the state change channel. - close(ac.stateChan) - ac.stateChan = make(chan struct{}) ac.state = s ac.channelz.ChannelMetrics.State.Store(&s) if lastErr == nil { @@ -1211,7 +1200,7 @@ func (ac *addrConn) updateConnectivityState(s connectivity.State, lastErr error) } else { channelz.Infof(logger, ac.channelz, "Subchannel Connectivity change to %v, last error: %s", s, lastErr) } - ac.acbw.updateState(s, lastErr) + ac.acbw.updateState(s, ac.curAddr, lastErr) } // adjustParams updates parameters used to create transports upon @@ -1228,8 +1217,10 @@ func (ac *addrConn) adjustParams(r transport.GoAwayReason) { } } -func (ac *addrConn) resetTransport() { - ac.mu.Lock() +// resetTransportAndUnlock unconditionally connects the addrConn. +// +// ac.mu must be held by the caller, and this function will guarantee it is released. +func (ac *addrConn) resetTransportAndUnlock() { acCtx := ac.ctx if acCtx.Err() != nil { ac.mu.Unlock() @@ -1519,7 +1510,7 @@ func (ac *addrConn) getReadyTransport() transport.ClientTransport { func (ac *addrConn) getTransport(ctx context.Context) (transport.ClientTransport, error) { for ctx.Err() == nil { ac.mu.Lock() - t, state, sc := ac.transport, ac.state, ac.stateChan + t, state, sc := ac.transport, ac.state, ac.stateReadyChan ac.mu.Unlock() if state == connectivity.Ready { return t, nil @@ -1582,7 +1573,7 @@ func (ac *addrConn) tearDown(err error) { } else { // Hard close the transport when the channel is entering idle or is // being shutdown. In the case where the channel is being shutdown, - // closing of transports is also taken care of by cancelation of cc.ctx. + // closing of transports is also taken care of by cancellation of cc.ctx. // But in the case where the channel is entering idle, we need to // explicitly close the transports here. Instead of distinguishing // between these two cases, it is simpler to close the transport @@ -1673,22 +1664,19 @@ func (cc *ClientConn) connectionError() error { return cc.lastConnectionError } -// parseTargetAndFindResolver parses the user's dial target and stores the -// parsed target in `cc.parsedTarget`. +// initParsedTargetAndResolverBuilder parses the user's dial target and stores +// the parsed target in `cc.parsedTarget`. // // The resolver to use is determined based on the scheme in the parsed target // and the same is stored in `cc.resolverBuilder`. // // Doesn't grab cc.mu as this method is expected to be called only at Dial time. -func (cc *ClientConn) parseTargetAndFindResolver() error { - channelz.Infof(logger, cc.channelz, "original dial target is: %q", cc.target) +func (cc *ClientConn) initParsedTargetAndResolverBuilder() error { + logger.Infof("original dial target is: %q", cc.target) var rb resolver.Builder parsedTarget, err := parseTarget(cc.target) - if err != nil { - channelz.Infof(logger, cc.channelz, "dial target %q parse failed: %v", cc.target, err) - } else { - channelz.Infof(logger, cc.channelz, "parsed dial target is: %#v", parsedTarget) + if err == nil { rb = cc.getResolver(parsedTarget.URL.Scheme) if rb != nil { cc.parsedTarget = parsedTarget @@ -1707,15 +1695,12 @@ func (cc *ClientConn) parseTargetAndFindResolver() error { defScheme = resolver.GetDefaultScheme() } - channelz.Infof(logger, cc.channelz, "fallback to scheme %q", defScheme) canonicalTarget := defScheme + ":///" + cc.target parsedTarget, err = parseTarget(canonicalTarget) if err != nil { - channelz.Infof(logger, cc.channelz, "dial target %q parse failed: %v", canonicalTarget, err) return err } - channelz.Infof(logger, cc.channelz, "parsed dial target is: %+v", parsedTarget) rb = cc.getResolver(parsedTarget.URL.Scheme) if rb == nil { return fmt.Errorf("could not get resolver for default scheme: %q", parsedTarget.URL.Scheme) @@ -1805,7 +1790,7 @@ func encodeAuthority(authority string) string { // credentials do not match the authority configured through the dial option. // // Doesn't grab cc.mu as this method is expected to be called only at Dial time. -func (cc *ClientConn) determineAuthority() error { +func (cc *ClientConn) initAuthority() error { dopts := cc.dopts // Historically, we had two options for users to specify the serverName or // authority for a channel. One was through the transport credentials @@ -1838,6 +1823,5 @@ func (cc *ClientConn) determineAuthority() error { } else { cc.authority = encodeAuthority(endpoint) } - channelz.Infof(logger, cc.channelz, "Channel authority set to %q", cc.authority) return nil } diff --git a/vendor/google.golang.org/grpc/codec.go b/vendor/google.golang.org/grpc/codec.go index 411e3dfd..e840858b 100644 --- a/vendor/google.golang.org/grpc/codec.go +++ b/vendor/google.golang.org/grpc/codec.go @@ -21,18 +21,73 @@ package grpc import ( "google.golang.org/grpc/encoding" _ "google.golang.org/grpc/encoding/proto" // to register the Codec for "proto" + "google.golang.org/grpc/mem" ) -// baseCodec contains the functionality of both Codec and encoding.Codec, but -// omits the name/string, which vary between the two and are not needed for -// anything besides the registry in the encoding package. +// baseCodec captures the new encoding.CodecV2 interface without the Name +// function, allowing it to be implemented by older Codec and encoding.Codec +// implementations. The omitted Name function is only needed for the register in +// the encoding package and is not part of the core functionality. type baseCodec interface { - Marshal(v any) ([]byte, error) - Unmarshal(data []byte, v any) error + Marshal(v any) (mem.BufferSlice, error) + Unmarshal(data mem.BufferSlice, v any) error } -var _ baseCodec = Codec(nil) -var _ baseCodec = encoding.Codec(nil) +// getCodec returns an encoding.CodecV2 for the codec of the given name (if +// registered). Initially checks the V2 registry with encoding.GetCodecV2 and +// returns the V2 codec if it is registered. Otherwise, it checks the V1 registry +// with encoding.GetCodec and if it is registered wraps it with newCodecV1Bridge +// to turn it into an encoding.CodecV2. Returns nil otherwise. +func getCodec(name string) encoding.CodecV2 { + if codecV1 := encoding.GetCodec(name); codecV1 != nil { + return newCodecV1Bridge(codecV1) + } + + return encoding.GetCodecV2(name) +} + +func newCodecV0Bridge(c Codec) baseCodec { + return codecV0Bridge{codec: c} +} + +func newCodecV1Bridge(c encoding.Codec) encoding.CodecV2 { + return codecV1Bridge{ + codecV0Bridge: codecV0Bridge{codec: c}, + name: c.Name(), + } +} + +var _ baseCodec = codecV0Bridge{} + +type codecV0Bridge struct { + codec interface { + Marshal(v any) ([]byte, error) + Unmarshal(data []byte, v any) error + } +} + +func (c codecV0Bridge) Marshal(v any) (mem.BufferSlice, error) { + data, err := c.codec.Marshal(v) + if err != nil { + return nil, err + } + return mem.BufferSlice{mem.NewBuffer(&data, nil)}, nil +} + +func (c codecV0Bridge) Unmarshal(data mem.BufferSlice, v any) (err error) { + return c.codec.Unmarshal(data.Materialize(), v) +} + +var _ encoding.CodecV2 = codecV1Bridge{} + +type codecV1Bridge struct { + codecV0Bridge + name string +} + +func (c codecV1Bridge) Name() string { + return c.name +} // Codec defines the interface gRPC uses to encode and decode messages. // Note that implementations of this interface must be thread safe; diff --git a/vendor/google.golang.org/grpc/credentials/insecure/insecure.go b/vendor/google.golang.org/grpc/credentials/insecure/insecure.go index 82bee144..4c805c64 100644 --- a/vendor/google.golang.org/grpc/credentials/insecure/insecure.go +++ b/vendor/google.golang.org/grpc/credentials/insecure/insecure.go @@ -40,7 +40,7 @@ func NewCredentials() credentials.TransportCredentials { // NoSecurity. type insecureTC struct{} -func (insecureTC) ClientHandshake(ctx context.Context, _ string, conn net.Conn) (net.Conn, credentials.AuthInfo, error) { +func (insecureTC) ClientHandshake(_ context.Context, _ string, conn net.Conn) (net.Conn, credentials.AuthInfo, error) { return conn, info{credentials.CommonAuthInfo{SecurityLevel: credentials.NoSecurity}}, nil } diff --git a/vendor/google.golang.org/grpc/credentials/tls.go b/vendor/google.golang.org/grpc/credentials/tls.go index 5dafd34e..41143585 100644 --- a/vendor/google.golang.org/grpc/credentials/tls.go +++ b/vendor/google.golang.org/grpc/credentials/tls.go @@ -27,9 +27,13 @@ import ( "net/url" "os" + "google.golang.org/grpc/grpclog" credinternal "google.golang.org/grpc/internal/credentials" + "google.golang.org/grpc/internal/envconfig" ) +var logger = grpclog.Component("credentials") + // TLSInfo contains the auth information for a TLS authenticated connection. // It implements the AuthInfo interface. type TLSInfo struct { @@ -112,6 +116,22 @@ func (c *tlsCreds) ClientHandshake(ctx context.Context, authority string, rawCon conn.Close() return nil, nil, ctx.Err() } + + // The negotiated protocol can be either of the following: + // 1. h2: When the server supports ALPN. Only HTTP/2 can be negotiated since + // it is the only protocol advertised by the client during the handshake. + // The tls library ensures that the server chooses a protocol advertised + // by the client. + // 2. "" (empty string): If the server doesn't support ALPN. ALPN is a requirement + // for using HTTP/2 over TLS. We can terminate the connection immediately. + np := conn.ConnectionState().NegotiatedProtocol + if np == "" { + if envconfig.EnforceALPNEnabled { + conn.Close() + return nil, nil, fmt.Errorf("credentials: cannot check peer: missing selected ALPN property") + } + logger.Warningf("Allowing TLS connection to server %q with ALPN disabled. TLS connections to servers with ALPN disabled will be disallowed in future grpc-go releases", cfg.ServerName) + } tlsInfo := TLSInfo{ State: conn.ConnectionState(), CommonAuthInfo: CommonAuthInfo{ @@ -131,8 +151,20 @@ func (c *tlsCreds) ServerHandshake(rawConn net.Conn) (net.Conn, AuthInfo, error) conn.Close() return nil, nil, err } + cs := conn.ConnectionState() + // The negotiated application protocol can be empty only if the client doesn't + // support ALPN. In such cases, we can close the connection since ALPN is required + // for using HTTP/2 over TLS. + if cs.NegotiatedProtocol == "" { + if envconfig.EnforceALPNEnabled { + conn.Close() + return nil, nil, fmt.Errorf("credentials: cannot check peer: missing selected ALPN property") + } else if logger.V(2) { + logger.Info("Allowing TLS connection from client with ALPN disabled. TLS connections with ALPN disabled will be disallowed in future grpc-go releases") + } + } tlsInfo := TLSInfo{ - State: conn.ConnectionState(), + State: cs, CommonAuthInfo: CommonAuthInfo{ SecurityLevel: PrivacyAndIntegrity, }, diff --git a/vendor/google.golang.org/grpc/dialoptions.go b/vendor/google.golang.org/grpc/dialoptions.go index 00273702..2b285bee 100644 --- a/vendor/google.golang.org/grpc/dialoptions.go +++ b/vendor/google.golang.org/grpc/dialoptions.go @@ -21,6 +21,7 @@ package grpc import ( "context" "net" + "net/url" "time" "google.golang.org/grpc/backoff" @@ -32,10 +33,16 @@ import ( "google.golang.org/grpc/internal/binarylog" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" + "google.golang.org/grpc/mem" "google.golang.org/grpc/resolver" "google.golang.org/grpc/stats" ) +const ( + // https://github.com/grpc/proposal/blob/master/A6-client-retries.md#limits-on-retries-and-hedges + defaultMaxCallAttempts = 5 +) + func init() { internal.AddGlobalDialOptions = func(opt ...DialOption) { globalDialOptions = append(globalDialOptions, opt...) @@ -43,10 +50,18 @@ func init() { internal.ClearGlobalDialOptions = func() { globalDialOptions = nil } + internal.AddGlobalPerTargetDialOptions = func(opt any) { + if ptdo, ok := opt.(perTargetDialOption); ok { + globalPerTargetDialOptions = append(globalPerTargetDialOptions, ptdo) + } + } + internal.ClearGlobalPerTargetDialOptions = func() { + globalPerTargetDialOptions = nil + } internal.WithBinaryLogger = withBinaryLogger internal.JoinDialOptions = newJoinDialOption internal.DisableGlobalDialOptions = newDisableGlobalDialOptions - internal.WithRecvBufferPool = withRecvBufferPool + internal.WithBufferPool = withBufferPool } // dialOptions configure a Dial call. dialOptions are set by the DialOption @@ -78,8 +93,8 @@ type dialOptions struct { defaultServiceConfigRawJSON *string resolvers []resolver.Builder idleTimeout time.Duration - recvBufferPool SharedBufferPool defaultScheme string + maxCallAttempts int } // DialOption configures how we set up the connection. @@ -89,6 +104,19 @@ type DialOption interface { var globalDialOptions []DialOption +// perTargetDialOption takes a parsed target and returns a dial option to apply. +// +// This gets called after NewClient() parses the target, and allows per target +// configuration set through a returned DialOption. The DialOption will not take +// effect if specifies a resolver builder, as that Dial Option is factored in +// while parsing target. +type perTargetDialOption interface { + // DialOption returns a Dial Option to apply. + DialOptionForTarget(parsedTarget url.URL) DialOption +} + +var globalPerTargetDialOptions []perTargetDialOption + // EmptyDialOption does not alter the dial configuration. It can be embedded in // another structure to build custom dial options. // @@ -490,6 +518,8 @@ func WithUserAgent(s string) DialOption { // WithKeepaliveParams returns a DialOption that specifies keepalive parameters // for the client transport. +// +// Keepalive is disabled by default. func WithKeepaliveParams(kp keepalive.ClientParameters) DialOption { if kp.Time < internal.KeepaliveMinPingTime { logger.Warningf("Adjusting keepalive ping interval to minimum period of %v", internal.KeepaliveMinPingTime) @@ -649,12 +679,13 @@ func defaultDialOptions() dialOptions { WriteBufferSize: defaultWriteBufSize, UseProxy: true, UserAgent: grpcUA, + BufferPool: mem.DefaultBufferPool(), }, bs: internalbackoff.DefaultExponential, healthCheckFunc: internal.HealthCheckFunc, idleTimeout: 30 * time.Minute, - recvBufferPool: nopBufferPool{}, defaultScheme: "dns", + maxCallAttempts: defaultMaxCallAttempts, } } @@ -712,25 +743,25 @@ func WithIdleTimeout(d time.Duration) DialOption { }) } -// WithRecvBufferPool returns a DialOption that configures the ClientConn -// to use the provided shared buffer pool for parsing incoming messages. Depending -// on the application's workload, this could result in reduced memory allocation. +// WithMaxCallAttempts returns a DialOption that configures the maximum number +// of attempts per call (including retries and hedging) using the channel. +// Service owners may specify a higher value for these parameters, but higher +// values will be treated as equal to the maximum value by the client +// implementation. This mitigates security concerns related to the service +// config being transferred to the client via DNS. // -// If you are unsure about how to implement a memory pool but want to utilize one, -// begin with grpc.NewSharedBufferPool. -// -// Note: The shared buffer pool feature will not be active if any of the following -// options are used: WithStatsHandler, EnableTracing, or binary logging. In such -// cases, the shared buffer pool will be ignored. -// -// Deprecated: use experimental.WithRecvBufferPool instead. Will be deleted in -// v1.60.0 or later. -func WithRecvBufferPool(bufferPool SharedBufferPool) DialOption { - return withRecvBufferPool(bufferPool) -} - -func withRecvBufferPool(bufferPool SharedBufferPool) DialOption { +// A value of 5 will be used if this dial option is not set or n < 2. +func WithMaxCallAttempts(n int) DialOption { return newFuncDialOption(func(o *dialOptions) { - o.recvBufferPool = bufferPool + if n < 2 { + n = defaultMaxCallAttempts + } + o.maxCallAttempts = n + }) +} + +func withBufferPool(bufferPool mem.BufferPool) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.copts.BufferPool = bufferPool }) } diff --git a/vendor/google.golang.org/grpc/doc.go b/vendor/google.golang.org/grpc/doc.go index 0022859a..e7b532b6 100644 --- a/vendor/google.golang.org/grpc/doc.go +++ b/vendor/google.golang.org/grpc/doc.go @@ -16,7 +16,7 @@ * */ -//go:generate ./regenerate.sh +//go:generate ./scripts/regenerate.sh /* Package grpc implements an RPC system called gRPC. diff --git a/vendor/google.golang.org/grpc/encoding/encoding.go b/vendor/google.golang.org/grpc/encoding/encoding.go index 5ebf88d7..11d0ae14 100644 --- a/vendor/google.golang.org/grpc/encoding/encoding.go +++ b/vendor/google.golang.org/grpc/encoding/encoding.go @@ -94,7 +94,7 @@ type Codec interface { Name() string } -var registeredCodecs = make(map[string]Codec) +var registeredCodecs = make(map[string]any) // RegisterCodec registers the provided Codec for use with all gRPC clients and // servers. @@ -126,5 +126,6 @@ func RegisterCodec(codec Codec) { // // The content-subtype is expected to be lowercase. func GetCodec(contentSubtype string) Codec { - return registeredCodecs[contentSubtype] + c, _ := registeredCodecs[contentSubtype].(Codec) + return c } diff --git a/vendor/google.golang.org/grpc/encoding/encoding_v2.go b/vendor/google.golang.org/grpc/encoding/encoding_v2.go new file mode 100644 index 00000000..074c5e23 --- /dev/null +++ b/vendor/google.golang.org/grpc/encoding/encoding_v2.go @@ -0,0 +1,81 @@ +/* + * + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package encoding + +import ( + "strings" + + "google.golang.org/grpc/mem" +) + +// CodecV2 defines the interface gRPC uses to encode and decode messages. Note +// that implementations of this interface must be thread safe; a CodecV2's +// methods can be called from concurrent goroutines. +type CodecV2 interface { + // Marshal returns the wire format of v. The buffers in the returned + // [mem.BufferSlice] must have at least one reference each, which will be freed + // by gRPC when they are no longer needed. + Marshal(v any) (out mem.BufferSlice, err error) + // Unmarshal parses the wire format into v. Note that data will be freed as soon + // as this function returns. If the codec wishes to guarantee access to the data + // after this function, it must take its own reference that it frees when it is + // no longer needed. + Unmarshal(data mem.BufferSlice, v any) error + // Name returns the name of the Codec implementation. The returned string + // will be used as part of content type in transmission. The result must be + // static; the result cannot change between calls. + Name() string +} + +// RegisterCodecV2 registers the provided CodecV2 for use with all gRPC clients and +// servers. +// +// The CodecV2 will be stored and looked up by result of its Name() method, which +// should match the content-subtype of the encoding handled by the CodecV2. This +// is case-insensitive, and is stored and looked up as lowercase. If the +// result of calling Name() is an empty string, RegisterCodecV2 will panic. See +// Content-Type on +// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for +// more details. +// +// If both a Codec and CodecV2 are registered with the same name, the CodecV2 +// will be used. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple Codecs are +// registered with the same name, the one registered last will take effect. +func RegisterCodecV2(codec CodecV2) { + if codec == nil { + panic("cannot register a nil CodecV2") + } + if codec.Name() == "" { + panic("cannot register CodecV2 with empty string result for Name()") + } + contentSubtype := strings.ToLower(codec.Name()) + registeredCodecs[contentSubtype] = codec +} + +// GetCodecV2 gets a registered CodecV2 by content-subtype, or nil if no CodecV2 is +// registered for the content-subtype. +// +// The content-subtype is expected to be lowercase. +func GetCodecV2(contentSubtype string) CodecV2 { + c, _ := registeredCodecs[contentSubtype].(CodecV2) + return c +} diff --git a/vendor/google.golang.org/grpc/encoding/proto/proto.go b/vendor/google.golang.org/grpc/encoding/proto/proto.go index 66d5cdf0..ceec319d 100644 --- a/vendor/google.golang.org/grpc/encoding/proto/proto.go +++ b/vendor/google.golang.org/grpc/encoding/proto/proto.go @@ -1,6 +1,6 @@ /* * - * Copyright 2018 gRPC authors. + * Copyright 2024 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import ( "fmt" "google.golang.org/grpc/encoding" + "google.golang.org/grpc/mem" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/protoadapt" ) @@ -32,28 +33,51 @@ import ( const Name = "proto" func init() { - encoding.RegisterCodec(codec{}) + encoding.RegisterCodecV2(&codecV2{}) } -// codec is a Codec implementation with protobuf. It is the default codec for gRPC. -type codec struct{} +// codec is a CodecV2 implementation with protobuf. It is the default codec for +// gRPC. +type codecV2 struct{} -func (codec) Marshal(v any) ([]byte, error) { +func (c *codecV2) Marshal(v any) (data mem.BufferSlice, err error) { vv := messageV2Of(v) if vv == nil { - return nil, fmt.Errorf("failed to marshal, message is %T, want proto.Message", v) + return nil, fmt.Errorf("proto: failed to marshal, message is %T, want proto.Message", v) } - return proto.Marshal(vv) + size := proto.Size(vv) + if mem.IsBelowBufferPoolingThreshold(size) { + buf, err := proto.Marshal(vv) + if err != nil { + return nil, err + } + data = append(data, mem.SliceBuffer(buf)) + } else { + pool := mem.DefaultBufferPool() + buf := pool.Get(size) + if _, err := (proto.MarshalOptions{}).MarshalAppend((*buf)[:0], vv); err != nil { + pool.Put(buf) + return nil, err + } + data = append(data, mem.NewBuffer(buf, pool)) + } + + return data, nil } -func (codec) Unmarshal(data []byte, v any) error { +func (c *codecV2) Unmarshal(data mem.BufferSlice, v any) (err error) { vv := messageV2Of(v) if vv == nil { return fmt.Errorf("failed to unmarshal, message is %T, want proto.Message", v) } - return proto.Unmarshal(data, vv) + buf := data.MaterializeToBuffer(mem.DefaultBufferPool()) + defer buf.Free() + // TODO: Upgrade proto.Unmarshal to support mem.BufferSlice. Right now, it's not + // really possible without a major overhaul of the proto package, but the + // vtprotobuf library may be able to support this. + return proto.Unmarshal(buf.ReadOnlyData(), vv) } func messageV2Of(v any) proto.Message { @@ -67,6 +91,6 @@ func messageV2Of(v any) proto.Message { return nil } -func (codec) Name() string { +func (c *codecV2) Name() string { return Name } diff --git a/vendor/google.golang.org/grpc/experimental/stats/metricregistry.go b/vendor/google.golang.org/grpc/experimental/stats/metricregistry.go new file mode 100644 index 00000000..1d827dd5 --- /dev/null +++ b/vendor/google.golang.org/grpc/experimental/stats/metricregistry.go @@ -0,0 +1,269 @@ +/* + * + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package stats + +import ( + "maps" + + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal" +) + +func init() { + internal.SnapshotMetricRegistryForTesting = snapshotMetricsRegistryForTesting +} + +var logger = grpclog.Component("metrics-registry") + +// DefaultMetrics are the default metrics registered through global metrics +// registry. This is written to at initialization time only, and is read only +// after initialization. +var DefaultMetrics = NewMetrics() + +// MetricDescriptor is the data for a registered metric. +type MetricDescriptor struct { + // The name of this metric. This name must be unique across the whole binary + // (including any per call metrics). See + // https://github.com/grpc/proposal/blob/master/A79-non-per-call-metrics-architecture.md#metric-instrument-naming-conventions + // for metric naming conventions. + Name Metric + // The description of this metric. + Description string + // The unit (e.g. entries, seconds) of this metric. + Unit string + // The required label keys for this metric. These are intended to + // metrics emitted from a stats handler. + Labels []string + // The optional label keys for this metric. These are intended to attached + // to metrics emitted from a stats handler if configured. + OptionalLabels []string + // Whether this metric is on by default. + Default bool + // The type of metric. This is set by the metric registry, and not intended + // to be set by a component registering a metric. + Type MetricType + // Bounds are the bounds of this metric. This only applies to histogram + // metrics. If unset or set with length 0, stats handlers will fall back to + // default bounds. + Bounds []float64 +} + +// MetricType is the type of metric. +type MetricType int + +// Type of metric supported by this instrument registry. +const ( + MetricTypeIntCount MetricType = iota + MetricTypeFloatCount + MetricTypeIntHisto + MetricTypeFloatHisto + MetricTypeIntGauge +) + +// Int64CountHandle is a typed handle for a int count metric. This handle +// is passed at the recording point in order to know which metric to record +// on. +type Int64CountHandle MetricDescriptor + +// Descriptor returns the int64 count handle typecast to a pointer to a +// MetricDescriptor. +func (h *Int64CountHandle) Descriptor() *MetricDescriptor { + return (*MetricDescriptor)(h) +} + +// Record records the int64 count value on the metrics recorder provided. +func (h *Int64CountHandle) Record(recorder MetricsRecorder, incr int64, labels ...string) { + recorder.RecordInt64Count(h, incr, labels...) +} + +// Float64CountHandle is a typed handle for a float count metric. This handle is +// passed at the recording point in order to know which metric to record on. +type Float64CountHandle MetricDescriptor + +// Descriptor returns the float64 count handle typecast to a pointer to a +// MetricDescriptor. +func (h *Float64CountHandle) Descriptor() *MetricDescriptor { + return (*MetricDescriptor)(h) +} + +// Record records the float64 count value on the metrics recorder provided. +func (h *Float64CountHandle) Record(recorder MetricsRecorder, incr float64, labels ...string) { + recorder.RecordFloat64Count(h, incr, labels...) +} + +// Int64HistoHandle is a typed handle for an int histogram metric. This handle +// is passed at the recording point in order to know which metric to record on. +type Int64HistoHandle MetricDescriptor + +// Descriptor returns the int64 histo handle typecast to a pointer to a +// MetricDescriptor. +func (h *Int64HistoHandle) Descriptor() *MetricDescriptor { + return (*MetricDescriptor)(h) +} + +// Record records the int64 histo value on the metrics recorder provided. +func (h *Int64HistoHandle) Record(recorder MetricsRecorder, incr int64, labels ...string) { + recorder.RecordInt64Histo(h, incr, labels...) +} + +// Float64HistoHandle is a typed handle for a float histogram metric. This +// handle is passed at the recording point in order to know which metric to +// record on. +type Float64HistoHandle MetricDescriptor + +// Descriptor returns the float64 histo handle typecast to a pointer to a +// MetricDescriptor. +func (h *Float64HistoHandle) Descriptor() *MetricDescriptor { + return (*MetricDescriptor)(h) +} + +// Record records the float64 histo value on the metrics recorder provided. +func (h *Float64HistoHandle) Record(recorder MetricsRecorder, incr float64, labels ...string) { + recorder.RecordFloat64Histo(h, incr, labels...) +} + +// Int64GaugeHandle is a typed handle for an int gauge metric. This handle is +// passed at the recording point in order to know which metric to record on. +type Int64GaugeHandle MetricDescriptor + +// Descriptor returns the int64 gauge handle typecast to a pointer to a +// MetricDescriptor. +func (h *Int64GaugeHandle) Descriptor() *MetricDescriptor { + return (*MetricDescriptor)(h) +} + +// Record records the int64 histo value on the metrics recorder provided. +func (h *Int64GaugeHandle) Record(recorder MetricsRecorder, incr int64, labels ...string) { + recorder.RecordInt64Gauge(h, incr, labels...) +} + +// registeredMetrics are the registered metric descriptor names. +var registeredMetrics = make(map[Metric]bool) + +// metricsRegistry contains all of the registered metrics. +// +// This is written to only at init time, and read only after that. +var metricsRegistry = make(map[Metric]*MetricDescriptor) + +// DescriptorForMetric returns the MetricDescriptor from the global registry. +// +// Returns nil if MetricDescriptor not present. +func DescriptorForMetric(metric Metric) *MetricDescriptor { + return metricsRegistry[metric] +} + +func registerMetric(name Metric, def bool) { + if registeredMetrics[name] { + logger.Fatalf("metric %v already registered", name) + } + registeredMetrics[name] = true + if def { + DefaultMetrics = DefaultMetrics.Add(name) + } +} + +// RegisterInt64Count registers the metric description onto the global registry. +// It returns a typed handle to use to recording data. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple metrics are +// registered with the same name, this function will panic. +func RegisterInt64Count(descriptor MetricDescriptor) *Int64CountHandle { + registerMetric(descriptor.Name, descriptor.Default) + descriptor.Type = MetricTypeIntCount + descPtr := &descriptor + metricsRegistry[descriptor.Name] = descPtr + return (*Int64CountHandle)(descPtr) +} + +// RegisterFloat64Count registers the metric description onto the global +// registry. It returns a typed handle to use to recording data. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple metrics are +// registered with the same name, this function will panic. +func RegisterFloat64Count(descriptor MetricDescriptor) *Float64CountHandle { + registerMetric(descriptor.Name, descriptor.Default) + descriptor.Type = MetricTypeFloatCount + descPtr := &descriptor + metricsRegistry[descriptor.Name] = descPtr + return (*Float64CountHandle)(descPtr) +} + +// RegisterInt64Histo registers the metric description onto the global registry. +// It returns a typed handle to use to recording data. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple metrics are +// registered with the same name, this function will panic. +func RegisterInt64Histo(descriptor MetricDescriptor) *Int64HistoHandle { + registerMetric(descriptor.Name, descriptor.Default) + descriptor.Type = MetricTypeIntHisto + descPtr := &descriptor + metricsRegistry[descriptor.Name] = descPtr + return (*Int64HistoHandle)(descPtr) +} + +// RegisterFloat64Histo registers the metric description onto the global +// registry. It returns a typed handle to use to recording data. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple metrics are +// registered with the same name, this function will panic. +func RegisterFloat64Histo(descriptor MetricDescriptor) *Float64HistoHandle { + registerMetric(descriptor.Name, descriptor.Default) + descriptor.Type = MetricTypeFloatHisto + descPtr := &descriptor + metricsRegistry[descriptor.Name] = descPtr + return (*Float64HistoHandle)(descPtr) +} + +// RegisterInt64Gauge registers the metric description onto the global registry. +// It returns a typed handle to use to recording data. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple metrics are +// registered with the same name, this function will panic. +func RegisterInt64Gauge(descriptor MetricDescriptor) *Int64GaugeHandle { + registerMetric(descriptor.Name, descriptor.Default) + descriptor.Type = MetricTypeIntGauge + descPtr := &descriptor + metricsRegistry[descriptor.Name] = descPtr + return (*Int64GaugeHandle)(descPtr) +} + +// snapshotMetricsRegistryForTesting snapshots the global data of the metrics +// registry. Returns a cleanup function that sets the metrics registry to its +// original state. +func snapshotMetricsRegistryForTesting() func() { + oldDefaultMetrics := DefaultMetrics + oldRegisteredMetrics := registeredMetrics + oldMetricsRegistry := metricsRegistry + + registeredMetrics = make(map[Metric]bool) + metricsRegistry = make(map[Metric]*MetricDescriptor) + maps.Copy(registeredMetrics, registeredMetrics) + maps.Copy(metricsRegistry, metricsRegistry) + + return func() { + DefaultMetrics = oldDefaultMetrics + registeredMetrics = oldRegisteredMetrics + metricsRegistry = oldMetricsRegistry + } +} diff --git a/vendor/google.golang.org/grpc/experimental/stats/metrics.go b/vendor/google.golang.org/grpc/experimental/stats/metrics.go new file mode 100644 index 00000000..3221f7a6 --- /dev/null +++ b/vendor/google.golang.org/grpc/experimental/stats/metrics.go @@ -0,0 +1,114 @@ +/* + * + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package stats contains experimental metrics/stats API's. +package stats + +import "maps" + +// MetricsRecorder records on metrics derived from metric registry. +type MetricsRecorder interface { + // RecordInt64Count records the measurement alongside labels on the int + // count associated with the provided handle. + RecordInt64Count(handle *Int64CountHandle, incr int64, labels ...string) + // RecordFloat64Count records the measurement alongside labels on the float + // count associated with the provided handle. + RecordFloat64Count(handle *Float64CountHandle, incr float64, labels ...string) + // RecordInt64Histo records the measurement alongside labels on the int + // histo associated with the provided handle. + RecordInt64Histo(handle *Int64HistoHandle, incr int64, labels ...string) + // RecordFloat64Histo records the measurement alongside labels on the float + // histo associated with the provided handle. + RecordFloat64Histo(handle *Float64HistoHandle, incr float64, labels ...string) + // RecordInt64Gauge records the measurement alongside labels on the int + // gauge associated with the provided handle. + RecordInt64Gauge(handle *Int64GaugeHandle, incr int64, labels ...string) +} + +// Metric is an identifier for a metric. +type Metric string + +// Metrics is a set of metrics to record. Once created, Metrics is immutable, +// however Add and Remove can make copies with specific metrics added or +// removed, respectively. +// +// Do not construct directly; use NewMetrics instead. +type Metrics struct { + // metrics are the set of metrics to initialize. + metrics map[Metric]bool +} + +// NewMetrics returns a Metrics containing Metrics. +func NewMetrics(metrics ...Metric) *Metrics { + newMetrics := make(map[Metric]bool) + for _, metric := range metrics { + newMetrics[metric] = true + } + return &Metrics{ + metrics: newMetrics, + } +} + +// Metrics returns the metrics set. The returned map is read-only and must not +// be modified. +func (m *Metrics) Metrics() map[Metric]bool { + return m.metrics +} + +// Add adds the metrics to the metrics set and returns a new copy with the +// additional metrics. +func (m *Metrics) Add(metrics ...Metric) *Metrics { + newMetrics := make(map[Metric]bool) + for metric := range m.metrics { + newMetrics[metric] = true + } + + for _, metric := range metrics { + newMetrics[metric] = true + } + return &Metrics{ + metrics: newMetrics, + } +} + +// Join joins the metrics passed in with the metrics set, and returns a new copy +// with the merged metrics. +func (m *Metrics) Join(metrics *Metrics) *Metrics { + newMetrics := make(map[Metric]bool) + maps.Copy(newMetrics, m.metrics) + maps.Copy(newMetrics, metrics.metrics) + return &Metrics{ + metrics: newMetrics, + } +} + +// Remove removes the metrics from the metrics set and returns a new copy with +// the metrics removed. +func (m *Metrics) Remove(metrics ...Metric) *Metrics { + newMetrics := make(map[Metric]bool) + for metric := range m.metrics { + newMetrics[metric] = true + } + + for _, metric := range metrics { + delete(newMetrics, metric) + } + return &Metrics{ + metrics: newMetrics, + } +} diff --git a/vendor/google.golang.org/grpc/grpclog/component.go b/vendor/google.golang.org/grpc/grpclog/component.go index ac73c9ce..f1ae080d 100644 --- a/vendor/google.golang.org/grpc/grpclog/component.go +++ b/vendor/google.golang.org/grpc/grpclog/component.go @@ -20,8 +20,6 @@ package grpclog import ( "fmt" - - "google.golang.org/grpc/internal/grpclog" ) // componentData records the settings for a component. @@ -33,22 +31,22 @@ var cache = map[string]*componentData{} func (c *componentData) InfoDepth(depth int, args ...any) { args = append([]any{"[" + string(c.name) + "]"}, args...) - grpclog.InfoDepth(depth+1, args...) + InfoDepth(depth+1, args...) } func (c *componentData) WarningDepth(depth int, args ...any) { args = append([]any{"[" + string(c.name) + "]"}, args...) - grpclog.WarningDepth(depth+1, args...) + WarningDepth(depth+1, args...) } func (c *componentData) ErrorDepth(depth int, args ...any) { args = append([]any{"[" + string(c.name) + "]"}, args...) - grpclog.ErrorDepth(depth+1, args...) + ErrorDepth(depth+1, args...) } func (c *componentData) FatalDepth(depth int, args ...any) { args = append([]any{"[" + string(c.name) + "]"}, args...) - grpclog.FatalDepth(depth+1, args...) + FatalDepth(depth+1, args...) } func (c *componentData) Info(args ...any) { diff --git a/vendor/google.golang.org/grpc/grpclog/grpclog.go b/vendor/google.golang.org/grpc/grpclog/grpclog.go index 16928c9c..db320105 100644 --- a/vendor/google.golang.org/grpc/grpclog/grpclog.go +++ b/vendor/google.golang.org/grpc/grpclog/grpclog.go @@ -18,18 +18,15 @@ // Package grpclog defines logging for grpc. // -// All logs in transport and grpclb packages only go to verbose level 2. -// All logs in other packages in grpc are logged in spite of the verbosity level. -// -// In the default logger, -// severity level can be set by environment variable GRPC_GO_LOG_SEVERITY_LEVEL, -// verbosity level can be set by GRPC_GO_LOG_VERBOSITY_LEVEL. -package grpclog // import "google.golang.org/grpc/grpclog" +// In the default logger, severity level can be set by environment variable +// GRPC_GO_LOG_SEVERITY_LEVEL, verbosity level can be set by +// GRPC_GO_LOG_VERBOSITY_LEVEL. +package grpclog import ( "os" - "google.golang.org/grpc/internal/grpclog" + "google.golang.org/grpc/grpclog/internal" ) func init() { @@ -38,58 +35,58 @@ func init() { // V reports whether verbosity level l is at least the requested verbose level. func V(l int) bool { - return grpclog.Logger.V(l) + return internal.LoggerV2Impl.V(l) } // Info logs to the INFO log. func Info(args ...any) { - grpclog.Logger.Info(args...) + internal.LoggerV2Impl.Info(args...) } // Infof logs to the INFO log. Arguments are handled in the manner of fmt.Printf. func Infof(format string, args ...any) { - grpclog.Logger.Infof(format, args...) + internal.LoggerV2Impl.Infof(format, args...) } // Infoln logs to the INFO log. Arguments are handled in the manner of fmt.Println. func Infoln(args ...any) { - grpclog.Logger.Infoln(args...) + internal.LoggerV2Impl.Infoln(args...) } // Warning logs to the WARNING log. func Warning(args ...any) { - grpclog.Logger.Warning(args...) + internal.LoggerV2Impl.Warning(args...) } // Warningf logs to the WARNING log. Arguments are handled in the manner of fmt.Printf. func Warningf(format string, args ...any) { - grpclog.Logger.Warningf(format, args...) + internal.LoggerV2Impl.Warningf(format, args...) } // Warningln logs to the WARNING log. Arguments are handled in the manner of fmt.Println. func Warningln(args ...any) { - grpclog.Logger.Warningln(args...) + internal.LoggerV2Impl.Warningln(args...) } // Error logs to the ERROR log. func Error(args ...any) { - grpclog.Logger.Error(args...) + internal.LoggerV2Impl.Error(args...) } // Errorf logs to the ERROR log. Arguments are handled in the manner of fmt.Printf. func Errorf(format string, args ...any) { - grpclog.Logger.Errorf(format, args...) + internal.LoggerV2Impl.Errorf(format, args...) } // Errorln logs to the ERROR log. Arguments are handled in the manner of fmt.Println. func Errorln(args ...any) { - grpclog.Logger.Errorln(args...) + internal.LoggerV2Impl.Errorln(args...) } // Fatal logs to the FATAL log. Arguments are handled in the manner of fmt.Print. // It calls os.Exit() with exit code 1. func Fatal(args ...any) { - grpclog.Logger.Fatal(args...) + internal.LoggerV2Impl.Fatal(args...) // Make sure fatal logs will exit. os.Exit(1) } @@ -97,15 +94,15 @@ func Fatal(args ...any) { // Fatalf logs to the FATAL log. Arguments are handled in the manner of fmt.Printf. // It calls os.Exit() with exit code 1. func Fatalf(format string, args ...any) { - grpclog.Logger.Fatalf(format, args...) + internal.LoggerV2Impl.Fatalf(format, args...) // Make sure fatal logs will exit. os.Exit(1) } // Fatalln logs to the FATAL log. Arguments are handled in the manner of fmt.Println. -// It calle os.Exit()) with exit code 1. +// It calls os.Exit() with exit code 1. func Fatalln(args ...any) { - grpclog.Logger.Fatalln(args...) + internal.LoggerV2Impl.Fatalln(args...) // Make sure fatal logs will exit. os.Exit(1) } @@ -114,19 +111,76 @@ func Fatalln(args ...any) { // // Deprecated: use Info. func Print(args ...any) { - grpclog.Logger.Info(args...) + internal.LoggerV2Impl.Info(args...) } // Printf prints to the logger. Arguments are handled in the manner of fmt.Printf. // // Deprecated: use Infof. func Printf(format string, args ...any) { - grpclog.Logger.Infof(format, args...) + internal.LoggerV2Impl.Infof(format, args...) } // Println prints to the logger. Arguments are handled in the manner of fmt.Println. // // Deprecated: use Infoln. func Println(args ...any) { - grpclog.Logger.Infoln(args...) + internal.LoggerV2Impl.Infoln(args...) +} + +// InfoDepth logs to the INFO log at the specified depth. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a +// later release. +func InfoDepth(depth int, args ...any) { + if internal.DepthLoggerV2Impl != nil { + internal.DepthLoggerV2Impl.InfoDepth(depth, args...) + } else { + internal.LoggerV2Impl.Infoln(args...) + } +} + +// WarningDepth logs to the WARNING log at the specified depth. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a +// later release. +func WarningDepth(depth int, args ...any) { + if internal.DepthLoggerV2Impl != nil { + internal.DepthLoggerV2Impl.WarningDepth(depth, args...) + } else { + internal.LoggerV2Impl.Warningln(args...) + } +} + +// ErrorDepth logs to the ERROR log at the specified depth. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a +// later release. +func ErrorDepth(depth int, args ...any) { + if internal.DepthLoggerV2Impl != nil { + internal.DepthLoggerV2Impl.ErrorDepth(depth, args...) + } else { + internal.LoggerV2Impl.Errorln(args...) + } +} + +// FatalDepth logs to the FATAL log at the specified depth. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a +// later release. +func FatalDepth(depth int, args ...any) { + if internal.DepthLoggerV2Impl != nil { + internal.DepthLoggerV2Impl.FatalDepth(depth, args...) + } else { + internal.LoggerV2Impl.Fatalln(args...) + } + os.Exit(1) } diff --git a/vendor/google.golang.org/grpc/grpclog/internal/grpclog.go b/vendor/google.golang.org/grpc/grpclog/internal/grpclog.go new file mode 100644 index 00000000..59c03bc1 --- /dev/null +++ b/vendor/google.golang.org/grpc/grpclog/internal/grpclog.go @@ -0,0 +1,26 @@ +/* + * + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package internal contains functionality internal to the grpclog package. +package internal + +// LoggerV2Impl is the logger used for the non-depth log functions. +var LoggerV2Impl LoggerV2 + +// DepthLoggerV2Impl is the logger used for the depth log functions. +var DepthLoggerV2Impl DepthLoggerV2 diff --git a/vendor/google.golang.org/grpc/grpclog/internal/logger.go b/vendor/google.golang.org/grpc/grpclog/internal/logger.go new file mode 100644 index 00000000..e524fdd4 --- /dev/null +++ b/vendor/google.golang.org/grpc/grpclog/internal/logger.go @@ -0,0 +1,87 @@ +/* + * + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package internal + +// Logger mimics golang's standard Logger as an interface. +// +// Deprecated: use LoggerV2. +type Logger interface { + Fatal(args ...any) + Fatalf(format string, args ...any) + Fatalln(args ...any) + Print(args ...any) + Printf(format string, args ...any) + Println(args ...any) +} + +// LoggerWrapper wraps Logger into a LoggerV2. +type LoggerWrapper struct { + Logger +} + +// Info logs to INFO log. Arguments are handled in the manner of fmt.Print. +func (l *LoggerWrapper) Info(args ...any) { + l.Logger.Print(args...) +} + +// Infoln logs to INFO log. Arguments are handled in the manner of fmt.Println. +func (l *LoggerWrapper) Infoln(args ...any) { + l.Logger.Println(args...) +} + +// Infof logs to INFO log. Arguments are handled in the manner of fmt.Printf. +func (l *LoggerWrapper) Infof(format string, args ...any) { + l.Logger.Printf(format, args...) +} + +// Warning logs to WARNING log. Arguments are handled in the manner of fmt.Print. +func (l *LoggerWrapper) Warning(args ...any) { + l.Logger.Print(args...) +} + +// Warningln logs to WARNING log. Arguments are handled in the manner of fmt.Println. +func (l *LoggerWrapper) Warningln(args ...any) { + l.Logger.Println(args...) +} + +// Warningf logs to WARNING log. Arguments are handled in the manner of fmt.Printf. +func (l *LoggerWrapper) Warningf(format string, args ...any) { + l.Logger.Printf(format, args...) +} + +// Error logs to ERROR log. Arguments are handled in the manner of fmt.Print. +func (l *LoggerWrapper) Error(args ...any) { + l.Logger.Print(args...) +} + +// Errorln logs to ERROR log. Arguments are handled in the manner of fmt.Println. +func (l *LoggerWrapper) Errorln(args ...any) { + l.Logger.Println(args...) +} + +// Errorf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. +func (l *LoggerWrapper) Errorf(format string, args ...any) { + l.Logger.Printf(format, args...) +} + +// V reports whether verbosity level l is at least the requested verbose level. +func (*LoggerWrapper) V(int) bool { + // Returns true for all verbose level. + return true +} diff --git a/vendor/google.golang.org/grpc/internal/grpclog/grpclog.go b/vendor/google.golang.org/grpc/grpclog/internal/loggerv2.go similarity index 52% rename from vendor/google.golang.org/grpc/internal/grpclog/grpclog.go rename to vendor/google.golang.org/grpc/grpclog/internal/loggerv2.go index bfc45102..07df71e9 100644 --- a/vendor/google.golang.org/grpc/internal/grpclog/grpclog.go +++ b/vendor/google.golang.org/grpc/grpclog/internal/loggerv2.go @@ -1,6 +1,6 @@ /* * - * Copyright 2020 gRPC authors. + * Copyright 2024 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,59 +16,17 @@ * */ -// Package grpclog (internal) defines depth logging for grpc. -package grpclog +package internal import ( + "encoding/json" + "fmt" + "io" + "log" "os" ) -// Logger is the logger used for the non-depth log functions. -var Logger LoggerV2 - -// DepthLogger is the logger used for the depth log functions. -var DepthLogger DepthLoggerV2 - -// InfoDepth logs to the INFO log at the specified depth. -func InfoDepth(depth int, args ...any) { - if DepthLogger != nil { - DepthLogger.InfoDepth(depth, args...) - } else { - Logger.Infoln(args...) - } -} - -// WarningDepth logs to the WARNING log at the specified depth. -func WarningDepth(depth int, args ...any) { - if DepthLogger != nil { - DepthLogger.WarningDepth(depth, args...) - } else { - Logger.Warningln(args...) - } -} - -// ErrorDepth logs to the ERROR log at the specified depth. -func ErrorDepth(depth int, args ...any) { - if DepthLogger != nil { - DepthLogger.ErrorDepth(depth, args...) - } else { - Logger.Errorln(args...) - } -} - -// FatalDepth logs to the FATAL log at the specified depth. -func FatalDepth(depth int, args ...any) { - if DepthLogger != nil { - DepthLogger.FatalDepth(depth, args...) - } else { - Logger.Fatalln(args...) - } - os.Exit(1) -} - // LoggerV2 does underlying logging work for grpclog. -// This is a copy of the LoggerV2 defined in the external grpclog package. It -// is defined here to avoid a circular dependency. type LoggerV2 interface { // Info logs to INFO log. Arguments are handled in the manner of fmt.Print. Info(args ...any) @@ -107,14 +65,13 @@ type LoggerV2 interface { // DepthLoggerV2 logs at a specified call frame. If a LoggerV2 also implements // DepthLoggerV2, the below functions will be called with the appropriate stack // depth set for trivial functions the logger may ignore. -// This is a copy of the DepthLoggerV2 defined in the external grpclog package. -// It is defined here to avoid a circular dependency. // // # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. type DepthLoggerV2 interface { + LoggerV2 // InfoDepth logs to INFO log at the specified depth. Arguments are handled in the manner of fmt.Println. InfoDepth(depth int, args ...any) // WarningDepth logs to WARNING log at the specified depth. Arguments are handled in the manner of fmt.Println. @@ -124,3 +81,124 @@ type DepthLoggerV2 interface { // FatalDepth logs to FATAL log at the specified depth. Arguments are handled in the manner of fmt.Println. FatalDepth(depth int, args ...any) } + +const ( + // infoLog indicates Info severity. + infoLog int = iota + // warningLog indicates Warning severity. + warningLog + // errorLog indicates Error severity. + errorLog + // fatalLog indicates Fatal severity. + fatalLog +) + +// severityName contains the string representation of each severity. +var severityName = []string{ + infoLog: "INFO", + warningLog: "WARNING", + errorLog: "ERROR", + fatalLog: "FATAL", +} + +// loggerT is the default logger used by grpclog. +type loggerT struct { + m []*log.Logger + v int + jsonFormat bool +} + +func (g *loggerT) output(severity int, s string) { + sevStr := severityName[severity] + if !g.jsonFormat { + g.m[severity].Output(2, fmt.Sprintf("%v: %v", sevStr, s)) + return + } + // TODO: we can also include the logging component, but that needs more + // (API) changes. + b, _ := json.Marshal(map[string]string{ + "severity": sevStr, + "message": s, + }) + g.m[severity].Output(2, string(b)) +} + +func (g *loggerT) Info(args ...any) { + g.output(infoLog, fmt.Sprint(args...)) +} + +func (g *loggerT) Infoln(args ...any) { + g.output(infoLog, fmt.Sprintln(args...)) +} + +func (g *loggerT) Infof(format string, args ...any) { + g.output(infoLog, fmt.Sprintf(format, args...)) +} + +func (g *loggerT) Warning(args ...any) { + g.output(warningLog, fmt.Sprint(args...)) +} + +func (g *loggerT) Warningln(args ...any) { + g.output(warningLog, fmt.Sprintln(args...)) +} + +func (g *loggerT) Warningf(format string, args ...any) { + g.output(warningLog, fmt.Sprintf(format, args...)) +} + +func (g *loggerT) Error(args ...any) { + g.output(errorLog, fmt.Sprint(args...)) +} + +func (g *loggerT) Errorln(args ...any) { + g.output(errorLog, fmt.Sprintln(args...)) +} + +func (g *loggerT) Errorf(format string, args ...any) { + g.output(errorLog, fmt.Sprintf(format, args...)) +} + +func (g *loggerT) Fatal(args ...any) { + g.output(fatalLog, fmt.Sprint(args...)) + os.Exit(1) +} + +func (g *loggerT) Fatalln(args ...any) { + g.output(fatalLog, fmt.Sprintln(args...)) + os.Exit(1) +} + +func (g *loggerT) Fatalf(format string, args ...any) { + g.output(fatalLog, fmt.Sprintf(format, args...)) + os.Exit(1) +} + +func (g *loggerT) V(l int) bool { + return l <= g.v +} + +// LoggerV2Config configures the LoggerV2 implementation. +type LoggerV2Config struct { + // Verbosity sets the verbosity level of the logger. + Verbosity int + // FormatJSON controls whether the logger should output logs in JSON format. + FormatJSON bool +} + +// NewLoggerV2 creates a new LoggerV2 instance with the provided configuration. +// The infoW, warningW, and errorW writers are used to write log messages of +// different severity levels. +func NewLoggerV2(infoW, warningW, errorW io.Writer, c LoggerV2Config) LoggerV2 { + var m []*log.Logger + flag := log.LstdFlags + if c.FormatJSON { + flag = 0 + } + m = append(m, log.New(infoW, "", flag)) + m = append(m, log.New(io.MultiWriter(infoW, warningW), "", flag)) + ew := io.MultiWriter(infoW, warningW, errorW) // ew will be used for error and fatal. + m = append(m, log.New(ew, "", flag)) + m = append(m, log.New(ew, "", flag)) + return &loggerT{m: m, v: c.Verbosity, jsonFormat: c.FormatJSON} +} diff --git a/vendor/google.golang.org/grpc/grpclog/logger.go b/vendor/google.golang.org/grpc/grpclog/logger.go index b1674d82..4b203585 100644 --- a/vendor/google.golang.org/grpc/grpclog/logger.go +++ b/vendor/google.golang.org/grpc/grpclog/logger.go @@ -18,70 +18,17 @@ package grpclog -import "google.golang.org/grpc/internal/grpclog" +import "google.golang.org/grpc/grpclog/internal" // Logger mimics golang's standard Logger as an interface. // // Deprecated: use LoggerV2. -type Logger interface { - Fatal(args ...any) - Fatalf(format string, args ...any) - Fatalln(args ...any) - Print(args ...any) - Printf(format string, args ...any) - Println(args ...any) -} +type Logger internal.Logger // SetLogger sets the logger that is used in grpc. Call only from // init() functions. // // Deprecated: use SetLoggerV2. func SetLogger(l Logger) { - grpclog.Logger = &loggerWrapper{Logger: l} -} - -// loggerWrapper wraps Logger into a LoggerV2. -type loggerWrapper struct { - Logger -} - -func (g *loggerWrapper) Info(args ...any) { - g.Logger.Print(args...) -} - -func (g *loggerWrapper) Infoln(args ...any) { - g.Logger.Println(args...) -} - -func (g *loggerWrapper) Infof(format string, args ...any) { - g.Logger.Printf(format, args...) -} - -func (g *loggerWrapper) Warning(args ...any) { - g.Logger.Print(args...) -} - -func (g *loggerWrapper) Warningln(args ...any) { - g.Logger.Println(args...) -} - -func (g *loggerWrapper) Warningf(format string, args ...any) { - g.Logger.Printf(format, args...) -} - -func (g *loggerWrapper) Error(args ...any) { - g.Logger.Print(args...) -} - -func (g *loggerWrapper) Errorln(args ...any) { - g.Logger.Println(args...) -} - -func (g *loggerWrapper) Errorf(format string, args ...any) { - g.Logger.Printf(format, args...) -} - -func (g *loggerWrapper) V(l int) bool { - // Returns true for all verbose level. - return true + internal.LoggerV2Impl = &internal.LoggerWrapper{Logger: l} } diff --git a/vendor/google.golang.org/grpc/grpclog/loggerv2.go b/vendor/google.golang.org/grpc/grpclog/loggerv2.go index ecfd36d7..892dc13d 100644 --- a/vendor/google.golang.org/grpc/grpclog/loggerv2.go +++ b/vendor/google.golang.org/grpc/grpclog/loggerv2.go @@ -19,52 +19,16 @@ package grpclog import ( - "encoding/json" - "fmt" "io" - "log" "os" "strconv" "strings" - "google.golang.org/grpc/internal/grpclog" + "google.golang.org/grpc/grpclog/internal" ) // LoggerV2 does underlying logging work for grpclog. -type LoggerV2 interface { - // Info logs to INFO log. Arguments are handled in the manner of fmt.Print. - Info(args ...any) - // Infoln logs to INFO log. Arguments are handled in the manner of fmt.Println. - Infoln(args ...any) - // Infof logs to INFO log. Arguments are handled in the manner of fmt.Printf. - Infof(format string, args ...any) - // Warning logs to WARNING log. Arguments are handled in the manner of fmt.Print. - Warning(args ...any) - // Warningln logs to WARNING log. Arguments are handled in the manner of fmt.Println. - Warningln(args ...any) - // Warningf logs to WARNING log. Arguments are handled in the manner of fmt.Printf. - Warningf(format string, args ...any) - // Error logs to ERROR log. Arguments are handled in the manner of fmt.Print. - Error(args ...any) - // Errorln logs to ERROR log. Arguments are handled in the manner of fmt.Println. - Errorln(args ...any) - // Errorf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. - Errorf(format string, args ...any) - // Fatal logs to ERROR log. Arguments are handled in the manner of fmt.Print. - // gRPC ensures that all Fatal logs will exit with os.Exit(1). - // Implementations may also call os.Exit() with a non-zero exit code. - Fatal(args ...any) - // Fatalln logs to ERROR log. Arguments are handled in the manner of fmt.Println. - // gRPC ensures that all Fatal logs will exit with os.Exit(1). - // Implementations may also call os.Exit() with a non-zero exit code. - Fatalln(args ...any) - // Fatalf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. - // gRPC ensures that all Fatal logs will exit with os.Exit(1). - // Implementations may also call os.Exit() with a non-zero exit code. - Fatalf(format string, args ...any) - // V reports whether verbosity level l is at least the requested verbose level. - V(l int) bool -} +type LoggerV2 internal.LoggerV2 // SetLoggerV2 sets logger that is used in grpc to a V2 logger. // Not mutex-protected, should be called before any gRPC functions. @@ -72,34 +36,8 @@ func SetLoggerV2(l LoggerV2) { if _, ok := l.(*componentData); ok { panic("cannot use component logger as grpclog logger") } - grpclog.Logger = l - grpclog.DepthLogger, _ = l.(grpclog.DepthLoggerV2) -} - -const ( - // infoLog indicates Info severity. - infoLog int = iota - // warningLog indicates Warning severity. - warningLog - // errorLog indicates Error severity. - errorLog - // fatalLog indicates Fatal severity. - fatalLog -) - -// severityName contains the string representation of each severity. -var severityName = []string{ - infoLog: "INFO", - warningLog: "WARNING", - errorLog: "ERROR", - fatalLog: "FATAL", -} - -// loggerT is the default logger used by grpclog. -type loggerT struct { - m []*log.Logger - v int - jsonFormat bool + internal.LoggerV2Impl = l + internal.DepthLoggerV2Impl, _ = l.(internal.DepthLoggerV2) } // NewLoggerV2 creates a loggerV2 with the provided writers. @@ -108,32 +46,13 @@ type loggerT struct { // Warning logs will be written to warningW and infoW. // Info logs will be written to infoW. func NewLoggerV2(infoW, warningW, errorW io.Writer) LoggerV2 { - return newLoggerV2WithConfig(infoW, warningW, errorW, loggerV2Config{}) + return internal.NewLoggerV2(infoW, warningW, errorW, internal.LoggerV2Config{}) } // NewLoggerV2WithVerbosity creates a loggerV2 with the provided writers and // verbosity level. func NewLoggerV2WithVerbosity(infoW, warningW, errorW io.Writer, v int) LoggerV2 { - return newLoggerV2WithConfig(infoW, warningW, errorW, loggerV2Config{verbose: v}) -} - -type loggerV2Config struct { - verbose int - jsonFormat bool -} - -func newLoggerV2WithConfig(infoW, warningW, errorW io.Writer, c loggerV2Config) LoggerV2 { - var m []*log.Logger - flag := log.LstdFlags - if c.jsonFormat { - flag = 0 - } - m = append(m, log.New(infoW, "", flag)) - m = append(m, log.New(io.MultiWriter(infoW, warningW), "", flag)) - ew := io.MultiWriter(infoW, warningW, errorW) // ew will be used for error and fatal. - m = append(m, log.New(ew, "", flag)) - m = append(m, log.New(ew, "", flag)) - return &loggerT{m: m, v: c.verbose, jsonFormat: c.jsonFormat} + return internal.NewLoggerV2(infoW, warningW, errorW, internal.LoggerV2Config{Verbosity: v}) } // newLoggerV2 creates a loggerV2 to be used as default logger. @@ -161,82 +80,12 @@ func newLoggerV2() LoggerV2 { jsonFormat := strings.EqualFold(os.Getenv("GRPC_GO_LOG_FORMATTER"), "json") - return newLoggerV2WithConfig(infoW, warningW, errorW, loggerV2Config{ - verbose: v, - jsonFormat: jsonFormat, + return internal.NewLoggerV2(infoW, warningW, errorW, internal.LoggerV2Config{ + Verbosity: v, + FormatJSON: jsonFormat, }) } -func (g *loggerT) output(severity int, s string) { - sevStr := severityName[severity] - if !g.jsonFormat { - g.m[severity].Output(2, fmt.Sprintf("%v: %v", sevStr, s)) - return - } - // TODO: we can also include the logging component, but that needs more - // (API) changes. - b, _ := json.Marshal(map[string]string{ - "severity": sevStr, - "message": s, - }) - g.m[severity].Output(2, string(b)) -} - -func (g *loggerT) Info(args ...any) { - g.output(infoLog, fmt.Sprint(args...)) -} - -func (g *loggerT) Infoln(args ...any) { - g.output(infoLog, fmt.Sprintln(args...)) -} - -func (g *loggerT) Infof(format string, args ...any) { - g.output(infoLog, fmt.Sprintf(format, args...)) -} - -func (g *loggerT) Warning(args ...any) { - g.output(warningLog, fmt.Sprint(args...)) -} - -func (g *loggerT) Warningln(args ...any) { - g.output(warningLog, fmt.Sprintln(args...)) -} - -func (g *loggerT) Warningf(format string, args ...any) { - g.output(warningLog, fmt.Sprintf(format, args...)) -} - -func (g *loggerT) Error(args ...any) { - g.output(errorLog, fmt.Sprint(args...)) -} - -func (g *loggerT) Errorln(args ...any) { - g.output(errorLog, fmt.Sprintln(args...)) -} - -func (g *loggerT) Errorf(format string, args ...any) { - g.output(errorLog, fmt.Sprintf(format, args...)) -} - -func (g *loggerT) Fatal(args ...any) { - g.output(fatalLog, fmt.Sprint(args...)) - os.Exit(1) -} - -func (g *loggerT) Fatalln(args ...any) { - g.output(fatalLog, fmt.Sprintln(args...)) - os.Exit(1) -} - -func (g *loggerT) Fatalf(format string, args ...any) { - g.output(fatalLog, fmt.Sprintf(format, args...)) - os.Exit(1) -} - -func (g *loggerT) V(l int) bool { - return l <= g.v -} - // DepthLoggerV2 logs at a specified call frame. If a LoggerV2 also implements // DepthLoggerV2, the below functions will be called with the appropriate stack // depth set for trivial functions the logger may ignore. @@ -245,14 +94,4 @@ func (g *loggerT) V(l int) bool { // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. -type DepthLoggerV2 interface { - LoggerV2 - // InfoDepth logs to INFO log at the specified depth. Arguments are handled in the manner of fmt.Println. - InfoDepth(depth int, args ...any) - // WarningDepth logs to WARNING log at the specified depth. Arguments are handled in the manner of fmt.Println. - WarningDepth(depth int, args ...any) - // ErrorDepth logs to ERROR log at the specified depth. Arguments are handled in the manner of fmt.Println. - ErrorDepth(depth int, args ...any) - // FatalDepth logs to FATAL log at the specified depth. Arguments are handled in the manner of fmt.Println. - FatalDepth(depth int, args ...any) -} +type DepthLoggerV2 internal.DepthLoggerV2 diff --git a/vendor/google.golang.org/grpc/internal/backoff/backoff.go b/vendor/google.golang.org/grpc/internal/backoff/backoff.go index fed1c011..b15cf482 100644 --- a/vendor/google.golang.org/grpc/internal/backoff/backoff.go +++ b/vendor/google.golang.org/grpc/internal/backoff/backoff.go @@ -25,10 +25,10 @@ package backoff import ( "context" "errors" + "math/rand" "time" grpcbackoff "google.golang.org/grpc/backoff" - "google.golang.org/grpc/internal/grpcrand" ) // Strategy defines the methodology for backing off after a grpc connection @@ -67,7 +67,7 @@ func (bc Exponential) Backoff(retries int) time.Duration { } // Randomize backoff delays so that if a cluster of requests start at // the same time, they won't operate in lockstep. - backoff *= 1 + bc.Config.Jitter*(grpcrand.Float64()*2-1) + backoff *= 1 + bc.Config.Jitter*(rand.Float64()*2-1) if backoff < 0 { return 0 } diff --git a/vendor/google.golang.org/grpc/internal/binarylog/method_logger.go b/vendor/google.golang.org/grpc/internal/binarylog/method_logger.go index aa4505a8..96693289 100644 --- a/vendor/google.golang.org/grpc/internal/binarylog/method_logger.go +++ b/vendor/google.golang.org/grpc/internal/binarylog/method_logger.go @@ -106,7 +106,7 @@ func (ml *TruncatingMethodLogger) Build(c LogEntryConfig) *binlogpb.GrpcLogEntry } // Log creates a proto binary log entry, and logs it to the sink. -func (ml *TruncatingMethodLogger) Log(ctx context.Context, c LogEntryConfig) { +func (ml *TruncatingMethodLogger) Log(_ context.Context, c LogEntryConfig) { ml.sink.Write(ml.Build(c)) } diff --git a/vendor/google.golang.org/grpc/internal/channelz/channelmap.go b/vendor/google.golang.org/grpc/internal/channelz/channelmap.go index dfe18b08..64c79195 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/channelmap.go +++ b/vendor/google.golang.org/grpc/internal/channelz/channelmap.go @@ -46,7 +46,7 @@ type entry interface { // channelMap is the storage data structure for channelz. // -// Methods of channelMap can be divided in two two categories with respect to +// Methods of channelMap can be divided into two categories with respect to // locking. // // 1. Methods acquire the global lock. @@ -234,13 +234,6 @@ func copyMap(m map[int64]string) map[int64]string { return n } -func min(a, b int) int { - if a < b { - return a - } - return b -} - func (c *channelMap) getTopChannels(id int64, maxResults int) ([]*Channel, bool) { if maxResults <= 0 { maxResults = EntriesPerPage diff --git a/vendor/google.golang.org/grpc/internal/channelz/funcs.go b/vendor/google.golang.org/grpc/internal/channelz/funcs.go index 03e24e15..078bb812 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/funcs.go +++ b/vendor/google.golang.org/grpc/internal/channelz/funcs.go @@ -33,7 +33,7 @@ var ( // outside this package except by tests. IDGen IDGenerator - db *channelMap = newChannelMap() + db = newChannelMap() // EntriesPerPage defines the number of channelz entries to be shown on a web page. EntriesPerPage = 50 curState int32 diff --git a/vendor/google.golang.org/grpc/internal/channelz/syscall_nonlinux.go b/vendor/google.golang.org/grpc/internal/channelz/syscall_nonlinux.go index d1ed8df6..0e6e18e1 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/syscall_nonlinux.go +++ b/vendor/google.golang.org/grpc/internal/channelz/syscall_nonlinux.go @@ -35,13 +35,13 @@ type SocketOptionData struct { // Getsockopt defines the function to get socket options requested by channelz. // It is to be passed to syscall.RawConn.Control(). // Windows OS doesn't support Socket Option -func (s *SocketOptionData) Getsockopt(fd uintptr) { +func (s *SocketOptionData) Getsockopt(uintptr) { once.Do(func() { logger.Warning("Channelz: socket options are not supported on non-linux environments") }) } // GetSocketOption gets the socket option info of the conn. -func GetSocketOption(c any) *SocketOptionData { +func GetSocketOption(any) *SocketOptionData { return nil } diff --git a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go index 9c915d9e..452985f8 100644 --- a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go +++ b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go @@ -40,6 +40,16 @@ var ( // ALTSMaxConcurrentHandshakes is the maximum number of concurrent ALTS // handshakes that can be performed. ALTSMaxConcurrentHandshakes = uint64FromEnv("GRPC_ALTS_MAX_CONCURRENT_HANDSHAKES", 100, 1, 100) + // EnforceALPNEnabled is set if TLS connections to servers with ALPN disabled + // should be rejected. The HTTP/2 protocol requires ALPN to be enabled, this + // option is present for backward compatibility. This option may be overridden + // by setting the environment variable "GRPC_ENFORCE_ALPN_ENABLED" to "true" + // or "false". + EnforceALPNEnabled = boolFromEnv("GRPC_ENFORCE_ALPN_ENABLED", true) + // XDSFallbackSupport is the env variable that controls whether support for + // xDS fallback is turned on. If this is unset or is false, only the first + // xDS server in the list of server configs will be used. + XDSFallbackSupport = boolFromEnv("GRPC_EXPERIMENTAL_XDS_FALLBACK", false) ) func boolFromEnv(envVar string, def bool) bool { diff --git a/vendor/google.golang.org/grpc/internal/experimental.go b/vendor/google.golang.org/grpc/internal/experimental.go index 7f7044e1..7617be21 100644 --- a/vendor/google.golang.org/grpc/internal/experimental.go +++ b/vendor/google.golang.org/grpc/internal/experimental.go @@ -18,11 +18,11 @@ package internal var ( - // WithRecvBufferPool is implemented by the grpc package and returns a dial + // WithBufferPool is implemented by the grpc package and returns a dial // option to configure a shared buffer pool for a grpc.ClientConn. - WithRecvBufferPool any // func (grpc.SharedBufferPool) grpc.DialOption + WithBufferPool any // func (grpc.SharedBufferPool) grpc.DialOption - // RecvBufferPool is implemented by the grpc package and returns a server + // BufferPool is implemented by the grpc package and returns a server // option to configure a shared buffer pool for a grpc.Server. - RecvBufferPool any // func (grpc.SharedBufferPool) grpc.ServerOption + BufferPool any // func (grpc.SharedBufferPool) grpc.ServerOption ) diff --git a/vendor/google.golang.org/grpc/internal/grpclog/prefixLogger.go b/vendor/google.golang.org/grpc/internal/grpclog/prefix_logger.go similarity index 63% rename from vendor/google.golang.org/grpc/internal/grpclog/prefixLogger.go rename to vendor/google.golang.org/grpc/internal/grpclog/prefix_logger.go index faa998de..092ad187 100644 --- a/vendor/google.golang.org/grpc/internal/grpclog/prefixLogger.go +++ b/vendor/google.golang.org/grpc/internal/grpclog/prefix_logger.go @@ -16,17 +16,21 @@ * */ +// Package grpclog provides logging functionality for internal gRPC packages, +// outside of the functionality provided by the external `grpclog` package. package grpclog import ( "fmt" + + "google.golang.org/grpc/grpclog" ) // PrefixLogger does logging with a prefix. // // Logging method on a nil logs without any prefix. type PrefixLogger struct { - logger DepthLoggerV2 + logger grpclog.DepthLoggerV2 prefix string } @@ -38,7 +42,7 @@ func (pl *PrefixLogger) Infof(format string, args ...any) { pl.logger.InfoDepth(1, fmt.Sprintf(format, args...)) return } - InfoDepth(1, fmt.Sprintf(format, args...)) + grpclog.InfoDepth(1, fmt.Sprintf(format, args...)) } // Warningf does warning logging. @@ -48,7 +52,7 @@ func (pl *PrefixLogger) Warningf(format string, args ...any) { pl.logger.WarningDepth(1, fmt.Sprintf(format, args...)) return } - WarningDepth(1, fmt.Sprintf(format, args...)) + grpclog.WarningDepth(1, fmt.Sprintf(format, args...)) } // Errorf does error logging. @@ -58,36 +62,18 @@ func (pl *PrefixLogger) Errorf(format string, args ...any) { pl.logger.ErrorDepth(1, fmt.Sprintf(format, args...)) return } - ErrorDepth(1, fmt.Sprintf(format, args...)) -} - -// Debugf does info logging at verbose level 2. -func (pl *PrefixLogger) Debugf(format string, args ...any) { - // TODO(6044): Refactor interfaces LoggerV2 and DepthLogger, and maybe - // rewrite PrefixLogger a little to ensure that we don't use the global - // `Logger` here, and instead use the `logger` field. - if !Logger.V(2) { - return - } - if pl != nil { - // Handle nil, so the tests can pass in a nil logger. - format = pl.prefix + format - pl.logger.InfoDepth(1, fmt.Sprintf(format, args...)) - return - } - InfoDepth(1, fmt.Sprintf(format, args...)) - + grpclog.ErrorDepth(1, fmt.Sprintf(format, args...)) } // V reports whether verbosity level l is at least the requested verbose level. func (pl *PrefixLogger) V(l int) bool { - // TODO(6044): Refactor interfaces LoggerV2 and DepthLogger, and maybe - // rewrite PrefixLogger a little to ensure that we don't use the global - // `Logger` here, and instead use the `logger` field. - return Logger.V(l) + if pl != nil { + return pl.logger.V(l) + } + return true } // NewPrefixLogger creates a prefix logger with the given prefix. -func NewPrefixLogger(logger DepthLoggerV2, prefix string) *PrefixLogger { +func NewPrefixLogger(logger grpclog.DepthLoggerV2, prefix string) *PrefixLogger { return &PrefixLogger{logger: logger, prefix: prefix} } diff --git a/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go b/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go deleted file mode 100644 index 0126d6b5..00000000 --- a/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go +++ /dev/null @@ -1,100 +0,0 @@ -//go:build !go1.21 - -// TODO: when this file is deleted (after Go 1.20 support is dropped), delete -// all of grpcrand and call the rand package directly. - -/* - * - * Copyright 2018 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// Package grpcrand implements math/rand functions in a concurrent-safe way -// with a global random source, independent of math/rand's global source. -package grpcrand - -import ( - "math/rand" - "sync" - "time" -) - -var ( - r = rand.New(rand.NewSource(time.Now().UnixNano())) - mu sync.Mutex -) - -// Int implements rand.Int on the grpcrand global source. -func Int() int { - mu.Lock() - defer mu.Unlock() - return r.Int() -} - -// Int63n implements rand.Int63n on the grpcrand global source. -func Int63n(n int64) int64 { - mu.Lock() - defer mu.Unlock() - return r.Int63n(n) -} - -// Intn implements rand.Intn on the grpcrand global source. -func Intn(n int) int { - mu.Lock() - defer mu.Unlock() - return r.Intn(n) -} - -// Int31n implements rand.Int31n on the grpcrand global source. -func Int31n(n int32) int32 { - mu.Lock() - defer mu.Unlock() - return r.Int31n(n) -} - -// Float64 implements rand.Float64 on the grpcrand global source. -func Float64() float64 { - mu.Lock() - defer mu.Unlock() - return r.Float64() -} - -// Uint64 implements rand.Uint64 on the grpcrand global source. -func Uint64() uint64 { - mu.Lock() - defer mu.Unlock() - return r.Uint64() -} - -// Uint32 implements rand.Uint32 on the grpcrand global source. -func Uint32() uint32 { - mu.Lock() - defer mu.Unlock() - return r.Uint32() -} - -// ExpFloat64 implements rand.ExpFloat64 on the grpcrand global source. -func ExpFloat64() float64 { - mu.Lock() - defer mu.Unlock() - return r.ExpFloat64() -} - -// Shuffle implements rand.Shuffle on the grpcrand global source. -var Shuffle = func(n int, f func(int, int)) { - mu.Lock() - defer mu.Unlock() - r.Shuffle(n, f) -} diff --git a/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand_go1.21.go b/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand_go1.21.go deleted file mode 100644 index c37299af..00000000 --- a/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand_go1.21.go +++ /dev/null @@ -1,73 +0,0 @@ -//go:build go1.21 - -/* - * - * Copyright 2024 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// Package grpcrand implements math/rand functions in a concurrent-safe way -// with a global random source, independent of math/rand's global source. -package grpcrand - -import "math/rand" - -// This implementation will be used for Go version 1.21 or newer. -// For older versions, the original implementation with mutex will be used. - -// Int implements rand.Int on the grpcrand global source. -func Int() int { - return rand.Int() -} - -// Int63n implements rand.Int63n on the grpcrand global source. -func Int63n(n int64) int64 { - return rand.Int63n(n) -} - -// Intn implements rand.Intn on the grpcrand global source. -func Intn(n int) int { - return rand.Intn(n) -} - -// Int31n implements rand.Int31n on the grpcrand global source. -func Int31n(n int32) int32 { - return rand.Int31n(n) -} - -// Float64 implements rand.Float64 on the grpcrand global source. -func Float64() float64 { - return rand.Float64() -} - -// Uint64 implements rand.Uint64 on the grpcrand global source. -func Uint64() uint64 { - return rand.Uint64() -} - -// Uint32 implements rand.Uint32 on the grpcrand global source. -func Uint32() uint32 { - return rand.Uint32() -} - -// ExpFloat64 implements rand.ExpFloat64 on the grpcrand global source. -func ExpFloat64() float64 { - return rand.ExpFloat64() -} - -// Shuffle implements rand.Shuffle on the grpcrand global source. -var Shuffle = func(n int, f func(int, int)) { - rand.Shuffle(n, f) -} diff --git a/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go b/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go index f7f40a16..19b9d639 100644 --- a/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go +++ b/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go @@ -53,16 +53,28 @@ func NewCallbackSerializer(ctx context.Context) *CallbackSerializer { return cs } -// Schedule adds a callback to be scheduled after existing callbacks are run. +// TrySchedule tries to schedules the provided callback function f to be +// executed in the order it was added. This is a best-effort operation. If the +// context passed to NewCallbackSerializer was canceled before this method is +// called, the callback will not be scheduled. // // Callbacks are expected to honor the context when performing any blocking // operations, and should return early when the context is canceled. +func (cs *CallbackSerializer) TrySchedule(f func(ctx context.Context)) { + cs.callbacks.Put(f) +} + +// ScheduleOr schedules the provided callback function f to be executed in the +// order it was added. If the context passed to NewCallbackSerializer has been +// canceled before this method is called, the onFailure callback will be +// executed inline instead. // -// Return value indicates if the callback was successfully added to the list of -// callbacks to be executed by the serializer. It is not possible to add -// callbacks once the context passed to NewCallbackSerializer is cancelled. -func (cs *CallbackSerializer) Schedule(f func(ctx context.Context)) bool { - return cs.callbacks.Put(f) == nil +// Callbacks are expected to honor the context when performing any blocking +// operations, and should return early when the context is canceled. +func (cs *CallbackSerializer) ScheduleOr(f func(ctx context.Context), onFailure func()) { + if cs.callbacks.Put(f) != nil { + onFailure() + } } func (cs *CallbackSerializer) run(ctx context.Context) { diff --git a/vendor/google.golang.org/grpc/internal/grpcsync/pubsub.go b/vendor/google.golang.org/grpc/internal/grpcsync/pubsub.go index aef8cec1..6d8c2f51 100644 --- a/vendor/google.golang.org/grpc/internal/grpcsync/pubsub.go +++ b/vendor/google.golang.org/grpc/internal/grpcsync/pubsub.go @@ -77,7 +77,7 @@ func (ps *PubSub) Subscribe(sub Subscriber) (cancel func()) { if ps.msg != nil { msg := ps.msg - ps.cs.Schedule(func(context.Context) { + ps.cs.TrySchedule(func(context.Context) { ps.mu.Lock() defer ps.mu.Unlock() if !ps.subscribers[sub] { @@ -103,7 +103,7 @@ func (ps *PubSub) Publish(msg any) { ps.msg = msg for sub := range ps.subscribers { s := sub - ps.cs.Schedule(func(context.Context) { + ps.cs.TrySchedule(func(context.Context) { ps.mu.Lock() defer ps.mu.Unlock() if !ps.subscribers[s] { diff --git a/vendor/google.golang.org/grpc/internal/internal.go b/vendor/google.golang.org/grpc/internal/internal.go index 48d24bdb..7aae9240 100644 --- a/vendor/google.golang.org/grpc/internal/internal.go +++ b/vendor/google.golang.org/grpc/internal/internal.go @@ -106,6 +106,14 @@ var ( // This is used in the 1.0 release of gcp/observability, and thus must not be // deleted or changed. ClearGlobalDialOptions func() + + // AddGlobalPerTargetDialOptions adds a PerTargetDialOption that will be + // configured for newly created ClientConns. + AddGlobalPerTargetDialOptions any // func (opt any) + // ClearGlobalPerTargetDialOptions clears the slice of global late apply + // dial options. + ClearGlobalPerTargetDialOptions func() + // JoinDialOptions combines the dial options passed as arguments into a // single dial option. JoinDialOptions any // func(...grpc.DialOption) grpc.DialOption @@ -126,7 +134,8 @@ var ( // deleted or changed. BinaryLogger any // func(binarylog.Logger) grpc.ServerOption - // SubscribeToConnectivityStateChanges adds a grpcsync.Subscriber to a provided grpc.ClientConn + // SubscribeToConnectivityStateChanges adds a grpcsync.Subscriber to a + // provided grpc.ClientConn. SubscribeToConnectivityStateChanges any // func(*grpc.ClientConn, grpcsync.Subscriber) // NewXDSResolverWithConfigForTesting creates a new xds resolver builder using @@ -174,7 +183,7 @@ var ( // GRPCResolverSchemeExtraMetadata determines when gRPC will add extra // metadata to RPCs. - GRPCResolverSchemeExtraMetadata string = "xds" + GRPCResolverSchemeExtraMetadata = "xds" // EnterIdleModeForTesting gets the ClientConn to enter IDLE mode. EnterIdleModeForTesting any // func(*grpc.ClientConn) @@ -184,25 +193,45 @@ var ( ChannelzTurnOffForTesting func() - // TriggerXDSResourceNameNotFoundForTesting triggers the resource-not-found - // error for a given resource type and name. This is usually triggered when - // the associated watch timer fires. For testing purposes, having this - // function makes events more predictable than relying on timer events. - TriggerXDSResourceNameNotFoundForTesting any // func(func(xdsresource.Type, string), string, string) error + // TriggerXDSResourceNotFoundForTesting causes the provided xDS Client to + // invoke resource-not-found error for the given resource type and name. + TriggerXDSResourceNotFoundForTesting any // func(xdsclient.XDSClient, xdsresource.Type, string) error - // TriggerXDSResourceNameNotFoundClient invokes the testing xDS Client - // singleton to invoke resource not found for a resource type name and - // resource name. - TriggerXDSResourceNameNotFoundClient any // func(string, string) error - - // FromOutgoingContextRaw returns the un-merged, intermediary contents of metadata.rawMD. + // FromOutgoingContextRaw returns the un-merged, intermediary contents of + // metadata.rawMD. FromOutgoingContextRaw any // func(context.Context) (metadata.MD, [][]string, bool) - // UserSetDefaultScheme is set to true if the user has overridden the default resolver scheme. - UserSetDefaultScheme bool = false + // UserSetDefaultScheme is set to true if the user has overridden the + // default resolver scheme. + UserSetDefaultScheme = false + + // ShuffleAddressListForTesting pseudo-randomizes the order of addresses. n + // is the number of elements. swap swaps the elements with indexes i and j. + ShuffleAddressListForTesting any // func(n int, swap func(i, j int)) + + // ConnectedAddress returns the connected address for a SubConnState. The + // address is only valid if the state is READY. + ConnectedAddress any // func (scs SubConnState) resolver.Address + + // SetConnectedAddress sets the connected address for a SubConnState. + SetConnectedAddress any // func(scs *SubConnState, addr resolver.Address) + + // SnapshotMetricRegistryForTesting snapshots the global data of the metric + // registry. Returns a cleanup function that sets the metric registry to its + // original state. Only called in testing functions. + SnapshotMetricRegistryForTesting func() func() + + // SetDefaultBufferPoolForTesting updates the default buffer pool, for + // testing purposes. + SetDefaultBufferPoolForTesting any // func(mem.BufferPool) + + // SetBufferPoolingThresholdForTesting updates the buffer pooling threshold, for + // testing purposes. + SetBufferPoolingThresholdForTesting any // func(int) ) -// HealthChecker defines the signature of the client-side LB channel health checking function. +// HealthChecker defines the signature of the client-side LB channel health +// checking function. // // The implementation is expected to create a health checking RPC stream by // calling newStream(), watch for the health status of serviceName, and report diff --git a/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go b/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go index f3f52a59..4552db16 100644 --- a/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go +++ b/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go @@ -24,6 +24,7 @@ import ( "context" "encoding/json" "fmt" + "math/rand" "net" "os" "strconv" @@ -35,7 +36,6 @@ import ( "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal/backoff" "google.golang.org/grpc/internal/envconfig" - "google.golang.org/grpc/internal/grpcrand" "google.golang.org/grpc/internal/resolver/dns/internal" "google.golang.org/grpc/resolver" "google.golang.org/grpc/serviceconfig" @@ -63,6 +63,8 @@ var ( func init() { resolver.Register(NewBuilder()) internal.TimeAfterFunc = time.After + internal.TimeNowFunc = time.Now + internal.TimeUntilFunc = time.Until internal.NewNetResolver = newNetResolver internal.AddressDialer = addressDialer } @@ -209,12 +211,12 @@ func (d *dnsResolver) watcher() { err = d.cc.UpdateState(*state) } - var waitTime time.Duration + var nextResolutionTime time.Time if err == nil { // Success resolving, wait for the next ResolveNow. However, also wait 30 // seconds at the very least to prevent constantly re-resolving. backoffIndex = 1 - waitTime = MinResolutionInterval + nextResolutionTime = internal.TimeNowFunc().Add(MinResolutionInterval) select { case <-d.ctx.Done(): return @@ -223,13 +225,13 @@ func (d *dnsResolver) watcher() { } else { // Poll on an error found in DNS Resolver or an error received from // ClientConn. - waitTime = backoff.DefaultExponential.Backoff(backoffIndex) + nextResolutionTime = internal.TimeNowFunc().Add(backoff.DefaultExponential.Backoff(backoffIndex)) backoffIndex++ } select { case <-d.ctx.Done(): return - case <-internal.TimeAfterFunc(waitTime): + case <-internal.TimeAfterFunc(internal.TimeUntilFunc(nextResolutionTime)): } } } @@ -423,7 +425,7 @@ func chosenByPercentage(a *int) bool { if a == nil { return true } - return grpcrand.Intn(100)+1 <= *a + return rand.Intn(100)+1 <= *a } func canaryingSC(js string) string { diff --git a/vendor/google.golang.org/grpc/internal/resolver/dns/internal/internal.go b/vendor/google.golang.org/grpc/internal/resolver/dns/internal/internal.go index a7ecaf8d..c0eae4f5 100644 --- a/vendor/google.golang.org/grpc/internal/resolver/dns/internal/internal.go +++ b/vendor/google.golang.org/grpc/internal/resolver/dns/internal/internal.go @@ -51,11 +51,22 @@ var ( // The following vars are overridden from tests. var ( // TimeAfterFunc is used by the DNS resolver to wait for the given duration - // to elapse. In non-test code, this is implemented by time.After. In test + // to elapse. In non-test code, this is implemented by time.After. In test // code, this can be used to control the amount of time the resolver is // blocked waiting for the duration to elapse. TimeAfterFunc func(time.Duration) <-chan time.Time + // TimeNowFunc is used by the DNS resolver to get the current time. + // In non-test code, this is implemented by time.Now. In test code, + // this can be used to control the current time for the resolver. + TimeNowFunc func() time.Time + + // TimeUntilFunc is used by the DNS resolver to calculate the remaining + // wait time for re-resolution. In non-test code, this is implemented by + // time.Until. In test code, this can be used to control the remaining + // time for resolver to wait for re-resolution. + TimeUntilFunc func(time.Time) time.Duration + // NewNetResolver returns the net.Resolver instance for the given target. NewNetResolver func(string) (NetResolver, error) diff --git a/vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go b/vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go index afac5657..b901c7ba 100644 --- a/vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go +++ b/vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go @@ -55,7 +55,7 @@ func (r *passthroughResolver) start() { r.cc.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: r.target.Endpoint()}}}) } -func (*passthroughResolver) ResolveNow(o resolver.ResolveNowOptions) {} +func (*passthroughResolver) ResolveNow(resolver.ResolveNowOptions) {} func (*passthroughResolver) Close() {} diff --git a/vendor/google.golang.org/grpc/internal/stats/labels.go b/vendor/google.golang.org/grpc/internal/stats/labels.go new file mode 100644 index 00000000..fd33af51 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/stats/labels.go @@ -0,0 +1,42 @@ +/* + * + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package stats provides internal stats related functionality. +package stats + +import "context" + +// Labels are the labels for metrics. +type Labels struct { + // TelemetryLabels are the telemetry labels to record. + TelemetryLabels map[string]string +} + +type labelsKey struct{} + +// GetLabels returns the Labels stored in the context, or nil if there is one. +func GetLabels(ctx context.Context) *Labels { + labels, _ := ctx.Value(labelsKey{}).(*Labels) + return labels +} + +// SetLabels sets the Labels in the context. +func SetLabels(ctx context.Context, labels *Labels) context.Context { + // could also append + return context.WithValue(ctx, labelsKey{}, labels) +} diff --git a/vendor/google.golang.org/grpc/internal/stats/metrics_recorder_list.go b/vendor/google.golang.org/grpc/internal/stats/metrics_recorder_list.go new file mode 100644 index 00000000..be110d41 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/stats/metrics_recorder_list.go @@ -0,0 +1,95 @@ +/* + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package stats + +import ( + "fmt" + + estats "google.golang.org/grpc/experimental/stats" + "google.golang.org/grpc/stats" +) + +// MetricsRecorderList forwards Record calls to all of its metricsRecorders. +// +// It eats any record calls where the label values provided do not match the +// number of label keys. +type MetricsRecorderList struct { + // metricsRecorders are the metrics recorders this list will forward to. + metricsRecorders []estats.MetricsRecorder +} + +// NewMetricsRecorderList creates a new metric recorder list with all the stats +// handlers provided which implement the MetricsRecorder interface. +// If no stats handlers provided implement the MetricsRecorder interface, +// the MetricsRecorder list returned is a no-op. +func NewMetricsRecorderList(shs []stats.Handler) *MetricsRecorderList { + var mrs []estats.MetricsRecorder + for _, sh := range shs { + if mr, ok := sh.(estats.MetricsRecorder); ok { + mrs = append(mrs, mr) + } + } + return &MetricsRecorderList{ + metricsRecorders: mrs, + } +} + +func verifyLabels(desc *estats.MetricDescriptor, labelsRecv ...string) { + if got, want := len(labelsRecv), len(desc.Labels)+len(desc.OptionalLabels); got != want { + panic(fmt.Sprintf("Received %d labels in call to record metric %q, but expected %d.", got, desc.Name, want)) + } +} + +func (l *MetricsRecorderList) RecordInt64Count(handle *estats.Int64CountHandle, incr int64, labels ...string) { + verifyLabels(handle.Descriptor(), labels...) + + for _, metricRecorder := range l.metricsRecorders { + metricRecorder.RecordInt64Count(handle, incr, labels...) + } +} + +func (l *MetricsRecorderList) RecordFloat64Count(handle *estats.Float64CountHandle, incr float64, labels ...string) { + verifyLabels(handle.Descriptor(), labels...) + + for _, metricRecorder := range l.metricsRecorders { + metricRecorder.RecordFloat64Count(handle, incr, labels...) + } +} + +func (l *MetricsRecorderList) RecordInt64Histo(handle *estats.Int64HistoHandle, incr int64, labels ...string) { + verifyLabels(handle.Descriptor(), labels...) + + for _, metricRecorder := range l.metricsRecorders { + metricRecorder.RecordInt64Histo(handle, incr, labels...) + } +} + +func (l *MetricsRecorderList) RecordFloat64Histo(handle *estats.Float64HistoHandle, incr float64, labels ...string) { + verifyLabels(handle.Descriptor(), labels...) + + for _, metricRecorder := range l.metricsRecorders { + metricRecorder.RecordFloat64Histo(handle, incr, labels...) + } +} + +func (l *MetricsRecorderList) RecordInt64Gauge(handle *estats.Int64GaugeHandle, incr int64, labels ...string) { + verifyLabels(handle.Descriptor(), labels...) + + for _, metricRecorder := range l.metricsRecorders { + metricRecorder.RecordInt64Gauge(handle, incr, labels...) + } +} diff --git a/vendor/google.golang.org/grpc/internal/status/status.go b/vendor/google.golang.org/grpc/internal/status/status.go index c7dbc820..75792538 100644 --- a/vendor/google.golang.org/grpc/internal/status/status.go +++ b/vendor/google.golang.org/grpc/internal/status/status.go @@ -138,11 +138,11 @@ func (s *Status) WithDetails(details ...protoadapt.MessageV1) (*Status, error) { // s.Code() != OK implies that s.Proto() != nil. p := s.Proto() for _, detail := range details { - any, err := anypb.New(protoadapt.MessageV2Of(detail)) + m, err := anypb.New(protoadapt.MessageV2Of(detail)) if err != nil { return nil, err } - p.Details = append(p.Details, any) + p.Details = append(p.Details, m) } return &Status{s: p}, nil } diff --git a/vendor/google.golang.org/grpc/internal/syscall/syscall_nonlinux.go b/vendor/google.golang.org/grpc/internal/syscall/syscall_nonlinux.go index 999f52cd..54c24c2f 100644 --- a/vendor/google.golang.org/grpc/internal/syscall/syscall_nonlinux.go +++ b/vendor/google.golang.org/grpc/internal/syscall/syscall_nonlinux.go @@ -58,20 +58,20 @@ func GetRusage() *Rusage { // CPUTimeDiff returns the differences of user CPU time and system CPU time used // between two Rusage structs. It a no-op function for non-linux environments. -func CPUTimeDiff(first *Rusage, latest *Rusage) (float64, float64) { +func CPUTimeDiff(*Rusage, *Rusage) (float64, float64) { log() return 0, 0 } // SetTCPUserTimeout is a no-op function under non-linux environments. -func SetTCPUserTimeout(conn net.Conn, timeout time.Duration) error { +func SetTCPUserTimeout(net.Conn, time.Duration) error { log() return nil } // GetTCPUserTimeout is a no-op function under non-linux environments. // A negative return value indicates the operation is not supported -func GetTCPUserTimeout(conn net.Conn) (int, error) { +func GetTCPUserTimeout(net.Conn) (int, error) { log() return -1, nil } diff --git a/vendor/google.golang.org/grpc/internal/tcp_keepalive_unix.go b/vendor/google.golang.org/grpc/internal/tcp_keepalive_unix.go index 078137b7..7e7aaa54 100644 --- a/vendor/google.golang.org/grpc/internal/tcp_keepalive_unix.go +++ b/vendor/google.golang.org/grpc/internal/tcp_keepalive_unix.go @@ -44,7 +44,7 @@ func NetDialerWithTCPKeepalive() *net.Dialer { // combination of unconditionally enabling TCP keepalives here, and // disabling the overriding of TCP keepalive parameters by setting the // KeepAlive field to a negative value above, results in OS defaults for - // the TCP keealive interval and time parameters. + // the TCP keepalive interval and time parameters. Control: func(_, _ string, c syscall.RawConn) error { return c.Control(func(fd uintptr) { unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_KEEPALIVE, 1) diff --git a/vendor/google.golang.org/grpc/internal/tcp_keepalive_windows.go b/vendor/google.golang.org/grpc/internal/tcp_keepalive_windows.go index fd7d43a8..d5c1085e 100644 --- a/vendor/google.golang.org/grpc/internal/tcp_keepalive_windows.go +++ b/vendor/google.golang.org/grpc/internal/tcp_keepalive_windows.go @@ -44,7 +44,7 @@ func NetDialerWithTCPKeepalive() *net.Dialer { // combination of unconditionally enabling TCP keepalives here, and // disabling the overriding of TCP keepalive parameters by setting the // KeepAlive field to a negative value above, results in OS defaults for - // the TCP keealive interval and time parameters. + // the TCP keepalive interval and time parameters. Control: func(_, _ string, c syscall.RawConn) error { return c.Control(func(fd uintptr) { windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_KEEPALIVE, 1) diff --git a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go index 3deadfb4..ef72fbb3 100644 --- a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go +++ b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go @@ -32,6 +32,7 @@ import ( "golang.org/x/net/http2/hpack" "google.golang.org/grpc/internal/grpclog" "google.golang.org/grpc/internal/grpcutil" + "google.golang.org/grpc/mem" "google.golang.org/grpc/status" ) @@ -148,9 +149,9 @@ type dataFrame struct { streamID uint32 endStream bool h []byte - d []byte + reader mem.Reader // onEachWrite is called every time - // a part of d is written out. + // a part of data is written out. onEachWrite func() } @@ -289,18 +290,22 @@ func (l *outStreamList) dequeue() *outStream { } // controlBuffer is a way to pass information to loopy. -// Information is passed as specific struct types called control frames. -// A control frame not only represents data, messages or headers to be sent out -// but can also be used to instruct loopy to update its internal state. -// It shouldn't be confused with an HTTP2 frame, although some of the control frames -// like dataFrame and headerFrame do go out on wire as HTTP2 frames. +// +// Information is passed as specific struct types called control frames. A +// control frame not only represents data, messages or headers to be sent out +// but can also be used to instruct loopy to update its internal state. It +// shouldn't be confused with an HTTP2 frame, although some of the control +// frames like dataFrame and headerFrame do go out on wire as HTTP2 frames. type controlBuffer struct { - ch chan struct{} - done <-chan struct{} + wakeupCh chan struct{} // Unblocks readers waiting for something to read. + done <-chan struct{} // Closed when the transport is done. + + // Mutex guards all the fields below, except trfChan which can be read + // atomically without holding mu. mu sync.Mutex - consumerWaiting bool - list *itemList - err error + consumerWaiting bool // True when readers are blocked waiting for new data. + closed bool // True when the controlbuf is finished. + list *itemList // List of queued control frames. // transportResponseFrames counts the number of queued items that represent // the response of an action initiated by the peer. trfChan is created @@ -308,47 +313,59 @@ type controlBuffer struct { // closed and nilled when transportResponseFrames drops below the // threshold. Both fields are protected by mu. transportResponseFrames int - trfChan atomic.Value // chan struct{} + trfChan atomic.Pointer[chan struct{}] } func newControlBuffer(done <-chan struct{}) *controlBuffer { return &controlBuffer{ - ch: make(chan struct{}, 1), - list: &itemList{}, - done: done, + wakeupCh: make(chan struct{}, 1), + list: &itemList{}, + done: done, } } -// throttle blocks if there are too many incomingSettings/cleanupStreams in the -// controlbuf. +// throttle blocks if there are too many frames in the control buf that +// represent the response of an action initiated by the peer, like +// incomingSettings cleanupStreams etc. func (c *controlBuffer) throttle() { - ch, _ := c.trfChan.Load().(chan struct{}) - if ch != nil { + if ch := c.trfChan.Load(); ch != nil { select { - case <-ch: + case <-(*ch): case <-c.done: } } } +// put adds an item to the controlbuf. func (c *controlBuffer) put(it cbItem) error { _, err := c.executeAndPut(nil, it) return err } +// executeAndPut runs f, and if the return value is true, adds the given item to +// the controlbuf. The item could be nil, in which case, this method simply +// executes f and does not add the item to the controlbuf. +// +// The first return value indicates whether the item was successfully added to +// the control buffer. A non-nil error, specifically ErrConnClosing, is returned +// if the control buffer is already closed. func (c *controlBuffer) executeAndPut(f func() bool, it cbItem) (bool, error) { - var wakeUp bool c.mu.Lock() - if c.err != nil { - c.mu.Unlock() - return false, c.err + defer c.mu.Unlock() + + if c.closed { + return false, ErrConnClosing } if f != nil { if !f() { // f wasn't successful - c.mu.Unlock() return false, nil } } + if it == nil { + return true, nil + } + + var wakeUp bool if c.consumerWaiting { wakeUp = true c.consumerWaiting = false @@ -359,98 +376,102 @@ func (c *controlBuffer) executeAndPut(f func() bool, it cbItem) (bool, error) { if c.transportResponseFrames == maxQueuedTransportResponseFrames { // We are adding the frame that puts us over the threshold; create // a throttling channel. - c.trfChan.Store(make(chan struct{})) + ch := make(chan struct{}) + c.trfChan.Store(&ch) } } - c.mu.Unlock() if wakeUp { select { - case c.ch <- struct{}{}: + case c.wakeupCh <- struct{}{}: default: } } return true, nil } -// Note argument f should never be nil. -func (c *controlBuffer) execute(f func(it any) bool, it any) (bool, error) { - c.mu.Lock() - if c.err != nil { - c.mu.Unlock() - return false, c.err - } - if !f(it) { // f wasn't successful - c.mu.Unlock() - return false, nil - } - c.mu.Unlock() - return true, nil -} - +// get returns the next control frame from the control buffer. If block is true +// **and** there are no control frames in the control buffer, the call blocks +// until one of the conditions is met: there is a frame to return or the +// transport is closed. func (c *controlBuffer) get(block bool) (any, error) { for { c.mu.Lock() - if c.err != nil { + frame, err := c.getOnceLocked() + if frame != nil || err != nil || !block { + // If we read a frame or an error, we can return to the caller. The + // call to getOnceLocked() returns a nil frame and a nil error if + // there is nothing to read, and in that case, if the caller asked + // us not to block, we can return now as well. c.mu.Unlock() - return nil, c.err - } - if !c.list.isEmpty() { - h := c.list.dequeue().(cbItem) - if h.isTransportResponseFrame() { - if c.transportResponseFrames == maxQueuedTransportResponseFrames { - // We are removing the frame that put us over the - // threshold; close and clear the throttling channel. - ch := c.trfChan.Load().(chan struct{}) - close(ch) - c.trfChan.Store((chan struct{})(nil)) - } - c.transportResponseFrames-- - } - c.mu.Unlock() - return h, nil - } - if !block { - c.mu.Unlock() - return nil, nil + return frame, err } c.consumerWaiting = true c.mu.Unlock() + + // Release the lock above and wait to be woken up. select { - case <-c.ch: + case <-c.wakeupCh: case <-c.done: return nil, errors.New("transport closed by client") } } } +// Callers must not use this method, but should instead use get(). +// +// Caller must hold c.mu. +func (c *controlBuffer) getOnceLocked() (any, error) { + if c.closed { + return false, ErrConnClosing + } + if c.list.isEmpty() { + return nil, nil + } + h := c.list.dequeue().(cbItem) + if h.isTransportResponseFrame() { + if c.transportResponseFrames == maxQueuedTransportResponseFrames { + // We are removing the frame that put us over the + // threshold; close and clear the throttling channel. + ch := c.trfChan.Swap(nil) + close(*ch) + } + c.transportResponseFrames-- + } + return h, nil +} + +// finish closes the control buffer, cleaning up any streams that have queued +// header frames. Once this method returns, no more frames can be added to the +// control buffer, and attempts to do so will return ErrConnClosing. func (c *controlBuffer) finish() { c.mu.Lock() - if c.err != nil { - c.mu.Unlock() + defer c.mu.Unlock() + + if c.closed { return } - c.err = ErrConnClosing + c.closed = true // There may be headers for streams in the control buffer. // These streams need to be cleaned out since the transport // is still not aware of these yet. for head := c.list.dequeueAll(); head != nil; head = head.next { - hdr, ok := head.it.(*headerFrame) - if !ok { - continue - } - if hdr.onOrphaned != nil { // It will be nil on the server-side. - hdr.onOrphaned(ErrConnClosing) + switch v := head.it.(type) { + case *headerFrame: + if v.onOrphaned != nil { // It will be nil on the server-side. + v.onOrphaned(ErrConnClosing) + } + case *dataFrame: + _ = v.reader.Close() } } + // In case throttle() is currently in flight, it needs to be unblocked. // Otherwise, the transport may not close, since the transport is closed by // the reader encountering the connection error. - ch, _ := c.trfChan.Load().(chan struct{}) + ch := c.trfChan.Swap(nil) if ch != nil { - close(ch) + close(*ch) } - c.trfChan.Store((chan struct{})(nil)) - c.mu.Unlock() } type side int @@ -466,7 +487,7 @@ const ( // stream maintains a queue of data frames; as loopy receives data frames // it gets added to the queue of the relevant stream. // Loopy goes over this list of active streams by processing one node every iteration, -// thereby closely resemebling to a round-robin scheduling over all streams. While +// thereby closely resembling a round-robin scheduling over all streams. While // processing a stream, loopy writes out data bytes from this stream capped by the min // of http2MaxFrameLen, connection-level flow control and stream-level flow control. type loopyWriter struct { @@ -490,12 +511,13 @@ type loopyWriter struct { draining bool conn net.Conn logger *grpclog.PrefixLogger + bufferPool mem.BufferPool // Side-specific handlers ssGoAwayHandler func(*goAway) (bool, error) } -func newLoopyWriter(s side, fr *framer, cbuf *controlBuffer, bdpEst *bdpEstimator, conn net.Conn, logger *grpclog.PrefixLogger, goAwayHandler func(*goAway) (bool, error)) *loopyWriter { +func newLoopyWriter(s side, fr *framer, cbuf *controlBuffer, bdpEst *bdpEstimator, conn net.Conn, logger *grpclog.PrefixLogger, goAwayHandler func(*goAway) (bool, error), bufferPool mem.BufferPool) *loopyWriter { var buf bytes.Buffer l := &loopyWriter{ side: s, @@ -511,6 +533,7 @@ func newLoopyWriter(s side, fr *framer, cbuf *controlBuffer, bdpEst *bdpEstimato conn: conn, logger: logger, ssGoAwayHandler: goAwayHandler, + bufferPool: bufferPool, } return l } @@ -768,6 +791,11 @@ func (l *loopyWriter) cleanupStreamHandler(c *cleanupStream) error { // not be established yet. delete(l.estdStreams, c.streamID) str.deleteSelf() + for head := str.itl.dequeueAll(); head != nil; head = head.next { + if df, ok := head.it.(*dataFrame); ok { + _ = df.reader.Close() + } + } } if c.rst { // If RST_STREAM needs to be sent. if err := l.framer.fr.WriteRSTStream(c.streamID, c.rstCode); err != nil { @@ -903,16 +931,18 @@ func (l *loopyWriter) processData() (bool, error) { dataItem := str.itl.peek().(*dataFrame) // Peek at the first data item this stream. // A data item is represented by a dataFrame, since it later translates into // multiple HTTP2 data frames. - // Every dataFrame has two buffers; h that keeps grpc-message header and d that is actual data. - // As an optimization to keep wire traffic low, data from d is copied to h to make as big as the - // maximum possible HTTP2 frame size. + // Every dataFrame has two buffers; h that keeps grpc-message header and data + // that is the actual message. As an optimization to keep wire traffic low, data + // from data is copied to h to make as big as the maximum possible HTTP2 frame + // size. - if len(dataItem.h) == 0 && len(dataItem.d) == 0 { // Empty data frame + if len(dataItem.h) == 0 && dataItem.reader.Remaining() == 0 { // Empty data frame // Client sends out empty data frame with endStream = true if err := l.framer.fr.WriteData(dataItem.streamID, dataItem.endStream, nil); err != nil { return false, err } str.itl.dequeue() // remove the empty data item from stream + _ = dataItem.reader.Close() if str.itl.isEmpty() { str.state = empty } else if trailer, ok := str.itl.peek().(*headerFrame); ok { // the next item is trailers. @@ -927,9 +957,7 @@ func (l *loopyWriter) processData() (bool, error) { } return false, nil } - var ( - buf []byte - ) + // Figure out the maximum size we can send maxSize := http2MaxFrameLen if strQuota := int(l.oiws) - str.bytesOutStanding; strQuota <= 0 { // stream-level flow control. @@ -943,43 +971,50 @@ func (l *loopyWriter) processData() (bool, error) { } // Compute how much of the header and data we can send within quota and max frame length hSize := min(maxSize, len(dataItem.h)) - dSize := min(maxSize-hSize, len(dataItem.d)) - if hSize != 0 { - if dSize == 0 { - buf = dataItem.h - } else { - // We can add some data to grpc message header to distribute bytes more equally across frames. - // Copy on the stack to avoid generating garbage - var localBuf [http2MaxFrameLen]byte - copy(localBuf[:hSize], dataItem.h) - copy(localBuf[hSize:], dataItem.d[:dSize]) - buf = localBuf[:hSize+dSize] - } - } else { - buf = dataItem.d - } - + dSize := min(maxSize-hSize, dataItem.reader.Remaining()) + remainingBytes := len(dataItem.h) + dataItem.reader.Remaining() - hSize - dSize size := hSize + dSize + var buf *[]byte + + if hSize != 0 && dSize == 0 { + buf = &dataItem.h + } else { + // Note: this is only necessary because the http2.Framer does not support + // partially writing a frame, so the sequence must be materialized into a buffer. + // TODO: Revisit once https://github.com/golang/go/issues/66655 is addressed. + pool := l.bufferPool + if pool == nil { + // Note that this is only supposed to be nil in tests. Otherwise, stream is + // always initialized with a BufferPool. + pool = mem.DefaultBufferPool() + } + buf = pool.Get(size) + defer pool.Put(buf) + + copy((*buf)[:hSize], dataItem.h) + _, _ = dataItem.reader.Read((*buf)[hSize:]) + } + // Now that outgoing flow controls are checked we can replenish str's write quota str.wq.replenish(size) var endStream bool // If this is the last data message on this stream and all of it can be written in this iteration. - if dataItem.endStream && len(dataItem.h)+len(dataItem.d) <= size { + if dataItem.endStream && remainingBytes == 0 { endStream = true } if dataItem.onEachWrite != nil { dataItem.onEachWrite() } - if err := l.framer.fr.WriteData(dataItem.streamID, endStream, buf[:size]); err != nil { + if err := l.framer.fr.WriteData(dataItem.streamID, endStream, (*buf)[:size]); err != nil { return false, err } str.bytesOutStanding += size l.sendQuota -= uint32(size) dataItem.h = dataItem.h[hSize:] - dataItem.d = dataItem.d[dSize:] - if len(dataItem.h) == 0 && len(dataItem.d) == 0 { // All the data from that message was written out. + if remainingBytes == 0 { // All the data from that message was written out. + _ = dataItem.reader.Close() str.itl.dequeue() } if str.itl.isEmpty() { @@ -998,10 +1033,3 @@ func (l *loopyWriter) processData() (bool, error) { } return false, nil } - -func min(a, b int) int { - if a < b { - return a - } - return b -} diff --git a/vendor/google.golang.org/grpc/internal/transport/handler_server.go b/vendor/google.golang.org/grpc/internal/transport/handler_server.go index 4a3ddce2..ce878693 100644 --- a/vendor/google.golang.org/grpc/internal/transport/handler_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/handler_server.go @@ -24,7 +24,6 @@ package transport import ( - "bytes" "context" "errors" "fmt" @@ -40,6 +39,7 @@ import ( "google.golang.org/grpc/credentials" "google.golang.org/grpc/internal/grpclog" "google.golang.org/grpc/internal/grpcutil" + "google.golang.org/grpc/mem" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" "google.golang.org/grpc/stats" @@ -50,7 +50,7 @@ import ( // NewServerHandlerTransport returns a ServerTransport handling gRPC from // inside an http.Handler, or writes an HTTP error to w and returns an error. // It requires that the http Server supports HTTP/2. -func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats []stats.Handler) (ServerTransport, error) { +func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats []stats.Handler, bufferPool mem.BufferPool) (ServerTransport, error) { if r.Method != http.MethodPost { w.Header().Set("Allow", http.MethodPost) msg := fmt.Sprintf("invalid gRPC request method %q", r.Method) @@ -98,6 +98,7 @@ func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats []s contentType: contentType, contentSubtype: contentSubtype, stats: stats, + bufferPool: bufferPool, } st.logger = prefixLoggerForServerHandlerTransport(st) @@ -171,6 +172,8 @@ type serverHandlerTransport struct { stats []stats.Handler logger *grpclog.PrefixLogger + + bufferPool mem.BufferPool } func (ht *serverHandlerTransport) Close(err error) { @@ -244,6 +247,7 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro } s.hdrMu.Lock() + defer s.hdrMu.Unlock() if p := st.Proto(); p != nil && len(p.Details) > 0 { delete(s.trailer, grpcStatusDetailsBinHeader) stBytes, err := proto.Marshal(p) @@ -268,7 +272,6 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro } } } - s.hdrMu.Unlock() }) if err == nil { // transport has not been closed @@ -330,16 +333,28 @@ func (ht *serverHandlerTransport) writeCustomHeaders(s *Stream) { s.hdrMu.Unlock() } -func (ht *serverHandlerTransport) Write(s *Stream, hdr []byte, data []byte, opts *Options) error { +func (ht *serverHandlerTransport) Write(s *Stream, hdr []byte, data mem.BufferSlice, _ *Options) error { + // Always take a reference because otherwise there is no guarantee the data will + // be available after this function returns. This is what callers to Write + // expect. + data.Ref() headersWritten := s.updateHeaderSent() - return ht.do(func() { + err := ht.do(func() { + defer data.Free() if !headersWritten { ht.writePendingHeaders(s) } ht.rw.Write(hdr) - ht.rw.Write(data) + for _, b := range data { + _, _ = ht.rw.Write(b.ReadOnlyData()) + } ht.rw.(http.Flusher).Flush() }) + if err != nil { + data.Free() + return err + } + return nil } func (ht *serverHandlerTransport) WriteHeader(s *Stream, md metadata.MD) error { @@ -406,7 +421,7 @@ func (ht *serverHandlerTransport) HandleStreams(ctx context.Context, startStream headerWireLength: 0, // won't have access to header wire length until golang/go#18997. } s.trReader = &transportReader{ - reader: &recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: s.buf, freeBuffer: func(*bytes.Buffer) {}}, + reader: &recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: s.buf}, windowHandler: func(int) {}, } @@ -415,21 +430,19 @@ func (ht *serverHandlerTransport) HandleStreams(ctx context.Context, startStream go func() { defer close(readerDone) - // TODO: minimize garbage, optimize recvBuffer code/ownership - const readSize = 8196 - for buf := make([]byte, readSize); ; { - n, err := req.Body.Read(buf) + for { + buf := ht.bufferPool.Get(http2MaxFrameLen) + n, err := req.Body.Read(*buf) if n > 0 { - s.buf.put(recvMsg{buffer: bytes.NewBuffer(buf[:n:n])}) - buf = buf[n:] + *buf = (*buf)[:n] + s.buf.put(recvMsg{buffer: mem.NewBuffer(buf, ht.bufferPool)}) + } else { + ht.bufferPool.Put(buf) } if err != nil { s.buf.put(recvMsg{err: mapRecvMsgError(err)}) return } - if len(buf) == 0 { - buf = make([]byte, readSize) - } } }() @@ -462,7 +475,7 @@ func (ht *serverHandlerTransport) IncrMsgSent() {} func (ht *serverHandlerTransport) IncrMsgRecv() {} -func (ht *serverHandlerTransport) Drain(debugData string) { +func (ht *serverHandlerTransport) Drain(string) { panic("Drain() is not implemented") } diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go index 3c63c706..c769deab 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_client.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_client.go @@ -47,6 +47,7 @@ import ( isyscall "google.golang.org/grpc/internal/syscall" "google.golang.org/grpc/internal/transport/networktype" "google.golang.org/grpc/keepalive" + "google.golang.org/grpc/mem" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" "google.golang.org/grpc/resolver" @@ -59,6 +60,8 @@ import ( // atomically. var clientConnectionCounter uint64 +var goAwayLoopyWriterTimeout = 5 * time.Second + var metadataFromOutgoingContextRaw = internal.FromOutgoingContextRaw.(func(context.Context) (metadata.MD, [][]string, bool)) // http2Client implements the ClientTransport interface with HTTP2. @@ -144,7 +147,7 @@ type http2Client struct { onClose func(GoAwayReason) - bufferPool *bufferPool + bufferPool mem.BufferPool connectionID uint64 logger *grpclog.PrefixLogger @@ -229,7 +232,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts } }(conn) - // The following defer and goroutine monitor the connectCtx for cancelation + // The following defer and goroutine monitor the connectCtx for cancellation // and deadline. On context expiration, the connection is hard closed and // this function will naturally fail as a result. Otherwise, the defer // waits for the goroutine to exit to prevent the context from being @@ -346,7 +349,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts streamQuota: defaultMaxStreamsClient, streamsQuotaAvailable: make(chan struct{}, 1), keepaliveEnabled: keepaliveEnabled, - bufferPool: newBufferPool(), + bufferPool: opts.BufferPool, onClose: onClose, } var czSecurity credentials.ChannelzSecurityValue @@ -463,7 +466,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts return nil, err } go func() { - t.loopy = newLoopyWriter(clientSide, t.framer, t.controlBuf, t.bdpEst, t.conn, t.logger, t.outgoingGoAwayHandler) + t.loopy = newLoopyWriter(clientSide, t.framer, t.controlBuf, t.bdpEst, t.conn, t.logger, t.outgoingGoAwayHandler, t.bufferPool) if err := t.loopy.run(); !isIOError(err) { // Immediately close the connection, as the loopy writer returns // when there are no more active streams and we were draining (the @@ -504,7 +507,6 @@ func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream { closeStream: func(err error) { t.CloseStream(s, err) }, - freeBuffer: t.bufferPool.put, }, windowHandler: func(n int) { t.updateWindow(s, uint32(n)) @@ -770,7 +772,7 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, hdr := &headerFrame{ hf: headerFields, endStream: false, - initStream: func(id uint32) error { + initStream: func(uint32) error { t.mu.Lock() // TODO: handle transport closure in loopy instead and remove this // initStream is never called when transport is draining. @@ -983,6 +985,7 @@ func (t *http2Client) closeStream(s *Stream, err error, rst bool, rstCode http2. // only once on a transport. Once it is called, the transport should not be // accessed anymore. func (t *http2Client) Close(err error) { + t.conn.SetWriteDeadline(time.Now().Add(time.Second * 10)) t.mu.Lock() // Make sure we only close once. if t.state == closing { @@ -1006,10 +1009,20 @@ func (t *http2Client) Close(err error) { t.kpDormancyCond.Signal() } t.mu.Unlock() + // Per HTTP/2 spec, a GOAWAY frame must be sent before closing the - // connection. See https://httpwg.org/specs/rfc7540.html#GOAWAY. + // connection. See https://httpwg.org/specs/rfc7540.html#GOAWAY. It + // also waits for loopyWriter to be closed with a timer to avoid the + // long blocking in case the connection is blackholed, i.e. TCP is + // just stuck. t.controlBuf.put(&goAway{code: http2.ErrCodeNo, debugData: []byte("client transport shutdown"), closeConn: err}) - <-t.writerDone + timer := time.NewTimer(goAwayLoopyWriterTimeout) + defer timer.Stop() + select { + case <-t.writerDone: // success + case <-timer.C: + t.logger.Infof("Failed to write a GOAWAY frame as part of connection close after %s. Giving up and closing the transport.", goAwayLoopyWriterTimeout) + } t.cancel() t.conn.Close() channelz.RemoveEntry(t.channelz.ID) @@ -1065,27 +1078,36 @@ func (t *http2Client) GracefulClose() { // Write formats the data into HTTP2 data frame(s) and sends it out. The caller // should proceed only if Write returns nil. -func (t *http2Client) Write(s *Stream, hdr []byte, data []byte, opts *Options) error { +func (t *http2Client) Write(s *Stream, hdr []byte, data mem.BufferSlice, opts *Options) error { + reader := data.Reader() + if opts.Last { // If it's the last message, update stream state. if !s.compareAndSwapState(streamActive, streamWriteDone) { + _ = reader.Close() return errStreamDone } } else if s.getState() != streamActive { + _ = reader.Close() return errStreamDone } df := &dataFrame{ streamID: s.id, endStream: opts.Last, h: hdr, - d: data, + reader: reader, } - if hdr != nil || data != nil { // If it's not an empty data frame, check quota. - if err := s.wq.get(int32(len(hdr) + len(data))); err != nil { + if hdr != nil || df.reader.Remaining() != 0 { // If it's not an empty data frame, check quota. + if err := s.wq.get(int32(len(hdr) + df.reader.Remaining())); err != nil { + _ = reader.Close() return err } } - return t.controlBuf.put(df) + if err := t.controlBuf.put(df); err != nil { + _ = reader.Close() + return err + } + return nil } func (t *http2Client) getStream(f http2.Frame) *Stream { @@ -1190,10 +1212,13 @@ func (t *http2Client) handleData(f *http2.DataFrame) { // guarantee f.Data() is consumed before the arrival of next frame. // Can this copy be eliminated? if len(f.Data()) > 0 { - buffer := t.bufferPool.get() - buffer.Reset() - buffer.Write(f.Data()) - s.write(recvMsg{buffer: buffer}) + pool := t.bufferPool + if pool == nil { + // Note that this is only supposed to be nil in tests. Otherwise, stream is + // always initialized with a BufferPool. + pool = mem.DefaultBufferPool() + } + s.write(recvMsg{buffer: mem.Copy(f.Data(), pool)}) } } // The server has closed the stream without sending trailers. Record that @@ -1222,7 +1247,7 @@ func (t *http2Client) handleRSTStream(f *http2.RSTStreamFrame) { if statusCode == codes.Canceled { if d, ok := s.ctx.Deadline(); ok && !d.After(time.Now()) { // Our deadline was already exceeded, and that was likely the cause - // of this cancelation. Alter the status code accordingly. + // of this cancellation. Alter the status code accordingly. statusCode = codes.DeadlineExceeded } } @@ -1307,7 +1332,7 @@ func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) { id := f.LastStreamID if id > 0 && id%2 == 0 { t.mu.Unlock() - t.Close(connectionErrorf(true, nil, "received goaway with non-zero even-numbered numbered stream id: %v", id)) + t.Close(connectionErrorf(true, nil, "received goaway with non-zero even-numbered stream id: %v", id)) return } // A client can receive multiple GoAways from the server (see @@ -1642,11 +1667,10 @@ func (t *http2Client) reader(errCh chan<- error) { t.closeStream(s, status.Error(code, msg), true, http2.ErrCodeProtocol, status.New(code, msg), nil, false) } continue - } else { - // Transport error. - t.Close(connectionErrorf(true, err, "error reading from server: %v", err)) - return } + // Transport error. + t.Close(connectionErrorf(true, err, "error reading from server: %v", err)) + return } switch frame := frame.(type) { case *http2.MetaHeadersFrame: @@ -1671,13 +1695,6 @@ func (t *http2Client) reader(errCh chan<- error) { } } -func minTime(a, b time.Duration) time.Duration { - if a < b { - return a - } - return b -} - // keepalive running in a separate goroutine makes sure the connection is alive by sending pings. func (t *http2Client) keepalive() { p := &ping{data: [8]byte{}} @@ -1745,7 +1762,7 @@ func (t *http2Client) keepalive() { // timeoutLeft. This will ensure that we wait only for kp.Time // before sending out the next ping (for cases where the ping is // acked). - sleepDuration := minTime(t.kp.Time, timeoutLeft) + sleepDuration := min(t.kp.Time, timeoutLeft) timeoutLeft -= sleepDuration timer.Reset(sleepDuration) case <-t.ctx.Done(): diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go index cab0e2d3..584b50fe 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_server.go @@ -25,6 +25,7 @@ import ( "fmt" "io" "math" + "math/rand" "net" "net/http" "strconv" @@ -38,12 +39,12 @@ import ( "google.golang.org/grpc/internal/grpcutil" "google.golang.org/grpc/internal/pretty" "google.golang.org/grpc/internal/syscall" + "google.golang.org/grpc/mem" "google.golang.org/protobuf/proto" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" "google.golang.org/grpc/internal/channelz" - "google.golang.org/grpc/internal/grpcrand" "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" @@ -119,7 +120,7 @@ type http2Server struct { // Fields below are for channelz metric collection. channelz *channelz.Socket - bufferPool *bufferPool + bufferPool mem.BufferPool connectionID uint64 @@ -261,7 +262,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, idle: time.Now(), kep: kep, initialWindowSize: iwz, - bufferPool: newBufferPool(), + bufferPool: config.BufferPool, } var czSecurity credentials.ChannelzSecurityValue if au, ok := authInfo.(credentials.ChannelzSecurityInfo); ok { @@ -330,7 +331,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, t.handleSettings(sf) go func() { - t.loopy = newLoopyWriter(serverSide, t.framer, t.controlBuf, t.bdpEst, t.conn, t.logger, t.outgoingGoAwayHandler) + t.loopy = newLoopyWriter(serverSide, t.framer, t.controlBuf, t.bdpEst, t.conn, t.logger, t.outgoingGoAwayHandler, t.bufferPool) err := t.loopy.run() close(t.loopyWriterDone) if !isIOError(err) { @@ -613,10 +614,9 @@ func (t *http2Server) operateHeaders(ctx context.Context, frame *http2.MetaHeade s.wq = newWriteQuota(defaultWriteQuota, s.ctxDone) s.trReader = &transportReader{ reader: &recvBufferReader{ - ctx: s.ctx, - ctxDone: s.ctxDone, - recv: s.buf, - freeBuffer: t.bufferPool.put, + ctx: s.ctx, + ctxDone: s.ctxDone, + recv: s.buf, }, windowHandler: func(n int) { t.updateWindow(s, uint32(n)) @@ -813,10 +813,13 @@ func (t *http2Server) handleData(f *http2.DataFrame) { // guarantee f.Data() is consumed before the arrival of next frame. // Can this copy be eliminated? if len(f.Data()) > 0 { - buffer := t.bufferPool.get() - buffer.Reset() - buffer.Write(f.Data()) - s.write(recvMsg{buffer: buffer}) + pool := t.bufferPool + if pool == nil { + // Note that this is only supposed to be nil in tests. Otherwise, stream is + // always initialized with a BufferPool. + pool = mem.DefaultBufferPool() + } + s.write(recvMsg{buffer: mem.Copy(f.Data(), pool)}) } } if f.StreamEnded() { @@ -1089,7 +1092,9 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { onWrite: t.setResetPingStrikes, } - success, err := t.controlBuf.execute(t.checkForHeaderListSize, trailingHeader) + success, err := t.controlBuf.executeAndPut(func() bool { + return t.checkForHeaderListSize(trailingHeader) + }, nil) if !success { if err != nil { return err @@ -1112,27 +1117,37 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { // Write converts the data into HTTP2 data frame and sends it out. Non-nil error // is returns if it fails (e.g., framing error, transport error). -func (t *http2Server) Write(s *Stream, hdr []byte, data []byte, opts *Options) error { +func (t *http2Server) Write(s *Stream, hdr []byte, data mem.BufferSlice, _ *Options) error { + reader := data.Reader() + if !s.isHeaderSent() { // Headers haven't been written yet. if err := t.WriteHeader(s, nil); err != nil { + _ = reader.Close() return err } } else { // Writing headers checks for this condition. if s.getState() == streamDone { + _ = reader.Close() return t.streamContextErr(s) } } + df := &dataFrame{ streamID: s.id, h: hdr, - d: data, + reader: reader, onEachWrite: t.setResetPingStrikes, } - if err := s.wq.get(int32(len(hdr) + len(data))); err != nil { + if err := s.wq.get(int32(len(hdr) + df.reader.Remaining())); err != nil { + _ = reader.Close() return t.streamContextErr(s) } - return t.controlBuf.put(df) + if err := t.controlBuf.put(df); err != nil { + _ = reader.Close() + return err + } + return nil } // keepalive running in a separate goroutine does the following: @@ -1223,7 +1238,7 @@ func (t *http2Server) keepalive() { // timeoutLeft. This will ensure that we wait only for kp.Time // before sending out the next ping (for cases where the ping is // acked). - sleepDuration := minTime(t.kp.Time, kpTimeoutLeft) + sleepDuration := min(t.kp.Time, kpTimeoutLeft) kpTimeoutLeft -= sleepDuration kpTimer.Reset(sleepDuration) case <-t.done: @@ -1440,7 +1455,7 @@ func getJitter(v time.Duration) time.Duration { } // Generate a jitter between +/- 10% of the value. r := int64(v / 10) - j := grpcrand.Int63n(2*r) - r + j := rand.Int63n(2*r) - r return time.Duration(j) } diff --git a/vendor/google.golang.org/grpc/internal/transport/http_util.go b/vendor/google.golang.org/grpc/internal/transport/http_util.go index 39cef3bd..3613d7b6 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http_util.go +++ b/vendor/google.golang.org/grpc/internal/transport/http_util.go @@ -317,28 +317,32 @@ func newBufWriter(conn net.Conn, batchSize int, pool *sync.Pool) *bufWriter { return w } -func (w *bufWriter) Write(b []byte) (n int, err error) { +func (w *bufWriter) Write(b []byte) (int, error) { if w.err != nil { return 0, w.err } if w.batchSize == 0 { // Buffer has been disabled. - n, err = w.conn.Write(b) + n, err := w.conn.Write(b) return n, toIOError(err) } if w.buf == nil { b := w.pool.Get().(*[]byte) w.buf = *b } + written := 0 for len(b) > 0 { - nn := copy(w.buf[w.offset:], b) - b = b[nn:] - w.offset += nn - n += nn - if w.offset >= w.batchSize { - err = w.flushKeepBuffer() + copied := copy(w.buf[w.offset:], b) + b = b[copied:] + written += copied + w.offset += copied + if w.offset < w.batchSize { + continue + } + if err := w.flushKeepBuffer(); err != nil { + return written, err } } - return n, err + return written, nil } func (w *bufWriter) Flush() error { @@ -389,7 +393,7 @@ type framer struct { fr *http2.Framer } -var writeBufferPoolMap map[int]*sync.Pool = make(map[int]*sync.Pool) +var writeBufferPoolMap = make(map[int]*sync.Pool) var writeBufferMutex sync.Mutex func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, sharedWriteBuffer bool, maxHeaderListSize uint32) *framer { diff --git a/vendor/google.golang.org/grpc/internal/transport/proxy.go b/vendor/google.golang.org/grpc/internal/transport/proxy.go index 24fa1032..54b22443 100644 --- a/vendor/google.golang.org/grpc/internal/transport/proxy.go +++ b/vendor/google.golang.org/grpc/internal/transport/proxy.go @@ -107,8 +107,14 @@ func doHTTPConnectHandshake(ctx context.Context, conn net.Conn, backendAddr stri } return nil, fmt.Errorf("failed to do connect handshake, response: %q", dump) } - - return &bufConn{Conn: conn, r: r}, nil + // The buffer could contain extra bytes from the target server, so we can't + // discard it. However, in many cases where the server waits for the client + // to send the first message (e.g. when TLS is being used), the buffer will + // be empty, so we can avoid the overhead of reading through this buffer. + if r.Buffered() != 0 { + return &bufConn{Conn: conn, r: r}, nil + } + return conn, nil } // proxyDial dials, connecting to a proxy first if necessary. Checks if a proxy diff --git a/vendor/google.golang.org/grpc/internal/transport/transport.go b/vendor/google.golang.org/grpc/internal/transport/transport.go index 4b39c0ad..fdd6fa86 100644 --- a/vendor/google.golang.org/grpc/internal/transport/transport.go +++ b/vendor/google.golang.org/grpc/internal/transport/transport.go @@ -22,7 +22,6 @@ package transport import ( - "bytes" "context" "errors" "fmt" @@ -37,6 +36,7 @@ import ( "google.golang.org/grpc/credentials" "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/keepalive" + "google.golang.org/grpc/mem" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" "google.golang.org/grpc/resolver" @@ -47,32 +47,10 @@ import ( const logLevel = 2 -type bufferPool struct { - pool sync.Pool -} - -func newBufferPool() *bufferPool { - return &bufferPool{ - pool: sync.Pool{ - New: func() any { - return new(bytes.Buffer) - }, - }, - } -} - -func (p *bufferPool) get() *bytes.Buffer { - return p.pool.Get().(*bytes.Buffer) -} - -func (p *bufferPool) put(b *bytes.Buffer) { - p.pool.Put(b) -} - // recvMsg represents the received msg from the transport. All transport // protocol specific info has been removed. type recvMsg struct { - buffer *bytes.Buffer + buffer mem.Buffer // nil: received some data // io.EOF: stream is completed. data is nil. // other non-nil error: transport failure. data is nil. @@ -102,6 +80,9 @@ func newRecvBuffer() *recvBuffer { func (b *recvBuffer) put(r recvMsg) { b.mu.Lock() if b.err != nil { + // drop the buffer on the floor. Since b.err is not nil, any subsequent reads + // will always return an error, making this buffer inaccessible. + r.buffer.Free() b.mu.Unlock() // An error had occurred earlier, don't accept more // data or errors. @@ -148,45 +129,70 @@ type recvBufferReader struct { ctx context.Context ctxDone <-chan struct{} // cache of ctx.Done() (for performance). recv *recvBuffer - last *bytes.Buffer // Stores the remaining data in the previous calls. + last mem.Buffer // Stores the remaining data in the previous calls. err error - freeBuffer func(*bytes.Buffer) } -// Read reads the next len(p) bytes from last. If last is drained, it tries to -// read additional data from recv. It blocks if there no additional data available -// in recv. If Read returns any non-nil error, it will continue to return that error. -func (r *recvBufferReader) Read(p []byte) (n int, err error) { +func (r *recvBufferReader) ReadHeader(header []byte) (n int, err error) { if r.err != nil { return 0, r.err } if r.last != nil { - // Read remaining data left in last call. - copied, _ := r.last.Read(p) - if r.last.Len() == 0 { - r.freeBuffer(r.last) - r.last = nil - } - return copied, nil + n, r.last = mem.ReadUnsafe(header, r.last) + return n, nil } if r.closeStream != nil { - n, r.err = r.readClient(p) + n, r.err = r.readHeaderClient(header) } else { - n, r.err = r.read(p) + n, r.err = r.readHeader(header) } return n, r.err } -func (r *recvBufferReader) read(p []byte) (n int, err error) { +// Read reads the next n bytes from last. If last is drained, it tries to read +// additional data from recv. It blocks if there no additional data available in +// recv. If Read returns any non-nil error, it will continue to return that +// error. +func (r *recvBufferReader) Read(n int) (buf mem.Buffer, err error) { + if r.err != nil { + return nil, r.err + } + if r.last != nil { + buf = r.last + if r.last.Len() > n { + buf, r.last = mem.SplitUnsafe(buf, n) + } else { + r.last = nil + } + return buf, nil + } + if r.closeStream != nil { + buf, r.err = r.readClient(n) + } else { + buf, r.err = r.read(n) + } + return buf, r.err +} + +func (r *recvBufferReader) readHeader(header []byte) (n int, err error) { select { case <-r.ctxDone: return 0, ContextErr(r.ctx.Err()) case m := <-r.recv.get(): - return r.readAdditional(m, p) + return r.readHeaderAdditional(m, header) } } -func (r *recvBufferReader) readClient(p []byte) (n int, err error) { +func (r *recvBufferReader) read(n int) (buf mem.Buffer, err error) { + select { + case <-r.ctxDone: + return nil, ContextErr(r.ctx.Err()) + case m := <-r.recv.get(): + return r.readAdditional(m, n) + } +} + +func (r *recvBufferReader) readHeaderClient(header []byte) (n int, err error) { // If the context is canceled, then closes the stream with nil metadata. // closeStream writes its error parameter to r.recv as a recvMsg. // r.readAdditional acts on that message and returns the necessary error. @@ -207,25 +213,67 @@ func (r *recvBufferReader) readClient(p []byte) (n int, err error) { // faster. r.closeStream(ContextErr(r.ctx.Err())) m := <-r.recv.get() - return r.readAdditional(m, p) + return r.readHeaderAdditional(m, header) case m := <-r.recv.get(): - return r.readAdditional(m, p) + return r.readHeaderAdditional(m, header) } } -func (r *recvBufferReader) readAdditional(m recvMsg, p []byte) (n int, err error) { +func (r *recvBufferReader) readClient(n int) (buf mem.Buffer, err error) { + // If the context is canceled, then closes the stream with nil metadata. + // closeStream writes its error parameter to r.recv as a recvMsg. + // r.readAdditional acts on that message and returns the necessary error. + select { + case <-r.ctxDone: + // Note that this adds the ctx error to the end of recv buffer, and + // reads from the head. This will delay the error until recv buffer is + // empty, thus will delay ctx cancellation in Recv(). + // + // It's done this way to fix a race between ctx cancel and trailer. The + // race was, stream.Recv() may return ctx error if ctxDone wins the + // race, but stream.Trailer() may return a non-nil md because the stream + // was not marked as done when trailer is received. This closeStream + // call will mark stream as done, thus fix the race. + // + // TODO: delaying ctx error seems like a unnecessary side effect. What + // we really want is to mark the stream as done, and return ctx error + // faster. + r.closeStream(ContextErr(r.ctx.Err())) + m := <-r.recv.get() + return r.readAdditional(m, n) + case m := <-r.recv.get(): + return r.readAdditional(m, n) + } +} + +func (r *recvBufferReader) readHeaderAdditional(m recvMsg, header []byte) (n int, err error) { r.recv.load() if m.err != nil { + if m.buffer != nil { + m.buffer.Free() + } return 0, m.err } - copied, _ := m.buffer.Read(p) - if m.buffer.Len() == 0 { - r.freeBuffer(m.buffer) - r.last = nil - } else { - r.last = m.buffer + + n, r.last = mem.ReadUnsafe(header, m.buffer) + + return n, nil +} + +func (r *recvBufferReader) readAdditional(m recvMsg, n int) (b mem.Buffer, err error) { + r.recv.load() + if m.err != nil { + if m.buffer != nil { + m.buffer.Free() + } + return nil, m.err } - return copied, nil + + if m.buffer.Len() > n { + m.buffer, r.last = mem.SplitUnsafe(m.buffer, n) + } + + return m.buffer, nil } type streamState uint32 @@ -241,7 +289,7 @@ const ( type Stream struct { id uint32 st ServerTransport // nil for client side Stream - ct *http2Client // nil for server side Stream + ct ClientTransport // nil for server side Stream ctx context.Context // the associated context of the stream cancel context.CancelFunc // always nil for client side Stream done chan struct{} // closed at the end of stream to unblock writers. On the client side. @@ -251,7 +299,7 @@ type Stream struct { recvCompress string sendCompress string buf *recvBuffer - trReader io.Reader + trReader *transportReader fc *inFlow wq *writeQuota @@ -408,7 +456,7 @@ func (s *Stream) TrailersOnly() bool { return s.noHeaders } -// Trailer returns the cached trailer metedata. Note that if it is not called +// Trailer returns the cached trailer metadata. Note that if it is not called // after the entire stream is done, it could return an empty MD. Client // side only. // It can be safely read only after stream has ended that is either read @@ -499,36 +547,87 @@ func (s *Stream) write(m recvMsg) { s.buf.put(m) } -// Read reads all p bytes from the wire for this stream. -func (s *Stream) Read(p []byte) (n int, err error) { +func (s *Stream) ReadHeader(header []byte) (err error) { // Don't request a read if there was an error earlier - if er := s.trReader.(*transportReader).er; er != nil { - return 0, er + if er := s.trReader.er; er != nil { + return er } - s.requestRead(len(p)) - return io.ReadFull(s.trReader, p) + s.requestRead(len(header)) + for len(header) != 0 { + n, err := s.trReader.ReadHeader(header) + header = header[n:] + if len(header) == 0 { + err = nil + } + if err != nil { + if n > 0 && err == io.EOF { + err = io.ErrUnexpectedEOF + } + return err + } + } + return nil } -// tranportReader reads all the data available for this Stream from the transport and +// Read reads n bytes from the wire for this stream. +func (s *Stream) Read(n int) (data mem.BufferSlice, err error) { + // Don't request a read if there was an error earlier + if er := s.trReader.er; er != nil { + return nil, er + } + s.requestRead(n) + for n != 0 { + buf, err := s.trReader.Read(n) + var bufLen int + if buf != nil { + bufLen = buf.Len() + } + n -= bufLen + if n == 0 { + err = nil + } + if err != nil { + if bufLen > 0 && err == io.EOF { + err = io.ErrUnexpectedEOF + } + data.Free() + return nil, err + } + data = append(data, buf) + } + return data, nil +} + +// transportReader reads all the data available for this Stream from the transport and // passes them into the decoder, which converts them into a gRPC message stream. // The error is io.EOF when the stream is done or another non-nil error if // the stream broke. type transportReader struct { - reader io.Reader + reader *recvBufferReader // The handler to control the window update procedure for both this // particular stream and the associated transport. windowHandler func(int) er error } -func (t *transportReader) Read(p []byte) (n int, err error) { - n, err = t.reader.Read(p) +func (t *transportReader) ReadHeader(header []byte) (int, error) { + n, err := t.reader.ReadHeader(header) if err != nil { t.er = err - return + return 0, err } - t.windowHandler(n) - return + t.windowHandler(len(header)) + return n, nil +} + +func (t *transportReader) Read(n int) (mem.Buffer, error) { + buf, err := t.reader.Read(n) + if err != nil { + t.er = err + return buf, err + } + t.windowHandler(buf.Len()) + return buf, nil } // BytesReceived indicates whether any bytes have been received on this stream. @@ -574,6 +673,7 @@ type ServerConfig struct { ChannelzParent *channelz.Server MaxHeaderListSize *uint32 HeaderTableSize *uint32 + BufferPool mem.BufferPool } // ConnectOptions covers all relevant options for communicating with the server. @@ -612,6 +712,8 @@ type ConnectOptions struct { MaxHeaderListSize *uint32 // UseProxy specifies if a proxy should be used. UseProxy bool + // The mem.BufferPool to use when reading/writing to the wire. + BufferPool mem.BufferPool } // NewClientTransport establishes the transport with the required ConnectOptions @@ -673,7 +775,7 @@ type ClientTransport interface { // Write sends the data for the given stream. A nil stream indicates // the write is to be performed on the transport as a whole. - Write(s *Stream, hdr []byte, data []byte, opts *Options) error + Write(s *Stream, hdr []byte, data mem.BufferSlice, opts *Options) error // NewStream creates a Stream for an RPC. NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, error) @@ -725,7 +827,7 @@ type ServerTransport interface { // Write sends the data for the given stream. // Write may not be called on all streams. - Write(s *Stream, hdr []byte, data []byte, opts *Options) error + Write(s *Stream, hdr []byte, data mem.BufferSlice, opts *Options) error // WriteStatus sends the status of a stream to the client. WriteStatus is // the final call made on a stream and always occurs. @@ -798,7 +900,7 @@ var ( // connection is draining. This could be caused by goaway or balancer // removing the address. errStreamDrain = status.Error(codes.Unavailable, "the connection is draining") - // errStreamDone is returned from write at the client side to indiacte application + // errStreamDone is returned from write at the client side to indicate application // layer of an error. errStreamDone = errors.New("the stream is done") // StatusGoAway indicates that the server sent a GOAWAY that included this diff --git a/vendor/google.golang.org/grpc/keepalive/keepalive.go b/vendor/google.golang.org/grpc/keepalive/keepalive.go index 34d31b5e..eb42b19f 100644 --- a/vendor/google.golang.org/grpc/keepalive/keepalive.go +++ b/vendor/google.golang.org/grpc/keepalive/keepalive.go @@ -34,15 +34,29 @@ type ClientParameters struct { // After a duration of this time if the client doesn't see any activity it // pings the server to see if the transport is still alive. // If set below 10s, a minimum value of 10s will be used instead. - Time time.Duration // The current default value is infinity. + // + // Note that gRPC servers have a default EnforcementPolicy.MinTime of 5 + // minutes (which means the client shouldn't ping more frequently than every + // 5 minutes). + // + // Though not ideal, it's not a strong requirement for Time to be less than + // EnforcementPolicy.MinTime. Time will automatically double if the server + // disconnects due to its enforcement policy. + // + // For more details, see + // https://github.com/grpc/proposal/blob/master/A8-client-side-keepalive.md + Time time.Duration // After having pinged for keepalive check, the client waits for a duration // of Timeout and if no activity is seen even after that the connection is // closed. - Timeout time.Duration // The current default value is 20 seconds. + // + // If keepalive is enabled, and this value is not explicitly set, the default + // is 20 seconds. + Timeout time.Duration // If true, client sends keepalive pings even with no active RPCs. If false, // when there are no active RPCs, Time and Timeout will be ignored and no // keepalive pings will be sent. - PermitWithoutStream bool // false by default. + PermitWithoutStream bool } // ServerParameters is used to set keepalive and max-age parameters on the diff --git a/vendor/google.golang.org/grpc/mem/buffer_pool.go b/vendor/google.golang.org/grpc/mem/buffer_pool.go new file mode 100644 index 00000000..c37c58c0 --- /dev/null +++ b/vendor/google.golang.org/grpc/mem/buffer_pool.go @@ -0,0 +1,194 @@ +/* + * + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package mem + +import ( + "sort" + "sync" + + "google.golang.org/grpc/internal" +) + +// BufferPool is a pool of buffers that can be shared and reused, resulting in +// decreased memory allocation. +type BufferPool interface { + // Get returns a buffer with specified length from the pool. + Get(length int) *[]byte + + // Put returns a buffer to the pool. + Put(*[]byte) +} + +var defaultBufferPoolSizes = []int{ + 256, + 4 << 10, // 4KB (go page size) + 16 << 10, // 16KB (max HTTP/2 frame size used by gRPC) + 32 << 10, // 32KB (default buffer size for io.Copy) + 1 << 20, // 1MB +} + +var defaultBufferPool BufferPool + +func init() { + defaultBufferPool = NewTieredBufferPool(defaultBufferPoolSizes...) + + internal.SetDefaultBufferPoolForTesting = func(pool BufferPool) { + defaultBufferPool = pool + } + + internal.SetBufferPoolingThresholdForTesting = func(threshold int) { + bufferPoolingThreshold = threshold + } +} + +// DefaultBufferPool returns the current default buffer pool. It is a BufferPool +// created with NewBufferPool that uses a set of default sizes optimized for +// expected workflows. +func DefaultBufferPool() BufferPool { + return defaultBufferPool +} + +// NewTieredBufferPool returns a BufferPool implementation that uses multiple +// underlying pools of the given pool sizes. +func NewTieredBufferPool(poolSizes ...int) BufferPool { + sort.Ints(poolSizes) + pools := make([]*sizedBufferPool, len(poolSizes)) + for i, s := range poolSizes { + pools[i] = newSizedBufferPool(s) + } + return &tieredBufferPool{ + sizedPools: pools, + } +} + +// tieredBufferPool implements the BufferPool interface with multiple tiers of +// buffer pools for different sizes of buffers. +type tieredBufferPool struct { + sizedPools []*sizedBufferPool + fallbackPool simpleBufferPool +} + +func (p *tieredBufferPool) Get(size int) *[]byte { + return p.getPool(size).Get(size) +} + +func (p *tieredBufferPool) Put(buf *[]byte) { + p.getPool(cap(*buf)).Put(buf) +} + +func (p *tieredBufferPool) getPool(size int) BufferPool { + poolIdx := sort.Search(len(p.sizedPools), func(i int) bool { + return p.sizedPools[i].defaultSize >= size + }) + + if poolIdx == len(p.sizedPools) { + return &p.fallbackPool + } + + return p.sizedPools[poolIdx] +} + +// sizedBufferPool is a BufferPool implementation that is optimized for specific +// buffer sizes. For example, HTTP/2 frames within gRPC have a default max size +// of 16kb and a sizedBufferPool can be configured to only return buffers with a +// capacity of 16kb. Note that however it does not support returning larger +// buffers and in fact panics if such a buffer is requested. Because of this, +// this BufferPool implementation is not meant to be used on its own and rather +// is intended to be embedded in a tieredBufferPool such that Get is only +// invoked when the required size is smaller than or equal to defaultSize. +type sizedBufferPool struct { + pool sync.Pool + defaultSize int +} + +func (p *sizedBufferPool) Get(size int) *[]byte { + buf := p.pool.Get().(*[]byte) + b := *buf + clear(b[:cap(b)]) + *buf = b[:size] + return buf +} + +func (p *sizedBufferPool) Put(buf *[]byte) { + if cap(*buf) < p.defaultSize { + // Ignore buffers that are too small to fit in the pool. Otherwise, when + // Get is called it will panic as it tries to index outside the bounds + // of the buffer. + return + } + p.pool.Put(buf) +} + +func newSizedBufferPool(size int) *sizedBufferPool { + return &sizedBufferPool{ + pool: sync.Pool{ + New: func() any { + buf := make([]byte, size) + return &buf + }, + }, + defaultSize: size, + } +} + +var _ BufferPool = (*simpleBufferPool)(nil) + +// simpleBufferPool is an implementation of the BufferPool interface that +// attempts to pool buffers with a sync.Pool. When Get is invoked, it tries to +// acquire a buffer from the pool but if that buffer is too small, it returns it +// to the pool and creates a new one. +type simpleBufferPool struct { + pool sync.Pool +} + +func (p *simpleBufferPool) Get(size int) *[]byte { + bs, ok := p.pool.Get().(*[]byte) + if ok && cap(*bs) >= size { + *bs = (*bs)[:size] + return bs + } + + // A buffer was pulled from the pool, but it is too small. Put it back in + // the pool and create one large enough. + if ok { + p.pool.Put(bs) + } + + b := make([]byte, size) + return &b +} + +func (p *simpleBufferPool) Put(buf *[]byte) { + p.pool.Put(buf) +} + +var _ BufferPool = NopBufferPool{} + +// NopBufferPool is a buffer pool that returns new buffers without pooling. +type NopBufferPool struct{} + +// Get returns a buffer with specified length from the pool. +func (NopBufferPool) Get(length int) *[]byte { + b := make([]byte, length) + return &b +} + +// Put returns a buffer to the pool. +func (NopBufferPool) Put(*[]byte) { +} diff --git a/vendor/google.golang.org/grpc/mem/buffer_slice.go b/vendor/google.golang.org/grpc/mem/buffer_slice.go new file mode 100644 index 00000000..228e9c2f --- /dev/null +++ b/vendor/google.golang.org/grpc/mem/buffer_slice.go @@ -0,0 +1,226 @@ +/* + * + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package mem + +import ( + "io" +) + +// BufferSlice offers a means to represent data that spans one or more Buffer +// instances. A BufferSlice is meant to be immutable after creation, and methods +// like Ref create and return copies of the slice. This is why all methods have +// value receivers rather than pointer receivers. +// +// Note that any of the methods that read the underlying buffers such as Ref, +// Len or CopyTo etc., will panic if any underlying buffers have already been +// freed. It is recommended to not directly interact with any of the underlying +// buffers directly, rather such interactions should be mediated through the +// various methods on this type. +// +// By convention, any APIs that return (mem.BufferSlice, error) should reduce +// the burden on the caller by never returning a mem.BufferSlice that needs to +// be freed if the error is non-nil, unless explicitly stated. +type BufferSlice []Buffer + +// Len returns the sum of the length of all the Buffers in this slice. +// +// # Warning +// +// Invoking the built-in len on a BufferSlice will return the number of buffers +// in the slice, and *not* the value returned by this function. +func (s BufferSlice) Len() int { + var length int + for _, b := range s { + length += b.Len() + } + return length +} + +// Ref invokes Ref on each buffer in the slice. +func (s BufferSlice) Ref() { + for _, b := range s { + b.Ref() + } +} + +// Free invokes Buffer.Free() on each Buffer in the slice. +func (s BufferSlice) Free() { + for _, b := range s { + b.Free() + } +} + +// CopyTo copies each of the underlying Buffer's data into the given buffer, +// returning the number of bytes copied. Has the same semantics as the copy +// builtin in that it will copy as many bytes as it can, stopping when either dst +// is full or s runs out of data, returning the minimum of s.Len() and len(dst). +func (s BufferSlice) CopyTo(dst []byte) int { + off := 0 + for _, b := range s { + off += copy(dst[off:], b.ReadOnlyData()) + } + return off +} + +// Materialize concatenates all the underlying Buffer's data into a single +// contiguous buffer using CopyTo. +func (s BufferSlice) Materialize() []byte { + l := s.Len() + if l == 0 { + return nil + } + out := make([]byte, l) + s.CopyTo(out) + return out +} + +// MaterializeToBuffer functions like Materialize except that it writes the data +// to a single Buffer pulled from the given BufferPool. +// +// As a special case, if the input BufferSlice only actually has one Buffer, this +// function simply increases the refcount before returning said Buffer. Freeing this +// buffer won't release it until the BufferSlice is itself released. +func (s BufferSlice) MaterializeToBuffer(pool BufferPool) Buffer { + if len(s) == 1 { + s[0].Ref() + return s[0] + } + sLen := s.Len() + if sLen == 0 { + return emptyBuffer{} + } + buf := pool.Get(sLen) + s.CopyTo(*buf) + return NewBuffer(buf, pool) +} + +// Reader returns a new Reader for the input slice after taking references to +// each underlying buffer. +func (s BufferSlice) Reader() Reader { + s.Ref() + return &sliceReader{ + data: s, + len: s.Len(), + } +} + +// Reader exposes a BufferSlice's data as an io.Reader, allowing it to interface +// with other parts systems. It also provides an additional convenience method +// Remaining(), which returns the number of unread bytes remaining in the slice. +// Buffers will be freed as they are read. +type Reader interface { + io.Reader + io.ByteReader + // Close frees the underlying BufferSlice and never returns an error. Subsequent + // calls to Read will return (0, io.EOF). + Close() error + // Remaining returns the number of unread bytes remaining in the slice. + Remaining() int +} + +type sliceReader struct { + data BufferSlice + len int + // The index into data[0].ReadOnlyData(). + bufferIdx int +} + +func (r *sliceReader) Remaining() int { + return r.len +} + +func (r *sliceReader) Close() error { + r.data.Free() + r.data = nil + r.len = 0 + return nil +} + +func (r *sliceReader) freeFirstBufferIfEmpty() bool { + if len(r.data) == 0 || r.bufferIdx != len(r.data[0].ReadOnlyData()) { + return false + } + + r.data[0].Free() + r.data = r.data[1:] + r.bufferIdx = 0 + return true +} + +func (r *sliceReader) Read(buf []byte) (n int, _ error) { + if r.len == 0 { + return 0, io.EOF + } + + for len(buf) != 0 && r.len != 0 { + // Copy as much as possible from the first Buffer in the slice into the + // given byte slice. + data := r.data[0].ReadOnlyData() + copied := copy(buf, data[r.bufferIdx:]) + r.len -= copied // Reduce len by the number of bytes copied. + r.bufferIdx += copied // Increment the buffer index. + n += copied // Increment the total number of bytes read. + buf = buf[copied:] // Shrink the given byte slice. + + // If we have copied all the data from the first Buffer, free it and advance to + // the next in the slice. + r.freeFirstBufferIfEmpty() + } + + return n, nil +} + +func (r *sliceReader) ReadByte() (byte, error) { + if r.len == 0 { + return 0, io.EOF + } + + // There may be any number of empty buffers in the slice, clear them all until a + // non-empty buffer is reached. This is guaranteed to exit since r.len is not 0. + for r.freeFirstBufferIfEmpty() { + } + + b := r.data[0].ReadOnlyData()[r.bufferIdx] + r.len-- + r.bufferIdx++ + // Free the first buffer in the slice if the last byte was read + r.freeFirstBufferIfEmpty() + return b, nil +} + +var _ io.Writer = (*writer)(nil) + +type writer struct { + buffers *BufferSlice + pool BufferPool +} + +func (w *writer) Write(p []byte) (n int, err error) { + b := Copy(p, w.pool) + *w.buffers = append(*w.buffers, b) + return b.Len(), nil +} + +// NewWriter wraps the given BufferSlice and BufferPool to implement the +// io.Writer interface. Every call to Write copies the contents of the given +// buffer into a new Buffer pulled from the given pool and the Buffer is added to +// the given BufferSlice. +func NewWriter(buffers *BufferSlice, pool BufferPool) io.Writer { + return &writer{buffers: buffers, pool: pool} +} diff --git a/vendor/google.golang.org/grpc/mem/buffers.go b/vendor/google.golang.org/grpc/mem/buffers.go new file mode 100644 index 00000000..4d66b2cc --- /dev/null +++ b/vendor/google.golang.org/grpc/mem/buffers.go @@ -0,0 +1,252 @@ +/* + * + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package mem provides utilities that facilitate memory reuse in byte slices +// that are used as buffers. +// +// # Experimental +// +// Notice: All APIs in this package are EXPERIMENTAL and may be changed or +// removed in a later release. +package mem + +import ( + "fmt" + "sync" + "sync/atomic" +) + +// A Buffer represents a reference counted piece of data (in bytes) that can be +// acquired by a call to NewBuffer() or Copy(). A reference to a Buffer may be +// released by calling Free(), which invokes the free function given at creation +// only after all references are released. +// +// Note that a Buffer is not safe for concurrent access and instead each +// goroutine should use its own reference to the data, which can be acquired via +// a call to Ref(). +// +// Attempts to access the underlying data after releasing the reference to the +// Buffer will panic. +type Buffer interface { + // ReadOnlyData returns the underlying byte slice. Note that it is undefined + // behavior to modify the contents of this slice in any way. + ReadOnlyData() []byte + // Ref increases the reference counter for this Buffer. + Ref() + // Free decrements this Buffer's reference counter and frees the underlying + // byte slice if the counter reaches 0 as a result of this call. + Free() + // Len returns the Buffer's size. + Len() int + + split(n int) (left, right Buffer) + read(buf []byte) (int, Buffer) +} + +var ( + bufferPoolingThreshold = 1 << 10 + + bufferObjectPool = sync.Pool{New: func() any { return new(buffer) }} + refObjectPool = sync.Pool{New: func() any { return new(atomic.Int32) }} +) + +func IsBelowBufferPoolingThreshold(size int) bool { + return size <= bufferPoolingThreshold +} + +type buffer struct { + origData *[]byte + data []byte + refs *atomic.Int32 + pool BufferPool +} + +func newBuffer() *buffer { + return bufferObjectPool.Get().(*buffer) +} + +// NewBuffer creates a new Buffer from the given data, initializing the reference +// counter to 1. The data will then be returned to the given pool when all +// references to the returned Buffer are released. As a special case to avoid +// additional allocations, if the given buffer pool is nil, the returned buffer +// will be a "no-op" Buffer where invoking Buffer.Free() does nothing and the +// underlying data is never freed. +// +// Note that the backing array of the given data is not copied. +func NewBuffer(data *[]byte, pool BufferPool) Buffer { + if pool == nil || IsBelowBufferPoolingThreshold(len(*data)) { + return (SliceBuffer)(*data) + } + b := newBuffer() + b.origData = data + b.data = *data + b.pool = pool + b.refs = refObjectPool.Get().(*atomic.Int32) + b.refs.Add(1) + return b +} + +// Copy creates a new Buffer from the given data, initializing the reference +// counter to 1. +// +// It acquires a []byte from the given pool and copies over the backing array +// of the given data. The []byte acquired from the pool is returned to the +// pool when all references to the returned Buffer are released. +func Copy(data []byte, pool BufferPool) Buffer { + if IsBelowBufferPoolingThreshold(len(data)) { + buf := make(SliceBuffer, len(data)) + copy(buf, data) + return buf + } + + buf := pool.Get(len(data)) + copy(*buf, data) + return NewBuffer(buf, pool) +} + +func (b *buffer) ReadOnlyData() []byte { + if b.refs == nil { + panic("Cannot read freed buffer") + } + return b.data +} + +func (b *buffer) Ref() { + if b.refs == nil { + panic("Cannot ref freed buffer") + } + b.refs.Add(1) +} + +func (b *buffer) Free() { + if b.refs == nil { + panic("Cannot free freed buffer") + } + + refs := b.refs.Add(-1) + switch { + case refs > 0: + return + case refs == 0: + if b.pool != nil { + b.pool.Put(b.origData) + } + + refObjectPool.Put(b.refs) + b.origData = nil + b.data = nil + b.refs = nil + b.pool = nil + bufferObjectPool.Put(b) + default: + panic("Cannot free freed buffer") + } +} + +func (b *buffer) Len() int { + return len(b.ReadOnlyData()) +} + +func (b *buffer) split(n int) (Buffer, Buffer) { + if b.refs == nil { + panic("Cannot split freed buffer") + } + + b.refs.Add(1) + split := newBuffer() + split.origData = b.origData + split.data = b.data[n:] + split.refs = b.refs + split.pool = b.pool + + b.data = b.data[:n] + + return b, split +} + +func (b *buffer) read(buf []byte) (int, Buffer) { + if b.refs == nil { + panic("Cannot read freed buffer") + } + + n := copy(buf, b.data) + if n == len(b.data) { + b.Free() + return n, nil + } + + b.data = b.data[n:] + return n, b +} + +// String returns a string representation of the buffer. May be used for +// debugging purposes. +func (b *buffer) String() string { + return fmt.Sprintf("mem.Buffer(%p, data: %p, length: %d)", b, b.ReadOnlyData(), len(b.ReadOnlyData())) +} + +func ReadUnsafe(dst []byte, buf Buffer) (int, Buffer) { + return buf.read(dst) +} + +// SplitUnsafe modifies the receiver to point to the first n bytes while it +// returns a new reference to the remaining bytes. The returned Buffer functions +// just like a normal reference acquired using Ref(). +func SplitUnsafe(buf Buffer, n int) (left, right Buffer) { + return buf.split(n) +} + +type emptyBuffer struct{} + +func (e emptyBuffer) ReadOnlyData() []byte { + return nil +} + +func (e emptyBuffer) Ref() {} +func (e emptyBuffer) Free() {} + +func (e emptyBuffer) Len() int { + return 0 +} + +func (e emptyBuffer) split(int) (left, right Buffer) { + return e, e +} + +func (e emptyBuffer) read([]byte) (int, Buffer) { + return 0, e +} + +type SliceBuffer []byte + +func (s SliceBuffer) ReadOnlyData() []byte { return s } +func (s SliceBuffer) Ref() {} +func (s SliceBuffer) Free() {} +func (s SliceBuffer) Len() int { return len(s) } + +func (s SliceBuffer) split(n int) (left, right Buffer) { + return s[:n], s[n:] +} + +func (s SliceBuffer) read(buf []byte) (int, Buffer) { + n := copy(buf, s) + if n == len(s) { + return n, nil + } + return n, s[n:] +} diff --git a/vendor/google.golang.org/grpc/metadata/metadata.go b/vendor/google.golang.org/grpc/metadata/metadata.go index 6c01a9b3..d2e15253 100644 --- a/vendor/google.golang.org/grpc/metadata/metadata.go +++ b/vendor/google.golang.org/grpc/metadata/metadata.go @@ -90,21 +90,6 @@ func Pairs(kv ...string) MD { return md } -// String implements the Stringer interface for pretty-printing a MD. -// Ordering of the values is non-deterministic as it ranges over a map. -func (md MD) String() string { - var sb strings.Builder - fmt.Fprintf(&sb, "MD{") - for k, v := range md { - if sb.Len() > 3 { - fmt.Fprintf(&sb, ", ") - } - fmt.Fprintf(&sb, "%s=[%s]", k, strings.Join(v, ", ")) - } - fmt.Fprintf(&sb, "}") - return sb.String() -} - // Len returns the number of items in md. func (md MD) Len() int { return len(md) @@ -228,11 +213,6 @@ func FromIncomingContext(ctx context.Context) (MD, bool) { // ValueFromIncomingContext returns the metadata value corresponding to the metadata // key from the incoming metadata if it exists. Keys are matched in a case insensitive // manner. -// -// # Experimental -// -// Notice: This API is EXPERIMENTAL and may be changed or removed in a -// later release. func ValueFromIncomingContext(ctx context.Context, key string) []string { md, ok := ctx.Value(mdIncomingKey{}).(MD) if !ok { @@ -243,7 +223,7 @@ func ValueFromIncomingContext(ctx context.Context, key string) []string { return copyOf(v) } for k, v := range md { - // Case insenitive comparison: MD is a map, and there's no guarantee + // Case insensitive comparison: MD is a map, and there's no guarantee // that the MD attached to the context is created using our helper // functions. if strings.EqualFold(k, key) { diff --git a/vendor/google.golang.org/grpc/picker_wrapper.go b/vendor/google.golang.org/grpc/picker_wrapper.go index 56e8aba7..bdaa2130 100644 --- a/vendor/google.golang.org/grpc/picker_wrapper.go +++ b/vendor/google.golang.org/grpc/picker_wrapper.go @@ -22,7 +22,7 @@ import ( "context" "fmt" "io" - "sync" + "sync/atomic" "google.golang.org/grpc/balancer" "google.golang.org/grpc/codes" @@ -33,35 +33,43 @@ import ( "google.golang.org/grpc/status" ) +// pickerGeneration stores a picker and a channel used to signal that a picker +// newer than this one is available. +type pickerGeneration struct { + // picker is the picker produced by the LB policy. May be nil if a picker + // has never been produced. + picker balancer.Picker + // blockingCh is closed when the picker has been invalidated because there + // is a new one available. + blockingCh chan struct{} +} + // pickerWrapper is a wrapper of balancer.Picker. It blocks on certain pick // actions and unblock when there's a picker update. type pickerWrapper struct { - mu sync.Mutex - done bool - blockingCh chan struct{} - picker balancer.Picker + // If pickerGen holds a nil pointer, the pickerWrapper is closed. + pickerGen atomic.Pointer[pickerGeneration] statsHandlers []stats.Handler // to record blocking picker calls } func newPickerWrapper(statsHandlers []stats.Handler) *pickerWrapper { - return &pickerWrapper{ - blockingCh: make(chan struct{}), + pw := &pickerWrapper{ statsHandlers: statsHandlers, } + pw.pickerGen.Store(&pickerGeneration{ + blockingCh: make(chan struct{}), + }) + return pw } -// updatePicker is called by UpdateBalancerState. It unblocks all blocked pick. +// updatePicker is called by UpdateState calls from the LB policy. It +// unblocks all blocked pick. func (pw *pickerWrapper) updatePicker(p balancer.Picker) { - pw.mu.Lock() - if pw.done { - pw.mu.Unlock() - return - } - pw.picker = p - // pw.blockingCh should never be nil. - close(pw.blockingCh) - pw.blockingCh = make(chan struct{}) - pw.mu.Unlock() + old := pw.pickerGen.Swap(&pickerGeneration{ + picker: p, + blockingCh: make(chan struct{}), + }) + close(old.blockingCh) } // doneChannelzWrapper performs the following: @@ -98,20 +106,17 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer. var lastPickErr error for { - pw.mu.Lock() - if pw.done { - pw.mu.Unlock() + pg := pw.pickerGen.Load() + if pg == nil { return nil, balancer.PickResult{}, ErrClientConnClosing } - - if pw.picker == nil { - ch = pw.blockingCh + if pg.picker == nil { + ch = pg.blockingCh } - if ch == pw.blockingCh { + if ch == pg.blockingCh { // This could happen when either: // - pw.picker is nil (the previous if condition), or - // - has called pick on the current picker. - pw.mu.Unlock() + // - we have already called pick on the current picker. select { case <-ctx.Done(): var errStr string @@ -145,9 +150,8 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer. } } - ch = pw.blockingCh - p := pw.picker - pw.mu.Unlock() + ch = pg.blockingCh + p := pg.picker pickResult, err := p.Pick(info) if err != nil { @@ -197,24 +201,15 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer. } func (pw *pickerWrapper) close() { - pw.mu.Lock() - defer pw.mu.Unlock() - if pw.done { - return - } - pw.done = true - close(pw.blockingCh) + old := pw.pickerGen.Swap(nil) + close(old.blockingCh) } // reset clears the pickerWrapper and prepares it for being used again when idle // mode is exited. func (pw *pickerWrapper) reset() { - pw.mu.Lock() - defer pw.mu.Unlock() - if pw.done { - return - } - pw.blockingCh = make(chan struct{}) + old := pw.pickerGen.Swap(&pickerGeneration{blockingCh: make(chan struct{})}) + close(old.blockingCh) } // dropError is a wrapper error that indicates the LB policy wishes to drop the diff --git a/vendor/google.golang.org/grpc/preloader.go b/vendor/google.golang.org/grpc/preloader.go index 73bd6336..e87a17f3 100644 --- a/vendor/google.golang.org/grpc/preloader.go +++ b/vendor/google.golang.org/grpc/preloader.go @@ -20,6 +20,7 @@ package grpc import ( "google.golang.org/grpc/codes" + "google.golang.org/grpc/mem" "google.golang.org/grpc/status" ) @@ -31,9 +32,10 @@ import ( // later release. type PreparedMsg struct { // Struct for preparing msg before sending them - encodedData []byte + encodedData mem.BufferSlice hdr []byte - payload []byte + payload mem.BufferSlice + pf payloadFormat } // Encode marshalls and compresses the message using the codec and compressor for the stream. @@ -57,11 +59,27 @@ func (p *PreparedMsg) Encode(s Stream, msg any) error { if err != nil { return err } - p.encodedData = data - compData, err := compress(data, rpcInfo.preloaderInfo.cp, rpcInfo.preloaderInfo.comp) + + materializedData := data.Materialize() + data.Free() + p.encodedData = mem.BufferSlice{mem.NewBuffer(&materializedData, nil)} + + // TODO: it should be possible to grab the bufferPool from the underlying + // stream implementation with a type cast to its actual type (such as + // addrConnStream) and accessing the buffer pool directly. + var compData mem.BufferSlice + compData, p.pf, err = compress(p.encodedData, rpcInfo.preloaderInfo.cp, rpcInfo.preloaderInfo.comp, mem.DefaultBufferPool()) if err != nil { return err } - p.hdr, p.payload = msgHeader(data, compData) + + if p.pf.isCompressed() { + materializedCompData := compData.Materialize() + compData.Free() + compData = mem.BufferSlice{mem.NewBuffer(&materializedCompData, nil)} + } + + p.hdr, p.payload = msgHeader(p.encodedData, compData, p.pf) + return nil } diff --git a/vendor/google.golang.org/grpc/regenerate.sh b/vendor/google.golang.org/grpc/regenerate.sh deleted file mode 100644 index 3edca296..00000000 --- a/vendor/google.golang.org/grpc/regenerate.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -# Copyright 2020 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eu -o pipefail - -WORKDIR=$(mktemp -d) - -function finish { - rm -rf "$WORKDIR" -} -trap finish EXIT - -export GOBIN=${WORKDIR}/bin -export PATH=${GOBIN}:${PATH} -mkdir -p ${GOBIN} - -echo "remove existing generated files" -# grpc_testing_not_regenerate/*.pb.go is not re-generated, -# see grpc_testing_not_regenerate/README.md for details. -rm -f $(find . -name '*.pb.go' | grep -v 'grpc_testing_not_regenerate') - -echo "go install google.golang.org/protobuf/cmd/protoc-gen-go" -(cd test/tools && go install google.golang.org/protobuf/cmd/protoc-gen-go) - -echo "go install cmd/protoc-gen-go-grpc" -(cd cmd/protoc-gen-go-grpc && go install .) - -echo "git clone https://github.com/grpc/grpc-proto" -git clone --quiet https://github.com/grpc/grpc-proto ${WORKDIR}/grpc-proto - -echo "git clone https://github.com/protocolbuffers/protobuf" -git clone --quiet https://github.com/protocolbuffers/protobuf ${WORKDIR}/protobuf - -# Pull in code.proto as a proto dependency -mkdir -p ${WORKDIR}/googleapis/google/rpc -echo "curl https://raw.githubusercontent.com/googleapis/googleapis/master/google/rpc/code.proto" -curl --silent https://raw.githubusercontent.com/googleapis/googleapis/master/google/rpc/code.proto > ${WORKDIR}/googleapis/google/rpc/code.proto - -mkdir -p ${WORKDIR}/out - -# Generates sources without the embed requirement -LEGACY_SOURCES=( - ${WORKDIR}/grpc-proto/grpc/binlog/v1/binarylog.proto - ${WORKDIR}/grpc-proto/grpc/channelz/v1/channelz.proto - ${WORKDIR}/grpc-proto/grpc/health/v1/health.proto - ${WORKDIR}/grpc-proto/grpc/lb/v1/load_balancer.proto - profiling/proto/service.proto - ${WORKDIR}/grpc-proto/grpc/reflection/v1alpha/reflection.proto - ${WORKDIR}/grpc-proto/grpc/reflection/v1/reflection.proto -) - -# Generates only the new gRPC Service symbols -SOURCES=( - $(git ls-files --exclude-standard --cached --others "*.proto" | grep -v '^profiling/proto/service.proto$') - ${WORKDIR}/grpc-proto/grpc/gcp/altscontext.proto - ${WORKDIR}/grpc-proto/grpc/gcp/handshaker.proto - ${WORKDIR}/grpc-proto/grpc/gcp/transport_security_common.proto - ${WORKDIR}/grpc-proto/grpc/lookup/v1/rls.proto - ${WORKDIR}/grpc-proto/grpc/lookup/v1/rls_config.proto - ${WORKDIR}/grpc-proto/grpc/testing/*.proto - ${WORKDIR}/grpc-proto/grpc/core/*.proto -) - -# These options of the form 'Mfoo.proto=bar' instruct the codegen to use an -# import path of 'bar' in the generated code when 'foo.proto' is imported in -# one of the sources. -# -# Note that the protos listed here are all for testing purposes. All protos to -# be used externally should have a go_package option (and they don't need to be -# listed here). -OPTS=Mgrpc/core/stats.proto=google.golang.org/grpc/interop/grpc_testing/core,\ -Mgrpc/testing/benchmark_service.proto=google.golang.org/grpc/interop/grpc_testing,\ -Mgrpc/testing/stats.proto=google.golang.org/grpc/interop/grpc_testing,\ -Mgrpc/testing/report_qps_scenario_service.proto=google.golang.org/grpc/interop/grpc_testing,\ -Mgrpc/testing/messages.proto=google.golang.org/grpc/interop/grpc_testing,\ -Mgrpc/testing/worker_service.proto=google.golang.org/grpc/interop/grpc_testing,\ -Mgrpc/testing/control.proto=google.golang.org/grpc/interop/grpc_testing,\ -Mgrpc/testing/test.proto=google.golang.org/grpc/interop/grpc_testing,\ -Mgrpc/testing/payloads.proto=google.golang.org/grpc/interop/grpc_testing,\ -Mgrpc/testing/empty.proto=google.golang.org/grpc/interop/grpc_testing - -for src in ${SOURCES[@]}; do - echo "protoc ${src}" - protoc --go_out=${OPTS}:${WORKDIR}/out --go-grpc_out=${OPTS},use_generic_streams_experimental=true:${WORKDIR}/out \ - -I"." \ - -I${WORKDIR}/grpc-proto \ - -I${WORKDIR}/googleapis \ - -I${WORKDIR}/protobuf/src \ - ${src} -done - -for src in ${LEGACY_SOURCES[@]}; do - echo "protoc ${src}" - protoc --go_out=${OPTS}:${WORKDIR}/out --go-grpc_out=${OPTS},require_unimplemented_servers=false:${WORKDIR}/out \ - -I"." \ - -I${WORKDIR}/grpc-proto \ - -I${WORKDIR}/googleapis \ - -I${WORKDIR}/protobuf/src \ - ${src} -done - -# The go_package option in grpc/lookup/v1/rls.proto doesn't match the -# current location. Move it into the right place. -mkdir -p ${WORKDIR}/out/google.golang.org/grpc/internal/proto/grpc_lookup_v1 -mv ${WORKDIR}/out/google.golang.org/grpc/lookup/grpc_lookup_v1/* ${WORKDIR}/out/google.golang.org/grpc/internal/proto/grpc_lookup_v1 - -# grpc_testing_not_regenerate/*.pb.go are not re-generated, -# see grpc_testing_not_regenerate/README.md for details. -rm ${WORKDIR}/out/google.golang.org/grpc/reflection/test/grpc_testing_not_regenerate/*.pb.go - -cp -R ${WORKDIR}/out/google.golang.org/grpc/* . diff --git a/vendor/google.golang.org/grpc/resolver_wrapper.go b/vendor/google.golang.org/grpc/resolver_wrapper.go index 9dcc9780..23bb3fb2 100644 --- a/vendor/google.golang.org/grpc/resolver_wrapper.go +++ b/vendor/google.golang.org/grpc/resolver_wrapper.go @@ -66,7 +66,7 @@ func newCCResolverWrapper(cc *ClientConn) *ccResolverWrapper { // any newly created ccResolverWrapper, except that close may be called instead. func (ccr *ccResolverWrapper) start() error { errCh := make(chan error) - ccr.serializer.Schedule(func(ctx context.Context) { + ccr.serializer.TrySchedule(func(ctx context.Context) { if ctx.Err() != nil { return } @@ -85,7 +85,7 @@ func (ccr *ccResolverWrapper) start() error { } func (ccr *ccResolverWrapper) resolveNow(o resolver.ResolveNowOptions) { - ccr.serializer.Schedule(func(ctx context.Context) { + ccr.serializer.TrySchedule(func(ctx context.Context) { if ctx.Err() != nil || ccr.resolver == nil { return } @@ -102,7 +102,7 @@ func (ccr *ccResolverWrapper) close() { ccr.closed = true ccr.mu.Unlock() - ccr.serializer.Schedule(func(context.Context) { + ccr.serializer.TrySchedule(func(context.Context) { if ccr.resolver == nil { return } @@ -171,12 +171,15 @@ func (ccr *ccResolverWrapper) NewAddress(addrs []resolver.Address) { // ParseServiceConfig is called by resolver implementations to parse a JSON // representation of the service config. func (ccr *ccResolverWrapper) ParseServiceConfig(scJSON string) *serviceconfig.ParseResult { - return parseServiceConfig(scJSON) + return parseServiceConfig(scJSON, ccr.cc.dopts.maxCallAttempts) } // addChannelzTraceEvent adds a channelz trace event containing the new // state received from resolver implementations. func (ccr *ccResolverWrapper) addChannelzTraceEvent(s resolver.State) { + if !logger.V(0) && !channelz.IsOn() { + return + } var updates []string var oldSC, newSC *ServiceConfig var oldOK, newOK bool diff --git a/vendor/google.golang.org/grpc/rpc_util.go b/vendor/google.golang.org/grpc/rpc_util.go index fdd49e6e..2d96f140 100644 --- a/vendor/google.golang.org/grpc/rpc_util.go +++ b/vendor/google.golang.org/grpc/rpc_util.go @@ -19,7 +19,6 @@ package grpc import ( - "bytes" "compress/gzip" "context" "encoding/binary" @@ -35,6 +34,7 @@ import ( "google.golang.org/grpc/encoding" "google.golang.org/grpc/encoding/proto" "google.golang.org/grpc/internal/transport" + "google.golang.org/grpc/mem" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" "google.golang.org/grpc/stats" @@ -220,8 +220,8 @@ type HeaderCallOption struct { HeaderAddr *metadata.MD } -func (o HeaderCallOption) before(c *callInfo) error { return nil } -func (o HeaderCallOption) after(c *callInfo, attempt *csAttempt) { +func (o HeaderCallOption) before(*callInfo) error { return nil } +func (o HeaderCallOption) after(_ *callInfo, attempt *csAttempt) { *o.HeaderAddr, _ = attempt.s.Header() } @@ -242,8 +242,8 @@ type TrailerCallOption struct { TrailerAddr *metadata.MD } -func (o TrailerCallOption) before(c *callInfo) error { return nil } -func (o TrailerCallOption) after(c *callInfo, attempt *csAttempt) { +func (o TrailerCallOption) before(*callInfo) error { return nil } +func (o TrailerCallOption) after(_ *callInfo, attempt *csAttempt) { *o.TrailerAddr = attempt.s.Trailer() } @@ -264,24 +264,20 @@ type PeerCallOption struct { PeerAddr *peer.Peer } -func (o PeerCallOption) before(c *callInfo) error { return nil } -func (o PeerCallOption) after(c *callInfo, attempt *csAttempt) { +func (o PeerCallOption) before(*callInfo) error { return nil } +func (o PeerCallOption) after(_ *callInfo, attempt *csAttempt) { if x, ok := peer.FromContext(attempt.s.Context()); ok { *o.PeerAddr = *x } } -// WaitForReady configures the action to take when an RPC is attempted on broken -// connections or unreachable servers. If waitForReady is false and the -// connection is in the TRANSIENT_FAILURE state, the RPC will fail -// immediately. Otherwise, the RPC client will block the call until a -// connection is available (or the call is canceled or times out) and will -// retry the call if it fails due to a transient error. gRPC will not retry if -// data was written to the wire unless the server indicates it did not process -// the data. Please refer to -// https://github.com/grpc/grpc/blob/master/doc/wait-for-ready.md. +// WaitForReady configures the RPC's behavior when the client is in +// TRANSIENT_FAILURE, which occurs when all addresses fail to connect. If +// waitForReady is false, the RPC will fail immediately. Otherwise, the client +// will wait until a connection becomes available or the RPC's deadline is +// reached. // -// By default, RPCs don't "wait for ready". +// By default, RPCs do not "wait for ready". func WaitForReady(waitForReady bool) CallOption { return FailFastCallOption{FailFast: !waitForReady} } @@ -308,7 +304,7 @@ func (o FailFastCallOption) before(c *callInfo) error { c.failFast = o.FailFast return nil } -func (o FailFastCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o FailFastCallOption) after(*callInfo, *csAttempt) {} // OnFinish returns a CallOption that configures a callback to be called when // the call completes. The error passed to the callback is the status of the @@ -343,7 +339,7 @@ func (o OnFinishCallOption) before(c *callInfo) error { return nil } -func (o OnFinishCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o OnFinishCallOption) after(*callInfo, *csAttempt) {} // MaxCallRecvMsgSize returns a CallOption which sets the maximum message size // in bytes the client can receive. If this is not set, gRPC uses the default @@ -367,7 +363,7 @@ func (o MaxRecvMsgSizeCallOption) before(c *callInfo) error { c.maxReceiveMessageSize = &o.MaxRecvMsgSize return nil } -func (o MaxRecvMsgSizeCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o MaxRecvMsgSizeCallOption) after(*callInfo, *csAttempt) {} // MaxCallSendMsgSize returns a CallOption which sets the maximum message size // in bytes the client can send. If this is not set, gRPC uses the default @@ -391,7 +387,7 @@ func (o MaxSendMsgSizeCallOption) before(c *callInfo) error { c.maxSendMessageSize = &o.MaxSendMsgSize return nil } -func (o MaxSendMsgSizeCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o MaxSendMsgSizeCallOption) after(*callInfo, *csAttempt) {} // PerRPCCredentials returns a CallOption that sets credentials.PerRPCCredentials // for a call. @@ -414,7 +410,7 @@ func (o PerRPCCredsCallOption) before(c *callInfo) error { c.creds = o.Creds return nil } -func (o PerRPCCredsCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o PerRPCCredsCallOption) after(*callInfo, *csAttempt) {} // UseCompressor returns a CallOption which sets the compressor used when // sending the request. If WithCompressor is also set, UseCompressor has @@ -442,7 +438,7 @@ func (o CompressorCallOption) before(c *callInfo) error { c.compressorType = o.CompressorType return nil } -func (o CompressorCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o CompressorCallOption) after(*callInfo, *csAttempt) {} // CallContentSubtype returns a CallOption that will set the content-subtype // for a call. For example, if content-subtype is "json", the Content-Type over @@ -479,7 +475,7 @@ func (o ContentSubtypeCallOption) before(c *callInfo) error { c.contentSubtype = o.ContentSubtype return nil } -func (o ContentSubtypeCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o ContentSubtypeCallOption) after(*callInfo, *csAttempt) {} // ForceCodec returns a CallOption that will set codec to be used for all // request and response messages for a call. The result of calling Name() will @@ -515,10 +511,50 @@ type ForceCodecCallOption struct { } func (o ForceCodecCallOption) before(c *callInfo) error { - c.codec = o.Codec + c.codec = newCodecV1Bridge(o.Codec) return nil } -func (o ForceCodecCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o ForceCodecCallOption) after(*callInfo, *csAttempt) {} + +// ForceCodecV2 returns a CallOption that will set codec to be used for all +// request and response messages for a call. The result of calling Name() will +// be used as the content-subtype after converting to lowercase, unless +// CallContentSubtype is also used. +// +// See Content-Type on +// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for +// more details. Also see the documentation on RegisterCodec and +// CallContentSubtype for more details on the interaction between Codec and +// content-subtype. +// +// This function is provided for advanced users; prefer to use only +// CallContentSubtype to select a registered codec instead. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a +// later release. +func ForceCodecV2(codec encoding.CodecV2) CallOption { + return ForceCodecV2CallOption{CodecV2: codec} +} + +// ForceCodecV2CallOption is a CallOption that indicates the codec used for +// marshaling messages. +// +// # Experimental +// +// Notice: This type is EXPERIMENTAL and may be changed or removed in a +// later release. +type ForceCodecV2CallOption struct { + CodecV2 encoding.CodecV2 +} + +func (o ForceCodecV2CallOption) before(c *callInfo) error { + c.codec = o.CodecV2 + return nil +} + +func (o ForceCodecV2CallOption) after(*callInfo, *csAttempt) {} // CallCustomCodec behaves like ForceCodec, but accepts a grpc.Codec instead of // an encoding.Codec. @@ -540,10 +576,10 @@ type CustomCodecCallOption struct { } func (o CustomCodecCallOption) before(c *callInfo) error { - c.codec = o.Codec + c.codec = newCodecV0Bridge(o.Codec) return nil } -func (o CustomCodecCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o CustomCodecCallOption) after(*callInfo, *csAttempt) {} // MaxRetryRPCBufferSize returns a CallOption that limits the amount of memory // used for buffering this RPC's requests for retry purposes. @@ -571,7 +607,7 @@ func (o MaxRetryRPCBufferSizeCallOption) before(c *callInfo) error { c.maxRetryRPCBufferSize = o.MaxRetryRPCBufferSize return nil } -func (o MaxRetryRPCBufferSizeCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o MaxRetryRPCBufferSizeCallOption) after(*callInfo, *csAttempt) {} // The format of the payload: compressed or not? type payloadFormat uint8 @@ -581,19 +617,28 @@ const ( compressionMade payloadFormat = 1 // compressed ) +func (pf payloadFormat) isCompressed() bool { + return pf == compressionMade +} + +type streamReader interface { + ReadHeader(header []byte) error + Read(n int) (mem.BufferSlice, error) +} + // parser reads complete gRPC messages from the underlying reader. type parser struct { // r is the underlying reader. // See the comment on recvMsg for the permissible // error types. - r io.Reader + r streamReader // The header of a gRPC message. Find more detail at // https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md header [5]byte - // recvBufferPool is the pool of shared receive buffers. - recvBufferPool SharedBufferPool + // bufferPool is the pool of shared receive buffers. + bufferPool mem.BufferPool } // recvMsg reads a complete gRPC message from the stream. @@ -608,14 +653,15 @@ type parser struct { // - an error from the status package // // No other error values or types must be returned, which also means -// that the underlying io.Reader must not return an incompatible +// that the underlying streamReader must not return an incompatible // error. -func (p *parser) recvMsg(maxReceiveMessageSize int) (pf payloadFormat, msg []byte, err error) { - if _, err := p.r.Read(p.header[:]); err != nil { +func (p *parser) recvMsg(maxReceiveMessageSize int) (payloadFormat, mem.BufferSlice, error) { + err := p.r.ReadHeader(p.header[:]) + if err != nil { return 0, nil, err } - pf = payloadFormat(p.header[0]) + pf := payloadFormat(p.header[0]) length := binary.BigEndian.Uint32(p.header[1:]) if length == 0 { @@ -627,20 +673,21 @@ func (p *parser) recvMsg(maxReceiveMessageSize int) (pf payloadFormat, msg []byt if int(length) > maxReceiveMessageSize { return 0, nil, status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max (%d vs. %d)", length, maxReceiveMessageSize) } - msg = p.recvBufferPool.Get(int(length)) - if _, err := p.r.Read(msg); err != nil { + + data, err := p.r.Read(int(length)) + if err != nil { if err == io.EOF { err = io.ErrUnexpectedEOF } return 0, nil, err } - return pf, msg, nil + return pf, data, nil } // encode serializes msg and returns a buffer containing the message, or an // error if it is too large to be transmitted by grpc. If msg is nil, it // generates an empty message. -func encode(c baseCodec, msg any) ([]byte, error) { +func encode(c baseCodec, msg any) (mem.BufferSlice, error) { if msg == nil { // NOTE: typed nils will not be caught by this check return nil, nil } @@ -648,7 +695,8 @@ func encode(c baseCodec, msg any) ([]byte, error) { if err != nil { return nil, status.Errorf(codes.Internal, "grpc: error while marshaling: %v", err.Error()) } - if uint(len(b)) > math.MaxUint32 { + if uint(b.Len()) > math.MaxUint32 { + b.Free() return nil, status.Errorf(codes.ResourceExhausted, "grpc: message too large (%d bytes)", len(b)) } return b, nil @@ -659,34 +707,41 @@ func encode(c baseCodec, msg any) ([]byte, error) { // indicating no compression was done. // // TODO(dfawley): eliminate cp parameter by wrapping Compressor in an encoding.Compressor. -func compress(in []byte, cp Compressor, compressor encoding.Compressor) ([]byte, error) { - if compressor == nil && cp == nil { - return nil, nil - } - if len(in) == 0 { - return nil, nil +func compress(in mem.BufferSlice, cp Compressor, compressor encoding.Compressor, pool mem.BufferPool) (mem.BufferSlice, payloadFormat, error) { + if (compressor == nil && cp == nil) || in.Len() == 0 { + return nil, compressionNone, nil } + var out mem.BufferSlice + w := mem.NewWriter(&out, pool) wrapErr := func(err error) error { + out.Free() return status.Errorf(codes.Internal, "grpc: error while compressing: %v", err.Error()) } - cbuf := &bytes.Buffer{} if compressor != nil { - z, err := compressor.Compress(cbuf) + z, err := compressor.Compress(w) if err != nil { - return nil, wrapErr(err) + return nil, 0, wrapErr(err) } - if _, err := z.Write(in); err != nil { - return nil, wrapErr(err) + for _, b := range in { + if _, err := z.Write(b.ReadOnlyData()); err != nil { + return nil, 0, wrapErr(err) + } } if err := z.Close(); err != nil { - return nil, wrapErr(err) + return nil, 0, wrapErr(err) } } else { - if err := cp.Do(cbuf, in); err != nil { - return nil, wrapErr(err) + // This is obviously really inefficient since it fully materializes the data, but + // there is no way around this with the old Compressor API. At least it attempts + // to return the buffer to the provider, in the hopes it can be reused (maybe + // even by a subsequent call to this very function). + buf := in.MaterializeToBuffer(pool) + defer buf.Free() + if err := cp.Do(w, buf.ReadOnlyData()); err != nil { + return nil, 0, wrapErr(err) } } - return cbuf.Bytes(), nil + return out, compressionMade, nil } const ( @@ -697,33 +752,36 @@ const ( // msgHeader returns a 5-byte header for the message being transmitted and the // payload, which is compData if non-nil or data otherwise. -func msgHeader(data, compData []byte) (hdr []byte, payload []byte) { +func msgHeader(data, compData mem.BufferSlice, pf payloadFormat) (hdr []byte, payload mem.BufferSlice) { hdr = make([]byte, headerLen) - if compData != nil { - hdr[0] = byte(compressionMade) - data = compData + hdr[0] = byte(pf) + + var length uint32 + if pf.isCompressed() { + length = uint32(compData.Len()) + payload = compData } else { - hdr[0] = byte(compressionNone) + length = uint32(data.Len()) + payload = data } // Write length of payload into buf - binary.BigEndian.PutUint32(hdr[payloadLen:], uint32(len(data))) - return hdr, data + binary.BigEndian.PutUint32(hdr[payloadLen:], length) + return hdr, payload } -func outPayload(client bool, msg any, data, payload []byte, t time.Time) *stats.OutPayload { +func outPayload(client bool, msg any, dataLength, payloadLength int, t time.Time) *stats.OutPayload { return &stats.OutPayload{ Client: client, Payload: msg, - Data: data, - Length: len(data), - WireLength: len(payload) + headerLen, - CompressedLength: len(payload), + Length: dataLength, + WireLength: payloadLength + headerLen, + CompressedLength: payloadLength, SentTime: t, } } -func checkRecvPayload(pf payloadFormat, recvCompress string, haveCompressor bool) *status.Status { +func checkRecvPayload(pf payloadFormat, recvCompress string, haveCompressor bool, isServer bool) *status.Status { switch pf { case compressionNone: case compressionMade: @@ -731,7 +789,11 @@ func checkRecvPayload(pf payloadFormat, recvCompress string, haveCompressor bool return status.New(codes.Internal, "grpc: compressed flag set with identity or empty encoding") } if !haveCompressor { - return status.Newf(codes.Unimplemented, "grpc: Decompressor is not installed for grpc-encoding %q", recvCompress) + if isServer { + return status.Newf(codes.Unimplemented, "grpc: Decompressor is not installed for grpc-encoding %q", recvCompress) + } else { + return status.Newf(codes.Internal, "grpc: Decompressor is not installed for grpc-encoding %q", recvCompress) + } } default: return status.Newf(codes.Internal, "grpc: received unexpected payload format %d", pf) @@ -741,104 +803,129 @@ func checkRecvPayload(pf payloadFormat, recvCompress string, haveCompressor bool type payloadInfo struct { compressedLength int // The compressed length got from wire. - uncompressedBytes []byte + uncompressedBytes mem.BufferSlice +} + +func (p *payloadInfo) free() { + if p != nil && p.uncompressedBytes != nil { + p.uncompressedBytes.Free() + } } // recvAndDecompress reads a message from the stream, decompressing it if necessary. // // Cancelling the returned cancel function releases the buffer back to the pool. So the caller should cancel as soon as // the buffer is no longer needed. -func recvAndDecompress(p *parser, s *transport.Stream, dc Decompressor, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor, -) (uncompressedBuf []byte, cancel func(), err error) { - pf, compressedBuf, err := p.recvMsg(maxReceiveMessageSize) +// TODO: Refactor this function to reduce the number of arguments. +// See: https://google.github.io/styleguide/go/best-practices.html#function-argument-lists +func recvAndDecompress(p *parser, s *transport.Stream, dc Decompressor, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor, isServer bool, +) (out mem.BufferSlice, err error) { + pf, compressed, err := p.recvMsg(maxReceiveMessageSize) if err != nil { - return nil, nil, err + return nil, err } - if st := checkRecvPayload(pf, s.RecvCompress(), compressor != nil || dc != nil); st != nil { - return nil, nil, st.Err() + compressedLength := compressed.Len() + + if st := checkRecvPayload(pf, s.RecvCompress(), compressor != nil || dc != nil, isServer); st != nil { + compressed.Free() + return nil, st.Err() } var size int - if pf == compressionMade { + if pf.isCompressed() { + defer compressed.Free() + // To match legacy behavior, if the decompressor is set by WithDecompressor or RPCDecompressor, // use this decompressor as the default. if dc != nil { - uncompressedBuf, err = dc.Do(bytes.NewReader(compressedBuf)) + var uncompressedBuf []byte + uncompressedBuf, err = dc.Do(compressed.Reader()) + if err == nil { + out = mem.BufferSlice{mem.NewBuffer(&uncompressedBuf, nil)} + } size = len(uncompressedBuf) } else { - uncompressedBuf, size, err = decompress(compressor, compressedBuf, maxReceiveMessageSize) + out, size, err = decompress(compressor, compressed, maxReceiveMessageSize, p.bufferPool) } if err != nil { - return nil, nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message: %v", err) + return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message: %v", err) } if size > maxReceiveMessageSize { + out.Free() // TODO: Revisit the error code. Currently keep it consistent with java // implementation. - return nil, nil, status.Errorf(codes.ResourceExhausted, "grpc: received message after decompression larger than max (%d vs. %d)", size, maxReceiveMessageSize) + return nil, status.Errorf(codes.ResourceExhausted, "grpc: received message after decompression larger than max (%d vs. %d)", size, maxReceiveMessageSize) } } else { - uncompressedBuf = compressedBuf + out = compressed } if payInfo != nil { - payInfo.compressedLength = len(compressedBuf) - payInfo.uncompressedBytes = uncompressedBuf - - cancel = func() {} - } else { - cancel = func() { - p.recvBufferPool.Put(&compressedBuf) - } + payInfo.compressedLength = compressedLength + out.Ref() + payInfo.uncompressedBytes = out } - return uncompressedBuf, cancel, nil + return out, nil } // Using compressor, decompress d, returning data and size. // Optionally, if data will be over maxReceiveMessageSize, just return the size. -func decompress(compressor encoding.Compressor, d []byte, maxReceiveMessageSize int) ([]byte, int, error) { - dcReader, err := compressor.Decompress(bytes.NewReader(d)) +func decompress(compressor encoding.Compressor, d mem.BufferSlice, maxReceiveMessageSize int, pool mem.BufferPool) (mem.BufferSlice, int, error) { + dcReader, err := compressor.Decompress(d.Reader()) if err != nil { return nil, 0, err } - if sizer, ok := compressor.(interface { - DecompressedSize(compressedBytes []byte) int - }); ok { - if size := sizer.DecompressedSize(d); size >= 0 { - if size > maxReceiveMessageSize { - return nil, size, nil - } - // size is used as an estimate to size the buffer, but we - // will read more data if available. - // +MinRead so ReadFrom will not reallocate if size is correct. - // - // TODO: If we ensure that the buffer size is the same as the DecompressedSize, - // we can also utilize the recv buffer pool here. - buf := bytes.NewBuffer(make([]byte, 0, size+bytes.MinRead)) - bytesRead, err := buf.ReadFrom(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1)) - return buf.Bytes(), int(bytesRead), err - } + + // TODO: Can/should this still be preserved with the new BufferSlice API? Are + // there any actual benefits to allocating a single large buffer instead of + // multiple smaller ones? + //if sizer, ok := compressor.(interface { + // DecompressedSize(compressedBytes []byte) int + //}); ok { + // if size := sizer.DecompressedSize(d); size >= 0 { + // if size > maxReceiveMessageSize { + // return nil, size, nil + // } + // // size is used as an estimate to size the buffer, but we + // // will read more data if available. + // // +MinRead so ReadFrom will not reallocate if size is correct. + // // + // // TODO: If we ensure that the buffer size is the same as the DecompressedSize, + // // we can also utilize the recv buffer pool here. + // buf := bytes.NewBuffer(make([]byte, 0, size+bytes.MinRead)) + // bytesRead, err := buf.ReadFrom(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1)) + // return buf.Bytes(), int(bytesRead), err + // } + //} + + var out mem.BufferSlice + _, err = io.Copy(mem.NewWriter(&out, pool), io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1)) + if err != nil { + out.Free() + return nil, 0, err } - // Read from LimitReader with limit max+1. So if the underlying - // reader is over limit, the result will be bigger than max. - d, err = io.ReadAll(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1)) - return d, len(d), err + return out, out.Len(), nil } // For the two compressor parameters, both should not be set, but if they are, // dc takes precedence over compressor. // TODO(dfawley): wrap the old compressor/decompressor using the new API? -func recv(p *parser, c baseCodec, s *transport.Stream, dc Decompressor, m any, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor) error { - buf, cancel, err := recvAndDecompress(p, s, dc, maxReceiveMessageSize, payInfo, compressor) +func recv(p *parser, c baseCodec, s *transport.Stream, dc Decompressor, m any, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor, isServer bool) error { + data, err := recvAndDecompress(p, s, dc, maxReceiveMessageSize, payInfo, compressor, isServer) if err != nil { return err } - defer cancel() - if err := c.Unmarshal(buf, m); err != nil { + // If the codec wants its own reference to the data, it can get it. Otherwise, always + // free the buffers. + defer data.Free() + + if err := c.Unmarshal(data, m); err != nil { return status.Errorf(codes.Internal, "grpc: failed to unmarshal the received message: %v", err) } + return nil } @@ -941,7 +1028,7 @@ func setCallInfoCodec(c *callInfo) error { // encoding.Codec (Name vs. String method name). We only support // setting content subtype from encoding.Codec to avoid a behavior // change with the deprecated version. - if ec, ok := c.codec.(encoding.Codec); ok { + if ec, ok := c.codec.(encoding.CodecV2); ok { c.contentSubtype = strings.ToLower(ec.Name()) } } @@ -950,12 +1037,12 @@ func setCallInfoCodec(c *callInfo) error { if c.contentSubtype == "" { // No codec specified in CallOptions; use proto by default. - c.codec = encoding.GetCodec(proto.Name) + c.codec = getCodec(proto.Name) return nil } // c.contentSubtype is already lowercased in CallContentSubtype - c.codec = encoding.GetCodec(c.contentSubtype) + c.codec = getCodec(c.contentSubtype) if c.codec == nil { return status.Errorf(codes.Internal, "no codec registered for content-subtype %s", c.contentSubtype) } diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go index 89f8e479..d1e1415a 100644 --- a/vendor/google.golang.org/grpc/server.go +++ b/vendor/google.golang.org/grpc/server.go @@ -45,6 +45,7 @@ import ( "google.golang.org/grpc/internal/grpcutil" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" + "google.golang.org/grpc/mem" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" "google.golang.org/grpc/stats" @@ -80,7 +81,7 @@ func init() { } internal.BinaryLogger = binaryLogger internal.JoinServerOptions = newJoinServerOption - internal.RecvBufferPool = recvBufferPool + internal.BufferPool = bufferPool } var statusOK = status.New(codes.OK, "") @@ -170,7 +171,7 @@ type serverOptions struct { maxHeaderListSize *uint32 headerTableSize *uint32 numServerWorkers uint32 - recvBufferPool SharedBufferPool + bufferPool mem.BufferPool waitForHandlers bool } @@ -181,7 +182,7 @@ var defaultServerOptions = serverOptions{ connectionTimeout: 120 * time.Second, writeBufferSize: defaultWriteBufSize, readBufferSize: defaultReadBufSize, - recvBufferPool: nopBufferPool{}, + bufferPool: mem.DefaultBufferPool(), } var globalServerOptions []ServerOption @@ -313,7 +314,7 @@ func KeepaliveEnforcementPolicy(kep keepalive.EnforcementPolicy) ServerOption { // Will be supported throughout 1.x. func CustomCodec(codec Codec) ServerOption { return newFuncServerOption(func(o *serverOptions) { - o.codec = codec + o.codec = newCodecV0Bridge(codec) }) } @@ -342,7 +343,22 @@ func CustomCodec(codec Codec) ServerOption { // later release. func ForceServerCodec(codec encoding.Codec) ServerOption { return newFuncServerOption(func(o *serverOptions) { - o.codec = codec + o.codec = newCodecV1Bridge(codec) + }) +} + +// ForceServerCodecV2 is the equivalent of ForceServerCodec, but for the new +// CodecV2 interface. +// +// Will be supported throughout 1.x. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a +// later release. +func ForceServerCodecV2(codecV2 encoding.CodecV2) ServerOption { + return newFuncServerOption(func(o *serverOptions) { + o.codec = codecV2 }) } @@ -592,26 +608,9 @@ func WaitForHandlers(w bool) ServerOption { }) } -// RecvBufferPool returns a ServerOption that configures the server -// to use the provided shared buffer pool for parsing incoming messages. Depending -// on the application's workload, this could result in reduced memory allocation. -// -// If you are unsure about how to implement a memory pool but want to utilize one, -// begin with grpc.NewSharedBufferPool. -// -// Note: The shared buffer pool feature will not be active if any of the following -// options are used: StatsHandler, EnableTracing, or binary logging. In such -// cases, the shared buffer pool will be ignored. -// -// Deprecated: use experimental.WithRecvBufferPool instead. Will be deleted in -// v1.60.0 or later. -func RecvBufferPool(bufferPool SharedBufferPool) ServerOption { - return recvBufferPool(bufferPool) -} - -func recvBufferPool(bufferPool SharedBufferPool) ServerOption { +func bufferPool(bufferPool mem.BufferPool) ServerOption { return newFuncServerOption(func(o *serverOptions) { - o.recvBufferPool = bufferPool + o.bufferPool = bufferPool }) } @@ -622,7 +621,7 @@ func recvBufferPool(bufferPool SharedBufferPool) ServerOption { // workload (assuming a QPS of a few thousand requests/sec). const serverWorkerResetThreshold = 1 << 16 -// serverWorkers blocks on a *transport.Stream channel forever and waits for +// serverWorker blocks on a *transport.Stream channel forever and waits for // data to be fed by serveStreams. This allows multiple requests to be // processed by the same goroutine, removing the need for expensive stack // re-allocations (see the runtime.morestack problem [1]). @@ -980,6 +979,7 @@ func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport { ChannelzParent: s.channelz, MaxHeaderListSize: s.opts.maxHeaderListSize, HeaderTableSize: s.opts.headerTableSize, + BufferPool: s.opts.bufferPool, } st, err := transport.NewServerTransport(c, config) if err != nil { @@ -1072,7 +1072,7 @@ var _ http.Handler = (*Server)(nil) // Notice: This API is EXPERIMENTAL and may be changed or removed in a // later release. func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { - st, err := transport.NewServerHandlerTransport(w, r, s.opts.statsHandlers) + st, err := transport.NewServerHandlerTransport(w, r, s.opts.statsHandlers, s.opts.bufferPool) if err != nil { // Errors returned from transport.NewServerHandlerTransport have // already been written to w. @@ -1142,20 +1142,35 @@ func (s *Server) sendResponse(ctx context.Context, t transport.ServerTransport, channelz.Error(logger, s.channelz, "grpc: server failed to encode response: ", err) return err } - compData, err := compress(data, cp, comp) + + compData, pf, err := compress(data, cp, comp, s.opts.bufferPool) if err != nil { + data.Free() channelz.Error(logger, s.channelz, "grpc: server failed to compress response: ", err) return err } - hdr, payload := msgHeader(data, compData) + + hdr, payload := msgHeader(data, compData, pf) + + defer func() { + compData.Free() + data.Free() + // payload does not need to be freed here, it is either data or compData, both of + // which are already freed. + }() + + dataLen := data.Len() + payloadLen := payload.Len() // TODO(dfawley): should we be checking len(data) instead? - if len(payload) > s.opts.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max (%d vs. %d)", len(payload), s.opts.maxSendMessageSize) + if payloadLen > s.opts.maxSendMessageSize { + return status.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max (%d vs. %d)", payloadLen, s.opts.maxSendMessageSize) } err = t.Write(stream, hdr, payload, opts) if err == nil { - for _, sh := range s.opts.statsHandlers { - sh.HandleRPC(ctx, outPayload(false, msg, data, payload, time.Now())) + if len(s.opts.statsHandlers) != 0 { + for _, sh := range s.opts.statsHandlers { + sh.HandleRPC(ctx, outPayload(false, msg, dataLen, payloadLen, time.Now())) + } } } return err @@ -1334,37 +1349,37 @@ func (s *Server) processUnaryRPC(ctx context.Context, t transport.ServerTranspor var payInfo *payloadInfo if len(shs) != 0 || len(binlogs) != 0 { payInfo = &payloadInfo{} + defer payInfo.free() } - d, cancel, err := recvAndDecompress(&parser{r: stream, recvBufferPool: s.opts.recvBufferPool}, stream, dc, s.opts.maxReceiveMessageSize, payInfo, decomp) + d, err := recvAndDecompress(&parser{r: stream, bufferPool: s.opts.bufferPool}, stream, dc, s.opts.maxReceiveMessageSize, payInfo, decomp, true) if err != nil { if e := t.WriteStatus(stream, status.Convert(err)); e != nil { channelz.Warningf(logger, s.channelz, "grpc: Server.processUnaryRPC failed to write status: %v", e) } return err } + defer d.Free() if channelz.IsOn() { t.IncrMsgRecv() } df := func(v any) error { - defer cancel() - if err := s.getCodec(stream.ContentSubtype()).Unmarshal(d, v); err != nil { return status.Errorf(codes.Internal, "grpc: error unmarshalling request: %v", err) } + for _, sh := range shs { sh.HandleRPC(ctx, &stats.InPayload{ RecvTime: time.Now(), Payload: v, - Length: len(d), + Length: d.Len(), WireLength: payInfo.compressedLength + headerLen, CompressedLength: payInfo.compressedLength, - Data: d, }) } if len(binlogs) != 0 { cm := &binarylog.ClientMessage{ - Message: d, + Message: d.Materialize(), } for _, binlog := range binlogs { binlog.Log(ctx, cm) @@ -1548,7 +1563,7 @@ func (s *Server) processStreamingRPC(ctx context.Context, t transport.ServerTran ctx: ctx, t: t, s: stream, - p: &parser{r: stream, recvBufferPool: s.opts.recvBufferPool}, + p: &parser{r: stream, bufferPool: s.opts.bufferPool}, codec: s.getCodec(stream.ContentSubtype()), maxReceiveMessageSize: s.opts.maxReceiveMessageSize, maxSendMessageSize: s.opts.maxSendMessageSize, @@ -1963,12 +1978,12 @@ func (s *Server) getCodec(contentSubtype string) baseCodec { return s.opts.codec } if contentSubtype == "" { - return encoding.GetCodec(proto.Name) + return getCodec(proto.Name) } - codec := encoding.GetCodec(contentSubtype) + codec := getCodec(contentSubtype) if codec == nil { logger.Warningf("Unsupported codec %q. Defaulting to %q for now. This will start to fail in future releases.", contentSubtype, proto.Name) - return encoding.GetCodec(proto.Name) + return getCodec(proto.Name) } return codec } diff --git a/vendor/google.golang.org/grpc/service_config.go b/vendor/google.golang.org/grpc/service_config.go index 9da8fc80..2671c5ef 100644 --- a/vendor/google.golang.org/grpc/service_config.go +++ b/vendor/google.golang.org/grpc/service_config.go @@ -26,6 +26,7 @@ import ( "time" "google.golang.org/grpc/balancer" + "google.golang.org/grpc/balancer/pickfirst" "google.golang.org/grpc/codes" "google.golang.org/grpc/internal" "google.golang.org/grpc/internal/balancer/gracefulswitch" @@ -163,9 +164,11 @@ type jsonSC struct { } func init() { - internal.ParseServiceConfig = parseServiceConfig + internal.ParseServiceConfig = func(js string) *serviceconfig.ParseResult { + return parseServiceConfig(js, defaultMaxCallAttempts) + } } -func parseServiceConfig(js string) *serviceconfig.ParseResult { +func parseServiceConfig(js string, maxAttempts int) *serviceconfig.ParseResult { if len(js) == 0 { return &serviceconfig.ParseResult{Err: fmt.Errorf("no JSON service config provided")} } @@ -183,12 +186,12 @@ func parseServiceConfig(js string) *serviceconfig.ParseResult { } c := rsc.LoadBalancingConfig if c == nil { - name := PickFirstBalancerName + name := pickfirst.Name if rsc.LoadBalancingPolicy != nil { name = *rsc.LoadBalancingPolicy } if balancer.Get(name) == nil { - name = PickFirstBalancerName + name = pickfirst.Name } cfg := []map[string]any{{name: struct{}{}}} strCfg, err := json.Marshal(cfg) @@ -218,7 +221,7 @@ func parseServiceConfig(js string) *serviceconfig.ParseResult { WaitForReady: m.WaitForReady, Timeout: (*time.Duration)(m.Timeout), } - if mc.RetryPolicy, err = convertRetryPolicy(m.RetryPolicy); err != nil { + if mc.RetryPolicy, err = convertRetryPolicy(m.RetryPolicy, maxAttempts); err != nil { logger.Warningf("grpc: unmarshalling service config %s: %v", js, err) return &serviceconfig.ParseResult{Err: err} } @@ -264,7 +267,7 @@ func parseServiceConfig(js string) *serviceconfig.ParseResult { return &serviceconfig.ParseResult{Config: &sc} } -func convertRetryPolicy(jrp *jsonRetryPolicy) (p *internalserviceconfig.RetryPolicy, err error) { +func convertRetryPolicy(jrp *jsonRetryPolicy, maxAttempts int) (p *internalserviceconfig.RetryPolicy, err error) { if jrp == nil { return nil, nil } @@ -278,17 +281,16 @@ func convertRetryPolicy(jrp *jsonRetryPolicy) (p *internalserviceconfig.RetryPol return nil, nil } + if jrp.MaxAttempts < maxAttempts { + maxAttempts = jrp.MaxAttempts + } rp := &internalserviceconfig.RetryPolicy{ - MaxAttempts: jrp.MaxAttempts, + MaxAttempts: maxAttempts, InitialBackoff: time.Duration(jrp.InitialBackoff), MaxBackoff: time.Duration(jrp.MaxBackoff), BackoffMultiplier: jrp.BackoffMultiplier, RetryableStatusCodes: make(map[codes.Code]bool), } - if rp.MaxAttempts > 5 { - // TODO(retry): Make the max maxAttempts configurable. - rp.MaxAttempts = 5 - } for _, code := range jrp.RetryableStatusCodes { rp.RetryableStatusCodes[code] = true } diff --git a/vendor/google.golang.org/grpc/shared_buffer_pool.go b/vendor/google.golang.org/grpc/shared_buffer_pool.go deleted file mode 100644 index 48a64cfe..00000000 --- a/vendor/google.golang.org/grpc/shared_buffer_pool.go +++ /dev/null @@ -1,154 +0,0 @@ -/* - * - * Copyright 2023 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package grpc - -import "sync" - -// SharedBufferPool is a pool of buffers that can be shared, resulting in -// decreased memory allocation. Currently, in gRPC-go, it is only utilized -// for parsing incoming messages. -// -// # Experimental -// -// Notice: This API is EXPERIMENTAL and may be changed or removed in a -// later release. -type SharedBufferPool interface { - // Get returns a buffer with specified length from the pool. - // - // The returned byte slice may be not zero initialized. - Get(length int) []byte - - // Put returns a buffer to the pool. - Put(*[]byte) -} - -// NewSharedBufferPool creates a simple SharedBufferPool with buckets -// of different sizes to optimize memory usage. This prevents the pool from -// wasting large amounts of memory, even when handling messages of varying sizes. -// -// # Experimental -// -// Notice: This API is EXPERIMENTAL and may be changed or removed in a -// later release. -func NewSharedBufferPool() SharedBufferPool { - return &simpleSharedBufferPool{ - pools: [poolArraySize]simpleSharedBufferChildPool{ - newBytesPool(level0PoolMaxSize), - newBytesPool(level1PoolMaxSize), - newBytesPool(level2PoolMaxSize), - newBytesPool(level3PoolMaxSize), - newBytesPool(level4PoolMaxSize), - newBytesPool(0), - }, - } -} - -// simpleSharedBufferPool is a simple implementation of SharedBufferPool. -type simpleSharedBufferPool struct { - pools [poolArraySize]simpleSharedBufferChildPool -} - -func (p *simpleSharedBufferPool) Get(size int) []byte { - return p.pools[p.poolIdx(size)].Get(size) -} - -func (p *simpleSharedBufferPool) Put(bs *[]byte) { - p.pools[p.poolIdx(cap(*bs))].Put(bs) -} - -func (p *simpleSharedBufferPool) poolIdx(size int) int { - switch { - case size <= level0PoolMaxSize: - return level0PoolIdx - case size <= level1PoolMaxSize: - return level1PoolIdx - case size <= level2PoolMaxSize: - return level2PoolIdx - case size <= level3PoolMaxSize: - return level3PoolIdx - case size <= level4PoolMaxSize: - return level4PoolIdx - default: - return levelMaxPoolIdx - } -} - -const ( - level0PoolMaxSize = 16 // 16 B - level1PoolMaxSize = level0PoolMaxSize * 16 // 256 B - level2PoolMaxSize = level1PoolMaxSize * 16 // 4 KB - level3PoolMaxSize = level2PoolMaxSize * 16 // 64 KB - level4PoolMaxSize = level3PoolMaxSize * 16 // 1 MB -) - -const ( - level0PoolIdx = iota - level1PoolIdx - level2PoolIdx - level3PoolIdx - level4PoolIdx - levelMaxPoolIdx - poolArraySize -) - -type simpleSharedBufferChildPool interface { - Get(size int) []byte - Put(any) -} - -type bufferPool struct { - sync.Pool - - defaultSize int -} - -func (p *bufferPool) Get(size int) []byte { - bs := p.Pool.Get().(*[]byte) - - if cap(*bs) < size { - p.Pool.Put(bs) - - return make([]byte, size) - } - - return (*bs)[:size] -} - -func newBytesPool(size int) simpleSharedBufferChildPool { - return &bufferPool{ - Pool: sync.Pool{ - New: func() any { - bs := make([]byte, size) - return &bs - }, - }, - defaultSize: size, - } -} - -// nopBufferPool is a buffer pool just makes new buffer without pooling. -type nopBufferPool struct { -} - -func (nopBufferPool) Get(length int) []byte { - return make([]byte, length) -} - -func (nopBufferPool) Put(*[]byte) { -} diff --git a/vendor/google.golang.org/grpc/stats/stats.go b/vendor/google.golang.org/grpc/stats/stats.go index fdb0bd65..71195c49 100644 --- a/vendor/google.golang.org/grpc/stats/stats.go +++ b/vendor/google.golang.org/grpc/stats/stats.go @@ -77,9 +77,6 @@ type InPayload struct { // the call to HandleRPC which provides the InPayload returns and must be // copied if needed later. Payload any - // Data is the serialized message payload. - // Deprecated: Data will be removed in the next release. - Data []byte // Length is the size of the uncompressed payload data. Does not include any // framing (gRPC or HTTP/2). @@ -150,9 +147,6 @@ type OutPayload struct { // the call to HandleRPC which provides the OutPayload returns and must be // copied if needed later. Payload any - // Data is the serialized message payload. - // Deprecated: Data will be removed in the next release. - Data []byte // Length is the size of the uncompressed payload data. Does not include any // framing (gRPC or HTTP/2). Length int diff --git a/vendor/google.golang.org/grpc/stream.go b/vendor/google.golang.org/grpc/stream.go index b54563e8..bb2b2a21 100644 --- a/vendor/google.golang.org/grpc/stream.go +++ b/vendor/google.golang.org/grpc/stream.go @@ -23,6 +23,7 @@ import ( "errors" "io" "math" + "math/rand" "strconv" "sync" "time" @@ -34,13 +35,13 @@ import ( "google.golang.org/grpc/internal/balancerload" "google.golang.org/grpc/internal/binarylog" "google.golang.org/grpc/internal/channelz" - "google.golang.org/grpc/internal/grpcrand" "google.golang.org/grpc/internal/grpcutil" imetadata "google.golang.org/grpc/internal/metadata" iresolver "google.golang.org/grpc/internal/resolver" "google.golang.org/grpc/internal/serviceconfig" istatus "google.golang.org/grpc/internal/status" "google.golang.org/grpc/internal/transport" + "google.golang.org/grpc/mem" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" "google.golang.org/grpc/stats" @@ -359,7 +360,7 @@ func newClientStreamWithParams(ctx context.Context, desc *StreamDesc, cc *Client cs.attempt = a return nil } - if err := cs.withRetry(op, func() { cs.bufferForRetryLocked(0, op) }); err != nil { + if err := cs.withRetry(op, func() { cs.bufferForRetryLocked(0, op, nil) }); err != nil { return nil, err } @@ -517,7 +518,7 @@ func (a *csAttempt) newStream() error { } a.s = s a.ctx = s.Context() - a.p = &parser{r: s, recvBufferPool: a.cs.cc.dopts.recvBufferPool} + a.p = &parser{r: s, bufferPool: a.cs.cc.dopts.copts.BufferPool} return nil } @@ -566,10 +567,15 @@ type clientStream struct { // place where we need to check if the attempt is nil. attempt *csAttempt // TODO(hedging): hedging will have multiple attempts simultaneously. - committed bool // active attempt committed for retry? - onCommit func() - buffer []func(a *csAttempt) error // operations to replay on retry - bufferSize int // current size of buffer + committed bool // active attempt committed for retry? + onCommit func() + replayBuffer []replayOp // operations to replay on retry + replayBufferSize int // current size of replayBuffer +} + +type replayOp struct { + op func(a *csAttempt) error + cleanup func() } // csAttempt implements a single transport stream attempt within a @@ -607,7 +613,12 @@ func (cs *clientStream) commitAttemptLocked() { cs.onCommit() } cs.committed = true - cs.buffer = nil + for _, op := range cs.replayBuffer { + if op.cleanup != nil { + op.cleanup() + } + } + cs.replayBuffer = nil } func (cs *clientStream) commitAttempt() { @@ -699,7 +710,7 @@ func (a *csAttempt) shouldRetry(err error) (bool, error) { if max := float64(rp.MaxBackoff); cur > max { cur = max } - dur = time.Duration(grpcrand.Int63n(int64(cur))) + dur = time.Duration(rand.Int63n(int64(cur))) cs.numRetriesSincePushback++ } @@ -732,7 +743,7 @@ func (cs *clientStream) retryLocked(attempt *csAttempt, lastErr error) error { // the stream is canceled. return err } - // Note that the first op in the replay buffer always sets cs.attempt + // Note that the first op in replayBuffer always sets cs.attempt // if it is able to pick a transport and create a stream. if lastErr = cs.replayBufferLocked(attempt); lastErr == nil { return nil @@ -761,7 +772,7 @@ func (cs *clientStream) withRetry(op func(a *csAttempt) error, onSuccess func()) // already be status errors. return toRPCErr(op(cs.attempt)) } - if len(cs.buffer) == 0 { + if len(cs.replayBuffer) == 0 { // For the first op, which controls creation of the stream and // assigns cs.attempt, we need to create a new attempt inline // before executing the first op. On subsequent ops, the attempt @@ -851,25 +862,26 @@ func (cs *clientStream) Trailer() metadata.MD { } func (cs *clientStream) replayBufferLocked(attempt *csAttempt) error { - for _, f := range cs.buffer { - if err := f(attempt); err != nil { + for _, f := range cs.replayBuffer { + if err := f.op(attempt); err != nil { return err } } return nil } -func (cs *clientStream) bufferForRetryLocked(sz int, op func(a *csAttempt) error) { +func (cs *clientStream) bufferForRetryLocked(sz int, op func(a *csAttempt) error, cleanup func()) { // Note: we still will buffer if retry is disabled (for transparent retries). if cs.committed { return } - cs.bufferSize += sz - if cs.bufferSize > cs.callInfo.maxRetryRPCBufferSize { + cs.replayBufferSize += sz + if cs.replayBufferSize > cs.callInfo.maxRetryRPCBufferSize { cs.commitAttemptLocked() + cleanup() return } - cs.buffer = append(cs.buffer, op) + cs.replayBuffer = append(cs.replayBuffer, replayOp{op: op, cleanup: cleanup}) } func (cs *clientStream) SendMsg(m any) (err error) { @@ -891,23 +903,50 @@ func (cs *clientStream) SendMsg(m any) (err error) { } // load hdr, payload, data - hdr, payload, data, err := prepareMsg(m, cs.codec, cs.cp, cs.comp) + hdr, data, payload, pf, err := prepareMsg(m, cs.codec, cs.cp, cs.comp, cs.cc.dopts.copts.BufferPool) if err != nil { return err } + defer func() { + data.Free() + // only free payload if compression was made, and therefore it is a different set + // of buffers from data. + if pf.isCompressed() { + payload.Free() + } + }() + + dataLen := data.Len() + payloadLen := payload.Len() // TODO(dfawley): should we be checking len(data) instead? - if len(payload) > *cs.callInfo.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payload), *cs.callInfo.maxSendMessageSize) + if payloadLen > *cs.callInfo.maxSendMessageSize { + return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", payloadLen, *cs.callInfo.maxSendMessageSize) } + + // always take an extra ref in case data == payload (i.e. when the data isn't + // compressed). The original ref will always be freed by the deferred free above. + payload.Ref() op := func(a *csAttempt) error { - return a.sendMsg(m, hdr, payload, data) + return a.sendMsg(m, hdr, payload, dataLen, payloadLen) + } + + // onSuccess is invoked when the op is captured for a subsequent retry. If the + // stream was established by a previous message and therefore retries are + // disabled, onSuccess will not be invoked, and payloadRef can be freed + // immediately. + onSuccessCalled := false + err = cs.withRetry(op, func() { + cs.bufferForRetryLocked(len(hdr)+payloadLen, op, payload.Free) + onSuccessCalled = true + }) + if !onSuccessCalled { + payload.Free() } - err = cs.withRetry(op, func() { cs.bufferForRetryLocked(len(hdr)+len(payload), op) }) if len(cs.binlogs) != 0 && err == nil { cm := &binarylog.ClientMessage{ OnClientSide: true, - Message: data, + Message: data.Materialize(), } for _, binlog := range cs.binlogs { binlog.Log(cs.ctx, cm) @@ -924,6 +963,7 @@ func (cs *clientStream) RecvMsg(m any) error { var recvInfo *payloadInfo if len(cs.binlogs) != 0 { recvInfo = &payloadInfo{} + defer recvInfo.free() } err := cs.withRetry(func(a *csAttempt) error { return a.recvMsg(m, recvInfo) @@ -931,7 +971,7 @@ func (cs *clientStream) RecvMsg(m any) error { if len(cs.binlogs) != 0 && err == nil { sm := &binarylog.ServerMessage{ OnClientSide: true, - Message: recvInfo.uncompressedBytes, + Message: recvInfo.uncompressedBytes.Materialize(), } for _, binlog := range cs.binlogs { binlog.Log(cs.ctx, sm) @@ -958,7 +998,7 @@ func (cs *clientStream) CloseSend() error { // RecvMsg. This also matches historical behavior. return nil } - cs.withRetry(op, func() { cs.bufferForRetryLocked(0, op) }) + cs.withRetry(op, func() { cs.bufferForRetryLocked(0, op, nil) }) if len(cs.binlogs) != 0 { chc := &binarylog.ClientHalfClose{ OnClientSide: true, @@ -1034,7 +1074,7 @@ func (cs *clientStream) finish(err error) { cs.cancel() } -func (a *csAttempt) sendMsg(m any, hdr, payld, data []byte) error { +func (a *csAttempt) sendMsg(m any, hdr []byte, payld mem.BufferSlice, dataLength, payloadLength int) error { cs := a.cs if a.trInfo != nil { a.mu.Lock() @@ -1052,8 +1092,10 @@ func (a *csAttempt) sendMsg(m any, hdr, payld, data []byte) error { } return io.EOF } - for _, sh := range a.statsHandlers { - sh.HandleRPC(a.ctx, outPayload(true, m, data, payld, time.Now())) + if len(a.statsHandlers) != 0 { + for _, sh := range a.statsHandlers { + sh.HandleRPC(a.ctx, outPayload(true, m, dataLength, payloadLength, time.Now())) + } } if channelz.IsOn() { a.t.IncrMsgSent() @@ -1065,6 +1107,7 @@ func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) { cs := a.cs if len(a.statsHandlers) != 0 && payInfo == nil { payInfo = &payloadInfo{} + defer payInfo.free() } if !a.decompSet { @@ -1083,8 +1126,7 @@ func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) { // Only initialize this state once per stream. a.decompSet = true } - err = recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, payInfo, a.decomp) - if err != nil { + if err := recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, payInfo, a.decomp, false); err != nil { if err == io.EOF { if statusErr := a.s.Status().Err(); statusErr != nil { return statusErr @@ -1103,14 +1145,12 @@ func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) { } for _, sh := range a.statsHandlers { sh.HandleRPC(a.ctx, &stats.InPayload{ - Client: true, - RecvTime: time.Now(), - Payload: m, - // TODO truncate large payload. - Data: payInfo.uncompressedBytes, + Client: true, + RecvTime: time.Now(), + Payload: m, WireLength: payInfo.compressedLength + headerLen, CompressedLength: payInfo.compressedLength, - Length: len(payInfo.uncompressedBytes), + Length: payInfo.uncompressedBytes.Len(), }) } if channelz.IsOn() { @@ -1122,14 +1162,12 @@ func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) { } // Special handling for non-server-stream rpcs. // This recv expects EOF or errors, so we don't collect inPayload. - err = recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, nil, a.decomp) - if err == nil { - return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) - } - if err == io.EOF { + if err := recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, nil, a.decomp, false); err == io.EOF { return a.s.Status().Err() // non-server streaming Recv returns nil on success + } else if err != nil { + return toRPCErr(err) } - return toRPCErr(err) + return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) } func (a *csAttempt) finish(err error) { @@ -1185,12 +1223,12 @@ func (a *csAttempt) finish(err error) { a.mu.Unlock() } -// newClientStream creates a ClientStream with the specified transport, on the +// newNonRetryClientStream creates a ClientStream with the specified transport, on the // given addrConn. // // It's expected that the given transport is either the same one in addrConn, or // is already closed. To avoid race, transport is specified separately, instead -// of using ac.transpot. +// of using ac.transport. // // Main difference between this and ClientConn.NewStream: // - no retry @@ -1276,7 +1314,7 @@ func newNonRetryClientStream(ctx context.Context, desc *StreamDesc, method strin return nil, err } as.s = s - as.p = &parser{r: s, recvBufferPool: ac.dopts.recvBufferPool} + as.p = &parser{r: s, bufferPool: ac.dopts.copts.BufferPool} ac.incrCallsStarted() if desc != unaryStreamDesc { // Listen on stream context to cleanup when the stream context is @@ -1373,17 +1411,26 @@ func (as *addrConnStream) SendMsg(m any) (err error) { } // load hdr, payload, data - hdr, payld, _, err := prepareMsg(m, as.codec, as.cp, as.comp) + hdr, data, payload, pf, err := prepareMsg(m, as.codec, as.cp, as.comp, as.ac.dopts.copts.BufferPool) if err != nil { return err } + defer func() { + data.Free() + // only free payload if compression was made, and therefore it is a different set + // of buffers from data. + if pf.isCompressed() { + payload.Free() + } + }() + // TODO(dfawley): should we be checking len(data) instead? - if len(payld) > *as.callInfo.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payld), *as.callInfo.maxSendMessageSize) + if payload.Len() > *as.callInfo.maxSendMessageSize { + return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", payload.Len(), *as.callInfo.maxSendMessageSize) } - if err := as.t.Write(as.s, hdr, payld, &transport.Options{Last: !as.desc.ClientStreams}); err != nil { + if err := as.t.Write(as.s, hdr, payload, &transport.Options{Last: !as.desc.ClientStreams}); err != nil { if !as.desc.ClientStreams { // For non-client-streaming RPCs, we return nil instead of EOF on error // because the generated code requires it. finish is not called; RecvMsg() @@ -1423,8 +1470,7 @@ func (as *addrConnStream) RecvMsg(m any) (err error) { // Only initialize this state once per stream. as.decompSet = true } - err = recv(as.p, as.codec, as.s, as.dc, m, *as.callInfo.maxReceiveMessageSize, nil, as.decomp) - if err != nil { + if err := recv(as.p, as.codec, as.s, as.dc, m, *as.callInfo.maxReceiveMessageSize, nil, as.decomp, false); err != nil { if err == io.EOF { if statusErr := as.s.Status().Err(); statusErr != nil { return statusErr @@ -1444,14 +1490,12 @@ func (as *addrConnStream) RecvMsg(m any) (err error) { // Special handling for non-server-stream rpcs. // This recv expects EOF or errors, so we don't collect inPayload. - err = recv(as.p, as.codec, as.s, as.dc, m, *as.callInfo.maxReceiveMessageSize, nil, as.decomp) - if err == nil { - return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) - } - if err == io.EOF { + if err := recv(as.p, as.codec, as.s, as.dc, m, *as.callInfo.maxReceiveMessageSize, nil, as.decomp, false); err == io.EOF { return as.s.Status().Err() // non-server streaming Recv returns nil on success + } else if err != nil { + return toRPCErr(err) } - return toRPCErr(err) + return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) } func (as *addrConnStream) finish(err error) { @@ -1645,18 +1689,31 @@ func (ss *serverStream) SendMsg(m any) (err error) { } // load hdr, payload, data - hdr, payload, data, err := prepareMsg(m, ss.codec, ss.cp, ss.comp) + hdr, data, payload, pf, err := prepareMsg(m, ss.codec, ss.cp, ss.comp, ss.p.bufferPool) if err != nil { return err } + defer func() { + data.Free() + // only free payload if compression was made, and therefore it is a different set + // of buffers from data. + if pf.isCompressed() { + payload.Free() + } + }() + + dataLen := data.Len() + payloadLen := payload.Len() + // TODO(dfawley): should we be checking len(data) instead? - if len(payload) > ss.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payload), ss.maxSendMessageSize) + if payloadLen > ss.maxSendMessageSize { + return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", payloadLen, ss.maxSendMessageSize) } if err := ss.t.Write(ss.s, hdr, payload, &transport.Options{Last: false}); err != nil { return toRPCErr(err) } + if len(ss.binlogs) != 0 { if !ss.serverHeaderBinlogged { h, _ := ss.s.Header() @@ -1669,7 +1726,7 @@ func (ss *serverStream) SendMsg(m any) (err error) { } } sm := &binarylog.ServerMessage{ - Message: data, + Message: data.Materialize(), } for _, binlog := range ss.binlogs { binlog.Log(ss.ctx, sm) @@ -1677,7 +1734,7 @@ func (ss *serverStream) SendMsg(m any) (err error) { } if len(ss.statsHandler) != 0 { for _, sh := range ss.statsHandler { - sh.HandleRPC(ss.s.Context(), outPayload(false, m, data, payload, time.Now())) + sh.HandleRPC(ss.s.Context(), outPayload(false, m, dataLen, payloadLen, time.Now())) } } return nil @@ -1714,8 +1771,9 @@ func (ss *serverStream) RecvMsg(m any) (err error) { var payInfo *payloadInfo if len(ss.statsHandler) != 0 || len(ss.binlogs) != 0 { payInfo = &payloadInfo{} + defer payInfo.free() } - if err := recv(ss.p, ss.codec, ss.s, ss.dc, m, ss.maxReceiveMessageSize, payInfo, ss.decomp); err != nil { + if err := recv(ss.p, ss.codec, ss.s, ss.dc, m, ss.maxReceiveMessageSize, payInfo, ss.decomp, true); err != nil { if err == io.EOF { if len(ss.binlogs) != 0 { chc := &binarylog.ClientHalfClose{} @@ -1733,11 +1791,9 @@ func (ss *serverStream) RecvMsg(m any) (err error) { if len(ss.statsHandler) != 0 { for _, sh := range ss.statsHandler { sh.HandleRPC(ss.s.Context(), &stats.InPayload{ - RecvTime: time.Now(), - Payload: m, - // TODO truncate large payload. - Data: payInfo.uncompressedBytes, - Length: len(payInfo.uncompressedBytes), + RecvTime: time.Now(), + Payload: m, + Length: payInfo.uncompressedBytes.Len(), WireLength: payInfo.compressedLength + headerLen, CompressedLength: payInfo.compressedLength, }) @@ -1745,7 +1801,7 @@ func (ss *serverStream) RecvMsg(m any) (err error) { } if len(ss.binlogs) != 0 { cm := &binarylog.ClientMessage{ - Message: payInfo.uncompressedBytes, + Message: payInfo.uncompressedBytes.Materialize(), } for _, binlog := range ss.binlogs { binlog.Log(ss.ctx, cm) @@ -1760,23 +1816,26 @@ func MethodFromServerStream(stream ServerStream) (string, bool) { return Method(stream.Context()) } -// prepareMsg returns the hdr, payload and data -// using the compressors passed or using the -// passed preparedmsg -func prepareMsg(m any, codec baseCodec, cp Compressor, comp encoding.Compressor) (hdr, payload, data []byte, err error) { +// prepareMsg returns the hdr, payload and data using the compressors passed or +// using the passed preparedmsg. The returned boolean indicates whether +// compression was made and therefore whether the payload needs to be freed in +// addition to the returned data. Freeing the payload if the returned boolean is +// false can lead to undefined behavior. +func prepareMsg(m any, codec baseCodec, cp Compressor, comp encoding.Compressor, pool mem.BufferPool) (hdr []byte, data, payload mem.BufferSlice, pf payloadFormat, err error) { if preparedMsg, ok := m.(*PreparedMsg); ok { - return preparedMsg.hdr, preparedMsg.payload, preparedMsg.encodedData, nil + return preparedMsg.hdr, preparedMsg.encodedData, preparedMsg.payload, preparedMsg.pf, nil } // The input interface is not a prepared msg. // Marshal and Compress the data at this point data, err = encode(codec, m) if err != nil { - return nil, nil, nil, err + return nil, nil, nil, 0, err } - compData, err := compress(data, cp, comp) + compData, pf, err := compress(data, cp, comp, pool) if err != nil { - return nil, nil, nil, err + data.Free() + return nil, nil, nil, 0, err } - hdr, payload = msgHeader(data, compData) - return hdr, payload, data, nil + hdr, payload = msgHeader(data, compData, pf) + return hdr, data, payload, pf, nil } diff --git a/vendor/google.golang.org/grpc/stream_interfaces.go b/vendor/google.golang.org/grpc/stream_interfaces.go index 8b813529..0037fee0 100644 --- a/vendor/google.golang.org/grpc/stream_interfaces.go +++ b/vendor/google.golang.org/grpc/stream_interfaces.go @@ -22,15 +22,35 @@ package grpc // request, many responses) RPC. It is generic over the type of the response // message. It is used in generated code. type ServerStreamingClient[Res any] interface { + // Recv receives the next response message from the server. The client may + // repeatedly call Recv to read messages from the response stream. If + // io.EOF is returned, the stream has terminated with an OK status. Any + // other error is compatible with the status package and indicates the + // RPC's status code and message. Recv() (*Res, error) + + // ClientStream is embedded to provide Context, Header, and Trailer + // functionality. No other methods in the ClientStream should be called + // directly. ClientStream } // ServerStreamingServer represents the server side of a server-streaming (one // request, many responses) RPC. It is generic over the type of the response // message. It is used in generated code. +// +// To terminate the response stream, return from the handler method and return +// an error from the status package, or use nil to indicate an OK status code. type ServerStreamingServer[Res any] interface { + // Send sends a response message to the client. The server handler may + // call Send multiple times to send multiple messages to the client. An + // error is returned if the stream was terminated unexpectedly, and the + // handler method should return, as the stream is no longer usable. Send(*Res) error + + // ServerStream is embedded to provide Context, SetHeader, SendHeader, and + // SetTrailer functionality. No other methods in the ServerStream should + // be called directly. ServerStream } @@ -39,8 +59,22 @@ type ServerStreamingServer[Res any] interface { // message stream and the type of the unary response message. It is used in // generated code. type ClientStreamingClient[Req any, Res any] interface { + // Send sends a request message to the server. The client may call Send + // multiple times to send multiple messages to the server. On error, Send + // aborts the stream. If the error was generated by the client, the status + // is returned directly. Otherwise, io.EOF is returned, and the status of + // the stream may be discovered using CloseAndRecv(). Send(*Req) error + + // CloseAndRecv closes the request stream and waits for the server's + // response. This method must be called once and only once after sending + // all request messages. Any error returned is implemented by the status + // package. CloseAndRecv() (*Res, error) + + // ClientStream is embedded to provide Context, Header, and Trailer + // functionality. No other methods in the ClientStream should be called + // directly. ClientStream } @@ -48,9 +82,28 @@ type ClientStreamingClient[Req any, Res any] interface { // requests, one response) RPC. It is generic over both the type of the request // message stream and the type of the unary response message. It is used in // generated code. +// +// To terminate the RPC, call SendAndClose and return nil from the method +// handler or do not call SendAndClose and return an error from the status +// package. type ClientStreamingServer[Req any, Res any] interface { + // Recv receives the next request message from the client. The server may + // repeatedly call Recv to read messages from the request stream. If + // io.EOF is returned, it indicates the client called CloseAndRecv on its + // ClientStreamingClient. Any other error indicates the stream was + // terminated unexpectedly, and the handler method should return, as the + // stream is no longer usable. Recv() (*Req, error) + + // SendAndClose sends a single response message to the client and closes + // the stream. This method must be called once and only once after all + // request messages have been processed. Recv should not be called after + // calling SendAndClose. SendAndClose(*Res) error + + // ServerStream is embedded to provide Context, SetHeader, SendHeader, and + // SetTrailer functionality. No other methods in the ServerStream should + // be called directly. ServerStream } @@ -59,8 +112,23 @@ type ClientStreamingServer[Req any, Res any] interface { // request message stream and the type of the response message stream. It is // used in generated code. type BidiStreamingClient[Req any, Res any] interface { + // Send sends a request message to the server. The client may call Send + // multiple times to send multiple messages to the server. On error, Send + // aborts the stream. If the error was generated by the client, the status + // is returned directly. Otherwise, io.EOF is returned, and the status of + // the stream may be discovered using Recv(). Send(*Req) error + + // Recv receives the next response message from the server. The client may + // repeatedly call Recv to read messages from the response stream. If + // io.EOF is returned, the stream has terminated with an OK status. Any + // other error is compatible with the status package and indicates the + // RPC's status code and message. Recv() (*Res, error) + + // ClientStream is embedded to provide Context, Header, Trailer, and + // CloseSend functionality. No other methods in the ClientStream should be + // called directly. ClientStream } @@ -68,9 +136,27 @@ type BidiStreamingClient[Req any, Res any] interface { // (many requests, many responses) RPC. It is generic over both the type of the // request message stream and the type of the response message stream. It is // used in generated code. +// +// To terminate the stream, return from the handler method and return +// an error from the status package, or use nil to indicate an OK status code. type BidiStreamingServer[Req any, Res any] interface { + // Recv receives the next request message from the client. The server may + // repeatedly call Recv to read messages from the request stream. If + // io.EOF is returned, it indicates the client called CloseSend on its + // BidiStreamingClient. Any other error indicates the stream was + // terminated unexpectedly, and the handler method should return, as the + // stream is no longer usable. Recv() (*Req, error) + + // Send sends a response message to the client. The server handler may + // call Send multiple times to send multiple messages to the client. An + // error is returned if the stream was terminated unexpectedly, and the + // handler method should return, as the stream is no longer usable. Send(*Res) error + + // ServerStream is embedded to provide Context, SetHeader, SendHeader, and + // SetTrailer functionality. No other methods in the ServerStream should + // be called directly. ServerStream } diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go index e1806e76..187fbf11 100644 --- a/vendor/google.golang.org/grpc/version.go +++ b/vendor/google.golang.org/grpc/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.64.0" +const Version = "1.67.0" diff --git a/vendor/gorm.io/gorm/association.go b/vendor/gorm.io/gorm/association.go index 7c93ebea..e3f51d17 100644 --- a/vendor/gorm.io/gorm/association.go +++ b/vendor/gorm.io/gorm/association.go @@ -396,6 +396,10 @@ func (association *Association) saveAssociation(clear bool, values ...interface{ } } case reflect.Struct: + if !rv.CanAddr() { + association.Error = ErrInvalidValue + return + } association.Error = association.Relationship.Field.Set(association.DB.Statement.Context, source, rv.Addr().Interface()) if association.Relationship.Field.FieldType.Kind() == reflect.Struct { @@ -433,6 +437,10 @@ func (association *Association) saveAssociation(clear bool, values ...interface{ appendToFieldValues(reflect.Indirect(rv.Index(i)).Addr()) } case reflect.Struct: + if !rv.CanAddr() { + association.Error = ErrInvalidValue + return + } appendToFieldValues(rv.Addr()) } @@ -510,6 +518,9 @@ func (association *Association) saveAssociation(clear bool, values ...interface{ for i := 0; i < reflectValue.Len(); i++ { appendToRelations(reflectValue.Index(i), reflect.Indirect(reflect.ValueOf(values[i])), clear) + if association.Error != nil { + return + } // TODO support save slice data, sql with case? association.Error = associationDB.Updates(reflectValue.Index(i).Addr().Interface()).Error @@ -531,6 +542,9 @@ func (association *Association) saveAssociation(clear bool, values ...interface{ for idx, value := range values { rv := reflect.Indirect(reflect.ValueOf(value)) appendToRelations(reflectValue, rv, clear && idx == 0) + if association.Error != nil { + return + } } if len(values) > 0 { diff --git a/vendor/gorm.io/gorm/callbacks/preload.go b/vendor/gorm.io/gorm/callbacks/preload.go index 112343fa..fd8214bb 100644 --- a/vendor/gorm.io/gorm/callbacks/preload.go +++ b/vendor/gorm.io/gorm/callbacks/preload.go @@ -125,13 +125,15 @@ func preloadEntryPoint(db *gorm.DB, joins []string, relationships *schema.Relati case reflect.Slice, reflect.Array: if rv.Len() > 0 { reflectValue := rel.FieldSchema.MakeSlice().Elem() - reflectValue.SetLen(rv.Len()) for i := 0; i < rv.Len(); i++ { frv := rel.Field.ReflectValueOf(db.Statement.Context, rv.Index(i)) if frv.Kind() != reflect.Ptr { - reflectValue.Index(i).Set(frv.Addr()) + reflectValue = reflect.Append(reflectValue, frv.Addr()) } else { - reflectValue.Index(i).Set(frv) + if frv.IsNil() { + continue + } + reflectValue = reflect.Append(reflectValue, frv) } } @@ -140,7 +142,7 @@ func preloadEntryPoint(db *gorm.DB, joins []string, relationships *schema.Relati return err } } - case reflect.Struct: + case reflect.Struct, reflect.Pointer: reflectValue := rel.Field.ReflectValueOf(db.Statement.Context, rv) tx := preloadDB(db, reflectValue, reflectValue.Interface()) if err := preloadEntryPoint(tx, nestedJoins, &tx.Statement.Schema.Relationships, preloadMap[name], associationsConds); err != nil { diff --git a/vendor/gorm.io/gorm/callbacks/query.go b/vendor/gorm.io/gorm/callbacks/query.go index 2a82eaba..bbf238a9 100644 --- a/vendor/gorm.io/gorm/callbacks/query.go +++ b/vendor/gorm.io/gorm/callbacks/query.go @@ -286,7 +286,11 @@ func Preload(db *gorm.DB) { func AfterQuery(db *gorm.DB) { // clear the joins after query because preload need it - db.Statement.Joins = nil + if v, ok := db.Statement.Clauses["FROM"].Expression.(clause.From); ok { + fromClause := db.Statement.Clauses["FROM"] + fromClause.Expression = clause.From{Tables: v.Tables, Joins: utils.RTrimSlice(v.Joins, len(db.Statement.Joins))} // keep the original From Joins + db.Statement.Clauses["FROM"] = fromClause + } if db.Error == nil && db.Statement.Schema != nil && !db.Statement.SkipHooks && db.Statement.Schema.AfterFind && db.RowsAffected > 0 { callMethod(db, func(value interface{}, tx *gorm.DB) bool { if i, ok := value.(AfterFindInterface); ok { diff --git a/vendor/gorm.io/gorm/chainable_api.go b/vendor/gorm.io/gorm/chainable_api.go index 33370603..8953413d 100644 --- a/vendor/gorm.io/gorm/chainable_api.go +++ b/vendor/gorm.io/gorm/chainable_api.go @@ -185,6 +185,13 @@ func (db *DB) Omit(columns ...string) (tx *DB) { return } +// MapColumns modify the column names in the query results to facilitate align to the corresponding structural fields +func (db *DB) MapColumns(m map[string]string) (tx *DB) { + tx = db.getInstance() + tx.Statement.ColumnMapping = m + return +} + // Where add conditions // // See the [docs] for details on the various formats that where clauses can take. By default, where clauses chain with AND. @@ -299,10 +306,16 @@ func (db *DB) Having(query interface{}, args ...interface{}) (tx *DB) { // // db.Order("name DESC") // db.Order(clause.OrderByColumn{Column: clause.Column{Name: "name"}, Desc: true}) +// db.Order(clause.OrderBy{Columns: []clause.OrderByColumn{ +// {Column: clause.Column{Name: "name"}, Desc: true}, +// {Column: clause.Column{Name: "age"}, Desc: true}, +// }}) func (db *DB) Order(value interface{}) (tx *DB) { tx = db.getInstance() switch v := value.(type) { + case clause.OrderBy: + tx.Statement.AddClause(v) case clause.OrderByColumn: tx.Statement.AddClause(clause.OrderBy{ Columns: []clause.OrderByColumn{v}, diff --git a/vendor/gorm.io/gorm/gorm.go b/vendor/gorm.io/gorm/gorm.go index 775cd3de..117d2fd0 100644 --- a/vendor/gorm.io/gorm/gorm.go +++ b/vendor/gorm.io/gorm/gorm.go @@ -50,6 +50,8 @@ type Config struct { CreateBatchSize int // TranslateError enabling error translation TranslateError bool + // PropagateUnscoped propagate Unscoped to every other nested statement + PropagateUnscoped bool // ClauseBuilders clause builder ClauseBuilders map[string]clause.ClauseBuilder @@ -110,6 +112,7 @@ type Session struct { DisableNestedTransaction bool AllowGlobalUpdate bool FullSaveAssociations bool + PropagateUnscoped bool QueryFields bool Context context.Context Logger logger.Interface @@ -241,6 +244,10 @@ func (db *DB) Session(config *Session) *DB { txConfig.FullSaveAssociations = true } + if config.PropagateUnscoped { + txConfig.PropagateUnscoped = true + } + if config.Context != nil || config.PrepareStmt || config.SkipHooks { tx.Statement = tx.Statement.clone() tx.Statement.DB = tx @@ -409,6 +416,9 @@ func (db *DB) getInstance() *DB { Vars: make([]interface{}, 0, 8), SkipHooks: db.Statement.SkipHooks, } + if db.Config.PropagateUnscoped { + tx.Statement.Unscoped = db.Statement.Unscoped + } } else { // with clone statement tx.Statement = db.Statement.clone() diff --git a/vendor/gorm.io/gorm/prepare_stmt.go b/vendor/gorm.io/gorm/prepare_stmt.go index 4d533885..094bb477 100644 --- a/vendor/gorm.io/gorm/prepare_stmt.go +++ b/vendor/gorm.io/gorm/prepare_stmt.go @@ -17,18 +17,16 @@ type Stmt struct { } type PreparedStmtDB struct { - Stmts map[string]*Stmt - PreparedSQL []string - Mux *sync.RWMutex + Stmts map[string]*Stmt + Mux *sync.RWMutex ConnPool } func NewPreparedStmtDB(connPool ConnPool) *PreparedStmtDB { return &PreparedStmtDB{ - ConnPool: connPool, - Stmts: make(map[string]*Stmt), - Mux: &sync.RWMutex{}, - PreparedSQL: make([]string, 0, 100), + ConnPool: connPool, + Stmts: make(map[string]*Stmt), + Mux: &sync.RWMutex{}, } } @@ -48,12 +46,17 @@ func (db *PreparedStmtDB) Close() { db.Mux.Lock() defer db.Mux.Unlock() - for _, query := range db.PreparedSQL { - if stmt, ok := db.Stmts[query]; ok { - delete(db.Stmts, query) - go stmt.Close() - } + for _, stmt := range db.Stmts { + go func(s *Stmt) { + // make sure the stmt must finish preparation first + <-s.prepared + if s.Stmt != nil { + _ = s.Close() + } + }(stmt) } + // setting db.Stmts to nil to avoid further using + db.Stmts = nil } func (sdb *PreparedStmtDB) Reset() { @@ -61,9 +64,14 @@ func (sdb *PreparedStmtDB) Reset() { defer sdb.Mux.Unlock() for _, stmt := range sdb.Stmts { - go stmt.Close() + go func(s *Stmt) { + // make sure the stmt must finish preparation first + <-s.prepared + if s.Stmt != nil { + _ = s.Close() + } + }(stmt) } - sdb.PreparedSQL = make([]string, 0, 100) sdb.Stmts = make(map[string]*Stmt) } @@ -93,7 +101,12 @@ func (db *PreparedStmtDB) prepare(ctx context.Context, conn ConnPool, isTransact return *stmt, nil } - + // check db.Stmts first to avoid Segmentation Fault(setting value to nil map) + // which cause by calling Close and executing SQL concurrently + if db.Stmts == nil { + db.Mux.Unlock() + return Stmt{}, ErrInvalidDB + } // cache preparing stmt first cacheStmt := Stmt{Transaction: isTransaction, prepared: make(chan struct{})} db.Stmts[query] = &cacheStmt @@ -118,7 +131,6 @@ func (db *PreparedStmtDB) prepare(ctx context.Context, conn ConnPool, isTransact db.Mux.Lock() cacheStmt.Stmt = stmt - db.PreparedSQL = append(db.PreparedSQL, query) db.Mux.Unlock() return cacheStmt, nil diff --git a/vendor/gorm.io/gorm/scan.go b/vendor/gorm.io/gorm/scan.go index e95e6d30..d852c2c9 100644 --- a/vendor/gorm.io/gorm/scan.go +++ b/vendor/gorm.io/gorm/scan.go @@ -131,6 +131,15 @@ func Scan(rows Rows, db *DB, mode ScanMode) { onConflictDonothing = mode&ScanOnConflictDoNothing != 0 ) + if len(db.Statement.ColumnMapping) > 0 { + for i, column := range columns { + v, ok := db.Statement.ColumnMapping[column] + if ok { + columns[i] = v + } + } + } + db.RowsAffected = 0 switch dest := db.Statement.Dest.(type) { @@ -244,7 +253,7 @@ func Scan(rows Rows, db *DB, mode ScanMode) { rel = rel.FieldSchema.Relationships.Relations[name] relFields = append(relFields, rel.Field) } - // lastest name is raw dbname + // latest name is raw dbname dbName := names[subNameCount-1] if field := rel.FieldSchema.LookUpField(dbName); field != nil && field.Readable { fields[idx] = field @@ -331,6 +340,9 @@ func Scan(rows Rows, db *DB, mode ScanMode) { } case reflect.Struct, reflect.Ptr: if initialized || rows.Next() { + if mode == ScanInitialized && reflectValue.Kind() == reflect.Struct { + db.Statement.ReflectValue.Set(reflect.Zero(reflectValue.Type())) + } db.scanIntoStruct(rows, reflectValue, values, fields, joinFields) } default: diff --git a/vendor/gorm.io/gorm/schema/naming.go b/vendor/gorm.io/gorm/schema/naming.go index e6fb81b2..6248bde8 100644 --- a/vendor/gorm.io/gorm/schema/naming.go +++ b/vendor/gorm.io/gorm/schema/naming.go @@ -8,6 +8,8 @@ import ( "unicode/utf8" "github.com/jinzhu/inflection" + "golang.org/x/text/cases" + "golang.org/x/text/language" ) // Namer namer interface @@ -121,7 +123,7 @@ var ( func init() { commonInitialismsForReplacer := make([]string, 0, len(commonInitialisms)) for _, initialism := range commonInitialisms { - commonInitialismsForReplacer = append(commonInitialismsForReplacer, initialism, strings.Title(strings.ToLower(initialism))) + commonInitialismsForReplacer = append(commonInitialismsForReplacer, initialism, cases.Title(language.Und).String(initialism)) } commonInitialismsReplacer = strings.NewReplacer(commonInitialismsForReplacer...) } @@ -186,9 +188,9 @@ func (ns NamingStrategy) toDBName(name string) string { } func (ns NamingStrategy) toSchemaName(name string) string { - result := strings.ReplaceAll(strings.Title(strings.ReplaceAll(name, "_", " ")), " ", "") + result := strings.ReplaceAll(cases.Title(language.Und, cases.NoLower).String(strings.ReplaceAll(name, "_", " ")), " ", "") for _, initialism := range commonInitialisms { - result = regexp.MustCompile(strings.Title(strings.ToLower(initialism))+"([A-Z]|$|_)").ReplaceAllString(result, initialism+"$1") + result = regexp.MustCompile(cases.Title(language.Und, cases.NoLower).String(strings.ToLower(initialism))+"([A-Z]|$|_)").ReplaceAllString(result, initialism+"$1") } return result } diff --git a/vendor/gorm.io/gorm/schema/relationship.go b/vendor/gorm.io/gorm/schema/relationship.go index c11918a5..32676b39 100644 --- a/vendor/gorm.io/gorm/schema/relationship.go +++ b/vendor/gorm.io/gorm/schema/relationship.go @@ -7,6 +7,9 @@ import ( "strings" "github.com/jinzhu/inflection" + "golang.org/x/text/cases" + "golang.org/x/text/language" + "gorm.io/gorm/clause" ) @@ -301,9 +304,9 @@ func (schema *Schema) buildMany2ManyRelation(relation *Relationship, field *Fiel } for idx, ownField := range ownForeignFields { - joinFieldName := strings.Title(schema.Name) + ownField.Name + joinFieldName := cases.Title(language.Und, cases.NoLower).String(schema.Name) + ownField.Name if len(joinForeignKeys) > idx { - joinFieldName = strings.Title(joinForeignKeys[idx]) + joinFieldName = cases.Title(language.Und, cases.NoLower).String(joinForeignKeys[idx]) } ownFieldsMap[joinFieldName] = ownField @@ -318,7 +321,7 @@ func (schema *Schema) buildMany2ManyRelation(relation *Relationship, field *Fiel } for idx, relField := range refForeignFields { - joinFieldName := strings.Title(relation.FieldSchema.Name) + relField.Name + joinFieldName := cases.Title(language.Und, cases.NoLower).String(relation.FieldSchema.Name) + relField.Name if _, ok := ownFieldsMap[joinFieldName]; ok { if field.Name != relation.FieldSchema.Name { @@ -329,7 +332,7 @@ func (schema *Schema) buildMany2ManyRelation(relation *Relationship, field *Fiel } if len(joinReferences) > idx { - joinFieldName = strings.Title(joinReferences[idx]) + joinFieldName = cases.Title(language.Und, cases.NoLower).String(joinReferences[idx]) } referFieldsMap[joinFieldName] = relField @@ -347,7 +350,7 @@ func (schema *Schema) buildMany2ManyRelation(relation *Relationship, field *Fiel } joinTableFields = append(joinTableFields, reflect.StructField{ - Name: strings.Title(schema.Name) + field.Name, + Name: cases.Title(language.Und, cases.NoLower).String(schema.Name) + field.Name, Type: schema.ModelType, Tag: `gorm:"-"`, }) diff --git a/vendor/gorm.io/gorm/schema/schema.go b/vendor/gorm.io/gorm/schema/schema.go index 3e7459ce..db236797 100644 --- a/vendor/gorm.io/gorm/schema/schema.go +++ b/vendor/gorm.io/gorm/schema/schema.go @@ -67,9 +67,10 @@ func (schema Schema) String() string { } func (schema Schema) MakeSlice() reflect.Value { - slice := reflect.MakeSlice(reflect.SliceOf(reflect.PtrTo(schema.ModelType)), 0, 20) + slice := reflect.MakeSlice(reflect.SliceOf(reflect.PointerTo(schema.ModelType)), 0, 20) results := reflect.New(slice.Type()) results.Elem().Set(slice) + return results } @@ -337,7 +338,7 @@ func ParseWithSpecialTableName(dest interface{}, cacheStore *sync.Map, namer Nam if _, embedded := schema.cacheStore.Load(embeddedCacheKey); !embedded { for _, field := range schema.Fields { - if field.DataType == "" && (field.Creatable || field.Updatable || field.Readable) { + if field.DataType == "" && field.GORMDataType == "" && (field.Creatable || field.Updatable || field.Readable) { if schema.parseRelation(field); schema.err != nil { return schema, schema.err } else { diff --git a/vendor/gorm.io/gorm/schema/serializer.go b/vendor/gorm.io/gorm/schema/serializer.go index f500521e..0fafbcba 100644 --- a/vendor/gorm.io/gorm/schema/serializer.go +++ b/vendor/gorm.io/gorm/schema/serializer.go @@ -84,7 +84,10 @@ func (JSONSerializer) Scan(ctx context.Context, field *Field, dst reflect.Value, case string: bytes = []byte(v) default: - return fmt.Errorf("failed to unmarshal JSONB value: %#v", dbValue) + bytes, err = json.Marshal(v) + if err != nil { + return err + } } if len(bytes) > 0 { diff --git a/vendor/gorm.io/gorm/statement.go b/vendor/gorm.io/gorm/statement.go index ae79aa32..39e05d09 100644 --- a/vendor/gorm.io/gorm/statement.go +++ b/vendor/gorm.io/gorm/statement.go @@ -30,8 +30,9 @@ type Statement struct { Clauses map[string]clause.Clause BuildClauses []string Distinct bool - Selects []string // selected columns - Omits []string // omit columns + Selects []string // selected columns + Omits []string // omit columns + ColumnMapping map[string]string // map columns Joins []join Preloads map[string][]interface{} Settings sync.Map @@ -513,6 +514,7 @@ func (stmt *Statement) clone() *Statement { Distinct: stmt.Distinct, Selects: stmt.Selects, Omits: stmt.Omits, + ColumnMapping: stmt.ColumnMapping, Preloads: map[string][]interface{}{}, ConnPool: stmt.ConnPool, Schema: stmt.Schema, diff --git a/vendor/gorm.io/gorm/utils/utils.go b/vendor/gorm.io/gorm/utils/utils.go index b8d30b35..fc615d73 100644 --- a/vendor/gorm.io/gorm/utils/utils.go +++ b/vendor/gorm.io/gorm/utils/utils.go @@ -166,3 +166,14 @@ func SplitNestedRelationName(name string) []string { func JoinNestedRelationNames(relationNames []string) string { return strings.Join(relationNames, nestedRelationSplit) } + +// RTrimSlice Right trims the given slice by given length +func RTrimSlice[T any](v []T, trimLen int) []T { + if trimLen >= len(v) { // trimLen greater than slice len means fully sliced + return v[:0] + } + if trimLen < 0 { // negative trimLen is ignored + return v[:] + } + return v[:len(v)-trimLen] +} diff --git a/vendor/modules.txt b/vendor/modules.txt index c5f58d81..0e2bfeab 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -2,7 +2,7 @@ ## explicit; go 1.20 filippo.io/edwards25519 filippo.io/edwards25519/field -# github.com/DataDog/zstd v1.5.5 +# github.com/DataDog/zstd v1.5.6 ## explicit; go 1.14 github.com/DataDog/zstd # github.com/ManyakRus/logrus v0.0.0-20231019115155-9e6fede0d792 @@ -18,7 +18,7 @@ github.com/asaskevich/govalidator # github.com/beorn7/perks v1.0.1 ## explicit; go 1.11 github.com/beorn7/perks/quantile -# github.com/camunda/zeebe/clients/go/v8 v8.5.3 +# github.com/camunda/zeebe/clients/go/v8 v8.5.7 ## explicit; go 1.21 github.com/camunda/zeebe/clients/go/v8/internal/embedded github.com/camunda/zeebe/clients/go/v8/internal/utils @@ -54,13 +54,13 @@ github.com/cockroachdb/errors/secondary github.com/cockroachdb/errors/stdstrings github.com/cockroachdb/errors/telemetrykeys github.com/cockroachdb/errors/withstack -# github.com/cockroachdb/fifo v0.0.0-20240616162244-4768e80dfb9a +# github.com/cockroachdb/fifo v0.0.0-20240816210425-c5d0cb0b6fc0 ## explicit; go 1.20 github.com/cockroachdb/fifo # github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b ## explicit; go 1.16 github.com/cockroachdb/logtags -# github.com/cockroachdb/pebble v1.1.1 +# github.com/cockroachdb/pebble v1.1.2 ## explicit; go 1.20 github.com/cockroachdb/pebble github.com/cockroachdb/pebble/internal/arenaskl @@ -137,7 +137,7 @@ github.com/emersion/go-message/textproto # github.com/emersion/go-sasl v0.0.0-20231106173351-e73c9f7bad43 ## explicit; go 1.12 github.com/emersion/go-sasl -# github.com/getsentry/sentry-go v0.28.1 +# github.com/getsentry/sentry-go v0.29.0 ## explicit; go 1.18 github.com/getsentry/sentry-go github.com/getsentry/sentry-go/internal/debug @@ -155,6 +155,9 @@ github.com/go-faster/jx/internal/byteseq # github.com/go-faster/xor v1.0.0 ## explicit; go 1.15 github.com/go-faster/xor +# github.com/go-ini/ini v1.67.0 +## explicit +github.com/go-ini/ini # github.com/go-ozzo/ozzo-validation/v4 v4.3.0 ## explicit; go 1.13 github.com/go-ozzo/ozzo-validation/v4 @@ -172,7 +175,7 @@ github.com/goccy/go-json/internal/encoder/vm_color_indent github.com/goccy/go-json/internal/encoder/vm_indent github.com/goccy/go-json/internal/errors github.com/goccy/go-json/internal/runtime -# github.com/gofiber/fiber/v2 v2.52.4 +# github.com/gofiber/fiber/v2 v2.52.5 ## explicit; go 1.20 github.com/gofiber/fiber/v2 github.com/gofiber/fiber/v2/internal/schema @@ -220,8 +223,6 @@ github.com/gorilla/websocket github.com/gotd/contrib/auth/kv github.com/gotd/contrib/bbolt github.com/gotd/contrib/bg -github.com/gotd/contrib/middleware/floodwait -github.com/gotd/contrib/middleware/ratelimit github.com/gotd/contrib/pebble github.com/gotd/contrib/storage # github.com/gotd/ige v0.2.2 @@ -230,7 +231,7 @@ github.com/gotd/ige # github.com/gotd/neo v0.1.5 ## explicit; go 1.12 github.com/gotd/neo -# github.com/gotd/td v0.104.0 +# github.com/gotd/td v0.110.1 ## explicit; go 1.21 github.com/gotd/td/ascii github.com/gotd/td/bin @@ -290,8 +291,8 @@ github.com/jackc/pgpassfile # github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 ## explicit; go 1.14 github.com/jackc/pgservicefile -# github.com/jackc/pgx/v5 v5.6.0 -## explicit; go 1.20 +# github.com/jackc/pgx/v5 v5.7.1 +## explicit; go 1.21 github.com/jackc/pgx/v5 github.com/jackc/pgx/v5/internal/iobufpool github.com/jackc/pgx/v5/internal/pgio @@ -304,7 +305,7 @@ github.com/jackc/pgx/v5/pgproto3 github.com/jackc/pgx/v5/pgtype github.com/jackc/pgx/v5/pgxpool github.com/jackc/pgx/v5/stdlib -# github.com/jackc/puddle/v2 v2.2.1 +# github.com/jackc/puddle/v2 v2.2.2 ## explicit; go 1.19 github.com/jackc/puddle/v2 github.com/jackc/puddle/v2/internal/genstack @@ -321,8 +322,8 @@ github.com/jmoiron/sqlx/reflectx # github.com/joho/godotenv v1.5.1 ## explicit; go 1.12 github.com/joho/godotenv -# github.com/klauspost/compress v1.17.9 -## explicit; go 1.20 +# github.com/klauspost/compress v1.17.10 +## explicit; go 1.21 github.com/klauspost/compress github.com/klauspost/compress/flate github.com/klauspost/compress/fse @@ -356,10 +357,10 @@ github.com/mattn/go-colorable # github.com/mattn/go-isatty v0.0.20 ## explicit; go 1.15 github.com/mattn/go-isatty -# github.com/mattn/go-runewidth v0.0.15 +# github.com/mattn/go-runewidth v0.0.16 ## explicit; go 1.9 github.com/mattn/go-runewidth -# github.com/mattn/go-sqlite3 v1.14.22 +# github.com/mattn/go-sqlite3 v1.14.23 ## explicit; go 1.19 github.com/mattn/go-sqlite3 # github.com/mdp/qrterminal/v3 v3.2.0 @@ -384,9 +385,10 @@ github.com/microsoft/go-mssqldb/msdsn # github.com/minio/md5-simd v1.1.2 ## explicit; go 1.14 github.com/minio/md5-simd -# github.com/minio/minio-go/v7 v7.0.72 +# github.com/minio/minio-go/v7 v7.0.77 ## explicit; go 1.21 github.com/minio/minio-go/v7 +github.com/minio/minio-go/v7/pkg/cors github.com/minio/minio-go/v7/pkg/credentials github.com/minio/minio-go/v7/pkg/encrypt github.com/minio/minio-go/v7/pkg/lifecycle @@ -400,7 +402,10 @@ github.com/minio/minio-go/v7/pkg/tags # github.com/mitchellh/go-homedir v1.1.0 ## explicit github.com/mitchellh/go-homedir -# github.com/nats-io/nats.go v1.36.0 +# github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 +## explicit +github.com/munnerz/goautoneg +# github.com/nats-io/nats.go v1.37.0 ## explicit; go 1.20 github.com/nats-io/nats.go github.com/nats-io/nats.go/encoders/builtin @@ -425,17 +430,16 @@ github.com/pkg/errors # github.com/pmezard/go-difflib v1.0.0 ## explicit github.com/pmezard/go-difflib/difflib -# github.com/prometheus/client_golang v1.19.1 +# github.com/prometheus/client_golang v1.20.4 ## explicit; go 1.20 github.com/prometheus/client_golang/prometheus github.com/prometheus/client_golang/prometheus/internal # github.com/prometheus/client_model v0.6.1 ## explicit; go 1.19 github.com/prometheus/client_model/go -# github.com/prometheus/common v0.54.0 +# github.com/prometheus/common v0.59.1 ## explicit; go 1.20 github.com/prometheus/common/expfmt -github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg github.com/prometheus/common/model # github.com/prometheus/procfs v0.15.1 ## explicit; go 1.20 @@ -445,11 +449,11 @@ github.com/prometheus/procfs/internal/util # github.com/rivo/uniseg v0.4.7 ## explicit; go 1.18 github.com/rivo/uniseg -# github.com/rogpeppe/go-internal v1.12.0 -## explicit; go 1.20 +# github.com/rogpeppe/go-internal v1.13.1 +## explicit; go 1.22 github.com/rogpeppe/go-internal/fmtsort -# github.com/rs/xid v1.5.0 -## explicit; go 1.12 +# github.com/rs/xid v1.6.0 +## explicit; go 1.16 github.com/rs/xid # github.com/rs/zerolog v1.33.0 ## explicit; go 1.15 @@ -460,7 +464,7 @@ github.com/rs/zerolog/internal/json ## explicit; go 1.18 github.com/rugatling/go-openai github.com/rugatling/go-openai/internal -# github.com/sashabaranov/go-openai v1.26.0 +# github.com/sashabaranov/go-openai v1.31.0 ## explicit; go 1.18 github.com/sashabaranov/go-openai github.com/sashabaranov/go-openai/internal @@ -549,7 +553,7 @@ github.com/toorop/go-dkim # github.com/valyala/bytebufferpool v1.0.0 ## explicit github.com/valyala/bytebufferpool -# github.com/valyala/fasthttp v1.55.0 +# github.com/valyala/fasthttp v1.56.0 ## explicit; go 1.20 github.com/valyala/fasthttp github.com/valyala/fasthttp/fasthttputil @@ -570,25 +574,24 @@ github.com/vmihailenco/tagparser/v2/internal/parser # github.com/xhit/go-simple-mail/v2 v2.16.0 ## explicit; go 1.13 github.com/xhit/go-simple-mail/v2 -# gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange v0.0.20 -## explicit; go 1.20 +# gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange v0.0.23 +## explicit; go 1.22 gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange -gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/bus_conn -gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/cons gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/data_packer +gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/liveness gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/sync_confirm gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/sync_global gitlab.aescorp.ru/dsp_dev/claim/common/sync_exchange/sync_types -# gitlab.aescorp.ru/dsp_dev/claim/sync_service v1.2.138 -## explicit; go 1.22 +# gitlab.aescorp.ru/dsp_dev/claim/sync_service v1.2.159 +## explicit; go 1.22.0 gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/db/calc_struct_version gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/db/db_constants gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/db/tables/table_connections gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/connections -# go.etcd.io/bbolt v1.3.10 -## explicit; go 1.21 +# go.etcd.io/bbolt v1.3.11 +## explicit; go 1.22 go.etcd.io/bbolt -# go.mau.fi/libsignal v0.1.0 +# go.mau.fi/libsignal v0.1.1 ## explicit; go 1.18 go.mau.fi/libsignal/cipher go.mau.fi/libsignal/ecc @@ -616,13 +619,14 @@ go.mau.fi/libsignal/util/errorhelper go.mau.fi/libsignal/util/keyhelper go.mau.fi/libsignal/util/medium go.mau.fi/libsignal/util/optional -# go.mau.fi/util v0.5.0 -## explicit; go 1.21 +# go.mau.fi/util v0.8.0 +## explicit; go 1.22.0 +go.mau.fi/util/fallocate go.mau.fi/util/jsontime go.mau.fi/util/random go.mau.fi/util/retryafter -# go.mau.fi/whatsmeow v0.0.0-20240619210240-329c2336a6f1 -## explicit; go 1.21 +# go.mau.fi/whatsmeow v0.0.0-20240924123543-d5cecea9882e +## explicit; go 1.22.0 go.mau.fi/whatsmeow go.mau.fi/whatsmeow/appstate go.mau.fi/whatsmeow/appstate/lthash @@ -665,14 +669,14 @@ go.mau.fi/whatsmeow/util/gcmutil go.mau.fi/whatsmeow/util/hkdfutil go.mau.fi/whatsmeow/util/keys go.mau.fi/whatsmeow/util/log -# go.opentelemetry.io/otel v1.27.0 -## explicit; go 1.21 +# go.opentelemetry.io/otel v1.30.0 +## explicit; go 1.22 go.opentelemetry.io/otel/attribute go.opentelemetry.io/otel/codes go.opentelemetry.io/otel/internal go.opentelemetry.io/otel/internal/attribute -# go.opentelemetry.io/otel/trace v1.27.0 -## explicit; go 1.21 +# go.opentelemetry.io/otel/trace v1.30.0 +## explicit; go 1.22 go.opentelemetry.io/otel/trace go.opentelemetry.io/otel/trace/embedded # go.uber.org/atomic v1.11.0 @@ -692,12 +696,11 @@ go.uber.org/zap/internal/exit go.uber.org/zap/internal/pool go.uber.org/zap/internal/stacktrace go.uber.org/zap/zapcore -# golang.org/x/crypto v0.24.0 -## explicit; go 1.18 +# golang.org/x/crypto v0.27.0 +## explicit; go 1.20 golang.org/x/crypto/argon2 golang.org/x/crypto/blake2b golang.org/x/crypto/curve25519 -golang.org/x/crypto/curve25519/internal/field golang.org/x/crypto/ed25519 golang.org/x/crypto/hkdf golang.org/x/crypto/internal/alias @@ -708,12 +711,12 @@ golang.org/x/crypto/nacl/secretbox golang.org/x/crypto/pbkdf2 golang.org/x/crypto/salsa20/salsa golang.org/x/crypto/ssh/terminal -# golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 -## explicit; go 1.20 +# golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 +## explicit; go 1.22.0 golang.org/x/exp/constraints golang.org/x/exp/maps golang.org/x/exp/rand -# golang.org/x/net v0.26.0 +# golang.org/x/net v0.29.0 ## explicit; go 1.18 golang.org/x/net/context golang.org/x/net/http/httpguts @@ -725,27 +728,27 @@ golang.org/x/net/internal/timeseries golang.org/x/net/proxy golang.org/x/net/publicsuffix golang.org/x/net/trace -# golang.org/x/oauth2 v0.21.0 +# golang.org/x/oauth2 v0.23.0 ## explicit; go 1.18 golang.org/x/oauth2 golang.org/x/oauth2/clientcredentials golang.org/x/oauth2/internal -# golang.org/x/sync v0.7.0 +# golang.org/x/sync v0.8.0 ## explicit; go 1.18 golang.org/x/sync/errgroup golang.org/x/sync/semaphore golang.org/x/sync/singleflight -# golang.org/x/sys v0.21.0 +# golang.org/x/sys v0.25.0 ## explicit; go 1.18 golang.org/x/sys/cpu golang.org/x/sys/execabs golang.org/x/sys/plan9 golang.org/x/sys/unix golang.org/x/sys/windows -# golang.org/x/term v0.21.0 +# golang.org/x/term v0.24.0 ## explicit; go 1.18 golang.org/x/term -# golang.org/x/text v0.16.0 +# golang.org/x/text v0.18.0 ## explicit; go 1.18 golang.org/x/text/cases golang.org/x/text/encoding @@ -765,20 +768,18 @@ golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm golang.org/x/text/width -# golang.org/x/time v0.5.0 -## explicit; go 1.18 -golang.org/x/time/rate -# google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4 -## explicit; go 1.20 +# google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 +## explicit; go 1.21 google.golang.org/genproto/googleapis/rpc/status -# google.golang.org/grpc v1.64.0 -## explicit; go 1.19 +# google.golang.org/grpc v1.67.0 +## explicit; go 1.21 google.golang.org/grpc google.golang.org/grpc/attributes google.golang.org/grpc/backoff google.golang.org/grpc/balancer google.golang.org/grpc/balancer/base google.golang.org/grpc/balancer/grpclb/state +google.golang.org/grpc/balancer/pickfirst google.golang.org/grpc/balancer/roundrobin google.golang.org/grpc/binarylog/grpc_binarylog_v1 google.golang.org/grpc/channelz @@ -788,7 +789,9 @@ google.golang.org/grpc/credentials google.golang.org/grpc/credentials/insecure google.golang.org/grpc/encoding google.golang.org/grpc/encoding/proto +google.golang.org/grpc/experimental/stats google.golang.org/grpc/grpclog +google.golang.org/grpc/grpclog/internal google.golang.org/grpc/internal google.golang.org/grpc/internal/backoff google.golang.org/grpc/internal/balancer/gracefulswitch @@ -799,7 +802,6 @@ google.golang.org/grpc/internal/channelz google.golang.org/grpc/internal/credentials google.golang.org/grpc/internal/envconfig google.golang.org/grpc/internal/grpclog -google.golang.org/grpc/internal/grpcrand google.golang.org/grpc/internal/grpcsync google.golang.org/grpc/internal/grpcutil google.golang.org/grpc/internal/idle @@ -811,11 +813,13 @@ google.golang.org/grpc/internal/resolver/dns/internal google.golang.org/grpc/internal/resolver/passthrough google.golang.org/grpc/internal/resolver/unix google.golang.org/grpc/internal/serviceconfig +google.golang.org/grpc/internal/stats google.golang.org/grpc/internal/status google.golang.org/grpc/internal/syscall google.golang.org/grpc/internal/transport google.golang.org/grpc/internal/transport/networktype google.golang.org/grpc/keepalive +google.golang.org/grpc/mem google.golang.org/grpc/metadata google.golang.org/grpc/peer google.golang.org/grpc/resolver @@ -859,9 +863,6 @@ google.golang.org/protobuf/runtime/protoimpl google.golang.org/protobuf/types/known/anypb google.golang.org/protobuf/types/known/durationpb google.golang.org/protobuf/types/known/timestamppb -# gopkg.in/ini.v1 v1.67.0 -## explicit -gopkg.in/ini.v1 # gopkg.in/natefinch/lumberjack.v2 v2.2.1 ## explicit; go 1.13 gopkg.in/natefinch/lumberjack.v2 @@ -874,7 +875,7 @@ gorm.io/driver/postgres # gorm.io/driver/sqlserver v1.5.3 ## explicit; go 1.14 gorm.io/driver/sqlserver -# gorm.io/gorm v1.25.10 +# gorm.io/gorm v1.25.12 ## explicit; go 1.18 gorm.io/gorm gorm.io/gorm/callbacks @@ -883,7 +884,7 @@ gorm.io/gorm/logger gorm.io/gorm/migrator gorm.io/gorm/schema gorm.io/gorm/utils -# nhooyr.io/websocket v1.8.11 +# nhooyr.io/websocket v1.8.17 ## explicit; go 1.19 nhooyr.io/websocket nhooyr.io/websocket/internal/bpool diff --git a/vendor/nhooyr.io/websocket/README.md b/vendor/nhooyr.io/websocket/README.md index d093746d..d663d5d0 100644 --- a/vendor/nhooyr.io/websocket/README.md +++ b/vendor/nhooyr.io/websocket/README.md @@ -1,155 +1 @@ -# websocket - -[![Go Reference](https://pkg.go.dev/badge/nhooyr.io/websocket.svg)](https://pkg.go.dev/nhooyr.io/websocket) -[![Go Coverage](https://img.shields.io/badge/coverage-91%25-success)](https://nhooyr.io/websocket/coverage.html) - -websocket is a minimal and idiomatic WebSocket library for Go. - -## Install - -```sh -go get nhooyr.io/websocket -``` - -## Highlights - -- Minimal and idiomatic API -- First class [context.Context](https://blog.golang.org/context) support -- Fully passes the WebSocket [autobahn-testsuite](https://github.com/crossbario/autobahn-testsuite) -- [Zero dependencies](https://pkg.go.dev/nhooyr.io/websocket?tab=imports) -- JSON helpers in the [wsjson](https://pkg.go.dev/nhooyr.io/websocket/wsjson) subpackage -- Zero alloc reads and writes -- Concurrent writes -- [Close handshake](https://pkg.go.dev/nhooyr.io/websocket#Conn.Close) -- [net.Conn](https://pkg.go.dev/nhooyr.io/websocket#NetConn) wrapper -- [Ping pong](https://pkg.go.dev/nhooyr.io/websocket#Conn.Ping) API -- [RFC 7692](https://tools.ietf.org/html/rfc7692) permessage-deflate compression -- [CloseRead](https://pkg.go.dev/nhooyr.io/websocket#Conn.CloseRead) helper for write only connections -- Compile to [Wasm](https://pkg.go.dev/nhooyr.io/websocket#hdr-Wasm) - -## Roadmap - -See GitHub issues for minor issues but the major future enhancements are: - -- [ ] Perfect examples [#217](https://github.com/nhooyr/websocket/issues/217) -- [ ] wstest.Pipe for in memory testing [#340](https://github.com/nhooyr/websocket/issues/340) -- [ ] Ping pong heartbeat helper [#267](https://github.com/nhooyr/websocket/issues/267) -- [ ] Ping pong instrumentation callbacks [#246](https://github.com/nhooyr/websocket/issues/246) -- [ ] Graceful shutdown helpers [#209](https://github.com/nhooyr/websocket/issues/209) -- [ ] Assembly for WebSocket masking [#16](https://github.com/nhooyr/websocket/issues/16) - - WIP at [#326](https://github.com/nhooyr/websocket/pull/326), about 3x faster -- [ ] HTTP/2 [#4](https://github.com/nhooyr/websocket/issues/4) -- [ ] The holy grail [#402](https://github.com/nhooyr/websocket/issues/402) - -## Examples - -For a production quality example that demonstrates the complete API, see the -[echo example](./internal/examples/echo). - -For a full stack example, see the [chat example](./internal/examples/chat). - -### Server - -```go -http.HandlerFunc(func (w http.ResponseWriter, r *http.Request) { - c, err := websocket.Accept(w, r, nil) - if err != nil { - // ... - } - defer c.CloseNow() - - ctx, cancel := context.WithTimeout(r.Context(), time.Second*10) - defer cancel() - - var v interface{} - err = wsjson.Read(ctx, c, &v) - if err != nil { - // ... - } - - log.Printf("received: %v", v) - - c.Close(websocket.StatusNormalClosure, "") -}) -``` - -### Client - -```go -ctx, cancel := context.WithTimeout(context.Background(), time.Minute) -defer cancel() - -c, _, err := websocket.Dial(ctx, "ws://localhost:8080", nil) -if err != nil { - // ... -} -defer c.CloseNow() - -err = wsjson.Write(ctx, c, "hi") -if err != nil { - // ... -} - -c.Close(websocket.StatusNormalClosure, "") -``` - -## Comparison - -### gorilla/websocket - -Advantages of [gorilla/websocket](https://github.com/gorilla/websocket): - -- Mature and widely used -- [Prepared writes](https://pkg.go.dev/github.com/gorilla/websocket#PreparedMessage) -- Configurable [buffer sizes](https://pkg.go.dev/github.com/gorilla/websocket#hdr-Buffers) -- No extra goroutine per connection to support cancellation with context.Context. This costs nhooyr.io/websocket 2 KB of memory per connection. - - Will be removed soon with [context.AfterFunc](https://github.com/golang/go/issues/57928). See [#411](https://github.com/nhooyr/websocket/issues/411) - -Advantages of nhooyr.io/websocket: - -- Minimal and idiomatic API - - Compare godoc of [nhooyr.io/websocket](https://pkg.go.dev/nhooyr.io/websocket) with [gorilla/websocket](https://pkg.go.dev/github.com/gorilla/websocket) side by side. -- [net.Conn](https://pkg.go.dev/nhooyr.io/websocket#NetConn) wrapper -- Zero alloc reads and writes ([gorilla/websocket#535](https://github.com/gorilla/websocket/issues/535)) -- Full [context.Context](https://blog.golang.org/context) support -- Dial uses [net/http.Client](https://golang.org/pkg/net/http/#Client) - - Will enable easy HTTP/2 support in the future - - Gorilla writes directly to a net.Conn and so duplicates features of net/http.Client. -- Concurrent writes -- Close handshake ([gorilla/websocket#448](https://github.com/gorilla/websocket/issues/448)) -- Idiomatic [ping pong](https://pkg.go.dev/nhooyr.io/websocket#Conn.Ping) API - - Gorilla requires registering a pong callback before sending a Ping -- Can target Wasm ([gorilla/websocket#432](https://github.com/gorilla/websocket/issues/432)) -- Transparent message buffer reuse with [wsjson](https://pkg.go.dev/nhooyr.io/websocket/wsjson) subpackage -- [1.75x](https://github.com/nhooyr/websocket/releases/tag/v1.7.4) faster WebSocket masking implementation in pure Go - - Gorilla's implementation is slower and uses [unsafe](https://golang.org/pkg/unsafe/). - Soon we'll have assembly and be 3x faster [#326](https://github.com/nhooyr/websocket/pull/326) -- Full [permessage-deflate](https://tools.ietf.org/html/rfc7692) compression extension support - - Gorilla only supports no context takeover mode -- [CloseRead](https://pkg.go.dev/nhooyr.io/websocket#Conn.CloseRead) helper for write only connections ([gorilla/websocket#492](https://github.com/gorilla/websocket/issues/492)) - -#### golang.org/x/net/websocket - -[golang.org/x/net/websocket](https://pkg.go.dev/golang.org/x/net/websocket) is deprecated. -See [golang/go/issues/18152](https://github.com/golang/go/issues/18152). - -The [net.Conn](https://pkg.go.dev/nhooyr.io/websocket#NetConn) can help in transitioning -to nhooyr.io/websocket. - -#### gobwas/ws - -[gobwas/ws](https://github.com/gobwas/ws) has an extremely flexible API that allows it to be used -in an event driven style for performance. See the author's [blog post](https://medium.freecodecamp.org/million-websockets-and-go-cc58418460bb). - -However it is quite bloated. See https://pkg.go.dev/github.com/gobwas/ws - -When writing idiomatic Go, nhooyr.io/websocket will be faster and easier to use. - -#### lesismal/nbio - -[lesismal/nbio](https://github.com/lesismal/nbio) is similar to gobwas/ws in that the API is -event driven for performance reasons. - -However it is quite bloated. See https://pkg.go.dev/github.com/lesismal/nbio - -When writing idiomatic Go, nhooyr.io/websocket will be faster and easier to use. +deprecated: Use https://github.com/coder/websocket instead diff --git a/vendor/nhooyr.io/websocket/accept.go b/vendor/nhooyr.io/websocket/accept.go index 285b3103..e1fd1f4f 100644 --- a/vendor/nhooyr.io/websocket/accept.go +++ b/vendor/nhooyr.io/websocket/accept.go @@ -21,6 +21,8 @@ import ( ) // AcceptOptions represents Accept's options. +// +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. type AcceptOptions struct { // Subprotocols lists the WebSocket subprotocols that Accept will negotiate with the client. // The empty subprotocol will always be negotiated as per RFC 6455. If you would like to @@ -75,6 +77,8 @@ func (opts *AcceptOptions) cloneWithDefaults() *AcceptOptions { // Accept accepts a WebSocket handshake from a client and upgrades the // the connection to a WebSocket. // +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. +// // Accept will not allow cross origin requests by default. // See the InsecureSkipVerify and OriginPatterns options to allow cross origin requests. // diff --git a/vendor/nhooyr.io/websocket/close.go b/vendor/nhooyr.io/websocket/close.go index 31504b0e..efbc2038 100644 --- a/vendor/nhooyr.io/websocket/close.go +++ b/vendor/nhooyr.io/websocket/close.go @@ -16,6 +16,8 @@ import ( // StatusCode represents a WebSocket status code. // https://tools.ietf.org/html/rfc6455#section-7.4 +// +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. type StatusCode int // https://www.iana.org/assignments/websocket/websocket.xhtml#close-code-number @@ -61,6 +63,8 @@ const ( // CloseError is returned when the connection is closed with a status and reason. // +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. +// // Use Go 1.13's errors.As to check for this error. // Also see the CloseStatus helper. type CloseError struct { @@ -68,6 +72,7 @@ type CloseError struct { Reason string } +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. func (ce CloseError) Error() string { return fmt.Sprintf("status = %v and reason = %q", ce.Code, ce.Reason) } @@ -75,6 +80,8 @@ func (ce CloseError) Error() string { // CloseStatus is a convenience wrapper around Go 1.13's errors.As to grab // the status code from a CloseError. // +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. +// // -1 will be returned if the passed error is nil or not a CloseError. func CloseStatus(err error) StatusCode { var ce CloseError @@ -86,6 +93,8 @@ func CloseStatus(err error) StatusCode { // Close performs the WebSocket close handshake with the given status code and reason. // +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. +// // It will write a WebSocket close frame with a timeout of 5s and then wait 5s for // the peer to send a close frame. // All data messages received from the peer during the close handshake will be discarded. @@ -130,6 +139,8 @@ func (c *Conn) Close(code StatusCode, reason string) (err error) { // CloseNow closes the WebSocket connection without attempting a close handshake. // Use when you do not want the overhead of the close handshake. +// +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. func (c *Conn) CloseNow() (err error) { defer errd.Wrap(&err, "failed to immediately close WebSocket") diff --git a/vendor/nhooyr.io/websocket/compress.go b/vendor/nhooyr.io/websocket/compress.go index 1f3adcfb..e50ae0b3 100644 --- a/vendor/nhooyr.io/websocket/compress.go +++ b/vendor/nhooyr.io/websocket/compress.go @@ -12,6 +12,8 @@ import ( // CompressionMode represents the modes available to the permessage-deflate extension. // See https://tools.ietf.org/html/rfc7692 // +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. +// // Works in all modern browsers except Safari which does not implement the permessage-deflate extension. // // Compression is only used if the peer supports the mode selected. diff --git a/vendor/nhooyr.io/websocket/conn.go b/vendor/nhooyr.io/websocket/conn.go index 8690fb3b..2bf221ca 100644 --- a/vendor/nhooyr.io/websocket/conn.go +++ b/vendor/nhooyr.io/websocket/conn.go @@ -17,6 +17,8 @@ import ( // MessageType represents the type of a WebSocket message. // See https://tools.ietf.org/html/rfc6455#section-5.6 +// +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. type MessageType int // MessageType constants. @@ -30,6 +32,8 @@ const ( // Conn represents a WebSocket connection. // All methods may be called concurrently except for Reader and Read. // +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. +// // You must always read from the connection. Otherwise control // frames will not be handled. See Reader and CloseRead. // @@ -140,6 +144,8 @@ func newConn(cfg connConfig) *Conn { // Subprotocol returns the negotiated subprotocol. // An empty string means the default protocol. +// +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. func (c *Conn) Subprotocol() string { return c.subprotocol } @@ -198,6 +204,8 @@ func (c *Conn) flate() bool { // not read from the connection but instead waits for a Reader call // to read the pong. // +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. +// // TCP Keepalives should suffice for most use cases. func (c *Conn) Ping(ctx context.Context) error { p := atomic.AddInt32(&c.pingCounter, 1) diff --git a/vendor/nhooyr.io/websocket/dial.go b/vendor/nhooyr.io/websocket/dial.go index e4c4daa1..6dd80502 100644 --- a/vendor/nhooyr.io/websocket/dial.go +++ b/vendor/nhooyr.io/websocket/dial.go @@ -21,6 +21,8 @@ import ( ) // DialOptions represents Dial's options. +// +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. type DialOptions struct { // HTTPClient is used for the connection. // Its Transport must return writable bodies for WebSocket handshakes. @@ -91,6 +93,8 @@ func (opts *DialOptions) cloneWithDefaults(ctx context.Context) (context.Context // Dial performs a WebSocket handshake on url. // +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. +// // The response is the WebSocket handshake response from the server. // You never need to close resp.Body yourself. // diff --git a/vendor/nhooyr.io/websocket/doc.go b/vendor/nhooyr.io/websocket/doc.go index 2ab648a6..0d8e66ae 100644 --- a/vendor/nhooyr.io/websocket/doc.go +++ b/vendor/nhooyr.io/websocket/doc.go @@ -3,6 +3,8 @@ // Package websocket implements the RFC 6455 WebSocket protocol. // +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. +// // https://tools.ietf.org/html/rfc6455 // // Use Dial to dial a WebSocket server. diff --git a/vendor/nhooyr.io/websocket/netconn.go b/vendor/nhooyr.io/websocket/netconn.go index 86f7dadb..9359bbce 100644 --- a/vendor/nhooyr.io/websocket/netconn.go +++ b/vendor/nhooyr.io/websocket/netconn.go @@ -12,6 +12,8 @@ import ( // NetConn converts a *websocket.Conn into a net.Conn. // +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. +// // It's for tunneling arbitrary protocols over WebSockets. // Few users of the library will need this but it's tricky to implement // correctly and so provided in the library. diff --git a/vendor/nhooyr.io/websocket/read.go b/vendor/nhooyr.io/websocket/read.go index a59e71d9..6ea2d500 100644 --- a/vendor/nhooyr.io/websocket/read.go +++ b/vendor/nhooyr.io/websocket/read.go @@ -21,6 +21,8 @@ import ( // Reader reads from the connection until there is a WebSocket // data message to be read. It will handle ping, pong and close frames as appropriate. // +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. +// // It returns the type of the message and an io.Reader to read it. // The passed context will also bound the reader. // Ensure you read to EOF otherwise the connection will hang. @@ -39,6 +41,8 @@ func (c *Conn) Reader(ctx context.Context) (MessageType, io.Reader, error) { // Read is a convenience method around Reader to read a single message // from the connection. +// +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. func (c *Conn) Read(ctx context.Context) (MessageType, []byte, error) { typ, r, err := c.Reader(ctx) if err != nil { @@ -52,6 +56,8 @@ func (c *Conn) Read(ctx context.Context) (MessageType, []byte, error) { // CloseRead starts a goroutine to read from the connection until it is closed // or a data message is received. // +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. +// // Once CloseRead is called you cannot read any messages from the connection. // The returned context will be cancelled when the connection is closed. // @@ -89,6 +95,8 @@ func (c *Conn) CloseRead(ctx context.Context) context.Context { // SetReadLimit sets the max number of bytes to read for a single message. // It applies to the Reader and Read methods. // +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. +// // By default, the connection has a message read limit of 32768 bytes. // // When the limit is hit, the connection will be closed with StatusMessageTooBig. diff --git a/vendor/nhooyr.io/websocket/stringer.go b/vendor/nhooyr.io/websocket/stringer.go index 5a66ba29..f70b623d 100644 --- a/vendor/nhooyr.io/websocket/stringer.go +++ b/vendor/nhooyr.io/websocket/stringer.go @@ -49,6 +49,7 @@ const _MessageType_name = "MessageTextMessageBinary" var _MessageType_index = [...]uint8{0, 11, 24} +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. func (i MessageType) String() string { i -= 1 if i < 0 || i >= MessageType(len(_MessageType_index)-1) { @@ -82,6 +83,7 @@ const _StatusCode_name = "StatusNormalClosureStatusGoingAwayStatusProtocolErrorS var _StatusCode_index = [...]uint16{0, 19, 34, 53, 74, 88, 106, 127, 156, 177, 196, 220, 239, 259, 278, 294, 312} +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. func (i StatusCode) String() string { i -= 1000 if i < 0 || i >= StatusCode(len(_StatusCode_index)-1) { diff --git a/vendor/nhooyr.io/websocket/write.go b/vendor/nhooyr.io/websocket/write.go index d7222f2d..6eaecada 100644 --- a/vendor/nhooyr.io/websocket/write.go +++ b/vendor/nhooyr.io/websocket/write.go @@ -23,6 +23,8 @@ import ( // Writer returns a writer bounded by the context that will write // a WebSocket message of type dataType to the connection. // +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. +// // You must close the writer once you have written the entire message. // // Only one writer can be open at a time, multiple calls will block until the previous writer @@ -37,6 +39,8 @@ func (c *Conn) Writer(ctx context.Context, typ MessageType) (io.WriteCloser, err // Write writes a message to the connection. // +// Deprecated: coder now maintains this library at https://github.com/coder/websocket. +// // See the Writer method if you want to stream a message. // // If compression is disabled or the compression threshold is not met, then it diff --git a/whatsapp_connect/whatsapp_connect.go b/whatsapp_connect/whatsapp_connect.go index ed0d5a88..e4c436ea 100644 --- a/whatsapp_connect/whatsapp_connect.go +++ b/whatsapp_connect/whatsapp_connect.go @@ -303,7 +303,7 @@ func FillSettings() { } -// Start - делает соединение с БД, отключение и др. +// Start - необходимые процедуры для подключения к серверу Whatsapp func Start(eventHandler func(evt interface{})) { Connect(eventHandler) @@ -312,6 +312,28 @@ func Start(eventHandler func(evt interface{})) { } +// Start_ctx - необходимые процедуры для подключения к серверу Whatsapp +// Свой контекст и WaitGroup нужны для остановки работы сервиса Graceful shutdown +// Для тех кто пользуется этим репозиторием для старта и останова сервиса можно просто Start() +func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup, eventHandler func(evt interface{})) error { + var err error + + //запомним к себе контекст и WaitGroup + contextmain.Ctx = ctx + stopapp.SetWaitGroup_Main(WaitGroup) + + // + err = Connect_err(eventHandler) + if err != nil { + return err + } + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() + + return err +} + func (m MessageWhatsapp) String() string { Otvet := ""