The Connectivity Tester is a Go-based CLI tool designed to test and manage network connectivity through various proxy servers. The project serves two main purposes:
- Testing and managing server connections
- Managing and testing SOAX client vantage points
The project is structured into several key packages:
cmd
: Contains the main CLI applicationpkg/connectivity
: Handles connection testingpkg/database
: Manages database operationspkg/models
: Defines data structurespkg/server
: Handles server-related operationspkg/soax
: Manages SOAX client operationspkg/ipinfo
: Handles IP information retrievalpkg/fetch
: Provides HTTP request functionality
- Uses Viper for configuration management
- Configuration stored in YAML format
- Supports multiple configuration paths
- Manages sensitive credentials for database and SOAX services
type Server struct {
IP string `bun:",pk"`
Port string `bun:",pk"`
UserInfo string `bun:",pk"`
FullAccessLink string `bun:",unique,notnull"`
Scheme string `bun:",notnull"`
// ... other fields
}
-
Initial Setup
- Parse server access links
- Extract IP, port, and user information
- Create database entries
-
Connectivity Testing
- Support for both TCP and UDP protocols
- Concurrent testing implementation
- Error handling and reporting
-
Result Management
- Database storage of test results
- Error tracking (TCP and UDP)
- Automatic removal of failed servers
type SoaxClient struct {
IP string `bun:",pk"`
UUID string `bun:",unique,notnull"`
SessionID int64 `bun:",notnull"`
SessionLength int `bun:",notnull"`
// ... other fields
}
-
Client Acquisition
- Random session ID generation
- Dynamic URL construction
- Unique IP verification
-
Information Gathering
- SOAX checker API integration
- IPInfo.io integration for ASN information
- Geographic and carrier information collection
-
Data Management
- Unique IP enforcement
- Session tracking
- Expiration time management
The database implementation uses the Bun ORM with PostgreSQL, featuring:
- Composite primary keys for servers
- IP-based primary keys for SOAX clients
- Automatic timestamp management
- Error tracking columns
-
Server Operations
- Upsert functionality
- Bulk operations support
- Concurrent access handling
-
Client Operations
- Unique IP enforcement
- Session management
- Partial result handling
connectivity-tester
├── add-servers [file]
├── test-servers [--tcp] [--udp]
└── get-clients [country] [type] [count]
-
Server Management
- File-based server addition
- Selective testing capabilities
- Error handling and reporting
-
Client Management
- Country-based client acquisition
- Type-specific handling (residential/mobile)
- Unique IP enforcement
- Graceful failure management
- Partial success handling
- Detailed error reporting
- Basic server testing
- Single-threaded operations
- Simple database operations
-
Concurrency
- Implemented worker pools
- Added concurrent testing
- Added mutex-protected database operations
-
Error Handling
- Enhanced error reporting
- Added partial success handling
- Implemented automatic server removal
-
Client Management
- Added unique IP verification
- Implemented attempt tracking
- Added partial result saving
- Connection pooling
- Concurrent testing
- Efficient database operations
-
Scalability
- Database sharding
- Distributed testing
- Load balancing
-
Monitoring
- Metrics collection
- Performance tracking
- Health checking
-
Features
- Additional testing protocols
- Enhanced reporting
- API integration
-
Database
- Regular cleanup of expired entries
- Index optimization
- Backup strategies
-
Testing
- Automated testing
- Performance benchmarking
- Error rate monitoring
The Connectivity Tester project has evolved into a robust tool for managing and testing network connectivity through various proxies. The implementation prioritizes:
- Reliability through proper error handling
- Performance through concurrent operations
- Maintainability through modular design
- Flexibility through configuration management
The iterative development process has allowed for continuous improvements and refinements, resulting in a tool that effectively handles both server testing and client management tasks.