simple-proxy 0.0.5__tar.gz → 0.0.7__tar.gz

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.1
2
2
  Name: simple-proxy
3
- Version: 0.0.5
3
+ Version: 0.0.7
4
4
  Summary: A very simple NIO TCP proxy server
5
5
  Home-page: https://github.com/ruanhao/simple-proxy
6
6
  Author: Hao Ruan
@@ -22,7 +22,7 @@ config = {
22
22
  'keywords': ['network', 'tcp', 'non-blocking', 'proxy'],
23
23
  'version': __version__,
24
24
  'packages': find_packages(),
25
- 'install_requires': ['click', 'py-netty', 'cryptography'],
25
+ 'install_requires': ['click', 'py-netty', 'cryptography~=42.0.0', 'attrs~=22.1.0'],
26
26
  'python_requires': ">=3.7, <4",
27
27
  'setup_requires': ['wheel'],
28
28
  'package_data': {'simple_proxy': ['*']},
@@ -4,6 +4,7 @@ import ssl
4
4
  from functools import wraps
5
5
  from py_netty.handler import LoggingChannelHandler
6
6
  from py_netty import Bootstrap, ServerBootstrap, EventLoopGroup
7
+ from py_netty.channel import NioSocketChannel
7
8
  import traceback
8
9
  import sys
9
10
  import os
@@ -188,12 +189,15 @@ def sneaky():
188
189
 
189
190
 
190
191
  @sneaky()
191
- def _handle(buffer, direction, src, dst, print_content, to_file):
192
- try:
193
- src_ip, src_port = src.getpeername()[:2]
194
- dst_ip, dst_port = dst.getpeername()[:2]
195
- except OSError:
196
- return buffer
192
+ def _handle(buffer: bytes, direction: bool, src: NioSocketChannel, dst: NioSocketChannel, print_content: bool, to_file: bool):
193
+ # try:
194
+ # src_ip, src_port = src.getpeername()[:2]
195
+ # dst_ip, dst_port = dst.getpeername()[:2]
196
+ # except OSError:
197
+ # return buffer
198
+
199
+ src_ip, src_port = src.channelinfo().peername
200
+ dst_ip, dst_port = dst.channelinfo().peername
197
201
 
198
202
  raddr = (src_ip, src_port) if direction else (dst_ip, dst_port)
199
203
 
@@ -297,7 +301,7 @@ class ProxyChannelHandler(LoggingChannelHandler):
297
301
  class _ChannelHandler(LoggingChannelHandler):
298
302
 
299
303
  def channel_read(this, ctx, bytebuf):
300
- _handle(bytebuf, False, ctx.channel().socket(), ctx0.channel().socket(), self._content, self._to_file)
304
+ _handle(bytebuf, False, ctx.channel(), ctx0.channel(), self._content, self._to_file)
301
305
  ctx0.write(bytebuf)
302
306
 
303
307
  def channel_inactive(this, ctx):
@@ -339,7 +343,7 @@ class ProxyChannelHandler(LoggingChannelHandler):
339
343
  self._client_channel(ctx, self._remote_host, self._remote_port)
340
344
  _clients[self.raddr].proxy_socket = self._client.socket()
341
345
 
342
- _handle(bytebuf, True, ctx.channel().socket(), self._client.socket(), self._content, self._to_file)
346
+ _handle(bytebuf, True, ctx.channel(), self._client, self._content, self._to_file)
343
347
  self._client.write(bytebuf)
344
348
 
345
349
  def channel_inactive(self, ctx):
@@ -0,0 +1 @@
1
+ __version__ = "0.0.7"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: simple-proxy
3
- Version: 0.0.5
3
+ Version: 0.0.7
4
4
  Summary: A very simple NIO TCP proxy server
5
5
  Home-page: https://github.com/ruanhao/simple-proxy
6
6
  Author: Hao Ruan
@@ -0,0 +1,4 @@
1
+ click
2
+ py-netty
3
+ cryptography~=42.0.0
4
+ attrs~=22.1.0
@@ -1 +0,0 @@
1
- __version__ = "0.0.5"
@@ -1,3 +0,0 @@
1
- click
2
- py-netty
3
- cryptography
File without changes
File without changes
File without changes