1 | <?php |
||
23 | abstract class TunnelServer implements TunnelServerInterface |
||
24 | { |
||
25 | use UseTimerTrait; |
||
26 | |||
27 | /** |
||
28 | * @var ConnectionInterface |
||
29 | */ |
||
30 | protected $controlConnection; |
||
31 | |||
32 | /** |
||
33 | * @var PublicConnectionCollection |
||
34 | */ |
||
35 | protected $publicConnections; |
||
36 | |||
37 | /** |
||
38 | * @var Socket |
||
39 | */ |
||
40 | protected $socket; |
||
41 | |||
42 | /** |
||
43 | * @var TunnelInterface |
||
44 | */ |
||
45 | protected $tunnel; |
||
46 | |||
47 | /** |
||
48 | * @var Server |
||
49 | */ |
||
50 | protected $server; |
||
51 | |||
52 | /** |
||
53 | * @var LoopInterface |
||
54 | */ |
||
55 | protected $loop; |
||
56 | |||
57 | public function __construct(Server $server, ConnectionInterface $controlConnection, TunnelInterface $tunnel, LoopInterface $loop) |
||
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | */ |
||
69 | public function run() |
||
83 | |||
84 | /** |
||
85 | * Gets the event dispatcher |
||
86 | * @return Dispatcher |
||
87 | */ |
||
88 | public function getDispatcher() |
||
92 | |||
93 | /** |
||
94 | * {@inheritdoc} |
||
95 | */ |
||
96 | public function close() |
||
110 | |||
111 | /** |
||
112 | * Handles the public connection |
||
113 | * @param PublicConnection $publicConnection |
||
114 | */ |
||
115 | public function handlePublicConnection(PublicConnection $publicConnection) |
||
128 | |||
129 | /** |
||
130 | * Registers proxy connection |
||
131 | * @param ConnectionInterface $proxyConnection |
||
132 | * @param SpikeInterface $message |
||
133 | */ |
||
134 | public function registerProxyConnection(ConnectionInterface $proxyConnection, SpikeInterface $message) |
||
174 | |||
175 | /** |
||
176 | * Gets the server address to bind |
||
177 | * @return string |
||
178 | */ |
||
179 | protected function getListenAddress() |
||
183 | |||
184 | /** |
||
185 | * Creates default timers |
||
186 | * @return TimerInterface[] |
||
187 | */ |
||
188 | protected function getDefaultTimers() |
||
194 | |||
195 | /** |
||
196 | * Gets the socket of the tunnel server |
||
197 | * @return Socket |
||
198 | */ |
||
199 | public function getSocket() |
||
203 | /** |
||
204 | * {@inheritdoc} |
||
205 | */ |
||
206 | public function getControlConnection() |
||
210 | |||
211 | /** |
||
212 | * {@inheritdoc} |
||
213 | */ |
||
214 | public function getLoop() |
||
218 | |||
219 | /** |
||
220 | * {@inheritdoc} |
||
221 | */ |
||
222 | public function getPublicConnections() |
||
226 | |||
227 | /** |
||
228 | * {@inheritdoc} |
||
229 | */ |
||
230 | public function getTunnel() |
||
234 | } |