Skip to content

Commit

Permalink
feat: Add version
Browse files Browse the repository at this point in the history
Signed-off-by: txtsd <[email protected]>
  • Loading branch information
txtsd committed Sep 7, 2023
1 parent 31f753a commit c406627
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
cmake_minimum_required(VERSION 3.24)

# Set the project name
project(DPITunnel DESCRIPTION "A program for bypassing internet censorship without a proxy server" LANGUAGES CXX)
file(STRINGS include/dpitunnel.h _raw_version_string REGEX "DPITUNNEL_VERSION \"([0-9]+\\.[0-9]+\\.[0-9]+)\"")
string(REGEX MATCH "([0-9]+\\.?)+" _dpitunnel_version "${_raw_version_string}")
project(DPITunnel DESCRIPTION "A program for bypassing internet censorship without a proxy server" VERSION ${_dpitunnel_version} LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
set(CXX_STANDARD_REQUIRED on)
cmake_policy(SET CMP0065 NEW)
cmake_policy(SET CMP0138 NEW)

Expand Down
5 changes: 4 additions & 1 deletion dpitunnel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <mutex>
#include <thread>
#include <csignal>
#include <format>
#include <unordered_map>
#include <sys/prctl.h>
#include <sys/socket.h>
Expand All @@ -34,7 +35,8 @@ const std::string CONNECTION_ERROR_RESPONSE(
"HTTP/1.1 0 Connection establish problem (read logs)\r\n\r\n");
const std::string PROCESS_NAME("DPITunnel");
const std::string HELP_PAGE(
"DPITunnel\n"
std::format(
"DPITunnel {}\n"
" A program for bypassing internet censorship without a proxy server\n"
"\n"
"Usage:\n"
Expand Down Expand Up @@ -76,6 +78,7 @@ const std::string HELP_PAGE(
" --custom-ips=<filename>\t\t\tallows to set custom IPs for specific domains, ignoring DNS/DoH response\n"
" --wsize=<number>\t\t\t\tTCP window size. Used to ask server to split Server Hello\n"
" --wsfactor=<number>\t\t\t\tTCP window scale factor. Used with wsize option"
, DPITUNNEL_VERSION)
);
int Interrupt_pipe[2];
std::atomic<bool> stop_flag;
Expand Down
2 changes: 2 additions & 0 deletions include/dpitunnel.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef DPITUNNEL_CLI_H
#define DPITUNNEL_CLI_H

#define DPITUNNEL_VERSION "0.9.0"

#include <map>
#include <set>
#include <string>
Expand Down

0 comments on commit c406627

Please sign in to comment.