Compare commits
4
Commits
dev-v0.1.50
...
v1.1.48
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67c43de80d | ||
|
|
ab4580920f | ||
|
|
c0942c4015 | ||
|
|
228aff5d63 |
No files matched your search
@@ -6,8 +6,9 @@ on:
|
||||
- dev
|
||||
paths:
|
||||
- 'core/src/**'
|
||||
- '.github/workflows/debian-dev.yml'
|
||||
- 'core/**'
|
||||
- 'nipovpn/**'
|
||||
- '.github/workflows/debian-dev.yml'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -38,37 +39,34 @@ jobs:
|
||||
libboost-all-dev \
|
||||
libyaml-cpp-dev
|
||||
|
||||
- name: Build the package
|
||||
- name: Build binary
|
||||
run: |
|
||||
rm -rf build
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
make -j$(nproc)
|
||||
cd ..
|
||||
|
||||
rm -rf package
|
||||
mkdir -p package/DEBIAN
|
||||
mkdir -p package/usr/bin
|
||||
- name: Build Debian package
|
||||
run: |
|
||||
mkdir -p nipovpn/usr/bin
|
||||
|
||||
cp build/core/nipovpn package/usr/bin/nipovpn
|
||||
chmod 755 package/usr/bin/nipovpn
|
||||
cp build/core/nipovpn nipovpn/usr/bin/nipovpn
|
||||
chmod 755 nipovpn/usr/bin/nipovpn
|
||||
|
||||
printf '%s\n' \
|
||||
"Package: nipovpn" \
|
||||
"Version: ${PACKAGE_VERSION}" \
|
||||
"Maintainer: Morteza Bashsiz" \
|
||||
"Architecture: amd64" \
|
||||
"Depends: libyaml-cpp0.8" \
|
||||
"Homepage: https://github.com/MortezaBashsiz/nipovpn" \
|
||||
"Description: Powerful and Secure HTTP/S Proxy" \
|
||||
> package/DEBIAN/control
|
||||
sed -i -E "s/^Version[[:space:]]*:.*/Version: ${PACKAGE_VERSION}/" nipovpn/DEBIAN/control
|
||||
|
||||
dpkg-deb --build package "build/${PACKAGE_FILE}"
|
||||
echo "Final control file:"
|
||||
cat nipovpn/DEBIAN/control
|
||||
|
||||
grep "^Version: ${PACKAGE_VERSION}$" nipovpn/DEBIAN/control
|
||||
|
||||
dpkg-deb --build nipovpn "build/${PACKAGE_FILE}"
|
||||
|
||||
- name: Show package information
|
||||
run: |
|
||||
dpkg -I "build/${PACKAGE_FILE}"
|
||||
ls -lah build/
|
||||
dpkg -c "build/${PACKAGE_FILE}"
|
||||
|
||||
- name: Upload Debian package as artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -81,17 +79,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Download build artifact
|
||||
- name: Download Debian package artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: nipovpn-dev-deb
|
||||
path: ./
|
||||
|
||||
- name: Check downloaded files
|
||||
run: |
|
||||
ls -lah
|
||||
|
||||
- name: Create GitHub DEV Release
|
||||
- name: Create DEV GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: dev-v${{ env.PACKAGE_VERSION }}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Build and Release Debian Package - DEV
|
||||
name: Build and Release Debian Package - MORI
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -6,15 +6,16 @@ on:
|
||||
- mori
|
||||
paths:
|
||||
- 'core/src/**'
|
||||
- '.github/workflows/debian-mori.yml'
|
||||
- 'core/**'
|
||||
- 'nipovpn/**'
|
||||
- '.github/workflows/debian-mori.yml'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
PACKAGE_VERSION: 0.1.${{ github.run_number }}
|
||||
PACKAGE_FILE: nipovpn_mori_0.1.${{ github.run_number }}_amd64.deb
|
||||
PACKAGE_VERSION: 0.2.${{ github.run_number }}
|
||||
PACKAGE_FILE: nipovpn_mori_0.2.${{ github.run_number }}_amd64.deb
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -38,37 +39,34 @@ jobs:
|
||||
libboost-all-dev \
|
||||
libyaml-cpp-dev
|
||||
|
||||
- name: Build the package
|
||||
- name: Build binary
|
||||
run: |
|
||||
rm -rf build
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
make -j$(nproc)
|
||||
cd ..
|
||||
|
||||
rm -rf package
|
||||
mkdir -p package/DEBIAN
|
||||
mkdir -p package/usr/bin
|
||||
- name: Build Debian package
|
||||
run: |
|
||||
mkdir -p nipovpn/usr/bin
|
||||
|
||||
cp build/core/nipovpn package/usr/bin/nipovpn
|
||||
chmod 755 package/usr/bin/nipovpn
|
||||
cp build/core/nipovpn nipovpn/usr/bin/nipovpn
|
||||
chmod 755 nipovpn/usr/bin/nipovpn
|
||||
|
||||
printf '%s\n' \
|
||||
"Package: nipovpn" \
|
||||
"Version: ${PACKAGE_VERSION}" \
|
||||
"Maintainer: Morteza Bashsiz" \
|
||||
"Architecture: amd64" \
|
||||
"Depends: libyaml-cpp0.8" \
|
||||
"Homepage: https://github.com/MortezaBashsiz/nipovpn" \
|
||||
"Description: Powerful and Secure HTTP/S Proxy" \
|
||||
> package/DEBIAN/control
|
||||
sed -i -E "s/^Version[[:space:]]*:.*/Version: ${PACKAGE_VERSION}/" nipovpn/DEBIAN/control
|
||||
|
||||
dpkg-deb --build package "build/${PACKAGE_FILE}"
|
||||
echo "Final control file:"
|
||||
cat nipovpn/DEBIAN/control
|
||||
|
||||
grep "^Version: ${PACKAGE_VERSION}$" nipovpn/DEBIAN/control
|
||||
|
||||
dpkg-deb --build nipovpn "build/${PACKAGE_FILE}"
|
||||
|
||||
- name: Show package information
|
||||
run: |
|
||||
dpkg -I "build/${PACKAGE_FILE}"
|
||||
ls -lah build/
|
||||
dpkg -c "build/${PACKAGE_FILE}"
|
||||
|
||||
- name: Upload Debian package as artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -81,17 +79,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Download build artifact
|
||||
- name: Download Debian package artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: nipovpn-mori-deb
|
||||
path: ./
|
||||
|
||||
- name: Check downloaded files
|
||||
run: |
|
||||
ls -lah
|
||||
|
||||
- name: Create GitHub MORI Release
|
||||
- name: Create MORI GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: mori-v${{ env.PACKAGE_VERSION }}
|
||||
|
||||
@@ -6,8 +6,9 @@ on:
|
||||
- main
|
||||
paths:
|
||||
- 'core/src/**'
|
||||
- '.github/workflows/debian.yml'
|
||||
- 'core/**'
|
||||
- 'nipovpn/**'
|
||||
- '.github/workflows/debian.yml'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -28,39 +29,44 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
dpkg-dev build-essential lintian fakeroot devscripts cmake \
|
||||
libssl-dev libboost-all-dev libyaml-cpp-dev
|
||||
dpkg-dev \
|
||||
build-essential \
|
||||
lintian \
|
||||
fakeroot \
|
||||
devscripts \
|
||||
cmake \
|
||||
libssl-dev \
|
||||
libboost-all-dev \
|
||||
libyaml-cpp-dev
|
||||
|
||||
- name: Build the package
|
||||
- name: Build binary
|
||||
run: |
|
||||
rm -rf build
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
make -j$(nproc)
|
||||
cd ..
|
||||
|
||||
rm -rf package
|
||||
mkdir -p package/DEBIAN package/usr/bin
|
||||
- name: Build Debian package
|
||||
run: |
|
||||
mkdir -p nipovpn/usr/bin
|
||||
|
||||
cp build/core/nipovpn package/usr/bin/nipovpn
|
||||
chmod 755 package/usr/bin/nipovpn
|
||||
cp build/core/nipovpn nipovpn/usr/bin/nipovpn
|
||||
chmod 755 nipovpn/usr/bin/nipovpn
|
||||
|
||||
printf '%s\n' \
|
||||
"Package: nipovpn" \
|
||||
"Version: ${PACKAGE_VERSION}" \
|
||||
"Maintainer: Morteza Bashsiz" \
|
||||
"Architecture: amd64" \
|
||||
"Depends: libyaml-cpp0.8" \
|
||||
"Homepage: https://github.com/MortezaBashsiz/nipovpn" \
|
||||
"Description: Powerful and Secure HTTP/S Proxy" \
|
||||
> package/DEBIAN/control
|
||||
|
||||
dpkg-deb --build package "build/${PACKAGE_FILE}"
|
||||
sed -i -E "s/^Version[[:space:]]*:.*/Version: ${PACKAGE_VERSION}/" nipovpn/DEBIAN/control
|
||||
|
||||
echo "Final control file:"
|
||||
cat nipovpn/DEBIAN/control
|
||||
|
||||
grep "^Version: ${PACKAGE_VERSION}$" nipovpn/DEBIAN/control
|
||||
|
||||
dpkg-deb --build nipovpn "build/${PACKAGE_FILE}"
|
||||
|
||||
- name: Show package information
|
||||
run: |
|
||||
dpkg -I "build/${PACKAGE_FILE}"
|
||||
ls -lah build/
|
||||
dpkg -c "build/${PACKAGE_FILE}"
|
||||
|
||||
- name: Upload Debian package as artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -73,7 +79,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Download build artifact
|
||||
- name: Download Debian package artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: nipovpn-main-deb
|
||||
@@ -83,7 +89,7 @@ jobs:
|
||||
run: |
|
||||
ls -lah
|
||||
|
||||
- name: Create GitHub MAIN Release
|
||||
- name: Create MAIN GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: v${{ env.PACKAGE_VERSION }}
|
||||
|
||||
@@ -149,7 +149,7 @@ void AgentHandler::handle() {
|
||||
}
|
||||
|
||||
std::string AgentHandler::relayHostHeader(const std::shared_ptr<Config> &config) {
|
||||
std::string hostHeader = config->general().fakeUrl;
|
||||
std::string hostHeader = config->randomFakeUrl();
|
||||
auto pos = hostHeader.find("://");
|
||||
if (pos != std::string::npos) hostHeader = hostHeader.substr(pos + 3);
|
||||
pos = hostHeader.find('/');
|
||||
|
||||
+32
-4
@@ -9,10 +9,11 @@ Config::Config(const RunMode &mode, const std::string &filePath)
|
||||
listenIp_("127.0.0.1"),
|
||||
listenPort_(0),
|
||||
general_({configYaml_["general"]["token"].as<std::string>(),
|
||||
configYaml_["general"]["fakeUrl"].as<std::string>(),
|
||||
configYaml_["general"]["fakeUrls"].as<std::vector<std::string>>(),
|
||||
configYaml_["general"]["methods"].as<std::vector<std::string>>(),
|
||||
configYaml_["general"]["endPoints"].as<std::vector<std::string>>(),
|
||||
configYaml_["general"]["timeout"].as<unsigned short>(),
|
||||
configYaml_["general"]["pullTimeout"].as<unsigned short>(),
|
||||
configYaml_["general"]["tunnelEnable"].as<bool>(false),
|
||||
configYaml_["general"]["connectionReuse"].as<bool>(false),
|
||||
configYaml_["general"]["tlsEnable"].as<bool>(false),
|
||||
@@ -72,7 +73,17 @@ std::string Config::toString() const {
|
||||
ss << "\nConfig :\n"
|
||||
<< " General :\n"
|
||||
<< " token: " << general_.token << "\n"
|
||||
<< " fakeUrl: " << general_.fakeUrl << "\n"
|
||||
<< " fakeUrls: ";
|
||||
|
||||
for (std::size_t i = 0; i < general_.fakeUrls.size(); ++i) {
|
||||
ss << general_.fakeUrls[i];
|
||||
|
||||
if (i != general_.fakeUrls.size() - 1) {
|
||||
ss << ", ";
|
||||
}
|
||||
}
|
||||
|
||||
ss << "\n"
|
||||
<< " methods: ";
|
||||
|
||||
for (std::size_t i = 0; i < general_.methods.size(); ++i) {
|
||||
@@ -96,6 +107,7 @@ std::string Config::toString() const {
|
||||
|
||||
ss << "\n"
|
||||
<< " timeout: " << general_.timeout << "\n"
|
||||
<< " pullTimeout: " << general_.pullTimeout << "\n"
|
||||
<< " tunnelEnable: " << std::boolalpha << general_.tunnelEnable << "\n"
|
||||
<< " connectionReuse: " << std::boolalpha << general_.connectionReuse << "\n"
|
||||
<< " tlsEnable: " << std::boolalpha << general_.tlsEnable << "\n"
|
||||
@@ -198,11 +210,27 @@ std::string Config::modeToString() const {
|
||||
}
|
||||
}
|
||||
|
||||
std::string Config::randomFakeUrl() const {
|
||||
std::lock_guard<std::mutex> lock(configMutex_);
|
||||
|
||||
if (general_.fakeUrls.empty()) {
|
||||
return "www.google.com";
|
||||
}
|
||||
|
||||
static thread_local std::mt19937 generator{std::random_device{}()};
|
||||
|
||||
std::uniform_int_distribution<std::size_t> distribution(
|
||||
0,
|
||||
general_.fakeUrls.size() - 1);
|
||||
|
||||
return general_.fakeUrls[distribution(generator)];
|
||||
}
|
||||
|
||||
std::string Config::randomMethod() const {
|
||||
std::lock_guard<std::mutex> lock(configMutex_);
|
||||
|
||||
if (general_.methods.empty()) {
|
||||
return "GET";// fallback
|
||||
return "GET";
|
||||
}
|
||||
|
||||
static thread_local std::mt19937 generator{std::random_device{}()};
|
||||
@@ -218,7 +246,7 @@ std::string Config::randomEndPoint() const {
|
||||
std::lock_guard<std::mutex> lock(configMutex_);
|
||||
|
||||
if (general_.endPoints.empty()) {
|
||||
return "api";// fallback
|
||||
return "api";
|
||||
}
|
||||
|
||||
static thread_local std::mt19937 generator{std::random_device{}()};
|
||||
|
||||
+4
-1
@@ -20,10 +20,11 @@ class Config : private Uncopyable {
|
||||
private:
|
||||
struct General {
|
||||
std::string token;
|
||||
std::string fakeUrl;
|
||||
std::vector<std::string> fakeUrls;
|
||||
std::vector<std::string> methods;
|
||||
std::vector<std::string> endPoints;
|
||||
unsigned short timeout;
|
||||
unsigned short pullTimeout;
|
||||
bool tunnelEnable;
|
||||
bool connectionReuse;
|
||||
bool tlsEnable;
|
||||
@@ -107,6 +108,8 @@ public:
|
||||
|
||||
std::string toString() const;
|
||||
|
||||
std::string randomFakeUrl() const;
|
||||
|
||||
std::string randomMethod() const;
|
||||
|
||||
std::string randomEndPoint() const;
|
||||
|
||||
@@ -325,10 +325,11 @@ inline BoolStr validateConfig(int argc, const char *argv[]) {
|
||||
|
||||
try {
|
||||
configYaml["general"]["token"].as<std::string>();
|
||||
configYaml["general"]["fakeUrl"].as<std::string>();
|
||||
configYaml["general"]["fakeUrls"].as<std::vector<std::string>>();
|
||||
configYaml["general"]["methods"].as<std::vector<std::string>>();
|
||||
configYaml["general"]["endPoints"].as<std::vector<std::string>>();
|
||||
configYaml["general"]["timeout"].as<unsigned short>();
|
||||
configYaml["general"]["pullTimeout"].as<unsigned short>();
|
||||
configYaml["general"]["tunnelEnable"].as<bool>();
|
||||
} catch (const std::exception &e) {
|
||||
result.message = std::string("Error in 'general' block: ") + e.what() + "\n";
|
||||
|
||||
+6
-4
@@ -156,10 +156,11 @@ bool HTTP::parseTls() {
|
||||
}
|
||||
|
||||
const std::string HTTP::genHttpPostReqString(const std::string &body) const {
|
||||
auto fakeUrl = config_->randomFakeUrl();
|
||||
return std::string(config_->randomMethod() + " " +
|
||||
config_->general().fakeUrl + " HTTP/" +
|
||||
fakeUrl + " HTTP/" +
|
||||
config_->agent().httpVersion + "\r\n") +
|
||||
"Host: " + config_->general().fakeUrl + "\r\n" +
|
||||
"Host: " + fakeUrl + "\r\n" +
|
||||
"User-Agent: " + config_->agent().userAgent + "\r\n" +
|
||||
"Accept: */*\r\n" + "Connection: keep-alive\r\n" +
|
||||
"Content-Length: " + std::to_string(body.length()) + "\r\n" +
|
||||
@@ -167,10 +168,11 @@ const std::string HTTP::genHttpPostReqString(const std::string &body) const {
|
||||
}
|
||||
|
||||
const std::string HTTP::genHttpRestPostReqString() const {
|
||||
auto fakeUrl = config_->randomFakeUrl();
|
||||
return std::string(config_->randomMethod() + " " +
|
||||
config_->general().fakeUrl + " HTTP/" +
|
||||
fakeUrl + " HTTP/" +
|
||||
config_->agent().httpVersion + "\r\n") +
|
||||
"Host: " + config_->general().fakeUrl + "\r\n" +
|
||||
"Host: " + fakeUrl + "\r\n" +
|
||||
"User-Agent: " + config_->agent().userAgent + "\r\n" +
|
||||
"Accept: */*\r\n" + "Connection: keep-alive\r\n" +
|
||||
"Rest: yes\r\n" + "COMP\r\n\r\n";
|
||||
|
||||
@@ -160,7 +160,7 @@ bool TCPClient::doHandshakeClient() {
|
||||
try {
|
||||
if (!tlsEnabled_ || !sslSocket_) return true;
|
||||
|
||||
std::string sniHost = config_->general().fakeUrl;
|
||||
std::string sniHost = config_->randomFakeUrl();
|
||||
|
||||
if (!sniHost.empty()) {
|
||||
auto pos = sniHost.find("://");
|
||||
|
||||
@@ -390,7 +390,7 @@ void TCPConnection::handleReadServer(const boost::system::error_code &error, siz
|
||||
}
|
||||
|
||||
std::string TCPConnection::makeRelayHostHeader() const {
|
||||
std::string hostHeader = config_->general().fakeUrl;
|
||||
std::string hostHeader = config_->randomFakeUrl();
|
||||
|
||||
auto pos = hostHeader.find("://");
|
||||
if (pos != std::string::npos) hostHeader = hostHeader.substr(pos + 3);
|
||||
@@ -512,7 +512,7 @@ void TCPConnection::startTunnelPollServer() {
|
||||
|
||||
pollInProgress_ = true;
|
||||
|
||||
pollTimer_.expires_after(std::chrono::milliseconds(10));
|
||||
pollTimer_.expires_after(std::chrono::milliseconds(config_->general().pullTimeout));
|
||||
pollTimer_.async_wait(
|
||||
boost::asio::bind_executor(
|
||||
strand_,
|
||||
|
||||
@@ -3,15 +3,19 @@
|
||||
general:
|
||||
# token: 32 bytes of string. this will be used on agent and server side to encryption
|
||||
token: "af445adb-2434-4975-9445-2c1b2231"
|
||||
# fakeUrl: string
|
||||
# Defines the fake url between agent and server
|
||||
fakeUrl: "www.google.com"
|
||||
# fakeUrls:
|
||||
# Defines the list of fake urls between agent and server
|
||||
fakeUrls:
|
||||
- nipo.ciron.net
|
||||
- sudoer.ir
|
||||
- sudoer.net
|
||||
- google.com
|
||||
- cloudflare.com
|
||||
# methods:
|
||||
# Defines the list of using methods
|
||||
# you like to send requests from agent to server
|
||||
# Program will choose randomly from this list
|
||||
methods:
|
||||
- HEAD
|
||||
- GET
|
||||
- POST
|
||||
- PUT
|
||||
@@ -29,6 +33,10 @@ general:
|
||||
# Defines the timeout for I/O Operation in seconds. 0 indicates no timeout.
|
||||
# Useful to automatically close stalled connections.
|
||||
timeout: 10
|
||||
# pullTimeout: unsigned short
|
||||
# Defines the timeout for I/O Operation in milliseconds.
|
||||
# Useful to expire serverside read timer.
|
||||
pullTimeout: 50
|
||||
# tunnelEnable: bool
|
||||
# Defines the connection mode between agent and server. If enabled then the traffic
|
||||
# will be TCP/TLS tunnel like.
|
||||
@@ -36,7 +44,7 @@ general:
|
||||
# connectionReuse: bool
|
||||
# If false then it will use same connection between agent and server to handle client request
|
||||
# If true then it will create new connection for each request between agent and server
|
||||
connectionReuse: false
|
||||
connectionReuse: true
|
||||
# tlsEnable: bool
|
||||
# It enables or disables tls between agent and server
|
||||
tlsEnable: false
|
||||
@@ -76,7 +84,7 @@ agent:
|
||||
# listenPort: the port number which will be used on agent
|
||||
listenPort: 8080
|
||||
# serverIp: IPv4 of the nipoServer
|
||||
serverIp: "127.0.0.1"
|
||||
serverIp: "127.0.0.10"
|
||||
# serverPort: port number of the nipoServer
|
||||
serverPort: 80
|
||||
# httpVersion: This version will be used between agent and server
|
||||
|
||||
Reference in new issue
Block a user