@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,1163 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AttributeKey,
|
|
3
|
+
ByteBuf,
|
|
4
|
+
ConsoleLogger,
|
|
5
|
+
type Channel,
|
|
6
|
+
type Logger,
|
|
7
|
+
} from '@netifyjs/netify'
|
|
8
|
+
|
|
9
|
+
import type { Session } from '../../../dispatch/session/index.ts'
|
|
10
|
+
import type { Protocol } from '../../../protocol/index.ts'
|
|
11
|
+
import type { Fanout } from '../../../scale/fanout/index.ts'
|
|
12
|
+
import { Offender } from '../../pro/counters/offender/index.ts'
|
|
13
|
+
import type { CounterStore } from '../../pro/counters/store/index.ts'
|
|
14
|
+
import { Sequence } from '../../pro/sequence/index.ts'
|
|
15
|
+
import { Bans } from '../ban/list/index.ts'
|
|
16
|
+
import { MemoryBanStore } from '../ban/memory/index.ts'
|
|
17
|
+
import type { BanModeId } from '../ban/record/index.ts'
|
|
18
|
+
import { BlueBox } from '../bluebox/gateway/index.ts'
|
|
19
|
+
import { Buddies } from '../buddies/index.ts'
|
|
20
|
+
import { Chat } from '../chat/index.ts'
|
|
21
|
+
import { SmartFox2XCodec } from '../codec/index.ts'
|
|
22
|
+
import type {
|
|
23
|
+
Authenticator,
|
|
24
|
+
ClusterBalancer,
|
|
25
|
+
PrivilegeProfile,
|
|
26
|
+
ZoneConfig,
|
|
27
|
+
} from '../config/index.ts'
|
|
28
|
+
import { Privilege, type PrivilegeId } from '../entity/privilege/index.ts'
|
|
29
|
+
import { Room } from '../entity/room/index.ts'
|
|
30
|
+
import { User } from '../entity/user/index.ts'
|
|
31
|
+
import { FloodFilter } from '../flood/index.ts'
|
|
32
|
+
import { SharedFloodFilter } from '../flood/shared/index.ts'
|
|
33
|
+
import { Games } from '../games/index.ts'
|
|
34
|
+
import type { Hall } from '../hall/index.ts'
|
|
35
|
+
import { LoginAttempt } from '../login/attempt/index.ts'
|
|
36
|
+
import { LoginVerdict } from '../login/verdict/index.ts'
|
|
37
|
+
import { Member } from '../member/index.ts'
|
|
38
|
+
import { ErrorCode } from '../packet/error/codes/index.ts'
|
|
39
|
+
import { SfsError } from '../packet/error/index.ts'
|
|
40
|
+
import { UserCountChangeEvent } from '../packet/event/count/index.ts'
|
|
41
|
+
import { ClientDisconnectionEvent } from '../packet/event/disconnection/index.ts'
|
|
42
|
+
import { UserLostEvent } from '../packet/event/lost/user/index.ts'
|
|
43
|
+
import type { LoginRequest } from '../packet/login/request/index.ts'
|
|
44
|
+
import { LoginResponse } from '../packet/login/response/index.ts'
|
|
45
|
+
import { BanMode } from '../packet/moderation/ban/request/index.ts'
|
|
46
|
+
import { LogoutResponse } from '../packet/logout/response/index.ts'
|
|
47
|
+
import { GenericMessageResponse } from '../packet/message/response/index.ts'
|
|
48
|
+
import { Proximity } from '../proximity/index.ts'
|
|
49
|
+
import { Rooms } from '../rooms/index.ts'
|
|
50
|
+
import { WebSocketBridge } from '../websocket/index.ts'
|
|
51
|
+
import { WordsFilter } from '../words/index.ts'
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A user who lost their connection and may still come back
|
|
55
|
+
*/
|
|
56
|
+
type Frozen = {
|
|
57
|
+
/**
|
|
58
|
+
* Who's away
|
|
59
|
+
*/
|
|
60
|
+
readonly member: Member
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Gives up on them
|
|
64
|
+
*/
|
|
65
|
+
readonly timer: Timer
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* One zone: its users, its rooms and the rules they play by
|
|
70
|
+
* @class
|
|
71
|
+
*/
|
|
72
|
+
export class Zone {
|
|
73
|
+
/**
|
|
74
|
+
* Where each connection keeps whether whole frames go straight to its socket
|
|
75
|
+
*/
|
|
76
|
+
private static readonly plain: AttributeKey<boolean> =
|
|
77
|
+
new AttributeKey<boolean>('netify:protocol:x2:plain')
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* What each kind of user may do unless the config says otherwise
|
|
81
|
+
*/
|
|
82
|
+
public static readonly defaultPrivileges: Readonly<
|
|
83
|
+
Record<number, PrivilegeProfile>
|
|
84
|
+
> = {
|
|
85
|
+
[Privilege.GUEST]: {
|
|
86
|
+
denied: [
|
|
87
|
+
'CreateRoom',
|
|
88
|
+
'PrivateMessage',
|
|
89
|
+
'SetRoomVariables',
|
|
90
|
+
'SetUserVariables',
|
|
91
|
+
'ChangeRoomName',
|
|
92
|
+
'ChangeRoomPassword',
|
|
93
|
+
'ChangeRoomCapacity',
|
|
94
|
+
'InitBuddyList',
|
|
95
|
+
'AddBuddy',
|
|
96
|
+
'BlockBuddy',
|
|
97
|
+
'RemoveBuddy',
|
|
98
|
+
'SetBuddyVariables',
|
|
99
|
+
'GoOnline',
|
|
100
|
+
'BuddyMessage',
|
|
101
|
+
'ModeratorMessage',
|
|
102
|
+
'AdminMessage',
|
|
103
|
+
'KickUser',
|
|
104
|
+
'BanUser',
|
|
105
|
+
],
|
|
106
|
+
superUser: false,
|
|
107
|
+
},
|
|
108
|
+
[Privilege.STANDARD]: {
|
|
109
|
+
denied: ['ModeratorMessage', 'AdminMessage', 'KickUser', 'BanUser'],
|
|
110
|
+
superUser: false,
|
|
111
|
+
},
|
|
112
|
+
[Privilege.MODERATOR]: {
|
|
113
|
+
denied: ['AdminMessage'],
|
|
114
|
+
superUser: true,
|
|
115
|
+
},
|
|
116
|
+
[Privilege.ADMINISTRATOR]: {
|
|
117
|
+
denied: [],
|
|
118
|
+
superUser: true,
|
|
119
|
+
},
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Name clients log in with
|
|
124
|
+
*/
|
|
125
|
+
public readonly name: string
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Most users online at once
|
|
129
|
+
*/
|
|
130
|
+
public readonly maxUsers: number
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Most rooms at once
|
|
134
|
+
*/
|
|
135
|
+
public readonly maxRooms: number
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Seconds a dropped user may take to reconnect
|
|
139
|
+
*/
|
|
140
|
+
public readonly reconnectionSeconds: number
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Seconds a user may stay silent
|
|
144
|
+
*/
|
|
145
|
+
public readonly maxUserIdle: number
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Shortest time between head count updates for one room, in ms
|
|
149
|
+
*/
|
|
150
|
+
public readonly userCountInterval: number
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Shortest room name
|
|
154
|
+
*/
|
|
155
|
+
public readonly minRoomNameLength: number
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Longest room name
|
|
159
|
+
*/
|
|
160
|
+
public readonly maxRoomNameLength: number
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Rooms one user may make per session
|
|
164
|
+
*/
|
|
165
|
+
public readonly maxRoomsPerUser: number
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Variables one user may hold
|
|
169
|
+
*/
|
|
170
|
+
public readonly maxUserVariables: number
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Variables one room may hold
|
|
174
|
+
*/
|
|
175
|
+
public readonly maxRoomVariables: number
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Rooms one user may be in at once
|
|
179
|
+
*/
|
|
180
|
+
public readonly maxJoinedRooms: number
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Every group clients may subscribe to
|
|
184
|
+
*/
|
|
185
|
+
public readonly groups: Set<string>
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Groups a user is subscribed to at login
|
|
189
|
+
*/
|
|
190
|
+
public readonly defaultGroups: readonly string[]
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Everyone logged in, by id
|
|
194
|
+
*/
|
|
195
|
+
public readonly members: Map<number, Member>
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Every room, by id
|
|
199
|
+
*/
|
|
200
|
+
public readonly halls: Map<number, Hall>
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Names and addresses that can't log in
|
|
204
|
+
*/
|
|
205
|
+
public readonly bans: Bans
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Finds words nobody gets to say, or null
|
|
209
|
+
*/
|
|
210
|
+
public readonly words: WordsFilter | null
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Counts requests per second, or null
|
|
214
|
+
*/
|
|
215
|
+
public readonly flood: FloodFilter | null
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* The flood filter if it counts in the counter store, or null
|
|
219
|
+
*/
|
|
220
|
+
public readonly shared: SharedFloodFilter | null
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Where warnings and kicks are counted, or null
|
|
224
|
+
*/
|
|
225
|
+
public readonly counters: CounterStore | null
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Hears about stores that fail
|
|
229
|
+
*/
|
|
230
|
+
public readonly logger: Logger
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Sends users to game nodes, or null
|
|
234
|
+
*/
|
|
235
|
+
public readonly cluster: ClusterBalancer | null
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Creating, joining, leaving and changing rooms
|
|
239
|
+
*/
|
|
240
|
+
public readonly rooms: Rooms
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Messages between users
|
|
244
|
+
*/
|
|
245
|
+
public readonly chat: Chat
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Buddy lists
|
|
249
|
+
*/
|
|
250
|
+
public readonly buddies: Buddies
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Invitations and managed games
|
|
254
|
+
*/
|
|
255
|
+
public readonly games: Games
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Who sees whom in MMO rooms
|
|
259
|
+
*/
|
|
260
|
+
public readonly proximity: Proximity
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Hands out user ids
|
|
264
|
+
*/
|
|
265
|
+
public readonly userIds: Sequence
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Hands out room ids
|
|
269
|
+
*/
|
|
270
|
+
public readonly roomIds: Sequence
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Who server notices are signed by
|
|
274
|
+
*/
|
|
275
|
+
public readonly server: User
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Whether a login with no name gets a guest name
|
|
279
|
+
*/
|
|
280
|
+
private readonly guests: boolean
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* What guest names start with
|
|
284
|
+
*/
|
|
285
|
+
private readonly guestPrefix: string
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Whether a second login under a name throws out the first
|
|
289
|
+
*/
|
|
290
|
+
private readonly forceLogout: boolean
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Checks every login, or null
|
|
294
|
+
*/
|
|
295
|
+
private readonly authenticator: Authenticator | null
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Privilege a named user gets
|
|
299
|
+
*/
|
|
300
|
+
private readonly defaultPrivilege: PrivilegeId
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* What each kind of user may do, by privilege id
|
|
304
|
+
*/
|
|
305
|
+
private readonly privileges: Readonly<Record<number, PrivilegeProfile>>
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Everyone logged in, by name
|
|
309
|
+
*/
|
|
310
|
+
private readonly names: Map<string, Member>
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Every room, by name
|
|
314
|
+
*/
|
|
315
|
+
private readonly hallNames: Map<string, Hall>
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Users who may still reconnect, by session token
|
|
319
|
+
*/
|
|
320
|
+
private readonly frozen: Map<string, Frozen>
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Sends broadcasts to users on other shards, or null
|
|
324
|
+
*/
|
|
325
|
+
private readonly fanout: Fanout | null
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Encodes a broadcast once for everyone, or null
|
|
329
|
+
*/
|
|
330
|
+
private readonly protocol: Protocol | null
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* @param name name clients log in with
|
|
334
|
+
* @param config how the zone is set up
|
|
335
|
+
* @param userIds hands out user ids
|
|
336
|
+
* @param roomIds hands out room ids
|
|
337
|
+
* @param fanout sends broadcasts to users on other shards, or null
|
|
338
|
+
* @param protocol encodes a broadcast once for everyone, or null
|
|
339
|
+
*/
|
|
340
|
+
private constructor(
|
|
341
|
+
name: string,
|
|
342
|
+
config: ZoneConfig,
|
|
343
|
+
userIds: Sequence,
|
|
344
|
+
roomIds: Sequence,
|
|
345
|
+
fanout: Fanout | null,
|
|
346
|
+
protocol: Protocol | null,
|
|
347
|
+
) {
|
|
348
|
+
this.name = name
|
|
349
|
+
this.fanout = fanout
|
|
350
|
+
this.protocol = protocol
|
|
351
|
+
this.maxUsers = config.maxUsers ?? 1000
|
|
352
|
+
this.maxRooms = config.maxRooms ?? 500
|
|
353
|
+
this.reconnectionSeconds = config.reconnectionSeconds ?? 0
|
|
354
|
+
this.maxUserIdle = config.maxUserIdle ?? 300
|
|
355
|
+
this.userCountInterval = config.userCountInterval ?? 1000
|
|
356
|
+
this.minRoomNameLength = config.minRoomNameLength ?? 3
|
|
357
|
+
this.maxRoomNameLength = config.maxRoomNameLength ?? 10
|
|
358
|
+
this.maxRoomsPerUser = config.maxRoomsPerUser ?? 5
|
|
359
|
+
this.maxUserVariables = config.maxUserVariables ?? 5
|
|
360
|
+
this.maxRoomVariables = config.maxRoomVariables ?? 5
|
|
361
|
+
this.maxJoinedRooms = config.maxJoinedRooms ?? 10
|
|
362
|
+
this.groups = new Set<string>(config.groups ?? [Room.defaultGroup])
|
|
363
|
+
this.defaultGroups = config.defaultGroups ?? [Room.defaultGroup]
|
|
364
|
+
this.members = new Map<number, Member>()
|
|
365
|
+
this.halls = new Map<number, Hall>()
|
|
366
|
+
this.counters = config.counters ?? null
|
|
367
|
+
this.logger = config.logger ?? new ConsoleLogger()
|
|
368
|
+
this.bans = new Bans(
|
|
369
|
+
name,
|
|
370
|
+
config.bans ?? new MemoryBanStore(),
|
|
371
|
+
this.logger,
|
|
372
|
+
config.banOutage === 'refuse',
|
|
373
|
+
)
|
|
374
|
+
this.words =
|
|
375
|
+
config.words === undefined ? null : new WordsFilter(config.words)
|
|
376
|
+
this.shared =
|
|
377
|
+
config.flood?.shared === true ? new SharedFloodFilter(config.flood) : null
|
|
378
|
+
this.flood =
|
|
379
|
+
this.shared ??
|
|
380
|
+
(config.flood === undefined ? null : new FloodFilter(config.flood))
|
|
381
|
+
if (this.shared !== null && this.counters === null) {
|
|
382
|
+
throw new RangeError('Counter store is missing')
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
this.cluster = config.cluster ?? null
|
|
386
|
+
this.userIds = userIds
|
|
387
|
+
this.roomIds = roomIds
|
|
388
|
+
this.server = User.of(-1, 'Server', Privilege.ADMINISTRATOR)
|
|
389
|
+
this.guests = config.guests ?? true
|
|
390
|
+
this.guestPrefix = config.guestPrefix ?? 'Guest#'
|
|
391
|
+
this.forceLogout = config.forceLogout ?? true
|
|
392
|
+
this.authenticator = config.authenticator ?? null
|
|
393
|
+
this.defaultPrivilege = config.defaultPrivilege ?? Privilege.STANDARD
|
|
394
|
+
this.privileges = { ...Zone.defaultPrivileges, ...config.privileges }
|
|
395
|
+
this.names = new Map<string, Member>()
|
|
396
|
+
this.hallNames = new Map<string, Hall>()
|
|
397
|
+
this.frozen = new Map<string, Frozen>()
|
|
398
|
+
|
|
399
|
+
for (const group of this.defaultGroups) {
|
|
400
|
+
this.groups.add(group)
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
this.rooms = new Rooms(this)
|
|
404
|
+
this.chat = new Chat(this)
|
|
405
|
+
this.buddies = new Buddies(this, config.buddies ?? null)
|
|
406
|
+
this.games = new Games(this)
|
|
407
|
+
this.proximity = new Proximity(this)
|
|
408
|
+
|
|
409
|
+
for (const room of config.rooms ?? []) {
|
|
410
|
+
this.groups.add(room.groupId ?? Room.defaultGroup)
|
|
411
|
+
this.rooms.open(room)
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* A zone with the rooms its config lists
|
|
417
|
+
* @param name name clients log in with
|
|
418
|
+
* @param config how the zone is set up
|
|
419
|
+
* @param userIds hands out user ids
|
|
420
|
+
* @param roomIds hands out room ids
|
|
421
|
+
* @param fanout sends broadcasts to users on other shards, or null
|
|
422
|
+
* @param protocol encodes a broadcast once for everyone, or null
|
|
423
|
+
*/
|
|
424
|
+
public static of(
|
|
425
|
+
name: string,
|
|
426
|
+
config: ZoneConfig = {},
|
|
427
|
+
userIds: Sequence = new Sequence(),
|
|
428
|
+
roomIds: Sequence = new Sequence(),
|
|
429
|
+
fanout: Fanout | null = null,
|
|
430
|
+
protocol: Protocol | null = null,
|
|
431
|
+
): Zone {
|
|
432
|
+
return new Zone(name, config, userIds, roomIds, fanout, protocol)
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* An error as clients are told
|
|
437
|
+
* @param code index into the client's table of error messages
|
|
438
|
+
* @param params values the client puts into the message
|
|
439
|
+
*/
|
|
440
|
+
public error(code: number, ...params: (string | number)[]): SfsError {
|
|
441
|
+
return SfsError.of(code, params.map(String))
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* A user by id, or null
|
|
446
|
+
* @param id their user id
|
|
447
|
+
*/
|
|
448
|
+
public find(id: number): Member | null {
|
|
449
|
+
return this.members.get(id) ?? null
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* A user by name, or null
|
|
454
|
+
* @param name the name they play under
|
|
455
|
+
*/
|
|
456
|
+
public named(name: string): Member | null {
|
|
457
|
+
return this.names.get(name) ?? null
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* A room by id, or null
|
|
462
|
+
* @param id its room id
|
|
463
|
+
*/
|
|
464
|
+
public hall(id: number): Hall | null {
|
|
465
|
+
return this.halls.get(id) ?? null
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* A room by name, or null
|
|
470
|
+
* @param name its room name
|
|
471
|
+
*/
|
|
472
|
+
public hallNamed(name: string): Hall | null {
|
|
473
|
+
return this.hallNames.get(name) ?? null
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Adds a room to the zone's lists
|
|
478
|
+
* @param hall the new room
|
|
479
|
+
*/
|
|
480
|
+
public enlist(hall: Hall): void {
|
|
481
|
+
this.halls.set(hall.id, hall)
|
|
482
|
+
this.hallNames.set(hall.name, hall)
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Takes a room off the zone's lists
|
|
487
|
+
* @param hall the room that's going
|
|
488
|
+
*/
|
|
489
|
+
public delist(hall: Hall): void {
|
|
490
|
+
this.halls.delete(hall.id)
|
|
491
|
+
this.hallNames.delete(hall.name)
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Gives a room a new name
|
|
496
|
+
* @param hall the room
|
|
497
|
+
* @param name what it's called from now on
|
|
498
|
+
*/
|
|
499
|
+
public rename(hall: Hall, name: string): void {
|
|
500
|
+
this.hallNames.delete(hall.name)
|
|
501
|
+
hall.room.name = name
|
|
502
|
+
this.hallNames.set(name, hall)
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Everyone who follows a group's room list
|
|
507
|
+
* @param group the group id
|
|
508
|
+
*/
|
|
509
|
+
public subscribers(group: string): Member[] {
|
|
510
|
+
return [...this.members.values()].filter((member: Member): boolean =>
|
|
511
|
+
member.groups.has(group),
|
|
512
|
+
)
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Everyone who should hear about a change to a room
|
|
517
|
+
* @param hall the room
|
|
518
|
+
*/
|
|
519
|
+
public audience(hall: Hall): Set<Member> {
|
|
520
|
+
const audience = new Set<Member>(hall.members.values())
|
|
521
|
+
if (hall.room.hidden) return audience
|
|
522
|
+
|
|
523
|
+
for (const member of this.subscribers(hall.room.groupId)) {
|
|
524
|
+
audience.add(member)
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
return audience
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Sends one packet to several users
|
|
532
|
+
* @param members who gets it
|
|
533
|
+
* @param packet what to send
|
|
534
|
+
* @param except someone to leave out, or null
|
|
535
|
+
*/
|
|
536
|
+
public tell(
|
|
537
|
+
members: Iterable<Member>,
|
|
538
|
+
packet: object,
|
|
539
|
+
except: Member | null = null,
|
|
540
|
+
): void {
|
|
541
|
+
const fanout = this.fanout
|
|
542
|
+
if (fanout === null) {
|
|
543
|
+
this.share(members, packet, except)
|
|
544
|
+
return
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
const channels: Channel[] = []
|
|
548
|
+
for (const member of members) {
|
|
549
|
+
if (member === except) continue
|
|
550
|
+
|
|
551
|
+
if (member.channel === null) member.send(packet)
|
|
552
|
+
else channels.push(member.channel)
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
fanout.spread(channels, packet)
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Sends one packet to several users on this shard
|
|
560
|
+
* @param members who gets it
|
|
561
|
+
* @param packet what to send
|
|
562
|
+
* @param except someone to leave out, or null
|
|
563
|
+
*/
|
|
564
|
+
private share(
|
|
565
|
+
members: Iterable<Member>,
|
|
566
|
+
packet: object,
|
|
567
|
+
except: Member | null,
|
|
568
|
+
): void {
|
|
569
|
+
let frame: Uint8Array | null = null
|
|
570
|
+
|
|
571
|
+
for (const member of members) {
|
|
572
|
+
if (member === except) continue
|
|
573
|
+
|
|
574
|
+
const channel = member.channel
|
|
575
|
+
if (channel === null || SmartFox2XCodec.cipherOf(channel) !== null) {
|
|
576
|
+
member.send(packet)
|
|
577
|
+
continue
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
frame ??= this.frame(packet)
|
|
581
|
+
if (frame === null) member.send(packet)
|
|
582
|
+
else if (Zone.direct(channel)) channel.writeAndFlushEncodedSync(frame)
|
|
583
|
+
else channel.writeAndFlushSync(ByteBuf.wrap(frame))
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Whether whole frames go straight to a connection's socket
|
|
589
|
+
* @param channel the connection
|
|
590
|
+
*/
|
|
591
|
+
public static direct(channel: Channel): boolean {
|
|
592
|
+
const known = channel.attributes.get<boolean>(Zone.plain)
|
|
593
|
+
if (known !== null) return known
|
|
594
|
+
|
|
595
|
+
const plain =
|
|
596
|
+
!BlueBox.carries(channel) &&
|
|
597
|
+
channel.pipeline.find<WebSocketBridge>(WebSocketBridge) === null
|
|
598
|
+
channel.attributes.set<boolean>(Zone.plain, plain)
|
|
599
|
+
|
|
600
|
+
return plain
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* A packet as one frame plain connections can share, or null
|
|
605
|
+
* @param packet what to send
|
|
606
|
+
*/
|
|
607
|
+
private frame(packet: object): Uint8Array | null {
|
|
608
|
+
try {
|
|
609
|
+
return this.protocol?.encode(packet) ?? null
|
|
610
|
+
} catch {
|
|
611
|
+
return null
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Lets a user's connection share the broadcasts of a room
|
|
617
|
+
* @param member who came in
|
|
618
|
+
* @param hall the room
|
|
619
|
+
*/
|
|
620
|
+
public hear(member: Member, hall: Hall): void {
|
|
621
|
+
if (member.channel === null) return
|
|
622
|
+
|
|
623
|
+
this.fanout?.join(member.channel, `${this.name}:room:${String(hall.id)}`)
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Stops a user's connection sharing the broadcasts of a room
|
|
628
|
+
* @param member who went out
|
|
629
|
+
* @param hall the room
|
|
630
|
+
*/
|
|
631
|
+
public unhear(member: Member, hall: Hall): void {
|
|
632
|
+
if (member.channel === null) return
|
|
633
|
+
|
|
634
|
+
this.fanout?.leave(member.channel, `${this.name}:room:${String(hall.id)}`)
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Lets a user's connection share the broadcasts of a room group
|
|
639
|
+
* @param member who follows the group
|
|
640
|
+
* @param group the group id
|
|
641
|
+
*/
|
|
642
|
+
public follow(member: Member, group: string): void {
|
|
643
|
+
if (member.channel === null) return
|
|
644
|
+
|
|
645
|
+
this.fanout?.join(member.channel, `${this.name}:group:${group}`)
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Stops a user's connection sharing the broadcasts of a room group
|
|
650
|
+
* @param member who stopped following
|
|
651
|
+
* @param group the group id
|
|
652
|
+
*/
|
|
653
|
+
public unfollow(member: Member, group: string): void {
|
|
654
|
+
if (member.channel === null) return
|
|
655
|
+
|
|
656
|
+
this.fanout?.leave(member.channel, `${this.name}:group:${group}`)
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Puts a returning user's new connection on everything they share
|
|
661
|
+
* @param member who came back
|
|
662
|
+
*/
|
|
663
|
+
public rejoin(member: Member): void {
|
|
664
|
+
if (member.channel !== null) {
|
|
665
|
+
this.fanout?.join(member.channel, `${this.name}:all`)
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
for (const id of member.rooms.keys()) {
|
|
669
|
+
const hall = this.halls.get(id)
|
|
670
|
+
if (hall !== undefined) this.hear(member, hall)
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
for (const group of member.groups) this.follow(member, group)
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Whether a lost user with this token may still come back here
|
|
678
|
+
* @param token token of the session they lost
|
|
679
|
+
*/
|
|
680
|
+
public holds(token: string): boolean {
|
|
681
|
+
return this.frozen.has(token)
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Tells a room's group how many are inside, no more often than the interval
|
|
686
|
+
* @param hall the room
|
|
687
|
+
*/
|
|
688
|
+
public recount(hall: Hall): void {
|
|
689
|
+
if (!hall.room.events.allowUserCountChange || hall.room.hidden) return
|
|
690
|
+
if (hall.counting !== null) return
|
|
691
|
+
|
|
692
|
+
const wait = hall.counted + this.userCountInterval - Date.now()
|
|
693
|
+
if (wait <= 0) {
|
|
694
|
+
this.count(hall)
|
|
695
|
+
return
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
hall.counting = setTimeout((): void => {
|
|
699
|
+
hall.counting = null
|
|
700
|
+
if (this.halls.has(hall.id)) this.count(hall)
|
|
701
|
+
}, wait)
|
|
702
|
+
hall.counting.unref()
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* What a kind of user may do
|
|
707
|
+
* @param privilege a privilege id
|
|
708
|
+
*/
|
|
709
|
+
public profile(privilege: PrivilegeId): PrivilegeProfile {
|
|
710
|
+
return (
|
|
711
|
+
this.privileges[privilege] ?? {
|
|
712
|
+
denied: [],
|
|
713
|
+
superUser: false,
|
|
714
|
+
}
|
|
715
|
+
)
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* Whether a user may make a request right now
|
|
720
|
+
* @param member who's asking
|
|
721
|
+
* @param request name of the request
|
|
722
|
+
*/
|
|
723
|
+
public permits(member: Member, request: string): boolean {
|
|
724
|
+
if (member.leaving) return false
|
|
725
|
+
if (this.profile(member.privilege).denied.includes(request)) return false
|
|
726
|
+
if (this.flood === null) return true
|
|
727
|
+
if (!this.flood.floods(member.counters, request)) return true
|
|
728
|
+
|
|
729
|
+
this.flooded(member, this.flood, request)
|
|
730
|
+
return false
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Who a user's offences are counted against
|
|
735
|
+
* @param member who broke a rule
|
|
736
|
+
*/
|
|
737
|
+
public offender(member: Member): Offender {
|
|
738
|
+
return member.privilege === Privilege.GUEST
|
|
739
|
+
? Offender.addressed(this.name, member.address)
|
|
740
|
+
: Offender.named(this.name, member.name)
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* Counts a request in the counter store and says whether it's one too many
|
|
745
|
+
* @param member who sent it
|
|
746
|
+
* @param request name of the request
|
|
747
|
+
*/
|
|
748
|
+
public async crowded(member: Member, request: string): Promise<boolean> {
|
|
749
|
+
const limit = this.shared?.limit(request) ?? null
|
|
750
|
+
const counters = this.counters
|
|
751
|
+
if (limit === null || counters === null) return false
|
|
752
|
+
|
|
753
|
+
try {
|
|
754
|
+
const key = this.offender(member).counter(`flooding:rate:${request}`)
|
|
755
|
+
|
|
756
|
+
return (await counters.hit(key, 1000)) > limit
|
|
757
|
+
} catch (err) {
|
|
758
|
+
this.logger.warn({ err }, 'Counter store failed')
|
|
759
|
+
|
|
760
|
+
return false
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* Checks a login and lets the user into the zone
|
|
766
|
+
* @param session the connection
|
|
767
|
+
* @param token token the handshake gave the session
|
|
768
|
+
* @param packet zone, name and password
|
|
769
|
+
*/
|
|
770
|
+
public async login(
|
|
771
|
+
session: Session<Member>,
|
|
772
|
+
token: string,
|
|
773
|
+
packet: LoginRequest,
|
|
774
|
+
): Promise<void> {
|
|
775
|
+
const attempt = LoginAttempt.of(
|
|
776
|
+
this.name,
|
|
777
|
+
packet.name,
|
|
778
|
+
packet.password,
|
|
779
|
+
token,
|
|
780
|
+
packet.params,
|
|
781
|
+
session.channel.remoteAddress,
|
|
782
|
+
)
|
|
783
|
+
|
|
784
|
+
const verdict = await this.judge(attempt)
|
|
785
|
+
if (verdict.error !== null) {
|
|
786
|
+
session.send(LoginResponse.failure(verdict.error))
|
|
787
|
+
return
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
const guest = (verdict.name ?? attempt.name) === ''
|
|
791
|
+
const id = this.userIds.next()
|
|
792
|
+
const name = guest
|
|
793
|
+
? `${this.guestPrefix}${String(id)}`
|
|
794
|
+
: (verdict.name ?? attempt.name)
|
|
795
|
+
|
|
796
|
+
const error = await this.refusal(session, name, guest)
|
|
797
|
+
if (error !== null) {
|
|
798
|
+
session.send(LoginResponse.failure(error))
|
|
799
|
+
return
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
const member = Member.of(
|
|
803
|
+
id,
|
|
804
|
+
name,
|
|
805
|
+
verdict.privilege ?? (guest ? Privilege.GUEST : this.defaultPrivilege),
|
|
806
|
+
this.name,
|
|
807
|
+
token,
|
|
808
|
+
session.channel,
|
|
809
|
+
)
|
|
810
|
+
for (const group of this.defaultGroups) {
|
|
811
|
+
member.groups.add(group)
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
this.members.set(id, member)
|
|
815
|
+
this.names.set(name, member)
|
|
816
|
+
session.user = member
|
|
817
|
+
this.fanout?.join(session.channel, `${this.name}:all`)
|
|
818
|
+
for (const group of member.groups) this.follow(member, group)
|
|
819
|
+
|
|
820
|
+
session.send(
|
|
821
|
+
LoginResponse.success(
|
|
822
|
+
id,
|
|
823
|
+
name,
|
|
824
|
+
member.privilege,
|
|
825
|
+
this.name,
|
|
826
|
+
this.rooms.listing(member.groups),
|
|
827
|
+
this.reconnectionSeconds,
|
|
828
|
+
verdict.data,
|
|
829
|
+
),
|
|
830
|
+
)
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
/**
|
|
834
|
+
* Takes a user out of the zone and tells them so
|
|
835
|
+
* @param session the connection
|
|
836
|
+
* @param member who's logging out
|
|
837
|
+
*/
|
|
838
|
+
public logout(session: Session<Member>, member: Member): void {
|
|
839
|
+
this.depart(member)
|
|
840
|
+
session.user = null
|
|
841
|
+
session.send(LogoutResponse.of(this.name))
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Deals with a user whose connection closed
|
|
846
|
+
* @param member who went away
|
|
847
|
+
* @param resumable whether their transport can reconnect
|
|
848
|
+
*/
|
|
849
|
+
public lose(member: Member, resumable = true): void {
|
|
850
|
+
member.channel = null
|
|
851
|
+
|
|
852
|
+
const seconds = this.reconnectionSeconds
|
|
853
|
+
if (seconds <= 0 || !resumable || member.manual || member.leaving) {
|
|
854
|
+
this.depart(member)
|
|
855
|
+
return
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
const timer = setTimeout((): void => {
|
|
859
|
+
this.frozen.delete(member.token)
|
|
860
|
+
this.depart(member)
|
|
861
|
+
}, seconds * 1000)
|
|
862
|
+
timer.unref()
|
|
863
|
+
|
|
864
|
+
this.frozen.set(member.token, { member, timer })
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Takes back a user who reconnected in time, or null
|
|
869
|
+
* @param token token of the session they lost
|
|
870
|
+
*/
|
|
871
|
+
public thaw(token: string): Member | null {
|
|
872
|
+
const frozen = this.frozen.get(token)
|
|
873
|
+
if (frozen === undefined) return null
|
|
874
|
+
|
|
875
|
+
clearTimeout(frozen.timer)
|
|
876
|
+
this.frozen.delete(token)
|
|
877
|
+
|
|
878
|
+
return frozen.member
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* Warns a user and throws them out after a delay
|
|
883
|
+
* @param member who's going
|
|
884
|
+
* @param message what they're told first
|
|
885
|
+
* @param delaySeconds how long they get to read it
|
|
886
|
+
* @param moderator who did it, null for the server
|
|
887
|
+
*/
|
|
888
|
+
public kick(
|
|
889
|
+
member: Member,
|
|
890
|
+
message: string,
|
|
891
|
+
delaySeconds = 5,
|
|
892
|
+
moderator: Member | null = null,
|
|
893
|
+
): void {
|
|
894
|
+
this.expel(member, message, delaySeconds, moderator, false)
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
/**
|
|
898
|
+
* Warns a user, throws them out after a delay and keeps them out
|
|
899
|
+
* @param member who's going
|
|
900
|
+
* @param message what they're told first
|
|
901
|
+
* @param mode what the ban is tied to
|
|
902
|
+
* @param delaySeconds how long they get to read it
|
|
903
|
+
* @param minutes how long the ban lasts
|
|
904
|
+
* @param moderator who did it, null for the server
|
|
905
|
+
*/
|
|
906
|
+
public async ban(
|
|
907
|
+
member: Member,
|
|
908
|
+
message: string,
|
|
909
|
+
mode: BanModeId = BanMode.BY_NAME,
|
|
910
|
+
delaySeconds = 5,
|
|
911
|
+
minutes = 1440,
|
|
912
|
+
moderator: Member | null = null,
|
|
913
|
+
): Promise<void> {
|
|
914
|
+
if (member.leaving) return
|
|
915
|
+
|
|
916
|
+
this.expel(member, message, delaySeconds, moderator, true)
|
|
917
|
+
await this.bans.add(
|
|
918
|
+
mode,
|
|
919
|
+
mode === BanMode.BY_NAME ? member.name : member.address,
|
|
920
|
+
minutes * 60_000,
|
|
921
|
+
message,
|
|
922
|
+
)
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* Tells a user why they're cut off and hangs up
|
|
927
|
+
* @param member who's going
|
|
928
|
+
* @param event the reason as clients are told
|
|
929
|
+
*/
|
|
930
|
+
public disconnect(member: Member, event: ClientDisconnectionEvent): void {
|
|
931
|
+
member.leaving = true
|
|
932
|
+
|
|
933
|
+
const channel = member.channel
|
|
934
|
+
if (channel === null) {
|
|
935
|
+
const frozen = this.thaw(member.token)
|
|
936
|
+
if (frozen !== null) this.depart(member)
|
|
937
|
+
return
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
channel.writeAndFlushSync(event)
|
|
941
|
+
void channel.close()
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* Removes a user from every room and from the zone
|
|
946
|
+
* @param member who's gone
|
|
947
|
+
*/
|
|
948
|
+
public depart(member: Member): void {
|
|
949
|
+
if (!this.members.delete(member.id)) return
|
|
950
|
+
|
|
951
|
+
this.names.delete(member.name)
|
|
952
|
+
if (member.channel !== null) this.fanout?.forget(member.channel)
|
|
953
|
+
|
|
954
|
+
const witnesses = new Set<Member>()
|
|
955
|
+
for (const id of [...member.rooms.keys()]) {
|
|
956
|
+
const hall = this.halls.get(id)
|
|
957
|
+
if (hall === undefined) continue
|
|
958
|
+
|
|
959
|
+
for (const witness of this.rooms.witnesses(member, hall)) {
|
|
960
|
+
witnesses.add(witness)
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
this.rooms.release(member, hall)
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
this.tell(witnesses, UserLostEvent.of(member.id), member)
|
|
967
|
+
this.buddies.leave(member)
|
|
968
|
+
this.games.forget(member)
|
|
969
|
+
this.rooms.orphan(member)
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
* Deals with a request the flood filter dropped
|
|
974
|
+
* @param member who sent it
|
|
975
|
+
* @param flood the zone's flood filter
|
|
976
|
+
* @param request name of the request
|
|
977
|
+
*/
|
|
978
|
+
private flooded(member: Member, flood: FloodFilter, request: string): void {
|
|
979
|
+
if (this.shared?.waiting === true) return
|
|
980
|
+
|
|
981
|
+
if (flood.logFloodingAttempts) {
|
|
982
|
+
this.logger.warn({ user: member.name, request }, 'Request was dropped')
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
if (this.counters !== null) {
|
|
986
|
+
void this.attempted(member, flood, this.counters)
|
|
987
|
+
return
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
member.attempts += 1
|
|
991
|
+
if (member.attempts >= flood.maxFloodingAttempts) this.outlaw(member, flood)
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* Counts a dropped request in the counter store
|
|
996
|
+
* @param member who sent it
|
|
997
|
+
* @param flood the zone's flood filter
|
|
998
|
+
* @param counters where dropped requests are counted
|
|
999
|
+
*/
|
|
1000
|
+
private async attempted(
|
|
1001
|
+
member: Member,
|
|
1002
|
+
flood: FloodFilter,
|
|
1003
|
+
counters: CounterStore,
|
|
1004
|
+
): Promise<void> {
|
|
1005
|
+
const key = this.offender(member).counter('flooding:attempts')
|
|
1006
|
+
|
|
1007
|
+
let attempts: number
|
|
1008
|
+
try {
|
|
1009
|
+
attempts = await counters.hit(key, flood.banMinutes * 60_000)
|
|
1010
|
+
if (attempts >= flood.maxFloodingAttempts) await counters.clear(key)
|
|
1011
|
+
} catch (err) {
|
|
1012
|
+
this.logger.warn({ err }, 'Counter store failed')
|
|
1013
|
+
member.attempts += 1
|
|
1014
|
+
attempts = member.attempts
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
if (attempts >= flood.maxFloodingAttempts) this.outlaw(member, flood)
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Bans a user who flooded once too often
|
|
1022
|
+
* @param member who flooded
|
|
1023
|
+
* @param flood the zone's flood filter
|
|
1024
|
+
*/
|
|
1025
|
+
private outlaw(member: Member, flood: FloodFilter): void {
|
|
1026
|
+
void this.ban(
|
|
1027
|
+
member,
|
|
1028
|
+
flood.banMessage,
|
|
1029
|
+
flood.banMode,
|
|
1030
|
+
flood.delaySeconds,
|
|
1031
|
+
flood.banMinutes,
|
|
1032
|
+
)
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* Sends one head count
|
|
1037
|
+
* @param hall the room
|
|
1038
|
+
*/
|
|
1039
|
+
private count(hall: Hall): void {
|
|
1040
|
+
hall.counted = Date.now()
|
|
1041
|
+
this.tell(
|
|
1042
|
+
this.subscribers(hall.room.groupId),
|
|
1043
|
+
UserCountChangeEvent.of(
|
|
1044
|
+
hall.id,
|
|
1045
|
+
hall.room.userCount,
|
|
1046
|
+
hall.room.spectatorCount,
|
|
1047
|
+
),
|
|
1048
|
+
)
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
/**
|
|
1052
|
+
* Asks the game what it makes of a login
|
|
1053
|
+
* @param attempt what the client sent
|
|
1054
|
+
*/
|
|
1055
|
+
private async judge(attempt: LoginAttempt): Promise<LoginVerdict> {
|
|
1056
|
+
if (this.authenticator === null) return LoginVerdict.accept()
|
|
1057
|
+
|
|
1058
|
+
return this.authenticator(attempt)
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
* Why a login can't go ahead, or null
|
|
1063
|
+
* @param session the connection
|
|
1064
|
+
* @param name name the user would play under
|
|
1065
|
+
* @param guest whether they came without a name
|
|
1066
|
+
*/
|
|
1067
|
+
private async refusal(
|
|
1068
|
+
session: Session<Member>,
|
|
1069
|
+
name: string,
|
|
1070
|
+
guest: boolean,
|
|
1071
|
+
): Promise<SfsError | null> {
|
|
1072
|
+
const address = session.channel.remoteAddress
|
|
1073
|
+
|
|
1074
|
+
if (session.user !== null) {
|
|
1075
|
+
return this.error(ErrorCode.LOGIN_ALREADY_LOGGED, name, this.name)
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
if (guest && !this.guests) {
|
|
1079
|
+
return this.error(ErrorCode.LOGIN_GUEST_NOT_ALLOWED, this.name)
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
const barred = await this.bans.addressed(address)
|
|
1083
|
+
if (barred === 'unreachable') {
|
|
1084
|
+
return this.error(ErrorCode.LOGIN_INACTIVE_ZONE, this.name)
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
if (barred !== null) return this.error(ErrorCode.LOGIN_BANNED_IP, address)
|
|
1088
|
+
|
|
1089
|
+
const listed = await this.bans.named(name)
|
|
1090
|
+
if (listed === 'unreachable') {
|
|
1091
|
+
return this.error(ErrorCode.LOGIN_INACTIVE_ZONE, this.name)
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
if (listed !== null) return this.error(ErrorCode.LOGIN_BANNED_USER, name)
|
|
1095
|
+
|
|
1096
|
+
const filtered =
|
|
1097
|
+
this.words?.names === true && !guest ? this.words.apply(name) : null
|
|
1098
|
+
if (filtered !== null && filtered.found.length > 0) {
|
|
1099
|
+
return this.error(
|
|
1100
|
+
ErrorCode.LOGIN_NAME_CONTAINS_BAD_WORDS,
|
|
1101
|
+
name,
|
|
1102
|
+
filtered.text ?? '',
|
|
1103
|
+
)
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
if (this.members.size >= this.maxUsers) {
|
|
1107
|
+
return this.error(ErrorCode.LOGIN_ZONE_FULL, this.name)
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
const twin = this.names.get(name)
|
|
1111
|
+
if (twin === undefined) return null
|
|
1112
|
+
if (!this.forceLogout) {
|
|
1113
|
+
return this.error(ErrorCode.LOGIN_ALREADY_LOGGED, name, this.name)
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
twin.leaving = true
|
|
1117
|
+
const channel = twin.channel
|
|
1118
|
+
this.thaw(twin.token)
|
|
1119
|
+
this.depart(twin)
|
|
1120
|
+
if (channel !== null) void channel.close()
|
|
1121
|
+
|
|
1122
|
+
return null
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* Warns a user and schedules the hang up
|
|
1127
|
+
* @param member who's going
|
|
1128
|
+
* @param message what they're told first
|
|
1129
|
+
* @param delaySeconds how long they get to read it
|
|
1130
|
+
* @param moderator who did it, null for the server
|
|
1131
|
+
* @param banned whether it's a ban
|
|
1132
|
+
*/
|
|
1133
|
+
private expel(
|
|
1134
|
+
member: Member,
|
|
1135
|
+
message: string,
|
|
1136
|
+
delaySeconds: number,
|
|
1137
|
+
moderator: Member | null,
|
|
1138
|
+
banned: boolean,
|
|
1139
|
+
): void {
|
|
1140
|
+
if (member.leaving) return
|
|
1141
|
+
|
|
1142
|
+
member.leaving = true
|
|
1143
|
+
member.send(
|
|
1144
|
+
GenericMessageResponse.moderatorMessage(
|
|
1145
|
+
moderator === null ? this.server : moderator.view(),
|
|
1146
|
+
message,
|
|
1147
|
+
),
|
|
1148
|
+
)
|
|
1149
|
+
|
|
1150
|
+
const timer = setTimeout(
|
|
1151
|
+
(): void => {
|
|
1152
|
+
this.disconnect(
|
|
1153
|
+
member,
|
|
1154
|
+
banned
|
|
1155
|
+
? ClientDisconnectionEvent.ban()
|
|
1156
|
+
: ClientDisconnectionEvent.kick(),
|
|
1157
|
+
)
|
|
1158
|
+
},
|
|
1159
|
+
Math.max(0, delaySeconds) * 1000,
|
|
1160
|
+
)
|
|
1161
|
+
timer.unref()
|
|
1162
|
+
}
|
|
1163
|
+
}
|