appmesh 1.3.8__py3-none-any.whl → 1.4.0__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.
- appmesh/app.py +2 -0
- appmesh/tcp_client.py +4 -1
- appmesh/tcp_transport.py +13 -7
- {appmesh-1.3.8.dist-info → appmesh-1.4.0.dist-info}/METADATA +2 -3
- appmesh-1.4.0.dist-info/RECORD +13 -0
- {appmesh-1.3.8.dist-info → appmesh-1.4.0.dist-info}/WHEEL +1 -1
- appmesh-1.3.8.dist-info/RECORD +0 -13
- {appmesh-1.3.8.dist-info → appmesh-1.4.0.dist-info}/top_level.txt +0 -0
appmesh/app.py
CHANGED
@@ -166,6 +166,8 @@ class App(object):
|
|
166
166
|
# Read-only attributes
|
167
167
|
self.owner = App._get_str_item(data, "owner")
|
168
168
|
"""owner name"""
|
169
|
+
self.user = App._get_str_item(data, "pid_user")
|
170
|
+
"""process user name"""
|
169
171
|
self.pstree = App._get_str_item(data, "pstree")
|
170
172
|
"""process tree"""
|
171
173
|
self.container_id = App._get_str_item(data, "container_id")
|
appmesh/tcp_client.py
CHANGED
@@ -162,7 +162,10 @@ class AppMeshClientTCP(AppMeshClient):
|
|
162
162
|
raise ValueError(f"Server did not respond with socket transfer option: {self.HTTP_HEADER_KEY_X_RECV_FILE_SOCKET}")
|
163
163
|
|
164
164
|
with open(local_file, "wb") as fp:
|
165
|
-
while
|
165
|
+
while True:
|
166
|
+
chunk_data = self.tcp_transport.receive_message()
|
167
|
+
if not chunk_data:
|
168
|
+
break
|
166
169
|
fp.write(chunk_data)
|
167
170
|
|
168
171
|
if apply_file_attributes:
|
appmesh/tcp_transport.py
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
import os
|
4
4
|
import socket
|
5
5
|
import ssl
|
6
|
+
import struct
|
6
7
|
from typing import Optional, Tuple, Union
|
7
8
|
|
8
9
|
|
@@ -12,8 +13,9 @@ class TCPTransport:
|
|
12
13
|
# Number of bytes used for the message length header
|
13
14
|
# Must match the C++ service implementation which uses uint32_t (4 bytes)
|
14
15
|
# Format: Big-endian unsigned 32-bit integer
|
15
|
-
|
16
|
-
|
16
|
+
TCP_MESSAGE_HEADER_LENGTH = 8
|
17
|
+
TCP_MESSAGE_MAGIC = 0x07C707F8 # Magic number
|
18
|
+
TCP_MAX_BLOCK_SIZE = 1024 * 1024 * 100 # 100 MB message size limit
|
17
19
|
|
18
20
|
def __init__(self, address: Tuple[str, int], ssl_verify: Union[bool, str], ssl_client_cert: Union[str, Tuple[str, str]]):
|
19
21
|
"""Construct an TCPTransport object to send and recieve TCP data.
|
@@ -114,15 +116,19 @@ class TCPTransport:
|
|
114
116
|
def send_message(self, data) -> None:
|
115
117
|
"""Send a message with a prefixed header indicating its length"""
|
116
118
|
length = len(data)
|
117
|
-
|
119
|
+
# Pack the header into 8 bytes using big-endian format
|
120
|
+
self._socket.sendall(struct.pack("!II", self.TCP_MESSAGE_MAGIC, length))
|
118
121
|
if length > 0:
|
119
122
|
self._socket.sendall(data)
|
120
123
|
|
121
124
|
def receive_message(self) -> Optional[bytearray]:
|
122
|
-
"""Receive a message with a prefixed header indicating its length"""
|
123
|
-
|
124
|
-
|
125
|
-
|
125
|
+
"""Receive a message with a prefixed header indicating its length and validate it"""
|
126
|
+
# Unpack the data (big-endian format)
|
127
|
+
magic, length = struct.unpack("!II", self._recvall(self.TCP_MESSAGE_HEADER_LENGTH))
|
128
|
+
if magic != self.TCP_MESSAGE_MAGIC:
|
129
|
+
raise ValueError(f"Invalid message: incorrect magic number 0x{magic:X}.")
|
130
|
+
if length > self.TCP_MAX_BLOCK_SIZE:
|
131
|
+
raise ValueError(f"Message size {length} exceeds the maximum allowed size of {self.TCP_MAX_BLOCK_SIZE} bytes.")
|
126
132
|
if length > 0:
|
127
133
|
return self._recvall(length)
|
128
134
|
return None
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: appmesh
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.4.0
|
4
4
|
Summary: Client SDK for App Mesh
|
5
5
|
Home-page: https://github.com/laoshanxi/app-mesh
|
6
6
|
Author: laoshanxi
|
@@ -14,7 +14,7 @@ Requires-Python: >=3
|
|
14
14
|
Description-Content-Type: text/markdown
|
15
15
|
Requires-Dist: requests
|
16
16
|
Requires-Dist: msgpack
|
17
|
-
Requires-Dist:
|
17
|
+
Requires-Dist: requests_toolbelt
|
18
18
|
Requires-Dist: aniso8601
|
19
19
|
|
20
20
|
[![language.badge]][language.url] [![standard.badge]][standard.url] [![release.badge]][release.url] [![pypi.badge]][pypi.url] [![unittest.badge]][unittest.url] [![docker.badge]][docker.url] [![cockpit.badge]][cockpit.url]
|
@@ -119,7 +119,6 @@ Refer to the [Installation doc](https://app-mesh.readthedocs.io/en/latest/Instal
|
|
119
119
|
- [MessagePack](https://msgpack.org/)
|
120
120
|
- [boostorg/boost](https://github.com/boostorg/boost)
|
121
121
|
- [ACE_TAO/ACE](https://github.com/DOCGroup/ACE_TAO)
|
122
|
-
- [curlpp](https://github.com/jpbarrette/curlpp)
|
123
122
|
- [Thalhammer/jwt-cpp](https://github.com/Thalhammer/jwt-cpp)
|
124
123
|
- [nlohmann/json](https://json.nlohmann.me)
|
125
124
|
- [yaml-cpp](https://github.com/jbeder/yaml-cpp)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
appmesh/__init__.py,sha256=vgiSdMzlzDwgHxBMDoFaKWb77g2nJVciRf4z_ssAlwE,431
|
2
|
+
appmesh/app.py,sha256=9Q-SOOej-MH13BU5Dv2iTa-p-sECCJQp6ZX9DjWWmwE,10526
|
3
|
+
appmesh/app_output.py,sha256=JK_TMKgjvaw4n_ys_vmN5S4MyWVZpmD7NlKz_UyMIM8,1015
|
4
|
+
appmesh/app_run.py,sha256=D4j_SaA16_RtZ2-Ey6X4HIyngvLdfFHgyzYurDT1ATc,1753
|
5
|
+
appmesh/appmesh_client.py,sha256=0ltkqHZUq094gKneYmC0bEZCP0X9kHTp9fccKdWFWP0,339
|
6
|
+
appmesh/http_client.py,sha256=miO52kW8d9s0tGn42SxbOPtVNu9ZL8HDFCoCCMXm_EA,47484
|
7
|
+
appmesh/tcp_client.py,sha256=UsdD_APVPRy5CtgX1_hJyljols8cmCBoEiWlKH2gYOM,10933
|
8
|
+
appmesh/tcp_messages.py,sha256=w1Kehz_aX4X2CYAUsy9mFVJRhxnLQwwc6L58W4YkQqs,969
|
9
|
+
appmesh/tcp_transport.py,sha256=UMGby2oKV4k7lyXZUMSOe2Je34fb1w7nTkxEpatKLKg,7256
|
10
|
+
appmesh-1.4.0.dist-info/METADATA,sha256=3xIB3lw5lIKSBRILRydR3hcCH4QFJVPbGGn5IpY6IsU,11142
|
11
|
+
appmesh-1.4.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
12
|
+
appmesh-1.4.0.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
|
13
|
+
appmesh-1.4.0.dist-info/RECORD,,
|
appmesh-1.3.8.dist-info/RECORD
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
appmesh/__init__.py,sha256=vgiSdMzlzDwgHxBMDoFaKWb77g2nJVciRf4z_ssAlwE,431
|
2
|
-
appmesh/app.py,sha256=trPD1i7PFv7DTuy33Hr8-AC36r3h3XIBejdB3cUU8C8,10438
|
3
|
-
appmesh/app_output.py,sha256=JK_TMKgjvaw4n_ys_vmN5S4MyWVZpmD7NlKz_UyMIM8,1015
|
4
|
-
appmesh/app_run.py,sha256=D4j_SaA16_RtZ2-Ey6X4HIyngvLdfFHgyzYurDT1ATc,1753
|
5
|
-
appmesh/appmesh_client.py,sha256=0ltkqHZUq094gKneYmC0bEZCP0X9kHTp9fccKdWFWP0,339
|
6
|
-
appmesh/http_client.py,sha256=miO52kW8d9s0tGn42SxbOPtVNu9ZL8HDFCoCCMXm_EA,47484
|
7
|
-
appmesh/tcp_client.py,sha256=cbnx_YbBMBbJeR5DY7u5jmlgHcYqbjzffirSiJ-zT1o,10852
|
8
|
-
appmesh/tcp_messages.py,sha256=w1Kehz_aX4X2CYAUsy9mFVJRhxnLQwwc6L58W4YkQqs,969
|
9
|
-
appmesh/tcp_transport.py,sha256=YlKMaE-oaKLmGuBdWIyKz3YH4ZPMgJWHBZYbINtUoYM,6934
|
10
|
-
appmesh-1.3.8.dist-info/METADATA,sha256=GCrx58vUH1DvcQfLWXjG-pVJowoD7ykM6ZehOZVTGMI,11191
|
11
|
-
appmesh-1.3.8.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
12
|
-
appmesh-1.3.8.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
|
13
|
-
appmesh-1.3.8.dist-info/RECORD,,
|
File without changes
|