diff mbox series

[bug#48729,v3,09/47] gnu: Add go-github-com-operatorfoundation-obfs4.

Message ID 20210608230240.17542-9-rg@raghavgururajan.name
State New
Headers show
Series : Bitmask VPN | expand

Commit Message

Raghav Gururajan June 8, 2021, 11:02 p.m. UTC
* gnu/packages/golang.scm (go-github-com-operatorfoundation-obfs4): New variable.
---
 gnu/packages/golang.scm | 151 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 151 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 2539863770..e2d5dfc4e4 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -69,6 +69,157 @@ 
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1))
 
+(define-public go-github-com-operatorfoundation-obfs4
+  (package
+    (name "go-github-com-operatorfoundation-obfs4")
+    (version "1.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/OperatorFoundation/obfs4")
+         (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0s730xagdxs66wfh65hb5v9a5h01q5ncic3pyij0a043scagizgr"))))
+    (build-system go-build-system)
+    (arguments
+     `(#:unpack-path "github.com/OperatorFoundation/obfs4"
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-source
+           (lambda _
+             (substitute* (find-files "." "\\.go$")
+               ;; Drop '.git' suffix in import path of goptlib.
+               (("goptlib\\.git") "goptlib"))
+             #t))
+         (replace 'build
+           (lambda* (#:key source system outputs search-paths build-flags unpack-path inputs #:allow-other-keys)
+             (for-each
+              (lambda (directory)
+                ((assoc-ref %standard-phases 'build)
+                 #:source source
+                 #:system system
+                 #:outputs outputs
+                 #:search-paths search-paths
+                 #:build-flags build-flags
+                 #:unpack-path unpack-path
+                 #:inputs inputs
+                 #:import-path directory))
+              (list
+               "github.com/OperatorFoundation/obfs4/common/csrand"
+               "github.com/OperatorFoundation/obfs4/common/drbg"
+               "github.com/OperatorFoundation/obfs4/common/log"
+               "github.com/OperatorFoundation/obfs4/common/ntor"
+               "github.com/OperatorFoundation/obfs4/common/probdist"
+               "github.com/OperatorFoundation/obfs4/common/pt_extras"
+               "github.com/OperatorFoundation/obfs4/common/replayfilter"
+               "github.com/OperatorFoundation/obfs4/common/socks5"
+               "github.com/OperatorFoundation/obfs4/common/termmon"
+               "github.com/OperatorFoundation/obfs4/common/uniformdh"
+               "github.com/OperatorFoundation/obfs4/modes/pt_socks5"
+               "github.com/OperatorFoundation/obfs4/modes/stun_udp"
+               "github.com/OperatorFoundation/obfs4/modes/transparent_tcp"
+               "github.com/OperatorFoundation/obfs4/modes/transparent_udp"
+               "github.com/OperatorFoundation/obfs4/obfs4proxy"
+               "github.com/OperatorFoundation/obfs4/proxy_dialers/proxy_http"
+               "github.com/OperatorFoundation/obfs4/proxy_dialers/proxy_socks4"
+               "github.com/OperatorFoundation/obfs4/transports"))
+             #t))
+         (replace 'check
+           (lambda* (#:key source system outputs search-paths tests? unpack-path inputs #:allow-other-keys)
+             (for-each
+              (lambda (directory)
+                ((assoc-ref %standard-phases 'check)
+                 #:source source
+                 #:system system
+                 #:outputs outputs
+                 #:search-paths search-paths
+                 #:tests? tests?
+                 #:unpack-path unpack-path
+                 #:inputs inputs
+                 #:import-path directory))
+              (list
+               "github.com/OperatorFoundation/obfs4/common/csrand"
+               "github.com/OperatorFoundation/obfs4/common/drbg"
+               "github.com/OperatorFoundation/obfs4/common/log"
+               "github.com/OperatorFoundation/obfs4/common/ntor"
+               "github.com/OperatorFoundation/obfs4/common/probdist"
+               "github.com/OperatorFoundation/obfs4/common/pt_extras"
+               "github.com/OperatorFoundation/obfs4/common/replayfilter"
+               "github.com/OperatorFoundation/obfs4/common/socks5"
+               "github.com/OperatorFoundation/obfs4/common/termmon"
+               "github.com/OperatorFoundation/obfs4/common/uniformdh"
+               ;; ERROR: Println arg dialFn is a func value, not called.
+               ;;"github.com/OperatorFoundation/obfs4/modes/pt_socks5"
+               ;; ERROR: Infof format %s has arg ln of wrong type *net.UDPConn.
+               ;;"github.com/OperatorFoundation/obfs4/modes/stun_udp"
+               "github.com/OperatorFoundation/obfs4/modes/transparent_tcp"
+               ;; ERROR: Infof format %s has arg ln of wrong type *net.UDPConn
+               ;;"github.com/OperatorFoundation/obfs4/modes/transparent_udp"
+               ;; ERROR: Println call has possible formatting directive %s.
+               ;;"github.com/OperatorFoundation/obfs4/obfs4proxy"
+               "github.com/OperatorFoundation/obfs4/proxy_dialers/proxy_http"
+               "github.com/OperatorFoundation/obfs4/proxy_dialers/proxy_socks4"
+               "github.com/OperatorFoundation/obfs4/transports"))
+             #t))
+         (replace 'install
+           (lambda* (#:key source system outputs search-paths install-source? unpack-path inputs #:allow-other-keys)
+             (for-each
+              (lambda (directory)
+                ((assoc-ref %standard-phases 'install)
+                 #:source source
+                 #:system system
+                 #:outputs outputs
+                 #:search-paths search-paths
+                 #:install-source? install-source?
+                 #:unpack-path unpack-path
+                 #:inputs inputs
+                 #:import-path directory))
+              (list
+               "github.com/OperatorFoundation/obfs4/common/csrand"
+               "github.com/OperatorFoundation/obfs4/common/drbg"
+               "github.com/OperatorFoundation/obfs4/common/log"
+               "github.com/OperatorFoundation/obfs4/common/ntor"
+               "github.com/OperatorFoundation/obfs4/common/probdist"
+               "github.com/OperatorFoundation/obfs4/common/pt_extras"
+               "github.com/OperatorFoundation/obfs4/common/replayfilter"
+               "github.com/OperatorFoundation/obfs4/common/socks5"
+               "github.com/OperatorFoundation/obfs4/common/termmon"
+               "github.com/OperatorFoundation/obfs4/common/uniformdh"
+               "github.com/OperatorFoundation/obfs4/modes/pt_socks5"
+               "github.com/OperatorFoundation/obfs4/modes/stun_udp"
+               "github.com/OperatorFoundation/obfs4/modes/transparent_tcp"
+               "github.com/OperatorFoundation/obfs4/modes/transparent_udp"
+               "github.com/OperatorFoundation/obfs4/obfs4proxy"
+               "github.com/OperatorFoundation/obfs4/proxy_dialers/proxy_http"
+               "github.com/OperatorFoundation/obfs4/proxy_dialers/proxy_socks4"
+               "github.com/OperatorFoundation/obfs4/transports"))
+             #t)))))
+    (propagated-inputs
+     `(("go-github-com-dchest-siphash" ,go-github-com-dchest-siphash)
+       ("go-github-com-operatorfoundation-ed25519"
+        ,go-github-com-operatorfoundation-ed25519)
+       ("go-github-com-willscott-goturn" ,go-github-com-willscott-goturn)
+       ("go-golang-org-x-crypto" ,go-golang-org-x-crypto)
+       ("go-golang-org-x-net" ,go-golang-org-x-net)
+       ("go-torproject-org-pluggable-transports-goptlib"
+        ,go-torproject-org-pluggable-transports-goptlib)))
+    (home-page "https://github.com/OperatorFoundation/obfs4")
+    (synopsis "The Obfourscator")
+    (description "Obfs4 is a look-like nothing obfuscation protocol that
+incorporates ideas and concepts from Philipp Winter's ScrambleSuit protocol.
+The notable differences between ScrambleSuit and obfs4 are:
+@itemize
+@The handshake always does a full key exchange (no such thing as a Session
+Ticket Handshake).
+@The handshake uses the Tor Project's ntor handshake with public keys obfuscated
+via the Elligator 2 mapping.
+@The link layer encryption uses NaCl secret boxes (Poly1305/XSalsa20).
+@end itemize")
+    (license license:bsd-2)))
+
 (define-public go-github-com-willscott-goturn
   (let ((commit "19f41278d0c9251d64e0ee29f37d51e87a24a97b")
         (revision "68"))