appmesh 1.3.9__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 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_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
- TCP_HEADER_LENGTH = 4
16
- MAX_MESSAGE_SIZE = 300 * 1024 * 1024 # 300 MiB message size limit
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
- self._socket.sendall(length.to_bytes(self.TCP_HEADER_LENGTH, byteorder="big", signed=False))
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
- length = int.from_bytes(self._recvall(self.TCP_HEADER_LENGTH), byteorder="big", signed=False)
124
- if length > self.MAX_MESSAGE_SIZE:
125
- raise ValueError(f"Message size {length} exceeds maximum allowed {self.MAX_MESSAGE_SIZE}")
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.9
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: requests-toolbelt
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)
@@ -1,13 +1,13 @@
1
1
  appmesh/__init__.py,sha256=vgiSdMzlzDwgHxBMDoFaKWb77g2nJVciRf4z_ssAlwE,431
2
- appmesh/app.py,sha256=trPD1i7PFv7DTuy33Hr8-AC36r3h3XIBejdB3cUU8C8,10438
2
+ appmesh/app.py,sha256=9Q-SOOej-MH13BU5Dv2iTa-p-sECCJQp6ZX9DjWWmwE,10526
3
3
  appmesh/app_output.py,sha256=JK_TMKgjvaw4n_ys_vmN5S4MyWVZpmD7NlKz_UyMIM8,1015
4
4
  appmesh/app_run.py,sha256=D4j_SaA16_RtZ2-Ey6X4HIyngvLdfFHgyzYurDT1ATc,1753
5
5
  appmesh/appmesh_client.py,sha256=0ltkqHZUq094gKneYmC0bEZCP0X9kHTp9fccKdWFWP0,339
6
6
  appmesh/http_client.py,sha256=miO52kW8d9s0tGn42SxbOPtVNu9ZL8HDFCoCCMXm_EA,47484
7
7
  appmesh/tcp_client.py,sha256=UsdD_APVPRy5CtgX1_hJyljols8cmCBoEiWlKH2gYOM,10933
8
8
  appmesh/tcp_messages.py,sha256=w1Kehz_aX4X2CYAUsy9mFVJRhxnLQwwc6L58W4YkQqs,969
9
- appmesh/tcp_transport.py,sha256=YlKMaE-oaKLmGuBdWIyKz3YH4ZPMgJWHBZYbINtUoYM,6934
10
- appmesh-1.3.9.dist-info/METADATA,sha256=YvI0e_YQxbntROWaY7oxJn9ksDq-dCXDmGwyv1xE6Vk,11191
11
- appmesh-1.3.9.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
12
- appmesh-1.3.9.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
13
- appmesh-1.3.9.dist-info/RECORD,,
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,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.5.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5