Unverified Commit 8e468f55 authored by Arne Keller's avatar Arne Keller Committed by GitHub
Browse files

geph -> geph5 : 4.99.16 -> 0.2.61 (#398813)

parents 43703b05 c8955ea9
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -15720,6 +15720,16 @@
    name = "John McParland";
    keys = [ { fingerprint = "39D2 171D D733 C718 DD21  285E B326 E14B 05D8 7A4E"; } ];
  };
  MCSeekeri = {
    email = "mcseekeri@outlook.com";
    github = "mcseekeri";
    githubId = 20928094;
    name = "MCSeekeri";
    keys = [
      { fingerprint = "5922 79AB D9D6 85EB 9D16  754C ECDC AD89 5A38 4A12"; }
      { fingerprint = "0762 A387 F160 76F1 116C  BF13 3276 6666 6666 6666"; }
    ];
  };
  McSinyx = {
    email = "cnx@loang.net";
    github = "McSinyx";
+0 −142
Original line number Diff line number Diff line
{
  lib,
  stdenvNoCC,
  rustPlatform,
  fetchFromGitHub,
  buildGoModule,
  makeWrapper,
  nodejs,
  pnpm,
  esbuild,
  perl,
  pkg-config,
  glib,
  webkitgtk_4_0,
  libayatana-appindicator,
  cairo,
  openssl,
}:

let
  version = "4.99.16";
  geph-meta = with lib; {
    description = "Modular Internet censorship circumvention system designed specifically to deal with national filtering";
    homepage = "https://geph.io";
    platforms = platforms.linux;
    maintainers = with maintainers; [ penalty1083 ];
  };
in
{
  cli = rustPlatform.buildRustPackage rec {
    pname = "geph4-client";
    inherit version;

    src = fetchFromGitHub {
      owner = "geph-official";
      repo = pname;
      rev = "v${version}";
      hash = "sha256-6YWPsSRIZpvVCIGZ1z7srobDvVzLr0o2jBcB/7kbK7I=";
    };

    useFetchCargoVendor = true;
    cargoHash = "sha256-igIYTlI3hqvlOTgdwouA9YussP9h0pOHUUTCjA2LE5U=";

    nativeBuildInputs = [ perl ];

    meta = geph-meta // {
      license = with lib.licenses; [ gpl3Only ];
    };
  };

  gui = stdenvNoCC.mkDerivation (finalAttrs: {
    pname = "geph-gui";
    inherit version;

    src = fetchFromGitHub {
      owner = "geph-official";
      repo = "gephgui-pkg";
      rev = "9f0d5c689c2cae67a4750a68295676f449724a98";
      hash = "sha256-/aHd1EDrFp1kXen5xRCCl8LVlMVH0pY8buILZri81II=";
      fetchSubmodules = true;
    };

    gephgui-wry = rustPlatform.buildRustPackage {
      pname = "gephgui-wry";
      inherit (finalAttrs) version src;

      sourceRoot = "${finalAttrs.src.name}/gephgui-wry";

      useFetchCargoVendor = true;
      cargoHash = "sha256-pCj4SulUVEC4QTPBrPQBn5xJ+sHPs6KfjsdVRcsRapY=";

      pnpmDeps = pnpm.fetchDeps {
        inherit (finalAttrs) pname version src;
        sourceRoot = "${finalAttrs.src.name}/gephgui-wry/gephgui";
        hash = "sha256-0MGlsLEgugQ1wEz07ROIwkanTa8PSKwIaxNahyS1014=";
      };

      nativeBuildInputs = [
        pkg-config
        pnpm.configHook
        makeWrapper
        nodejs
      ];

      buildInputs = [
        glib
        webkitgtk_4_0
        libayatana-appindicator
        cairo
        openssl
      ];

      ESBUILD_BINARY_PATH = "${lib.getExe (
        esbuild.override {
          buildGoModule =
            args:
            buildGoModule (
              args
              // rec {
                version = "0.15.10";
                src = fetchFromGitHub {
                  owner = "evanw";
                  repo = "esbuild";
                  rev = "v${version}";
                  hash = "sha256-DebmLtgPrla+1UcvOHMnWmxa/ZqrugeRRKXIiJ9LYDk=";
                };
                vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
              }
            );
        }
      )}";

      pnpmRoot = "gephgui";

      preBuild = ''
        pushd gephgui
        pnpm build
        popd
      '';
    };

    dontBuild = true;

    installPhase = ''
      install -Dt $out/bin ${finalAttrs.gephgui-wry}/bin/gephgui-wry
      install -d $out/share/icons/hicolor
      for i in '16' '32' '64' '128' '256'
      do
        name=''${i}x''${i}
        dir=$out/share/icons/hicolor
        mkdir -p $dir
        mv flatpak/icons/$name $dir
      done
      install -Dt $out/share/applications flatpak/icons/io.geph.GephGui.desktop
      sed -i -e '/StartupWMClass/s/=.*/=gephgui-wry/' $out/share/applications/io.geph.GephGui.desktop
    '';

    meta = geph-meta // {
      license = with lib.licenses; [ unfree ];
    };
  });
}
+115 −0
Original line number Diff line number Diff line
{
  lib,
  rustPlatform,
  fetchFromGitHub,
  pkg-config,
  libxkbcommon,
  openssl,
  rust-jemalloc-sys-unprefixed,
  sqlite,
  vulkan-loader,
  wayland,
  iproute2,
  iptables,
  libglvnd,
  copyDesktopItems,
  makeDesktopItem,
}:
let
  binPath = lib.makeBinPath [
    iproute2
    iptables
  ];
in
rustPlatform.buildRustPackage (finalAttrs: {
  pname = "geph5";
  version = "0.2.61";

  src = fetchFromGitHub {
    owner = "geph-official";
    repo = "geph5";
    rev = "geph5-client-v${finalAttrs.version}";
    hash = "sha256-qy1E5x5Fn+xwS5st6HkMrJu9nksXQQIyJf97FvNOKO4=";
  };

  cargoHash = "sha256-r97DsSsqp/KtgqtYQe92nz2qaOBcJF6w9ckfxpk8Cxg=";

  patches = [ ./test-fix.patch ];

  postPatch = ''
    substituteInPlace binaries/geph5-client/src/vpn/*.sh \
      --replace-fail 'PATH=' 'PATH=${binPath}:'
  '';

  nativeBuildInputs = [
    pkg-config
    copyDesktopItems
  ];

  buildInputs = [
    openssl
    rust-jemalloc-sys-unprefixed
    sqlite
  ];

  env = {
    OPENSSL_NO_VENDOR = true;
    LIBSQLITE3_SYS_USE_PKG_CONFIG = "1";
  };

  buildFeatures = [
    "aws_lambda"
    "windivert"
  ];

  checkFlags = [
    # Wrong test
    "--skip=traffcount::tests::test_traffic_cleanup"
    "--skip=traffcount::tests::test_traffic_count_basic"
    # Requires network
    "--skip=dns::tests::resolve_google"
    # Never finish
    "--skip=tests::test_blind_sign"
    "--skip=tests::test_generate_secret_key"
  ];

  desktopItems = [
    (makeDesktopItem {
      name = "Geph5";
      desktopName = "Geph5";
      icon = "geph5";
      exec = "geph5-client-gui";
      categories = [ "Network" ];
      comment = "Modular Internet censorship circumvention system designed specifically to deal with national filtering";
    })
  ];

  postInstall = ''
    install -m 444 -D binaries/geph5-client-gui/icon.png $out/share/icons/hicolor/512x512/apps/geph5.png
  '';

  postFixup = ''
    # Add required but not explicitly requested libraries
    patchelf --add-rpath '${
      lib.makeLibraryPath [
        wayland
        libxkbcommon
        vulkan-loader
        libglvnd
      ]
    }' "$out/bin/geph5-client-gui"
  '';

  meta = {
    description = "Modular Internet censorship circumvention system designed specifically to deal with national filtering";
    homepage = "https://github.com/geph-official/geph5";
    changelog = "https://github.com/geph-official/geph5/releases/tag/geph5-client-v${finalAttrs.version}";
    mainProgram = "geph5-client";
    platforms = lib.platforms.unix;
    license = lib.licenses.mpl20;
    maintainers = with lib.maintainers; [
      penalty1083
      MCSeekeri
    ];
  };
})
+27 −0
Original line number Diff line number Diff line
diff --git a/binaries/geph5-client/src/traffcount.rs b/binaries/geph5-client/src/traffcount.rs
index 5c91a27..61c0b3b 100644
--- a/binaries/geph5-client/src/traffcount.rs
+++ b/binaries/geph5-client/src/traffcount.rs
@@ -28,14 +28,14 @@ impl TraffCount {
     }
 
     // /// Create a new traffic counter with custom history length
-    // pub fn with_history(max_seconds: usize) -> Self {
-    //     let now = Instant::now();
-    //     Self {
-    //         bins: VecDeque::with_capacity(max_seconds),
-    //         window_start: now,
-    //         max_history_seconds: max_seconds,
-    //     }
-    // }
+    pub fn with_history(max_seconds: usize) -> Self {
+        let now = Instant::now();
+        Self {
+            bins: VecDeque::with_capacity(max_seconds),
+            window_start: now,
+            max_history_seconds: max_seconds,
+        }
+    }
 
     /// Increment the traffic count with the given number of bytes
     pub fn incr(&mut self, bytes: f64) {
+0 −2
Original line number Diff line number Diff line
@@ -8138,8 +8138,6 @@ with pkgs;
  gecode_6 = qt5.callPackage ../development/libraries/gecode { };
  gecode = gecode_6;
  geph = recurseIntoAttrs (callPackages ../applications/networking/geph { pnpm = pnpm_8; });
  gegl = callPackage ../development/libraries/gegl {
    openexr = openexr_2;
  };