2023-02-02 18:25:31 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2023-05-24 13:37:59 +00:00
|
|
|
, fetchpatch
|
|
|
|
, cmake
|
2023-02-02 18:25:31 +00:00
|
|
|
, makeWrapper
|
|
|
|
, iptables
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "udp2raw";
|
2023-02-09 11:40:11 +00:00
|
|
|
version = "20230206.0";
|
2023-02-02 18:25:31 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "wangyu-";
|
|
|
|
repo = "udp2raw";
|
|
|
|
rev = version;
|
2023-02-09 11:40:11 +00:00
|
|
|
hash = "sha256-mchSaqw6sOJ7+dydCM8juP7QMOVUrPL4MFA79Rvyjdo=";
|
2023-02-02 18:25:31 +00:00
|
|
|
};
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
patches = [
|
|
|
|
# Add install target to CMakeLists.txt
|
|
|
|
# https://github.com/wangyu-/udp2raw/pull/469
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/wangyu-/udp2raw/commit/4559e6d47bb69fda0fbd3fb4b7d04ddb1cf5e2ae.patch";
|
|
|
|
hash = "sha256-2csZdXmMW89tjXhN5QIK0rnMSXlFjLvwGnmieeKRX90=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
echo 'const char *gitversion = "${version}";' > git_version.h
|
2023-07-15 17:15:38 +00:00
|
|
|
# Adress sanitization crashes the application, reported upstream at https://github.com/wangyu-/udp2raw/issues/474
|
|
|
|
substituteInPlace CMakeLists.txt --replace "sanitize=address," "sanitize="
|
2023-05-24 13:37:59 +00:00
|
|
|
'';
|
2023-02-02 18:25:31 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
makeWrapper
|
|
|
|
];
|
2023-02-02 18:25:31 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
postInstall = ''
|
|
|
|
wrapProgram "$out/bin/udp2raw" --prefix PATH : "${lib.makeBinPath [ iptables ]}"
|
2023-02-02 18:25:31 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/wangyu-/udp2raw";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Tunnel which turns UDP traffic into encrypted UDP/FakeTCP/ICMP traffic by using a raw socket";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "udp2raw";
|
2023-02-02 18:25:31 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
changelog = "https://github.com/wangyu-/udp2raw/releases/tag/${version}";
|
|
|
|
maintainers = with maintainers; [ chvp ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|