diff mbox series

[bug#42380,8/9] gnu: obfs4

Message ID 20200915151525.GH13296@andel
State New
Headers show
Series gnu: Add torbrowser-unbundle. | expand

Commit Message

André Batista Sept. 15, 2020, 3:15 p.m. UTC
From 6e228ba965d65963456f3232cb8bd7fcc25bf822 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Batista?= <nandre@riseup.net>
Date: Mon, 14 Sep 2020 19:05:45 -0300
Subject: [PATCH] gnu: Add obfs4.
To: 42380@debbugs.gnu.org

* gnu/packages/tor.scm (obfs4): New variable.
* Alphabetically order module imports.
---
 gnu/packages/tor.scm | 80 ++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 77 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/tor.scm b/gnu/packages/tor.scm
index c852c54a5b..dd362d3af8 100644
--- a/gnu/packages/tor.scm
+++ b/gnu/packages/tor.scm
@@ -33,13 +33,16 @@ 
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system go)
   #:use-module (guix build-system python)
   #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
-  #:use-module (gnu packages libevent)
-  #:use-module (gnu packages linux)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages golang)
+  #:use-module (gnu packages libevent)
+  #:use-module (gnu packages linux)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
@@ -47,7 +50,6 @@ 
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
-  #:use-module (gnu packages autotools)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages w3m))
 
@@ -324,3 +326,75 @@  statistics and status reports on:
 
 Potential client and exit connections are scrubbed of sensitive information.")
     (license license:gpl3+)))
+
+(define-public obfs4
+  (package
+   (name "obfs4")
+   (version "0.0.11")
+   (source
+    (origin
+     (method git-fetch)
+     (uri (git-reference
+           (url "https://git.torproject.org/pluggable-transports/obfs4.git")
+           (commit (string-append "obfs4proxy-" version))))
+     (file-name (git-file-name name version))
+     (sha256
+      (base32
+       "1y2kjwrk64l1h8b87m4iqsanib5rn68gzkdri1vd132qrlypycjn"))))
+   (build-system go-build-system)
+   (arguments
+    '(#:import-path "git.torproject.org/pluggable-transports/obfs4.git"
+      #:tests? #f ;; No test files
+      #:phases
+      (modify-phases %standard-phases
+        (replace 'build
+          (lambda* (#:key outputs configure-flags #:allow-other-keys)
+            (let ((out (assoc-ref outputs "out")))
+              (copy-recursively
+               "src/git.torproject.org/pluggable-transports/obfs4.git"
+               "src/gitlab.com/yawning/obfs4.git"
+               #:log (%make-void-port "w"))
+              (with-directory-excursion
+               "src/git.torproject.org/pluggable-transports/obfs4.git/obfs4proxy"
+               (invoke "go" "build" "-ldflags" "-s"))
+            #t)))
+        (replace 'install
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let* ((out (assoc-ref outputs "out"))
+                   (src "src/git.torproject.org/pluggable-transports/obfs4.git")
+                   (bin (string-append out "/bin"))
+                   (share (string-append out "/share"))
+                   (doc (string-append share "/doc"))
+                   (man (string-append share "/man/man1")))
+              (mkdir-p man)
+              (mkdir bin)
+              (mkdir doc)
+              (with-directory-excursion
+               (string-append src "/obfs4proxy")
+               (copy-file "obfs4proxy"
+                          (string-append bin "/obfs4proxy")))
+              (with-directory-excursion
+               (string-append src "/doc")
+               (copy-file "obfs4proxy.1"
+                          (string-append man "/obfs4proxy.1"))
+               (copy-file "obfs4-spec.txt"
+                          (string-append doc "/obfs4-spec.txt")))
+            #t))))))
+   (propagated-inputs
+    `(("go-torproject-org-ptlib" ,go-torproject-org-ptlib)
+      ("go-github-com-agl-ed25519" ,go-github-com-agl-ed25519)
+      ("go-github-com-dchest-siphash" ,go-github-com-dchest-siphash)
+      ("go-github-com-dchest-uniuri" ,go-github-com-dchest-uniuri)
+      ("go-github-com-dsnet-compress" ,go-github-com-dsnet-compress)
+      ("go-schwanenlied-me-yawning-bsaes" ,go-schwanenlied-me-yawning-bsaes)
+      ("go-gitlab-com-yawning-utls" ,go-gitlab-com-yawning-utls)
+      ("go-golang-org-x-net" ,go-golang-org-x-net)
+      ("go-golang-org-x-crypto" ,go-golang-org-x-crypto)
+      ("go-golang-org-x-text" ,go-golang-org-x-text)))
+   (home-page "https://git.torproject.org/pluggable-transports/obfs4.git")
+   (synopsis "Obfs4 implements an obfuscation protocol")
+   (description "This is a look-like nothing obfuscation protocol that
+incorporates ideas and concepts from Philipp Winter's ScrambleSuit protocol.
+The obfs naming was chosen primarily because it was shorter, in terms of
+protocol ancestery obfs4 is much closer to ScrambleSuit than obfs2/obfs3.")
+   (license license:gpl3+)))