@@ -9955,3 +9955,33 @@ (define-public go-github-com-songgao-water
library for Go that efficiently works with standard packages like io, bufio,
etc.. Use waterutil with it to work with TUN/TAP packets/frames.")
(license license:bsd-3)))
+
+(define-public go-github-com-vishvananda-netns
+ (package
+ (name "go-github-com-vishvananda-netns")
+ (version "0.0.0-20211101163701-50045581ed74")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/vishvananda/netns")
+ (commit (go-version->git-ref version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0kam780m036mk77fmc0w0z6qz4b5awkllcd1dps71zd1n82mr407"))))
+ (build-system go-build-system)
+ (arguments '(#:tests? #f ; Tests require root privileges
+ #:import-path "github.com/vishvananda/netns"))
+ (native-inputs
+ (list go-golang-org-x-sys))
+ (home-page "https://github.com/vishvananda/netns")
+ (synopsis "Simple network namespace handling for Go")
+ (description
+ "Package netns allows ultra-simple network namespace handling. NsHandles can be
+retrieved and set. Note that the current namespace is thread local so actions
+that set and reset namespaces should use LockOSThread to make sure the namespace
+doesn't change due to a goroutine switch. It is best to close NsHandles when
+you are done with them. This can be accomplished via a `defer ns.Close()` on
+the handle. Changing namespaces requires elevated privileges, so in most cases
+this code needs to be run as root.")
+ (license license:asl2.0)))