feat: initial conan support and build process refactoring (#2260)

* feat: initial conan support

* feat: add awg-go and awg-apple recipes

* feat: macos full feature conan build, except ss and cloak

* feat: conan android initial support

* fix: android libssh fixes

* conan: android additional recipes and fixes

* feat: openvpn add support android

* fix: awg android connection establish

* conan: apple full-featured support

* chore: bump min macos version

* chore: get rid of manual deploy recursive copying

* conan: beautify makefile-based recipes

* conan: add geosite.dat and geoip.dat

* conan: use lib linking instead of QT_EXTRA_LIBS for OVPN

* conan: address lack of SONAME of libck-ovpn-plugin.so correctly

* conan: windows initial support

* conan: make awg-windows and wintun be interpret as exes

* conan: fix version for v2ray-rules-dat

* feat: conan and platform bootstrap rework in cmake

* feat: 16kb support for Android

* chore(conan): recipes cleanup

* feat: support of drivers for windows

* feat: support full-featured cmake install

* chore: exclude qtkeychain from the target build

* fix: install for apple systems

* fix: provide flags for cloak plugin for openvpn-pt-android

* chore: bump android deps for 16kb support

* feat(conan): patch cloak to properly provide env for golang

* chore: remove redundant hint from conan find

* feat: linux <-> conan features

* feat: linux initial packaging support

* feat: linux cpack support

* feat: cpack windows full-featured build

* feat: productbuild cpack support

* feat: rework CI/CD for macos

* feat: rework CI/CD for Linux

* fix: libncap automake args

* fix: CI/CD correct QT paths

* fix: windows rework CI/CD

* fix: windows artifact upload

* chore: remove MacOS-old from build targets

* feat: add conan to all mobile and NE builds

* feat: support default amnezia conan remote

* fix: use Release instead of release on Android

* feat: get rid of 3rd-prebuilt

* feat: conan CI/CD upload

* fix: CI/CD change windows toolset versions

* fix: remove MSVC version from CI/CD

* feat: conan CI/CD add Release and Debug build types

* feat: add multiple xcode versions for conan CI/CD

* fix: correct conan CI/CD clang versions

* feat: separate prebuilt baking, and add some for NE

* feat: rework keychain on ios/macos even more

* fix: add desktop Qt for iOS

* feat: add QT_HOST_PATH to build.sh

* fix: add deploy definition to cmake

* fix: android adjustments for toolchains and CI/CD

* fix: add needs for Android CI/CD

* fix: Android CI/CD use android-28

* fix: modernize translations, and CI/CD fixes

* fix: gradle min sdk compilation error

* fix: CI/CD add installers to all jobs

* fix: parse android platform more precisely

* fix: adjust aab path in CI/CD

* feat: CI/CD do not execute artifact build if there is nothing changed

* fix: CI/CD use common jobs even if previous were failed

* fix: Apple CI/CD use set-key-partition-list for keychains

* fix: Apple CI/CD do not specify any keychain (use default)

* fix: build aab as a different step in build script

* chore: beautify build.sh script

* feat: CI/CD build separate APKs per ABI

* fix: Android CI/CD upload artifact in separate steps

* chore: recipes cleanup

* feat: add hints for conan on MacOS

* fix: add main.cpp and tests back to CMakeLists.txt

* chore: xrayProtocol codestyle changes

* fix: openssl set proper X509 request version

* fix: make openvpn protocol rely only on client while configuring

* chore: get rid of old scripts

* chore: readme update describing build process more precisely

* feat: windows build script add multiprocessing capabilities

* chore: bump Qt version in README

* feat: add generator option and use Ninja by default in CI/CD for linux/macos

---------

Co-authored-by: NickVs2015 <nv@amnezia.org>
This commit is contained in:
Yaroslav Gurov
2026-05-04 16:59:24 +02:00
committed by GitHub
parent c0cae0ff01
commit 009ca981d5
103 changed files with 4050 additions and 2119 deletions

View File

@@ -0,0 +1,62 @@
from conan import ConanFile
from conan.tools.files import get, copy
from conan.tools.layout import basic_layout
from conan.errors import ConanInvalidConfiguration
from conan.tools.env import VirtualBuildEnv, Environment
import os
import stat
from pathlib import Path
class AmneziaLibxray(ConanFile):
name = "amnezia-libxray"
version = "1.0.0"
settings = "os", "arch", "compiler"
def configure(self):
self.settings.rm_safe("compiler.libcxx")
self.settings.rm_safe("compiler.cppstd")
def layout(self):
basic_layout(self, build_folder=".")
def build_requirements(self):
self.tool_requires("go/1.26.0")
def validate(self):
if self.settings.os != "Android":
raise ConanInvalidConfiguration(f"{self.name} v{self.version} does not support {self.settings.os}")
def source(self):
get(self, "https://github.com/amnezia-vpn/amnezia-libxray/archive/refs/tags/v1.0.0.zip",
sha256="0c50c5acd5063a9fc3cfbb5b3e11481d30cfa3762b3cb1d72130248ff498e9df", strip_root=True
)
def generate(self):
VirtualBuildEnv(self).generate()
env = Environment()
ndk_path_str = self.conf.get("tools.android:ndk_path")
if ndk_path_str:
ndk_path = Path(ndk_path_str)
if len(ndk_path.parts) > 2:
sdk_path = ndk_path.parents[1]
env.define("ANDROID_HOME", str(sdk_path))
env.vars(self).save_script("conan_provide_androidhome")
def _patch_sources(self):
build_path = os.path.join(self.build_folder, "build.sh")
build_stat = os.stat(build_path)
os.chmod(build_path, build_stat.st_mode | stat.S_IEXEC)
def build(self):
self._patch_sources()
self.run("./build.sh android")
def package(self):
copy(self, "libxray.aar", src=self.build_folder, dst=os.path.join(self.package_folder, "aar"))
def package_info(self):
self.cpp_info.set_property("cmake_extra_variables", {
"AMNEZIA_LIBXRAY_PATH": os.path.join(self.package_folder, "aar", "libxray.aar"),
})

View File

@@ -0,0 +1,110 @@
from conan import ConanFile
from conan.tools.files import get, copy, collect_libs, chdir, rename
from conan.tools.layout import basic_layout
from conan.errors import ConanInvalidConfiguration
from conan.tools.gnu import Autotools, AutotoolsToolchain
import os
class AmneziaXrayBindings(ConanFile):
name = "amnezia-xray-bindings"
version = "1.1.0"
settings = "os", "arch", "compiler"
@property
def _goos(self):
return {
"Linux": "linux",
"iOS": "ios",
"Macos": "darwin",
"Windows": "windows"
}.get(str(self.settings.os))
@property
def _goarch(self):
return {
"x86": "386",
"x86_64": "amd64",
"armv8": "arm64"
}.get(str(self.settings.arch))
@property
def _is_windows(self):
return str(self.settings.os).startswith("Windows")
def config_options(self):
self.package_type = "shared-library" if self._is_windows else "static-library"
def configure(self):
self.settings.rm_safe("compiler.libcxx")
self.settings.rm_safe("compiler.cppstd")
if self._is_windows:
# mingw-builds is being used on Windows
del self.settings.compiler
def layout(self):
basic_layout(self)
def build_requirements(self):
self.tool_requires("go/1.26.0")
if self._is_windows:
self.win_bash = True
if not self.conf.get("tools.microsoft.bash:path", check_type=str):
self.tool_requires("msys2/cci.latest")
self.tool_requires("mingw-builds/15.1.0")
def validate(self):
if not self._goos or not self._goarch:
raise ConanInvalidConfiguration(
f"{self.name} v{self.version} does not support {self.settings.os} {self.settings.arch}"
)
def source(self):
get(self, "https://github.com/amnezia-vpn/amnezia-xray-bindings/archive/v1.1.0.zip",
sha256="6ea768ec7002cedd422a39aea17704b888acaf794432aa5937cfc92fb6d80eb5", strip_root=True)
def generate(self):
tc = AutotoolsToolchain(self)
tc.make_args = [
"LIB_ARC=libamnezia_xray.a"
]
env = tc.environment()
env.define("ARCH", self._goarch)
env.define("GOARCH", self._goarch)
env.define("GOOS", self._goos)
env.define("CGO_LDFLAGS", tc.ldflags)
env.define("CGO_CFLAGS", tc.cflags)
if self._is_windows:
env.define("OS", "windows")
tc.generate(env)
def build(self):
with chdir(self, self.source_folder):
autotools = Autotools(self)
autotools.make()
def _rename_header(self):
if not self._is_windows:
rename(self, os.path.join(self.package_folder, "include", "libamnezia_xray.h"),
os.path.join(self.package_folder, "include", "amnezia_xray.h"))
def _rename_libs(self):
# workaround of bad naming strategy in amnezia-xray-bindings
# TODO: change it and kick out the code below
lib_dir = os.path.join(self.package_folder, "lib")
for fname in os.listdir(lib_dir):
if not fname.startswith("lib"):
src = os.path.join(lib_dir, fname)
dst = os.path.join(lib_dir, "lib" + fname)
os.rename(src, dst)
def package(self):
copy(self, "*.h", src=self.build_folder, dst=os.path.join(self.package_folder, "include"))
copy(self, "*.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"))
copy(self, "*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"))
copy(self, "*.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"))
self._rename_header()
def package_info(self):
self.cpp_info.set_property("cmake_target_name", "amnezia::xray-bindings")
self.cpp_info.libs = collect_libs(self)

View File

@@ -0,0 +1,86 @@
from conan import ConanFile
from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain
from conan.tools.files import copy, replace_in_file
from conan.errors import ConanInvalidConfiguration
from conan.tools.scm import Git
import os
import platform
class AwgAndroid(ConanFile):
name = "awg-android"
version = "1.1.7"
settings = "os", "arch", "build_type", "compiler"
def configure(self):
self.settings.rm_safe("compiler.libcxx")
self.settings.rm_safe("compiler.cppstd")
def layout(self):
cmake_layout(self)
def build_requirements(self):
self.tool_requires("cmake/[>=3.4.1 <4]")
def validate(self):
if self.settings.os != "Android":
raise ConanInvalidConfiguration(f"{self.name} v{self.version} does not support {self.settings.os}")
def source(self):
git = Git(self)
git.clone(
url="https://github.com/amnezia-vpn/amneziawg-android.git",
target=".",
args=["--recurse-submodules", "--branch", f"v{self.version}"]
)
def generate(self):
tc = CMakeToolchain(self)
tc.variables["GRADLE_USER_HOME"] = os.path.join(self.build_folder, "gradle_user_home")
tc.variables["CMAKE_LIBRARY_OUTPUT_DIRECTORY"] = os.path.join(self.build_folder, "out")
# not to warn in case of strtok() usage
tc.extra_cflags = ["-Wno-deprecated-declarations"]
tc.generate()
def _patch_sources(self):
if platform.system() == 'Darwin':
replace_in_file(self,
os.path.join(self.source_folder, "tunnel", "tools", "libwg-go", "Makefile"),
'flock "$@.lock" -c \' \\\n',
"",
)
replace_in_file(self,
os.path.join(self.source_folder, "tunnel", "tools", "libwg-go", "Makefile"),
'mv "$@.tmp" "$@"\'',
'mv "$@.tmp" "$@"',
)
replace_in_file(self,
os.path.join(self.source_folder, "tunnel", "tools", "libwg-go", "Makefile"),
'touch "$@"\'',
'touch "$@"',
)
replace_in_file(self,
os.path.join(self.source_folder, "tunnel", "tools", "libwg-go", "Makefile"),
'sha256sum -c',
'shasum -a 256 -c'
)
def build(self):
self._patch_sources()
cmake = CMake(self)
cmake.configure(build_script_folder=os.path.join(self.source_folder, "tunnel", "tools"))
cmake.build(target=["libwg-go.so", "libwg.so", "libwg-quick.so"])
def package(self):
copy(self, "libwg-go.h", src=os.path.join(self.build_folder, "out"), dst=os.path.join(self.package_folder, "include"))
copy(self, "libwg-go.so", src=os.path.join(self.build_folder, "out"), dst=os.path.join(self.package_folder, "lib"))
copy(self, "libwg.so", src=os.path.join(self.build_folder, "out"), dst=os.path.join(self.package_folder, "bin"))
copy(self, "libwg-quick.so", src=os.path.join(self.build_folder, "out"), dst=os.path.join(self.package_folder, "bin"))
def package_info(self):
self.cpp_info.set_property("cmake_target_name", "amnezia::awg-android")
self.cpp_info.libs = [ "wg-go" ]
self.cpp_info.set_property("cmake_extra_variables", {
"AMNEZIA_ANDROID_LIBWG_PATH": os.path.join(self.package_folder, "bin", "libwg.so"),
"AMNEZIA_ANDROID_LIBWG_QUICK_PATH": os.path.join(self.package_folder, "bin", "libwg-quick.so"),
})

View File

@@ -0,0 +1,66 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.layout import basic_layout
from conan.tools.files import get, copy, collect_libs
from conan.tools.apple import is_apple_os
from conan.tools.gnu import AutotoolsToolchain, Autotools
import os
class AwgApple(ConanFile):
name = "awg-apple"
version = "2.0.1"
settings = "os", "arch", "compiler"
@property
def _goarch(self):
arch_map = {
"armv8": "arm64",
"x86_64": "x86_64",
}
archs = str(self.settings.arch).split("|")
return " ".join(arch_map.get(arch, arch) for arch in archs)
def configure(self):
self.settings.rm_safe("compiler.libcxx")
self.settings.rm_safe("compiler.cppstd")
def layout(self):
basic_layout(self, build_folder=os.path.join(self.folders.source, "Sources/WireGuardKitGo"))
def build_requirements(self):
self.tool_requires("go/1.26.0")
def validate(self):
if not is_apple_os(self):
raise ConanInvalidConfiguration(
f"{self.name} v{self.version} does not support {self.settings.os}"
)
def source(self):
get(self, f"https://github.com/amnezia-vpn/amneziawg-apple/archive/refs/tags/v{self.version}.zip",
sha256="9fe4f8cfbb6a751558b54b7979db3a5ea46e49731912aae99f093e84a1433e97", strip_root=True
)
def generate(self):
tc = AutotoolsToolchain(self)
sdk = self.settings.get_safe("os.sdk", "macosx")
tc.make_args = [
f"ARCHS={self._goarch}",
f"PLATFORM_NAME={sdk}"
]
tc.generate()
def build(self):
autotools = Autotools(self)
autotools.make()
autotools.make("version-header")
def package(self):
copy(self, "wireguard.h", src=self.build_folder, dst=os.path.join(self.package_folder, "include"))
copy(self, "*.h", src=os.path.join(self.build_folder, "out"), dst=os.path.join(self.package_folder, "include"))
copy(self, "*.a", src=os.path.join(self.build_folder, "out"), dst=os.path.join(self.package_folder, "lib"))
def package_info(self):
self.cpp_info.set_property("cmake_target_name", "amnezia::awg-apple")
self.cpp_info.libs = collect_libs(self)

View File

@@ -0,0 +1,67 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.layout import basic_layout
from conan.tools.files import get, copy
from conan.tools.gnu import Autotools, AutotoolsToolchain
import os
class AwgGo(ConanFile):
name = "awg-go"
version = "0.2.16"
package_type = "application"
settings = "os", "arch"
@property
def _goos(self):
return {
"Linux": "linux",
"Macos": "darwin",
"Windows": "windows"
}.get(str(self.settings.os))
@property
def _goarch(self):
return {
"x86": "386",
"x86_64": "amd64",
"armv8": "arm64"
}.get(str(self.settings.arch))
def layout(self):
basic_layout(self, build_folder=".")
def build_requirements(self):
self.tool_requires("go/1.26.0")
def validate(self):
if not self._goos or not self._goarch:
raise ConanInvalidConfiguration(
f"{self.name} v{self.version} does not support {self.settings.os} {self.settings.arch}"
)
def source(self):
get(self, f"https://github.com/amnezia-vpn/amneziawg-go/archive/refs/tags/v{self.version}.zip",
sha256="34da7d4189f215f3930de441548bc2a0c89d54d347a4fb85cb9c715fce6413aa", strip_root=True
)
def generate(self):
tc = AutotoolsToolchain(self)
env = tc.environment()
env.define("GOOS", self._goos)
env.define("GOARCH", self._goarch)
env.define("CGO_LDFLAGS", tc.ldflags)
env.define("CGO_CFLAGS", tc.cflags)
tc.generate(env)
def build(self):
at = Autotools(self)
at.make()
def package(self):
copy(self, "amneziawg-go", src=self.build_folder, dst=self.package_folder)
def package_info(self):
self.cpp_info.exe = True
self.cpp_info.location = os.path.join(self.package_folder, "amneziawg-go")
self.cpp_info.set_property("cmake_target_name", "amnezia::awg-go")

View File

@@ -0,0 +1,102 @@
from conan import ConanFile
from conan.tools.layout import basic_layout
from conan.errors import ConanInvalidConfiguration
from conan.tools.files import get, copy, chdir
from conan.tools.gnu import AutotoolsToolchain
import os
class AwgWindows(ConanFile):
name = "awg-windows"
version = "0.1.8"
settings = "os", "arch"
@property
def _goarm(self):
return {
"armv5el": "5",
"armv5hf": "5",
"armv6": "6",
"armv7": "7",
"armv7hf": "7",
"armv7s": "7",
"armv7k": "7",
}.get(str(self.settings.arch))
@property
def _goarch(self):
return {
"x86": "386",
"x86_64": "amd64",
"armv5el": "arm",
"armv5hf": "arm",
"armv6": "arm",
"armv7": "arm",
"armv7hf": "arm",
"armv7s": "arm",
"armv7k": "arm",
"armv8": "arm64",
"armv8_32": "arm64",
"armv8.3": "arm64",
"arm64ec": "arm64"
}.get(str(self.settings.arch))
def layout(self):
basic_layout(self)
def validate(self):
if not str(self.settings.os).startswith("Windows"):
raise ConanInvalidConfiguration(
f"{self.name} v{self.version} is to be used on Windows only!"
)
if not self._goarch:
raise ConanInvalidConfiguration(
f"{self.name} v{self.version} does not support {self.settings.arch} architecture"
)
def build_requirements(self):
self.tool_requires("mingw-builds/15.1.0")
self.tool_requires("go/1.26.0")
def requirements(self):
self.requires("wintun/[*]")
def source(self):
get(self, f"https://github.com/amnezia-vpn/amneziawg-windows/archive/refs/tags/v{self.version}.zip",
sha256="1de472832b332515c96cdf14ea887edde42ed7ad173675280c51baa9a3ef62f2", strip_root=True)
def generate(self):
tc = AutotoolsToolchain(self)
tc.extra_cflags = [
"-Wall",
"-Wno-unused-function",
"-Wno-switch",
"-DWINVER=0x0601"
]
tc.extra_ldflags = [
"-Wl,--dynamicbase",
"-Wl,--nxcompat",
"-Wl,--export-all-symbols",
"-Wl,--high-entropy-va"
]
env = tc.environment()
env.define("GOOS", "windows")
if self._goarm:
env.define("GOARM", self._goarm)
env.define("GOARCH", self._goarch)
env.define("CGO_ENABLED", "1")
env.define("CGO_LDFLAGS", tc.ldflags)
env.define("CGO_CFLAGS", tc.cflags)
tc.generate(env)
def build(self):
with chdir(self, self.source_folder):
self.run(f'go build -buildmode c-shared -ldflags="-w -s" -trimpath -v -o "{os.path.join(self.build_folder, "tunnel.dll")}"')
def package(self):
copy(self, "tunnel.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"))
def package_info(self):
self.cpp_info.exe = True
self.cpp_info.location = os.path.join(self.package_folder, "bin", "tunnel.dll")
self.cpp_info.set_property("cmake_target_name", "amnezia::awg-windows")

26
recipes/go/conandata.yml Normal file
View File

@@ -0,0 +1,26 @@
sources:
"1.26.0":
Macos:
x86_64:
url: "https://go.dev/dl/go1.26.0.darwin-amd64.tar.gz"
sha256: "1ca28b7703cbea05a65b2a1d92d6b308610ef92f8824578a0874f2e60c9d5a22"
armv8:
url: "https://go.dev/dl/go1.26.0.darwin-arm64.tar.gz"
sha256: "b1640525dfe68f066d56f200bef7bf4dce955a1a893bd061de6754c211431023"
Linux:
x86:
url: "https://go.dev/dl/go1.26.0.linux-386.tar.gz"
sha256: "35e2ec7a7ae6905a1fae5459197b70e3fcbc5e0a786a7d6ba8e49bcd38ad2e26"
x86_64:
url: "https://go.dev/dl/go1.26.0.linux-amd64.tar.gz"
sha256: "aac1b08a0fb0c4e0a7c1555beb7b59180b05dfc5a3d62e40e9de90cd42f88235"
armv8:
url: "https://go.dev/dl/go1.26.0.linux-arm64.tar.gz"
sha256: "bd03b743eb6eb4193ea3c3fd3956546bf0e3ca5b7076c8226334afe6b75704cd"
Windows:
x86:
url: "https://go.dev/dl/go1.26.0.windows-386.zip"
sha256: "50674f3d6a071fa1a4c1d76dc37fafa0330df87d84087a262fee020da5396b6b"
x86_64:
url: "https://go.dev/dl/go1.26.0.windows-amd64.zip"
sha256: "9bbe0fc64236b2b51f6255c05c4232532b8ecc0e6d2e00950bd3021d8a4d07d4"

23
recipes/go/conanfile.py Normal file
View File

@@ -0,0 +1,23 @@
from conan import ConanFile
from conan.tools.layout import basic_layout
from conan.tools.files import get, copy
import os
class Golang(ConanFile):
name = "go"
version = "1.26.0"
settings = "os", "arch"
def layout(self):
basic_layout(self)
def build(self):
get(self, **self.conan_data["sources"][str(self.version)][str(self.settings.os)][str(self.settings.arch)], strip_root=True, destination="go")
def package(self):
copy(self, "*", src=os.path.join(self.build_folder, "go"), dst=self.package_folder)
def package_info(self):
self.cpp_info.bindirs = ["bin"]

View File

@@ -0,0 +1,100 @@
from conan import ConanFile
from conan.tools.layout import basic_layout
from conan.tools.scm import Git
from conan.tools.files import copy, collect_libs
from conan.internal.model.pkg_type import PackageType
from conan.tools.gnu import AutotoolsToolchain, Autotools
from conan.tools.apple import is_apple_os
import os
import shutil
required_conan_version = ">=2.26"
class HevSocks5Tunnel(ConanFile):
name = "hev-socks5-tunnel"
version = "2.14.4"
settings = "os", "arch", "compiler"
options = {
"shared": [True, False],
"as_framework": [True, False],
}
default_options = {
"shared": False,
"as_framework": False
}
def config_options(self):
if not is_apple_os(self):
del self.options.as_framework
def configure(self):
self.settings.rm_safe("compiler.libcxx")
self.settings.rm_safe("compiler.cppstd")
if self.options.get_safe("as_framework"):
self.options.shared = False
def layout(self):
basic_layout(self, build_folder=".")
def source(self):
git = Git(self)
git.clone(
url="https://github.com/heiher/hev-socks5-tunnel.git",
target=".",
args=["--recurse-submodules", "--branch", self.version]
)
def generate(self):
tc = AutotoolsToolchain(self)
tc.generate()
def build(self):
autotools = Autotools(self)
autotools.make("shared" if self.options.shared else "static")
if self.options.get_safe("as_framework"):
lib_path = os.path.join(self.build_folder, "bin", "libhev-socks5-tunnel.a")
self.run(
f"libtool -static -o {lib_path}"
f" {lib_path}"
f" {os.path.join(self.build_folder, "third-part", "lwip", "bin", "liblwip.a")}"
f" {os.path.join(self.build_folder, "third-part", "yaml", "bin", "libyaml.a")}"
f" {os.path.join(self.build_folder, "third-part", "hev-task-system", "bin", "libhev-task-system.a")}"
)
include_dir = os.path.join(self.build_folder, "framework_include")
copy(self, "hev-main.h", src=os.path.join(self.source_folder, "src"), dst=include_dir)
copy(self, "module.modulemap", src=os.path.join(self.source_folder), dst=include_dir)
self.run('xcodebuild -create-xcframework'
f' -library {lib_path}'
f' -headers {include_dir}'
f' -output {os.path.join(self.build_folder, "HevSocks5Tunnel.xcframework")}'
)
def package(self):
if self.options.get_safe("as_framework"):
shutil.copytree(src=os.path.join(self.build_folder, "HevSocks5Tunnel.xcframework"),
dst=os.path.join(self.package_folder, "HevSocks5Tunnel.xcframework"))
else:
copy(self, "hev-main.h", src=os.path.join(self.source_folder, "src"), dst=os.path.join(self.package_folder, "include"))
copy(self, "*.a", src=os.path.join(self.build_folder, "bin"), dst=os.path.join(self.package_folder, "lib"))
copy(self, "*.so", src=os.path.join(self.build_folder, "bin"), dst=os.path.join(self.package_folder, "lib"))
copy(self, "*.a", src=os.path.join(self.build_folder, "bin", "third-part", "lwip"), dst=os.path.join(self.package_folder, "lib"))
copy(self, "*.so", src=os.path.join(self.build_folder, "bin", "third-part", "lwip"), dst=os.path.join(self.package_folder, "lib"))
copy(self, "*.a", src=os.path.join(self.build_folder, "bin", "third-part", "yaml"), dst=os.path.join(self.package_folder, "lib"))
copy(self, "*.so", src=os.path.join(self.build_folder, "bin", "third-part", "yaml"), dst=os.path.join(self.package_folder, "lib"))
copy(self, "*.a", src=os.path.join(self.build_folder, "bin", "third-part", "hev-task-system"), dst=os.path.join(self.package_folder, "lib"))
copy(self, "*.so", src=os.path.join(self.build_folder, "bin", "third-part", "hev-task-system"), dst=os.path.join(self.package_folder, "lib"))
def package_info(self):
self.cpp_info.set_property("cmake_target_name", "heiher::hev-socks5-tunnel")
if self.options.get_safe("as_framework"):
self.cpp_info.type = PackageType.STATIC
self.cpp_info.package_framework = True
self.cpp_info.location = os.path.join(self.package_folder, "HevSocks5Tunnel.xcframework")
else:
self.cpp_info.libraries = collect_libs(self)

View File

@@ -0,0 +1,57 @@
from conan import ConanFile
from conan.tools.layout import basic_layout
from conan.tools.files import get, collect_libs
from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps, AutotoolsDeps
from conan.errors import ConanInvalidConfiguration
from pathlib import Path
class LibcapNg(ConanFile):
name = "libcap-ng"
version = "0.9.2"
settings = "build_type", "compiler", "os", "arch"
options = {
"shared": [True, False]
}
default_options = {
"shared": False
}
def layout(self):
basic_layout(self, src_folder="src")
def validate(self):
if self.settings.os != "Linux":
ConanInvalidConfiguration(f"{self.name} v{self.version} is available only on Linux")
def requirements(self):
self.tool_requires("automake/1.16.5")
self.tool_requires("libtool/2.4.7")
self.tool_requires("pkgconf/2.5.1")
def source(self):
get(self, f"https://github.com/stevegrubb/libcap-ng/archive/refs/tags/v{self.version}.zip",
sha256="9c8847f9732f8ee161faf5bebad44cc6f614a8199f3d8dcb2014290b4acedc18", strip_root=True)
def generate(self):
pkgconf = PkgConfigDeps(self)
pkgconf.generate()
tc = AutotoolsToolchain(self)
tc.configure_args += ["--without-python3", "--disable-cap-audit"]
tc.generate()
deps = AutotoolsDeps(self)
deps.generate()
def build(self):
Path(self.source_folder, "NEWS").touch(exist_ok=True)
autotools = Autotools(self)
autotools.autoreconf()
autotools.configure()
autotools.make()
def package(self):
autotools = Autotools(self)
autotools.install()
def package_info(self):
self.cpp_info.libs = collect_libs(self)

134
recipes/libssh/conanfile.py Normal file
View File

@@ -0,0 +1,134 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
from conan.tools.files import copy, get, rmdir
from conan.tools.microsoft import is_msvc_static_runtime, is_msvc
from conan.tools.scm import Version
import os
required_conan_version = ">=2.21"
class LibSSHRecipe(ConanFile):
name = "libssh"
version = "0.11.3"
user = "amnezia"
license = "LGPL-2.1"
homepage = "https://www.libssh.org/"
description = "multiplatform C library implementing the SSHv2 protocol on client and server side"
topics = ("ssh", "shell", "ssh2", "connection")
package_type = "library"
settings = "os", "compiler", "build_type", "arch"
options = {
"shared": [True, False],
"fPIC": [True, False],
"with_zlib": [True, False],
"crypto_backend": ["openssl", "gcrypt", "mbedtls"],
"with_symbol_versioning": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_zlib": True,
"crypto_backend": "openssl",
"with_symbol_versioning": True,
}
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
del self.options.with_symbol_versioning
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
self.settings.rm_safe("compiler.libcxx")
self.settings.rm_safe("compiler.cppstd")
def layout(self):
cmake_layout(self, src_folder="src")
def requirements(self):
if self.options.with_zlib:
self.requires("zlib/[>=1.2.11 <2]")
if self.options.crypto_backend =="openssl":
self.requires("openssl/[>=1.1 <4]")
elif self.options.crypto_backend == "gcrypt":
self.requires("libgcrypt/[>=1.8.4 <2]")
elif self.options.crypto_backend == "mbedtls":
self.requires("mbedtls/3.6.0")
def validate(self):
if self.options.crypto_backend == "mbedtls" and not self.dependencies["mbedtls"].options.enable_threading:
raise ConanInvalidConfiguration(f"{self.ref} requires '-o mbedtls/*:enable_threading=True' when using '-o libssh/*:crypto_backend=mbedtls'")
def source(self):
get(self, "https://www.libssh.org/files/0.11/libssh-0.11.3.tar.xz",
sha256="7d8a1361bb094ec3f511964e78a5a4dba689b5986e112afabe4f4d0d6c6125c3", strip_root=True
)
def generate(self):
tc = CMakeToolchain(self)
tc.cache_variables["CLIENT_TESTING"] = False
tc.cache_variables["SERVER_TESTING"] = False
tc.cache_variables["WITH_EXAMPLES"] = False
tc.cache_variables["WITH_GCRYPT"] = self.options.crypto_backend == "gcrypt"
tc.cache_variables["WITH_GSSAPI"] = False
tc.cache_variables["WITH_MBEDTLS"] = self.options.crypto_backend == "mbedtls"
tc.cache_variables["WITH_NACL"] = False
tc.cache_variables["WITH_SYMBOL_VERSIONING"] = self.options.get_safe("with_symbol_versioning", True)
tc.variables["WITH_ZLIB"] = self.options.with_zlib
if is_msvc(self):
tc.cache_variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self)
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
tc.cache_variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = str(self.settings.build_type)
if self.settings.os == "Android":
if Version(self.settings.get_safe("os.api_level")) < 24:
tc.cache_variables["HAVE_IFADDRS_H"] = False
tc.cache_variables["HAVE_GLOB_H"] = False
tc.preprocessor_definitions["S_IWRITE"] = "S_IRUSR"
tc.preprocessor_definitions["S_IWRITE"] = "S_IWUSR"
tc.preprocessor_definitions["S_IEXEC"] = "S_IXUSR"
tc.generate()
deps = CMakeDeps(self)
deps.set_property("libgcrypt", "cmake_file_name", "GCrypt")
deps.set_property("libgcrypt", "cmake_additional_variables_prefixes", ["GCRYPT"])
deps.set_property("libgcrypt", "cmake_extra_variables", {"GCRYPT_FOUND": "TRUE"})
deps.set_property("mbedtls", "cmake_additional_variables_prefixes", ["MBEDTLS"])
deps.set_property("mbedtls", "cmake_extra_variables", {"MBEDTLS_FOUND": "TRUE"})
deps.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
cmake = CMake(self)
cmake.install()
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
def package_info(self):
self.cpp_info.libs = ["ssh"]
if not self.options.shared:
self.cpp_info.defines.append("LIBSSH_STATIC=ON")
if self.settings.os == "Windows":
self.cpp_info.system_libs.extend(["ws2_32", "iphlpapi"])
self.cpp_info.set_property("cmake_file_name", "libssh")
# target and alias names defined at:
# ssh https://git.libssh.org/projects/libssh.git/tree/src/CMakeLists.txt?h=libssh-0.10.6#n351
# ssh::ssh https://git.libssh.org/projects/libssh.git/tree/src/CMakeLists.txt?h=libssh-0.10.6#n371
# ssh-static https://git.libssh.org/projects/libssh.git/tree/src/CMakeLists.txt?h=libssh-0.10.6#n413
# ssh::static https://git.libssh.org/projects/libssh.git/tree/src/CMakeLists.txt?h=libssh-0.10.6#n428
self.cpp_info.set_property("cmake_target_name", "ssh::ssh")
self.cpp_info.set_property(
"cmake_target_aliases",
["ssh"] if self.options.shared else ["ssh", "ssh-static", "ssh::static"],
)
# pkg-config defined at https://git.libssh.org/projects/libssh.git/tree/CMakeLists.txt?h=libssh-0.10.6#n124
self.cpp_info.set_property("pkg_config_name", "libssh")

View File

@@ -0,0 +1,3 @@
patches:
"1.0.0":
- patch_file: "patches/0001-fix-cloak-go-build.patch"

View File

@@ -0,0 +1,57 @@
from conan import ConanFile
from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain
from conan.tools.files import copy, apply_conandata_patches, export_conandata_patches
from conan.tools.scm import Git
from conan.errors import ConanInvalidConfiguration
import os
class OpenvpnPtAndroid(ConanFile):
name = "openvpn-pt-android"
version = "1.0.0"
package_type = "shared-library"
settings = "os", "arch", "build_type", "compiler"
def export_sources(self):
export_conandata_patches(self)
def layout(self):
cmake_layout(self, src_folder="src")
def build_requirements(self):
self.tool_requires("swig/4.1.1")
self.tool_requires("go/1.26.0")
self.tool_requires("cmake/[>=3.4.1 <4]")
def validate(self):
if self.settings.os != "Android":
raise ConanInvalidConfiguration(f"{self.name} only supports Android, got {self.settings.os}")
def source(self):
git = Git(self)
git.clone(
url="https://github.com/amnezia-vpn/openvpn-pt-android.git",
target=".",
args=["--recurse-submodules", "--branch", "update-ovpn3"]
)
def generate(self):
tc = CMakeToolchain(self)
tc.generate()
def build(self):
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure()
cmake.build(target=["ck_ovpn_plugin_go", "ovpn3", "ovpnutil", "rsapss"])
def package(self):
copy(self, "*.h", src=self.build_folder, dst=os.path.join(self.package_folder, "include"))
copy(self, "*.so", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"))
def package_info(self):
self.cpp_info.set_property("cmake_target_name", "amnezia::openvpn-pt-android")
self.cpp_info.libs = [ "ovpn3", "ovpnutil", "rsapss" ]
self.cpp_info.set_property("cmake_extra_variables", {
"OPENVPN_PT_ANDROID_LIBCK_OVPN_PLUGIN_PATH": os.path.join(self.package_folder, "lib", "libck-ovpn-plugin.so")
})

View File

@@ -0,0 +1,65 @@
From 5a96e1a9a5116917969afdd7adebfa895ff42617 Mon Sep 17 00:00:00 2001
From: Yaroslav Gurov <ygurov@proton.me>
Date: Mon, 30 Mar 2026 17:38:11 +0200
Subject: [PATCH] fix cloak go build
---
cloak.cmake | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/cloak.cmake b/cloak.cmake
index 8199ebc..d8ef1cb 100644
--- a/cloak.cmake
+++ b/cloak.cmake
@@ -9,36 +9,32 @@ list(APPEND CMAKE_PROGRAM_PATH "/usr/local/go/bin")
find_program(GO_EXEC go)
set(BUILD_CMD_ARGS build)
-list(APPEND BUILD_CMD_ARGS -buildmode=c-shared -o ${CMAKE_CURRENT_BINARY_DIR}/${CLOAK_LIB} ${CMAKE_GO_FLAGS} ./...)
-
-set(PREPARE_ENV_ARGS env)
-list(APPEND PREPARE_ENV_ARGS -w CGO_ENABLED=1 GOOS=android)
-
+list(APPEND BUILD_CMD_ARGS -buildmode=c-shared -v -o ${CMAKE_CURRENT_BINARY_DIR}/${CLOAK_LIB} ./...)
string(REGEX MATCH "[0-9]+$" ANDROID_API_LEVEL ${ANDROID_PLATFORM})
message(WARNING "build cloak plugin abi=${ANDROID_ABI}, ANDROID_API_LEVEL=${ANDROID_API_LEVEL}")
+list(APPEND GO_ENV CGO_ENABLED=1 GOOS=android)
+list(APPEND GO_ENV "CC=${CMAKE_C_COMPILER} --target=${CMAKE_C_COMPILER_TARGET}")
if ("${ANDROID_ABI}" STREQUAL "x86")
- list(APPEND PREPARE_ENV_ARGS GOARCH=386)
- list(APPEND PREPARE_ENV_ARGS CC=${ANDROID_TOOLCHAIN_ROOT}/bin/i686-linux-android${ANDROID_API_LEVEL}-clang)
+ list(APPEND GO_ENV GOARCH=386)
elseif ("${ANDROID_ABI}" STREQUAL "x86_64")
- list(APPEND PREPARE_ENV_ARGS GOARCH=amd64)
- list(APPEND PREPARE_ENV_ARGS CC=${ANDROID_TOOLCHAIN_ROOT}/bin/x86_64-linux-android${ANDROID_API_LEVEL}-clang)
+ list(APPEND GO_ENV GOARCH=amd64)
elseif ("${ANDROID_ABI}" STREQUAL "arm64-v8a")
- list(APPEND PREPARE_ENV_ARGS GOARCH=arm64)
- list(APPEND PREPARE_ENV_ARGS CC=${ANDROID_TOOLCHAIN_ROOT}/bin/aarch64-linux-android${ANDROID_API_LEVEL}-clang)
+ list(APPEND GO_ENV GOARCH=arm64)
elseif ("${ANDROID_ABI}" STREQUAL "armeabi-v7a")
- list(APPEND PREPARE_ENV_ARGS GOARCH=arm)
- list(APPEND PREPARE_ENV_ARGS GOARM=7)
- list(APPEND PREPARE_ENV_ARGS CC=${ANDROID_TOOLCHAIN_ROOT}/bin/armv7a-linux-androideabi${ANDROID_API_LEVEL}-clang)
+ list(APPEND GO_ENV GOARCH=arm)
+ list(APPEND GO_ENV GOARM=7)
endif ()
+string(REPLACE -mthumb -marm GO_C_FLAGS ${CMAKE_C_FLAGS})
+list(APPEND GO_ENV "CGO_CFLAGS=${GO_C_FLAGS}")
+list(APPEND GO_ENV "CGO_LDFLAGS=${GO_C_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CLOAK_LIB}
DEPENDS ${CLOAK_SRCS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cloak/cmd/ck-ovpn-plugin
- COMMAND ${GO_EXEC} ${PREPARE_ENV_ARGS}
- COMMAND ${GO_EXEC} ${BUILD_CMD_ARGS}
+ COMMAND ${CMAKE_COMMAND} -E env ${GO_ENV} ${GO_EXEC} ${BUILD_CMD_ARGS}
COMMENT "Building Go library")
add_custom_target(${TARGET} DEPENDS ${CLOAK_LIB} ${HEADER})
--
2.50.1 (Apple Git-155)

View File

@@ -0,0 +1,107 @@
from conan import ConanFile
from conan.tools.files import get, copy, replace_in_file
from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps
from conan.tools.layout import basic_layout
from conan.tools.cmake import cmake_layout, CMakeToolchain, CMake, CMakeDeps
import os
class Openvpn(ConanFile):
name = "openvpn"
version = "2.7.0"
package_type = "application"
settings = "os", "build_type", "arch", "compiler"
@property
def _is_windows(self):
return str(self.settings.os).startswith("Windows")
def export_sources(self):
copy(self, "*applink.c", src=self.recipe_folder, dst=self.export_sources_folder)
def layout(self):
if self._is_windows:
cmake_layout(self)
else:
basic_layout(self)
def build_requirements(self):
if self._is_windows:
self.tool_requires("cmake/[>=3.14 <4]")
else:
self.tool_requires("libtool/2.4.7")
self.tool_requires("automake/1.16.5")
if self.settings.os == "Linux" or self._is_windows:
self.tool_requires("pkgconf/2.5.1")
def requirements(self):
self.requires("openssl/3.6.1", visible=False)
self.requires("lz4/1.10.0", visible=False)
self.requires("lzo/2.10", visible=False)
if self.settings.os == "Linux":
self.requires("libnl/3.9.0", visible=False)
self.requires("libcap-ng/0.9.2", visible=False)
if self._is_windows:
self.requires("tap-windows6/[*]")
def source(self):
get(self, f"https://github.com/OpenVPN/openvpn/archive/refs/tags/v{self.version}.zip",
sha256="1a65d8587f932c13d55b1f175ff2e1d61d795d9092788662e888054854d4ee3d", strip_root=True
)
def _patch_sources(self):
replace_in_file(self,
os.path.join(self.source_folder, "CMakeLists.txt"),
"/Qspectre",
""
)
def generate(self):
self._patch_sources()
if self.settings.os == "Linux" or self._is_windows:
pkgconf = PkgConfigDeps(self)
pkgconf.generate()
if self._is_windows:
tc = CMakeToolchain(self)
applink_include_path = os.path.join(self.export_sources_folder, "include").replace("\\", "/")
tap_include_path = (self.dependencies["tap-windows6"].cpp_info.aggregated_components().includedirs[0]).replace("\\", "/")
tc.extra_cflags = [ f"-I{tap_include_path}", f"-I{applink_include_path}" ]
tc.extra_cxxflags = [ f"-I{tap_include_path}", f"-I{applink_include_path}" ]
tc.cache_variables["BUILD_TESTING"] = False
tc.cache_variables["ENABLE_PKCS11"] = False
tc.generate()
deps = CMakeDeps(self)
deps.generate()
else:
tc = AutotoolsToolchain(self)
tc.configure_args.extend(["--disable-shared", "--enable-static"])
tc.configure_args.append("--disable-plugins")
tc.generate()
deps = AutotoolsDeps(self)
deps.generate()
def build(self):
if self._is_windows:
cmake = CMake(self)
cmake.configure()
cmake.build()
else:
at = Autotools(self)
at.autoreconf()
at.configure()
at.make()
def package(self):
if self._is_windows:
copy(self, "*openvpn.exe", src=self.build_folder, dst=self.package_folder, keep_path=False)
else:
copy(self, "openvpn", src=os.path.join(self.build_folder, "src", "openvpn"), dst=self.package_folder)
def package_info(self):
self.cpp_info.exe = True
ext = ".exe" if self._is_windows else ""
self.cpp_info.location = os.path.join(self.package_folder, f"openvpn{ext}")

View File

@@ -0,0 +1,151 @@
/*
* Copyright 2004-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#define APPLINK_STDIN 1
#define APPLINK_STDOUT 2
#define APPLINK_STDERR 3
#define APPLINK_FPRINTF 4
#define APPLINK_FGETS 5
#define APPLINK_FREAD 6
#define APPLINK_FWRITE 7
#define APPLINK_FSETMOD 8
#define APPLINK_FEOF 9
#define APPLINK_FCLOSE 10 /* should not be used */
#define APPLINK_FOPEN 11 /* solely for completeness */
#define APPLINK_FSEEK 12
#define APPLINK_FTELL 13
#define APPLINK_FFLUSH 14
#define APPLINK_FERROR 15
#define APPLINK_CLEARERR 16
#define APPLINK_FILENO 17 /* to be used with below */
#define APPLINK_OPEN 18 /* formally can't be used, as flags can vary */
#define APPLINK_READ 19
#define APPLINK_WRITE 20
#define APPLINK_LSEEK 21
#define APPLINK_CLOSE 22
#define APPLINK_MAX 22 /* always same as last macro */
#ifndef APPMACROS_ONLY
/*
* Normally, do not define APPLINK_NO_INCLUDES. Define it if you are using
* symbol preprocessing and do not want the preprocessing to affect the
* following included header files. You will need to put these
* include lines somewhere in the file that is including applink.c.
*/
#ifndef APPLINK_NO_INCLUDES
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#endif
#ifdef __BORLANDC__
/* _lseek in <io.h> is a function-like macro so we can't take its address */
#undef _lseek
#define _lseek lseek
#endif
static void *app_stdin(void)
{
return stdin;
}
static void *app_stdout(void)
{
return stdout;
}
static void *app_stderr(void)
{
return stderr;
}
static int app_feof(FILE *fp)
{
return feof(fp);
}
static int app_ferror(FILE *fp)
{
return ferror(fp);
}
static void app_clearerr(FILE *fp)
{
clearerr(fp);
}
static int app_fileno(FILE *fp)
{
return _fileno(fp);
}
static int app_fsetmod(FILE *fp, char mod)
{
return _setmode(_fileno(fp), mod == 'b' ? _O_BINARY : _O_TEXT);
}
#ifdef __cplusplus
extern "C" {
#endif
__declspec(dllexport) void **
#if defined(__BORLANDC__)
/*
* __stdcall appears to be the only way to get the name
* decoration right with Borland C. Otherwise it works
* purely incidentally, as we pass no parameters.
*/
__stdcall
#else
__cdecl
#endif
OPENSSL_Applink(void)
{
static int once = 1;
static void *OPENSSL_ApplinkTable[APPLINK_MAX + 1] = { (void *)APPLINK_MAX };
if (once) {
OPENSSL_ApplinkTable[APPLINK_STDIN] = app_stdin;
OPENSSL_ApplinkTable[APPLINK_STDOUT] = app_stdout;
OPENSSL_ApplinkTable[APPLINK_STDERR] = app_stderr;
OPENSSL_ApplinkTable[APPLINK_FPRINTF] = fprintf;
OPENSSL_ApplinkTable[APPLINK_FGETS] = fgets;
OPENSSL_ApplinkTable[APPLINK_FREAD] = fread;
OPENSSL_ApplinkTable[APPLINK_FWRITE] = fwrite;
OPENSSL_ApplinkTable[APPLINK_FSETMOD] = app_fsetmod;
OPENSSL_ApplinkTable[APPLINK_FEOF] = app_feof;
OPENSSL_ApplinkTable[APPLINK_FCLOSE] = fclose;
OPENSSL_ApplinkTable[APPLINK_FOPEN] = fopen;
OPENSSL_ApplinkTable[APPLINK_FSEEK] = fseek;
OPENSSL_ApplinkTable[APPLINK_FTELL] = ftell;
OPENSSL_ApplinkTable[APPLINK_FFLUSH] = fflush;
OPENSSL_ApplinkTable[APPLINK_FERROR] = app_ferror;
OPENSSL_ApplinkTable[APPLINK_CLEARERR] = app_clearerr;
OPENSSL_ApplinkTable[APPLINK_FILENO] = app_fileno;
OPENSSL_ApplinkTable[APPLINK_OPEN] = _open;
OPENSSL_ApplinkTable[APPLINK_READ] = _read;
OPENSSL_ApplinkTable[APPLINK_WRITE] = _write;
OPENSSL_ApplinkTable[APPLINK_LSEEK] = _lseek;
OPENSSL_ApplinkTable[APPLINK_CLOSE] = _close;
once = 0;
}
return OPENSSL_ApplinkTable;
}
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,72 @@
from conan import ConanFile
from conan.tools.layout import basic_layout
from conan.tools.apple import is_apple_os
from conan.errors import ConanInvalidConfiguration
from conan.tools.scm import Git
from conan.internal.model.pkg_type import PackageType
from conan.tools.files import chdir
import os
import shutil
class OpenVPNAdapter(ConanFile):
name = "openvpnadapter"
version = "1.0.0"
settings = "os", "build_type"
@property
def _sdk(self):
return str(self.settings.get_safe("os.sdk", "macosx"))
@property
def _platform(self):
return {
"macosx": "macOS",
"iphoneos": "iOS",
"iphonesimulator": "iOS Simulator"
}.get(self._sdk)
@property
def _configuration(self):
return "Debug" if self.settings.get_safe("build_type") == "Debug" else "Release"
def layout(self):
basic_layout(self)
def validate(self):
if not is_apple_os(self):
raise ConanInvalidConfiguration(
f"There is absolutely no point building Apple framework for {self.settings.os}"
)
def source(self):
git = Git(self)
git.clone(
url="https://github.com/amnezia-vpn/OpenVPNAdapter.git",
target=".",
args=["--recurse-submodules", "--branch", "master-amnezia"]
)
def build(self):
with chdir(self, self.source_folder):
self.run("xcrun xcodebuild"
" -project OpenVPNAdapter.xcodeproj"
" -scheme OpenVPNAdapter"
" -configuration Release"
f" -destination 'generic/platform={self._platform}'"
f" -sdk {self._sdk}"
f' "CONFIGURATION_BUILD_DIR={self.build_folder}"'
f' "BUILT_PRODUCTS_DIR={self.build_folder}"'
" BUILD_LIBRARY_FOR_DISTRIBUTION=YES"
" CODE_SIGNING_ALLOWED=NO"
)
def package(self):
shutil.copytree(os.path.join(self.build_folder, "OpenVPNAdapter.framework"),
os.path.join(self.package_folder, "OpenVPNAdapter.framework"))
def package_info(self):
self.cpp_info.set_property("cmake_target_name", "amnezia::openvpnadapter")
self.cpp_info.type = PackageType.STATIC
self.cpp_info.package_framework = True
self.cpp_info.location = os.path.join(self.package_folder, "OpenVPNAdapter.framework")

View File

@@ -0,0 +1,47 @@
from conan import ConanFile
from conan.tools.layout import basic_layout
from conan.errors import ConanInvalidConfiguration
from conan.tools.files import get, copy
import os
class TapWindows6(ConanFile):
name = "tap-windows6"
version = "9.27.0"
settings = "os", "arch"
@property
def _arch(self):
return {
"x86": "i386",
"x86_64": "amd64",
"armv8": "arm64"
}.get(str(self.settings.arch))
def layout(self):
basic_layout(self)
def validate(self):
if not str(self.settings.os).startswith("Windows"):
raise ConanInvalidConfiguration(
f"{self.name} v{self.version} does only support Windows"
)
if not self._arch:
raise ConanInvalidConfiguration(
f"{self.name} v{self.version} does not support {self.settings.arch}"
)
def source(self):
get(self, f"https://github.com/OpenVPN/tap-windows6/releases/download/{self.version}/dist.win10.zip",
sha256="36e2609b7ceefedcb978ce5c48caf9e0e5af83423717c4e2e3c1d7ebca8f62a5", strip_root=True)
def package(self):
copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include"))
copy(self, "*", src=os.path.join(self.source_folder, self._arch), dst=os.path.join(self.package_folder, "bin"))
def package_info(self):
self.cpp_info.set_property("cmake_target_name", "openvpn::tap-windows6")
self.cpp_info.set_property("cmake_extra_variables", {
"TAP_WINDOWS6_BIN": os.path.join(self.package_folder, "bin").replace("\\", "/")
})

View File

@@ -0,0 +1,90 @@
from conan import ConanFile
from conan.tools.layout import basic_layout
from conan.tools.files import get, copy, chdir
from conan.errors import ConanInvalidConfiguration
from conan.tools.gnu import Autotools, AutotoolsToolchain
from conan.tools.env import Environment
import os
class Tun2Socks(ConanFile):
name = "tun2socks"
version = "2.6.0"
package_type = "application"
settings = "os", "arch"
@property
def _goos(self):
return {
"Linux": "linux",
"Macos": "darwin",
"Windows": "windows"
}.get(str(self.settings.os))
@property
def _goarch(self):
return {
"x86": "386",
"x86_64": "amd64",
"armv8": "arm64"
}.get(str(self.settings.arch))
@property
def _is_windows(self):
return str(self.settings.get_safe("os")).startswith("Windows")
@property
def _ext(self):
return ".exe" if self._is_windows else ""
def layout(self):
basic_layout(self)
def validate(self):
if not self._goos or not self._goarch:
raise ConanInvalidConfiguration(
f"{self.name} v{self.version} does not support {self.settings.os} {self.settings.arch}"
)
def build_requirements(self):
self.tool_requires("go/1.26.0")
if self._is_windows:
self.win_bash = True
if not self.conf.get("tools.microsoft.bash:path", check_type=str):
self.tool_requires("msys2/cci.latest")
self.tool_requires("mingw-builds/15.1.0")
def requirements(self):
if self._is_windows:
self.requires("wintun/[*]")
def source(self):
get(self, f"https://github.com/xjasonlyu/tun2socks/archive/refs/tags/v{self.version}.zip",
sha256="a7ef9cec1c30dfe9971af89a8aac767fd3d2a4df833e92b635642c2f0204c701", strip_root=True
)
def generate(self):
tc = AutotoolsToolchain(self)
env = tc.environment()
env.define("LDFLAGS", "")
env.define("CGO_LDFLAGS", tc.ldflags)
env.define("CGO_CFLAGS", tc.cflags)
env.define("GOOS", self._goos)
env.define("GOARCH", self._goarch)
tc.generate(env)
def build(self):
with chdir(self, self.source_folder):
at = Autotools(self)
at.make("tun2socks")
def package(self):
copy(self, "tun2socks", src=self.build_folder, dst=self.package_folder)
if self._is_windows:
with chdir(self, self.package_folder):
os.rename(src="tun2socks", dst="tun2socks.exe")
def package_info(self):
self.cpp_info.exe = True
self.cpp_info.location = os.path.join(self.package_folder, f"tun2socks{self._ext}")
self.cpp_info.set_property("cmake_target_name", "xjasonlyu::tun2socks")

View File

@@ -0,0 +1,29 @@
from conan import ConanFile
from conan.tools.layout import basic_layout
from conan.tools.files import download, copy
import os
class V2rayRulesDat(ConanFile):
name = "v2ray-rules-dat"
version = "202603162227"
def layout(self):
basic_layout(self, build_folder=".")
def source(self):
# TODO(ygurov): build from source instead of plain copying
download(self, filename="geoip.dat", url=f"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/{self.version}/geoip.dat",
sha256="e48b925d985d7bf33cfee76f309241af0f1779699963b69363dec2c4740041d1")
download(self, filename="geosite.dat", url=f"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/{self.version}/geosite.dat",
sha256="a2f83e25b8be3f089cfdd9423fc7b6eda5a0d4060919917902711d65acac1e0c")
def package(self):
copy(self, "*.dat", src=self.build_folder, dst=self.package_folder)
def package_info(self):
self.cpp_info.set_property("cmake_target_name", "Loyalsoldier::v2ray-rules-dat")
self.cpp_info.set_property("cmake_extra_variables", {
"GEOSITE_DAT_PATH": os.path.join(self.package_folder, "geosite.dat").replace("\\", "/"),
"GEOIP_DAT_PATH": os.path.join(self.package_folder, "geoip.dat").replace("\\", "/")
})

View File

@@ -0,0 +1,53 @@
from conan import ConanFile
from conan.tools.layout import basic_layout
from conan.tools.files import download, copy
from conan.errors import ConanInvalidConfiguration
import os
class WinSplitTunnel(ConanFile):
name = "win-split-tunnel"
version = "1.2.5.0"
settings = "os", "arch"
@property
def _arch(self):
return {
"x86_64": "x86_64",
"armv8": "aarch64"
}.get(str(self.settings.arch))
@property
def _target(self):
return f"{self._arch}-pc-windows-msvc"
def layout(self):
basic_layout(self)
def validate(self):
if not str(self.settings.os).startswith("Windows"):
raise ConanInvalidConfiguration(
f"{self.name} v{self.version} supports only Windows"
)
def build(self):
url = f"https://raw.githubusercontent.com/mullvad/mullvadvpn-app-binaries/ff0e3746c89a04314377cffeb52faaa976413a69/{self._target}/split-tunnel"
files = [
("mullvad-split-tunnel.cat", "9bbd10b95a2cf2226b266a52077300c280f7782def69ebbeb892bb60505d9a5f"),
("mullvad-split-tunnel.inf", "4ec3c2bdefc2a1df9e4e19cd4301b5774624ea07e61add588067b16f8925f5d7"),
("mullvad-split-tunnel.pdb", "ee0e246b18a3bfecfc27104b40f9492ffd2b735582870fbd572f93d55e8e9eaa"),
("mullvad-split-tunnel.sys", "4056b22d08115c1a83bc2cafa17de0bb17db3705eac382de77fd7935eeff7edb"),
]
for name, sha256 in files:
download(self, f"{url}/{name}", os.path.join("prebuilt", name), sha256=sha256)
def package(self):
copy(self, "*", src="prebuilt", dst=os.path.join(self.package_folder, "bin"))
def package_info(self):
self.cpp_info.set_property("cmake_target_name", "mullvad::win-split-tunnel")
self.cpp_info.set_property("cmake_extra_variables", {
"WIN_SPLIT_TUNNEL_BIN": os.path.join(self.package_folder, "bin").replace("\\", "/")
})

View File

@@ -0,0 +1,45 @@
from conan import ConanFile
from conan.tools.layout import basic_layout
from conan.tools.files import get, copy
from conan.errors import ConanInvalidConfiguration
import os
class PackageConan(ConanFile):
name = "wintun"
version = "0.14.1"
settings = "os", "arch"
@property
def _arch(self):
return {
"x86_64": "amd64",
"armv8": "arm64",
"x86": "x86"
}.get(str(self.settings.arch))
def layout(self):
basic_layout(self)
def validate(self):
if not str(self.settings.os).startswith("Windows"):
raise ConanInvalidConfiguration(
f"{self.name} v{self.version} is supposed to be run on Windows only"
)
if not self._arch:
raise ConanInvalidConfiguration(
f"{self.name} v{self.version} does not support {self.settings.arch}"
)
def source(self):
get(self, f"https://www.wintun.net/builds/wintun-{self.version}.zip",
sha256="07c256185d6ee3652e09fa55c0b673e2624b565e02c4b9091c79ca7d2f24ef51", strip_root=True)
def package(self):
copy(self, "wintun.dll", src=os.path.join(self.source_folder, "bin", self._arch), dst=os.path.join(self.package_folder, "bin"))
def package_info(self):
self.cpp_info.exe = True
self.cpp_info.location = os.path.join(self.package_folder, "bin", "wintun.dll")
self.cpp_info.set_property("cmake_target_name", "zx2c4::wintun")