GNServer 0.0.0.0.59__py3-none-any.whl → 0.0.0.0.60__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- GNServer/_app.py +5 -3
- GNServer/_client.py +0 -8
- GNServer/models.py +8 -7
- {gnserver-0.0.0.0.59.dist-info → gnserver-0.0.0.0.60.dist-info}/METADATA +1 -1
- {gnserver-0.0.0.0.59.dist-info → gnserver-0.0.0.0.60.dist-info}/RECORD +8 -8
- {gnserver-0.0.0.0.59.dist-info → gnserver-0.0.0.0.60.dist-info}/WHEEL +0 -0
- {gnserver-0.0.0.0.59.dist-info → gnserver-0.0.0.0.60.dist-info}/licenses/LICENSE +0 -0
- {gnserver-0.0.0.0.59.dist-info → gnserver-0.0.0.0.60.dist-info}/top_level.txt +0 -0
GNServer/_app.py
CHANGED
@@ -249,6 +249,8 @@ class App:
|
|
249
249
|
return r.handler(**kw)
|
250
250
|
|
251
251
|
result = await r.handler(**kw)
|
252
|
+
if result is None:
|
253
|
+
result = AllGNFastCommands.ok()
|
252
254
|
if isinstance(result, GNResponse):
|
253
255
|
if r.cors is None:
|
254
256
|
if result._cors is None:
|
@@ -359,7 +361,7 @@ class App:
|
|
359
361
|
raise Exception('Не удалось расшифровать от KDC')
|
360
362
|
|
361
363
|
request.stream_id = stream_id # type: ignore
|
362
|
-
logger.debug(f'Request: {request.method} {request.url}')
|
364
|
+
logger.debug(f'[<] Request: {request.method} {request.url}')
|
363
365
|
asyncio.create_task(self._handle_request(request, mode))
|
364
366
|
|
365
367
|
self._buffer.pop(event.stream_id, None)
|
@@ -457,7 +459,7 @@ class App:
|
|
457
459
|
await response.assembly()
|
458
460
|
|
459
461
|
|
460
|
-
logger.debug(f'Response: {request.method} {request.url} -> {response.command} {response.payload if len(str(response.payload)) < 256 else ''}')
|
462
|
+
logger.debug(f'[>] Response: {request.method} {request.url} -> {response.command} {response.payload if len(str(response.payload)) < 256 else ''}')
|
461
463
|
|
462
464
|
blob = response.serialize(mode)
|
463
465
|
|
@@ -542,4 +544,4 @@ class App:
|
|
542
544
|
cert_path=cert_path,
|
543
545
|
key_path=key_path,
|
544
546
|
host=host
|
545
|
-
)
|
547
|
+
)
|
GNServer/_client.py
CHANGED
@@ -189,15 +189,11 @@ class AsyncClient:
|
|
189
189
|
|
190
190
|
async def connect(self, request: GNRequest, restart_connection: bool = False, reconnect_wait: float = 10, keep_alive: bool = True) -> 'QuicClient':
|
191
191
|
domain = request.url.hostname
|
192
|
-
devLog(request, '1.2.1', 10, f'Connect to {domain}: restart_connection={restart_connection}, reconnect_wait={reconnect_wait}, keep_alive={keep_alive}')
|
193
192
|
if not restart_connection and domain in self._active_connections:
|
194
193
|
c = self._active_connections[domain]
|
195
|
-
devLog(request, '1.2.2', 10, f'Connection to {domain} found: status={c.status}')
|
196
194
|
if c.status == 'connecting':
|
197
|
-
devLog(request, '1.2.3', 10, f'Waiting for connection to {domain}...')
|
198
195
|
try:
|
199
196
|
await asyncio.wait_for(c.connect_future, reconnect_wait)
|
200
|
-
devLog(request, '1.2.4', 10, f'Connected to {domain}: status={c.status}')
|
201
197
|
if c.status == 'active':
|
202
198
|
return c
|
203
199
|
elif c.status == 'connecting': # если очень долго подключаемся, то кидаем ошибку
|
@@ -206,7 +202,6 @@ class AsyncClient:
|
|
206
202
|
elif c.status == 'disconnect':
|
207
203
|
raise GNExceptions.ConnectionError.client.connection
|
208
204
|
except:
|
209
|
-
devLog(request, '1.2.5', 10, f'Connection to {domain} failed or timed out.')
|
210
205
|
await self.disconnect(domain)
|
211
206
|
|
212
207
|
else:
|
@@ -216,9 +211,7 @@ class AsyncClient:
|
|
216
211
|
c.status = 'connecting'
|
217
212
|
self._active_connections[domain] = c
|
218
213
|
|
219
|
-
devLog(request, '1.2.6', 10, f'Connecting to {domain}...')
|
220
214
|
data = await self.getDNS(domain, raise_errors=True)
|
221
|
-
devLog(request, '1.2.7', 10, f'Got DNS for {domain}: {data}')
|
222
215
|
|
223
216
|
data = data.split(':')
|
224
217
|
|
@@ -229,7 +222,6 @@ class AsyncClient:
|
|
229
222
|
|
230
223
|
c._disconnect_signal = f # type: ignore
|
231
224
|
c._domain = domain # type: ignore
|
232
|
-
devLog(request, '1.2.8', 10, f'Creating QuicClient for {domain}...')
|
233
225
|
await c.connect(data[0], int(data[1]), keep_alive=keep_alive)
|
234
226
|
await c.connect_future
|
235
227
|
|
GNServer/models.py
CHANGED
@@ -28,11 +28,11 @@ class KDCObject:
|
|
28
28
|
|
29
29
|
async def init(self, servers_keys: Optional[Dict[str, bytes]] = None): # type: ignore
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
if self._kdc_domain not in self._servers_keys:
|
32
|
+
self._servers_keys[self._kdc_domain] = self._kdc_key
|
33
|
+
h = hash3(self._kdc_domain.encode())
|
34
|
+
self._servers_keys_hash_domain[h] = self._kdc_domain
|
35
|
+
self._servers_keys_domain_hash[self._kdc_domain] = h
|
36
36
|
|
37
37
|
|
38
38
|
if servers_keys is not None:
|
@@ -76,14 +76,15 @@ class KDCObject:
|
|
76
76
|
return request[:8] + sig + self._domain_hash + data
|
77
77
|
|
78
78
|
def decode(self, response: bytes):
|
79
|
+
r = response
|
79
80
|
if len(response) < 8+164+64:
|
80
|
-
return
|
81
|
+
return r, None
|
81
82
|
h = response[:8]
|
82
83
|
response = response[8:]
|
83
84
|
sig, domain_h, data = response[:164], response[164:164+64], response[164+64:]
|
84
85
|
if domain_h not in self._servers_keys_hash_domain:
|
85
86
|
print(domain_h, 'not in', self._servers_keys_hash_domain)
|
86
|
-
return
|
87
|
+
return r, None
|
87
88
|
d = self._servers_keys_hash_domain[domain_h]
|
88
89
|
key = self._servers_keys[d]
|
89
90
|
if not s2.verify(key, sig):
|
@@ -1,14 +1,14 @@
|
|
1
1
|
GNServer/__init__.py,sha256=QmvIIE5RWIv040_l216aWtYuiIPtLasdsFbH0Fya2SI,1793
|
2
|
-
GNServer/_app.py,sha256=
|
3
|
-
GNServer/_client.py,sha256=
|
2
|
+
GNServer/_app.py,sha256=ffr4Ar-hV5m0ED-dGDQw5RYymmpUWF5Uzp3k2ZCV1wk,19414
|
3
|
+
GNServer/_client.py,sha256=Rp5INEVFfeD3rdm0tppjyGKqNT6yLe_STEVVNDJUpKw,32410
|
4
4
|
GNServer/_cors_resolver.py,sha256=aDxk4ItaEK-6vlDbkno8FJZEjczGEe8vkOui6_kz5-Y,5950
|
5
5
|
GNServer/_crt.py,sha256=SOmyX7zBiCY9EhVSekksQtBHgTIZVvdqNZ8Ni-E5Zow,1390
|
6
6
|
GNServer/_func_params_validation.py,sha256=pDXRzPVTdPnDHFMMmKd014SConBjFOuaLeJTY0vldlM,11412
|
7
7
|
GNServer/_routes.py,sha256=bJnmQ8uEhPVQgy2tTqE5TEIM8aFXV-lVI7c2nG0rQwk,3384
|
8
8
|
GNServer/_template_resolver.py,sha256=vdJYb_7PjIeTWq-Clr7jyj7QIvPBxplU7EqeOuMJ64c,1409
|
9
|
-
GNServer/models.py,sha256=
|
10
|
-
gnserver-0.0.0.0.
|
11
|
-
gnserver-0.0.0.0.
|
12
|
-
gnserver-0.0.0.0.
|
13
|
-
gnserver-0.0.0.0.
|
14
|
-
gnserver-0.0.0.0.
|
9
|
+
GNServer/models.py,sha256=QkDVNUvRhm3k_z1GSzQ8xGPcFhi9LbzWDrZnO33cHso,3289
|
10
|
+
gnserver-0.0.0.0.60.dist-info/licenses/LICENSE,sha256=_rN-sb3LemR3cKsEqjJRdXkdt7mME1mkW1BwWEn-zAw,1309
|
11
|
+
gnserver-0.0.0.0.60.dist-info/METADATA,sha256=poKkvSjNlosNVlL5sMaLV_AHnhDjf_gS60N76clzTIk,830
|
12
|
+
gnserver-0.0.0.0.60.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
13
|
+
gnserver-0.0.0.0.60.dist-info/top_level.txt,sha256=-UOUBuD4u7Qkb1o5PdcwyA3kx8xCH2lwy0tJHi26Wb4,9
|
14
|
+
gnserver-0.0.0.0.60.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|