Skip to content

qwerty32123/H278

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

H278 Tor Network Client

Educational Project Notice: This is an educational project created to demonstrate and learn how Go interacts with shared memory across different operating systems. The implementation serves as a learning resource for understanding cross-platform shared memory management and network programming in Go.

A high-performance, multi-circuit Tor network client implementation in Go with cross-platform shared memory support.

Overview

H278 is a sophisticated network client that enables concurrent HTTP requests through multiple Tor circuits while maintaining cross-platform compatibility for shared memory operations. The application is designed to handle high-throughput network requests with IP rotation capabilities and comprehensive logging.

Educational Purpose

This project was created to:

  • Demonstrate shared memory implementation in Go
  • Show cross-platform compatibility approaches
  • Illustrate system-level programming concepts
  • Provide practical examples of Go's syscall interfaces
  • Showcase proper error handling and resource management

Key Features

  • Multiple concurrent Tor circuits management
  • Cross-platform shared memory implementation (Windows/Unix)
  • Automatic IP rotation
  • Request queuing and processing
  • Comprehensive logging and monitoring
  • Graceful shutdown handling

System Requirements

  • Go 1.23.2 or higher
  • Tor service installed and accessible in system PATH
    • For Unix/Linux: sudo apt-get install tor (Debian/Ubuntu)
    • For Windows: Download and install from the official Tor website
    • Verify installation with tor --version in terminal/command prompt
  • Compatible with Windows and Unix-based systems

Architecture

Core Components

Network Package (/network)

  • MultiTorClient: Manages multiple Tor circuits
  • TorCircuit: Individual Tor circuit implementation
  • Request: HTTP request abstraction

Memory Package (/Memory)

  • Platform-specific shared memory implementations
  • Unified interface through SharedMemoryInterface
  • Separate implementations for Windows and Unix systems

Service Package (/service)

  • ResponseLogger: Handles request logging and monitoring
  • Manages client lifecycle and request processing

Memory Management

The application implements a cross-platform shared memory system:

  • Unix Implementation: Uses POSIX shared memory (shm_open)
  • Windows Implementation: Uses Windows memory-mapped files
  • Abstract interface ensuring consistent behavior across platforms

Dependencies

require (
    github.com/cretz/bine v0.2.0
    golang.org/x/net v0.31.0
    golang.org/x/sys v0.27.0
    golang.org/x/crypto v0.29.0
)

Configuration

Shared Memory

sharedMemName := "h278"    // Shared memory identifier
sharedMemSize := 1024*1024 // 1MB size

Network Settings

  • Default request interval: 5 seconds
  • Random delay between requests: 600-800ms
  • Circuit count: 4 (configurable)

Usage

Basic Implementation

package main

import (
    "H278/service"
    "log"
)

func main() {
    logger, err := service.NewResponseLogger(
        "your-target-url",
        "h278",    // Shared memory name
        1024*1024, // Shared memory size
    )
    if err != nil {
        log.Fatal(err)
    }
    defer logger.Stop()

    logger.Start()
    // ... handle shutdown
}

Request Configuration

request := network.Request{
    URL:    targetURL,
    Method: "POST",
    Body:   jsonBody,
    Headers: map[string]string{
        "Connection":   "keep-alive",
        "User-Agent":   "H278",
        "Content-Type": "application/json",
    },
}

Testing

The application includes comprehensive test suites:

Client Tests (/tests/Client_test.go)

  • Circuit initialization
  • IP rotation
  • Request processing
  • Error handling

IP Change Tests (/tests/IpChange_test.go)

  • Tor connection validation
  • IP rotation verification
  • Response timing tests

Run tests using:

go test ./tests/...

Security Considerations

Network Security

  • All requests are routed through Tor circuits
  • Automatic IP rotation for anonymity
  • Configurable request delays to prevent detection

Memory Security

  • Secure shared memory implementation
  • Proper cleanup on shutdown
  • Memory access permissions handling

Error Handling

  • Circuit initialization failures
  • Network request errors
  • Shared memory errors
  • Graceful cleanup on failures

Performance Considerations

  • Concurrent circuit management
  • Configurable delay between requests
  • Memory-efficient shared data handling
  • Automatic resource cleanup

Limitations

  • Requires local Tor service installation
  • Memory size limited by system constraints
  • Network performance dependent on Tor network

Best Practices

Configuration

  • Adjust shared memory size based on requirements
  • Configure appropriate request delays
  • Set reasonable circuit count

Monitoring

  • Monitor response times
  • Track IP rotation success
  • Log error patterns

Maintenance

  • Regular Tor service updates
  • Monitor memory usage
  • Review log patterns

Contributing

  1. Fork the repository
  2. Create feature branch
  3. Implement changes
  4. Add/update tests
  5. Submit pull request

License

This project is released under a permissive educational license:

Permission is hereby granted, free of charge, to any person obtaining a copy of this software, to use, copy, modify, and distribute this software and its documentation for educational purposes, subject to the following conditions:

  • The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  • The software is provided "as is", without warranty of any kind, express or implied.
  • This software may be used freely for educational and learning purposes.
  • Commercial use requires separate licensing.

Disclaimer

This tool is intended for educational purposes only. The primary goal is to demonstrate shared memory concepts and Go programming techniques. Users are responsible for compliance with applicable laws and regulations regarding network access and data collection.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages