From 0a98dcaeb0cb0da6f279142a7a15aa40e972203e Mon Sep 17 00:00:00 2001 From: acetone Date: Thu, 16 Jan 2025 02:48:45 -0500 Subject: [PATCH] moved to giti2p --- CMakeLists.txt | 1 - README.md | 2 +- html/config_page.html | 2 +- html/error_page.html | 2 +- html/main_page.html | 2 +- http/httpserver.cpp | 1 - main.cpp | 9 +-- memorymanagment.cpp | 124 ------------------------------------------ memorymanagment.h | 39 ------------- 9 files changed, 9 insertions(+), 173 deletions(-) delete mode 100644 memorymanagment.cpp delete mode 100644 memorymanagment.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f41cc8..5ff44b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,6 @@ add_executable(i2pdtunnelwizard main.cpp tunneltype.h randomstringgenerator.h randomstringgenerator.cpp randomstringgenerator.h randomstringgenerator.cpp - memorymanagment.h memorymanagment.cpp http/crow.h http/crow/app.h http/crow/ci_map.h diff --git a/README.md b/README.md index 103673b..08ff063 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # i2pd tunnel wizard -A simple assistant for generating i2pd tunnel configuration files with an intuitive web interface without JS and i18n support (Russian and English). +A simple assistant for generating i2pd tunnel configuration files with an intuitive web interface (without JS) and i18n support (Russian and English). Clean C++. One external dependency is the `asio` library. diff --git a/html/config_page.html b/html/config_page.html index f861c4f..d04f1b9 100644 --- a/html/config_page.html +++ b/html/config_page.html @@ -76,7 +76,7 @@ English | Русский
- i2pd tunnel wizard v{{version}}
+ i2pd tunnel wizard v{{version}}
acetone, 2025 (no copyright)
diff --git a/html/error_page.html b/html/error_page.html index fd666cc..7e502f4 100644 --- a/html/error_page.html +++ b/html/error_page.html @@ -74,7 +74,7 @@ English | Русский
- i2pd tunnel wizard v{{version}}
+ i2pd tunnel wizard v{{version}}
acetone, 2025 (no copyright)
diff --git a/html/main_page.html b/html/main_page.html index f35b29f..985b459 100644 --- a/html/main_page.html +++ b/html/main_page.html @@ -156,7 +156,7 @@ English | Русский
- i2pd tunnel wizard v{{version}}
+ i2pd tunnel wizard v{{version}}
acetone, 2025 (no copyright)
diff --git a/http/httpserver.cpp b/http/httpserver.cpp index 0ccaba3..c67aace 100644 --- a/http/httpserver.cpp +++ b/http/httpserver.cpp @@ -1,6 +1,5 @@ #include "httpserver.h" #include "../tunnelconstructor.h" -#include "../memorymanagment.h" #include "crow/mustache.h" #include "../htmldata.h" #include "../tunnelconstructor.h" diff --git a/main.cpp b/main.cpp index 65eea65..d8f73ad 100644 --- a/main.cpp +++ b/main.cpp @@ -1,9 +1,7 @@ #include -#include "tunnelconstructor.h" -#include #include "http/httpserver.h" -#include "htmldata.h" +#include "versionnumber.h" void usage(char* argv0) { @@ -13,6 +11,9 @@ void usage(char* argv0) int main(int argc, char* argv[]) { + std::cout << "i2pd tunnel wizard v" << VERSION << std::endl; + std::cout << "src: http://git.i2p/acetone/i2pdtunnelwizard" << std::endl; + if (argc < 3) { usage(argv[0]); @@ -22,7 +23,7 @@ int main(int argc, char* argv[]) const std::string address (argv[1]); const uint16_t port (std::stoi(argv[2])); - std::cout << "Address: http://" << address << ":" << port << std::endl; + std::cout << "web ui: http://" << address << ":" << port << std::endl; crow::App app; app.loglevel(crow::LogLevel::Critical); diff --git a/memorymanagment.cpp b/memorymanagment.cpp deleted file mode 100644 index faa7d22..0000000 --- a/memorymanagment.cpp +++ /dev/null @@ -1,124 +0,0 @@ -#include "memorymanagment.h" - -/* - * Author: David Robert Nadeau - * Site: http://NadeauSoftware.com/ - * License: Creative Commons Attribution 3.0 Unported License - * http://creativecommons.org/licenses/by/3.0/deed.en_US - */ - -#if defined(_WIN32) -#include -#include - -#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__)) -#include -#include - -#if defined(__APPLE__) && defined(__MACH__) -#include - -#elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__))) -#include -#include - -#elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__) -#include - -#endif - -#else -#error "Cannot define getPeakRSS( ) or getCurrentRSS( ) for an unknown OS." -#endif - - - - - -/** - * Returns the peak (maximum so far) resident set size (physical - * memory use) measured in bytes, or zero if the value cannot be - * determined on this OS. - */ -size_t getPeakRSS( ) -{ -#if defined(_WIN32) - /* Windows -------------------------------------------------- */ - PROCESS_MEMORY_COUNTERS info; - GetProcessMemoryInfo( GetCurrentProcess( ), &info, sizeof(info) ); - return (size_t)info.PeakWorkingSetSize; - -#elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__))) - /* AIX and Solaris ------------------------------------------ */ - struct psinfo psinfo; - int fd = -1; - if ( (fd = open( "/proc/self/psinfo", O_RDONLY )) == -1 ) - return (size_t)0L; /* Can't open? */ - if ( read( fd, &psinfo, sizeof(psinfo) ) != sizeof(psinfo) ) - { - close( fd ); - return (size_t)0L; /* Can't read? */ - } - close( fd ); - return (size_t)(psinfo.pr_rssize * 1024L); - -#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__)) - /* BSD, Linux, and OSX -------------------------------------- */ - struct rusage rusage; - getrusage( RUSAGE_SELF, &rusage ); -#if defined(__APPLE__) && defined(__MACH__) - return (size_t)rusage.ru_maxrss; -#else - return (size_t)(rusage.ru_maxrss * 1024L); -#endif - -#else - /* Unknown OS ----------------------------------------------- */ - return (size_t)0L; /* Unsupported. */ -#endif -} - - - - - -/** - * Returns the current resident set size (physical memory use) measured - * in bytes, or zero if the value cannot be determined on this OS. - */ -size_t getCurrentRSS( ) -{ -#if defined(_WIN32) - /* Windows -------------------------------------------------- */ - PROCESS_MEMORY_COUNTERS info; - GetProcessMemoryInfo( GetCurrentProcess( ), &info, sizeof(info) ); - return (size_t)info.WorkingSetSize; - -#elif defined(__APPLE__) && defined(__MACH__) - /* OSX ------------------------------------------------------ */ - struct mach_task_basic_info info; - mach_msg_type_number_t infoCount = MACH_TASK_BASIC_INFO_COUNT; - if ( task_info( mach_task_self( ), MACH_TASK_BASIC_INFO, - (task_info_t)&info, &infoCount ) != KERN_SUCCESS ) - return (size_t)0L; /* Can't access? */ - return (size_t)info.resident_size; - -#elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__) - /* Linux ---------------------------------------------------- */ - long rss = 0L; - FILE* fp = NULL; - if ( (fp = fopen( "/proc/self/statm", "r" )) == NULL ) - return (size_t)0L; /* Can't open? */ - if ( fscanf( fp, "%*s%ld", &rss ) != 1 ) - { - fclose( fp ); - return (size_t)0L; /* Can't read? */ - } - fclose( fp ); - return (size_t)rss * (size_t)sysconf( _SC_PAGESIZE); - -#else - /* AIX, BSD, Solaris, and Unknown OS ------------------------ */ - return (size_t)0L; /* Unsupported. */ -#endif -} diff --git a/memorymanagment.h b/memorymanagment.h deleted file mode 100644 index c3d2b0c..0000000 --- a/memorymanagment.h +++ /dev/null @@ -1,39 +0,0 @@ -//#pragma once - -/* - * Author: David Robert Nadeau - * Site: http://NadeauSoftware.com/ - * License: Creative Commons Attribution 3.0 Unported License - * http://creativecommons.org/licenses/by/3.0/deed.en_US - */ - -#if defined(_WIN32) -#include -#include - -#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__)) -#include -#include - -#if defined(__APPLE__) && defined(__MACH__) -#include - -#elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__))) -#include -#include - -#elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__) -#include - -#endif - -#else -#error "Cannot define getPeakRSS( ) or getCurrentRSS( ) for an unknown OS." -#endif - - - - - -size_t getPeakRSS( ); -size_t getCurrentRSS( );