Merge pull request #1 from sh4dak/master

Fixed Values
This commit is contained in:
Михаил Подивилов 2019-05-11 22:27:15 +03:00 committed by GitHub
commit 1548fedb82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 28 additions and 28 deletions

View file

@ -149,12 +149,12 @@ namespace config {
options_description dotnetcontrol("DotNetControl options"); options_description dotnetcontrol("DotNetControl options");
dotnetcontrol.add_options() dotnetcontrol.add_options()
("dotnetcontrol.enabled", value<bool>()->default_value(false), "Enable or disable DOTNET Control Protocol") ("dotnetcontrol.enabled", value<bool>()->default_value(false), "Enable or disable .NET Control Protocol")
("dotnetcontrol.address", value<std::string>()->default_value("127.0.0.1"), "DOTNETCP listen address") ("dotnetcontrol.address", value<std::string>()->default_value("127.0.0.1"), "DNCP listen address")
("dotnetcontrol.port", value<uint16_t>()->default_value(55505), "DOTNETCP listen port") ("dotnetcontrol.port", value<uint16_t>()->default_value(55505), "DNCP listen port")
("dotnetcontrol.password", value<std::string>()->default_value("dotnet"), "DOTNETCP access password") ("dotnetcontrol.password", value<std::string>()->default_value("dotnet"), "DNCP access password")
("dotnetcontrol.cert", value<std::string>()->default_value("dotnetcontrol.crt.pem"), "DOTNETCP connection certificate") ("dotnetcontrol.cert", value<std::string>()->default_value("dotnetcontrol.crt.pem"), "DNCP connection certificate")
("dotnetcontrol.key", value<std::string>()->default_value("dotnetcontrol.key.pem"), "DOTNETCP connection certificate key") ("dotnetcontrol.key", value<std::string>()->default_value("dotnetcontrol.key.pem"), "DNCP connection certificate key")
; ;
bool upnp_default = false; bool upnp_default = false;

View file

@ -53,7 +53,7 @@ namespace fs {
if(!GetModuleFileName(NULL, localAppData, MAX_PATH)) if(!GetModuleFileName(NULL, localAppData, MAX_PATH))
{ {
#if defined(WIN32_APP) #if defined(WIN32_APP)
MessageBox(NULL, TEXT("Unable to get application path!"), TEXT("DOTNET: error"), MB_ICONERROR | MB_OK); MessageBox(NULL, TEXT("Unable to get application path!"), TEXT(".NET: error"), MB_ICONERROR | MB_OK);
#else #else
fprintf(stderr, "Error: Unable to get application path!"); fprintf(stderr, "Error: Unable to get application path!");
#endif #endif
@ -71,7 +71,7 @@ namespace fs {
if(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, localAppData) != S_OK) if(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, localAppData) != S_OK)
{ {
#if defined(WIN32_APP) #if defined(WIN32_APP)
MessageBox(NULL, TEXT("Unable to get AppData path!"), TEXT("DOTNET: error"), MB_ICONERROR | MB_OK); MessageBox(NULL, TEXT("Unable to get AppData path!"), TEXT(".NET: error"), MB_ICONERROR | MB_OK);
#else #else
fprintf(stderr, "Error: Unable to get AppData path!"); fprintf(stderr, "Error: Unable to get AppData path!");
#endif #endif

View file

@ -337,8 +337,8 @@ namespace data
{ {
uint16_t stA = htobe16 (GetSigType ()), stA1 = htobe16 (GetBlindedSigType ()); uint16_t stA = htobe16 (GetSigType ()), stA1 = htobe16 (GetBlindedSigType ());
uint8_t salt[32]; uint8_t salt[32];
//seed = HKDF(H("DOTNETGenerateAlpha", keydata), datestring || secret, "dotnetblinding1", 64) //seed = HKDF(H("DotNetGenerateAlpha", keydata), datestring || secret, "dotnetblinding1", 64)
H ("DOTNETGenerateAlpha", { {GetPublicKey (), GetPublicKeyLen ()}, {(const uint8_t *)&stA, 2}, {(const uint8_t *)&stA1, 2} }, salt); H ("DotNetGenerateAlpha", { {GetPublicKey (), GetPublicKeyLen ()}, {(const uint8_t *)&stA, 2}, {(const uint8_t *)&stA1, 2} }, salt);
dotnet::crypto::HKDF (salt, (const uint8_t *)date, 8, "dotnetblinding1", seed); dotnet::crypto::HKDF (salt, (const uint8_t *)date, 8, "dotnetblinding1", seed);
} }

View file

@ -127,14 +127,14 @@ namespace client
for (auto& it: m_ClientTunnels) for (auto& it: m_ClientTunnels)
{ {
LogPrint(eLogInfo, "Clients: stopping DOTNET client tunnel on port ", it.first); LogPrint(eLogInfo, "Clients: stopping .NET client tunnel on port ", it.first);
it.second->Stop (); it.second->Stop ();
} }
m_ClientTunnels.clear (); m_ClientTunnels.clear ();
for (auto& it: m_ServerTunnels) for (auto& it: m_ServerTunnels)
{ {
LogPrint(eLogInfo, "Clients: stopping DOTNET server tunnel"); LogPrint(eLogInfo, "Clients: stopping .NET server tunnel");
it.second->Stop (); it.second->Stop ();
} }
m_ServerTunnels.clear (); m_ServerTunnels.clear ();
@ -446,8 +446,8 @@ namespace client
} }
} }
LogPrint (eLogInfo, "Clients: ", numClientTunnels, " DOTNET client tunnels created"); LogPrint (eLogInfo, "Clients: ", numClientTunnels, " client tunnels created");
LogPrint (eLogInfo, "Clients: ", numServerTunnels, " DOTNET server tunnels created"); LogPrint (eLogInfo, "Clients: ", numServerTunnels, " server tunnels created");
} }
@ -523,7 +523,7 @@ namespace client
clientTunnel->Start(); clientTunnel->Start();
} }
else else
LogPrint(eLogError, "Clients: DOTNET Client forward for endpoint ", end, " already exists"); LogPrint(eLogError, "Clients: .NET Client forward for endpoint ", end, " already exists");
} else { } else {
boost::asio::ip::tcp::endpoint clientEndpoint; boost::asio::ip::tcp::endpoint clientEndpoint;
@ -563,7 +563,7 @@ namespace client
if(timeout) if(timeout)
{ {
clientTunnel->SetConnectTimeout(timeout); clientTunnel->SetConnectTimeout(timeout);
LogPrint(eLogInfo, "Clients: DOTNET Client tunnel connect timeout set to ", timeout); LogPrint(eLogInfo, "Clients: .NET Client tunnel connect timeout set to ", timeout);
} }
auto ins = m_ClientTunnels.insert (std::make_pair (clientEndpoint, clientTunnel)); auto ins = m_ClientTunnels.insert (std::make_pair (clientEndpoint, clientTunnel));
@ -577,11 +577,11 @@ namespace client
// TODO: update // TODO: update
if (ins.first->second->GetLocalDestination () != clientTunnel->GetLocalDestination ()) if (ins.first->second->GetLocalDestination () != clientTunnel->GetLocalDestination ())
{ {
LogPrint (eLogInfo, "Clients: DOTNET client tunnel destination updated"); LogPrint (eLogInfo, "Clients: .NET client tunnel destination updated");
ins.first->second->SetLocalDestination (clientTunnel->GetLocalDestination ()); ins.first->second->SetLocalDestination (clientTunnel->GetLocalDestination ());
} }
ins.first->second->isUpdated = true; ins.first->second->isUpdated = true;
LogPrint (eLogInfo, "Clients: DOTNET client tunnel for endpoint ", clientEndpoint, " already exists"); LogPrint (eLogInfo, "Clients: .NET client tunnel for endpoint ", clientEndpoint, " already exists");
} }
} }
} }
@ -637,10 +637,10 @@ namespace client
serverTunnel)).second) serverTunnel)).second)
{ {
serverTunnel->Start(); serverTunnel->Start();
LogPrint(eLogInfo, "Clients: DOTNET Server Forward created for UDP Endpoint ", host, ":", port, " bound on ", address, " for ",localDestination->GetIdentHash().ToBase32()); LogPrint(eLogInfo, "Clients: .NET Server Forward created for UDP Endpoint ", host, ":", port, " bound on ", address, " for ",localDestination->GetIdentHash().ToBase32());
} }
else else
LogPrint(eLogError, "Clients: DOTNET Server Forward for destination/port ", m_AddressBook.ToAddress(localDestination->GetIdentHash()), "/", port, "already exists"); LogPrint(eLogError, "Clients: .NET Server Forward for destination/port ", m_AddressBook.ToAddress(localDestination->GetIdentHash()), "/", port, "already exists");
continue; continue;
} }
@ -687,11 +687,11 @@ namespace client
// TODO: update // TODO: update
if (ins.first->second->GetLocalDestination () != serverTunnel->GetLocalDestination ()) if (ins.first->second->GetLocalDestination () != serverTunnel->GetLocalDestination ())
{ {
LogPrint (eLogInfo, "Clients: DOTNET server tunnel destination updated"); LogPrint (eLogInfo, "Clients: .NET server tunnel destination updated");
ins.first->second->SetLocalDestination (serverTunnel->GetLocalDestination ()); ins.first->second->SetLocalDestination (serverTunnel->GetLocalDestination ());
} }
ins.first->second->isUpdated = true; ins.first->second->isUpdated = true;
LogPrint (eLogInfo, "Clients: DOTNET server tunnel for destination/port ", m_AddressBook.ToAddress(localDestination->GetIdentHash ()), "/", inPort, " already exists"); LogPrint (eLogInfo, "Clients: .NET server tunnel for destination/port ", m_AddressBook.ToAddress(localDestination->GetIdentHash ()), "/", inPort, " already exists");
} }
} }

View file

@ -56,7 +56,7 @@ namespace client
virtual void Start () = 0; virtual void Start () = 0;
virtual void Stop () = 0; virtual void Stop () = 0;
virtual const char* GetName() { return "Generic DOTNET Service"; } virtual const char* GetName() { return "Generic .NET Service"; }
private: private:
void TriggerReadyCheckTimer(); void TriggerReadyCheckTimer();

View file

@ -338,7 +338,7 @@ namespace proxy {
} }
} }
} }
/* check dest_host really exists and inside DOTNET network */ /* check dest_host really exists and inside .NET network */
if (str_rmatch(dest_host, ".dotnet")) { if (str_rmatch(dest_host, ".dotnet")) {
if (!dotnet::client::context.GetAddressBook ().GetAddress (dest_host)) { if (!dotnet::client::context.GetAddressBook ().GetAddress (dest_host)) {
HostNotFound(dest_host); HostNotFound(dest_host);
@ -353,7 +353,7 @@ namespace proxy {
GenericProxyError("Outproxy failure", "bad outproxy settings"); GenericProxyError("Outproxy failure", "bad outproxy settings");
} else { } else {
LogPrint (eLogWarning, "HTTPProxy: outproxy failure for ", dest_host, ": no outproxy enabled"); LogPrint (eLogWarning, "HTTPProxy: outproxy failure for ", dest_host, ": no outproxy enabled");
std::string message = "Host " + dest_host + " not inside DOTNET network, but outproxy is not enabled"; std::string message = "Host " + dest_host + " not inside .NET network, but outproxy is not enabled";
GenericProxyError("Outproxy failure", message.c_str()); GenericProxyError("Outproxy failure", message.c_str());
} }
return true; return true;

View file

@ -833,7 +833,7 @@ namespace client
{ {
LogPrint (eLogError, "SAM: socket write error: ", ecode.message ()); LogPrint (eLogError, "SAM: socket write error: ", ecode.message ());
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
Terminate ("socket write error at HandleWriteDOTNETata"); Terminate ("socket write error at HandleWriteDotnetAta");
} }
else else
{ {
@ -845,7 +845,7 @@ namespace client
{ {
if (stream) if (stream)
{ {
LogPrint (eLogDebug, "SAM: incoming DOTNET connection for session ", m_ID); LogPrint (eLogDebug, "SAM: incoming .NET connection for session ", m_ID);
m_SocketType = eSAMSocketTypeStream; m_SocketType = eSAMSocketTypeStream;
m_IsAccepting = false; m_IsAccepting = false;
m_Stream = stream; m_Stream = stream;
@ -880,7 +880,7 @@ namespace client
DOTNETReceive (); DOTNETReceive ();
} }
else else
LogPrint (eLogWarning, "SAM: DOTNET acceptor has been reset"); LogPrint (eLogWarning, "SAM: .NET acceptor has been reset");
} }
void SAMSocket::HandleDOTNETatagramReceive (const dotnet::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len) void SAMSocket::HandleDOTNETatagramReceive (const dotnet::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len)