sysctl

package module
v0.0.0-...-c78a995 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2021 License: MIT Imports: 4 Imported by: 0

README

sysctl

build.yaml Go Reference golangci.yaml

Package sysctl inspired by systemd's sysctl source code and kubernetes's sysctl subpackage.

Install

go get github.com/go-laeo/sysctl

Example

// disables all ipv6
sysctl.Set("net.ipv6.conf.all.disable_ipv6", "1")

// check if ipv6 has disabled
disabled, err := sysctl.GetBool("net.ipv6.conf.all.disable_ipv6")

License

The MIT License.

Documentation

Overview

Package sysctl inspired by systemd's sysctl source code and kubernetes's sysctl subpackage.

Example:

sysctl.Set("net.ipv6.conf.all.disable_ipv6", "1") // disables all ipv6
value, err := sysctl.Get("net.ipv6.conf.all.disable_ipv6") // retrieves kernel settings value

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomGet

func CustomGet(procSysPath, property string) ([]byte, error)

func CustomSet

func CustomSet(procSysPath, property, value string) error

func Get

func Get(property string) ([]byte, error)

Get reads property value from in /proc/sys.

func GetBool

func GetBool(property string) (bool, error)

func GetInt

func GetInt(property string) (int, error)

func Normalize

func Normalize(property string) string

Normalize will checks if the first separator is a slash, the path is assumed to be normalized and slashes remain slashes and dots remains dots.

func Set

func Set(property, value string) error

Set writes given value and a special char "\n" to /proc/sys.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL