auto-proxy-vpn 0.1.0__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.
Files changed (40) hide show
  1. auto_proxy_vpn-0.1.0/LICENSE +20 -0
  2. auto_proxy_vpn-0.1.0/PKG-INFO +568 -0
  3. auto_proxy_vpn-0.1.0/README.md +517 -0
  4. auto_proxy_vpn-0.1.0/auto_proxy_vpn/__init__.py +26 -0
  5. auto_proxy_vpn-0.1.0/auto_proxy_vpn/configs.py +59 -0
  6. auto_proxy_vpn-0.1.0/auto_proxy_vpn/manager_register.py +71 -0
  7. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/alibaba/__init__.py +0 -0
  8. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/alibaba/alibaba_proxy.py +0 -0
  9. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/aws/__init__.py +0 -0
  10. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/aws/aws_proxy.py +0 -0
  11. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/azure/__init__.py +1 -0
  12. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/azure/azure_proxy.py +569 -0
  13. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/azure/azure_utils.py +244 -0
  14. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/digitalocean/__init__.py +1 -0
  15. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/digitalocean/digitalocean_exceptions.py +3 -0
  16. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/digitalocean/digitalocean_proxy.py +459 -0
  17. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/digitalocean/digitalocean_utils.py +255 -0
  18. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/google/__init__.py +1 -0
  19. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/google/google_exceptions.py +3 -0
  20. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/google/google_proxy.py +600 -0
  21. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/google/google_utils.py +247 -0
  22. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/google/google_vpn.py +0 -0
  23. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/oracle/__init__.py +0 -0
  24. auto_proxy_vpn-0.1.0/auto_proxy_vpn/providers/oracle/oracle_proxy.py +0 -0
  25. auto_proxy_vpn-0.1.0/auto_proxy_vpn/proxy_pool.py +256 -0
  26. auto_proxy_vpn-0.1.0/auto_proxy_vpn/utils/__init__.py +0 -0
  27. auto_proxy_vpn-0.1.0/auto_proxy_vpn/utils/base_proxy.py +372 -0
  28. auto_proxy_vpn-0.1.0/auto_proxy_vpn/utils/base_vpn.py +0 -0
  29. auto_proxy_vpn-0.1.0/auto_proxy_vpn/utils/exceptions.py +7 -0
  30. auto_proxy_vpn-0.1.0/auto_proxy_vpn/utils/files_utils.py +56 -0
  31. auto_proxy_vpn-0.1.0/auto_proxy_vpn/utils/ssh_client.py +87 -0
  32. auto_proxy_vpn-0.1.0/auto_proxy_vpn/utils/util.py +34 -0
  33. auto_proxy_vpn-0.1.0/auto_proxy_vpn.egg-info/PKG-INFO +568 -0
  34. auto_proxy_vpn-0.1.0/auto_proxy_vpn.egg-info/SOURCES.txt +38 -0
  35. auto_proxy_vpn-0.1.0/auto_proxy_vpn.egg-info/dependency_links.txt +1 -0
  36. auto_proxy_vpn-0.1.0/auto_proxy_vpn.egg-info/requires.txt +18 -0
  37. auto_proxy_vpn-0.1.0/auto_proxy_vpn.egg-info/top_level.txt +1 -0
  38. auto_proxy_vpn-0.1.0/pyproject.toml +62 -0
  39. auto_proxy_vpn-0.1.0/setup.cfg +4 -0
  40. auto_proxy_vpn-0.1.0/setup.py +3 -0
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ignasi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR
@@ -0,0 +1,568 @@
1
+ Metadata-Version: 2.4
2
+ Name: auto_proxy_vpn
3
+ Version: 0.1.0
4
+ Summary: A package to create on demand proxies and vpns in different cloud providers.
5
+ License: MIT License
6
+
7
+ Copyright (c) 2026 Ignasi
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR
25
+ Keywords: vpn,proxy,networking,cloud,security,web scrapping
26
+ Classifier: Programming Language :: Python :: 3
27
+ Classifier: License :: OSI Approved :: MIT License
28
+ Classifier: Operating System :: OS Independent
29
+ Classifier: Topic :: Internet :: Proxy Servers
30
+ Classifier: Topic :: Security
31
+ Classifier: Topic :: System :: Networking
32
+ Requires-Python: >=3.10
33
+ Description-Content-Type: text/markdown
34
+ License-File: LICENSE
35
+ Requires-Dist: requests
36
+ Provides-Extra: test
37
+ Requires-Dist: pytest; extra == "test"
38
+ Requires-Dist: pytest-cov; extra == "test"
39
+ Requires-Dist: pytest-mock; extra == "test"
40
+ Requires-Dist: responses; extra == "test"
41
+ Requires-Dist: python-dotenv; extra == "test"
42
+ Provides-Extra: google
43
+ Requires-Dist: google-cloud-compute; extra == "google"
44
+ Provides-Extra: azure
45
+ Requires-Dist: azure-identity; extra == "azure"
46
+ Requires-Dist: azure-mgmt-subscription; extra == "azure"
47
+ Requires-Dist: azure-mgmt-resource; extra == "azure"
48
+ Requires-Dist: azure-mgmt-network; extra == "azure"
49
+ Requires-Dist: azure-mgmt-compute; extra == "azure"
50
+ Dynamic: license-file
51
+
52
+ <p align="center">
53
+ <h1 align="center">Auto proxy vpn</h1>
54
+ <p align="center">
55
+ On-demand proxies and VPNs across multiple cloud providers — from a single Python call.
56
+ </p>
57
+ </p>
58
+
59
+ <p align="center">
60
+ <a href="#installation">Installation</a> &nbsp;·&nbsp;
61
+ <a href="#quick-start">Quick Start</a> &nbsp;·&nbsp;
62
+ <a href="#supported-providers">Providers</a> &nbsp;·&nbsp;
63
+ <a href="#proxy-pool">Proxy Pool</a> &nbsp;·&nbsp;
64
+ <a href="#api-reference">API Reference</a> &nbsp;·&nbsp;
65
+ <a href="#limitations">Limitations</a>
66
+ <!-- hide-nav-contributing -->
67
+ &nbsp;·&nbsp;
68
+ <a href="#contributing">Contributing</a>
69
+ <!-- /hide-nav-contributing -->
70
+ </p>
71
+
72
+ ---
73
+
74
+ **auto_proxy_vpn** is a Python library that provisions disposable HTTP(S) proxy servers (and WireGuard VPNs) on major cloud platforms. Each proxy runs [Squid](http://www.squid-cache.org/) on a fresh VM/droplet, is accessible in one or two minutes, and is cleaned up automatically when you're done.
75
+
76
+ **Key features:**
77
+
78
+ - **Multi-cloud** — spin up proxies on Google Cloud, Azure, or DigitalOcean with the same API.
79
+ - **Zero infrastructure** — no pre-existing VMs, containers, or images required.
80
+ - **Context manager support** — resources are created on entry and destroyed on exit.
81
+ - **Proxy Pool** — distribute proxy creation across multiple providers with a single call.
82
+ - **Multi-account** — use multiple accounts per provider in the same pool to multiply capacity and avoid rate limits.
83
+ - **Batch creation** — provision multiple proxies at once with `create_batch()`.
84
+ - **Async-friendly** — return faster and poll readiness later.
85
+ - **Random region by default** — each proxy is deployed by default to a randomly selected region, maximizing IP diversity out of the box.
86
+ - **Basic auth & IP filtering** — optional Squid authentication and source-IP firewall rules.
87
+ - **Reconnect** — reload a previously created proxy by name without re-provisioning.
88
+
89
+ > **⚠️ Responsible Use:** This tool is intended for legitimate purposes such as testing, privacy, and accessing geo-restricted content you have rights to. If you use it for web scraping, please respect each website's `robots.txt`, rate limits, and terms of service. Hammering servers or bypassing protections you're not supposed to bypass isn't cool — and it gives tools like this a bad name.
90
+
91
+ ## Table of Contents
92
+
93
+ - [Installation](#installation)
94
+ - [Quick Start](#quick-start)
95
+ - [Supported Providers](#supported-providers)
96
+ - [Provider Setup Guides](#provider-setup-guides)
97
+ - [Usage](#usage)
98
+ - [Single Provider](#single-provider)
99
+ - [Proxy Pool (Multi-Provider)](#proxy-pool)
100
+ - [Batch Creation](#batch-creation)
101
+ - [Authentication & IP Filtering](#authentication--ip-filtering)
102
+ - [Asynchronous Creation](#asynchronous-creation)
103
+ - [Reconnecting to Existing Proxies](#reconnecting-to-existing-proxies)
104
+ - [API Reference](#api-reference)
105
+ - [ProxyPool](#proxypool)
106
+ - [BaseProxy](#baseproxy)
107
+ - [ProxyBatch](#proxybatch)
108
+ - [Configuration Objects](#configuration-objects)
109
+ - [Limitations](#limitations)
110
+ - [Project Structure](#project-structure)
111
+ - [Contributing](#contributing)
112
+
113
+ ---
114
+
115
+ ## Installation
116
+
117
+ ```bash
118
+ pip install auto_proxy_vpn
119
+ ```
120
+
121
+ Then install provider-specific optional dependencies (extras):
122
+
123
+ | Provider | Extra packages |
124
+ |---|---|
125
+ | **DigitalOcean** | *(none — uses `requests`, already included)* |
126
+ | **Google Cloud** | `pip install auto_proxy_vpn[google]` |
127
+ | **Azure** | `pip install auto_proxy_vpn[azure]` |
128
+
129
+ Install multiple extras together if needed:
130
+
131
+ ```bash
132
+ pip install auto_proxy_vpn[google,azure]
133
+ ```
134
+
135
+ ## Quick Start
136
+
137
+ ### 1. DigitalOcean — simplest setup
138
+
139
+ ```python
140
+ from auto_proxy_vpn.providers.digitalocean import ProxyManagerDigitalOcean
141
+
142
+ manager = ProxyManagerDigitalOcean(
143
+ ssh_key="my-existing-key-name",
144
+ token="dop_v1_xxxx..." # or set DIGITALOCEAN_API_TOKEN env var
145
+ )
146
+
147
+ with manager.get_proxy() as proxy:
148
+ import requests
149
+ r = requests.get("https://httpbin.org/ip", proxies=proxy.get_proxy())
150
+ print(r.json())
151
+ # Droplet is destroyed automatically
152
+ ```
153
+
154
+ ### 2. Google Cloud
155
+
156
+ ```python
157
+ from auto_proxy_vpn.providers.google import ProxyManagerGoogle
158
+
159
+ manager = ProxyManagerGoogle(
160
+ project="my-gcp-project-id",
161
+ ssh_key="ssh-rsa AAAAB3...",
162
+ credentials="google_credentials.json" # or set GOOGLE_APPLICATION_CREDENTIALS
163
+ )
164
+
165
+ with manager.get_proxy() as proxy:
166
+ print(proxy.get_proxy_str()) # http://203.0.113.42:38721
167
+ ```
168
+
169
+ ### 3. Azure
170
+
171
+ ```python
172
+ from auto_proxy_vpn.providers.azure import ProxyManagerAzure
173
+
174
+ manager = ProxyManagerAzure(
175
+ ssh_key="ssh-rsa AAAAB3...",
176
+ credentials={
177
+ "AZURE_SUBSCRIPTION_ID": "xxxx-...",
178
+ "AZURE_CLIENT_ID": "xxxx-...",
179
+ "AZURE_CLIENT_SECRET": "xxxx-...",
180
+ "AZURE_TENANT_ID": "xxxx-...",
181
+ }
182
+ # or set env vars and use: credentials="your-subscription-id"
183
+ # or az login and use: credentials="your-subscription-id"
184
+ )
185
+
186
+ with manager.get_proxy() as proxy:
187
+ print(proxy.get_proxy_str())
188
+ ```
189
+
190
+ ### 4. Multi-cloud with ProxyPool
191
+
192
+ ```python
193
+ from auto_proxy_vpn import ProxyPool, GoogleConfig, AzureConfig, DigitalOceanConfig
194
+
195
+ pool = ProxyPool(
196
+ GoogleConfig(project="my-project", ssh_key="ssh-rsa AAAA..."),
197
+ AzureConfig(ssh_key="ssh-rsa AAAA..."),
198
+ DigitalOceanConfig(ssh_key="my-key", token="dop_v1_xxxx..."),
199
+ )
200
+
201
+ # One proxy from a randomly selected provider
202
+ with pool.create_one() as proxy:
203
+ print(proxy.get_proxy_str())
204
+
205
+ # Batch of 6 proxies distributed evenly across providers
206
+ with pool.create_batch(6) as batch:
207
+ for proxy in batch:
208
+ print(proxy)
209
+ ```
210
+
211
+ ---
212
+
213
+ ## Supported Providers
214
+
215
+ | Provider | Proxy | VPN | Status |
216
+ |---|---|---|---|
217
+ | **Google Cloud** | Yes | - | Stable |
218
+ | **Azure** | Yes | — | Stable |
219
+ | **DigitalOcean** | Yes | - | Stable |
220
+ | AWS | — | — | Planned |
221
+ | Oracle Cloud | — | — | Planned |
222
+ | Alibaba Cloud | — | — | Planned |
223
+
224
+ ---
225
+
226
+ ## Provider Setup Guides
227
+
228
+ Each provider has its own README with step-by-step credential setup, full API reference, and advanced usage examples:
229
+
230
+ | Provider | Guide |
231
+ |---|---|
232
+ | Google Cloud | [Google docs](auto_proxy_vpn/providers/google/README.md) |
233
+ | Azure | [Azure docs](auto_proxy_vpn/providers/azure/README.md) |
234
+ | DigitalOcean | [DigitalOcean docs](auto_proxy_vpn/providers/digitalocean/README.md) |
235
+
236
+ > **Security:** All guides recommend storing credentials in a `.env` file (never via `export` in shell history or committed to version control). See each provider README for details.
237
+
238
+ ---
239
+
240
+ ## Usage
241
+
242
+ ### Single Provider
243
+
244
+ Every provider exposes a **Manager** class that creates and manages proxy instances:
245
+
246
+ ```python
247
+ from auto_proxy_vpn.providers.digitalocean import ProxyManagerDigitalOcean
248
+
249
+ manager = ProxyManagerDigitalOcean(ssh_key="my-key")
250
+
251
+ # Context manager (recommended) — auto-cleanup on exit
252
+ with manager.get_proxy() as proxy:
253
+ response = requests.get("https://example.com", proxies=proxy.get_proxy())
254
+
255
+ # Manual lifecycle
256
+ proxy = manager.get_proxy()
257
+ try:
258
+ response = requests.get("https://example.com", proxies=proxy.get_proxy())
259
+ finally:
260
+ proxy.close()
261
+ ```
262
+
263
+ ### Proxy Pool
264
+
265
+ `ProxyPool` distributes proxy creation across multiple providers **and multiple accounts of the same provider**. Each config object with different credentials creates a separate manager — proxies are then distributed evenly across all of them using round-robin random selection:
266
+
267
+ ```python
268
+ from auto_proxy_vpn import ProxyPool, GoogleConfig, AzureConfig, DigitalOceanConfig
269
+
270
+ pool = ProxyPool(
271
+ GoogleConfig(project="my-project", ssh_key="ssh_keys"),
272
+ DigitalOceanConfig(ssh_key="my-key"),
273
+ )
274
+
275
+ proxy = pool.create_one(size="small", on_exit="destroy")
276
+ # do something with the proxy
277
+ proxy.close()
278
+
279
+ # or with context manager
280
+ with pool.create_one(size="small", on_exit="destroy") as proxy:
281
+ response = requests.get("https://example.com", proxies=proxy.get_proxy())
282
+ ```
283
+
284
+ #### Multi-account per provider
285
+
286
+ Pass multiple configs for the same provider with different credentials to multiply your capacity and distribute load across accounts. If a config omits credentials, the corresponding environment variable is used as fallback (e.g. `GOOGLE_APPLICATION_CREDENTIALS`, `AZURE_SUBSCRIPTION_ID`, `DIGITALOCEAN_API_TOKEN`):
287
+
288
+ ```python
289
+ pool = ProxyPool(
290
+ # Account 1: explicit credentials
291
+ GoogleConfig(project="project-1", ssh_key="ssh_keys", credentials="creds_1.json"),
292
+ # Account 2: uses GOOGLE_APPLICATION_CREDENTIALS env var
293
+ GoogleConfig(project="project-2", ssh_key="ssh_keys"),
294
+ # Plus an Azure account
295
+ AzureConfig(ssh_key="ssh-rsa AAAA..."),
296
+ )
297
+
298
+ # 9 proxies distributed across 3 managers (≈3 each)
299
+ with pool.create_batch(9) as batch:
300
+ for proxy in batch:
301
+ print(proxy)
302
+ ```
303
+
304
+ ### Batch Creation
305
+
306
+ Create multiple proxies at once — they are provisioned asynchronously by default:
307
+
308
+ ```python
309
+ with pool.create_batch(6) as batch:
310
+ for proxy in batch:
311
+ print(proxy.get_proxy_str())
312
+ # All 6 proxies are destroyed on exit
313
+
314
+ # or
315
+ batch = pool.create_batch(6)
316
+ for proxy in batch:
317
+ print(proxy.get_proxy_str())
318
+ batch.close()
319
+ ```
320
+
321
+ Or directly from a single manager:
322
+
323
+ ```python
324
+ batch = manager.get_proxies(
325
+ number=3,
326
+ sizes=["small", "medium", "large"],
327
+ is_async=True,
328
+ )
329
+ # Use batch[0], batch[1], batch[2]
330
+ batch.close()
331
+ ```
332
+
333
+ ### Authentication & IP Filtering
334
+
335
+ ```python
336
+ proxy = manager.get_proxy(
337
+ auth={"user": "myuser", "password": "s3cret"},
338
+ allowed_ips=["203.0.113.10", "198.51.100.0/24"],
339
+ )
340
+ # Proxy URL: http://myuser:s3cret@<ip>:<port>
341
+ # Only listed IPs (+ your current IP, auto-added) can connect
342
+ ```
343
+
344
+ ### Asynchronous Creation
345
+
346
+ Return immediately without blocking on VM provisioning:
347
+
348
+ ```python
349
+ proxy = manager.get_proxy(is_async=True)
350
+
351
+ # ... do other work ...
352
+
353
+ # Block until the proxy is ready
354
+ if proxy.is_active(wait=True):
355
+ r = requests.get("https://example.com", proxies=proxy.get_proxy())
356
+ ```
357
+
358
+ ### Reconnecting to Existing Proxies
359
+
360
+ If a proxy was created with `on_exit="keep"`, it remains running after `close()`. Reconnect later by name:
361
+
362
+ ```python
363
+ # Create and keep alive
364
+ proxy = manager.get_proxy(on_exit="keep")
365
+ print(proxy.name) # "proxy1"
366
+ proxy.close() # resources are NOT deleted
367
+
368
+ # Later session — reconnect
369
+ proxy = manager.get_proxy_by_name("proxy1", on_exit="destroy")
370
+ ```
371
+
372
+ List all running proxies:
373
+
374
+ ```python
375
+ names = manager.get_running_proxy_names()
376
+ # ["proxy1", "proxy2"]
377
+ ```
378
+
379
+ ---
380
+
381
+ ## API Reference
382
+
383
+ ### `ProxyPool`
384
+
385
+ High-level orchestrator that distributes proxy creation across providers.
386
+
387
+ ```python
388
+ from auto_proxy_vpn import ProxyPool
389
+
390
+ pool = ProxyPool(
391
+ *provider_configs, # GoogleConfig, AzureConfig, DigitalOceanConfig, ...
392
+ log=True,
393
+ log_file=None,
394
+ log_format="%(asctime)-10s %(levelname)-5s %(message)s",
395
+ logger=None,
396
+ )
397
+ ```
398
+
399
+ | Method | Returns | Description |
400
+ |---|---|---|
401
+ | `create_one(...)` | `BaseProxy` | Create one proxy from a randomly selected provider |
402
+ | `create_batch(count, ...)` | `ProxyBatch` | Create `count` proxies distributed across providers |
403
+
404
+ Both methods accept the same proxy parameters: `port`, `size`, `region`, `auth`, `allowed_ips`, `is_async`, `retry`, `proxy_name`/`proxy_names`, and `on_exit`.
405
+
406
+ ---
407
+
408
+ ### `BaseProxy`
409
+
410
+ Common interface shared by all proxy instances (`GoogleProxy`, `AzureProxy`, `DigitalOceanProxy`).
411
+
412
+ | Property | Type | Description |
413
+ |---|---|---|
414
+ | `ip` | `str` | Public IPv4 address |
415
+ | `port` | `int` | Proxy TCP port |
416
+ | `name` | `str` | Instance/droplet name |
417
+ | `active` | `bool` | Whether the proxy is confirmed reachable |
418
+ | `user` | `str` | Basic-auth username (empty if none) |
419
+ | `password` | `str` | Basic-auth password (empty if none) |
420
+
421
+ | Method | Returns | Description |
422
+ |---|---|---|
423
+ | `get_proxy_str()` | `str` | Full proxy URL: `http://user:pass@ip:port` |
424
+ | `get_proxy()` | `dict \| None` | `{"http": url, "https": url}` for `requests` |
425
+ | `is_active(wait=False)` | `bool` | Check or wait for proxy readiness |
426
+ | `close(wait=True)` | `None` | Destroy or keep the proxy (depends on `on_exit`) |
427
+
428
+ **Context manager:**
429
+
430
+ ```python
431
+ with manager.get_proxy() as proxy:
432
+ # proxy is guaranteed active
433
+ ...
434
+ # resources are cleaned up automatically
435
+ ```
436
+
437
+ ---
438
+
439
+ ### `ProxyBatch`
440
+
441
+ Container for multiple proxies with iteration and lifecycle control.
442
+
443
+ ```python
444
+ with pool.create_batch(5) as batch:
445
+ print(len(batch)) # 5
446
+ print(batch[0]) # first proxy
447
+ for proxy in batch:
448
+ print(proxy.get_proxy_str())
449
+ # All proxies are closed on exit
450
+ ```
451
+
452
+ | Method | Returns | Description |
453
+ |---|---|---|
454
+ | `close()` | `None` | Close all proxies in the batch |
455
+ | `len(batch)` | `int` | Number of proxies |
456
+ | `batch[i]` | `BaseProxy` | Access by index |
457
+ | `for p in batch` | iteration | Iterate over proxies |
458
+
459
+ ---
460
+
461
+ ### Configuration Objects
462
+
463
+ Dataclass-based configs used with `ProxyPool` or `Manager.from_config()`.
464
+
465
+ #### `GoogleConfig`
466
+
467
+ ```python
468
+ from auto_proxy_vpn import GoogleConfig
469
+
470
+ GoogleConfig(
471
+ project="my-gcp-project-id", # required
472
+ ssh_key="ssh-rsa AAAA...", # str | dict | list | file path
473
+ credentials="creds.json", # path to service account JSON (or env var)
474
+ )
475
+ ```
476
+
477
+ #### `AzureConfig`
478
+
479
+ ```python
480
+ from auto_proxy_vpn import AzureConfig
481
+
482
+ AzureConfig(
483
+ ssh_key="ssh-rsa AAAA...",
484
+ credentials="subscription-id", # str | dict with AZURE_* keys (or env vars)
485
+ )
486
+ ```
487
+
488
+ #### `DigitalOceanConfig`
489
+
490
+ ```python
491
+ from auto_proxy_vpn import DigitalOceanConfig
492
+
493
+ DigitalOceanConfig(
494
+ ssh_key="my-key-name",
495
+ token="dop_v1_xxxx...", # or env var DIGITALOCEAN_API_TOKEN
496
+ project_name="AutoProxyVPN",
497
+ project_description="On demand proxies",
498
+ )
499
+ ```
500
+
501
+ ---
502
+
503
+ ### Common `get_proxy()` Parameters
504
+
505
+ All provider managers share the same `get_proxy()` signature:
506
+
507
+ | Parameter | Type | Default | Description |
508
+ |---|---|---|---|
509
+ | `port` | `int` | `0` (random) | Proxy TCP port (random 10000–65000 if 0) |
510
+ | `size` | `"small" \| "medium" \| "large"` | `"medium"` | VM/droplet size tier |
511
+ | `region` | `str` | `""` (random) | Cloud region/zone |
512
+ | `auth` | `dict` | `{}` | `{"user": ..., "password": ...}` for basic auth |
513
+ | `allowed_ips` | `str \| list[str]` | `[]` | Allowed source IPs (your IP auto-added) |
514
+ | `is_async` | `bool` | `False` | Return before VM is fully ready |
515
+ | `retry` | `bool` | `True` | Retry in another region on failure |
516
+ | `proxy_name` | `str` | `""` | Custom name (auto-generated if empty) |
517
+ | `on_exit` | `"destroy" \| "keep"` | `"destroy"` | Cleanup behavior when proxy is closed |
518
+
519
+ ---
520
+
521
+ ## Limitations
522
+
523
+ Before choosing this tool, keep in mind:
524
+
525
+ - **Cloud IP blacklists.** Some websites maintain blacklists of IP ranges belonging to major cloud providers (AWS, Google Cloud, Azure, DigitalOcean, etc.). If a target site blocks cloud IPs, proxies created by this library will be blocked too — no matter how many regions or accounts you rotate through. This is a fundamental limitation of cloud-based proxies vs. residential ones.
526
+ - **Not a residential proxy.** The IPs you get are datacenter IPs. Services with aggressive anti-bot detection (e.g. some e-commerce sites, social media platforms, or ticket sellers) will likely flag or block them.
527
+ - **Provider rate limits.** Each cloud provider imposes quotas on VM/droplet creation. If you spin up many proxies in a short time, you may hit these limits. Using multiple accounts via `ProxyPool` helps, but doesn't eliminate them entirely.
528
+ - **Cost.** Every proxy is a real cloud VM. Forgetting to destroy instances will incur charges.
529
+
530
+ ---
531
+
532
+ ## Project Structure
533
+
534
+ ```
535
+ auto_proxy_vpn/
536
+ ├── __init__.py # CloudProvider enum, public exports
537
+ ├── configs.py # GoogleConfig, AzureConfig, DigitalOceanConfig, ManagerRuntimeConfig
538
+ ├── manager_register.py # ProxyManagers registry + provider auto-discovery
539
+ ├── proxy_pool.py # ProxyPool, RandomManagerPicker
540
+ ├── providers/
541
+ │ ├── azure/ # Azure VM proxy provider
542
+ │ ├── digitalocean/ # DigitalOcean droplet proxy + WireGuard VPN
543
+ │ ├── google/ # Google Compute Engine proxy + WireGuard VPN
544
+ │ ├── aws/ # (planned)
545
+ │ ├── alibaba/ # (planned)
546
+ │ └── oracle/ # (planned)
547
+ └── utils/
548
+ ├── base_proxy.py # BaseProxy, BaseProxyManager, ProxyBatch
549
+ ├── base_vpn.py # Base VPN classes
550
+ ├── exceptions.py # Shared exceptions
551
+ ├── files_utils.py # Squid config generator
552
+ ├── ssh_client.py # SSH command execution and file download
553
+ └── util.py # Public IP detection
554
+ ```
555
+
556
+ <!-- hide-contributing -->
557
+ ---
558
+
559
+ ## Contributing
560
+
561
+ Contributions are welcome! Please read [contributing docs](CONTRIBUTING.md) guide for detailed information on:
562
+
563
+ - Reporting bugs and suggesting features
564
+ - Development setup and workflow
565
+ - Coding guidelines and style conventions
566
+ - Adding a new cloud provider (step-by-step)
567
+ - Building and updating the Sphinx documentation
568
+ - Pull request process