dimples 1.2.7__tar.gz → 1.3.0__tar.gz
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.
- dimples-1.3.0/PKG-INFO +22 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/conn/gate.py +10 -26
- {dimples-1.2.7 → dimples-1.3.0}/dimples/conn/ws.py +53 -5
- dimples-1.3.0/dimples.egg-info/PKG-INFO +22 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples.egg-info/SOURCES.txt +0 -1
- {dimples-1.2.7 → dimples-1.3.0}/dimples.egg-info/entry_points.txt +1 -0
- dimples-1.3.0/dimples.egg-info/requires.txt +9 -0
- {dimples-1.2.7 → dimples-1.3.0}/setup.py +6 -6
- dimples-1.2.7/LICENSE +0 -21
- dimples-1.2.7/PKG-INFO +0 -31
- dimples-1.2.7/dimples.egg-info/PKG-INFO +0 -31
- dimples-1.2.7/dimples.egg-info/requires.txt +0 -9
- {dimples-1.2.7 → dimples-1.3.0}/README.md +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/archivist.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/checkpoint.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/cpu/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/cpu/commands.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/cpu/creator.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/cpu/group.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/cpu/grp_expel.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/cpu/grp_invite.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/cpu/grp_join.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/cpu/grp_query.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/cpu/grp_quit.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/cpu/grp_reset.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/cpu/grp_resign.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/cpu/handshake.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/facebook.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/messenger.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/network/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/network/session.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/network/state.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/network/transition.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/packer.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/processor.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/client/terminal.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/anonymous.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/ans.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/archivist.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/compat/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/compat/btc.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/compat/compatible.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/compat/entity.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/compat/meta.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/compat/network.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/dbi/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/dbi/account.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/dbi/message.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/dbi/session.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/facebook.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/messenger.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/packer.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/processer.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/protocol/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/protocol/ans.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/protocol/block.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/protocol/handshake.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/protocol/login.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/protocol/mute.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/protocol/report.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/register.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/common/session.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/conn/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/conn/flexible.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/conn/gatekeeper.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/conn/mars.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/conn/mtp.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/conn/protocol/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/conn/protocol/mars.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/conn/protocol/ws.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/conn/queue.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/conn/seeker.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/conn/session.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/account.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/dos/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/dos/base.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/dos/document.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/dos/group.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/dos/group_history.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/dos/group_keys.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/dos/login.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/dos/meta.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/dos/private.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/dos/station.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/dos/user.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/message.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/redis/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/redis/base.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/redis/document.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/redis/group.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/redis/grp_history.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/redis/grp_keys.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/redis/login.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/redis/message.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/redis/meta.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/redis/station.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/redis/user.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/session.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/t_base.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/t_cipherkey.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/t_document.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/t_group.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/t_group_history.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/t_group_keys.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/t_login.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/t_message.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/t_meta.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/t_private.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/t_station.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/database/t_user.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/edge/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/edge/octopus.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/edge/shared.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/edge/start.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/group/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/group/admin.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/group/builder.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/group/delegate.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/group/emitter.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/group/helper.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/group/manager.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/group/packer.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/register/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/register/base.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/register/ext.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/register/run.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/register/shared.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/archivist.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/cpu/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/cpu/ans.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/cpu/document.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/cpu/handshake.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/cpu/login.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/cpu/report.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/deliver.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/dis_roamer.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/dispatcher.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/messenger.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/packer.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/processor.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/push.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/session.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/session_center.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/server/trace.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/station/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/station/handler.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/station/shared.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/station/start.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/utils/__init__.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/utils/cache.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/utils/config.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/utils/log.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples/utils/runner.py +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples.egg-info/dependency_links.txt +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/dimples.egg-info/top_level.txt +0 -0
- {dimples-1.2.7 → dimples-1.3.0}/setup.cfg +0 -0
dimples-1.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: dimples
|
|
3
|
+
Version: 1.3.0
|
|
4
|
+
Summary: DIMP Library for Edges and Stations
|
|
5
|
+
Home-page: https://github.com/dimchat/demo-py
|
|
6
|
+
Author: Albert Moky
|
|
7
|
+
Author-email: albert.moky@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Description: # DIMP Library for Edges and Stations (Python version)
|
|
10
|
+
|
|
11
|
+
[](https://github.com/dimchat/demo-py/blob/master/LICENSE)
|
|
12
|
+
[](https://github.com/dimchat/demo-py/wiki)
|
|
13
|
+
[](https://github.com/dimchat/demo-py/pulls)
|
|
14
|
+
[](https://github.com/dimchat/demo-py/wiki)
|
|
15
|
+
|
|
16
|
+
Copyright © 2018-2022 Albert Moky
|
|
17
|
+
|
|
18
|
+
Platform: UNKNOWN
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
# ==============================================================================
|
|
30
30
|
|
|
31
31
|
import socket
|
|
32
|
-
import threading
|
|
33
32
|
from abc import ABC
|
|
34
33
|
from typing import Generic, TypeVar, Optional, Union
|
|
35
34
|
|
|
@@ -38,7 +37,7 @@ from startrek.net.state import StateOrder
|
|
|
38
37
|
from startrek import Hub
|
|
39
38
|
from startrek import Connection, ConnectionState, ActiveConnection
|
|
40
39
|
from startrek import Porter, PorterStatus, PorterDelegate
|
|
41
|
-
from startrek import Arrival,
|
|
40
|
+
from startrek import Arrival, StarGate
|
|
42
41
|
|
|
43
42
|
from ..utils import Logging
|
|
44
43
|
|
|
@@ -57,7 +56,6 @@ class CommonGate(StarGate, Logging, Generic[H], ABC):
|
|
|
57
56
|
def __init__(self, delegate: PorterDelegate):
|
|
58
57
|
super().__init__(delegate=delegate)
|
|
59
58
|
self.__hub: H = None
|
|
60
|
-
self.__lock = threading.Lock()
|
|
61
59
|
|
|
62
60
|
@property
|
|
63
61
|
def hub(self) -> H:
|
|
@@ -92,29 +90,15 @@ class CommonGate(StarGate, Logging, Generic[H], ABC):
|
|
|
92
90
|
else:
|
|
93
91
|
return docker.status
|
|
94
92
|
|
|
95
|
-
async def fetch_porter(self, remote: SocketAddress, local: Optional[SocketAddress]) -> Porter:
|
|
96
|
-
#
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
worker = old
|
|
105
|
-
if old is None:
|
|
106
|
-
hub = self.hub
|
|
107
|
-
assert isinstance(hub, Hub), 'gate hub error: %s' % hub
|
|
108
|
-
conn = await hub.connect(remote=remote, local=local)
|
|
109
|
-
if conn is None:
|
|
110
|
-
# assert False, 'failed to get connection: %s -> %s' % (local, remote)
|
|
111
|
-
self._remove_porter(worker, remote=remote, local=local)
|
|
112
|
-
worker = None
|
|
113
|
-
else:
|
|
114
|
-
assert isinstance(worker, StarPorter), 'docker error: %s, %s' % (remote, worker)
|
|
115
|
-
# set connection for this docker
|
|
116
|
-
await worker.set_connection(conn)
|
|
117
|
-
return worker
|
|
93
|
+
async def fetch_porter(self, remote: SocketAddress, local: Optional[SocketAddress]) -> Optional[Porter]:
|
|
94
|
+
# get connection from hub
|
|
95
|
+
hub = self.hub
|
|
96
|
+
assert isinstance(hub, Hub), 'gate hub error: %s' % hub
|
|
97
|
+
conn = await hub.connect(remote=remote, local=local)
|
|
98
|
+
if conn is not None:
|
|
99
|
+
# connected, get docker with this connection
|
|
100
|
+
return await self._dock(connection=conn, create_porter=True)
|
|
101
|
+
assert False, 'failed to get connection: %s -> %s' % (local, remote)
|
|
118
102
|
|
|
119
103
|
async def send_response(self, payload: bytes, ship: Arrival,
|
|
120
104
|
remote: SocketAddress, local: Optional[SocketAddress]) -> bool:
|
|
@@ -61,7 +61,9 @@ class WSArrival(ArrivalShip):
|
|
|
61
61
|
|
|
62
62
|
@property # Override
|
|
63
63
|
def sn(self) -> bytes:
|
|
64
|
-
|
|
64
|
+
data = self.__payload
|
|
65
|
+
sn = _fetch_sig_or_time(data=data)
|
|
66
|
+
return data if sn is None else sn
|
|
65
67
|
|
|
66
68
|
# Override
|
|
67
69
|
def assemble(self, ship):
|
|
@@ -71,11 +73,12 @@ class WSArrival(ArrivalShip):
|
|
|
71
73
|
|
|
72
74
|
class WSDeparture(DepartureShip):
|
|
73
75
|
|
|
74
|
-
def __init__(self, package: bytes, payload: bytes, priority: int = 0):
|
|
76
|
+
def __init__(self, package: bytes, payload: bytes, priority: int = 0, important: bool = False):
|
|
75
77
|
super().__init__(priority=priority, max_tries=1)
|
|
76
78
|
self.__fragments = [package]
|
|
77
79
|
self.__package = package
|
|
78
80
|
self.__payload = payload
|
|
81
|
+
self.__important = important
|
|
79
82
|
|
|
80
83
|
@property
|
|
81
84
|
def package(self) -> bytes:
|
|
@@ -87,7 +90,9 @@ class WSDeparture(DepartureShip):
|
|
|
87
90
|
|
|
88
91
|
@property # Override
|
|
89
92
|
def sn(self) -> bytes:
|
|
90
|
-
|
|
93
|
+
data = self.__payload
|
|
94
|
+
sn = _fetch_sig_or_time(data=data)
|
|
95
|
+
return data if sn is None else sn
|
|
91
96
|
|
|
92
97
|
@property # Override
|
|
93
98
|
def fragments(self) -> List[bytes]:
|
|
@@ -102,7 +107,43 @@ class WSDeparture(DepartureShip):
|
|
|
102
107
|
|
|
103
108
|
@property
|
|
104
109
|
def is_important(self) -> bool:
|
|
105
|
-
return
|
|
110
|
+
return self.__important
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def _fetch_sig_or_time(data: bytes) -> Optional[bytes]:
|
|
114
|
+
sn = _fetch_value(data=data, tag=b'signature')
|
|
115
|
+
if sn is None:
|
|
116
|
+
sn = _fetch_value(data=data, tag=b'time')
|
|
117
|
+
return sn
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _fetch_value(data: bytes, tag: bytes) -> Optional[bytes]:
|
|
121
|
+
tag_len = len(tag)
|
|
122
|
+
if tag_len == 0:
|
|
123
|
+
return None
|
|
124
|
+
# search tag
|
|
125
|
+
pos = data.find(tag)
|
|
126
|
+
if pos < 0:
|
|
127
|
+
return None
|
|
128
|
+
else:
|
|
129
|
+
pos += tag_len
|
|
130
|
+
# skip to start of value
|
|
131
|
+
pos = data.find(b':', pos)
|
|
132
|
+
if pos < 0:
|
|
133
|
+
return None
|
|
134
|
+
else:
|
|
135
|
+
pos += 1
|
|
136
|
+
# find end value
|
|
137
|
+
end = data.find(b',', pos)
|
|
138
|
+
if end < 0:
|
|
139
|
+
end = data.find(b'}', pos)
|
|
140
|
+
if end < 0:
|
|
141
|
+
return None
|
|
142
|
+
value = data[pos:end]
|
|
143
|
+
value = value.strip(b' ')
|
|
144
|
+
value = value.strip(b'"')
|
|
145
|
+
value = value.strip(b"'")
|
|
146
|
+
return value
|
|
106
147
|
|
|
107
148
|
|
|
108
149
|
class WSPorter(PlainPorter, DeparturePacker):
|
|
@@ -116,6 +157,7 @@ class WSPorter(PlainPorter, DeparturePacker):
|
|
|
116
157
|
self.__chunks = b''
|
|
117
158
|
self.__chunks_lock = threading.RLock()
|
|
118
159
|
self.__package_received = False
|
|
160
|
+
self.__ack_enable = False
|
|
119
161
|
|
|
120
162
|
def _parse_package(self, data: bytes) -> Tuple[Optional[bytes], Optional[bytes], int]:
|
|
121
163
|
conn = self.connection
|
|
@@ -208,6 +250,11 @@ class WSPorter(PlainPorter, DeparturePacker):
|
|
|
208
250
|
elif body == OK:
|
|
209
251
|
# should not happen
|
|
210
252
|
return None
|
|
253
|
+
if body.startswith(b'ACK:'):
|
|
254
|
+
# respond for message
|
|
255
|
+
await self._check_response(ship=ship)
|
|
256
|
+
self.__ack_enable = True
|
|
257
|
+
return None
|
|
211
258
|
# NOTICE: the delegate must respond to client in current request,
|
|
212
259
|
# cause it's a HTTP connection
|
|
213
260
|
return ship
|
|
@@ -220,7 +267,8 @@ class WSPorter(PlainPorter, DeparturePacker):
|
|
|
220
267
|
# Override
|
|
221
268
|
def pack(self, payload: bytes, priority: int = 0) -> Optional[Departure]:
|
|
222
269
|
req_pack = WebSocket.pack(payload=payload)
|
|
223
|
-
|
|
270
|
+
important = self.__ack_enable
|
|
271
|
+
return WSDeparture(package=req_pack, payload=payload, priority=priority, important=important)
|
|
224
272
|
|
|
225
273
|
@classmethod
|
|
226
274
|
def check(cls, data: bytes) -> bool:
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: dimples
|
|
3
|
+
Version: 1.3.0
|
|
4
|
+
Summary: DIMP Library for Edges and Stations
|
|
5
|
+
Home-page: https://github.com/dimchat/demo-py
|
|
6
|
+
Author: Albert Moky
|
|
7
|
+
Author-email: albert.moky@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Description: # DIMP Library for Edges and Stations (Python version)
|
|
10
|
+
|
|
11
|
+
[](https://github.com/dimchat/demo-py/blob/master/LICENSE)
|
|
12
|
+
[](https://github.com/dimchat/demo-py/wiki)
|
|
13
|
+
[](https://github.com/dimchat/demo-py/pulls)
|
|
14
|
+
[](https://github.com/dimchat/demo-py/wiki)
|
|
15
|
+
|
|
16
|
+
Copyright © 2018-2022 Albert Moky
|
|
17
|
+
|
|
18
|
+
Platform: UNKNOWN
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
@@ -14,7 +14,7 @@ import io
|
|
|
14
14
|
|
|
15
15
|
from setuptools import setup, find_packages
|
|
16
16
|
|
|
17
|
-
__version__ = '1.
|
|
17
|
+
__version__ = '1.3.0'
|
|
18
18
|
__author__ = 'Albert Moky'
|
|
19
19
|
__contact__ = 'albert.moky@gmail.com'
|
|
20
20
|
|
|
@@ -51,12 +51,12 @@ setup(
|
|
|
51
51
|
# 'pycryptodome', # 3.14.1
|
|
52
52
|
# 'base58', # 1.0.3
|
|
53
53
|
# 'ecdsa', # 0.16.1
|
|
54
|
-
'dimplugins>=2.
|
|
54
|
+
'dimplugins>=2.1.0',
|
|
55
55
|
|
|
56
|
-
'dimsdk>=2.
|
|
57
|
-
'dimp>=2.
|
|
58
|
-
'dkd>=2.
|
|
59
|
-
'mkm>=2.
|
|
56
|
+
'dimsdk>=2.1.0',
|
|
57
|
+
'dimp>=2.1.0',
|
|
58
|
+
'dkd>=2.1.0',
|
|
59
|
+
'mkm>=2.1.0',
|
|
60
60
|
|
|
61
61
|
'startrek>=2.2.0',
|
|
62
62
|
'tcp>=2.2.0',
|
dimples-1.2.7/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Albert Moky
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
dimples-1.2.7/PKG-INFO
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: dimples
|
|
3
|
-
Version: 1.2.7
|
|
4
|
-
Summary: DIMP Library for Edges and Stations
|
|
5
|
-
Home-page: https://github.com/dimchat/demo-py
|
|
6
|
-
Author: Albert Moky
|
|
7
|
-
Author-email: albert.moky@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
|
-
Description-Content-Type: text/markdown
|
|
13
|
-
License-File: LICENSE
|
|
14
|
-
Requires-Dist: dimplugins>=2.0.0
|
|
15
|
-
Requires-Dist: dimsdk>=2.0.0
|
|
16
|
-
Requires-Dist: dimp>=2.0.0
|
|
17
|
-
Requires-Dist: dkd>=2.0.0
|
|
18
|
-
Requires-Dist: mkm>=2.0.0
|
|
19
|
-
Requires-Dist: startrek>=2.2.0
|
|
20
|
-
Requires-Dist: tcp>=2.2.0
|
|
21
|
-
Requires-Dist: udp>=2.2.0
|
|
22
|
-
Requires-Dist: aiou>=0.3.0
|
|
23
|
-
|
|
24
|
-
# DIMP Library for Edges and Stations (Python version)
|
|
25
|
-
|
|
26
|
-
[](https://github.com/dimchat/demo-py/blob/master/LICENSE)
|
|
27
|
-
[](https://github.com/dimchat/demo-py/wiki)
|
|
28
|
-
[](https://github.com/dimchat/demo-py/pulls)
|
|
29
|
-
[](https://github.com/dimchat/demo-py/wiki)
|
|
30
|
-
|
|
31
|
-
Copyright © 2018-2022 Albert Moky
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: dimples
|
|
3
|
-
Version: 1.2.7
|
|
4
|
-
Summary: DIMP Library for Edges and Stations
|
|
5
|
-
Home-page: https://github.com/dimchat/demo-py
|
|
6
|
-
Author: Albert Moky
|
|
7
|
-
Author-email: albert.moky@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
|
-
Description-Content-Type: text/markdown
|
|
13
|
-
License-File: LICENSE
|
|
14
|
-
Requires-Dist: dimplugins>=2.0.0
|
|
15
|
-
Requires-Dist: dimsdk>=2.0.0
|
|
16
|
-
Requires-Dist: dimp>=2.0.0
|
|
17
|
-
Requires-Dist: dkd>=2.0.0
|
|
18
|
-
Requires-Dist: mkm>=2.0.0
|
|
19
|
-
Requires-Dist: startrek>=2.2.0
|
|
20
|
-
Requires-Dist: tcp>=2.2.0
|
|
21
|
-
Requires-Dist: udp>=2.2.0
|
|
22
|
-
Requires-Dist: aiou>=0.3.0
|
|
23
|
-
|
|
24
|
-
# DIMP Library for Edges and Stations (Python version)
|
|
25
|
-
|
|
26
|
-
[](https://github.com/dimchat/demo-py/blob/master/LICENSE)
|
|
27
|
-
[](https://github.com/dimchat/demo-py/wiki)
|
|
28
|
-
[](https://github.com/dimchat/demo-py/pulls)
|
|
29
|
-
[](https://github.com/dimchat/demo-py/wiki)
|
|
30
|
-
|
|
31
|
-
Copyright © 2018-2022 Albert Moky
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|