Documentation
¶
Overview ¶
Package stargate provides network connection functionality with randomized source IP addresses. It includes dialers that can bind to random IP addresses within specified CIDR ranges, with built-in verification to prevent IP address leaks and binding errors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Logger loggerFunc
Functions ¶
func CheckHostConflicts ¶
CheckHostConflicts detects if any of the addresses we are going to use are broadcast addresses. It populates the global broadcastAddrs map by examining all system network interfaces. It returns a list of all conflicting IPs
Types ¶
type DialFunc ¶
DialFunc represents a function that establishes network connections. It follows the same signature as net.Dialer.DialContext.
type IPBindBroadcastError ¶
type IPBindBroadcastError struct {
IPBindError
}
IPBindBroadcastError represents a critical error where a connection was bound to a broadcast IP address.
func (*IPBindBroadcastError) Error ¶
func (e *IPBindBroadcastError) Error() string
Error returns a formatted error message for the broadcast IP binding error.
func (*IPBindBroadcastError) Unwrap ¶
func (e *IPBindBroadcastError) Unwrap() error
Unwrap returns the embedded IPBindError to support error unwrapping with errors.As.
type IPBindError ¶
IPBindError represents a critical error where a connection was bound to an unexpected IP address.
func (*IPBindError) Error ¶
func (e *IPBindError) Error() string
Error returns a formatted error message for the IP binding error.
type IPBindLeakError ¶
type IPBindLeakError struct {
IPBindError
ActualIP net.IP
}
IPBindLeakError represents a critical error where a connection was bound to an unintended IP address. This error is used to prevent IP address leaks by aborting connections that don't use the expected source IP.
func (*IPBindLeakError) Error ¶
func (e *IPBindLeakError) Error() string
Error returns a formatted error message for the IP leak error.
func (*IPBindLeakError) Unwrap ¶
func (e *IPBindLeakError) Unwrap() error
Unwrap returns the embedded IPBindError to support error unwrapping with errors.As.
type RandomIPDialer ¶
type RandomIPDialer struct {
// contains filtered or unexported fields
}
RandomIPDialer manages iteration through random subnets within a CIDR range. It uses a permutation iterator to cycle through all possible subnets in a random order.
func NewRandomIPIterator ¶
func NewRandomIPIterator(prefix netip.Prefix, cidrBits uint) (*RandomIPDialer, error)
NewRandomIPIterator creates a new RandomIPDialer for the given network prefix. It calculates the number of possible subnets and initializes the random iterator.
func (*RandomIPDialer) Dial ¶
Dial implements DialFunc and establishes a connection using a random egress IP.
func (*RandomIPDialer) NextDial ¶
func (it *RandomIPDialer) NextDial() (net.IP, DialFunc, error)
NextDial returns the next random IP and a corresponding DialFunc for establishing connections.
func (*RandomIPDialer) NextIP ¶
func (it *RandomIPDialer) NextIP() (*net.IPNet, error)
NextIP returns the next random subnet as a net.IPNet. When all subnets have been used, it automatically resets to start over.
func (*RandomIPDialer) Size ¶
func (it *RandomIPDialer) Size() uint64
Size returns the total number of subnets available for iteration.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package main implements Stargate, a TCP SOCKS proxy server that can egress traffic from multiple IP addresses within a subnet.
|
Package main implements Stargate, a TCP SOCKS proxy server that can egress traffic from multiple IP addresses within a subnet. |
|
Package permute provides memory-efficient iterators for generating pseudo-random permutations of integer ranges without storing all values.
|
Package permute provides memory-efficient iterators for generating pseudo-random permutations of integer ranges without storing all values. |