GNServer 0.0.0.0.39__py3-none-any.whl → 0.0.0.0.41__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/_client.py CHANGED
@@ -136,7 +136,7 @@ async def chain_async(first_item, rest: AsyncIterable) -> AsyncGenerator:
136
136
 
137
137
 
138
138
  class AsyncClient:
139
- def __init__(self, server_key: Optional[Union[bytes, str]] = None):
139
+ def __init__(self, domain: Optional[str] = None, server_key: Optional[Union[bytes, str]] = None):
140
140
  self.__dns_core__ipv4 = '51.250.85.38:52943'
141
141
  self.__dns_gn__ipv4: Optional[str] = None
142
142
 
@@ -149,6 +149,8 @@ class AsyncClient:
149
149
  self.__dns_client: Optional[AsyncClient] = None
150
150
  self._dns_cache: TTLDict = TTLDict()
151
151
 
152
+ self.__domain = domain
153
+
152
154
  if server_key:
153
155
  if isinstance(server_key, bytes):
154
156
  self.__server_key = server_key
@@ -179,14 +181,14 @@ class AsyncClient:
179
181
  if self.__server_key is not None:
180
182
  s = s2.sign(self.__server_key)
181
183
  data = m1.encrypt(s, domain.encode(), serialize({'domain': domain}), hash(self.__server_key))
182
- payload = {'sign': {'alg': 'KeyisB-c-s-m1', 'data': s}, 'data': data}
184
+ payload = {'sign': {'alg': 'KeyisB-c-s-m1', 'data': s, 'domain': self.__domain}, 'data': data}
183
185
  else:
184
186
  payload = None
185
187
 
186
188
  r1 = await self.__dns_client.request(GNRequest('GET', Url(f'gn://{self.__dns_core__ipv4}/getIp?d={domain}'), payload=payload), keep_alive=keep_alive)
187
189
 
188
- if r1.command != 'ok':
189
- raise GNExceptions.ConnectionError.dns.data
190
+ if not r1.command:
191
+ raise r1
190
192
 
191
193
  if r1.payload is None:
192
194
  raise GNExceptions.ConnectionError.dns.data
@@ -185,6 +185,8 @@ def _build_schema_from_params(func_params) -> Schema:
185
185
  names = set()
186
186
  has_kwargs = False
187
187
  for name, p in pmap.items():
188
+ if name == "request":
189
+ continue
188
190
  if p.kind == Parameter.VAR_KEYWORD:
189
191
  has_kwargs = True; continue
190
192
  if p.kind == Parameter.VAR_POSITIONAL:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GNServer
3
- Version: 0.0.0.0.39
3
+ Version: 0.0.0.0.41
4
4
  Summary: GNServer
5
5
  Home-page: https://github.com/KeyisB/libs/tree/main/GNServer
6
6
  Author: KeyisB
@@ -1,13 +1,13 @@
1
1
  GNServer/__init__.py,sha256=6CMCZlkBO74PW8i8DAri5xz2fYM9EyPH8vdsLYBMmOo,1560
2
2
  GNServer/_app.py,sha256=nvK_9w1YtZfE-Xh0K-ebkvVINAx4Fir3NSw7Lbwyaz4,18874
3
- GNServer/_client.py,sha256=H209KSvCnoJ3qXQFTYuzQSecEV-3qQv5JcHeIfT0ypc,32911
3
+ GNServer/_client.py,sha256=tXLY-K-G4grsHZDJsZ_EP8HArC7AoNEO4ZPS8Q_6h_A,32961
4
4
  GNServer/_cors_resolver.py,sha256=U9IFGN7vpVsEM2smhuf5QGj8vYgs7HeFQwDdzWVVy9c,4832
5
5
  GNServer/_crt.py,sha256=SOmyX7zBiCY9EhVSekksQtBHgTIZVvdqNZ8Ni-E5Zow,1390
6
- GNServer/_func_params_validation.py,sha256=2Pkv4g8Ln5Csj_2LOjKmJO-Y7EdiyfXmM6iv7_Vlt9A,11359
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-0.0.0.0.39.dist-info/licenses/LICENSE,sha256=WH_t7dKZyWJ5Ld07eYIkUG4Tv6zZWXtAdsUqYAUesn0,1084
10
- gnserver-0.0.0.0.39.dist-info/METADATA,sha256=Ue1W90cZttBNM2BD8rLCKavHb5i9n5bzs1MOLDe4f5w,830
11
- gnserver-0.0.0.0.39.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
- gnserver-0.0.0.0.39.dist-info/top_level.txt,sha256=-UOUBuD4u7Qkb1o5PdcwyA3kx8xCH2lwy0tJHi26Wb4,9
13
- gnserver-0.0.0.0.39.dist-info/RECORD,,
9
+ gnserver-0.0.0.0.41.dist-info/licenses/LICENSE,sha256=WH_t7dKZyWJ5Ld07eYIkUG4Tv6zZWXtAdsUqYAUesn0,1084
10
+ gnserver-0.0.0.0.41.dist-info/METADATA,sha256=8zSWXk_DeqshZElKzbbEL804XTYuELRj2CP4bJE7mxk,830
11
+ gnserver-0.0.0.0.41.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
+ gnserver-0.0.0.0.41.dist-info/top_level.txt,sha256=-UOUBuD4u7Qkb1o5PdcwyA3kx8xCH2lwy0tJHi26Wb4,9
13
+ gnserver-0.0.0.0.41.dist-info/RECORD,,