slidge-whatsapp 0.2.5__cp312-cp312-manylinux_2_36_aarch64.whl → 0.2.7__cp312-cp312-manylinux_2_36_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of slidge-whatsapp might be problematic. Click here for more details.
- slidge_whatsapp/config.py +3 -0
- slidge_whatsapp/event.go +31 -26
- slidge_whatsapp/gateway.go +13 -9
- slidge_whatsapp/gateway.py +2 -2
- slidge_whatsapp/generated/_whatsapp.cpython-312-aarch64-linux-gnu.h +183 -183
- slidge_whatsapp/generated/_whatsapp.cpython-312-aarch64-linux-gnu.so +0 -0
- slidge_whatsapp/generated/build.py +148 -148
- slidge_whatsapp/generated/whatsapp.c +1490 -1490
- slidge_whatsapp/generated/whatsapp.go +1217 -1217
- slidge_whatsapp/generated/whatsapp.py +1210 -1210
- slidge_whatsapp/generated/whatsapp_go.h +183 -183
- slidge_whatsapp/go.mod +15 -12
- slidge_whatsapp/go.sum +35 -29
- slidge_whatsapp/media/media.go +21 -11
- slidge_whatsapp/session.go +73 -66
- slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn.go +4 -4
- slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn_darwin.go +0 -5
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_libinit.go +3 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols.go +40 -20
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/CHANGELOG.md +14 -1
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/ffi.go +2 -2
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/fun.go +10 -2
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/lib.go +1 -1
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/lib_unix.go +1 -1
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/lib_windows.go +1 -1
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/README.md +2 -7
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/callback.go +2 -1
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c +8510 -5090
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h +344 -150
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3.go +57 -23
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_unlock_notify.c +4 -0
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_unlock_notify.go +4 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/.gitignore +4 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/LICENSE +202 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/README.md +4 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid.go +35 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid_gccgo.go +26 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.3.c +23 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.3.go +22 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.4.go +35 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.4.s +18 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.5.go +28 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.5.s +44 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid_slow.go +24 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_gccgo_go1.8.go +17 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.23.go +38 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.5.go +57 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.6.go +43 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.9.go +37 -0
- slidge_whatsapp/vendor/github.com/rs/zerolog/CONTRIBUTING.md +43 -0
- slidge_whatsapp/vendor/github.com/rs/zerolog/README.md +31 -0
- slidge_whatsapp/vendor/github.com/rs/zerolog/console.go +20 -5
- slidge_whatsapp/vendor/github.com/rs/zerolog/log/log.go +131 -0
- slidge_whatsapp/vendor/github.com/rs/zerolog/log.go +1 -1
- slidge_whatsapp/vendor/github.com/rs/zerolog/sampler.go +4 -1
- slidge_whatsapp/vendor/github.com/rs/zerolog/writer.go +9 -0
- slidge_whatsapp/vendor/go.mau.fi/libsignal/groups/GroupCipher.go +17 -6
- slidge_whatsapp/vendor/go.mau.fi/libsignal/groups/GroupSessionBuilder.go +17 -7
- slidge_whatsapp/vendor/go.mau.fi/libsignal/groups/state/store/SenderKeyStore.go +4 -2
- slidge_whatsapp/vendor/go.mau.fi/libsignal/keys/chain/ChainKey.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/libsignal/keys/identity/IdentityKey.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/libsignal/logger/DefaultLogger.go +2 -2
- slidge_whatsapp/vendor/go.mau.fi/libsignal/serialize/FingerprintProtocol.pb.go +3 -2
- slidge_whatsapp/vendor/go.mau.fi/libsignal/serialize/LocalStorageProtocol.pb.go +3 -2
- slidge_whatsapp/vendor/go.mau.fi/libsignal/serialize/WhisperTextProtocol.pb.go +3 -2
- slidge_whatsapp/vendor/go.mau.fi/libsignal/session/Session.go +41 -17
- slidge_whatsapp/vendor/go.mau.fi/libsignal/session/SessionCipher.go +64 -30
- slidge_whatsapp/vendor/go.mau.fi/libsignal/state/store/IdentityKeyStore.go +5 -3
- slidge_whatsapp/vendor/go.mau.fi/libsignal/state/store/MessageKeyStore.go +6 -4
- slidge_whatsapp/vendor/go.mau.fi/libsignal/state/store/PreKeyStore.go +6 -4
- slidge_whatsapp/vendor/go.mau.fi/libsignal/state/store/SessionStore.go +8 -6
- slidge_whatsapp/vendor/go.mau.fi/libsignal/state/store/SignedPreKeyStore.go +7 -5
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/connlog.go +257 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/database.go +309 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/iter.go +233 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/json.go +47 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/log.go +129 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/massinsert.go +164 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/queryhelper.go +137 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/reflectscan.go +30 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/transaction.go +180 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/upgrades.go +250 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/upgradetable.go +331 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exerrors/dualerror.go +33 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exerrors/must.go +23 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exhttp/cors.go +32 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exhttp/handleerrors.go +64 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exhttp/json.go +36 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exhttp/middleware.go +30 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exhttp/networkerror.go +37 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exstrings/stringutil.go +76 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/event.go +88 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/returnonce.go +25 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/ringbuffer.go +139 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/syncmap.go +94 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/syncset.go +136 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exzerolog/callermarshal.go +28 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exzerolog/defaults.go +32 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exzerolog/generics.go +45 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exzerolog/writer.go +81 -0
- slidge_whatsapp/vendor/go.mau.fi/util/ptr/ptr.go +43 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/decode.go +27 -26
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/encode.go +4 -3
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/keys.go +5 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate.go +27 -25
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/armadillomessage.go +40 -7
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/binary/encoder.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/broadcast.go +5 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/call.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/client.go +119 -37
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/connectionevents.go +29 -11
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download-to-file.go +63 -30
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download.go +74 -34
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/errors.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/group.go +61 -31
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/internals.go +188 -152
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/keepalive.go +3 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/mediaconn.go +5 -3
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/mediaretry.go +2 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/message.go +444 -135
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/msgsecret.go +118 -31
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/notification.go +78 -42
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair-code.go +7 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair.go +42 -18
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/prekeys.go +9 -5
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/presence.go +2 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/privacysettings.go +10 -11
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/extra.go +7 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/InstamadilloAddMessage.pb.go +983 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/InstamadilloAddMessage.proto +85 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/extra.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeActionLog/InstamadilloCoreTypeActionLog.pb.go +197 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeActionLog/InstamadilloCoreTypeActionLog.proto +13 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeAdminMessage/InstamadilloCoreTypeAdminMessage.pb.go +279 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeAdminMessage/InstamadilloCoreTypeAdminMessage.proto +21 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeCollection/InstamadilloCoreTypeCollection.pb.go +137 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeCollection/InstamadilloCoreTypeCollection.proto +10 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeLink/InstamadilloCoreTypeLink.pb.go +313 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeLink/InstamadilloCoreTypeLink.proto +27 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeMedia/InstamadilloCoreTypeMedia.pb.go +1299 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeMedia/InstamadilloCoreTypeMedia.proto +112 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeText/InstamadilloCoreTypeText.pb.go +514 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeText/InstamadilloCoreTypeText.proto +47 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/InstamadilloDeleteMessage.pb.go +123 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/InstamadilloDeleteMessage.proto +7 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/extra.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/InstamadilloSupplementMessage.pb.go +720 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/InstamadilloSupplementMessage.proto +59 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/extra.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloTransportPayload/InstamadilloTransportPayload.pb.go +365 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloTransportPayload/InstamadilloTransportPayload.proto +33 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloXmaContentRef/InstamadilloXmaContentRef.pb.go +1238 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloXmaContentRef/InstamadilloXmaContentRef.proto +105 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waAdv/WAAdv.pb.go +39 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloApplication/WAArmadilloApplication.pb.go +354 -175
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloApplication/WAArmadilloApplication.proto +5 -5
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.go +170 -15
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.proto +4 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCert/WACert.pb.go +29 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waChatLockSettings/WAProtobufsChatLockSettings.pb.go +13 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCommon/WACommon.pb.go +344 -31
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCommon/WACommon.proto +26 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/{WAWebProtobufsCompanionReg.pb.go → WACompanionReg.pb.go} +184 -89
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/{WAWebProtobufsCompanionReg.proto → WACompanionReg.proto} +2 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waConsumerApplication/WAConsumerApplication.pb.go +173 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.pb.go +78 -16
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.proto +5 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go +7428 -2151
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto +373 -44
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.go +456 -135
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.proto +14 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waLidMigrationSyncPayload/WAWebProtobufLidMigrationSyncPayload.pb.go +198 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waLidMigrationSyncPayload/WAWebProtobufLidMigrationSyncPayload.proto +14 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.pb.go +162 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.proto +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMmsRetry/WAMmsRetry.pb.go +32 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMmsRetry/WAMmsRetry.proto +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.pb.go +192 -52
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.proto +8 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/WAMsgTransport.pb.go +60 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/extra.go +7 -6
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMultiDevice/WAMultiDevice.pb.go +39 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waServerSync/WAServerSync.pb.go +61 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.pb.go +800 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.proto +72 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go +1344 -438
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto +52 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waUserPassword/WAProtobufsUserPassword.pb.go +27 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waVnameCert/WAWebProtobufsVnameCert.pb.go +59 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.go +382 -78
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.proto +8 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.go +563 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.proto +4 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/receipt.go +25 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/reportingfields.json +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/reportingtoken.go +176 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/retry.go +39 -21
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/send.go +261 -75
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/sendfb.go +28 -16
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/clientpayload.go +3 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/noop.go +85 -43
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/signal.go +75 -88
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go +86 -65
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/lidmap.go +186 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go +291 -167
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/00-latest-schema.sql +155 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/03-message-secrets.sql +11 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/04-privacy-tokens.sql +8 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/05-account-jid-format.sql +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/06-facebook-uuid.sql +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/07-account-lid.sql +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/08-lid-mapping.sql +5 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/09-decryption-buffer.sql +10 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/10-chat-db-lid-migration-ts.sql +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/upgrades.go +22 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/store.go +107 -56
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/botmap.go +210 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/events/events.go +13 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/group.go +15 -6
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/jid.go +7 -8
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/message.go +18 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/update.go +3 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/upload.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/user.go +47 -29
- slidge_whatsapp/vendor/golang.org/x/exp/LICENSE +27 -0
- slidge_whatsapp/vendor/golang.org/x/exp/PATENTS +22 -0
- slidge_whatsapp/vendor/golang.org/x/exp/constraints/constraints.go +54 -0
- slidge_whatsapp/vendor/golang.org/x/net/http/httpguts/guts.go +50 -0
- slidge_whatsapp/vendor/golang.org/x/net/http/httpguts/httplex.go +347 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/.gitignore +2 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/ascii.go +53 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/ciphers.go +641 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/client_conn_pool.go +311 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/config.go +122 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/config_go124.go +61 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/config_pre_go124.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/databuffer.go +149 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/errors.go +145 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/flow.go +120 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/frame.go +1702 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/gotrack.go +170 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/hpack/encode.go +245 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/hpack/hpack.go +523 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/hpack/huffman.go +226 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/hpack/static_table.go +188 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/hpack/tables.go +403 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/http2.go +432 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/pipe.go +184 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/server.go +3350 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/timer.go +20 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/transport.go +3287 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/unencrypted.go +32 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/write.go +381 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/writesched.go +251 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/writesched_priority.go +451 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/writesched_random.go +77 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/writesched_roundrobin.go +119 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/go118.go +13 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/idna10.0.0.go +769 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/idna9.0.0.go +717 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/pre_go118.go +11 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/punycode.go +217 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/tables10.0.0.go +4559 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/tables11.0.0.go +4653 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/tables12.0.0.go +4733 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/tables13.0.0.go +4959 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/tables15.0.0.go +5144 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/tables9.0.0.go +4486 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/trie.go +51 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/trie12.0.0.go +30 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/trie13.0.0.go +30 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/trieval.go +119 -0
- slidge_whatsapp/vendor/golang.org/x/net/internal/httpcommon/ascii.go +53 -0
- slidge_whatsapp/vendor/golang.org/x/net/internal/httpcommon/headermap.go +115 -0
- slidge_whatsapp/vendor/golang.org/x/net/internal/httpcommon/request.go +467 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_darwin.go +148 -1
- slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_linux.go +16 -26
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +84 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +20 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +84 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +20 -0
- slidge_whatsapp/vendor/golang.org/x/sys/windows/security_windows.go +44 -5
- slidge_whatsapp/vendor/golang.org/x/sys/windows/syscall_windows.go +4 -2
- slidge_whatsapp/vendor/golang.org/x/sys/windows/types_windows.go +239 -0
- slidge_whatsapp/vendor/golang.org/x/sys/windows/zsyscall_windows.go +9 -0
- slidge_whatsapp/vendor/golang.org/x/text/LICENSE +27 -0
- slidge_whatsapp/vendor/golang.org/x/text/PATENTS +22 -0
- slidge_whatsapp/vendor/golang.org/x/text/secure/bidirule/bidirule.go +336 -0
- slidge_whatsapp/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go +11 -0
- slidge_whatsapp/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go +14 -0
- slidge_whatsapp/vendor/golang.org/x/text/transform/transform.go +709 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/bidi.go +359 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/bracket.go +335 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/core.go +1071 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/prop.go +206 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go +1815 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go +1887 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go +1923 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go +1955 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables15.0.0.go +2042 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go +1781 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/trieval.go +48 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/composition.go +512 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/forminfo.go +279 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/input.go +109 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/iter.go +458 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/normalize.go +610 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/readwriter.go +125 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go +7657 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go +7693 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go +7710 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go +7760 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables15.0.0.go +7907 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go +7637 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/transform.go +88 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/trie.go +54 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb +0 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/editions.go +3 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go +16 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/strs/{strings_unsafe_go121.go → strings_unsafe.go} +0 -2
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/version/version.go +1 -1
- slidge_whatsapp/vendor/google.golang.org/protobuf/proto/merge.go +6 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go +2 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/reflect/protoreflect/{value_unsafe_go121.go → value_unsafe.go} +0 -2
- slidge_whatsapp/vendor/modules.txt +52 -13
- {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.2.7.dist-info}/METADATA +1 -1
- {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.2.7.dist-info}/RECORD +330 -184
- {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.2.7.dist-info}/WHEEL +1 -1
- slidge_whatsapp/vendor/github.com/rs/zerolog/CNAME +0 -1
- slidge_whatsapp/vendor/github.com/rs/zerolog/_config.yml +0 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waAdv/WAAdv.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloApplication/WAArmadilloApplication.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCert/WACert.pb.raw +0 -23
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waChatLockSettings/WAProtobufsChatLockSettings.pb.raw +0 -7
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCommon/WACommon.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WAWebProtobufsCompanionReg.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waConsumerApplication/WAConsumerApplication.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMmsRetry/WAMmsRetry.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/WAMsgTransport.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMultiDevice/WAMultiDevice.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waServerSync/WAServerSync.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waUserPassword/WAProtobufsUserPassword.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waVnameCert/WAWebProtobufsVnameCert.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrade.go +0 -296
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go +0 -94
- slidge_whatsapp/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go +0 -98
- {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.2.7.dist-info}/LICENSE +0 -0
- {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.2.7.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright 2024 The Go Authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style
|
|
3
|
+
// license that can be found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
package http2
|
|
6
|
+
|
|
7
|
+
import (
|
|
8
|
+
"crypto/tls"
|
|
9
|
+
"errors"
|
|
10
|
+
"net"
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
const nextProtoUnencryptedHTTP2 = "unencrypted_http2"
|
|
14
|
+
|
|
15
|
+
// unencryptedNetConnFromTLSConn retrieves a net.Conn wrapped in a *tls.Conn.
|
|
16
|
+
//
|
|
17
|
+
// TLSNextProto functions accept a *tls.Conn.
|
|
18
|
+
//
|
|
19
|
+
// When passing an unencrypted HTTP/2 connection to a TLSNextProto function,
|
|
20
|
+
// we pass a *tls.Conn with an underlying net.Conn containing the unencrypted connection.
|
|
21
|
+
// To be extra careful about mistakes (accidentally dropping TLS encryption in a place
|
|
22
|
+
// where we want it), the tls.Conn contains a net.Conn with an UnencryptedNetConn method
|
|
23
|
+
// that returns the actual connection we want to use.
|
|
24
|
+
func unencryptedNetConnFromTLSConn(tc *tls.Conn) (net.Conn, error) {
|
|
25
|
+
conner, ok := tc.NetConn().(interface {
|
|
26
|
+
UnencryptedNetConn() net.Conn
|
|
27
|
+
})
|
|
28
|
+
if !ok {
|
|
29
|
+
return nil, errors.New("http2: TLS conn unexpectedly found in unencrypted handoff")
|
|
30
|
+
}
|
|
31
|
+
return conner.UnencryptedNetConn(), nil
|
|
32
|
+
}
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
// Copyright 2014 The Go Authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style
|
|
3
|
+
// license that can be found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
package http2
|
|
6
|
+
|
|
7
|
+
import (
|
|
8
|
+
"bytes"
|
|
9
|
+
"fmt"
|
|
10
|
+
"log"
|
|
11
|
+
"net/http"
|
|
12
|
+
"net/url"
|
|
13
|
+
|
|
14
|
+
"golang.org/x/net/http/httpguts"
|
|
15
|
+
"golang.org/x/net/http2/hpack"
|
|
16
|
+
"golang.org/x/net/internal/httpcommon"
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
// writeFramer is implemented by any type that is used to write frames.
|
|
20
|
+
type writeFramer interface {
|
|
21
|
+
writeFrame(writeContext) error
|
|
22
|
+
|
|
23
|
+
// staysWithinBuffer reports whether this writer promises that
|
|
24
|
+
// it will only write less than or equal to size bytes, and it
|
|
25
|
+
// won't Flush the write context.
|
|
26
|
+
staysWithinBuffer(size int) bool
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// writeContext is the interface needed by the various frame writer
|
|
30
|
+
// types below. All the writeFrame methods below are scheduled via the
|
|
31
|
+
// frame writing scheduler (see writeScheduler in writesched.go).
|
|
32
|
+
//
|
|
33
|
+
// This interface is implemented by *serverConn.
|
|
34
|
+
//
|
|
35
|
+
// TODO: decide whether to a) use this in the client code (which didn't
|
|
36
|
+
// end up using this yet, because it has a simpler design, not
|
|
37
|
+
// currently implementing priorities), or b) delete this and
|
|
38
|
+
// make the server code a bit more concrete.
|
|
39
|
+
type writeContext interface {
|
|
40
|
+
Framer() *Framer
|
|
41
|
+
Flush() error
|
|
42
|
+
CloseConn() error
|
|
43
|
+
// HeaderEncoder returns an HPACK encoder that writes to the
|
|
44
|
+
// returned buffer.
|
|
45
|
+
HeaderEncoder() (*hpack.Encoder, *bytes.Buffer)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// writeEndsStream reports whether w writes a frame that will transition
|
|
49
|
+
// the stream to a half-closed local state. This returns false for RST_STREAM,
|
|
50
|
+
// which closes the entire stream (not just the local half).
|
|
51
|
+
func writeEndsStream(w writeFramer) bool {
|
|
52
|
+
switch v := w.(type) {
|
|
53
|
+
case *writeData:
|
|
54
|
+
return v.endStream
|
|
55
|
+
case *writeResHeaders:
|
|
56
|
+
return v.endStream
|
|
57
|
+
case nil:
|
|
58
|
+
// This can only happen if the caller reuses w after it's
|
|
59
|
+
// been intentionally nil'ed out to prevent use. Keep this
|
|
60
|
+
// here to catch future refactoring breaking it.
|
|
61
|
+
panic("writeEndsStream called on nil writeFramer")
|
|
62
|
+
}
|
|
63
|
+
return false
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
type flushFrameWriter struct{}
|
|
67
|
+
|
|
68
|
+
func (flushFrameWriter) writeFrame(ctx writeContext) error {
|
|
69
|
+
return ctx.Flush()
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
func (flushFrameWriter) staysWithinBuffer(max int) bool { return false }
|
|
73
|
+
|
|
74
|
+
type writeSettings []Setting
|
|
75
|
+
|
|
76
|
+
func (s writeSettings) staysWithinBuffer(max int) bool {
|
|
77
|
+
const settingSize = 6 // uint16 + uint32
|
|
78
|
+
return frameHeaderLen+settingSize*len(s) <= max
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
func (s writeSettings) writeFrame(ctx writeContext) error {
|
|
83
|
+
return ctx.Framer().WriteSettings([]Setting(s)...)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
type writeGoAway struct {
|
|
87
|
+
maxStreamID uint32
|
|
88
|
+
code ErrCode
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
func (p *writeGoAway) writeFrame(ctx writeContext) error {
|
|
92
|
+
err := ctx.Framer().WriteGoAway(p.maxStreamID, p.code, nil)
|
|
93
|
+
ctx.Flush() // ignore error: we're hanging up on them anyway
|
|
94
|
+
return err
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
func (*writeGoAway) staysWithinBuffer(max int) bool { return false } // flushes
|
|
98
|
+
|
|
99
|
+
type writeData struct {
|
|
100
|
+
streamID uint32
|
|
101
|
+
p []byte
|
|
102
|
+
endStream bool
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
func (w *writeData) String() string {
|
|
106
|
+
return fmt.Sprintf("writeData(stream=%d, p=%d, endStream=%v)", w.streamID, len(w.p), w.endStream)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
func (w *writeData) writeFrame(ctx writeContext) error {
|
|
110
|
+
return ctx.Framer().WriteData(w.streamID, w.endStream, w.p)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
func (w *writeData) staysWithinBuffer(max int) bool {
|
|
114
|
+
return frameHeaderLen+len(w.p) <= max
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// handlerPanicRST is the message sent from handler goroutines when
|
|
118
|
+
// the handler panics.
|
|
119
|
+
type handlerPanicRST struct {
|
|
120
|
+
StreamID uint32
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
func (hp handlerPanicRST) writeFrame(ctx writeContext) error {
|
|
124
|
+
return ctx.Framer().WriteRSTStream(hp.StreamID, ErrCodeInternal)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
func (hp handlerPanicRST) staysWithinBuffer(max int) bool { return frameHeaderLen+4 <= max }
|
|
128
|
+
|
|
129
|
+
func (se StreamError) writeFrame(ctx writeContext) error {
|
|
130
|
+
return ctx.Framer().WriteRSTStream(se.StreamID, se.Code)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
func (se StreamError) staysWithinBuffer(max int) bool { return frameHeaderLen+4 <= max }
|
|
134
|
+
|
|
135
|
+
type writePing struct {
|
|
136
|
+
data [8]byte
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
func (w writePing) writeFrame(ctx writeContext) error {
|
|
140
|
+
return ctx.Framer().WritePing(false, w.data)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
func (w writePing) staysWithinBuffer(max int) bool { return frameHeaderLen+len(w.data) <= max }
|
|
144
|
+
|
|
145
|
+
type writePingAck struct{ pf *PingFrame }
|
|
146
|
+
|
|
147
|
+
func (w writePingAck) writeFrame(ctx writeContext) error {
|
|
148
|
+
return ctx.Framer().WritePing(true, w.pf.Data)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
func (w writePingAck) staysWithinBuffer(max int) bool { return frameHeaderLen+len(w.pf.Data) <= max }
|
|
152
|
+
|
|
153
|
+
type writeSettingsAck struct{}
|
|
154
|
+
|
|
155
|
+
func (writeSettingsAck) writeFrame(ctx writeContext) error {
|
|
156
|
+
return ctx.Framer().WriteSettingsAck()
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
func (writeSettingsAck) staysWithinBuffer(max int) bool { return frameHeaderLen <= max }
|
|
160
|
+
|
|
161
|
+
// splitHeaderBlock splits headerBlock into fragments so that each fragment fits
|
|
162
|
+
// in a single frame, then calls fn for each fragment. firstFrag/lastFrag are true
|
|
163
|
+
// for the first/last fragment, respectively.
|
|
164
|
+
func splitHeaderBlock(ctx writeContext, headerBlock []byte, fn func(ctx writeContext, frag []byte, firstFrag, lastFrag bool) error) error {
|
|
165
|
+
// For now we're lazy and just pick the minimum MAX_FRAME_SIZE
|
|
166
|
+
// that all peers must support (16KB). Later we could care
|
|
167
|
+
// more and send larger frames if the peer advertised it, but
|
|
168
|
+
// there's little point. Most headers are small anyway (so we
|
|
169
|
+
// generally won't have CONTINUATION frames), and extra frames
|
|
170
|
+
// only waste 9 bytes anyway.
|
|
171
|
+
const maxFrameSize = 16384
|
|
172
|
+
|
|
173
|
+
first := true
|
|
174
|
+
for len(headerBlock) > 0 {
|
|
175
|
+
frag := headerBlock
|
|
176
|
+
if len(frag) > maxFrameSize {
|
|
177
|
+
frag = frag[:maxFrameSize]
|
|
178
|
+
}
|
|
179
|
+
headerBlock = headerBlock[len(frag):]
|
|
180
|
+
if err := fn(ctx, frag, first, len(headerBlock) == 0); err != nil {
|
|
181
|
+
return err
|
|
182
|
+
}
|
|
183
|
+
first = false
|
|
184
|
+
}
|
|
185
|
+
return nil
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// writeResHeaders is a request to write a HEADERS and 0+ CONTINUATION frames
|
|
189
|
+
// for HTTP response headers or trailers from a server handler.
|
|
190
|
+
type writeResHeaders struct {
|
|
191
|
+
streamID uint32
|
|
192
|
+
httpResCode int // 0 means no ":status" line
|
|
193
|
+
h http.Header // may be nil
|
|
194
|
+
trailers []string // if non-nil, which keys of h to write. nil means all.
|
|
195
|
+
endStream bool
|
|
196
|
+
|
|
197
|
+
date string
|
|
198
|
+
contentType string
|
|
199
|
+
contentLength string
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
func encKV(enc *hpack.Encoder, k, v string) {
|
|
203
|
+
if VerboseLogs {
|
|
204
|
+
log.Printf("http2: server encoding header %q = %q", k, v)
|
|
205
|
+
}
|
|
206
|
+
enc.WriteField(hpack.HeaderField{Name: k, Value: v})
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
func (w *writeResHeaders) staysWithinBuffer(max int) bool {
|
|
210
|
+
// TODO: this is a common one. It'd be nice to return true
|
|
211
|
+
// here and get into the fast path if we could be clever and
|
|
212
|
+
// calculate the size fast enough, or at least a conservative
|
|
213
|
+
// upper bound that usually fires. (Maybe if w.h and
|
|
214
|
+
// w.trailers are nil, so we don't need to enumerate it.)
|
|
215
|
+
// Otherwise I'm afraid that just calculating the length to
|
|
216
|
+
// answer this question would be slower than the ~2µs benefit.
|
|
217
|
+
return false
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
func (w *writeResHeaders) writeFrame(ctx writeContext) error {
|
|
221
|
+
enc, buf := ctx.HeaderEncoder()
|
|
222
|
+
buf.Reset()
|
|
223
|
+
|
|
224
|
+
if w.httpResCode != 0 {
|
|
225
|
+
encKV(enc, ":status", httpCodeString(w.httpResCode))
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
encodeHeaders(enc, w.h, w.trailers)
|
|
229
|
+
|
|
230
|
+
if w.contentType != "" {
|
|
231
|
+
encKV(enc, "content-type", w.contentType)
|
|
232
|
+
}
|
|
233
|
+
if w.contentLength != "" {
|
|
234
|
+
encKV(enc, "content-length", w.contentLength)
|
|
235
|
+
}
|
|
236
|
+
if w.date != "" {
|
|
237
|
+
encKV(enc, "date", w.date)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
headerBlock := buf.Bytes()
|
|
241
|
+
if len(headerBlock) == 0 && w.trailers == nil {
|
|
242
|
+
panic("unexpected empty hpack")
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return splitHeaderBlock(ctx, headerBlock, w.writeHeaderBlock)
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
func (w *writeResHeaders) writeHeaderBlock(ctx writeContext, frag []byte, firstFrag, lastFrag bool) error {
|
|
249
|
+
if firstFrag {
|
|
250
|
+
return ctx.Framer().WriteHeaders(HeadersFrameParam{
|
|
251
|
+
StreamID: w.streamID,
|
|
252
|
+
BlockFragment: frag,
|
|
253
|
+
EndStream: w.endStream,
|
|
254
|
+
EndHeaders: lastFrag,
|
|
255
|
+
})
|
|
256
|
+
} else {
|
|
257
|
+
return ctx.Framer().WriteContinuation(w.streamID, lastFrag, frag)
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// writePushPromise is a request to write a PUSH_PROMISE and 0+ CONTINUATION frames.
|
|
262
|
+
type writePushPromise struct {
|
|
263
|
+
streamID uint32 // pusher stream
|
|
264
|
+
method string // for :method
|
|
265
|
+
url *url.URL // for :scheme, :authority, :path
|
|
266
|
+
h http.Header
|
|
267
|
+
|
|
268
|
+
// Creates an ID for a pushed stream. This runs on serveG just before
|
|
269
|
+
// the frame is written. The returned ID is copied to promisedID.
|
|
270
|
+
allocatePromisedID func() (uint32, error)
|
|
271
|
+
promisedID uint32
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
func (w *writePushPromise) staysWithinBuffer(max int) bool {
|
|
275
|
+
// TODO: see writeResHeaders.staysWithinBuffer
|
|
276
|
+
return false
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
func (w *writePushPromise) writeFrame(ctx writeContext) error {
|
|
280
|
+
enc, buf := ctx.HeaderEncoder()
|
|
281
|
+
buf.Reset()
|
|
282
|
+
|
|
283
|
+
encKV(enc, ":method", w.method)
|
|
284
|
+
encKV(enc, ":scheme", w.url.Scheme)
|
|
285
|
+
encKV(enc, ":authority", w.url.Host)
|
|
286
|
+
encKV(enc, ":path", w.url.RequestURI())
|
|
287
|
+
encodeHeaders(enc, w.h, nil)
|
|
288
|
+
|
|
289
|
+
headerBlock := buf.Bytes()
|
|
290
|
+
if len(headerBlock) == 0 {
|
|
291
|
+
panic("unexpected empty hpack")
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return splitHeaderBlock(ctx, headerBlock, w.writeHeaderBlock)
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
func (w *writePushPromise) writeHeaderBlock(ctx writeContext, frag []byte, firstFrag, lastFrag bool) error {
|
|
298
|
+
if firstFrag {
|
|
299
|
+
return ctx.Framer().WritePushPromise(PushPromiseParam{
|
|
300
|
+
StreamID: w.streamID,
|
|
301
|
+
PromiseID: w.promisedID,
|
|
302
|
+
BlockFragment: frag,
|
|
303
|
+
EndHeaders: lastFrag,
|
|
304
|
+
})
|
|
305
|
+
} else {
|
|
306
|
+
return ctx.Framer().WriteContinuation(w.streamID, lastFrag, frag)
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
type write100ContinueHeadersFrame struct {
|
|
311
|
+
streamID uint32
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
func (w write100ContinueHeadersFrame) writeFrame(ctx writeContext) error {
|
|
315
|
+
enc, buf := ctx.HeaderEncoder()
|
|
316
|
+
buf.Reset()
|
|
317
|
+
encKV(enc, ":status", "100")
|
|
318
|
+
return ctx.Framer().WriteHeaders(HeadersFrameParam{
|
|
319
|
+
StreamID: w.streamID,
|
|
320
|
+
BlockFragment: buf.Bytes(),
|
|
321
|
+
EndStream: false,
|
|
322
|
+
EndHeaders: true,
|
|
323
|
+
})
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
func (w write100ContinueHeadersFrame) staysWithinBuffer(max int) bool {
|
|
327
|
+
// Sloppy but conservative:
|
|
328
|
+
return 9+2*(len(":status")+len("100")) <= max
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
type writeWindowUpdate struct {
|
|
332
|
+
streamID uint32 // or 0 for conn-level
|
|
333
|
+
n uint32
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
func (wu writeWindowUpdate) staysWithinBuffer(max int) bool { return frameHeaderLen+4 <= max }
|
|
337
|
+
|
|
338
|
+
func (wu writeWindowUpdate) writeFrame(ctx writeContext) error {
|
|
339
|
+
return ctx.Framer().WriteWindowUpdate(wu.streamID, wu.n)
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// encodeHeaders encodes an http.Header. If keys is not nil, then (k, h[k])
|
|
343
|
+
// is encoded only if k is in keys.
|
|
344
|
+
func encodeHeaders(enc *hpack.Encoder, h http.Header, keys []string) {
|
|
345
|
+
if keys == nil {
|
|
346
|
+
sorter := sorterPool.Get().(*sorter)
|
|
347
|
+
// Using defer here, since the returned keys from the
|
|
348
|
+
// sorter.Keys method is only valid until the sorter
|
|
349
|
+
// is returned:
|
|
350
|
+
defer sorterPool.Put(sorter)
|
|
351
|
+
keys = sorter.Keys(h)
|
|
352
|
+
}
|
|
353
|
+
for _, k := range keys {
|
|
354
|
+
vv := h[k]
|
|
355
|
+
k, ascii := httpcommon.LowerHeader(k)
|
|
356
|
+
if !ascii {
|
|
357
|
+
// Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header
|
|
358
|
+
// field names have to be ASCII characters (just as in HTTP/1.x).
|
|
359
|
+
continue
|
|
360
|
+
}
|
|
361
|
+
if !validWireHeaderFieldName(k) {
|
|
362
|
+
// Skip it as backup paranoia. Per
|
|
363
|
+
// golang.org/issue/14048, these should
|
|
364
|
+
// already be rejected at a higher level.
|
|
365
|
+
continue
|
|
366
|
+
}
|
|
367
|
+
isTE := k == "transfer-encoding"
|
|
368
|
+
for _, v := range vv {
|
|
369
|
+
if !httpguts.ValidHeaderFieldValue(v) {
|
|
370
|
+
// TODO: return an error? golang.org/issue/14048
|
|
371
|
+
// For now just omit it.
|
|
372
|
+
continue
|
|
373
|
+
}
|
|
374
|
+
// TODO: more of "8.1.2.2 Connection-Specific Header Fields"
|
|
375
|
+
if isTE && v != "trailers" {
|
|
376
|
+
continue
|
|
377
|
+
}
|
|
378
|
+
encKV(enc, k, v)
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
// Copyright 2014 The Go Authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style
|
|
3
|
+
// license that can be found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
package http2
|
|
6
|
+
|
|
7
|
+
import "fmt"
|
|
8
|
+
|
|
9
|
+
// WriteScheduler is the interface implemented by HTTP/2 write schedulers.
|
|
10
|
+
// Methods are never called concurrently.
|
|
11
|
+
type WriteScheduler interface {
|
|
12
|
+
// OpenStream opens a new stream in the write scheduler.
|
|
13
|
+
// It is illegal to call this with streamID=0 or with a streamID that is
|
|
14
|
+
// already open -- the call may panic.
|
|
15
|
+
OpenStream(streamID uint32, options OpenStreamOptions)
|
|
16
|
+
|
|
17
|
+
// CloseStream closes a stream in the write scheduler. Any frames queued on
|
|
18
|
+
// this stream should be discarded. It is illegal to call this on a stream
|
|
19
|
+
// that is not open -- the call may panic.
|
|
20
|
+
CloseStream(streamID uint32)
|
|
21
|
+
|
|
22
|
+
// AdjustStream adjusts the priority of the given stream. This may be called
|
|
23
|
+
// on a stream that has not yet been opened or has been closed. Note that
|
|
24
|
+
// RFC 7540 allows PRIORITY frames to be sent on streams in any state. See:
|
|
25
|
+
// https://tools.ietf.org/html/rfc7540#section-5.1
|
|
26
|
+
AdjustStream(streamID uint32, priority PriorityParam)
|
|
27
|
+
|
|
28
|
+
// Push queues a frame in the scheduler. In most cases, this will not be
|
|
29
|
+
// called with wr.StreamID()!=0 unless that stream is currently open. The one
|
|
30
|
+
// exception is RST_STREAM frames, which may be sent on idle or closed streams.
|
|
31
|
+
Push(wr FrameWriteRequest)
|
|
32
|
+
|
|
33
|
+
// Pop dequeues the next frame to write. Returns false if no frames can
|
|
34
|
+
// be written. Frames with a given wr.StreamID() are Pop'd in the same
|
|
35
|
+
// order they are Push'd, except RST_STREAM frames. No frames should be
|
|
36
|
+
// discarded except by CloseStream.
|
|
37
|
+
Pop() (wr FrameWriteRequest, ok bool)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// OpenStreamOptions specifies extra options for WriteScheduler.OpenStream.
|
|
41
|
+
type OpenStreamOptions struct {
|
|
42
|
+
// PusherID is zero if the stream was initiated by the client. Otherwise,
|
|
43
|
+
// PusherID names the stream that pushed the newly opened stream.
|
|
44
|
+
PusherID uint32
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// FrameWriteRequest is a request to write a frame.
|
|
48
|
+
type FrameWriteRequest struct {
|
|
49
|
+
// write is the interface value that does the writing, once the
|
|
50
|
+
// WriteScheduler has selected this frame to write. The write
|
|
51
|
+
// functions are all defined in write.go.
|
|
52
|
+
write writeFramer
|
|
53
|
+
|
|
54
|
+
// stream is the stream on which this frame will be written.
|
|
55
|
+
// nil for non-stream frames like PING and SETTINGS.
|
|
56
|
+
// nil for RST_STREAM streams, which use the StreamError.StreamID field instead.
|
|
57
|
+
stream *stream
|
|
58
|
+
|
|
59
|
+
// done, if non-nil, must be a buffered channel with space for
|
|
60
|
+
// 1 message and is sent the return value from write (or an
|
|
61
|
+
// earlier error) when the frame has been written.
|
|
62
|
+
done chan error
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// StreamID returns the id of the stream this frame will be written to.
|
|
66
|
+
// 0 is used for non-stream frames such as PING and SETTINGS.
|
|
67
|
+
func (wr FrameWriteRequest) StreamID() uint32 {
|
|
68
|
+
if wr.stream == nil {
|
|
69
|
+
if se, ok := wr.write.(StreamError); ok {
|
|
70
|
+
// (*serverConn).resetStream doesn't set
|
|
71
|
+
// stream because it doesn't necessarily have
|
|
72
|
+
// one. So special case this type of write
|
|
73
|
+
// message.
|
|
74
|
+
return se.StreamID
|
|
75
|
+
}
|
|
76
|
+
return 0
|
|
77
|
+
}
|
|
78
|
+
return wr.stream.id
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// isControl reports whether wr is a control frame for MaxQueuedControlFrames
|
|
82
|
+
// purposes. That includes non-stream frames and RST_STREAM frames.
|
|
83
|
+
func (wr FrameWriteRequest) isControl() bool {
|
|
84
|
+
return wr.stream == nil
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// DataSize returns the number of flow control bytes that must be consumed
|
|
88
|
+
// to write this entire frame. This is 0 for non-DATA frames.
|
|
89
|
+
func (wr FrameWriteRequest) DataSize() int {
|
|
90
|
+
if wd, ok := wr.write.(*writeData); ok {
|
|
91
|
+
return len(wd.p)
|
|
92
|
+
}
|
|
93
|
+
return 0
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Consume consumes min(n, available) bytes from this frame, where available
|
|
97
|
+
// is the number of flow control bytes available on the stream. Consume returns
|
|
98
|
+
// 0, 1, or 2 frames, where the integer return value gives the number of frames
|
|
99
|
+
// returned.
|
|
100
|
+
//
|
|
101
|
+
// If flow control prevents consuming any bytes, this returns (_, _, 0). If
|
|
102
|
+
// the entire frame was consumed, this returns (wr, _, 1). Otherwise, this
|
|
103
|
+
// returns (consumed, rest, 2), where 'consumed' contains the consumed bytes and
|
|
104
|
+
// 'rest' contains the remaining bytes. The consumed bytes are deducted from the
|
|
105
|
+
// underlying stream's flow control budget.
|
|
106
|
+
func (wr FrameWriteRequest) Consume(n int32) (FrameWriteRequest, FrameWriteRequest, int) {
|
|
107
|
+
var empty FrameWriteRequest
|
|
108
|
+
|
|
109
|
+
// Non-DATA frames are always consumed whole.
|
|
110
|
+
wd, ok := wr.write.(*writeData)
|
|
111
|
+
if !ok || len(wd.p) == 0 {
|
|
112
|
+
return wr, empty, 1
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Might need to split after applying limits.
|
|
116
|
+
allowed := wr.stream.flow.available()
|
|
117
|
+
if n < allowed {
|
|
118
|
+
allowed = n
|
|
119
|
+
}
|
|
120
|
+
if wr.stream.sc.maxFrameSize < allowed {
|
|
121
|
+
allowed = wr.stream.sc.maxFrameSize
|
|
122
|
+
}
|
|
123
|
+
if allowed <= 0 {
|
|
124
|
+
return empty, empty, 0
|
|
125
|
+
}
|
|
126
|
+
if len(wd.p) > int(allowed) {
|
|
127
|
+
wr.stream.flow.take(allowed)
|
|
128
|
+
consumed := FrameWriteRequest{
|
|
129
|
+
stream: wr.stream,
|
|
130
|
+
write: &writeData{
|
|
131
|
+
streamID: wd.streamID,
|
|
132
|
+
p: wd.p[:allowed],
|
|
133
|
+
// Even if the original had endStream set, there
|
|
134
|
+
// are bytes remaining because len(wd.p) > allowed,
|
|
135
|
+
// so we know endStream is false.
|
|
136
|
+
endStream: false,
|
|
137
|
+
},
|
|
138
|
+
// Our caller is blocking on the final DATA frame, not
|
|
139
|
+
// this intermediate frame, so no need to wait.
|
|
140
|
+
done: nil,
|
|
141
|
+
}
|
|
142
|
+
rest := FrameWriteRequest{
|
|
143
|
+
stream: wr.stream,
|
|
144
|
+
write: &writeData{
|
|
145
|
+
streamID: wd.streamID,
|
|
146
|
+
p: wd.p[allowed:],
|
|
147
|
+
endStream: wd.endStream,
|
|
148
|
+
},
|
|
149
|
+
done: wr.done,
|
|
150
|
+
}
|
|
151
|
+
return consumed, rest, 2
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// The frame is consumed whole.
|
|
155
|
+
// NB: This cast cannot overflow because allowed is <= math.MaxInt32.
|
|
156
|
+
wr.stream.flow.take(int32(len(wd.p)))
|
|
157
|
+
return wr, empty, 1
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// String is for debugging only.
|
|
161
|
+
func (wr FrameWriteRequest) String() string {
|
|
162
|
+
var des string
|
|
163
|
+
if s, ok := wr.write.(fmt.Stringer); ok {
|
|
164
|
+
des = s.String()
|
|
165
|
+
} else {
|
|
166
|
+
des = fmt.Sprintf("%T", wr.write)
|
|
167
|
+
}
|
|
168
|
+
return fmt.Sprintf("[FrameWriteRequest stream=%d, ch=%v, writer=%v]", wr.StreamID(), wr.done != nil, des)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// replyToWriter sends err to wr.done and panics if the send must block
|
|
172
|
+
// This does nothing if wr.done is nil.
|
|
173
|
+
func (wr *FrameWriteRequest) replyToWriter(err error) {
|
|
174
|
+
if wr.done == nil {
|
|
175
|
+
return
|
|
176
|
+
}
|
|
177
|
+
select {
|
|
178
|
+
case wr.done <- err:
|
|
179
|
+
default:
|
|
180
|
+
panic(fmt.Sprintf("unbuffered done channel passed in for type %T", wr.write))
|
|
181
|
+
}
|
|
182
|
+
wr.write = nil // prevent use (assume it's tainted after wr.done send)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// writeQueue is used by implementations of WriteScheduler.
|
|
186
|
+
type writeQueue struct {
|
|
187
|
+
s []FrameWriteRequest
|
|
188
|
+
prev, next *writeQueue
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
func (q *writeQueue) empty() bool { return len(q.s) == 0 }
|
|
192
|
+
|
|
193
|
+
func (q *writeQueue) push(wr FrameWriteRequest) {
|
|
194
|
+
q.s = append(q.s, wr)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
func (q *writeQueue) shift() FrameWriteRequest {
|
|
198
|
+
if len(q.s) == 0 {
|
|
199
|
+
panic("invalid use of queue")
|
|
200
|
+
}
|
|
201
|
+
wr := q.s[0]
|
|
202
|
+
// TODO: less copy-happy queue.
|
|
203
|
+
copy(q.s, q.s[1:])
|
|
204
|
+
q.s[len(q.s)-1] = FrameWriteRequest{}
|
|
205
|
+
q.s = q.s[:len(q.s)-1]
|
|
206
|
+
return wr
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// consume consumes up to n bytes from q.s[0]. If the frame is
|
|
210
|
+
// entirely consumed, it is removed from the queue. If the frame
|
|
211
|
+
// is partially consumed, the frame is kept with the consumed
|
|
212
|
+
// bytes removed. Returns true iff any bytes were consumed.
|
|
213
|
+
func (q *writeQueue) consume(n int32) (FrameWriteRequest, bool) {
|
|
214
|
+
if len(q.s) == 0 {
|
|
215
|
+
return FrameWriteRequest{}, false
|
|
216
|
+
}
|
|
217
|
+
consumed, rest, numresult := q.s[0].Consume(n)
|
|
218
|
+
switch numresult {
|
|
219
|
+
case 0:
|
|
220
|
+
return FrameWriteRequest{}, false
|
|
221
|
+
case 1:
|
|
222
|
+
q.shift()
|
|
223
|
+
case 2:
|
|
224
|
+
q.s[0] = rest
|
|
225
|
+
}
|
|
226
|
+
return consumed, true
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
type writeQueuePool []*writeQueue
|
|
230
|
+
|
|
231
|
+
// put inserts an unused writeQueue into the pool.
|
|
232
|
+
func (p *writeQueuePool) put(q *writeQueue) {
|
|
233
|
+
for i := range q.s {
|
|
234
|
+
q.s[i] = FrameWriteRequest{}
|
|
235
|
+
}
|
|
236
|
+
q.s = q.s[:0]
|
|
237
|
+
*p = append(*p, q)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// get returns an empty writeQueue.
|
|
241
|
+
func (p *writeQueuePool) get() *writeQueue {
|
|
242
|
+
ln := len(*p)
|
|
243
|
+
if ln == 0 {
|
|
244
|
+
return new(writeQueue)
|
|
245
|
+
}
|
|
246
|
+
x := ln - 1
|
|
247
|
+
q := (*p)[x]
|
|
248
|
+
(*p)[x] = nil
|
|
249
|
+
*p = (*p)[:x]
|
|
250
|
+
return q
|
|
251
|
+
}
|