Debian Codegraph @

/

debian golang-github-lorenzosaino-go-sysctl 0.3.1+ds1-1debian golang-github-lorenzosaino-go-sysctl-dev gomod github.com/lorenzosaino/go-sysctl debiangogoinimakemakefilemarkdownshellyaml 27 files · 186 symbols
View dependency graph

Depends on

README (full)

Go Sysctl

GoDoc Build Go Report Card License

Go wrapper around the sysctl interface.

Documentation

See Go doc.

Usage

import sysctl "github.com/lorenzosaino/go-sysctl"

var (
    val string
    vals map[string]string
    err error
)

// Get value of a single sysctl
// This is equivalent to running "sysctl <key>"
val, err = sysctl.Get("net.ipv4.ip_forward")

// Get the values of all sysctls matching a given pattern
// This is equivalent to running "sysctl -a -r <pattern>"
vals, err = sysctl.GetPattern("net.ipv4.ipfrag")

// Get the values of all sysctls
// This is equivalent to running "sysctl -a"
vals, err = sysctl.GetAll()

// Set the value of a sysctl
// This is equivalent to running "sysctl -w <key>=<value>"
err = sysctl.Set("net.ipv4.ip_forward", "1")

// Set sysctl values from configuration file
// This is equivalent to running "sysctl -p <config-file>"
err = sysctl.LoadConfigAndApply("/etc/sysctl.conf")

License

BSD 3-clause

dir .github/
dir debian/
dir testdata/
file .gitignore
file CHANGELOG.md
file LICENSE
file Makefile
file README.md
file client.go
file client_test.go
file config.go
file config_test.go
file go.mod
file go.sum
file sysctl.go
file sysctl_linux_test.go
file tools.go