nginx-lens 0.2.2__py3-none-any.whl → 0.2.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nginx-lens
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: CLI-инструмент для анализа, визуализации и диагностики конфигураций Nginx
5
5
  Author: Daniil Astrouski
6
6
  Author-email: shelovesuastra@gmail.com
@@ -25,13 +25,13 @@ exporter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  exporter/graph.py,sha256=WYUrqUgCaK6KihgxAcRHaQn4oMo6b7ybC8yb_36ZIsA,3995
26
26
  exporter/html.py,sha256=uquEM-WvBt2aV9GshgaI3UVhYd8sD0QQ-OmuNtvYUdU,798
27
27
  exporter/markdown.py,sha256=_0mXQIhurGEZ0dO-eq9DbsuKNrgEDIblgtL3DAgYNo8,724
28
- nginx_lens-0.2.2.dist-info/licenses/LICENSE,sha256=g8QXKdvZZC56rU8E12vIeYF6R4jeTWOsblOnYAda3K4,1073
28
+ nginx_lens-0.2.3.dist-info/licenses/LICENSE,sha256=g8QXKdvZZC56rU8E12vIeYF6R4jeTWOsblOnYAda3K4,1073
29
29
  parser/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  parser/nginx_parser.py,sha256=Sa9FtGAkvTqNzoehBvgLUWPJHLLIZYWH9ugSHW50X8s,3699
31
31
  upstream_checker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
- upstream_checker/checker.py,sha256=_GiiNNO1U2CoFKmJP7rWwvCdyxsgB4keSS9y4IrSeEc,1961
33
- nginx_lens-0.2.2.dist-info/METADATA,sha256=wyn9pvzpCJVnmjcdQjtE04udvjc9NOqZ_pWfx7BQGh8,520
34
- nginx_lens-0.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
- nginx_lens-0.2.2.dist-info/entry_points.txt,sha256=qEcecjSyLqcJjbIVlNlTpqAhPqDyaujUV5ZcBTAr3po,48
36
- nginx_lens-0.2.2.dist-info/top_level.txt,sha256=mxLJO4rZg0rbixVGhplF3fUNFs8vxDIL25ronZNvRy4,51
37
- nginx_lens-0.2.2.dist-info/RECORD,,
32
+ upstream_checker/checker.py,sha256=5aTU3-ejUlEOKX9lYxD8PuGTBYyQENwiDknSh168lFE,2336
33
+ nginx_lens-0.2.3.dist-info/METADATA,sha256=ue5Bb9dQNf6RSCxxS7k718glb6-ujAY8yqLlTU7b27w,520
34
+ nginx_lens-0.2.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
+ nginx_lens-0.2.3.dist-info/entry_points.txt,sha256=qEcecjSyLqcJjbIVlNlTpqAhPqDyaujUV5ZcBTAr3po,48
36
+ nginx_lens-0.2.3.dist-info/top_level.txt,sha256=mxLJO4rZg0rbixVGhplF3fUNFs8vxDIL25ronZNvRy4,51
37
+ nginx_lens-0.2.3.dist-info/RECORD,,
@@ -7,9 +7,15 @@ from typing import Dict, List
7
7
 
8
8
 
9
9
  def check_tcp(address: str, timeout: float, retries: int) -> bool:
10
- """Проверка доступности сервера по TCP"""
11
- host, port = address.split(":")
10
+ """
11
+ Проверка доступности сервера по TCP.
12
+ Ignores extra upstream options like 'max_fails' or 'fail_timeout'.
13
+ """
14
+ # Берем только host:port, игнорируем параметры
15
+ host_port = address.split()[0]
16
+ host, port = host_port.split(":")
12
17
  port = int(port)
18
+
13
19
  for _ in range(retries):
14
20
  try:
15
21
  with socket.create_connection((host, port), timeout=timeout):
@@ -20,9 +26,14 @@ def check_tcp(address: str, timeout: float, retries: int) -> bool:
20
26
 
21
27
 
22
28
  def check_http(address: str, timeout: float, retries: int) -> bool:
23
- """Проверка доступности сервера по HTTP (GET /)"""
24
- host, port = address.split(":")
29
+ """
30
+ Проверка доступности сервера по HTTP (GET /).
31
+ Ignores extra upstream options like 'max_fails' or 'fail_timeout'.
32
+ """
33
+ host_port = address.split()[0]
34
+ host, port = host_port.split(":")
25
35
  port = int(port)
36
+
26
37
  for _ in range(retries):
27
38
  try:
28
39
  conn = http.client.HTTPConnection(host, port, timeout=timeout)
@@ -38,10 +49,16 @@ def check_http(address: str, timeout: float, retries: int) -> bool:
38
49
  return False
39
50
 
40
51
 
41
- def check_upstreams(upstreams: Dict[str, List[str]], timeout=2.0, retries=1, mode="tcp") -> Dict[str, List[dict]]:
52
+ def check_upstreams(
53
+ upstreams: Dict[str, List[str]],
54
+ timeout: float = 2.0,
55
+ retries: int = 1,
56
+ mode: str = "tcp"
57
+ ) -> Dict[str, List[dict]]:
42
58
  """
43
59
  Проверяет доступность upstream-серверов.
44
60
  mode: "tcp" (по умолчанию) или "http"
61
+
45
62
  Возвращает:
46
63
  {
47
64
  "backend": [