disabler

package
v0.0.0-...-2036b99 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package disabler contains a go routine that polls system variable at a regular interval and will kill xtcp if the stdout response is "1\n"

This go routine can be disabled via cli flag.

Please note that given xtcp should NOT be running as root, so this code does NOT carefully check the command arguments passed If running as root, this could be dangerous, but root is already dangerous enough, so we not making things worse

The channel is required to ensure that on startup xtcp blocks waiting for the first iteration to complete, otherwise polling can start before we've finished checking if we're disabled (eg spawning the new process is slower than starting the other go routines)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Disabler

func Disabler(cliFlags cliflags.CliFlags, done chan<- struct{}, testing bool) bool

Disabler polls a command, and if the stdout response is "1\n", the calls os.Exit(0) - a clean exit It goes return bool, for when using for testing. Disabler == true means it would os.Exit(0) if not testing

Types

This section is empty.

Jump to

Keyboard shortcuts

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