mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
pow-testgiver support
This commit is contained in:
parent
dbde9c1c40
commit
f064b1047a
257 changed files with 6665 additions and 2608 deletions
|
@ -30,7 +30,7 @@
|
|||
#include "td/utils/port/IPAddress.h"
|
||||
#include "td/net/UdpServer.h"
|
||||
#include "td/utils/port/signals.h"
|
||||
#include "td/utils/OptionsParser.h"
|
||||
#include "td/utils/OptionParser.h"
|
||||
#include "td/utils/FileLog.h"
|
||||
#include "td/utils/port/path.h"
|
||||
#include "td/utils/port/user.h"
|
||||
|
@ -91,12 +91,11 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
std::string config = "/var/ton-work/etc/adnl-proxy.conf.json";
|
||||
|
||||
td::OptionsParser p;
|
||||
td::OptionParser p;
|
||||
p.set_description("adnl pinger");
|
||||
p.add_option('v', "verbosity", "set verbosity level", [&](td::Slice arg) {
|
||||
int v = VERBOSITY_NAME(FATAL) + (td::to_integer<int>(arg));
|
||||
SET_VERBOSITY_LEVEL(v);
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('h', "help", "prints_help", [&]() {
|
||||
char b[10240];
|
||||
|
@ -104,7 +103,6 @@ int main(int argc, char *argv[]) {
|
|||
sb << p;
|
||||
std::cout << sb.as_cslice().c_str();
|
||||
std::exit(2);
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('d', "daemonize", "set SIGHUP", [&]() {
|
||||
#if TD_DARWIN || TD_LINUX
|
||||
|
@ -112,9 +110,8 @@ int main(int argc, char *argv[]) {
|
|||
setsid();
|
||||
#endif
|
||||
td::set_signal_handler(td::SignalType::HangUp, force_rotate_logs).ensure();
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('l', "logname", "log to file", [&](td::Slice fname) {
|
||||
p.add_checked_option('l', "logname", "log to file", [&](td::Slice fname) {
|
||||
auto F = std::make_unique<td::FileLog>();
|
||||
TRY_STATUS(F->init(fname.str(), std::numeric_limits<td::uint64>::max(), true));
|
||||
logger_ = std::move(F);
|
||||
|
@ -122,25 +119,26 @@ int main(int argc, char *argv[]) {
|
|||
return td::Status::OK();
|
||||
});
|
||||
td::uint32 threads = 7;
|
||||
p.add_option('t', "threads", PSTRING() << "number of threads (default=" << threads << ")", [&](td::Slice fname) {
|
||||
td::int32 v;
|
||||
try {
|
||||
v = std::stoi(fname.str());
|
||||
} catch (...) {
|
||||
return td::Status::Error(ton::ErrorCode::error, "bad value for --threads: not a number");
|
||||
}
|
||||
if (v < 1 || v > 256) {
|
||||
return td::Status::Error(ton::ErrorCode::error, "bad value for --threads: should be in range [1..256]");
|
||||
}
|
||||
threads = v;
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('u', "user", "change user", [&](td::Slice user) { return td::change_user(user); });
|
||||
p.add_option('k', "key", "private key", [&](td::Slice key) {
|
||||
p.add_checked_option(
|
||||
't', "threads", PSTRING() << "number of threads (default=" << threads << ")", [&](td::Slice fname) {
|
||||
td::int32 v;
|
||||
try {
|
||||
v = std::stoi(fname.str());
|
||||
} catch (...) {
|
||||
return td::Status::Error(ton::ErrorCode::error, "bad value for --threads: not a number");
|
||||
}
|
||||
if (v < 1 || v > 256) {
|
||||
return td::Status::Error(ton::ErrorCode::error, "bad value for --threads: should be in range [1..256]");
|
||||
}
|
||||
threads = v;
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_checked_option('u', "user", "change user", [&](td::Slice user) { return td::change_user(user.str()); });
|
||||
p.add_checked_option('k', "key", "private key", [&](td::Slice key) {
|
||||
TRY_RESULT_ASSIGN(pk, ton::PrivateKey::import(key));
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('a', "addr", "ip:port of instance", [&](td::Slice key) {
|
||||
p.add_checked_option('a', "addr", "ip:port of instance", [&](td::Slice key) {
|
||||
TRY_STATUS(addr.init_host_port(key.str()));
|
||||
return td::Status::OK();
|
||||
});
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "td/utils/buffer.h"
|
||||
#include "td/utils/Status.h"
|
||||
#include "auto/tl/ton_api.h"
|
||||
|
||||
namespace ton {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "td/utils/port/IPAddress.h"
|
||||
#include "td/net/UdpServer.h"
|
||||
#include "td/utils/port/signals.h"
|
||||
#include "td/utils/OptionsParser.h"
|
||||
#include "td/utils/OptionParser.h"
|
||||
#include "td/utils/FileLog.h"
|
||||
#include "td/utils/port/path.h"
|
||||
#include "td/utils/port/user.h"
|
||||
|
@ -297,12 +297,11 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
std::string config = "/var/ton-work/etc/adnl-proxy.conf.json";
|
||||
|
||||
td::OptionsParser p;
|
||||
td::OptionParser p;
|
||||
p.set_description("validator or full node for TON network");
|
||||
p.add_option('v', "verbosity", "set verbosity level", [&](td::Slice arg) {
|
||||
int v = VERBOSITY_NAME(FATAL) + (td::to_integer<int>(arg));
|
||||
SET_VERBOSITY_LEVEL(v);
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('h', "help", "prints_help", [&]() {
|
||||
char b[10240];
|
||||
|
@ -310,21 +309,16 @@ int main(int argc, char *argv[]) {
|
|||
sb << p;
|
||||
std::cout << sb.as_cslice().c_str();
|
||||
std::exit(2);
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('c', "config", "config file", [&](td::Slice arg) {
|
||||
config = arg.str();
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('c', "config", "config file", [&](td::Slice arg) { config = arg.str(); });
|
||||
p.add_option('d', "daemonize", "set SIGHUP", [&]() {
|
||||
#if TD_DARWIN || TD_LINUX
|
||||
close(0);
|
||||
setsid();
|
||||
#endif
|
||||
td::set_signal_handler(td::SignalType::HangUp, force_rotate_logs).ensure();
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('l', "logname", "log to file", [&](td::Slice fname) {
|
||||
p.add_checked_option('l', "logname", "log to file", [&](td::Slice fname) {
|
||||
auto F = std::make_unique<td::FileLog>();
|
||||
TRY_STATUS(F->init(fname.str(), std::numeric_limits<td::int64>::max(), true));
|
||||
logger_ = std::move(F);
|
||||
|
@ -332,20 +326,21 @@ int main(int argc, char *argv[]) {
|
|||
return td::Status::OK();
|
||||
});
|
||||
td::uint32 threads = 7;
|
||||
p.add_option('t', "threads", PSTRING() << "number of threads (default=" << threads << ")", [&](td::Slice fname) {
|
||||
td::int32 v;
|
||||
try {
|
||||
v = std::stoi(fname.str());
|
||||
} catch (...) {
|
||||
return td::Status::Error(ton::ErrorCode::error, "bad value for --threads: not a number");
|
||||
}
|
||||
if (v < 1 || v > 256) {
|
||||
return td::Status::Error(ton::ErrorCode::error, "bad value for --threads: should be in range [1..256]");
|
||||
}
|
||||
threads = v;
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('u', "user", "change user", [&](td::Slice user) { return td::change_user(user); });
|
||||
p.add_checked_option(
|
||||
't', "threads", PSTRING() << "number of threads (default=" << threads << ")", [&](td::Slice fname) {
|
||||
td::int32 v;
|
||||
try {
|
||||
v = std::stoi(fname.str());
|
||||
} catch (...) {
|
||||
return td::Status::Error(ton::ErrorCode::error, "bad value for --threads: not a number");
|
||||
}
|
||||
if (v < 1 || v > 256) {
|
||||
return td::Status::Error(ton::ErrorCode::error, "bad value for --threads: should be in range [1..256]");
|
||||
}
|
||||
threads = v;
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_checked_option('u', "user", "change user", [&](td::Slice user) { return td::change_user(user.str()); });
|
||||
|
||||
p.run(argc, argv).ensure();
|
||||
|
||||
|
|
|
@ -1,3 +1,30 @@
|
|||
/*
|
||||
This file is part of TON Blockchain source code.
|
||||
|
||||
TON Blockchain is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
TON Blockchain is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with TON Blockchain. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, as a special exception, the copyright holders give permission
|
||||
to link the code of portions of this program with the OpenSSL library.
|
||||
You must obey the GNU General Public License in all respects for all
|
||||
of the code used other than OpenSSL. If you modify file(s) with this
|
||||
exception, you may extend this exception to your version of the file(s),
|
||||
but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. If you delete this exception statement
|
||||
from all source files in the program, then also delete it here.
|
||||
|
||||
Copyright 2017-2020 Telegram Systems LLP
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "adnl.h"
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "keys/encryptor.h"
|
||||
#include "td/utils/Time.h"
|
||||
#include "td/utils/format.h"
|
||||
#include "td/utils/OptionsParser.h"
|
||||
#include "td/utils/OptionParser.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
@ -168,7 +168,7 @@ td::Result<td::UInt256> get_uint256(std::string str) {
|
|||
int main(int argc, char *argv[]) {
|
||||
td::actor::ActorOwn<AdnlNode> x;
|
||||
|
||||
td::OptionsParser p;
|
||||
td::OptionParser p;
|
||||
p.set_description("test basic adnl functionality");
|
||||
p.add_option('h', "help", "prints_help", [&]() {
|
||||
char b[10240];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue