1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 17:39:53 +03:00

separte log directory and database(config) directory

@ was an alias for exedir. To separate log directory and
database(config) directory, @ is now an alias for logdir and $ is an
alias for dbdir.
This commit is contained in:
Koichiro IWAO 2019-09-11 13:34:09 +09:00
parent 01abdedc45
commit c64674479d
No known key found for this signature in database
GPG Key ID: 9F72CDBC01BF10EB
10 changed files with 37 additions and 25 deletions

View File

@ -431,6 +431,12 @@
#define LOG_ENGINE_BUFFER_CACHE_SIZE_MAX (10 * 1024 * 1024) // Write cache size #define LOG_ENGINE_BUFFER_CACHE_SIZE_MAX (10 * 1024 * 1024) // Write cache size
// Constant such as a file name // Constant such as a file name
//
// These placeholders will be replaced in InnerFilePathW().
//
// @ - placeholder for LogDir
// $ - placeholder for DbDir (config directory)
//
#define SERVER_LOG_DIR "server_log" #define SERVER_LOG_DIR "server_log"
#define SERVER_LOG_DIR_NAME "@"SERVER_LOG_DIR #define SERVER_LOG_DIR_NAME "@"SERVER_LOG_DIR
#define BRIDGE_LOG_DIR_NAME SERVER_LOG_DIR_NAME #define BRIDGE_LOG_DIR_NAME SERVER_LOG_DIR_NAME
@ -516,7 +522,7 @@
// Expiration date of random size cache // Expiration date of random size cache
#define RAND_SIZE_CACHE_EXPIRE (24 * 60 * 60 * 1000) #define RAND_SIZE_CACHE_EXPIRE (24 * 60 * 60 * 1000)
// Management allowed IP address list file name // Management allowed IP address list file name
#define ADMINIP_TXT "@adminip.txt" #define ADMINIP_TXT "$adminip.txt"
#define NON_SSL_MIN_COUNT 60 #define NON_SSL_MIN_COUNT 60
#define NON_SSL_ENTRY_EXPIRES (10 * 60 * 1000) #define NON_SSL_ENTRY_EXPIRES (10 * 60 * 1000)
@ -567,7 +573,7 @@
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
#define EL_ADMIN_PORT 22888 #define EL_ADMIN_PORT 22888
#define EL_CONFIG_FILENAME "@etherlogger.config" #define EL_CONFIG_FILENAME "$etherlogger.config"
#define EL_PACKET_LOG_DIR "etherlogger_log" #define EL_PACKET_LOG_DIR "etherlogger_log"
#define EL_PACKET_LOG_DIR_NAME "@"EL_PACKET_LOG_DIR #define EL_PACKET_LOG_DIR_NAME "@"EL_PACKET_LOG_DIR
#define EL_PACKET_LOG_FILE_NAME EL_PACKET_LOG_DIR_NAME"/%s" #define EL_PACKET_LOG_FILE_NAME EL_PACKET_LOG_DIR_NAME"/%s"

View File

@ -19,7 +19,7 @@
// Constants // Constants
#define CLIENT_CONFIG_FILE_NAME "@vpn_client.config" #define CLIENT_CONFIG_FILE_NAME "$vpn_client.config"
#define CLIENT_DEFAULT_KEEPALIVE_HOST "keepalive.softether.org" #define CLIENT_DEFAULT_KEEPALIVE_HOST "keepalive.softether.org"
#define CLIENT_DEFAULT_KEEPALIVE_PORT 80 #define CLIENT_DEFAULT_KEEPALIVE_PORT 80
#define CLIENT_DEFAULT_KEEPALIVE_INTERVAL KEEP_INTERVAL_DEFAULT #define CLIENT_DEFAULT_KEEPALIVE_INTERVAL KEEP_INTERVAL_DEFAULT
@ -39,7 +39,7 @@
#define CLIENT_WIN32_EXE_FILENAME_X64 "vpnclient_x64.exe" #define CLIENT_WIN32_EXE_FILENAME_X64 "vpnclient_x64.exe"
#define CLIENT_WIN32_EXE_FILENAME_IA64 "vpnclient_ia64.exe" #define CLIENT_WIN32_EXE_FILENAME_IA64 "vpnclient_ia64.exe"
#define CLIENT_CUSTOM_INI_FILENAME "@custom.ini" #define CLIENT_CUSTOM_INI_FILENAME "$custom.ini"
#define CLIENT_GLOBAL_PULSE_NAME "clientglobalpulse" #define CLIENT_GLOBAL_PULSE_NAME "clientglobalpulse"

View File

@ -9,7 +9,7 @@
#define NAT_H #define NAT_H
// Constants // Constants
#define NAT_CONFIG_FILE_NAME "@vpn_router.config" // NAT configuration file #define NAT_CONFIG_FILE_NAME "$vpn_router.config" // NAT configuration file
#define DEFAULT_NAT_ADMIN_PORT 2828 // Default port number for management #define DEFAULT_NAT_ADMIN_PORT 2828 // Default port number for management
#define NAT_ADMIN_PORT_LISTEN_INTERVAL 1000 // Interval for trying to open a port for management #define NAT_ADMIN_PORT_LISTEN_INTERVAL 1000 // Interval for trying to open a port for management
#define NAT_FILE_SAVE_INTERVAL (30 * 1000) // Interval to save #define NAT_FILE_SAVE_INTERVAL (30 * 1000) // Interval to save

View File

@ -9,12 +9,12 @@
static SERVER *server = NULL; static SERVER *server = NULL;
static LOCK *server_lock = NULL; static LOCK *server_lock = NULL;
char *SERVER_CONFIG_FILE_NAME = "@vpn_server.config"; char *SERVER_CONFIG_FILE_NAME = "$vpn_server.config";
char *SERVER_CONFIG_FILE_NAME_IN_CLIENT = "@vpn_gate_svc.config"; char *SERVER_CONFIG_FILE_NAME_IN_CLIENT = "$vpn_gate_svc.config";
char *SERVER_CONFIG_FILE_NAME_IN_CLIENT_RELAY = "@vpn_gate_relay.config"; char *SERVER_CONFIG_FILE_NAME_IN_CLIENT_RELAY = "$vpn_gate_relay.config";
char *BRIDGE_CONFIG_FILE_NAME = "@vpn_bridge.config"; char *BRIDGE_CONFIG_FILE_NAME = "$vpn_bridge.config";
char *SERVER_CONFIG_TEMPLATE_NAME = "@vpn_server_template.config"; char *SERVER_CONFIG_TEMPLATE_NAME = "$vpn_server_template.config";
char *BRIDGE_CONFIG_TEMPLATE_NAME = "@vpn_server_template.config"; char *BRIDGE_CONFIG_TEMPLATE_NAME = "$vpn_server_template.config";
static bool server_reset_setting = false; static bool server_reset_setting = false;
@ -964,7 +964,7 @@ LIST *EnumLogFile(char *hubname)
hubname = NULL; hubname = NULL;
} }
GetExeDir(exe_dir, sizeof(exe_dir)); GetLogDir(exe_dir, sizeof(exe_dir));
// Enumerate in the server_log // Enumerate in the server_log
if (hubname == NULL) if (hubname == NULL)
@ -1056,7 +1056,7 @@ void EnumLogFileDir(LIST *o, char *dirname)
return; return;
} }
GetExeDir(exe_dir, sizeof(exe_dir)); GetLogDir(exe_dir, sizeof(exe_dir));
Format(dir_full_path, sizeof(dir_full_path), "%s/%s", exe_dir, dirname); Format(dir_full_path, sizeof(dir_full_path), "%s/%s", exe_dir, dirname);
dir = EnumDir(dir_full_path); dir = EnumDir(dir_full_path);

View File

@ -48,7 +48,7 @@ extern char *SERVER_CONFIG_FILE_NAME;
#define MAX_PUBLIC_PORT_NUM 128 #define MAX_PUBLIC_PORT_NUM 128
#define MEMBER_SELECTOR_TXT_FILENAME "@member_selector.config" #define MEMBER_SELECTOR_TXT_FILENAME "$member_selector.config"
#define MEMBER_SELECTOR_CONNECT_TIMEOUT 2000 #define MEMBER_SELECTOR_CONNECT_TIMEOUT 2000
#define MEMBER_SELECTOR_DATA_TIMEOUT 5000 #define MEMBER_SELECTOR_DATA_TIMEOUT 5000

View File

@ -33,12 +33,12 @@ void BackupCfgWEx(CFG_RW *rw, FOLDER *f, wchar_t *original, UINT revision_number
} }
// Determine the directory name // Determine the directory name
UniFormat(dirname, sizeof(dirname), L"@backup.%s", original[0] == L'@' ? original + 1 : original); UniFormat(dirname, sizeof(dirname), L"$backup.%s", original[0] == L'$' ? original + 1 : original);
// Determine the file name // Determine the file name
LocalTime(&st); LocalTime(&st);
UniFormat(datestr, sizeof(datestr), L"%04u%02u%02u%02u_%s", UniFormat(datestr, sizeof(datestr), L"%04u%02u%02u%02u_%s",
st.wYear, st.wMonth, st.wDay, st.wHour, original[0] == L'@' ? original + 1 : original); st.wYear, st.wMonth, st.wDay, st.wHour, original[0] == L'$' ? original + 1 : original);
if (revision_number == INFINITE) if (revision_number == INFINITE)
{ {
@ -47,7 +47,7 @@ void BackupCfgWEx(CFG_RW *rw, FOLDER *f, wchar_t *original, UINT revision_number
else else
{ {
UniFormat(filename, sizeof(filename), L"%08u_%s", UniFormat(filename, sizeof(filename), L"%08u_%s",
revision_number, original[0] == L'@' ? original + 1 : original); revision_number, original[0] == L'$' ? original + 1 : original);
} }
// Don't save if the date and time has not been changed // Don't save if the date and time has not been changed

View File

@ -11,7 +11,7 @@
// Macro // Macro
//#define CHECK_CFG_NAME_EXISTS // Check duplication of the existing name //#define CHECK_CFG_NAME_EXISTS // Check duplication of the existing name
#define SAVE_BINARY_FILE_NAME_SWITCH L"@save_binary" #define SAVE_BINARY_FILE_NAME_SWITCH L"$save_binary"
// Constants // Constants
#define TAG_DECLARE "declare" #define TAG_DECLARE "declare"

View File

@ -2122,15 +2122,21 @@ void InnerFilePathW(wchar_t *dst, UINT size, wchar_t *src)
return; return;
} }
if (src[0] != L'@') if (src[0] == L'@')
{ {
NormalizePathW(dst, size, src); wchar_t dir[MAX_SIZE];
GetLogDirW(dir, sizeof(dir));
ConbinePathW(dst, size, dir, &src[1]);
}
else if (src[0] == L'$')
{
wchar_t dir[MAX_SIZE];
GetDbDirW(dir, sizeof(dir));
ConbinePathW(dst, size, dir, &src[1]);
} }
else else
{ {
wchar_t dir[MAX_SIZE]; NormalizePathW(dst, size, src);
GetExeDirW(dir, sizeof(dir));
ConbinePathW(dst, size, dir, &src[1]);
} }
} }
void InnerFilePath(char *dst, UINT size, char *src) void InnerFilePath(char *dst, UINT size, char *src)

View File

@ -54,7 +54,7 @@ struct DYN_VALUE
#define SSL_LOGGING_DIRNAME "@ssl_log" #define SSL_LOGGING_DIRNAME "@ssl_log"
// Private IP list file // Private IP list file
#define PRIVATE_IP_TXT_FILENAME "@private_ip.txt" #define PRIVATE_IP_TXT_FILENAME "$private_ip.txt"
// Start range of the random UDP port // Start range of the random UDP port
#define RAND_UDP_PORT_START 5000 #define RAND_UDP_PORT_START 5000

View File

@ -13,7 +13,7 @@
#define LANGLIST_FILENAME "|languages.txt" #define LANGLIST_FILENAME "|languages.txt"
#define LANGLIST_FILENAME_WINE "|languages_wine.txt" #define LANGLIST_FILENAME_WINE "|languages_wine.txt"
#define LANG_CONFIG_FILENAME L"@lang.config" #define LANG_CONFIG_FILENAME L"$lang.config"
#define LANG_CONFIG_TEMPLETE "|lang.config" #define LANG_CONFIG_TEMPLETE "|lang.config"
// Language constant // Language constant