stealthy

package module
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2025 License: MIT Imports: 11 Imported by: 0

README

Stealthy - Go Library for persistent identity Web Requests

A lightweight Go library for making stealthy HTTP requests with persistent identities, proxy support, and serialization capabilities.

Features

  • 🛡️ Persistent Session Identity
    Consistent User-Agent, Headers, and Session-ID across requests
  • 🔄 Proxy Rotation Support
    Built-in support for SmartProxy
  • 📦 State Serialization
    Save/restore client state to Base64 strings
  • ⏱️ Request Spoofing
    Auto-header generation with device fingerprinting

Usage

package main

import (
  "github.com/m0ttii/stealthy"
  "net/http"
)

func main() {
  // Create client with SmartProxy
  client, _ := stealthy.NewStealthClient(
    stealthclient.WithProxy(stealthclient.ProxyConfig{
      Host:         "gate.smartproxy.com",
      User:         "USER",
      ZonePassword: "PASSWORD",
      Port:         10001,
    }),
  )

  // Make request
  req, _ := http.NewRequest("GET", "https://api.example.com/data", nil)
  resp, _ := client.Do(req)
}
State Management
// Serialize client
data, _ := client.Serialize() 
// -> "eyJVc2VyQWdlbnQiOiJNb3ppbGxhLzUuMC4u..."

// Restore client
restoredClient, _ := stealthclient.DeserializeClient(data)

// Rotate SmartProxy session ID
restoredClient.RotateSmartProxySession("new_session_id")
Custom Header
client, err := stealthy.NewStealthClient(
		stealthy.WithCustomHeaders(map[string]string{
			"Accept-Language": "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7",
			"X-Custom-Header": "abc",
			"Authorization":   "Bearer my_token_123",
		}),
	)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithCustomHeaders

func WithCustomHeaders(headers map[string]string) func(*StealthClient)

WithCustomHeaders adds custom headers to the client

func WithProxy

func WithProxy(cfg ProxyConfig) func(*StealthClient)

WithProxy adds a proxy to the client

Types

type ProxyConfig

type ProxyConfig struct {
	Host            string
	User            string
	ZonePassword    string
	SessionDuration int
	Port            int
}

type StealthClient

type StealthClient struct {
	// contains filtered or unexported fields
}

StealthClient, represents a http client with stealth capabilities

func DeserializeClient

func DeserializeClient(data string) (*StealthClient, error)

DeserializeClient deserializes a string into a StealthClient

func NewStealthClient

func NewStealthClient(options ...func(*StealthClient)) (*StealthClient, error)

NewStealthClient creates a new StealthClient

func (*StealthClient) Do

func (c *StealthClient) Do(req *http.Request) (*http.Response, error)

Do makes a HTTP request

func (*StealthClient) RotateProxySession added in v0.2.3

func (c *StealthClient) RotateProxySession() error

func (*StealthClient) Serialize

func (c *StealthClient) Serialize() (string, error)

Serialize serializes the client to a string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL