croxy

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 11 Imported by: 0

README

go-croxy

A headless Go HTTP transport that transparently tunnels requests through CroxyProxy. It automates the session handshake, CSRF token extraction, and server selection logic.

Installation

go get github.com/askmdev/go-croxy

Usage

package main

import (
	"fmt"
	"io"
	"net/http"
	"github.com/askmdev/go-croxy"
)

func main() {
	// Initialize the client (handles cookies & session automatically)
	client := croxy.New()

	// Create your request as usual
	req, _ := http.NewRequest("GET", "https://api.ipify.org", nil)

	// Tunnel it through the proxy
	resp, err := client.ProxyRequest(req)
	if err != nil {
		// If the session dies, you can retry or reset:
		// client.Reset()
		panic(err)
	}
	defer resp.Body.Close()

	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}

Key Features

  • Zero Configuration: Handles the complex multi-step handshake automatically.
  • Session Persistence: re-uses established sessions for subsequent requests.
  • Manual Rotation: client.Reset() clears cookies to force a new server IP on the next request.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New() *Client

func (*Client) ProxyRequest

func (c *Client) ProxyRequest(req *http.Request) (*http.Response, error)

func (*Client) Reset

func (c *Client) Reset()

Jump to

Keyboard shortcuts

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