public function __construct(App $app) { $this->app = $app; $that = $this; $app->addCommand('via [--help | -h]', function () use($that) { echo 'forward all connections via next SOCKS server' . PHP_EOL; }); $app->addCommand('via list', function () use($that, $app) { $that->runList($app); })->shortHelp = 'list all forwarding entries'; $app->addCommand('via default <target>', function (array $args) use($that, $app) { $that->runSetDefault($args['target'], $app); })->shortHelp = 'set given <target> socks proxy as default target'; $app->addCommand('via reject <host>', function (array $args) use($that, $app) { $that->runAdd($args['host'], 'reject', -1, $app); })->shortHelp = 'reject connections to the given host'; $app->addCommand('via add <host> <target> [<priority:int>]', function (array $args) use($that, $app) { $that->runAdd($args['host'], $args['target'], isset($args['priority']) ? $args['priority'] : 0, $app); })->shortHelp = 'add new <target> socks proxy for connections to given <host>'; $app->addCommand('via remove <id:uint>', function (array $args) use($that, $app) { $that->runRemove($args['id'], $app); })->shortHelp = 'remove forwarding entry with given <id> (see "via list")'; $app->addCommand('via reset', function (array $args) use($that, $app) { $that->runReset($app); })->shortHelp = 'clear and reset all forwarding entries and only connect locally'; }
public function __construct(App $app) { $that = $this; $app->addCommand('ping [--help | -h]', function () { echo 'Ping the given target socks server. Usage: ping <target>' . PHP_EOL; }); $app->addCommand('ping <target>', function (array $args) use($that, $app) { $that->runPing($args['target'], $app); })->shortHelp = 'ping another SOCKS proxy server via TCP handshake'; }
public function __construct(App $app) { $that = $this; $app->addCommand('status', function () use($that) { $that->run(); })->shortHelp = 'show status'; }
public function __construct(App $app) { $that = $this; $app->addCommand('quit | exit', function () use($that, $app) { $that->run($app); })->shortHelp = 'shutdown this application'; }
public function __construct(App $app) { $that = $this; $app->addCommand('help', function () use($that, $app) { $that->run($app); })->shortHelp = 'show this very help'; }