You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* removed option to run one proxy per port
* added -subnet-size option to select one IP per network if provided (fixes#3)
* use permute package to reduce memory overhead
* use goreleaser to build packages automatically
* major code refractor and modernizations
* added -test flag to ensure routing is setup corectly
* added fail-safe checks to pervent IP leaks
* modernized the code
Stargate runs TCP SOCKS proxies on different ports egressing on sequential IPs in the same subnet.
3
+
Stargate is a TCP SOCKS5 proxy server that can egress traffic from multiple IP addresses within a subnet. It randomly distributes connections across different IP addresses to help avoid rate-limiting and provide load balancing across your available IP range.
4
+
4
5
This requires the host running stargate to have the subnet routed directly to it.
5
6
6
7
If you have an IPv6 subnet, stargate can allow you to make full use of it by any program that can speak SOCKS.
@@ -9,62 +10,117 @@ If you have an IPv6 subnet, stargate can allow you to make full use of it by any
9
10
10
11
```console
11
12
Usage of ./stargate: [OPTION]... CIDR
12
-
CIDR example: "192.0.2.0/24"
13
+
CIDR example: "192.0.2.0/24"
13
14
OPTIONS:
14
15
-listen string
15
-
IP to listen on (default "localhost")
16
-
-port uint
17
-
first port to start listening on
18
-
-random uint
19
-
port to use for random proxy server
16
+
listen on specified [IP:]port (e.g., '1337', '127.0.0.1:8080', '[::1]:1080') (default "localhost:1080")
20
17
-subnet-size uint
21
-
CIDR prefix length for random subnet proxy (e.g., 24 for /24 subnets)
18
+
CIDR prefix length for random subnet proxy (e.g., 64 for /64 IPv6 subnets)
19
+
-test
20
+
run test request on all IPs and exit
22
21
-verbose
23
-
enable verbose logging
22
+
enable verbose logging
24
23
-version
25
-
print version and exit
24
+
print version and exit
26
25
```
27
26
28
-
## Random
27
+
Stargate now operates as a single SOCKS5 proxy server that randomly selects egress IP addresses from your specified CIDR range. This approach is much more memory-efficient and suitable for large IPv6 ranges.
29
28
30
-
The `-random` flag starts a SOCKS5 proxy that egresses traffic on a random IP in the subnet.
31
-
This is useful to avoid rate-limiting or in situations where there are too many IPs in the subnet to listen on each port which is common with IPv6.
29
+
## Test Flag - Preventing IP Address Leakage
32
30
33
-
When used with `-subnet-size`, the proxy will randomly distribute connections across different subnets within the main CIDR range. For example, with a /48 IPv6 block and `-subnet-size 64`, connections will be distributed across random /64 subnets.
31
+
**IMPORTANT**: Before using Stargate in production, always run the test mode first to ensure there are no unintended IP address leaks.
34
32
35
-
## Example
33
+
The `-test` flag performs comprehensive validation by:
36
34
37
-
The following will start 254 SOCKS proxies listening on 127.0.0.7 ports 10001-100254 sending traffic egressing on 192.0.2.1 through 192.0.2.254.
35
+
- Testing HTTP requests from every available IP address in your CIDR range
36
+
- Verifying that each egress IP matches the intended source address
37
+
- Detecting binding errors or network misconfigurations
38
+
- Ensuring no connections leak through unintended IP addresses
**Note:** When using `-subnet-size`, the test will validate one randomly selected IP address from each subnet rather than testing every possible IP. For example, with `-subnet-size 64` on a /48, it tests one IP per /64 subnet, not every IP in the entire /48. In order to test every possible IP address, do not pass a `-subnet-size` option when using `-test`.
41
+
42
+
**Always run this test before production use:**
43
+
44
+
```bash
45
+
# Test your configuration first - THIS IS CRITICAL!
46
+
./stargate -test 192.0.2.0/24
47
+
48
+
# Only proceed to normal operation after tests pass
49
+
./stargate 192.0.2.0/24
41
50
```
42
51
43
-
The following will start a single socks proxy listening on 127.0.0.1:1337 egressing each connection from a random IP in 2001:DB8:1337::1/64 This offers you 2<sup>64</sup> possible IPs to egress on.
52
+
The test will fail immediately if any IP address binding issues are detected, preventing potential IP leakage that could compromise your setup.
44
53
45
-
```console
46
-
./stargate -random 1337 2001:DB8:1337::1/64
54
+
## Subnet Distribution
55
+
56
+
When used with `-subnet-size`, the proxy will randomly distribute connections across different subnets within the main CIDR range. For example, with a /48 IPv6 block and `-subnet-size 64`, connections will be distributed across random /64 subnets, giving you access to multiple /64 networks within your larger allocation.
57
+
58
+
## Examples
59
+
60
+
### Basic Usage
61
+
62
+
Start a SOCKS5 proxy on the default port (1080) that randomly egresses from IPs in the 192.0.2.0/24 range:
63
+
64
+
```bash
65
+
# Always test first!
66
+
./stargate -test 192.0.2.0/24
67
+
68
+
# Run the proxy after tests pass
69
+
./stargate 192.0.2.0/24
47
70
```
48
71
49
-
The following will start a single socks proxy listening on 127.0.0.1:8080 that distributes connections across random /64 subnets within a /48 IPv6 block:
The easiest way to get started is with [precompiled binaries](https://github.com/lanrat/stargate/releases) available for multiple platforms including Linux and FreeBSD. These are statically linked and ready to run without additional dependencies.
Stargate can be run inside Docker as well, but it will require fancy routing rules or `--net=host`.
108
+
Docker is particularly useful for deployment in containerized environments, though network configuration requires special attention to ensure proper subnet routing.
109
+
110
+
Running in docker will require `--net=host`, or the subnet must be routed directly to the container.
63
111
64
112
```shell
65
113
docker pull ghcr.io/lanrat/stargate:latest
66
114
```
67
115
68
116
## Building
69
117
70
-
Just run `make`!
118
+
Building from source is straightforward - just run `make`!
119
+
120
+
```bash
121
+
git clone https://github.com/lanrat/stargate.git
122
+
cd stargate
123
+
make
124
+
```
125
+
126
+
This will produce a statically linked binary that's ready to use.
0 commit comments