python-socks 2.8.2__py3-none-any.whl → 3.0.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.
- python_socks/__init__.py +11 -13
- python_socks/_abc.py +35 -22
- python_socks/_connectors/abc.py +5 -3
- python_socks/_connectors/factory_async.py +8 -8
- python_socks/_connectors/factory_sync.py +8 -8
- python_socks/_connectors/http_async.py +7 -7
- python_socks/_connectors/http_sync.py +7 -7
- python_socks/_connectors/socks4_async.py +10 -10
- python_socks/_connectors/socks4_sync.py +10 -10
- python_socks/_connectors/socks5_async.py +29 -26
- python_socks/_connectors/socks5_sync.py +36 -28
- python_socks/_errors.py +15 -2
- python_socks/_helpers.py +35 -32
- python_socks/_protocols/errors.py +10 -1
- python_socks/_protocols/http.py +55 -60
- python_socks/_protocols/socks4.py +22 -26
- python_socks/_protocols/socks5.py +77 -70
- python_socks/_types.py +4 -0
- python_socks/_version.py +2 -2
- python_socks/async_/__init__.py +0 -3
- python_socks/async_/anyio/__init__.py +1 -2
- python_socks/async_/anyio/_connect.py +6 -4
- python_socks/async_/anyio/_proxy.py +85 -92
- python_socks/async_/anyio/_resolver.py +10 -3
- python_socks/async_/anyio/_stream.py +11 -26
- python_socks/async_/anyio/v2/__init__.py +1 -5
- python_socks/async_/anyio/v2/_connect.py +7 -4
- python_socks/async_/anyio/v2/_proxy.py +36 -26
- python_socks/async_/anyio/v2/_stream.py +11 -11
- python_socks/async_/asyncio/__init__.py +1 -2
- python_socks/async_/asyncio/_connect.py +12 -7
- python_socks/async_/asyncio/_proxy.py +48 -49
- python_socks/async_/asyncio/_resolver.py +11 -4
- python_socks/async_/asyncio/_stream.py +9 -13
- python_socks/async_/asyncio/v2/__init__.py +1 -2
- python_socks/async_/asyncio/v2/_connect.py +8 -5
- python_socks/async_/asyncio/v2/_proxy.py +38 -28
- python_socks/async_/asyncio/v2/_stream.py +16 -18
- python_socks/async_/trio/__init__.py +1 -1
- python_socks/async_/trio/_connect.py +5 -4
- python_socks/async_/trio/_proxy.py +46 -48
- python_socks/async_/trio/_resolver.py +11 -3
- python_socks/async_/trio/_stream.py +9 -9
- python_socks/async_/trio/v2/__init__.py +1 -5
- python_socks/async_/trio/v2/_connect.py +3 -2
- python_socks/async_/trio/v2/_proxy.py +34 -24
- python_socks/async_/trio/v2/_stream.py +13 -13
- python_socks/sync/__init__.py +1 -3
- python_socks/sync/_connect.py +4 -3
- python_socks/sync/_proxy.py +42 -43
- python_socks/sync/_resolver.py +17 -5
- python_socks/sync/_stream.py +9 -9
- python_socks/sync/v2/__init__.py +1 -5
- python_socks/sync/v2/_connect.py +5 -3
- python_socks/sync/v2/_proxy.py +35 -26
- python_socks/sync/v2/_ssl_transport.py +3 -0
- python_socks/sync/v2/_stream.py +19 -14
- python_socks-3.0.0.dist-info/METADATA +346 -0
- python_socks-3.0.0.dist-info/RECORD +65 -0
- {python_socks-2.8.2.dist-info → python_socks-3.0.0.dist-info}/WHEEL +1 -1
- python_socks/async_/_proxy_chain.py +0 -34
- python_socks/async_/anyio/_chain.py +0 -42
- python_socks/async_/anyio/v2/_chain.py +0 -32
- python_socks/async_/asyncio/v2/_chain.py +0 -32
- python_socks/async_/curio/__init__.py +0 -4
- python_socks/async_/curio/_connect.py +0 -17
- python_socks/async_/curio/_proxy.py +0 -132
- python_socks/async_/curio/_resolver.py +0 -25
- python_socks/async_/curio/_stream.py +0 -32
- python_socks/async_/trio/v2/_chain.py +0 -32
- python_socks/sync/_chain.py +0 -32
- python_socks/sync/v2/_chain.py +0 -26
- python_socks-2.8.2.dist-info/METADATA +0 -295
- python_socks-2.8.2.dist-info/RECORD +0 -77
- {python_socks-2.8.2.dist-info → python_socks-3.0.0.dist-info}/licenses/LICENSE.txt +0 -0
- {python_socks-2.8.2.dist-info → python_socks-3.0.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-socks
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Summary: Proxy (SOCKS4, SOCKS5, HTTP CONNECT) client for Python
|
|
5
|
+
Author-email: Roman Snegirev <snegiryev@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: homepage, https://github.com/romis2012/python-socks
|
|
8
|
+
Project-URL: repository, https://github.com/romis2012/python-socks
|
|
9
|
+
Keywords: socks,socks5,socks4,http,proxy,asyncio,trio,anyio
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Operating System :: MacOS
|
|
21
|
+
Classifier: Operating System :: Microsoft
|
|
22
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
23
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
24
|
+
Classifier: Intended Audience :: Developers
|
|
25
|
+
Classifier: Framework :: AsyncIO
|
|
26
|
+
Classifier: Framework :: Trio
|
|
27
|
+
Requires-Python: >=3.9.0
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE.txt
|
|
30
|
+
Provides-Extra: asyncio
|
|
31
|
+
Requires-Dist: async-timeout>=5.0.1; python_version < "3.11" and extra == "asyncio"
|
|
32
|
+
Provides-Extra: trio
|
|
33
|
+
Requires-Dist: trio>=0.30.0; extra == "trio"
|
|
34
|
+
Provides-Extra: anyio
|
|
35
|
+
Requires-Dist: anyio<5.0.0,>=4.12.1; extra == "anyio"
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
## python-socks
|
|
39
|
+
|
|
40
|
+
[](https://github.com/romis2012/python-socks/actions/workflows/ci.yml)
|
|
41
|
+
[](https://codecov.io/gh/romis2012/python-socks)
|
|
42
|
+
[](https://pypi.python.org/pypi/python-socks)
|
|
43
|
+
[](https://github.com/romis2012/python-socks)
|
|
44
|
+
<!--
|
|
45
|
+
[](https://pepy.tech/project/python-socks)
|
|
46
|
+
-->
|
|
47
|
+
|
|
48
|
+
The `python-socks` package provides a core proxy client functionality for Python.
|
|
49
|
+
Supports `SOCKS4(a)`, `SOCKS5(h)`, `HTTP CONNECT` proxy and provides sync and async (asyncio, trio, anyio) APIs.
|
|
50
|
+
You probably don't need to use `python-socks` directly.
|
|
51
|
+
It is used internally by
|
|
52
|
+
[aiohttp-socks](https://github.com/romis2012/aiohttp-socks) and [httpx-socks](https://github.com/romis2012/httpx-socks) packages.
|
|
53
|
+
|
|
54
|
+
## Requirements
|
|
55
|
+
- Python >= 3.9
|
|
56
|
+
- async-timeout >= 5.0 (optional)
|
|
57
|
+
- trio >= 0.30 (optional)
|
|
58
|
+
- anyio >= 4.12 (optional)
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
only sync proxy support:
|
|
63
|
+
```
|
|
64
|
+
pip install python-socks
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
to include optional asyncio support:
|
|
68
|
+
```
|
|
69
|
+
pip install python-socks[asyncio]
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
to include optional trio support:
|
|
73
|
+
```
|
|
74
|
+
pip install python-socks[trio]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
to include optional anyio support:
|
|
78
|
+
```
|
|
79
|
+
pip install python-socks[anyio]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Simple usage
|
|
83
|
+
We are making secure HTTP GET request via SOCKS5 proxy
|
|
84
|
+
|
|
85
|
+
#### Sync
|
|
86
|
+
```python
|
|
87
|
+
import ssl
|
|
88
|
+
from python_socks.sync import Proxy
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def fetch():
|
|
92
|
+
proxy = Proxy.from_url("socks5://user:password@127.0.0.1:1080")
|
|
93
|
+
|
|
94
|
+
# `connect` returns standard Python socket in blocking mode
|
|
95
|
+
sock = proxy.connect(
|
|
96
|
+
dest_host="check-host.net",
|
|
97
|
+
dest_port=443,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
sock = ssl.create_default_context().wrap_socket(
|
|
101
|
+
sock=sock,
|
|
102
|
+
server_hostname="check-host.net",
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
# fmt: off
|
|
106
|
+
request = (
|
|
107
|
+
b"GET /ip HTTP/1.1\r\n"
|
|
108
|
+
b"Host: check-host.net\r\n"
|
|
109
|
+
b"Connection: close\r\n\r\n"
|
|
110
|
+
)
|
|
111
|
+
# fmt: on
|
|
112
|
+
|
|
113
|
+
sock.sendall(request)
|
|
114
|
+
response = sock.recv(4096)
|
|
115
|
+
print(response)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
fetch()
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### Async (asyncio)
|
|
122
|
+
```python
|
|
123
|
+
import asyncio
|
|
124
|
+
import ssl
|
|
125
|
+
from python_socks.async_.asyncio import Proxy
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
async def fetch():
|
|
129
|
+
proxy = Proxy.from_url("socks5://user:password@127.0.0.1:1080")
|
|
130
|
+
|
|
131
|
+
# `connect` returns standard Python socket in non-blocking mode
|
|
132
|
+
# so we can pass it to asyncio.open_connection(...)
|
|
133
|
+
sock = await proxy.connect(
|
|
134
|
+
dest_host="check-host.net",
|
|
135
|
+
dest_port=443,
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
reader, writer = await asyncio.open_connection(
|
|
139
|
+
sock=sock,
|
|
140
|
+
ssl=ssl.create_default_context(),
|
|
141
|
+
server_hostname="check-host.net",
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
# fmt: off
|
|
145
|
+
request = (
|
|
146
|
+
b"GET /ip HTTP/1.1\r\n"
|
|
147
|
+
b"Host: check-host.net\r\n"
|
|
148
|
+
b"Connection: close\r\n\r\n"
|
|
149
|
+
)
|
|
150
|
+
# fmt: on
|
|
151
|
+
|
|
152
|
+
writer.write(request)
|
|
153
|
+
response = await reader.read(-1)
|
|
154
|
+
print(response)
|
|
155
|
+
|
|
156
|
+
writer.close()
|
|
157
|
+
await writer.wait_closed()
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
asyncio.run(fetch())
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
#### Async (trio)
|
|
164
|
+
```python
|
|
165
|
+
import ssl
|
|
166
|
+
import trio
|
|
167
|
+
from python_socks.async_.trio import Proxy
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
async def fetch():
|
|
171
|
+
proxy = Proxy.from_url("socks5://user:password@127.0.0.1:1080")
|
|
172
|
+
|
|
173
|
+
# `connect` returns trio.socket.SocketType
|
|
174
|
+
# so we can pass it to trio.SocketStream
|
|
175
|
+
sock = await proxy.connect(
|
|
176
|
+
dest_host="check-host.net",
|
|
177
|
+
dest_port=443,
|
|
178
|
+
)
|
|
179
|
+
stream = trio.SocketStream(sock)
|
|
180
|
+
stream = trio.SSLStream(
|
|
181
|
+
stream,
|
|
182
|
+
ssl_context=ssl.create_default_context(),
|
|
183
|
+
server_hostname="check-host.net",
|
|
184
|
+
)
|
|
185
|
+
await stream.do_handshake()
|
|
186
|
+
|
|
187
|
+
# fmt: off
|
|
188
|
+
request = (
|
|
189
|
+
b"GET /ip HTTP/1.1\r\n"
|
|
190
|
+
b"Host: check-host.net\r\n"
|
|
191
|
+
b"Connection: close\r\n\r\n"
|
|
192
|
+
)
|
|
193
|
+
# fmt: on
|
|
194
|
+
|
|
195
|
+
await stream.send_all(request)
|
|
196
|
+
response = await stream.receive_some(4096)
|
|
197
|
+
print(response)
|
|
198
|
+
|
|
199
|
+
await stream.aclose()
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
trio.run(fetch)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
#### Async (anyio)
|
|
206
|
+
```python
|
|
207
|
+
import ssl
|
|
208
|
+
import anyio
|
|
209
|
+
from anyio.streams.tls import TLSStream
|
|
210
|
+
from python_socks.async_.anyio import Proxy
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
async def fetch():
|
|
214
|
+
proxy = Proxy.from_url("socks5://user:password@127.0.0.1:1080")
|
|
215
|
+
|
|
216
|
+
# `connect` returns anyio.abc.SocketStream
|
|
217
|
+
# we can use it directly
|
|
218
|
+
stream = await proxy.connect(
|
|
219
|
+
dest_host="check-host.net",
|
|
220
|
+
dest_port=443,
|
|
221
|
+
)
|
|
222
|
+
stream = await TLSStream.wrap(
|
|
223
|
+
stream,
|
|
224
|
+
ssl_context=ssl.create_default_context(),
|
|
225
|
+
hostname="check-host.net",
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
# fmt: off
|
|
229
|
+
request = (
|
|
230
|
+
b"GET /ip HTTP/1.1\r\n"
|
|
231
|
+
b"Host: check-host.net\r\n"
|
|
232
|
+
b"Connection: close\r\n\r\n"
|
|
233
|
+
)
|
|
234
|
+
# fmt: on
|
|
235
|
+
|
|
236
|
+
await stream.send(request)
|
|
237
|
+
response = await stream.receive(4096)
|
|
238
|
+
print(response)
|
|
239
|
+
|
|
240
|
+
await stream.aclose()
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
anyio.run(fetch)
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## More complex example
|
|
247
|
+
|
|
248
|
+
#### A urllib3 PoolManager that routes connections via the proxy
|
|
249
|
+
|
|
250
|
+
```python
|
|
251
|
+
from urllib3 import PoolManager, HTTPConnectionPool, HTTPSConnectionPool
|
|
252
|
+
from urllib3.connection import HTTPConnection, HTTPSConnection
|
|
253
|
+
from python_socks.sync import Proxy
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
class ProxyHTTPConnection(HTTPConnection):
|
|
257
|
+
def __init__(self, *args, **kwargs):
|
|
258
|
+
socks_options = kwargs.pop("_socks_options")
|
|
259
|
+
self._proxy_url = socks_options["proxy_url"]
|
|
260
|
+
super().__init__(*args, **kwargs)
|
|
261
|
+
|
|
262
|
+
def _new_conn(self):
|
|
263
|
+
proxy = Proxy.from_url(self._proxy_url)
|
|
264
|
+
return proxy.connect(
|
|
265
|
+
dest_host=self.host,
|
|
266
|
+
dest_port=self.port,
|
|
267
|
+
timeout=self.timeout,
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
class ProxyHTTPSConnection(ProxyHTTPConnection, HTTPSConnection):
|
|
272
|
+
pass
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
class ProxyHTTPConnectionPool(HTTPConnectionPool):
|
|
276
|
+
ConnectionCls = ProxyHTTPConnection
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
class ProxyHTTPSConnectionPool(HTTPSConnectionPool):
|
|
280
|
+
ConnectionCls = ProxyHTTPSConnection
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
class ProxyPoolManager(PoolManager):
|
|
284
|
+
def __init__(
|
|
285
|
+
self,
|
|
286
|
+
proxy_url,
|
|
287
|
+
timeout=5,
|
|
288
|
+
num_pools=10,
|
|
289
|
+
headers=None,
|
|
290
|
+
**connection_pool_kw,
|
|
291
|
+
):
|
|
292
|
+
|
|
293
|
+
connection_pool_kw["_socks_options"] = {"proxy_url": proxy_url}
|
|
294
|
+
connection_pool_kw["timeout"] = timeout
|
|
295
|
+
|
|
296
|
+
super().__init__(num_pools, headers, **connection_pool_kw)
|
|
297
|
+
|
|
298
|
+
self.pool_classes_by_scheme = {
|
|
299
|
+
"http": ProxyHTTPConnectionPool,
|
|
300
|
+
"https": ProxyHTTPSConnectionPool,
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
### and how to use it
|
|
305
|
+
manager = ProxyPoolManager("socks5://user:password@127.0.0.1:1080")
|
|
306
|
+
response = manager.request("GET", "https://check-host.net/ip")
|
|
307
|
+
print(response.data)
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
## Proxy Chaining (sync example — same for asyncio, trio, anyio)
|
|
311
|
+
|
|
312
|
+
```python
|
|
313
|
+
import ssl
|
|
314
|
+
from python_socks.sync import Proxy
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
def fetch():
|
|
318
|
+
proxy1 = Proxy.from_url("socks5://user:password@127.0.0.1:1080")
|
|
319
|
+
proxy2 = Proxy.from_url("socks4://127.0.0.1:1081", forward=proxy1)
|
|
320
|
+
proxy3 = Proxy.from_url("http://user:password@127.0.0.1:1082", forward=proxy2)
|
|
321
|
+
|
|
322
|
+
sock = proxy3.connect(
|
|
323
|
+
dest_host="check-host.net",
|
|
324
|
+
dest_port=443,
|
|
325
|
+
)
|
|
326
|
+
|
|
327
|
+
sock = ssl.create_default_context().wrap_socket(
|
|
328
|
+
sock=sock,
|
|
329
|
+
server_hostname="check-host.net",
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
# fmt: off
|
|
333
|
+
request = (
|
|
334
|
+
b"GET /ip HTTP/1.1\r\n"
|
|
335
|
+
b"Host: check-host.net\r\n"
|
|
336
|
+
b"Connection: close\r\n\r\n"
|
|
337
|
+
)
|
|
338
|
+
# fmt: on
|
|
339
|
+
|
|
340
|
+
sock.sendall(request)
|
|
341
|
+
response = sock.recv(4096)
|
|
342
|
+
print(response)
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
fetch()
|
|
346
|
+
```
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
python_socks/__init__.py,sha256=6IejmLHZJBuYvt6V5fFRmsDdE9BI4SHJYw4vQwBS4nU,365
|
|
2
|
+
python_socks/_abc.py,sha256=hWx0g_a1Df5puIzVIn3Dd9_SHF4ADzax4WQZeo-Y8bY,1207
|
|
3
|
+
python_socks/_errors.py,sha256=gfolrrm3V08_v5HTLz0IyLlq14lkyXbOGa_X-ppSFzQ,511
|
|
4
|
+
python_socks/_helpers.py,sha256=NweYNhD0-RimP0TPzfqofp3EFl23WWr6pMP_4g-Tskc,2743
|
|
5
|
+
python_socks/_types.py,sha256=G4Pktu-z8eJmdmlt6t8gnMT5-kuZQkY7Vmy1Nx0rdIw,157
|
|
6
|
+
python_socks/_version.py,sha256=IDLGnOO0HqgubX0FroxCqZQ1glwT5MN-OdAtMXKqdgA,49
|
|
7
|
+
python_socks/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
python_socks/_connectors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
python_socks/_connectors/abc.py,sha256=FaLueczebKhIH0CvOfw232hE_SlKc8BY2hWfCXNpxmI,435
|
|
10
|
+
python_socks/_connectors/factory_async.py,sha256=ni429tDujO-xjv7Q7mvJ4yqwT2hrk9sqU4_2CZe30cg,1069
|
|
11
|
+
python_socks/_connectors/factory_sync.py,sha256=t3C2pV4NISkSOezzIysunyp9Xz2wKyLfTSPK6eP2QoQ,1056
|
|
12
|
+
python_socks/_connectors/http_async.py,sha256=AjlS_PgKxU1M1EVlYDRFIl_fM8HG3fSlng3ueqZSqQY,956
|
|
13
|
+
python_socks/_connectors/http_sync.py,sha256=W1FrclTg-4shC2KkDaBQ616BTpjrFFEz01cIyYrBHUQ,931
|
|
14
|
+
python_socks/_connectors/socks4_async.py,sha256=OS-dDXQNtSrz5YjZqn-VXQ4PEqOJwVdVP6JfZ5HQyR0,1202
|
|
15
|
+
python_socks/_connectors/socks4_sync.py,sha256=lnQ2EueNvPlSJg8WHV1ZlLlsffMsZPFEt-eTa5KD6NY,1171
|
|
16
|
+
python_socks/_connectors/socks5_async.py,sha256=NWjUYubjCuT9Kxz02LLQbhgotzUug_J-GKxIaxGgmbs,3091
|
|
17
|
+
python_socks/_connectors/socks5_sync.py,sha256=_Au7HLSC3UPVORyC4ziFOXisxetTItIqqH7iEjhSR7g,2907
|
|
18
|
+
python_socks/_protocols/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
+
python_socks/_protocols/errors.py,sha256=rtQo2fM92Oc41ELMBPvyY2zHZomGAxXWRL0_3rzm9FM,269
|
|
20
|
+
python_socks/_protocols/http.py,sha256=aq1THZoNi6cqAfvcGRx5guNbWqYgsM0X88b9olerkAA,4987
|
|
21
|
+
python_socks/_protocols/socks4.py,sha256=F2sEgWYe19asMH4AtD4htlEnRlQBN641HQqoFKivVpw,3071
|
|
22
|
+
python_socks/_protocols/socks5.py,sha256=grVRKgRVm6xMBgX9MwUVXTJ515-tLOYGXYyfnH7AIXA,10147
|
|
23
|
+
python_socks/async_/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
+
python_socks/async_/anyio/__init__.py,sha256=4M0l4I7yH3TNjeBjHqQfZWEZD7uCFf-wQzWkUREm5Hc,62
|
|
25
|
+
python_socks/async_/anyio/_connect.py,sha256=z2Uq2909RmTH9oABoYoIBXjdgbfEAX2wFxSWdDNcDzc,305
|
|
26
|
+
python_socks/async_/anyio/_proxy.py,sha256=HdMguf864waZMoLIpFMTuifegsBUSscgV2mCaC-xrF8,3741
|
|
27
|
+
python_socks/async_/anyio/_resolver.py,sha256=VotJDC-fs_EWNLzm_x0gys-kUvlkxeV1x1JYezpPuhE,711
|
|
28
|
+
python_socks/async_/anyio/_stream.py,sha256=xCMMjst07gsDbVM9cW_kzCB3ULApozfNOW3k2xs1XwY,1301
|
|
29
|
+
python_socks/async_/anyio/v2/__init__.py,sha256=4M0l4I7yH3TNjeBjHqQfZWEZD7uCFf-wQzWkUREm5Hc,62
|
|
30
|
+
python_socks/async_/anyio/v2/_connect.py,sha256=9XAnQX8WXpsfEYJDJwpudD0kLwIl4apnusV9jbhRASI,352
|
|
31
|
+
python_socks/async_/anyio/v2/_proxy.py,sha256=1JRDH2R1fxE7VnonIWrSFpXvV3hP4AxsrCO9plcKW_4,4237
|
|
32
|
+
python_socks/async_/anyio/v2/_stream.py,sha256=lj4SvetB5stU0KE6uG1fuW5sGrW_GZ1XpPX_GojrwKk,1704
|
|
33
|
+
python_socks/async_/asyncio/__init__.py,sha256=vryJNtCqDYriwWhmlB279WN7XI1dbELUAOrsMXWN2Ww,64
|
|
34
|
+
python_socks/async_/asyncio/_connect.py,sha256=_lmJj_1Bs_mASeCv5j9bI_o_wgu8YMI8zeUStfzd6_g,1240
|
|
35
|
+
python_socks/async_/asyncio/_proxy.py,sha256=t0OKUBa9MQ3xTarNRIvuYSb83K2V9k95C0UupExqa0k,4120
|
|
36
|
+
python_socks/async_/asyncio/_resolver.py,sha256=9kHNrBk8Cf_gULxCix_yB7G5wjueLUQ_FPzq25DjsD4,871
|
|
37
|
+
python_socks/async_/asyncio/_stream.py,sha256=p2XMTbrnXwz23jGd4NPYIcpgx1nZnNjn7aw7w0R-Dcg,1067
|
|
38
|
+
python_socks/async_/asyncio/v2/__init__.py,sha256=vryJNtCqDYriwWhmlB279WN7XI1dbELUAOrsMXWN2Ww,64
|
|
39
|
+
python_socks/async_/asyncio/v2/_connect.py,sha256=W5ZaQF-jY1yxD_WjiuFUot0gADeY-QiCFFaXm5Nfj5I,625
|
|
40
|
+
python_socks/async_/asyncio/v2/_proxy.py,sha256=iqngXtYYD79yHAnMHIc5UxsTlzRQZiY8pL2seBnxYI4,4935
|
|
41
|
+
python_socks/async_/asyncio/v2/_stream.py,sha256=t4C5eUajR-Bfb5jSJ2o3t3v4LVJ_M3lCWF47suHERwk,2798
|
|
42
|
+
python_socks/async_/trio/__init__.py,sha256=-SQ1iuGgZ3A9YUaVKF8Q12lCj_e-5Kytd9P3zJwaoy0,61
|
|
43
|
+
python_socks/async_/trio/_connect.py,sha256=Zvdun2nXdMmbXACEQsKnmRcUmB8fCLuiJD21gXnfv8c,910
|
|
44
|
+
python_socks/async_/trio/_proxy.py,sha256=LhacHbqElxSZK9nWmyTAbbBc5cAqZ8MrlylkD52-3Po,3793
|
|
45
|
+
python_socks/async_/trio/_resolver.py,sha256=cAFm7fEwg9lG5QaeXBFhrLJKju-nqTE9gs_VislMzRg,755
|
|
46
|
+
python_socks/async_/trio/_stream.py,sha256=dDmBoqJxmF1DIZFRzoy86wu90vezT88M5TqxD_q2yzE,1138
|
|
47
|
+
python_socks/async_/trio/v2/__init__.py,sha256=-SQ1iuGgZ3A9YUaVKF8Q12lCj_e-5Kytd9P3zJwaoy0,61
|
|
48
|
+
python_socks/async_/trio/v2/_connect.py,sha256=1AIy6xjv64BDyZzCrfE-1Ad-GT5_zoMH7hbkrPfOcOg,365
|
|
49
|
+
python_socks/async_/trio/v2/_proxy.py,sha256=igiZ25e_zo7UZ6TCNdCUxoMW9PPyy7bnfNNqW1bSQnI,4315
|
|
50
|
+
python_socks/async_/trio/v2/_stream.py,sha256=LNuEv4cntWpBN0zLUyvdQ74Skhvk2FdaOILaIkic9Tk,1620
|
|
51
|
+
python_socks/sync/__init__.py,sha256=O9lYydn6a2z0QSz8hoZjxL6OqQQ873i8Zy1ye67iR8k,61
|
|
52
|
+
python_socks/sync/_connect.py,sha256=SSkmuekFEGK7GMm4ffUo--29SuOkfLgeFvyt0KCphjM,339
|
|
53
|
+
python_socks/sync/_proxy.py,sha256=uqIIDbgmnk3v0NcqC966_ljU5qHI_Uem0VMB98DxuAk,3317
|
|
54
|
+
python_socks/sync/_resolver.py,sha256=IUpXerBFIhOciM_CJ_I29IKMGI49yEUJKD02SOb_BHE,750
|
|
55
|
+
python_socks/sync/_stream.py,sha256=wuonNLZwtKtuvOMhgAoEsONNK0_tH0MYben_J1sjLBk,922
|
|
56
|
+
python_socks/sync/v2/__init__.py,sha256=O9lYydn6a2z0QSz8hoZjxL6OqQQ873i8Zy1ye67iR8k,61
|
|
57
|
+
python_socks/sync/v2/_connect.py,sha256=TQGD3j8qwHjJqqzLRubmwmIMhkoWRfQd4351ipTY4mU,416
|
|
58
|
+
python_socks/sync/v2/_proxy.py,sha256=sD2vVKvXEfSw5IzzDcwp45DElkKB33lsT6ZCKXcoxPk,3815
|
|
59
|
+
python_socks/sync/v2/_ssl_transport.py,sha256=z3fB52pH7tqOADyICuoJF1YYKTs1ogkeR3K-J8v6P0w,6123
|
|
60
|
+
python_socks/sync/v2/_stream.py,sha256=23srzyxyP7o7KtEdNQllZIvPIxBZ8oC_rV0bkd4jui8,1744
|
|
61
|
+
python_socks-3.0.0.dist-info/licenses/LICENSE.txt,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
62
|
+
python_socks-3.0.0.dist-info/METADATA,sha256=vmOXG6pVTxNJzJeDUVPlvOMS0tj2PqN2B0_Oenym9Lo,8923
|
|
63
|
+
python_socks-3.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
64
|
+
python_socks-3.0.0.dist-info/top_level.txt,sha256=7qyDAVwjTZ0sIYG1iatFbE-SLpWhONjaoMQ0Ib2DX0Q,13
|
|
65
|
+
python_socks-3.0.0.dist-info/RECORD,,
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
from typing import Iterable
|
|
2
|
-
import warnings
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class ProxyChain:
|
|
6
|
-
def __init__(self, proxies: Iterable):
|
|
7
|
-
warnings.warn(
|
|
8
|
-
'This implementation of ProxyChain is deprecated and will be removed in the future',
|
|
9
|
-
DeprecationWarning,
|
|
10
|
-
stacklevel=2,
|
|
11
|
-
)
|
|
12
|
-
self._proxies = proxies
|
|
13
|
-
|
|
14
|
-
async def connect(self, dest_host, dest_port, timeout=None):
|
|
15
|
-
curr_socket = None
|
|
16
|
-
proxies = list(self._proxies)
|
|
17
|
-
|
|
18
|
-
length = len(proxies) - 1
|
|
19
|
-
for i in range(length):
|
|
20
|
-
curr_socket = await proxies[i].connect(
|
|
21
|
-
dest_host=proxies[i + 1].proxy_host,
|
|
22
|
-
dest_port=proxies[i + 1].proxy_port,
|
|
23
|
-
timeout=timeout,
|
|
24
|
-
_socket=curr_socket,
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
curr_socket = await proxies[length].connect(
|
|
28
|
-
dest_host=dest_host,
|
|
29
|
-
dest_port=dest_port,
|
|
30
|
-
timeout=timeout,
|
|
31
|
-
_socket=curr_socket,
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
return curr_socket
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
from typing import Iterable
|
|
2
|
-
import warnings
|
|
3
|
-
from ._proxy import AnyioProxy
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class ProxyChain:
|
|
7
|
-
def __init__(self, proxies: Iterable[AnyioProxy]):
|
|
8
|
-
warnings.warn(
|
|
9
|
-
'This implementation of ProxyChain is deprecated and will be removed in the future',
|
|
10
|
-
DeprecationWarning,
|
|
11
|
-
stacklevel=2,
|
|
12
|
-
)
|
|
13
|
-
self._proxies = proxies
|
|
14
|
-
|
|
15
|
-
async def connect(
|
|
16
|
-
self,
|
|
17
|
-
dest_host,
|
|
18
|
-
dest_port,
|
|
19
|
-
dest_ssl=None,
|
|
20
|
-
timeout=None,
|
|
21
|
-
):
|
|
22
|
-
_stream = None
|
|
23
|
-
proxies = list(self._proxies)
|
|
24
|
-
|
|
25
|
-
length = len(proxies) - 1
|
|
26
|
-
for i in range(length):
|
|
27
|
-
_stream = await proxies[i].connect(
|
|
28
|
-
dest_host=proxies[i + 1].proxy_host,
|
|
29
|
-
dest_port=proxies[i + 1].proxy_port,
|
|
30
|
-
timeout=timeout,
|
|
31
|
-
_stream=_stream,
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
_stream = await proxies[length].connect(
|
|
35
|
-
dest_host=dest_host,
|
|
36
|
-
dest_port=dest_port,
|
|
37
|
-
dest_ssl=dest_ssl,
|
|
38
|
-
timeout=timeout,
|
|
39
|
-
_stream=_stream,
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
return _stream
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
from typing import Sequence
|
|
2
|
-
import warnings
|
|
3
|
-
from ._proxy import AnyioProxy
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class ProxyChain:
|
|
7
|
-
def __init__(self, proxies: Sequence[AnyioProxy]):
|
|
8
|
-
warnings.warn(
|
|
9
|
-
'This implementation of ProxyChain is deprecated and will be removed in the future',
|
|
10
|
-
DeprecationWarning,
|
|
11
|
-
stacklevel=2,
|
|
12
|
-
)
|
|
13
|
-
self._proxies = proxies
|
|
14
|
-
|
|
15
|
-
async def connect(
|
|
16
|
-
self,
|
|
17
|
-
dest_host,
|
|
18
|
-
dest_port,
|
|
19
|
-
dest_ssl=None,
|
|
20
|
-
timeout=None,
|
|
21
|
-
):
|
|
22
|
-
forward = None
|
|
23
|
-
for proxy in self._proxies:
|
|
24
|
-
proxy._forward = forward
|
|
25
|
-
forward = proxy
|
|
26
|
-
|
|
27
|
-
return await forward.connect(
|
|
28
|
-
dest_host=dest_host,
|
|
29
|
-
dest_port=dest_port,
|
|
30
|
-
dest_ssl=dest_ssl,
|
|
31
|
-
timeout=timeout,
|
|
32
|
-
)
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
from typing import Sequence
|
|
2
|
-
import warnings
|
|
3
|
-
from ._proxy import AsyncioProxy
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class ProxyChain:
|
|
7
|
-
def __init__(self, proxies: Sequence[AsyncioProxy]):
|
|
8
|
-
warnings.warn(
|
|
9
|
-
'This implementation of ProxyChain is deprecated and will be removed in the future',
|
|
10
|
-
DeprecationWarning,
|
|
11
|
-
stacklevel=2,
|
|
12
|
-
)
|
|
13
|
-
self._proxies = proxies
|
|
14
|
-
|
|
15
|
-
async def connect(
|
|
16
|
-
self,
|
|
17
|
-
dest_host: str,
|
|
18
|
-
dest_port: int,
|
|
19
|
-
dest_ssl=None,
|
|
20
|
-
timeout=None,
|
|
21
|
-
):
|
|
22
|
-
forward = None
|
|
23
|
-
for proxy in self._proxies:
|
|
24
|
-
proxy._forward = forward
|
|
25
|
-
forward = proxy
|
|
26
|
-
|
|
27
|
-
return await forward.connect(
|
|
28
|
-
dest_host=dest_host,
|
|
29
|
-
dest_port=dest_port,
|
|
30
|
-
dest_ssl=dest_ssl,
|
|
31
|
-
timeout=timeout,
|
|
32
|
-
)
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
from typing import Optional, Tuple
|
|
2
|
-
|
|
3
|
-
import curio
|
|
4
|
-
import curio.io
|
|
5
|
-
import curio.socket
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
async def connect_tcp(
|
|
9
|
-
host: str,
|
|
10
|
-
port: int,
|
|
11
|
-
local_addr: Optional[Tuple[str, int]] = None,
|
|
12
|
-
) -> curio.io.Socket:
|
|
13
|
-
return await curio.open_connection(
|
|
14
|
-
host=host,
|
|
15
|
-
port=port,
|
|
16
|
-
source_addr=local_addr,
|
|
17
|
-
)
|