Download the PHP package tourze/workerman-relay-worker without Composer
On this page you can find all versions of the php package tourze/workerman-relay-worker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package workerman-relay-worker
Workerman Relay Worker
中文
A connection relay worker for Workerman that enables traffic forwarding between different connections (TCP/UDP).
Features
- Support for TCP and UDP connection relaying
- Works with the Workerman PHP framework
- Automatic pipeline creation between source and target connections
- Connection buffering while setting up the relay
- Seamless integration with existing Workerman applications
- Built-in load balancers for distributing connections across multiple targets:
- Round Robin Load Balancer
- Random Load Balancer
- Weighted Load Balancer
- IP Hash Load Balancer
- Least Connections Load Balancer
Installation
Quick Start
Usage
The RelayWorker class extends Workerman's Worker class and provides a connection relay mechanism. You can use it to:
- Create TCP-to-TCP, TCP-to-UDP, UDP-to-TCP, or UDP-to-UDP relays
- Buffer incoming data until a target is set
- Process connections asynchronously
For each connection, you need to add target addresses using RelayWorker::addTarget() or set multiple
targets using RelayWorker::setTargets(). Once targets are set, data received on that connection will
be forwarded using the configured load balancer.
Load Balancing
The package includes several load balancing strategies for distributing connections across multiple targets:
Available Load Balancers
- Round Robin: Distributes requests evenly across all targets in order
- Random: Randomly selects a target for each connection
- Weighted: Distributes requests based on assigned weights
- IP Hash: Routes connections from the same IP to the same target
- Least Connections: Routes to the target with the fewest active connections
Dependencies
- PHP 8.1+
- workerman/workerman: ^5.1
- tourze/workerman-connection-pipe: 0.0.*
License
The MIT License (MIT). Please see License File for more information.