-
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy path41-server-secure.php
More file actions
22 lines (17 loc) · 738 Bytes
/
41-server-secure.php
File metadata and controls
22 lines (17 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
// A more advanced example which runs a secure SOCKS over TLS proxy server.
// The listen address can be given as first argument and defaults to 127.0.0.1:1080 otherwise.
//
// See also example #42 for the client side.
require __DIR__ . '/../vendor/autoload.php';
// start a new SOCKS proxy server
$socks = new Clue\React\Socks\Server();
// listen on tls://127.0.0.1:1080 or first argument
$uri = 'tls://' . (isset($argv[1]) ? $argv[1] : '127.0.0.1:1080');
$socket = new React\Socket\SocketServer($uri, array(
'tls' => array(
'local_cert' => __DIR__ . '/localhost.pem',
)
));
$socks->listen($socket);
echo 'SOCKS over TLS server listening on ' . str_replace('tls:', 'sockss:', $socket->getAddress()) . PHP_EOL;