An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 4.2% dependent packages on proxy.golang.org
Top 4.7% dependent repos on proxy.golang.org

proxy.golang.org : github.com/thediveo/gons

Package gons ("go [into] namespaces") selectively switches your Go application into other already existing Linux namespaces. This must happen before the Go runtime spins up, because the Go runtime later unintentionally blocks certain namespace changes, especially changing into a different mount namespace when running with multiple OS threads. Simply import the gons package into your application, and you're almost set. In your application's main() you should check that there were no errors switching namespaces. The existing namespaces to join/switch into are referenced by their paths in the filesystem (such as "/proc/123456/ns/mnt"), and are specified using environment variables. Set only the environment variables for those namespaces that should be switched at startup. These variables need to be set before your application is started. The names of the environment variables are as follows and must be all lowercase: Additionally, you can specify the order in which the namespaces should be switched, as well as when the namespace paths are to be opened: if not overridden by the optional environment variable gons_order=..., then the default order is "!user,!mnt,!cgroup,!ipc,!net,!pid,!uts" (see below for the meaning of "!"). It's not necessary to specify all 7 namespace types when you don't intend to switch them all. For instance, if you just switch the net and IPC namespaces, then "gons_order=net,ipc" is sufficient. When a namespace type name is preceded by a bang "!", such as "!user", then the its path will be opened before the first namespace switch takes place. Without a bang, the namespace path is opened just right before switching into this namespace. This is mostly of importance when switching the mount namespace, as this can also change the filesystem and thus how the namespace paths are resolved. In case your Go application wants to fork and then restart itself in order to be able to switch namespaces, you might find the subpackage "github.com/thediveo/gons/reexec" useful. It simplifies the overall process and takes care of correctly setting the environment variables. Setting "gons_pid=..."" does not switch your application's own PID namespace, but rather controls the PID namespace any child processes of your application will be put into. If a given namespace path is invalid, or if there are insufficient rights to access the path or switch to the specified namespace, then an error message is printed to stderr and the application aborted with error code 1. The gons package requires cgo (https://golang.org/cmd/cgo/): the required namespace switches can only safely be done while your application is still single-threaded and that's only the case before the Go runtime is spinning up.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/thediveo/gons
License: Apache-2.0
Latest release: over 1 year ago
First release: over 4 years ago
Namespace: github.com/thediveo
Dependent packages: 2
Dependent repositories: 1
Stars: 0 on GitHub
Forks: 2 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 20 days ago

    Loading...
    Readme
    Loading...