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