@netifyjs/protocol 0.0.0-stage → 1.0.0-alpha.2
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.
- package/LICENSE +21 -0
- package/README.md +38 -2
- package/package.json +56 -4
- package/src/codec/index.ts +256 -0
- package/src/dispatch/dispatcher/index.ts +200 -0
- package/src/dispatch/event/index.ts +49 -0
- package/src/dispatch/index.ts +11 -0
- package/src/dispatch/route/index.ts +141 -0
- package/src/dispatch/session/index.ts +60 -0
- package/src/format/index.ts +72 -0
- package/src/index.ts +66 -0
- package/src/names/index.ts +73 -0
- package/src/photon/application/index.ts +76 -0
- package/src/photon/authentication/admission/index.ts +47 -0
- package/src/photon/authentication/authenticator/index.ts +106 -0
- package/src/photon/authentication/failure/index.ts +15 -0
- package/src/photon/authentication/gate/index.ts +221 -0
- package/src/photon/authentication/http/index.ts +337 -0
- package/src/photon/authentication/index.ts +18 -0
- package/src/photon/authentication/keys/index.ts +67 -0
- package/src/photon/authentication/provider/index.ts +48 -0
- package/src/photon/authentication/queue/index.ts +284 -0
- package/src/photon/authentication/result/index.ts +191 -0
- package/src/photon/balancing/catalogue/events/index.ts +93 -0
- package/src/photon/balancing/catalogue/index.ts +148 -0
- package/src/photon/balancing/catalogue/requests/index.ts +104 -0
- package/src/photon/balancing/catalogue/responses/index.ts +106 -0
- package/src/photon/balancing/code/actor/index.ts +24 -0
- package/src/photon/balancing/code/authentication/index.ts +101 -0
- package/src/photon/balancing/code/caching/index.ts +69 -0
- package/src/photon/balancing/code/cause/index.ts +115 -0
- package/src/photon/balancing/code/error/index.ts +280 -0
- package/src/photon/balancing/code/event/index.ts +104 -0
- package/src/photon/balancing/code/friends/index.ts +35 -0
- package/src/photon/balancing/code/game/index.ts +69 -0
- package/src/photon/balancing/code/index.ts +52 -0
- package/src/photon/balancing/code/join/index.ts +29 -0
- package/src/photon/balancing/code/lobby/index.ts +29 -0
- package/src/photon/balancing/code/matchmaking/index.ts +25 -0
- package/src/photon/balancing/code/message/index.ts +507 -0
- package/src/photon/balancing/code/operation/index.ts +124 -0
- package/src/photon/balancing/code/parameter/index.ts +414 -0
- package/src/photon/balancing/code/ping/index.ts +29 -0
- package/src/photon/balancing/code/port/index.ts +89 -0
- package/src/photon/balancing/code/property/index.ts +30 -0
- package/src/photon/balancing/code/receiver/index.ts +24 -0
- package/src/photon/balancing/code/room/index.ts +45 -0
- package/src/photon/balancing/code/state/index.ts +109 -0
- package/src/photon/balancing/code/status/index.ts +89 -0
- package/src/photon/balancing/code/web/index.ts +29 -0
- package/src/photon/balancing/codec/index.ts +294 -0
- package/src/photon/balancing/dotnet/index.ts +55 -0
- package/src/photon/balancing/entity/authentication/index.ts +51 -0
- package/src/photon/balancing/entity/credentials/index.ts +77 -0
- package/src/photon/balancing/entity/entry/index.ts +77 -0
- package/src/photon/balancing/entity/grant/index.ts +192 -0
- package/src/photon/balancing/entity/index.ts +7 -0
- package/src/photon/balancing/entity/lobby/index.ts +35 -0
- package/src/photon/balancing/entity/options/index.ts +174 -0
- package/src/photon/balancing/entity/stat/index.ts +59 -0
- package/src/photon/balancing/format/authenticate/index.ts +2 -0
- package/src/photon/balancing/format/authenticate/request/index.ts +82 -0
- package/src/photon/balancing/format/authenticate/response/index.ts +61 -0
- package/src/photon/balancing/format/contract/index.ts +51 -0
- package/src/photon/balancing/format/event/auth/index.ts +49 -0
- package/src/photon/balancing/format/event/azure/index.ts +56 -0
- package/src/photon/balancing/format/event/custom/index.ts +55 -0
- package/src/photon/balancing/format/event/disconnect/index.ts +54 -0
- package/src/photon/balancing/format/event/error/index.ts +51 -0
- package/src/photon/balancing/format/event/index.ts +16 -0
- package/src/photon/balancing/format/event/join/index.ts +58 -0
- package/src/photon/balancing/format/event/leave/index.ts +60 -0
- package/src/photon/balancing/format/event/list/index.ts +53 -0
- package/src/photon/balancing/format/event/match/index.ts +55 -0
- package/src/photon/balancing/format/event/offline/index.ts +52 -0
- package/src/photon/balancing/format/event/properties/index.ts +60 -0
- package/src/photon/balancing/format/event/purged/index.ts +44 -0
- package/src/photon/balancing/format/event/queue/index.ts +51 -0
- package/src/photon/balancing/format/event/slice/index.ts +57 -0
- package/src/photon/balancing/format/event/stats/app/index.ts +60 -0
- package/src/photon/balancing/format/event/stats/index.ts +2 -0
- package/src/photon/balancing/format/event/stats/lobby/index.ts +54 -0
- package/src/photon/balancing/format/event/update/index.ts +53 -0
- package/src/photon/balancing/format/friends/index.ts +2 -0
- package/src/photon/balancing/format/friends/request/index.ts +56 -0
- package/src/photon/balancing/format/friends/response/index.ts +64 -0
- package/src/photon/balancing/format/game/create/index.ts +2 -0
- package/src/photon/balancing/format/game/create/request/index.ts +79 -0
- package/src/photon/balancing/format/game/create/response/index.ts +87 -0
- package/src/photon/balancing/format/game/debug/index.ts +2 -0
- package/src/photon/balancing/format/game/debug/request/index.ts +55 -0
- package/src/photon/balancing/format/game/debug/response/index.ts +60 -0
- package/src/photon/balancing/format/game/index.ts +17 -0
- package/src/photon/balancing/format/game/join/index.ts +2 -0
- package/src/photon/balancing/format/game/join/request/index.ts +93 -0
- package/src/photon/balancing/format/game/join/response/index.ts +87 -0
- package/src/photon/balancing/format/game/list/index.ts +2 -0
- package/src/photon/balancing/format/game/list/request/index.ts +59 -0
- package/src/photon/balancing/format/game/list/response/index.ts +57 -0
- package/src/photon/balancing/format/game/random/index.ts +2 -0
- package/src/photon/balancing/format/game/random/request/index.ts +87 -0
- package/src/photon/balancing/format/game/random/response/index.ts +66 -0
- package/src/photon/balancing/format/groups/index.ts +2 -0
- package/src/photon/balancing/format/groups/request/index.ts +54 -0
- package/src/photon/balancing/format/groups/response/index.ts +52 -0
- package/src/photon/balancing/format/index.ts +88 -0
- package/src/photon/balancing/format/leave/index.ts +2 -0
- package/src/photon/balancing/format/leave/request/index.ts +54 -0
- package/src/photon/balancing/format/leave/response/index.ts +49 -0
- package/src/photon/balancing/format/lobby/index.ts +12 -0
- package/src/photon/balancing/format/lobby/join/index.ts +2 -0
- package/src/photon/balancing/format/lobby/join/request/index.ts +63 -0
- package/src/photon/balancing/format/lobby/join/response/index.ts +45 -0
- package/src/photon/balancing/format/lobby/leave/index.ts +2 -0
- package/src/photon/balancing/format/lobby/leave/request/index.ts +43 -0
- package/src/photon/balancing/format/lobby/leave/response/index.ts +45 -0
- package/src/photon/balancing/format/lobby/stats/index.ts +2 -0
- package/src/photon/balancing/format/lobby/stats/request/index.ts +54 -0
- package/src/photon/balancing/format/lobby/stats/response/index.ts +62 -0
- package/src/photon/balancing/format/once/index.ts +2 -0
- package/src/photon/balancing/format/once/request/index.ts +72 -0
- package/src/photon/balancing/format/once/response/index.ts +65 -0
- package/src/photon/balancing/format/ping/index.ts +2 -0
- package/src/photon/balancing/format/ping/request/index.ts +43 -0
- package/src/photon/balancing/format/ping/response/index.ts +49 -0
- package/src/photon/balancing/format/properties/get/index.ts +2 -0
- package/src/photon/balancing/format/properties/get/request/index.ts +58 -0
- package/src/photon/balancing/format/properties/get/response/index.ts +62 -0
- package/src/photon/balancing/format/properties/index.ts +8 -0
- package/src/photon/balancing/format/properties/set/index.ts +2 -0
- package/src/photon/balancing/format/properties/set/request/index.ts +66 -0
- package/src/photon/balancing/format/properties/set/response/index.ts +53 -0
- package/src/photon/balancing/format/raise/index.ts +2 -0
- package/src/photon/balancing/format/raise/request/index.ts +93 -0
- package/src/photon/balancing/format/raise/response/index.ts +49 -0
- package/src/photon/balancing/format/reader/index.ts +362 -0
- package/src/photon/balancing/format/regions/index.ts +2 -0
- package/src/photon/balancing/format/regions/request/index.ts +49 -0
- package/src/photon/balancing/format/regions/response/index.ts +62 -0
- package/src/photon/balancing/format/rpc/index.ts +2 -0
- package/src/photon/balancing/format/rpc/request/index.ts +56 -0
- package/src/photon/balancing/format/rpc/response/index.ts +62 -0
- package/src/photon/balancing/format/settings/index.ts +2 -0
- package/src/photon/balancing/format/settings/request/index.ts +52 -0
- package/src/photon/balancing/format/settings/response/index.ts +49 -0
- package/src/photon/balancing/format/shared/credentials/index.ts +84 -0
- package/src/photon/balancing/format/shared/entry/index.ts +43 -0
- package/src/photon/balancing/format/shared/grant/index.ts +96 -0
- package/src/photon/balancing/format/shared/index.ts +6 -0
- package/src/photon/balancing/format/shared/lobby/index.ts +36 -0
- package/src/photon/balancing/format/shared/options/index.ts +68 -0
- package/src/photon/balancing/format/shared/stats/index.ts +55 -0
- package/src/photon/balancing/format/writer/index.ts +187 -0
- package/src/photon/balancing/index.ts +239 -0
- package/src/photon/balancing/packet/adapter/index.ts +39 -0
- package/src/photon/balancing/packet/authenticate/index.ts +2 -0
- package/src/photon/balancing/packet/authenticate/request/index.ts +105 -0
- package/src/photon/balancing/packet/authenticate/response/index.ts +49 -0
- package/src/photon/balancing/packet/event/auth/index.ts +30 -0
- package/src/photon/balancing/packet/event/azure/index.ts +54 -0
- package/src/photon/balancing/packet/event/custom/index.ts +50 -0
- package/src/photon/balancing/packet/event/disconnect/index.ts +30 -0
- package/src/photon/balancing/packet/event/error/index.ts +29 -0
- package/src/photon/balancing/packet/event/index.ts +16 -0
- package/src/photon/balancing/packet/event/join/index.ts +54 -0
- package/src/photon/balancing/packet/event/leave/index.ts +63 -0
- package/src/photon/balancing/packet/event/list/index.ts +30 -0
- package/src/photon/balancing/packet/event/match/index.ts +37 -0
- package/src/photon/balancing/packet/event/offline/index.ts +29 -0
- package/src/photon/balancing/packet/event/properties/index.ts +58 -0
- package/src/photon/balancing/packet/event/purged/index.ts +21 -0
- package/src/photon/balancing/packet/event/queue/index.ts +29 -0
- package/src/photon/balancing/packet/event/slice/index.ts +40 -0
- package/src/photon/balancing/packet/event/stats/app/index.ts +56 -0
- package/src/photon/balancing/packet/event/stats/index.ts +2 -0
- package/src/photon/balancing/packet/event/stats/lobby/index.ts +30 -0
- package/src/photon/balancing/packet/event/update/index.ts +30 -0
- package/src/photon/balancing/packet/friends/index.ts +2 -0
- package/src/photon/balancing/packet/friends/request/index.ts +40 -0
- package/src/photon/balancing/packet/friends/response/index.ts +60 -0
- package/src/photon/balancing/packet/game/create/index.ts +2 -0
- package/src/photon/balancing/packet/game/create/request/index.ts +160 -0
- package/src/photon/balancing/packet/game/create/response/index.ts +122 -0
- package/src/photon/balancing/packet/game/debug/index.ts +2 -0
- package/src/photon/balancing/packet/game/debug/request/index.ts +40 -0
- package/src/photon/balancing/packet/game/debug/response/index.ts +70 -0
- package/src/photon/balancing/packet/game/index.ts +8 -0
- package/src/photon/balancing/packet/game/join/index.ts +2 -0
- package/src/photon/balancing/packet/game/join/request/index.ts +218 -0
- package/src/photon/balancing/packet/game/join/response/index.ts +122 -0
- package/src/photon/balancing/packet/game/list/index.ts +2 -0
- package/src/photon/balancing/packet/game/list/request/index.ts +41 -0
- package/src/photon/balancing/packet/game/list/response/index.ts +49 -0
- package/src/photon/balancing/packet/game/random/index.ts +2 -0
- package/src/photon/balancing/packet/game/random/request/index.ts +172 -0
- package/src/photon/balancing/packet/game/random/response/index.ts +95 -0
- package/src/photon/balancing/packet/groups/index.ts +2 -0
- package/src/photon/balancing/packet/groups/request/index.ts +40 -0
- package/src/photon/balancing/packet/groups/response/index.ts +35 -0
- package/src/photon/balancing/packet/index.ts +69 -0
- package/src/photon/balancing/packet/leave/index.ts +2 -0
- package/src/photon/balancing/packet/leave/request/index.ts +40 -0
- package/src/photon/balancing/packet/leave/response/index.ts +35 -0
- package/src/photon/balancing/packet/lobby/index.ts +3 -0
- package/src/photon/balancing/packet/lobby/join/index.ts +2 -0
- package/src/photon/balancing/packet/lobby/join/request/index.ts +55 -0
- package/src/photon/balancing/packet/lobby/join/response/index.ts +35 -0
- package/src/photon/balancing/packet/lobby/leave/index.ts +2 -0
- package/src/photon/balancing/packet/lobby/leave/request/index.ts +21 -0
- package/src/photon/balancing/packet/lobby/leave/response/index.ts +43 -0
- package/src/photon/balancing/packet/lobby/stats/index.ts +2 -0
- package/src/photon/balancing/packet/lobby/stats/request/index.ts +43 -0
- package/src/photon/balancing/packet/lobby/stats/response/index.ts +49 -0
- package/src/photon/balancing/packet/once/index.ts +2 -0
- package/src/photon/balancing/packet/once/request/index.ts +70 -0
- package/src/photon/balancing/packet/once/response/index.ts +49 -0
- package/src/photon/balancing/packet/ping/index.ts +2 -0
- package/src/photon/balancing/packet/ping/request/index.ts +21 -0
- package/src/photon/balancing/packet/ping/response/index.ts +35 -0
- package/src/photon/balancing/packet/properties/get/index.ts +2 -0
- package/src/photon/balancing/packet/properties/get/request/index.ts +69 -0
- package/src/photon/balancing/packet/properties/get/response/index.ts +66 -0
- package/src/photon/balancing/packet/properties/index.ts +2 -0
- package/src/photon/balancing/packet/properties/set/index.ts +2 -0
- package/src/photon/balancing/packet/properties/set/request/index.ts +122 -0
- package/src/photon/balancing/packet/properties/set/response/index.ts +35 -0
- package/src/photon/balancing/packet/raise/index.ts +2 -0
- package/src/photon/balancing/packet/raise/request/index.ts +219 -0
- package/src/photon/balancing/packet/raise/response/index.ts +35 -0
- package/src/photon/balancing/packet/regions/index.ts +2 -0
- package/src/photon/balancing/packet/regions/request/index.ts +29 -0
- package/src/photon/balancing/packet/regions/response/index.ts +60 -0
- package/src/photon/balancing/packet/reply/index.ts +59 -0
- package/src/photon/balancing/packet/rpc/index.ts +2 -0
- package/src/photon/balancing/packet/rpc/request/index.ts +54 -0
- package/src/photon/balancing/packet/rpc/response/index.ts +88 -0
- package/src/photon/balancing/packet/settings/index.ts +2 -0
- package/src/photon/balancing/packet/settings/request/index.ts +29 -0
- package/src/photon/balancing/packet/settings/response/index.ts +35 -0
- package/src/photon/balancing/packet/unknown/index.ts +71 -0
- package/src/photon/balancing/pun/code/index.ts +376 -0
- package/src/photon/balancing/pun/destroy/index.ts +2 -0
- package/src/photon/balancing/pun/destroy/object/index.ts +48 -0
- package/src/photon/balancing/pun/destroy/player/index.ts +53 -0
- package/src/photon/balancing/pun/events/index.ts +283 -0
- package/src/photon/balancing/pun/filter/index.ts +45 -0
- package/src/photon/balancing/pun/index.ts +34 -0
- package/src/photon/balancing/pun/instantiation/index.ts +213 -0
- package/src/photon/balancing/pun/keys/index.ts +78 -0
- package/src/photon/balancing/pun/master/index.ts +48 -0
- package/src/photon/balancing/pun/ownership/index.ts +4 -0
- package/src/photon/balancing/pun/ownership/request/index.ts +55 -0
- package/src/photon/balancing/pun/ownership/transfer/index.ts +55 -0
- package/src/photon/balancing/pun/ownership/update/index.ts +57 -0
- package/src/photon/balancing/pun/rpc/index.ts +180 -0
- package/src/photon/balancing/pun/serialize/batch/index.ts +143 -0
- package/src/photon/balancing/pun/serialize/index.ts +2 -0
- package/src/photon/balancing/pun/serialize/view/index.ts +96 -0
- package/src/photon/balancing/pun/view/index.ts +41 -0
- package/src/photon/balancing/role/index.ts +24 -0
- package/src/photon/balancing/travel/index.ts +103 -0
- package/src/photon/binary/adapter/index.ts +619 -0
- package/src/photon/binary/custom/index.ts +148 -0
- package/src/photon/binary/dictionary/index.ts +110 -0
- package/src/photon/binary/disconnect/index.ts +51 -0
- package/src/photon/binary/event/index.ts +48 -0
- package/src/photon/binary/factory/index.ts +23 -0
- package/src/photon/binary/hashtable/index.ts +83 -0
- package/src/photon/binary/index.ts +25 -0
- package/src/photon/binary/kind/index.ts +104 -0
- package/src/photon/binary/parameters/index.ts +119 -0
- package/src/photon/binary/protocol/index.ts +122 -0
- package/src/photon/binary/request/index.ts +38 -0
- package/src/photon/binary/response/index.ts +92 -0
- package/src/photon/binary/shape/index.ts +260 -0
- package/src/photon/binary/v16/index.ts +834 -0
- package/src/photon/binary/v18/index.ts +1428 -0
- package/src/photon/binary/value/index.ts +414 -0
- package/src/photon/client/bot/index.ts +662 -0
- package/src/photon/client/connection/index.ts +420 -0
- package/src/photon/client/endpoint/index.ts +87 -0
- package/src/photon/client/failure/index.ts +37 -0
- package/src/photon/client/index.ts +5 -0
- package/src/photon/client/options/index.ts +78 -0
- package/src/photon/cluster/back/index.ts +186 -0
- package/src/photon/cluster/carriage/index.ts +334 -0
- package/src/photon/cluster/directory/index.ts +103 -0
- package/src/photon/cluster/dresser/index.ts +83 -0
- package/src/photon/cluster/feed/index.ts +267 -0
- package/src/photon/cluster/front/index.ts +205 -0
- package/src/photon/cluster/grid/index.ts +429 -0
- package/src/photon/cluster/hub/index.ts +434 -0
- package/src/photon/cluster/index.ts +18 -0
- package/src/photon/cluster/mover/index.ts +173 -0
- package/src/photon/cluster/parcel/index.ts +158 -0
- package/src/photon/cluster/pooled/index.ts +66 -0
- package/src/photon/cluster/press/index.ts +96 -0
- package/src/photon/cluster/route/game/index.ts +95 -0
- package/src/photon/cluster/route/index.ts +3 -0
- package/src/photon/cluster/route/master/index.ts +235 -0
- package/src/photon/cluster/route/name/index.ts +176 -0
- package/src/photon/cluster/seat/game/index.ts +113 -0
- package/src/photon/cluster/seat/index.ts +2 -0
- package/src/photon/cluster/seat/master/index.ts +97 -0
- package/src/photon/cluster/seed/index.ts +190 -0
- package/src/photon/cluster/sessions/index.ts +136 -0
- package/src/photon/cluster/spread/index.ts +236 -0
- package/src/photon/cluster/value/index.ts +46 -0
- package/src/photon/crypto/code/index.ts +149 -0
- package/src/photon/crypto/connection/index.ts +127 -0
- package/src/photon/crypto/data/index.ts +214 -0
- package/src/photon/crypto/datagram/index.ts +119 -0
- package/src/photon/crypto/error/index.ts +29 -0
- package/src/photon/crypto/exchange/index.ts +187 -0
- package/src/photon/crypto/index.ts +31 -0
- package/src/photon/crypto/init/binary/index.ts +249 -0
- package/src/photon/crypto/init/http/index.ts +222 -0
- package/src/photon/crypto/init/index.ts +6 -0
- package/src/photon/crypto/init/query/index.ts +85 -0
- package/src/photon/crypto/init/socket/index.ts +82 -0
- package/src/photon/crypto/method/index.ts +20 -0
- package/src/photon/crypto/mode/index.ts +35 -0
- package/src/photon/crypto/once/gate/index.ts +60 -0
- package/src/photon/crypto/once/index.ts +4 -0
- package/src/photon/crypto/once/reply/index.ts +96 -0
- package/src/photon/crypto/once/request/index.ts +14 -0
- package/src/photon/crypto/payload/index.ts +189 -0
- package/src/photon/crypto/protocol/index.ts +30 -0
- package/src/photon/crypto/refusal/index.ts +118 -0
- package/src/photon/crypto/sequence/index.ts +97 -0
- package/src/photon/crypto/token/authority/index.ts +158 -0
- package/src/photon/crypto/token/codec/index.ts +18 -0
- package/src/photon/crypto/token/index.ts +5 -0
- package/src/photon/crypto/token/record/index.ts +116 -0
- package/src/photon/crypto/token/sealed/index.ts +285 -0
- package/src/photon/crypto/token/verdict/index.ts +43 -0
- package/src/photon/enet/client/index.ts +204 -0
- package/src/photon/enet/closure/index.ts +90 -0
- package/src/photon/enet/command/index.ts +301 -0
- package/src/photon/enet/datagram/index.ts +289 -0
- package/src/photon/enet/flight/index.ts +93 -0
- package/src/photon/enet/gateway/index.ts +311 -0
- package/src/photon/enet/handler/index.ts +65 -0
- package/src/photon/enet/index.ts +21 -0
- package/src/photon/enet/lane/index.ts +403 -0
- package/src/photon/enet/link/index.ts +200 -0
- package/src/photon/enet/options/index.ts +283 -0
- package/src/photon/enet/peer/index.ts +1527 -0
- package/src/photon/enet/server/index.ts +107 -0
- package/src/photon/enet/transport/index.ts +83 -0
- package/src/photon/enet/window/index.ts +48 -0
- package/src/photon/envelope/index.ts +83 -0
- package/src/photon/family/index.ts +41 -0
- package/src/photon/frame/index.ts +88 -0
- package/src/photon/game/actor/index.ts +117 -0
- package/src/photon/game/authenticator/index.ts +139 -0
- package/src/photon/game/bag/index.ts +169 -0
- package/src/photon/game/cache/index.ts +456 -0
- package/src/photon/game/clock/index.ts +137 -0
- package/src/photon/game/compare/index.ts +162 -0
- package/src/photon/game/entry/index.ts +334 -0
- package/src/photon/game/fault/index.ts +77 -0
- package/src/photon/game/gate/index.ts +177 -0
- package/src/photon/game/groups/index.ts +115 -0
- package/src/photon/game/guard/index.ts +54 -0
- package/src/photon/game/handler/index.ts +458 -0
- package/src/photon/game/hooked/index.ts +873 -0
- package/src/photon/game/index.ts +41 -0
- package/src/photon/game/peer/index.ts +186 -0
- package/src/photon/game/report/index.ts +120 -0
- package/src/photon/game/room/index.ts +2271 -0
- package/src/photon/game/rooms/index.ts +149 -0
- package/src/photon/game/server/index.ts +503 -0
- package/src/photon/game/settings/index.ts +341 -0
- package/src/photon/game/shared/index.ts +54 -0
- package/src/photon/game/snapshot/index.ts +124 -0
- package/src/photon/game/stage/index.ts +74 -0
- package/src/photon/game/touch/index.ts +43 -0
- package/src/photon/game/wellknown/index.ts +353 -0
- package/src/photon/hooks/index.ts +9 -0
- package/src/photon/hooks/reason/index.ts +129 -0
- package/src/photon/hooks/reply/index.ts +239 -0
- package/src/photon/hooks/request/index.ts +383 -0
- package/src/photon/hooks/sender/index.ts +268 -0
- package/src/photon/hooks/settings/index.ts +383 -0
- package/src/photon/hooks/state/index.ts +545 -0
- package/src/photon/index.ts +31 -0
- package/src/photon/master/application/index.ts +446 -0
- package/src/photon/master/balancer/index.ts +170 -0
- package/src/photon/master/context/index.ts +127 -0
- package/src/photon/master/equality/index.ts +104 -0
- package/src/photon/master/fault/index.ts +86 -0
- package/src/photon/master/game/index.ts +847 -0
- package/src/photon/master/gate/index.ts +243 -0
- package/src/photon/master/handler/index.ts +1103 -0
- package/src/photon/master/index.ts +20 -0
- package/src/photon/master/list/channel/index.ts +417 -0
- package/src/photon/master/list/games/index.ts +419 -0
- package/src/photon/master/list/index.ts +6 -0
- package/src/photon/master/list/limited/index.ts +103 -0
- package/src/photon/master/list/plain/index.ts +47 -0
- package/src/photon/master/list/silent/index.ts +45 -0
- package/src/photon/master/list/sql/index.ts +280 -0
- package/src/photon/master/lobbies/index.ts +85 -0
- package/src/photon/master/lobby/index.ts +572 -0
- package/src/photon/master/peer/index.ts +168 -0
- package/src/photon/master/players/index.ts +177 -0
- package/src/photon/master/redirect/index.ts +90 -0
- package/src/photon/master/rpc/index.ts +2 -0
- package/src/photon/master/server/index.ts +212 -0
- package/src/photon/master/settings/index.ts +515 -0
- package/src/photon/master/sql/error/index.ts +92 -0
- package/src/photon/master/sql/host/index.ts +153 -0
- package/src/photon/master/sql/index.ts +9 -0
- package/src/photon/master/sql/relay/index.ts +141 -0
- package/src/photon/master/sql/remote/index.ts +257 -0
- package/src/photon/master/sql/store/index.ts +37 -0
- package/src/photon/master/sql/table/index.ts +219 -0
- package/src/photon/master/sql/value/index.ts +93 -0
- package/src/photon/master/sql/watch/index.ts +80 -0
- package/src/photon/master/sql/wire/index.ts +98 -0
- package/src/photon/master/stats/app/index.ts +122 -0
- package/src/photon/master/stats/index.ts +2 -0
- package/src/photon/master/stats/lobby/index.ts +180 -0
- package/src/photon/master/wellknown/index.ts +220 -0
- package/src/photon/message/binary/index.ts +289 -0
- package/src/photon/message/client/index.ts +110 -0
- package/src/photon/message/dialect/index.ts +61 -0
- package/src/photon/message/format/index.ts +21 -0
- package/src/photon/message/handler/index.ts +176 -0
- package/src/photon/message/index.ts +23 -0
- package/src/photon/message/init/classic/index.ts +204 -0
- package/src/photon/message/init/form/index.ts +29 -0
- package/src/photon/message/init/index.ts +6 -0
- package/src/photon/message/init/request/index.ts +388 -0
- package/src/photon/message/internal/index.ts +203 -0
- package/src/photon/message/json/format/index.ts +129 -0
- package/src/photon/message/json/index.ts +3 -0
- package/src/photon/message/json/keys/index.ts +44 -0
- package/src/photon/message/json/values/index.ts +323 -0
- package/src/photon/message/once/index.ts +69 -0
- package/src/photon/message/peer/index.ts +276 -0
- package/src/photon/message/pipeline/index.ts +350 -0
- package/src/photon/message/server/index.ts +208 -0
- package/src/photon/message/type/index.ts +59 -0
- package/src/photon/message/watch/index.ts +30 -0
- package/src/photon/message/wire/index.ts +215 -0
- package/src/photon/name/config/index.ts +133 -0
- package/src/photon/name/handler/index.ts +816 -0
- package/src/photon/name/index.ts +12 -0
- package/src/photon/name/node/index.ts +181 -0
- package/src/photon/name/peer/index.ts +23 -0
- package/src/photon/name/regions/index.ts +110 -0
- package/src/photon/name/server/index.ts +207 -0
- package/src/photon/registry/index.ts +244 -0
- package/src/photon/rpc/fault/index.ts +60 -0
- package/src/photon/rpc/http/index.ts +508 -0
- package/src/photon/rpc/index.ts +10 -0
- package/src/photon/rpc/meter/index.ts +47 -0
- package/src/photon/rpc/relay/index.ts +112 -0
- package/src/photon/rpc/service/index.ts +67 -0
- package/src/photon/seal/index.ts +17 -0
- package/src/photon/server/config/index.ts +241 -0
- package/src/photon/server/gatekeeper/index.ts +99 -0
- package/src/photon/server/host/index.ts +581 -0
- package/src/photon/server/index.ts +5 -0
- package/src/photon/server/listeners/index.ts +250 -0
- package/src/photon/server/ports/index.ts +156 -0
- package/src/photon/tcp/client/index.ts +64 -0
- package/src/photon/tcp/clock/index.ts +12 -0
- package/src/photon/tcp/codec/index.ts +174 -0
- package/src/photon/tcp/framing/index.ts +131 -0
- package/src/photon/tcp/index.ts +8 -0
- package/src/photon/tcp/ping/index.ts +43 -0
- package/src/photon/tcp/pong/index.ts +53 -0
- package/src/photon/tcp/server/index.ts +81 -0
- package/src/photon/timers/index.ts +68 -0
- package/src/photon/websocket/binary/index.ts +71 -0
- package/src/photon/websocket/bridge/index.ts +301 -0
- package/src/photon/websocket/framing/index.ts +45 -0
- package/src/photon/websocket/index.ts +14 -0
- package/src/photon/websocket/json/index.ts +49 -0
- package/src/photon/websocket/message/index.ts +176 -0
- package/src/photon/websocket/negotiation/index.ts +99 -0
- package/src/photon/websocket/path/index.ts +52 -0
- package/src/photon/websocket/plain/index.ts +25 -0
- package/src/photon/websocket/query/index.ts +99 -0
- package/src/photon/websocket/reassembly/index.ts +75 -0
- package/src/photon/websocket/subprotocol/index.ts +24 -0
- package/src/photon/websocket/text/index.ts +80 -0
- package/src/protocol/index.ts +61 -0
- package/src/scale/batch/index.ts +210 -0
- package/src/scale/courier/index.ts +726 -0
- package/src/scale/datagram/index.ts +337 -0
- package/src/scale/fanout/index.ts +654 -0
- package/src/scale/handoff/index.ts +271 -0
- package/src/scale/hosted/index.ts +68 -0
- package/src/scale/index.ts +41 -0
- package/src/scale/layout/index.ts +29 -0
- package/src/scale/mesh/index.ts +211 -0
- package/src/scale/outlet/index.ts +121 -0
- package/src/scale/pending/index.ts +165 -0
- package/src/scale/placement/index.ts +89 -0
- package/src/scale/portable/index.ts +42 -0
- package/src/scale/relay/index.ts +136 -0
- package/src/scale/sink/index.ts +51 -0
- package/src/scale/switchboard/index.ts +91 -0
- package/src/scale/transport/index.ts +112 -0
- package/src/scale/tunnel/index.ts +743 -0
- package/src/smartfox/index.ts +2 -0
- package/src/smartfox/pro/bans/index.ts +3 -0
- package/src/smartfox/pro/bans/list/index.ts +101 -0
- package/src/smartfox/pro/bans/memory/index.ts +57 -0
- package/src/smartfox/pro/bans/store/index.ts +43 -0
- package/src/smartfox/pro/bluebox/gateway/index.ts +310 -0
- package/src/smartfox/pro/bluebox/index.ts +4 -0
- package/src/smartfox/pro/bluebox/session/index.ts +63 -0
- package/src/smartfox/pro/bluebox/transport/index.ts +104 -0
- package/src/smartfox/pro/buddies/index.ts +4 -0
- package/src/smartfox/pro/buddies/memory/index.ts +38 -0
- package/src/smartfox/pro/buddies/roster/index.ts +411 -0
- package/src/smartfox/pro/buddies/store/index.ts +37 -0
- package/src/smartfox/pro/buddy/index.ts +65 -0
- package/src/smartfox/pro/catalogue/index.ts +141 -0
- package/src/smartfox/pro/claims/index.ts +110 -0
- package/src/smartfox/pro/codec/index.ts +87 -0
- package/src/smartfox/pro/counters/index.ts +3 -0
- package/src/smartfox/pro/counters/memory/index.ts +90 -0
- package/src/smartfox/pro/counters/offender/index.ts +47 -0
- package/src/smartfox/pro/counters/store/index.ts +17 -0
- package/src/smartfox/pro/entity/index.ts +111 -0
- package/src/smartfox/pro/escalation/index.ts +194 -0
- package/src/smartfox/pro/filter/index.ts +226 -0
- package/src/smartfox/pro/flood/index.ts +190 -0
- package/src/smartfox/pro/format/buddy/add/index.ts +2 -0
- package/src/smartfox/pro/format/buddy/add/notice/index.ts +44 -0
- package/src/smartfox/pro/format/buddy/add/request/index.ts +37 -0
- package/src/smartfox/pro/format/buddy/block/index.ts +44 -0
- package/src/smartfox/pro/format/buddy/clear/index.ts +37 -0
- package/src/smartfox/pro/format/buddy/index.ts +13 -0
- package/src/smartfox/pro/format/buddy/list/index.ts +59 -0
- package/src/smartfox/pro/format/buddy/load/index.ts +37 -0
- package/src/smartfox/pro/format/buddy/permission/index.ts +2 -0
- package/src/smartfox/pro/format/buddy/permission/notice/index.ts +43 -0
- package/src/smartfox/pro/format/buddy/permission/request/index.ts +48 -0
- package/src/smartfox/pro/format/buddy/remove/index.ts +2 -0
- package/src/smartfox/pro/format/buddy/remove/notice/index.ts +37 -0
- package/src/smartfox/pro/format/buddy/remove/request/index.ts +37 -0
- package/src/smartfox/pro/format/buddy/room/index.ts +2 -0
- package/src/smartfox/pro/format/buddy/room/reply/index.ts +50 -0
- package/src/smartfox/pro/format/buddy/room/request/index.ts +37 -0
- package/src/smartfox/pro/format/buddy/update/index.ts +54 -0
- package/src/smartfox/pro/format/buddy/variables/index.ts +48 -0
- package/src/smartfox/pro/format/chat/admin/index.ts +48 -0
- package/src/smartfox/pro/format/chat/index.ts +13 -0
- package/src/smartfox/pro/format/chat/moderator/index.ts +2 -0
- package/src/smartfox/pro/format/chat/moderator/message/index.ts +48 -0
- package/src/smartfox/pro/format/chat/moderator/request/index.ts +52 -0
- package/src/smartfox/pro/format/chat/private/index.ts +2 -0
- package/src/smartfox/pro/format/chat/private/message/index.ts +48 -0
- package/src/smartfox/pro/format/chat/private/request/index.ts +49 -0
- package/src/smartfox/pro/format/chat/public/index.ts +2 -0
- package/src/smartfox/pro/format/chat/public/message/index.ts +48 -0
- package/src/smartfox/pro/format/chat/public/request/index.ts +40 -0
- package/src/smartfox/pro/format/create/added/index.ts +76 -0
- package/src/smartfox/pro/format/create/deleted/index.ts +37 -0
- package/src/smartfox/pro/format/create/index.ts +4 -0
- package/src/smartfox/pro/format/create/refused/index.ts +37 -0
- package/src/smartfox/pro/format/create/request/index.ts +95 -0
- package/src/smartfox/pro/format/data/group/index.ts +62 -0
- package/src/smartfox/pro/format/data/index.ts +3 -0
- package/src/smartfox/pro/format/data/message/index.ts +54 -0
- package/src/smartfox/pro/format/data/request/index.ts +46 -0
- package/src/smartfox/pro/format/entry/buddy/index.ts +62 -0
- package/src/smartfox/pro/format/entry/index.ts +5 -0
- package/src/smartfox/pro/format/entry/object/index.ts +171 -0
- package/src/smartfox/pro/format/entry/room/index.ts +70 -0
- package/src/smartfox/pro/format/entry/user/index.ts +60 -0
- package/src/smartfox/pro/format/entry/variables/index.ts +148 -0
- package/src/smartfox/pro/format/extension/index.ts +3 -0
- package/src/smartfox/pro/format/extension/json/index.ts +99 -0
- package/src/smartfox/pro/format/extension/object/index.ts +95 -0
- package/src/smartfox/pro/format/extension/raw/index.ts +139 -0
- package/src/smartfox/pro/format/index.ts +86 -0
- package/src/smartfox/pro/format/join/accepted/index.ts +72 -0
- package/src/smartfox/pro/format/join/index.ts +3 -0
- package/src/smartfox/pro/format/join/refused/index.ts +37 -0
- package/src/smartfox/pro/format/join/request/index.ts +54 -0
- package/src/smartfox/pro/format/key/index.ts +2 -0
- package/src/smartfox/pro/format/key/reply/index.ts +37 -0
- package/src/smartfox/pro/format/key/request/index.ts +37 -0
- package/src/smartfox/pro/format/leave/index.ts +2 -0
- package/src/smartfox/pro/format/leave/notice/index.ts +41 -0
- package/src/smartfox/pro/format/leave/request/index.ts +41 -0
- package/src/smartfox/pro/format/login/accepted/index.ts +49 -0
- package/src/smartfox/pro/format/login/index.ts +3 -0
- package/src/smartfox/pro/format/login/refused/index.ts +37 -0
- package/src/smartfox/pro/format/login/request/index.ts +53 -0
- package/src/smartfox/pro/format/logout/index.ts +2 -0
- package/src/smartfox/pro/format/logout/notice/index.ts +37 -0
- package/src/smartfox/pro/format/logout/request/index.ts +37 -0
- package/src/smartfox/pro/format/ping/index.ts +2 -0
- package/src/smartfox/pro/format/ping/reply/index.ts +37 -0
- package/src/smartfox/pro/format/ping/request/index.ts +37 -0
- package/src/smartfox/pro/format/presence/count/index.ts +44 -0
- package/src/smartfox/pro/format/presence/entered/index.ts +47 -0
- package/src/smartfox/pro/format/presence/index.ts +3 -0
- package/src/smartfox/pro/format/presence/left/index.ts +44 -0
- package/src/smartfox/pro/format/rooms/auto/index.ts +37 -0
- package/src/smartfox/pro/format/rooms/index.ts +3 -0
- package/src/smartfox/pro/format/rooms/list/index.ts +54 -0
- package/src/smartfox/pro/format/rooms/request/index.ts +37 -0
- package/src/smartfox/pro/format/seat/index.ts +8 -0
- package/src/smartfox/pro/format/seat/player/index.ts +2 -0
- package/src/smartfox/pro/format/seat/player/notice/index.ts +49 -0
- package/src/smartfox/pro/format/seat/player/request/index.ts +37 -0
- package/src/smartfox/pro/format/seat/spectator/index.ts +2 -0
- package/src/smartfox/pro/format/seat/spectator/notice/index.ts +49 -0
- package/src/smartfox/pro/format/seat/spectator/request/index.ts +38 -0
- package/src/smartfox/pro/format/system/index.ts +19 -0
- package/src/smartfox/pro/format/variables/index.ts +8 -0
- package/src/smartfox/pro/format/variables/room/index.ts +2 -0
- package/src/smartfox/pro/format/variables/room/request/index.ts +50 -0
- package/src/smartfox/pro/format/variables/room/update/index.ts +52 -0
- package/src/smartfox/pro/format/variables/user/index.ts +2 -0
- package/src/smartfox/pro/format/variables/user/request/index.ts +47 -0
- package/src/smartfox/pro/format/variables/user/update/index.ts +52 -0
- package/src/smartfox/pro/format/version/accepted/index.ts +37 -0
- package/src/smartfox/pro/format/version/index.ts +3 -0
- package/src/smartfox/pro/format/version/refused/index.ts +37 -0
- package/src/smartfox/pro/format/version/request/index.ts +37 -0
- package/src/smartfox/pro/handler/buddy/index.ts +138 -0
- package/src/smartfox/pro/handler/chat/index.ts +221 -0
- package/src/smartfox/pro/handler/index.ts +7 -0
- package/src/smartfox/pro/handler/login/index.ts +175 -0
- package/src/smartfox/pro/handler/room/index.ts +121 -0
- package/src/smartfox/pro/handler/seat/index.ts +75 -0
- package/src/smartfox/pro/handler/shared/index.ts +29 -0
- package/src/smartfox/pro/handler/variable/index.ts +77 -0
- package/src/smartfox/pro/index.ts +60 -0
- package/src/smartfox/pro/login/attempt/index.ts +83 -0
- package/src/smartfox/pro/login/authenticator/index.ts +9 -0
- package/src/smartfox/pro/login/index.ts +3 -0
- package/src/smartfox/pro/login/verdict/index.ts +48 -0
- package/src/smartfox/pro/messages/index.ts +136 -0
- package/src/smartfox/pro/object/index.ts +12 -0
- package/src/smartfox/pro/options/index.ts +189 -0
- package/src/smartfox/pro/packet/buddy/add/index.ts +2 -0
- package/src/smartfox/pro/packet/buddy/add/notice/index.ts +27 -0
- package/src/smartfox/pro/packet/buddy/add/request/index.ts +25 -0
- package/src/smartfox/pro/packet/buddy/block/index.ts +33 -0
- package/src/smartfox/pro/packet/buddy/clear/index.ts +25 -0
- package/src/smartfox/pro/packet/buddy/index.ts +10 -0
- package/src/smartfox/pro/packet/buddy/list/index.ts +41 -0
- package/src/smartfox/pro/packet/buddy/load/index.ts +25 -0
- package/src/smartfox/pro/packet/buddy/permission/index.ts +2 -0
- package/src/smartfox/pro/packet/buddy/permission/notice/index.ts +33 -0
- package/src/smartfox/pro/packet/buddy/permission/request/index.ts +33 -0
- package/src/smartfox/pro/packet/buddy/remove/index.ts +2 -0
- package/src/smartfox/pro/packet/buddy/remove/notice/index.ts +25 -0
- package/src/smartfox/pro/packet/buddy/remove/request/index.ts +25 -0
- package/src/smartfox/pro/packet/buddy/room/index.ts +2 -0
- package/src/smartfox/pro/packet/buddy/room/reply/index.ts +25 -0
- package/src/smartfox/pro/packet/buddy/room/request/index.ts +25 -0
- package/src/smartfox/pro/packet/buddy/update/index.ts +35 -0
- package/src/smartfox/pro/packet/buddy/variables/index.ts +27 -0
- package/src/smartfox/pro/packet/chat/admin/index.ts +41 -0
- package/src/smartfox/pro/packet/chat/index.ts +5 -0
- package/src/smartfox/pro/packet/chat/moderator/index.ts +3 -0
- package/src/smartfox/pro/packet/chat/moderator/message/index.ts +41 -0
- package/src/smartfox/pro/packet/chat/moderator/request/index.ts +64 -0
- package/src/smartfox/pro/packet/chat/private/index.ts +2 -0
- package/src/smartfox/pro/packet/chat/private/message/index.ts +41 -0
- package/src/smartfox/pro/packet/chat/private/request/index.ts +45 -0
- package/src/smartfox/pro/packet/chat/public/index.ts +2 -0
- package/src/smartfox/pro/packet/chat/public/message/index.ts +41 -0
- package/src/smartfox/pro/packet/chat/public/request/index.ts +33 -0
- package/src/smartfox/pro/packet/create/added/index.ts +27 -0
- package/src/smartfox/pro/packet/create/deleted/index.ts +25 -0
- package/src/smartfox/pro/packet/create/index.ts +5 -0
- package/src/smartfox/pro/packet/create/refused/index.ts +25 -0
- package/src/smartfox/pro/packet/create/request/index.ts +105 -0
- package/src/smartfox/pro/packet/data/group/index.ts +51 -0
- package/src/smartfox/pro/packet/data/index.ts +3 -0
- package/src/smartfox/pro/packet/data/message/index.ts +43 -0
- package/src/smartfox/pro/packet/data/request/index.ts +35 -0
- package/src/smartfox/pro/packet/extension/index.ts +3 -0
- package/src/smartfox/pro/packet/extension/json/index.ts +2 -0
- package/src/smartfox/pro/packet/extension/json/reply/index.ts +33 -0
- package/src/smartfox/pro/packet/extension/json/request/index.ts +66 -0
- package/src/smartfox/pro/packet/extension/object/index.ts +2 -0
- package/src/smartfox/pro/packet/extension/object/reply/index.ts +35 -0
- package/src/smartfox/pro/packet/extension/object/request/index.ts +68 -0
- package/src/smartfox/pro/packet/extension/raw/index.ts +2 -0
- package/src/smartfox/pro/packet/extension/raw/reply/index.ts +25 -0
- package/src/smartfox/pro/packet/extension/raw/request/index.ts +66 -0
- package/src/smartfox/pro/packet/frame/index.ts +2 -0
- package/src/smartfox/pro/packet/frame/policy/file/index.ts +25 -0
- package/src/smartfox/pro/packet/frame/policy/index.ts +2 -0
- package/src/smartfox/pro/packet/frame/policy/request/index.ts +25 -0
- package/src/smartfox/pro/packet/frame/unknown/index.ts +25 -0
- package/src/smartfox/pro/packet/index.ts +72 -0
- package/src/smartfox/pro/packet/join/accepted/index.ts +74 -0
- package/src/smartfox/pro/packet/join/index.ts +3 -0
- package/src/smartfox/pro/packet/join/refused/index.ts +25 -0
- package/src/smartfox/pro/packet/join/request/index.ts +79 -0
- package/src/smartfox/pro/packet/key/index.ts +2 -0
- package/src/smartfox/pro/packet/key/reply/index.ts +25 -0
- package/src/smartfox/pro/packet/key/request/index.ts +25 -0
- package/src/smartfox/pro/packet/leave/index.ts +2 -0
- package/src/smartfox/pro/packet/leave/notice/index.ts +25 -0
- package/src/smartfox/pro/packet/leave/request/index.ts +25 -0
- package/src/smartfox/pro/packet/login/accepted/index.ts +45 -0
- package/src/smartfox/pro/packet/login/index.ts +3 -0
- package/src/smartfox/pro/packet/login/refused/index.ts +25 -0
- package/src/smartfox/pro/packet/login/request/index.ts +41 -0
- package/src/smartfox/pro/packet/logout/index.ts +2 -0
- package/src/smartfox/pro/packet/logout/notice/index.ts +25 -0
- package/src/smartfox/pro/packet/logout/request/index.ts +25 -0
- package/src/smartfox/pro/packet/ping/index.ts +2 -0
- package/src/smartfox/pro/packet/ping/reply/index.ts +25 -0
- package/src/smartfox/pro/packet/ping/request/index.ts +25 -0
- package/src/smartfox/pro/packet/presence/count/index.ts +41 -0
- package/src/smartfox/pro/packet/presence/entered/index.ts +35 -0
- package/src/smartfox/pro/packet/presence/index.ts +3 -0
- package/src/smartfox/pro/packet/presence/left/index.ts +33 -0
- package/src/smartfox/pro/packet/rooms/auto/index.ts +25 -0
- package/src/smartfox/pro/packet/rooms/index.ts +3 -0
- package/src/smartfox/pro/packet/rooms/list/index.ts +27 -0
- package/src/smartfox/pro/packet/rooms/request/index.ts +25 -0
- package/src/smartfox/pro/packet/seat/index.ts +2 -0
- package/src/smartfox/pro/packet/seat/player/index.ts +2 -0
- package/src/smartfox/pro/packet/seat/player/notice/index.ts +45 -0
- package/src/smartfox/pro/packet/seat/player/request/index.ts +25 -0
- package/src/smartfox/pro/packet/seat/spectator/index.ts +2 -0
- package/src/smartfox/pro/packet/seat/spectator/notice/index.ts +45 -0
- package/src/smartfox/pro/packet/seat/spectator/request/index.ts +25 -0
- package/src/smartfox/pro/packet/variables/index.ts +2 -0
- package/src/smartfox/pro/packet/variables/room/index.ts +2 -0
- package/src/smartfox/pro/packet/variables/room/request/index.ts +51 -0
- package/src/smartfox/pro/packet/variables/room/update/index.ts +47 -0
- package/src/smartfox/pro/packet/variables/user/index.ts +2 -0
- package/src/smartfox/pro/packet/variables/user/request/index.ts +35 -0
- package/src/smartfox/pro/packet/variables/user/update/index.ts +47 -0
- package/src/smartfox/pro/packet/version/accepted/index.ts +25 -0
- package/src/smartfox/pro/packet/version/index.ts +3 -0
- package/src/smartfox/pro/packet/version/refused/index.ts +25 -0
- package/src/smartfox/pro/packet/version/request/index.ts +25 -0
- package/src/smartfox/pro/penalty/index.ts +65 -0
- package/src/smartfox/pro/protocol/index.ts +395 -0
- package/src/smartfox/pro/room/index.ts +155 -0
- package/src/smartfox/pro/route/index.ts +25 -0
- package/src/smartfox/pro/sequence/index.ts +35 -0
- package/src/smartfox/pro/user/index.ts +80 -0
- package/src/smartfox/pro/variable/index.ts +34 -0
- package/src/smartfox/pro/web/index.ts +155 -0
- package/src/smartfox/pro/xml/index.ts +2 -0
- package/src/smartfox/pro/xml/reader/index.ts +228 -0
- package/src/smartfox/pro/xml/templates/index.ts +169 -0
- package/src/smartfox/pro/xml/writer/index.ts +147 -0
- package/src/smartfox/pro/zone/index.ts +874 -0
- package/src/smartfox/pro/zones/index.ts +324 -0
- package/src/smartfox/x2/balancer/index.ts +193 -0
- package/src/smartfox/x2/ban/index.ts +4 -0
- package/src/smartfox/x2/ban/list/index.ts +136 -0
- package/src/smartfox/x2/ban/memory/index.ts +71 -0
- package/src/smartfox/x2/ban/record/index.ts +36 -0
- package/src/smartfox/x2/ban/store/index.ts +28 -0
- package/src/smartfox/x2/bluebox/gateway/index.ts +315 -0
- package/src/smartfox/x2/bluebox/index.ts +4 -0
- package/src/smartfox/x2/bluebox/session/index.ts +63 -0
- package/src/smartfox/x2/bluebox/transport/index.ts +125 -0
- package/src/smartfox/x2/buddies/index.ts +608 -0
- package/src/smartfox/x2/catalogue/index.ts +23 -0
- package/src/smartfox/x2/catalogue/requests/index.ts +91 -0
- package/src/smartfox/x2/catalogue/responses/index.ts +93 -0
- package/src/smartfox/x2/chat/index.ts +383 -0
- package/src/smartfox/x2/cipher/index.ts +88 -0
- package/src/smartfox/x2/codec/index.ts +201 -0
- package/src/smartfox/x2/config/index.ts +383 -0
- package/src/smartfox/x2/data/array/index.ts +467 -0
- package/src/smartfox/x2/data/entry/index.ts +35 -0
- package/src/smartfox/x2/data/index.ts +6 -0
- package/src/smartfox/x2/data/object/index.ts +597 -0
- package/src/smartfox/x2/data/serializer/index.ts +393 -0
- package/src/smartfox/x2/data/type/index.ts +94 -0
- package/src/smartfox/x2/entity/buddy/index.ts +114 -0
- package/src/smartfox/x2/entity/index.ts +38 -0
- package/src/smartfox/x2/entity/invitation/index.ts +90 -0
- package/src/smartfox/x2/entity/item/index.ts +74 -0
- package/src/smartfox/x2/entity/match/index.ts +269 -0
- package/src/smartfox/x2/entity/privilege/index.ts +26 -0
- package/src/smartfox/x2/entity/room/index.ts +334 -0
- package/src/smartfox/x2/entity/settings/index.ts +239 -0
- package/src/smartfox/x2/entity/user/index.ts +118 -0
- package/src/smartfox/x2/entity/variable/buddy/index.ts +114 -0
- package/src/smartfox/x2/entity/variable/index.ts +16 -0
- package/src/smartfox/x2/entity/variable/item/index.ts +114 -0
- package/src/smartfox/x2/entity/variable/room/index.ts +153 -0
- package/src/smartfox/x2/entity/variable/type/index.ts +166 -0
- package/src/smartfox/x2/entity/variable/user/index.ts +134 -0
- package/src/smartfox/x2/entity/vector/index.ts +127 -0
- package/src/smartfox/x2/flood/gate/index.ts +78 -0
- package/src/smartfox/x2/flood/index.ts +162 -0
- package/src/smartfox/x2/flood/shared/index.ts +113 -0
- package/src/smartfox/x2/format/buddy/add/index.ts +2 -0
- package/src/smartfox/x2/format/buddy/add/request/index.ts +42 -0
- package/src/smartfox/x2/format/buddy/add/response/index.ts +55 -0
- package/src/smartfox/x2/format/buddy/block/index.ts +2 -0
- package/src/smartfox/x2/format/buddy/block/request/index.ts +45 -0
- package/src/smartfox/x2/format/buddy/block/response/index.ts +60 -0
- package/src/smartfox/x2/format/buddy/index.ts +21 -0
- package/src/smartfox/x2/format/buddy/init/index.ts +2 -0
- package/src/smartfox/x2/format/buddy/init/request/index.ts +38 -0
- package/src/smartfox/x2/format/buddy/init/response/index.ts +92 -0
- package/src/smartfox/x2/format/buddy/online/index.ts +2 -0
- package/src/smartfox/x2/format/buddy/online/request/index.ts +42 -0
- package/src/smartfox/x2/format/buddy/online/response/index.ts +61 -0
- package/src/smartfox/x2/format/buddy/remove/index.ts +2 -0
- package/src/smartfox/x2/format/buddy/remove/request/index.ts +42 -0
- package/src/smartfox/x2/format/buddy/remove/response/index.ts +51 -0
- package/src/smartfox/x2/format/buddy/variables/index.ts +2 -0
- package/src/smartfox/x2/format/buddy/variables/request/index.ts +46 -0
- package/src/smartfox/x2/format/buddy/variables/response/index.ts +58 -0
- package/src/smartfox/x2/format/cluster/connection/index.ts +1 -0
- package/src/smartfox/x2/format/cluster/connection/response/index.ts +52 -0
- package/src/smartfox/x2/format/cluster/error/index.ts +1 -0
- package/src/smartfox/x2/format/cluster/error/response/index.ts +38 -0
- package/src/smartfox/x2/format/cluster/index.ts +4 -0
- package/src/smartfox/x2/format/cluster/invite/index.ts +1 -0
- package/src/smartfox/x2/format/cluster/invite/request/index.ts +55 -0
- package/src/smartfox/x2/format/cluster/join/index.ts +1 -0
- package/src/smartfox/x2/format/cluster/join/request/index.ts +107 -0
- package/src/smartfox/x2/format/contract/index.ts +37 -0
- package/src/smartfox/x2/format/disconnect/index.ts +1 -0
- package/src/smartfox/x2/format/disconnect/request/index.ts +39 -0
- package/src/smartfox/x2/format/event/count/index.ts +49 -0
- package/src/smartfox/x2/format/event/disconnection/index.ts +48 -0
- package/src/smartfox/x2/format/event/enter/index.ts +53 -0
- package/src/smartfox/x2/format/event/exit/index.ts +45 -0
- package/src/smartfox/x2/format/event/index.ts +7 -0
- package/src/smartfox/x2/format/event/item/index.ts +51 -0
- package/src/smartfox/x2/format/event/lost/index.ts +2 -0
- package/src/smartfox/x2/format/event/lost/room/index.ts +42 -0
- package/src/smartfox/x2/format/event/lost/user/index.ts +42 -0
- package/src/smartfox/x2/format/event/reconnection/index.ts +39 -0
- package/src/smartfox/x2/format/extension/index.ts +2 -0
- package/src/smartfox/x2/format/extension/request/index.ts +49 -0
- package/src/smartfox/x2/format/extension/response/index.ts +47 -0
- package/src/smartfox/x2/format/find/index.ts +8 -0
- package/src/smartfox/x2/format/find/rooms/index.ts +2 -0
- package/src/smartfox/x2/format/find/rooms/request/index.ts +51 -0
- package/src/smartfox/x2/format/find/rooms/response/index.ts +74 -0
- package/src/smartfox/x2/format/find/users/index.ts +2 -0
- package/src/smartfox/x2/format/find/users/request/index.ts +54 -0
- package/src/smartfox/x2/format/find/users/response/index.ts +74 -0
- package/src/smartfox/x2/format/game/create/index.ts +1 -0
- package/src/smartfox/x2/format/game/create/request/index.ts +61 -0
- package/src/smartfox/x2/format/game/index.ts +14 -0
- package/src/smartfox/x2/format/game/invite/index.ts +2 -0
- package/src/smartfox/x2/format/game/invite/request/index.ts +50 -0
- package/src/smartfox/x2/format/game/invite/response/index.ts +61 -0
- package/src/smartfox/x2/format/game/join/index.ts +1 -0
- package/src/smartfox/x2/format/game/join/request/index.ts +55 -0
- package/src/smartfox/x2/format/game/quick/index.ts +2 -0
- package/src/smartfox/x2/format/game/quick/request/index.ts +56 -0
- package/src/smartfox/x2/format/game/quick/response/index.ts +48 -0
- package/src/smartfox/x2/format/game/reply/index.ts +2 -0
- package/src/smartfox/x2/format/game/reply/request/index.ts +50 -0
- package/src/smartfox/x2/format/game/reply/response/index.ts +70 -0
- package/src/smartfox/x2/format/group/index.ts +8 -0
- package/src/smartfox/x2/format/group/subscribe/index.ts +2 -0
- package/src/smartfox/x2/format/group/subscribe/request/index.ts +43 -0
- package/src/smartfox/x2/format/group/subscribe/response/index.ts +89 -0
- package/src/smartfox/x2/format/group/unsubscribe/index.ts +2 -0
- package/src/smartfox/x2/format/group/unsubscribe/request/index.ts +43 -0
- package/src/smartfox/x2/format/group/unsubscribe/response/index.ts +52 -0
- package/src/smartfox/x2/format/handshake/index.ts +2 -0
- package/src/smartfox/x2/format/handshake/request/index.ts +52 -0
- package/src/smartfox/x2/format/handshake/response/index.ts +62 -0
- package/src/smartfox/x2/format/index.ts +105 -0
- package/src/smartfox/x2/format/login/index.ts +2 -0
- package/src/smartfox/x2/format/login/request/index.ts +52 -0
- package/src/smartfox/x2/format/login/response/index.ts +99 -0
- package/src/smartfox/x2/format/logout/index.ts +2 -0
- package/src/smartfox/x2/format/logout/request/index.ts +38 -0
- package/src/smartfox/x2/format/logout/response/index.ts +42 -0
- package/src/smartfox/x2/format/message/index.ts +2 -0
- package/src/smartfox/x2/format/message/request/index.ts +126 -0
- package/src/smartfox/x2/format/message/response/index.ts +68 -0
- package/src/smartfox/x2/format/mmo/index.ts +4 -0
- package/src/smartfox/x2/format/mmo/position/index.ts +2 -0
- package/src/smartfox/x2/format/mmo/position/request/index.ts +49 -0
- package/src/smartfox/x2/format/mmo/position/response/index.ts +107 -0
- package/src/smartfox/x2/format/moderation/ban/index.ts +1 -0
- package/src/smartfox/x2/format/moderation/ban/request/index.ts +57 -0
- package/src/smartfox/x2/format/moderation/index.ts +2 -0
- package/src/smartfox/x2/format/moderation/kick/index.ts +1 -0
- package/src/smartfox/x2/format/moderation/kick/request/index.ts +48 -0
- package/src/smartfox/x2/format/ping/index.ts +2 -0
- package/src/smartfox/x2/format/ping/request/index.ts +38 -0
- package/src/smartfox/x2/format/ping/response/index.ts +38 -0
- package/src/smartfox/x2/format/room/capacity/index.ts +2 -0
- package/src/smartfox/x2/format/room/capacity/request/index.ts +50 -0
- package/src/smartfox/x2/format/room/capacity/response/index.ts +59 -0
- package/src/smartfox/x2/format/room/create/index.ts +2 -0
- package/src/smartfox/x2/format/room/create/request/index.ts +55 -0
- package/src/smartfox/x2/format/room/create/response/index.ts +55 -0
- package/src/smartfox/x2/format/room/index.ts +23 -0
- package/src/smartfox/x2/format/room/join/index.ts +2 -0
- package/src/smartfox/x2/format/room/join/request/index.ts +53 -0
- package/src/smartfox/x2/format/room/join/response/index.ts +84 -0
- package/src/smartfox/x2/format/room/leave/index.ts +1 -0
- package/src/smartfox/x2/format/room/leave/request/index.ts +42 -0
- package/src/smartfox/x2/format/room/password/index.ts +2 -0
- package/src/smartfox/x2/format/room/password/request/index.ts +46 -0
- package/src/smartfox/x2/format/room/password/response/index.ts +55 -0
- package/src/smartfox/x2/format/room/quick/index.ts +1 -0
- package/src/smartfox/x2/format/room/quick/request/index.ts +68 -0
- package/src/smartfox/x2/format/room/rename/index.ts +2 -0
- package/src/smartfox/x2/format/room/rename/request/index.ts +46 -0
- package/src/smartfox/x2/format/room/rename/response/index.ts +55 -0
- package/src/smartfox/x2/format/room/variables/index.ts +2 -0
- package/src/smartfox/x2/format/room/variables/request/index.ts +49 -0
- package/src/smartfox/x2/format/room/variables/response/index.ts +49 -0
- package/src/smartfox/x2/format/seat/index.ts +8 -0
- package/src/smartfox/x2/format/seat/player/index.ts +2 -0
- package/src/smartfox/x2/format/seat/player/request/index.ts +43 -0
- package/src/smartfox/x2/format/seat/player/response/index.ts +59 -0
- package/src/smartfox/x2/format/seat/spectator/index.ts +2 -0
- package/src/smartfox/x2/format/seat/spectator/request/index.ts +43 -0
- package/src/smartfox/x2/format/seat/spectator/response/index.ts +55 -0
- package/src/smartfox/x2/format/settings/index.ts +276 -0
- package/src/smartfox/x2/format/user/index.ts +4 -0
- package/src/smartfox/x2/format/user/variables/index.ts +2 -0
- package/src/smartfox/x2/format/user/variables/request/index.ts +46 -0
- package/src/smartfox/x2/format/user/variables/response/index.ts +49 -0
- package/src/smartfox/x2/games/index.ts +484 -0
- package/src/smartfox/x2/hall/index.ts +240 -0
- package/src/smartfox/x2/handler/buddy/index.ts +120 -0
- package/src/smartfox/x2/handler/chat/index.ts +213 -0
- package/src/smartfox/x2/handler/extension/index.ts +33 -0
- package/src/smartfox/x2/handler/game/index.ts +171 -0
- package/src/smartfox/x2/handler/index.ts +6 -0
- package/src/smartfox/x2/handler/room/index.ts +466 -0
- package/src/smartfox/x2/handler/session/index.ts +201 -0
- package/src/smartfox/x2/header/index.ts +25 -0
- package/src/smartfox/x2/index.ts +275 -0
- package/src/smartfox/x2/login/attempt/index.ts +102 -0
- package/src/smartfox/x2/login/index.ts +2 -0
- package/src/smartfox/x2/login/verdict/index.ts +81 -0
- package/src/smartfox/x2/member/index.ts +260 -0
- package/src/smartfox/x2/packet/buddy/add/index.ts +2 -0
- package/src/smartfox/x2/packet/buddy/add/request/index.ts +25 -0
- package/src/smartfox/x2/packet/buddy/add/response/index.ts +43 -0
- package/src/smartfox/x2/packet/buddy/block/index.ts +2 -0
- package/src/smartfox/x2/packet/buddy/block/request/index.ts +33 -0
- package/src/smartfox/x2/packet/buddy/block/response/index.ts +68 -0
- package/src/smartfox/x2/packet/buddy/index.ts +13 -0
- package/src/smartfox/x2/packet/buddy/init/index.ts +2 -0
- package/src/smartfox/x2/packet/buddy/init/request/index.ts +14 -0
- package/src/smartfox/x2/packet/buddy/init/response/index.ts +69 -0
- package/src/smartfox/x2/packet/buddy/online/index.ts +2 -0
- package/src/smartfox/x2/packet/buddy/online/request/index.ts +25 -0
- package/src/smartfox/x2/packet/buddy/online/response/index.ts +85 -0
- package/src/smartfox/x2/packet/buddy/remove/index.ts +2 -0
- package/src/smartfox/x2/packet/buddy/remove/request/index.ts +25 -0
- package/src/smartfox/x2/packet/buddy/remove/response/index.ts +42 -0
- package/src/smartfox/x2/packet/buddy/variables/index.ts +2 -0
- package/src/smartfox/x2/packet/buddy/variables/request/index.ts +29 -0
- package/src/smartfox/x2/packet/buddy/variables/response/index.ts +58 -0
- package/src/smartfox/x2/packet/cluster/connection/index.ts +1 -0
- package/src/smartfox/x2/packet/cluster/connection/response/index.ts +54 -0
- package/src/smartfox/x2/packet/cluster/error/index.ts +1 -0
- package/src/smartfox/x2/packet/cluster/error/response/index.ts +14 -0
- package/src/smartfox/x2/packet/cluster/index.ts +4 -0
- package/src/smartfox/x2/packet/cluster/invite/index.ts +1 -0
- package/src/smartfox/x2/packet/cluster/invite/request/index.ts +77 -0
- package/src/smartfox/x2/packet/cluster/join/index.ts +1 -0
- package/src/smartfox/x2/packet/cluster/join/request/index.ts +52 -0
- package/src/smartfox/x2/packet/disconnect/index.ts +1 -0
- package/src/smartfox/x2/packet/disconnect/request/index.ts +14 -0
- package/src/smartfox/x2/packet/error/codes/index.ts +231 -0
- package/src/smartfox/x2/packet/error/index.ts +69 -0
- package/src/smartfox/x2/packet/event/count/index.ts +45 -0
- package/src/smartfox/x2/packet/event/disconnection/index.ts +72 -0
- package/src/smartfox/x2/packet/event/enter/index.ts +47 -0
- package/src/smartfox/x2/packet/event/exit/index.ts +33 -0
- package/src/smartfox/x2/packet/event/index.ts +10 -0
- package/src/smartfox/x2/packet/event/item/index.ts +51 -0
- package/src/smartfox/x2/packet/event/lost/index.ts +2 -0
- package/src/smartfox/x2/packet/event/lost/room/index.ts +25 -0
- package/src/smartfox/x2/packet/event/lost/user/index.ts +25 -0
- package/src/smartfox/x2/packet/event/reconnection/index.ts +14 -0
- package/src/smartfox/x2/packet/extension/index.ts +2 -0
- package/src/smartfox/x2/packet/extension/request/index.ts +74 -0
- package/src/smartfox/x2/packet/extension/response/index.ts +54 -0
- package/src/smartfox/x2/packet/find/index.ts +2 -0
- package/src/smartfox/x2/packet/find/rooms/index.ts +2 -0
- package/src/smartfox/x2/packet/find/rooms/request/index.ts +51 -0
- package/src/smartfox/x2/packet/find/rooms/response/index.ts +27 -0
- package/src/smartfox/x2/packet/find/users/index.ts +2 -0
- package/src/smartfox/x2/packet/find/users/request/index.ts +89 -0
- package/src/smartfox/x2/packet/find/users/response/index.ts +27 -0
- package/src/smartfox/x2/packet/game/create/index.ts +1 -0
- package/src/smartfox/x2/packet/game/create/request/index.ts +27 -0
- package/src/smartfox/x2/packet/game/index.ts +8 -0
- package/src/smartfox/x2/packet/game/invite/index.ts +2 -0
- package/src/smartfox/x2/packet/game/invite/request/index.ts +51 -0
- package/src/smartfox/x2/packet/game/invite/response/index.ts +92 -0
- package/src/smartfox/x2/packet/game/join/index.ts +1 -0
- package/src/smartfox/x2/packet/game/join/request/index.ts +77 -0
- package/src/smartfox/x2/packet/game/quick/index.ts +2 -0
- package/src/smartfox/x2/packet/game/quick/request/index.ts +89 -0
- package/src/smartfox/x2/packet/game/quick/response/index.ts +34 -0
- package/src/smartfox/x2/packet/game/reply/index.ts +2 -0
- package/src/smartfox/x2/packet/game/reply/request/index.ts +51 -0
- package/src/smartfox/x2/packet/game/reply/response/index.ts +91 -0
- package/src/smartfox/x2/packet/group/index.ts +8 -0
- package/src/smartfox/x2/packet/group/subscribe/index.ts +2 -0
- package/src/smartfox/x2/packet/group/subscribe/request/index.ts +25 -0
- package/src/smartfox/x2/packet/group/subscribe/response/index.ts +58 -0
- package/src/smartfox/x2/packet/group/unsubscribe/index.ts +2 -0
- package/src/smartfox/x2/packet/group/unsubscribe/request/index.ts +25 -0
- package/src/smartfox/x2/packet/group/unsubscribe/response/index.ts +42 -0
- package/src/smartfox/x2/packet/handshake/index.ts +2 -0
- package/src/smartfox/x2/packet/handshake/request/index.ts +49 -0
- package/src/smartfox/x2/packet/handshake/response/index.ts +83 -0
- package/src/smartfox/x2/packet/index.ts +99 -0
- package/src/smartfox/x2/packet/login/index.ts +2 -0
- package/src/smartfox/x2/packet/login/request/index.ts +95 -0
- package/src/smartfox/x2/packet/login/response/index.ts +131 -0
- package/src/smartfox/x2/packet/logout/index.ts +2 -0
- package/src/smartfox/x2/packet/logout/request/index.ts +14 -0
- package/src/smartfox/x2/packet/logout/response/index.ts +25 -0
- package/src/smartfox/x2/packet/message/index.ts +4 -0
- package/src/smartfox/x2/packet/message/request/index.ts +241 -0
- package/src/smartfox/x2/packet/message/response/index.ts +216 -0
- package/src/smartfox/x2/packet/message/type/index.ts +56 -0
- package/src/smartfox/x2/packet/mmo/index.ts +5 -0
- package/src/smartfox/x2/packet/mmo/position/index.ts +3 -0
- package/src/smartfox/x2/packet/mmo/position/request/index.ts +38 -0
- package/src/smartfox/x2/packet/mmo/position/response/index.ts +114 -0
- package/src/smartfox/x2/packet/moderation/ban/index.ts +1 -0
- package/src/smartfox/x2/packet/moderation/ban/request/index.ts +83 -0
- package/src/smartfox/x2/packet/moderation/index.ts +2 -0
- package/src/smartfox/x2/packet/moderation/kick/index.ts +1 -0
- package/src/smartfox/x2/packet/moderation/kick/request/index.ts +45 -0
- package/src/smartfox/x2/packet/ping/index.ts +2 -0
- package/src/smartfox/x2/packet/ping/request/index.ts +14 -0
- package/src/smartfox/x2/packet/ping/response/index.ts +14 -0
- package/src/smartfox/x2/packet/room/capacity/index.ts +2 -0
- package/src/smartfox/x2/packet/room/capacity/request/index.ts +45 -0
- package/src/smartfox/x2/packet/room/capacity/response/index.ts +67 -0
- package/src/smartfox/x2/packet/room/create/index.ts +2 -0
- package/src/smartfox/x2/packet/room/create/request/index.ts +51 -0
- package/src/smartfox/x2/packet/room/create/response/index.ts +43 -0
- package/src/smartfox/x2/packet/room/index.ts +21 -0
- package/src/smartfox/x2/packet/room/join/index.ts +3 -0
- package/src/smartfox/x2/packet/room/join/request/index.ts +101 -0
- package/src/smartfox/x2/packet/room/join/response/index.ts +74 -0
- package/src/smartfox/x2/packet/room/leave/index.ts +1 -0
- package/src/smartfox/x2/packet/room/leave/request/index.ts +25 -0
- package/src/smartfox/x2/packet/room/password/index.ts +2 -0
- package/src/smartfox/x2/packet/room/password/request/index.ts +33 -0
- package/src/smartfox/x2/packet/room/password/response/index.ts +57 -0
- package/src/smartfox/x2/packet/room/quick/index.ts +1 -0
- package/src/smartfox/x2/packet/room/quick/request/index.ts +67 -0
- package/src/smartfox/x2/packet/room/rename/index.ts +2 -0
- package/src/smartfox/x2/packet/room/rename/request/index.ts +33 -0
- package/src/smartfox/x2/packet/room/rename/response/index.ts +50 -0
- package/src/smartfox/x2/packet/room/variables/index.ts +2 -0
- package/src/smartfox/x2/packet/room/variables/request/index.ts +38 -0
- package/src/smartfox/x2/packet/room/variables/response/index.ts +38 -0
- package/src/smartfox/x2/packet/seat/index.ts +8 -0
- package/src/smartfox/x2/packet/seat/player/index.ts +2 -0
- package/src/smartfox/x2/packet/seat/player/request/index.ts +25 -0
- package/src/smartfox/x2/packet/seat/player/response/index.ts +67 -0
- package/src/smartfox/x2/packet/seat/spectator/index.ts +2 -0
- package/src/smartfox/x2/packet/seat/spectator/request/index.ts +25 -0
- package/src/smartfox/x2/packet/seat/spectator/response/index.ts +50 -0
- package/src/smartfox/x2/packet/unknown/index.ts +47 -0
- package/src/smartfox/x2/packet/user/index.ts +4 -0
- package/src/smartfox/x2/packet/user/variables/index.ts +2 -0
- package/src/smartfox/x2/packet/user/variables/request/index.ts +29 -0
- package/src/smartfox/x2/packet/user/variables/response/index.ts +38 -0
- package/src/smartfox/x2/protocol/index.ts +495 -0
- package/src/smartfox/x2/proximity/index.ts +353 -0
- package/src/smartfox/x2/rooms/index.ts +981 -0
- package/src/smartfox/x2/roster/index.ts +3 -0
- package/src/smartfox/x2/roster/memory/index.ts +41 -0
- package/src/smartfox/x2/roster/record/index.ts +31 -0
- package/src/smartfox/x2/roster/store/index.ts +21 -0
- package/src/smartfox/x2/route/index.ts +17 -0
- package/src/smartfox/x2/sessions/index.ts +18 -0
- package/src/smartfox/x2/udp/index.ts +392 -0
- package/src/smartfox/x2/web/index.ts +183 -0
- package/src/smartfox/x2/websocket/index.ts +119 -0
- package/src/smartfox/x2/words/index.ts +265 -0
- package/src/smartfox/x2/zone/index.ts +1163 -0
- package/src/smartfox/x2/zones/index.ts +608 -0
|
@@ -0,0 +1,1103 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto'
|
|
2
|
+
|
|
3
|
+
import { IdleStateEvent } from '@netifyjs/netify'
|
|
4
|
+
|
|
5
|
+
import { Closed } from '../../../dispatch/event/index.ts'
|
|
6
|
+
import { on, when } from '../../../dispatch/route/index.ts'
|
|
7
|
+
import type { Session } from '../../../dispatch/session/index.ts'
|
|
8
|
+
import type { Applications } from '../../application/index.ts'
|
|
9
|
+
import type { CustomAuthenticator } from '../../authentication/authenticator/index.ts'
|
|
10
|
+
import { AuthenticationFailure } from '../../authentication/failure/index.ts'
|
|
11
|
+
import { TokenGate } from '../../authentication/gate/index.ts'
|
|
12
|
+
import type { AuthenticationAttempt } from '../../authentication/provider/index.ts'
|
|
13
|
+
import type { AuthenticationResult } from '../../authentication/result/index.ts'
|
|
14
|
+
import {
|
|
15
|
+
CustomAuthenticationResult,
|
|
16
|
+
CustomAuthenticationType,
|
|
17
|
+
} from '../../balancing/code/authentication/index.ts'
|
|
18
|
+
import { ErrorCode } from '../../balancing/code/error/index.ts'
|
|
19
|
+
import { JoinMode } from '../../balancing/code/join/index.ts'
|
|
20
|
+
import { LobbyType } from '../../balancing/code/lobby/index.ts'
|
|
21
|
+
import { ErrorMessage } from '../../balancing/code/message/index.ts'
|
|
22
|
+
import { OperationCode } from '../../balancing/code/operation/index.ts'
|
|
23
|
+
import { RoomOptionFlag } from '../../balancing/code/room/index.ts'
|
|
24
|
+
import type { Lobby } from '../../balancing/entity/lobby/index.ts'
|
|
25
|
+
import type { RoomOptions } from '../../balancing/entity/options/index.ts'
|
|
26
|
+
import { Grant } from '../../balancing/entity/grant/index.ts'
|
|
27
|
+
import { GrantFormat } from '../../balancing/format/shared/grant/index.ts'
|
|
28
|
+
import { ParameterWriter } from '../../balancing/format/writer/index.ts'
|
|
29
|
+
import type { Packet } from '../../balancing/packet/adapter/index.ts'
|
|
30
|
+
import { AuthenticateRequest } from '../../balancing/packet/authenticate/request/index.ts'
|
|
31
|
+
import { AuthenticateResponse } from '../../balancing/packet/authenticate/response/index.ts'
|
|
32
|
+
import { FindFriendsRequest } from '../../balancing/packet/friends/request/index.ts'
|
|
33
|
+
import { FindFriendsResponse } from '../../balancing/packet/friends/response/index.ts'
|
|
34
|
+
import { CreateGameRequest } from '../../balancing/packet/game/create/request/index.ts'
|
|
35
|
+
import { CreateGameResponse } from '../../balancing/packet/game/create/response/index.ts'
|
|
36
|
+
import { JoinGameRequest } from '../../balancing/packet/game/join/request/index.ts'
|
|
37
|
+
import { JoinGameResponse } from '../../balancing/packet/game/join/response/index.ts'
|
|
38
|
+
import { GetGameListRequest } from '../../balancing/packet/game/list/request/index.ts'
|
|
39
|
+
import { GetGameListResponse } from '../../balancing/packet/game/list/response/index.ts'
|
|
40
|
+
import { JoinRandomGameRequest } from '../../balancing/packet/game/random/request/index.ts'
|
|
41
|
+
import { JoinRandomGameResponse } from '../../balancing/packet/game/random/response/index.ts'
|
|
42
|
+
import { JoinLobbyRequest } from '../../balancing/packet/lobby/join/request/index.ts'
|
|
43
|
+
import { JoinLobbyResponse } from '../../balancing/packet/lobby/join/response/index.ts'
|
|
44
|
+
import { LeaveLobbyRequest } from '../../balancing/packet/lobby/leave/request/index.ts'
|
|
45
|
+
import { LeaveLobbyResponse } from '../../balancing/packet/lobby/leave/response/index.ts'
|
|
46
|
+
import { GetLobbyStatsRequest } from '../../balancing/packet/lobby/stats/request/index.ts'
|
|
47
|
+
import type { ReplyAdapter } from '../../balancing/packet/reply/index.ts'
|
|
48
|
+
import { WebRpcRequest } from '../../balancing/packet/rpc/request/index.ts'
|
|
49
|
+
import { WebRpcResponse } from '../../balancing/packet/rpc/response/index.ts'
|
|
50
|
+
import { ServerSettingsRequest } from '../../balancing/packet/settings/request/index.ts'
|
|
51
|
+
import { UnknownResponse } from '../../balancing/packet/unknown/index.ts'
|
|
52
|
+
import { PhotonDictionary } from '../../binary/dictionary/index.ts'
|
|
53
|
+
import type { PhotonHashtable } from '../../binary/hashtable/index.ts'
|
|
54
|
+
import { Kind } from '../../binary/kind/index.ts'
|
|
55
|
+
import { OperationResponse } from '../../binary/response/index.ts'
|
|
56
|
+
import { Shape } from '../../binary/shape/index.ts'
|
|
57
|
+
import { PhotonValue } from '../../binary/value/index.ts'
|
|
58
|
+
import type { TokenAuthority } from '../../crypto/token/authority/index.ts'
|
|
59
|
+
import type { AuthToken } from '../../crypto/token/record/index.ts'
|
|
60
|
+
import { Envelope } from '../../envelope/index.ts'
|
|
61
|
+
import { AddressFamily } from '../../family/index.ts'
|
|
62
|
+
import { InitRequest } from '../../message/init/request/index.ts'
|
|
63
|
+
import { JsonValues } from '../../message/json/values/index.ts'
|
|
64
|
+
import { OnceAnswer } from '../../message/once/index.ts'
|
|
65
|
+
import { PhotonPeer } from '../../message/peer/index.ts'
|
|
66
|
+
import { WebRpcRelay } from '../../rpc/relay/index.ts'
|
|
67
|
+
import type { MasterApplication } from '../application/index.ts'
|
|
68
|
+
import { MasterFault } from '../fault/index.ts'
|
|
69
|
+
import type { AppLobby, Placement, Seat } from '../lobby/index.ts'
|
|
70
|
+
import { MasterPeer, PeerStage } from '../peer/index.ts'
|
|
71
|
+
import { WellKnownProperties } from '../wellknown/index.ts'
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* What the handler needs from its Master
|
|
75
|
+
*/
|
|
76
|
+
export type MasterServices = {
|
|
77
|
+
/**
|
|
78
|
+
* Lobbies, games, statistics and settings
|
|
79
|
+
*/
|
|
80
|
+
readonly application: MasterApplication
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Checks the tokens clients bring
|
|
84
|
+
*/
|
|
85
|
+
readonly gate: TokenGate
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Issues tokens for logins without one, or null
|
|
89
|
+
*/
|
|
90
|
+
readonly authority: TokenAuthority | null
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Runs custom authentication
|
|
94
|
+
*/
|
|
95
|
+
readonly authenticator: CustomAuthenticator
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Checks app ids and versions of logins without a token
|
|
99
|
+
*/
|
|
100
|
+
readonly applications: Applications
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Serves every operation a client sends to a Master
|
|
105
|
+
* @class
|
|
106
|
+
*/
|
|
107
|
+
export class MasterHandler {
|
|
108
|
+
/**
|
|
109
|
+
* Lobbies, tokens and settings of the server
|
|
110
|
+
*/
|
|
111
|
+
private readonly services: MasterServices
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Writes the parameters of an authenticate response
|
|
115
|
+
*/
|
|
116
|
+
private readonly grants: GrantFormat
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @param services lobbies, tokens and settings of the server
|
|
120
|
+
*/
|
|
121
|
+
public constructor(services: MasterServices) {
|
|
122
|
+
this.services = services
|
|
123
|
+
this.grants = new GrantFormat()
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* A user id that's never blank
|
|
128
|
+
* @param userId what's known, or null
|
|
129
|
+
*/
|
|
130
|
+
private static named(userId: string | null): string {
|
|
131
|
+
return userId === null || userId.trim() === '' ? randomUUID() : userId
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* A provider's values as the dictionary a client reads, or null
|
|
136
|
+
* @param data values from the provider, or null
|
|
137
|
+
*/
|
|
138
|
+
private static dictionary(
|
|
139
|
+
data: Readonly<Record<string, unknown>> | null,
|
|
140
|
+
): PhotonDictionary | null {
|
|
141
|
+
if (data === null) return null
|
|
142
|
+
|
|
143
|
+
const dictionary = PhotonDictionary.of(Shape.string(), Shape.any())
|
|
144
|
+
for (const [name, value] of Object.entries<unknown>(data)) {
|
|
145
|
+
dictionary.set(name, JsonValues.read(value))
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return dictionary
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* The refusal for a lobby type no lobby has
|
|
153
|
+
* @param type what the client sent
|
|
154
|
+
*/
|
|
155
|
+
private static lobbyType(type: number): MasterFault {
|
|
156
|
+
return MasterFault.invalid(
|
|
157
|
+
`${ErrorMessage.INVALID_LOBBY_TYPE} ${String(type)}`,
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Whether a create or join asks for its user id to be checked
|
|
163
|
+
* @param options the room options block, or null
|
|
164
|
+
*/
|
|
165
|
+
private static checksUser(options: RoomOptions | null): boolean {
|
|
166
|
+
if (options === null) return false
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
options.checkUserOnJoin === true ||
|
|
170
|
+
(options.roomFlags & RoomOptionFlag.CHECK_USER_ON_JOIN) !== 0
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Sets a connection up once its init request is through
|
|
176
|
+
* @param session the connection
|
|
177
|
+
*/
|
|
178
|
+
@when<InitRequest>(InitRequest)
|
|
179
|
+
public async opened(session: Session<MasterPeer>): Promise<void> {
|
|
180
|
+
const photon = PhotonPeer.of(session.channel)
|
|
181
|
+
if (photon === null) return
|
|
182
|
+
|
|
183
|
+
const application = this.services.application
|
|
184
|
+
const family = AddressFamily.of(session.channel)
|
|
185
|
+
const peer = new MasterPeer(
|
|
186
|
+
session,
|
|
187
|
+
photon.transport,
|
|
188
|
+
family.ipv6,
|
|
189
|
+
family.bridged,
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
session.user = peer
|
|
193
|
+
application.stats.connected(peer)
|
|
194
|
+
|
|
195
|
+
const token = TokenGate.admitted(session.channel)
|
|
196
|
+
if (token !== null) {
|
|
197
|
+
await this.admit(peer, photon, token)
|
|
198
|
+
return
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
peer.noAuth = application.timers.after(
|
|
202
|
+
application.settings.disconnectIfNoAuthInterval,
|
|
203
|
+
(): void => {
|
|
204
|
+
peer.noAuth = null
|
|
205
|
+
void session.close()
|
|
206
|
+
},
|
|
207
|
+
)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Logs a client in
|
|
212
|
+
* @param session the connection
|
|
213
|
+
* @param packet token or credentials
|
|
214
|
+
*/
|
|
215
|
+
@on<AuthenticateRequest>(AuthenticateRequest)
|
|
216
|
+
public async authenticate(
|
|
217
|
+
session: Session<MasterPeer>,
|
|
218
|
+
packet: AuthenticateRequest,
|
|
219
|
+
): Promise<void> {
|
|
220
|
+
const peer = session.user
|
|
221
|
+
if (peer === null) return
|
|
222
|
+
|
|
223
|
+
this.services.application.timers.cancel(peer.noAuth)
|
|
224
|
+
peer.noAuth = null
|
|
225
|
+
|
|
226
|
+
try {
|
|
227
|
+
await this.login(peer, packet)
|
|
228
|
+
} catch (cause) {
|
|
229
|
+
if (peer.stage === PeerStage.AUTHENTICATING) {
|
|
230
|
+
peer.stage = PeerStage.INITIAL
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const fault = MasterFault.from(cause)
|
|
234
|
+
peer.send(
|
|
235
|
+
AuthenticateResponse.failure(fault.code, fault.message).to(packet),
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Lets a client into a lobby
|
|
242
|
+
* @param session the connection
|
|
243
|
+
* @param packet lobby, game count and filter
|
|
244
|
+
*/
|
|
245
|
+
@on<JoinLobbyRequest>(JoinLobbyRequest)
|
|
246
|
+
public joinLobby(
|
|
247
|
+
session: Session<MasterPeer>,
|
|
248
|
+
packet: JoinLobbyRequest,
|
|
249
|
+
): void {
|
|
250
|
+
this.answer(
|
|
251
|
+
session,
|
|
252
|
+
packet,
|
|
253
|
+
OperationCode.JOIN_LOBBY,
|
|
254
|
+
(peer: MasterPeer): ReplyAdapter | null => {
|
|
255
|
+
const application = this.services.application
|
|
256
|
+
const type = packet.lobby?.type ?? LobbyType.DEFAULT
|
|
257
|
+
if (type > LobbyType.ASYNC_RANDOM) throw MasterHandler.lobbyType(type)
|
|
258
|
+
|
|
259
|
+
application.leave(peer)
|
|
260
|
+
|
|
261
|
+
const lobby = application.lobbies.resolve(
|
|
262
|
+
packet.lobby?.name ?? null,
|
|
263
|
+
type,
|
|
264
|
+
)
|
|
265
|
+
const list = lobby.join(
|
|
266
|
+
peer,
|
|
267
|
+
packet.gameListCount ?? 0,
|
|
268
|
+
peer.properties(packet.gameProperties),
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
peer.lobby = lobby
|
|
272
|
+
peer.send(JoinLobbyResponse.success().to(packet))
|
|
273
|
+
if (list !== null) peer.send(list)
|
|
274
|
+
|
|
275
|
+
return null
|
|
276
|
+
},
|
|
277
|
+
)
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Lets a client out of its lobby
|
|
282
|
+
* @param session the connection
|
|
283
|
+
* @param packet nothing that matters
|
|
284
|
+
*/
|
|
285
|
+
@on<LeaveLobbyRequest>(LeaveLobbyRequest)
|
|
286
|
+
public leaveLobby(
|
|
287
|
+
session: Session<MasterPeer>,
|
|
288
|
+
packet: LeaveLobbyRequest,
|
|
289
|
+
): void {
|
|
290
|
+
this.answer(
|
|
291
|
+
session,
|
|
292
|
+
packet,
|
|
293
|
+
OperationCode.LEAVE_LOBBY,
|
|
294
|
+
(peer: MasterPeer): ReplyAdapter | null => {
|
|
295
|
+
if (peer.lobby === null) return LeaveLobbyResponse.notJoined()
|
|
296
|
+
|
|
297
|
+
this.services.application.leave(peer)
|
|
298
|
+
return LeaveLobbyResponse.success()
|
|
299
|
+
},
|
|
300
|
+
)
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Creates a game and sends the creator to its Game Server
|
|
305
|
+
* @param session the connection
|
|
306
|
+
* @param packet name, lobby, properties and reserved users
|
|
307
|
+
*/
|
|
308
|
+
@on<CreateGameRequest>(CreateGameRequest)
|
|
309
|
+
public create(session: Session<MasterPeer>, packet: CreateGameRequest): void {
|
|
310
|
+
this.answer(
|
|
311
|
+
session,
|
|
312
|
+
packet,
|
|
313
|
+
OperationCode.CREATE_GAME,
|
|
314
|
+
(peer: MasterPeer): ReplyAdapter | null => {
|
|
315
|
+
const placement = this.placement(
|
|
316
|
+
peer,
|
|
317
|
+
packet.roomName,
|
|
318
|
+
peer.properties(packet.options?.gameProperties ?? null),
|
|
319
|
+
packet.expectedUsers,
|
|
320
|
+
)
|
|
321
|
+
const type = packet.lobby?.type ?? LobbyType.DEFAULT
|
|
322
|
+
if (type > LobbyType.ASYNC_RANDOM) throw MasterHandler.lobbyType(type)
|
|
323
|
+
|
|
324
|
+
const lobby = this.lobby(peer, packet.lobby)
|
|
325
|
+
return this.queued(
|
|
326
|
+
peer,
|
|
327
|
+
OperationCode.CREATE_GAME,
|
|
328
|
+
(): ReplyAdapter => {
|
|
329
|
+
const seat = lobby.create(peer, placement)
|
|
330
|
+
|
|
331
|
+
return CreateGameResponse.master(seat.address, seat.game)
|
|
332
|
+
},
|
|
333
|
+
)
|
|
334
|
+
},
|
|
335
|
+
)
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Sends a client to the Game Server of a game it names
|
|
340
|
+
* @param session the connection
|
|
341
|
+
* @param packet name, join mode, lobby and reserved users
|
|
342
|
+
*/
|
|
343
|
+
@on<JoinGameRequest>(JoinGameRequest)
|
|
344
|
+
public join(session: Session<MasterPeer>, packet: JoinGameRequest): void {
|
|
345
|
+
this.answer(
|
|
346
|
+
session,
|
|
347
|
+
packet,
|
|
348
|
+
OperationCode.JOIN_GAME,
|
|
349
|
+
(peer: MasterPeer): ReplyAdapter | null => {
|
|
350
|
+
const placement = this.placement(
|
|
351
|
+
peer,
|
|
352
|
+
packet.roomName,
|
|
353
|
+
peer.properties(packet.options?.gameProperties ?? null),
|
|
354
|
+
packet.expectedUsers,
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
const application = this.services.application
|
|
358
|
+
const known = application.find(packet.roomName)
|
|
359
|
+
const plain =
|
|
360
|
+
packet.joinMode === JoinMode.DEFAULT &&
|
|
361
|
+
!application.settings.allowAsyncJoin
|
|
362
|
+
if (known === null && plain) {
|
|
363
|
+
throw MasterFault.of(
|
|
364
|
+
ErrorCode.GAME_DOES_NOT_EXIST,
|
|
365
|
+
ErrorMessage.GAME_ID_DOES_NOT_EXIST,
|
|
366
|
+
)
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
const lobby = known?.lobby ?? this.lobby(peer, packet.lobby)
|
|
370
|
+
return this.queued(
|
|
371
|
+
peer,
|
|
372
|
+
OperationCode.JOIN_GAME,
|
|
373
|
+
(): ReplyAdapter | null => {
|
|
374
|
+
const seat = lobby.enter(peer, packet, {
|
|
375
|
+
...placement,
|
|
376
|
+
/**
|
|
377
|
+
* Decides between joining, creating and rejoining
|
|
378
|
+
*/
|
|
379
|
+
mode: packet.joinMode,
|
|
380
|
+
/**
|
|
381
|
+
* Asked for by flag or by the old parameter
|
|
382
|
+
*/
|
|
383
|
+
checkUser: MasterHandler.checksUser(packet.options),
|
|
384
|
+
})
|
|
385
|
+
|
|
386
|
+
return seat === null
|
|
387
|
+
? null
|
|
388
|
+
: JoinGameResponse.master(seat.address, null, null, 0)
|
|
389
|
+
},
|
|
390
|
+
)
|
|
391
|
+
},
|
|
392
|
+
)
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Sends a client to a game that fits, or creates one if asked to
|
|
397
|
+
* @param session the connection
|
|
398
|
+
* @param packet filters, mode, lobby and reserved users
|
|
399
|
+
*/
|
|
400
|
+
@on<JoinRandomGameRequest>(JoinRandomGameRequest)
|
|
401
|
+
public random(
|
|
402
|
+
session: Session<MasterPeer>,
|
|
403
|
+
packet: JoinRandomGameRequest,
|
|
404
|
+
): void {
|
|
405
|
+
const code = OperationCode.JOIN_RANDOM_GAME
|
|
406
|
+
|
|
407
|
+
this.answer(
|
|
408
|
+
session,
|
|
409
|
+
packet,
|
|
410
|
+
code,
|
|
411
|
+
(peer: MasterPeer): ReplyAdapter | null => {
|
|
412
|
+
const word = this.forbidden(packet.sqlFilter, false)
|
|
413
|
+
if (word !== null) throw word
|
|
414
|
+
|
|
415
|
+
const lobby = this.lobby(peer, packet.lobby)
|
|
416
|
+
return this.queued(peer, code, (): ReplyAdapter => {
|
|
417
|
+
const seat =
|
|
418
|
+
lobby.random(peer, {
|
|
419
|
+
/**
|
|
420
|
+
* Properties a game must have
|
|
421
|
+
*/
|
|
422
|
+
filter: peer.filter(packet.gameProperties),
|
|
423
|
+
/**
|
|
424
|
+
* Where the walk through the games starts
|
|
425
|
+
*/
|
|
426
|
+
mode: packet.matchmakingMode,
|
|
427
|
+
/**
|
|
428
|
+
* Filters of a SQL lobby
|
|
429
|
+
*/
|
|
430
|
+
sql: packet.sqlFilter,
|
|
431
|
+
/**
|
|
432
|
+
* Checked by games that check user ids
|
|
433
|
+
*/
|
|
434
|
+
users: packet.expectedUsers,
|
|
435
|
+
}) ?? this.fallback(peer, packet)
|
|
436
|
+
|
|
437
|
+
return JoinRandomGameResponse.success(seat.address, seat.game, 0)
|
|
438
|
+
})
|
|
439
|
+
},
|
|
440
|
+
)
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Lists the games of a SQL lobby that pass a filter
|
|
445
|
+
* @param session the connection
|
|
446
|
+
* @param packet lobby and filter
|
|
447
|
+
*/
|
|
448
|
+
@on<GetGameListRequest>(GetGameListRequest)
|
|
449
|
+
public list(session: Session<MasterPeer>, packet: GetGameListRequest): void {
|
|
450
|
+
this.answer(
|
|
451
|
+
session,
|
|
452
|
+
packet,
|
|
453
|
+
OperationCode.GET_GAME_LIST,
|
|
454
|
+
(): ReplyAdapter | null => {
|
|
455
|
+
const word = this.forbidden(packet.sqlFilter, true)
|
|
456
|
+
if (word !== null) throw word
|
|
457
|
+
|
|
458
|
+
const type = packet.lobby?.type ?? LobbyType.DEFAULT
|
|
459
|
+
if (type !== LobbyType.SQL) throw MasterHandler.lobbyType(type)
|
|
460
|
+
|
|
461
|
+
const name = packet.lobby?.name ?? ''
|
|
462
|
+
if (name === '') throw MasterFault.invalid("Invalid lobby name: ''")
|
|
463
|
+
|
|
464
|
+
const lobby = this.services.application.lobbies.resolve(name, type)
|
|
465
|
+
return GetGameListResponse.success(lobby.query(packet.sqlFilter ?? ''))
|
|
466
|
+
},
|
|
467
|
+
)
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Tells a client which friends are online and where
|
|
472
|
+
* @param session the connection
|
|
473
|
+
* @param packet user ids and option bits
|
|
474
|
+
*/
|
|
475
|
+
@on<FindFriendsRequest>(FindFriendsRequest)
|
|
476
|
+
public friends(
|
|
477
|
+
session: Session<MasterPeer>,
|
|
478
|
+
packet: FindFriendsRequest,
|
|
479
|
+
): void {
|
|
480
|
+
this.answer(
|
|
481
|
+
session,
|
|
482
|
+
packet,
|
|
483
|
+
OperationCode.FIND_FRIENDS,
|
|
484
|
+
(): ReplyAdapter | null => {
|
|
485
|
+
const found = this.services.application.players.find(
|
|
486
|
+
packet.userIds,
|
|
487
|
+
packet.options ?? 0,
|
|
488
|
+
)
|
|
489
|
+
|
|
490
|
+
return FindFriendsResponse.success(found.online, found.rooms)
|
|
491
|
+
},
|
|
492
|
+
)
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Tells a client how full lobbies are
|
|
497
|
+
* @param session the connection
|
|
498
|
+
* @param packet lobbies the client asks about
|
|
499
|
+
*/
|
|
500
|
+
@on<GetLobbyStatsRequest>(GetLobbyStatsRequest)
|
|
501
|
+
public lobbyStats(
|
|
502
|
+
session: Session<MasterPeer>,
|
|
503
|
+
packet: GetLobbyStatsRequest,
|
|
504
|
+
): void {
|
|
505
|
+
this.answer(
|
|
506
|
+
session,
|
|
507
|
+
packet,
|
|
508
|
+
OperationCode.GET_LOBBY_STATS,
|
|
509
|
+
(): ReplyAdapter | null =>
|
|
510
|
+
this.services.application.lobbyStats.answer(packet),
|
|
511
|
+
)
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Switches lobby statistics on or off for a client
|
|
516
|
+
* @param session the connection
|
|
517
|
+
* @param packet the switch
|
|
518
|
+
*/
|
|
519
|
+
@on<ServerSettingsRequest>(ServerSettingsRequest)
|
|
520
|
+
public settings(
|
|
521
|
+
session: Session<MasterPeer>,
|
|
522
|
+
packet: ServerSettingsRequest,
|
|
523
|
+
): void {
|
|
524
|
+
const peer = session.user
|
|
525
|
+
if (peer === null || packet.lobbyStats === null) return
|
|
526
|
+
|
|
527
|
+
this.watch(peer, packet.lobbyStats)
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Runs a WebRPC call
|
|
532
|
+
* @param session the connection
|
|
533
|
+
* @param packet path and parameters of the call
|
|
534
|
+
*/
|
|
535
|
+
@on<WebRpcRequest>(WebRpcRequest)
|
|
536
|
+
public async rpc(
|
|
537
|
+
session: Session<MasterPeer>,
|
|
538
|
+
packet: WebRpcRequest,
|
|
539
|
+
): Promise<void> {
|
|
540
|
+
const peer = session.user
|
|
541
|
+
if (peer === null) return
|
|
542
|
+
|
|
543
|
+
try {
|
|
544
|
+
peer.send((await this.call(peer, packet)).to(packet))
|
|
545
|
+
} catch (cause) {
|
|
546
|
+
const fault = MasterFault.from(cause)
|
|
547
|
+
|
|
548
|
+
peer.send(WebRpcResponse.failure(fault.code, fault.message).to(packet))
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Drops a connection that went quiet
|
|
554
|
+
* @param session the connection
|
|
555
|
+
* @param event which side went quiet
|
|
556
|
+
*/
|
|
557
|
+
@when<IdleStateEvent>(IdleStateEvent)
|
|
558
|
+
public async idle(
|
|
559
|
+
session: Session<MasterPeer>,
|
|
560
|
+
event: IdleStateEvent,
|
|
561
|
+
): Promise<void> {
|
|
562
|
+
if (event.state === 'reader') await session.close()
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Forgets a connection that closed
|
|
567
|
+
* @param session the connection
|
|
568
|
+
*/
|
|
569
|
+
@when<Closed>(Closed)
|
|
570
|
+
public closed(session: Session<MasterPeer>): void {
|
|
571
|
+
const peer = session.user
|
|
572
|
+
if (peer === null) return
|
|
573
|
+
|
|
574
|
+
const application = this.services.application
|
|
575
|
+
application.timers.cancel(peer.noAuth)
|
|
576
|
+
application.timers.cancel(peer.hangUp)
|
|
577
|
+
peer.noAuth = null
|
|
578
|
+
peer.hangUp = null
|
|
579
|
+
application.detach(peer)
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Runs an operation and sends its answer, or the reason it failed
|
|
584
|
+
* @param session the connection
|
|
585
|
+
* @param packet what the client sent
|
|
586
|
+
* @param code operation a failure is answered under
|
|
587
|
+
* @param work what the operation does
|
|
588
|
+
*/
|
|
589
|
+
private answer(
|
|
590
|
+
session: Session<MasterPeer>,
|
|
591
|
+
packet: Packet,
|
|
592
|
+
code: number,
|
|
593
|
+
work: (peer: MasterPeer) => ReplyAdapter | null,
|
|
594
|
+
): void {
|
|
595
|
+
const peer = session.user
|
|
596
|
+
if (peer === null) return
|
|
597
|
+
|
|
598
|
+
let reply: ReplyAdapter | null
|
|
599
|
+
try {
|
|
600
|
+
reply = work(peer)
|
|
601
|
+
} catch (cause) {
|
|
602
|
+
const fault = MasterFault.from(cause)
|
|
603
|
+
|
|
604
|
+
reply = UnknownResponse.failure(code, fault.code, fault.message)
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
if (reply !== null) peer.send(reply.to(packet))
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Runs the lobby part of a create or join and keeps the flood counters
|
|
612
|
+
* @param peer who's asking
|
|
613
|
+
* @param code operation a failure is answered under
|
|
614
|
+
* @param work what the lobby does
|
|
615
|
+
*/
|
|
616
|
+
private queued(
|
|
617
|
+
peer: MasterPeer,
|
|
618
|
+
code: number,
|
|
619
|
+
work: () => ReplyAdapter | null,
|
|
620
|
+
): ReplyAdapter | null {
|
|
621
|
+
peer.concurrentJoins += 1
|
|
622
|
+
|
|
623
|
+
let reply: ReplyAdapter | null
|
|
624
|
+
try {
|
|
625
|
+
reply = work()
|
|
626
|
+
} catch (cause) {
|
|
627
|
+
const fault = MasterFault.from(cause)
|
|
628
|
+
|
|
629
|
+
reply = UnknownResponse.failure(code, fault.code, fault.message)
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
if (reply === null) return null
|
|
633
|
+
|
|
634
|
+
peer.concurrentJoins -= 1
|
|
635
|
+
if (reply.succeeded) peer.successfulJoins += 1
|
|
636
|
+
|
|
637
|
+
return reply
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* The lobby a create, join or random join runs in
|
|
642
|
+
* @param peer who's asking
|
|
643
|
+
* @param lobby what the request names, or null
|
|
644
|
+
*/
|
|
645
|
+
private lobby(peer: MasterPeer, lobby: Lobby | null): AppLobby {
|
|
646
|
+
return this.services.application.lobby(
|
|
647
|
+
peer,
|
|
648
|
+
lobby?.name ?? null,
|
|
649
|
+
lobby?.type ?? LobbyType.DEFAULT,
|
|
650
|
+
)
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Checks the properties and reserved users of a create or join
|
|
655
|
+
* @param peer who's asking
|
|
656
|
+
* @param name name of the game, or null
|
|
657
|
+
* @param properties properties the client sent, or null
|
|
658
|
+
* @param users user ids to keep seats for, or null
|
|
659
|
+
*/
|
|
660
|
+
private placement(
|
|
661
|
+
peer: MasterPeer,
|
|
662
|
+
name: string | null,
|
|
663
|
+
properties: PhotonHashtable | null,
|
|
664
|
+
users: readonly string[] | null,
|
|
665
|
+
): Placement {
|
|
666
|
+
const known =
|
|
667
|
+
properties === null || properties.size === 0
|
|
668
|
+
? null
|
|
669
|
+
: WellKnownProperties.request(properties)
|
|
670
|
+
const wanted = users ?? known?.expectedUsers ?? null
|
|
671
|
+
const unique = wanted === null ? null : [...new Set<string>(wanted)]
|
|
672
|
+
|
|
673
|
+
if (unique !== null) {
|
|
674
|
+
const needed =
|
|
675
|
+
unique.length + (unique.includes(peer.userId ?? '') ? 0 : 1)
|
|
676
|
+
const most = known?.maxPlayers ?? 0
|
|
677
|
+
if (most !== 0 && needed > most) {
|
|
678
|
+
throw MasterFault.invalid(
|
|
679
|
+
'Reserved slots count is bigger then max player value',
|
|
680
|
+
)
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
if (unique.includes('')) {
|
|
684
|
+
throw MasterFault.invalid(ErrorMessage.SLOT_CAN_NOT_HAVE_EMPTY_NAME)
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
return { name, properties: known?.table ?? properties, users: unique }
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Creates the game a random join falls back to
|
|
693
|
+
* @param peer who's asking
|
|
694
|
+
* @param packet what they asked for
|
|
695
|
+
*/
|
|
696
|
+
private fallback(peer: MasterPeer, packet: JoinRandomGameRequest): Seat {
|
|
697
|
+
if (packet.joinMode !== JoinMode.CREATE_IF_NOT_EXISTS) {
|
|
698
|
+
throw MasterFault.of(ErrorCode.NO_RANDOM_MATCH_FOUND, 'No match found')
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
const lobby = this.lobby(peer, packet.lobby)
|
|
702
|
+
return lobby.create(
|
|
703
|
+
peer,
|
|
704
|
+
this.placement(
|
|
705
|
+
peer,
|
|
706
|
+
packet.roomName,
|
|
707
|
+
peer.properties(packet.properties ?? packet.gameProperties),
|
|
708
|
+
packet.expectedUsers,
|
|
709
|
+
),
|
|
710
|
+
)
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Why a filter is refused for what it holds, or null
|
|
715
|
+
* @param query the filter, or null
|
|
716
|
+
* @param single whether a semicolon counts too
|
|
717
|
+
*/
|
|
718
|
+
private forbidden(query: string | null, single: boolean): MasterFault | null {
|
|
719
|
+
const settings = this.services.application.settings
|
|
720
|
+
if (query === null || query === '' || settings.onlyLogQueryDataErrors) {
|
|
721
|
+
return null
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
if (single && query.includes(';')) {
|
|
725
|
+
return MasterFault.invalid(ErrorMessage.SEMICOLON_IN_QUERY_DATA)
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
const word = settings.wrongWordsForQueryData.find(
|
|
729
|
+
(wrong: string): boolean => query.includes(wrong),
|
|
730
|
+
)
|
|
731
|
+
|
|
732
|
+
return word === undefined
|
|
733
|
+
? null
|
|
734
|
+
: MasterFault.invalid(ErrorMessage.WORD_IN_QUERY_DATA, word)
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Switches lobby statistics on or off for a client
|
|
739
|
+
* @param peer who asked
|
|
740
|
+
* @param wanted whether they want them
|
|
741
|
+
*/
|
|
742
|
+
private watch(peer: MasterPeer, wanted: boolean): void {
|
|
743
|
+
const statistics = this.services.application.lobbyStats
|
|
744
|
+
|
|
745
|
+
peer.lobbyStats = wanted
|
|
746
|
+
if (wanted) statistics.subscribe(peer)
|
|
747
|
+
else statistics.unsubscribe(peer)
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Runs a WebRPC call through the configured service
|
|
752
|
+
* @param peer who's calling
|
|
753
|
+
* @param packet path and parameters of the call
|
|
754
|
+
*/
|
|
755
|
+
private async call(
|
|
756
|
+
peer: MasterPeer,
|
|
757
|
+
packet: WebRpcRequest,
|
|
758
|
+
): Promise<UnknownResponse> {
|
|
759
|
+
const settings = this.services.application.settings
|
|
760
|
+
const service = settings.rpc
|
|
761
|
+
if (service === null)
|
|
762
|
+
throw MasterFault.denied(ErrorMessage.RPC_IS_NOT_SETUP)
|
|
763
|
+
|
|
764
|
+
const limit = settings.webRpcHttpCallsLimit
|
|
765
|
+
if (peer.calls.exceeds(settings.clock(), limit)) {
|
|
766
|
+
throw MasterFault.of(
|
|
767
|
+
ErrorCode.HTTP_LIMIT_REACHED,
|
|
768
|
+
ErrorMessage.HTTP_FORWARDED_OPERATIONS_LIMIT_REACHED,
|
|
769
|
+
)
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
return WebRpcRelay.run(
|
|
773
|
+
service,
|
|
774
|
+
packet,
|
|
775
|
+
peer.userId,
|
|
776
|
+
peer.token?.authCookie ?? null,
|
|
777
|
+
)
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Finishes the login of a client whose init request brought a token
|
|
782
|
+
* @param peer who connected
|
|
783
|
+
* @param photon what's known about the connection
|
|
784
|
+
* @param token what the init request brought
|
|
785
|
+
*/
|
|
786
|
+
private async admit(
|
|
787
|
+
peer: MasterPeer,
|
|
788
|
+
photon: PhotonPeer,
|
|
789
|
+
token: AuthToken,
|
|
790
|
+
): Promise<void> {
|
|
791
|
+
const refusal = this.refusal(photon, token)
|
|
792
|
+
if (refusal !== null) {
|
|
793
|
+
peer.send(
|
|
794
|
+
Envelope.reliable<OperationResponse>(
|
|
795
|
+
OperationResponse.failure(
|
|
796
|
+
OperationCode.AUTHENTICATE_ONCE,
|
|
797
|
+
refusal.code,
|
|
798
|
+
refusal.message,
|
|
799
|
+
),
|
|
800
|
+
),
|
|
801
|
+
)
|
|
802
|
+
await peer.session.close()
|
|
803
|
+
return
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
this.enter(peer, token, false)
|
|
807
|
+
peer.send(OnceAnswer.master(this.services.gate.seal(token)))
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Why a good token still doesn't get a client in, or null
|
|
812
|
+
* @param photon what's known about the connection
|
|
813
|
+
* @param token what the client brought
|
|
814
|
+
*/
|
|
815
|
+
private refusal(photon: PhotonPeer, token: AuthToken): MasterFault | null {
|
|
816
|
+
const application = this.services.application
|
|
817
|
+
if (application.settings.requireSecureConnection && !photon.secure) {
|
|
818
|
+
return MasterFault.of(
|
|
819
|
+
ErrorCode.SECURE_CONNECTION_REQUIRED,
|
|
820
|
+
ErrorMessage.SECURE_CONNECTION_REQUIRED,
|
|
821
|
+
)
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
if (application.blocked(token.userId)) {
|
|
825
|
+
return MasterFault.of(ErrorCode.USER_BLOCKED, ErrorMessage.USER_BLOCKED)
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
return null
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* Marks a client as logged in
|
|
833
|
+
* @param peer who's in
|
|
834
|
+
* @param token what they hold from now on
|
|
835
|
+
* @param lobbyStats whether they asked for lobby statistics
|
|
836
|
+
*/
|
|
837
|
+
private enter(peer: MasterPeer, token: AuthToken, lobbyStats: boolean): void {
|
|
838
|
+
peer.token = token
|
|
839
|
+
peer.userId = token.userId
|
|
840
|
+
peer.stage = PeerStage.AUTHENTICATED
|
|
841
|
+
peer.lobbyStats = lobbyStats
|
|
842
|
+
this.services.application.attach(peer)
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
/**
|
|
846
|
+
* Works through one authenticate request
|
|
847
|
+
* @param peer who's logging in
|
|
848
|
+
* @param packet token or credentials
|
|
849
|
+
*/
|
|
850
|
+
private async login(
|
|
851
|
+
peer: MasterPeer,
|
|
852
|
+
packet: AuthenticateRequest,
|
|
853
|
+
): Promise<void> {
|
|
854
|
+
if (this.services.gate.tokened(packet)) {
|
|
855
|
+
await this.byToken(peer, packet)
|
|
856
|
+
return
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
const credentials = packet.credentials
|
|
860
|
+
const data = credentials?.authentication?.data ?? null
|
|
861
|
+
if (
|
|
862
|
+
data !== null &&
|
|
863
|
+
data.kind !== Kind.STRING &&
|
|
864
|
+
data.kind !== Kind.BYTES
|
|
865
|
+
) {
|
|
866
|
+
throw MasterFault.invalid(ErrorMessage.INVALID_TYPE_FOR_AUTH_DATA)
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
const fault = this.services.applications.fault(
|
|
870
|
+
credentials?.applicationId ?? null,
|
|
871
|
+
credentials?.appVersion ?? null,
|
|
872
|
+
)
|
|
873
|
+
if (fault !== null) {
|
|
874
|
+
throw MasterFault.of(ErrorCode.INVALID_AUTHENTICATION, fault)
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
if (this.services.authenticator.enabled) {
|
|
878
|
+
await this.custom(peer, packet)
|
|
879
|
+
return
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
const given = credentials?.userId ?? null
|
|
883
|
+
const userId = MasterHandler.named(given)
|
|
884
|
+
const token = this.issue(packet, userId, {})
|
|
885
|
+
|
|
886
|
+
this.enter(peer, token, packet.lobbyStats)
|
|
887
|
+
peer.send(
|
|
888
|
+
AuthenticateResponse.success(
|
|
889
|
+
Grant.of(null, this.sealed(token), userId === given ? null : userId),
|
|
890
|
+
).to(packet),
|
|
891
|
+
)
|
|
892
|
+
this.greet(peer)
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* Logs a client in by the token it brought
|
|
897
|
+
* @param peer who's logging in
|
|
898
|
+
* @param packet the token
|
|
899
|
+
*/
|
|
900
|
+
private async byToken(
|
|
901
|
+
peer: MasterPeer,
|
|
902
|
+
packet: AuthenticateRequest,
|
|
903
|
+
): Promise<void> {
|
|
904
|
+
const verdict = this.services.gate.verify(packet.token)
|
|
905
|
+
const token = verdict.token
|
|
906
|
+
if (token === null) {
|
|
907
|
+
throw MasterFault.of(
|
|
908
|
+
verdict.refusal?.code ?? ErrorCode.INVALID_AUTHENTICATION,
|
|
909
|
+
verdict.refusal?.message ?? ErrorMessage.AUTH_TOKEN_TYPE_NOT_SUPPORTED,
|
|
910
|
+
)
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
const photon = PhotonPeer.of(peer.session.channel)
|
|
914
|
+
const application = this.services.application
|
|
915
|
+
if (application.blocked(token.userId)) {
|
|
916
|
+
throw MasterFault.of(ErrorCode.USER_BLOCKED, ErrorMessage.USER_BLOCKED)
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
if (
|
|
920
|
+
application.settings.requireSecureConnection &&
|
|
921
|
+
photon?.secure !== true
|
|
922
|
+
) {
|
|
923
|
+
peer.send(
|
|
924
|
+
AuthenticateResponse.failure(
|
|
925
|
+
ErrorCode.SECURE_CONNECTION_REQUIRED,
|
|
926
|
+
ErrorMessage.SECURE_CONNECTION_REQUIRED,
|
|
927
|
+
).to(packet),
|
|
928
|
+
)
|
|
929
|
+
await peer.session.close()
|
|
930
|
+
return
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
const userId = token.userId
|
|
934
|
+
this.enter(peer, token, packet.lobbyStats)
|
|
935
|
+
peer.send(
|
|
936
|
+
AuthenticateResponse.success(
|
|
937
|
+
Grant.master(
|
|
938
|
+
PhotonValue.string(this.services.gate.seal(token)),
|
|
939
|
+
userId === null || userId === '' ? null : userId,
|
|
940
|
+
),
|
|
941
|
+
).to(packet),
|
|
942
|
+
)
|
|
943
|
+
this.greet(peer)
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* Logs a client in through custom authentication
|
|
948
|
+
* @param peer who's logging in
|
|
949
|
+
* @param packet credentials and auth values
|
|
950
|
+
*/
|
|
951
|
+
private async custom(
|
|
952
|
+
peer: MasterPeer,
|
|
953
|
+
packet: AuthenticateRequest,
|
|
954
|
+
): Promise<void> {
|
|
955
|
+
const credentials = packet.credentials
|
|
956
|
+
const attempt: AuthenticationAttempt = {
|
|
957
|
+
type:
|
|
958
|
+
credentials?.authentication?.type ?? CustomAuthenticationType.CUSTOM,
|
|
959
|
+
parameters: credentials?.authentication?.parameters ?? null,
|
|
960
|
+
data: credentials?.authentication?.data ?? null,
|
|
961
|
+
applicationId: credentials?.applicationId ?? null,
|
|
962
|
+
applicationVersion: credentials?.appVersion ?? null,
|
|
963
|
+
userId: credentials?.userId ?? null,
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
peer.stage = PeerStage.AUTHENTICATING
|
|
967
|
+
|
|
968
|
+
let result: AuthenticationResult
|
|
969
|
+
try {
|
|
970
|
+
result = await this.services.authenticator.authenticate(attempt)
|
|
971
|
+
} catch (cause) {
|
|
972
|
+
if (!(cause instanceof AuthenticationFailure)) throw cause
|
|
973
|
+
|
|
974
|
+
throw MasterFault.of(
|
|
975
|
+
ErrorCode.CUSTOM_AUTHENTICATION_FAILED,
|
|
976
|
+
cause.message,
|
|
977
|
+
)
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
peer.stage = PeerStage.INITIAL
|
|
981
|
+
if (!peer.session.channel.isActive) return
|
|
982
|
+
|
|
983
|
+
if (result.code === CustomAuthenticationResult.DATA) {
|
|
984
|
+
peer.send(
|
|
985
|
+
AuthenticateResponse.success(
|
|
986
|
+
Grant.of(
|
|
987
|
+
null,
|
|
988
|
+
null,
|
|
989
|
+
null,
|
|
990
|
+
null,
|
|
991
|
+
null,
|
|
992
|
+
null,
|
|
993
|
+
MasterHandler.dictionary(result.data),
|
|
994
|
+
),
|
|
995
|
+
).to(packet),
|
|
996
|
+
)
|
|
997
|
+
return
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
if (result.code !== CustomAuthenticationResult.OK) {
|
|
1001
|
+
throw MasterFault.of(
|
|
1002
|
+
ErrorCode.CUSTOM_AUTHENTICATION_FAILED,
|
|
1003
|
+
result.message ?? '',
|
|
1004
|
+
)
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
const provided = result.userId
|
|
1008
|
+
const userId = MasterHandler.named(
|
|
1009
|
+
provided === null || provided === ''
|
|
1010
|
+
? (credentials?.userId ?? null)
|
|
1011
|
+
: provided,
|
|
1012
|
+
)
|
|
1013
|
+
const token = this.issue(packet, userId, result.cookie ?? {})
|
|
1014
|
+
const writer = ParameterWriter.of(OperationCode.AUTHENTICATE)
|
|
1015
|
+
|
|
1016
|
+
this.grants.write(
|
|
1017
|
+
Grant.of(
|
|
1018
|
+
null,
|
|
1019
|
+
this.sealed(token),
|
|
1020
|
+
userId,
|
|
1021
|
+
result.nickname,
|
|
1022
|
+
null,
|
|
1023
|
+
null,
|
|
1024
|
+
MasterHandler.dictionary(result.data),
|
|
1025
|
+
),
|
|
1026
|
+
writer,
|
|
1027
|
+
)
|
|
1028
|
+
this.enter(peer, token, packet.lobbyStats)
|
|
1029
|
+
peer.send(
|
|
1030
|
+
UnknownResponse.of(
|
|
1031
|
+
OperationCode.AUTHENTICATE,
|
|
1032
|
+
ErrorCode.OK,
|
|
1033
|
+
result.message,
|
|
1034
|
+
writer.parameters,
|
|
1035
|
+
).to(packet),
|
|
1036
|
+
)
|
|
1037
|
+
this.greet(peer)
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
/**
|
|
1041
|
+
* Sends a fresh login its first lobby statistics, if it asked for them
|
|
1042
|
+
* @param peer who just logged in
|
|
1043
|
+
*/
|
|
1044
|
+
private greet(peer: MasterPeer): void {
|
|
1045
|
+
if (peer.lobbyStats) this.services.application.lobbyStats.subscribe(peer)
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
/**
|
|
1049
|
+
* A new token for a login that brought none
|
|
1050
|
+
* @param packet what the client sent
|
|
1051
|
+
* @param userId who the token is for
|
|
1052
|
+
* @param cookie values custom authentication wants remembered
|
|
1053
|
+
*/
|
|
1054
|
+
private issue(
|
|
1055
|
+
packet: AuthenticateRequest,
|
|
1056
|
+
userId: string,
|
|
1057
|
+
cookie: Readonly<Record<string, unknown>>,
|
|
1058
|
+
): AuthToken {
|
|
1059
|
+
const authority = this.services.authority
|
|
1060
|
+
if (authority === null) {
|
|
1061
|
+
throw new Error(ErrorMessage.AUTH_TOKEN_TYPE_NOT_SUPPORTED)
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
const credentials = packet.credentials
|
|
1065
|
+
const application = credentials?.applicationId ?? null
|
|
1066
|
+
const version = credentials?.appVersion ?? null
|
|
1067
|
+
|
|
1068
|
+
return authority.issue({
|
|
1069
|
+
/**
|
|
1070
|
+
* Who the token is for
|
|
1071
|
+
*/
|
|
1072
|
+
userId,
|
|
1073
|
+
/**
|
|
1074
|
+
* What custom authentication wants remembered
|
|
1075
|
+
*/
|
|
1076
|
+
authCookie: cookie,
|
|
1077
|
+
/**
|
|
1078
|
+
* Bit flags the servers pass along
|
|
1079
|
+
*/
|
|
1080
|
+
flags: packet.flags ?? 0,
|
|
1081
|
+
/**
|
|
1082
|
+
* Custom unless the client said otherwise
|
|
1083
|
+
*/
|
|
1084
|
+
customAuthProvider:
|
|
1085
|
+
credentials?.authentication?.type ?? CustomAuthenticationType.CUSTOM,
|
|
1086
|
+
...(application === null ? {} : { applicationId: application }),
|
|
1087
|
+
...(version === null ? {} : { applicationVersion: version }),
|
|
1088
|
+
})
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
/**
|
|
1092
|
+
* A token as the value a client is sent
|
|
1093
|
+
* @param token what to seal
|
|
1094
|
+
*/
|
|
1095
|
+
private sealed(token: AuthToken): PhotonValue {
|
|
1096
|
+
const authority = this.services.authority
|
|
1097
|
+
if (authority === null) {
|
|
1098
|
+
throw new Error(ErrorMessage.AUTH_TOKEN_TYPE_NOT_SUPPORTED)
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
return PhotonValue.string(authority.seal(token, false))
|
|
1102
|
+
}
|
|
1103
|
+
}
|