diff mbox series

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

Message ID 66abc6eeaeab68a209c54740678b64f1d96ecd87.1622687706.git.nandre@riseup.net
State New
Headers show
Series [bug#42380,v4,1/9] gnu: Add go-torproject-org-ptlib. | expand

Commit Message

André Batista June 3, 2021, 3:17 a.m. UTC
* gnu/packages/tor.scm (obfs4): New variable.
* Alphabetically order module imports.
diff mbox series

Patch

diff --git a/gnu/packages/tor.scm b/gnu/packages/tor.scm
index bd11dd3a75..52d78cba79 100644
--- a/gnu/packages/tor.scm
+++ b/gnu/packages/tor.scm
@@ -9,7 +9,7 @@ 
 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
-;;; Copyright © 2020 André Batista <nandre@riseup.net>
+;;; Copyright © 2020, 2021 André Batista <nandre@riseup.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -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)
@@ -423,3 +426,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+)))