mirror of
https://github.com/danog/tonProxy.git
synced 2024-11-26 12:04:49 +01:00
Update
This commit is contained in:
parent
5f5ced71ff
commit
e0a50c8c51
@ -5,9 +5,9 @@
|
||||
"type": "project",
|
||||
"require": {
|
||||
"amphp/websocket-server": "dev-master as v2.0.0-rc1",
|
||||
"amphp/http-server-static-content": "dev-master",
|
||||
"amphp/http-server-router": "dev-master",
|
||||
"amphp/log": "dev-master"
|
||||
"amphp/http-server-static-content": "^1",
|
||||
"amphp/http-server-router": "^1",
|
||||
"amphp/log": "^1"
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
|
19
main.php
19
main.php
@ -24,10 +24,8 @@ use function Amp\Socket\connect;
|
||||
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
|
||||
$ip = '127.0.0.1'; // Connect to local TON validator
|
||||
$ip = 'ton.daniil.it';
|
||||
$port = 9999;
|
||||
|
||||
$ip = '67.207.74.182';
|
||||
$port = 4924;
|
||||
|
||||
$logHandler = new StreamHandler(getStdout());
|
||||
$logHandler->setFormatter(new ConsoleFormatter);
|
||||
@ -35,7 +33,7 @@ $logger = new Logger('server');
|
||||
$logger->pushHandler($logHandler);
|
||||
|
||||
|
||||
$websocket = new Websocket(new class($ip, $port, $logger) implements ClientHandler {
|
||||
class TONHandler implements ClientHandler {
|
||||
/**
|
||||
* TON validator URI.
|
||||
*
|
||||
@ -171,15 +169,18 @@ $websocket = new Websocket(new class($ip, $port, $logger) implements ClientHandl
|
||||
$socket->close();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
$sockets = [
|
||||
Socket\listen('127.0.0.1:80'),
|
||||
Socket\listen('[::1]:80'),
|
||||
Socket\listen('0.0.0.0:80'),
|
||||
Socket\listen('[::]:80'),
|
||||
];
|
||||
|
||||
$router = new Router;
|
||||
$router->addRoute('GET', '/ton', $websocket);
|
||||
$router->addRoute('GET', '/testnet', new Websocket(new TONHandler($ip, $port, $logger)));
|
||||
$router->addRoute('GET', '/testnetDebug', new Websocket(new TONHandler('127.0.0.1', 9999, $logger)));
|
||||
$router->setFallback(
|
||||
new CallableRequestHandler(
|
||||
function () {
|
||||
|
Loading…
Reference in New Issue
Block a user