Documentation
¶
Index ¶
- func AddMASQUEProvider(hostname string)
- func IsMASQUEProvider(host string) bool
- func IsMASQUEProxyURL(proxyURL string) bool
- func IsSOCKS5URL(proxyURL string) bool
- func NormalizeMASQUEURL(proxyURL string) (string, error)
- func ParseMASQUETarget(addr string) (string, int, error)
- type MASQUEConn
- func (c *MASQUEConn) Close() error
- func (c *MASQUEConn) Establish(ctx context.Context, targetHost string, targetPort int) error
- func (c *MASQUEConn) EstablishWithQUICConfig(ctx context.Context, targetHost string, targetPort int, tlsConfig *tls.Config, ...) error
- func (c *MASQUEConn) LocalAddr() net.Addr
- func (c *MASQUEConn) ReadFrom(b []byte) (int, net.Addr, error)
- func (c *MASQUEConn) SetDeadline(t time.Time) error
- func (c *MASQUEConn) SetReadDeadline(t time.Time) error
- func (c *MASQUEConn) SetResolvedTarget(addr *net.UDPAddr)
- func (c *MASQUEConn) SetWriteDeadline(t time.Time) error
- func (c *MASQUEConn) WriteTo(b []byte, addr net.Addr) (int, error)
- type SOCKS5Dialer
- type SOCKS5UDPConn
- func (c *SOCKS5UDPConn) Close() error
- func (c *SOCKS5UDPConn) Establish(ctx context.Context) error
- func (c *SOCKS5UDPConn) IsEstablished() bool
- func (c *SOCKS5UDPConn) LocalAddr() net.Addr
- func (c *SOCKS5UDPConn) ReadFrom(b []byte) (int, net.Addr, error)
- func (c *SOCKS5UDPConn) RelayAddr() *net.UDPAddr
- func (c *SOCKS5UDPConn) SetDeadline(t time.Time) error
- func (c *SOCKS5UDPConn) SetReadDeadline(t time.Time) error
- func (c *SOCKS5UDPConn) SetWriteDeadline(t time.Time) error
- func (c *SOCKS5UDPConn) WriteTo(b []byte, addr net.Addr) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddMASQUEProvider ¶
func AddMASQUEProvider(hostname string)
AddMASQUEProvider adds a custom MASQUE provider hostname to the known list. This allows users to add their own MASQUE-compatible proxy providers.
func IsMASQUEProvider ¶
IsMASQUEProvider checks if the given hostname belongs to a known MASQUE provider. This allows auto-detection of MASQUE proxies when using https:// scheme.
func IsMASQUEProxyURL ¶
IsMASQUEProxyURL checks if a proxy URL should use MASQUE protocol. Returns true if: - URL scheme is "masque://" - URL scheme is "https://" and host is a known MASQUE provider
func IsSOCKS5URL ¶ added in v1.5.5
IsSOCKS5URL checks if the URL is a SOCKS5 proxy URL
func NormalizeMASQUEURL ¶
NormalizeMASQUEURL normalizes a MASQUE proxy URL to https:// scheme. MASQUE uses HTTP/3 over HTTPS, so masque:// is just a hint.
Types ¶
type MASQUEConn ¶
type MASQUEConn struct {
// contains filtered or unexported fields
}
MASQUEConn implements net.PacketConn for MASQUE CONNECT-UDP tunneling. This allows QUIC connections to be tunneled through an HTTP/3 MASQUE proxy.
MASQUE (Multiplexed Application Substrate over QUIC Encryption) uses: - RFC 9298: CONNECT-UDP method for UDP proxying - RFC 9297: HTTP/3 Datagrams for carrying UDP packets - RFC 9484: MASQUE protocol specification
func NewMASQUEConn ¶
func NewMASQUEConn(proxyURL string) (*MASQUEConn, error)
NewMASQUEConn creates a new MASQUE connection to the specified proxy URL. URL format: masque://[user:pass@]host:port or https://[user:pass@]host:port
func (*MASQUEConn) Close ¶
func (c *MASQUEConn) Close() error
Close closes the MASQUE connection and all underlying resources
func (*MASQUEConn) Establish ¶
Establish performs the MASQUE CONNECT-UDP handshake with default config. For browser fingerprinting, use EstablishWithQUICConfig instead.
func (*MASQUEConn) EstablishWithQUICConfig ¶
func (c *MASQUEConn) EstablishWithQUICConfig(ctx context.Context, targetHost string, targetPort int, tlsConfig *tls.Config, quicConfig *quic.Config) error
EstablishWithQUICConfig establishes the MASQUE tunnel with custom QUIC config. This allows maintaining browser fingerprinting on the proxy connection.
func (*MASQUEConn) LocalAddr ¶
func (c *MASQUEConn) LocalAddr() net.Addr
LocalAddr returns the local address (simulated for net.PacketConn interface)
func (*MASQUEConn) ReadFrom ¶
ReadFrom implements net.PacketConn - reads a UDP datagram from the MASQUE tunnel
func (*MASQUEConn) SetDeadline ¶
func (c *MASQUEConn) SetDeadline(t time.Time) error
SetDeadline sets read and write deadlines
func (*MASQUEConn) SetReadDeadline ¶
func (c *MASQUEConn) SetReadDeadline(t time.Time) error
SetReadDeadline sets the read deadline
func (*MASQUEConn) SetResolvedTarget ¶
func (c *MASQUEConn) SetResolvedTarget(addr *net.UDPAddr)
SetResolvedTarget sets the resolved target address for proper PacketConn behavior. This should be called after DNS resolution to ensure ReadFrom returns the correct source address that matches what QUIC dialed to.
func (*MASQUEConn) SetWriteDeadline ¶
func (c *MASQUEConn) SetWriteDeadline(t time.Time) error
SetWriteDeadline sets the write deadline
type SOCKS5Dialer ¶ added in v1.5.5
type SOCKS5Dialer struct {
// Control is called after creating the network connection but before
// the connect() call. Used to apply TCP/IP fingerprint setsockopt options.
Control func(network, address string, conn syscall.RawConn) error
// contains filtered or unexported fields
}
SOCKS5Dialer provides SOCKS5 TCP CONNECT functionality for HTTP/1.1 and HTTP/2
func NewSOCKS5Dialer ¶ added in v1.5.5
func NewSOCKS5Dialer(proxyURL string) (*SOCKS5Dialer, error)
NewSOCKS5Dialer creates a new SOCKS5 dialer from a proxy URL URL format: socks5://[user:pass@]host:port or socks5h://[user:pass@]host:port
func (*SOCKS5Dialer) DialContext ¶ added in v1.5.5
DialContext connects to the target through the SOCKS5 proxy using TCP CONNECT
func (*SOCKS5Dialer) SetLocalAddr ¶ added in v1.6.0
func (d *SOCKS5Dialer) SetLocalAddr(addr string)
SetLocalAddr sets the local IP address for outgoing connections
type SOCKS5UDPConn ¶
type SOCKS5UDPConn struct {
// contains filtered or unexported fields
}
SOCKS5UDPConn implements net.PacketConn for SOCKS5 UDP relay This allows QUIC to send UDP packets through a SOCKS5 proxy
func NewSOCKS5UDPConn ¶
func NewSOCKS5UDPConn(proxyURL string) (*SOCKS5UDPConn, error)
NewSOCKS5UDPConn creates a new SOCKS5 UDP connection from a proxy URL URL format: socks5://[user:pass@]host:port
func (*SOCKS5UDPConn) Close ¶
func (c *SOCKS5UDPConn) Close() error
Close closes both TCP and UDP connections
func (*SOCKS5UDPConn) Establish ¶
func (c *SOCKS5UDPConn) Establish(ctx context.Context) error
Establish performs the SOCKS5 UDP ASSOCIATE handshake This must be called before using the connection It will retry up to 5 times if the proxy returns "general failure" (common with load-balanced proxies where some servers don't support UDP)
func (*SOCKS5UDPConn) IsEstablished ¶
func (c *SOCKS5UDPConn) IsEstablished() bool
IsEstablished returns true if UDP ASSOCIATE was successful
func (*SOCKS5UDPConn) LocalAddr ¶
func (c *SOCKS5UDPConn) LocalAddr() net.Addr
LocalAddr returns the local UDP address
func (*SOCKS5UDPConn) ReadFrom ¶
ReadFrom implements net.PacketConn - reads a UDP datagram from the proxy
func (*SOCKS5UDPConn) RelayAddr ¶
func (c *SOCKS5UDPConn) RelayAddr() *net.UDPAddr
RelayAddr returns the UDP relay address from the proxy
func (*SOCKS5UDPConn) SetDeadline ¶
func (c *SOCKS5UDPConn) SetDeadline(t time.Time) error
SetDeadline sets both read and write deadlines
func (*SOCKS5UDPConn) SetReadDeadline ¶
func (c *SOCKS5UDPConn) SetReadDeadline(t time.Time) error
SetReadDeadline sets the read deadline
func (*SOCKS5UDPConn) SetWriteDeadline ¶
func (c *SOCKS5UDPConn) SetWriteDeadline(t time.Time) error
SetWriteDeadline sets the write deadline