Documentation ¶
Overview ¶
Package execs contains external executables.
Index ¶
- Variables
- func RunIP(ctx context.Context, arg ...string) (stdout, stderr []byte, err error)
- func RunIP4Route(ctx context.Context, arg ...string) (stdout, stderr []byte, err error)
- func RunIP4Rule(ctx context.Context, arg ...string) (stdout, stderr []byte, err error)
- func RunIP6Route(ctx context.Context, arg ...string) (stdout, stderr []byte, err error)
- func RunIP6Rule(ctx context.Context, arg ...string) (stdout, stderr []byte, err error)
- func RunIPAddress(ctx context.Context, arg ...string) (stdout, stderr []byte, err error)
- func RunIPLink(ctx context.Context, arg ...string) (stdout, stderr []byte, err error)
- func RunNft(ctx context.Context, s string) (stdout, stderr []byte, err error)
- func RunResolvectl(ctx context.Context, arg ...string) (stdout, stderr []byte, err error)
- func RunSysctl(ctx context.Context, arg ...string) (stdout, stderr []byte, err error)
- func SetExecutables(config *Config)
- type Config
Constants ¶
This section is empty.
Variables ¶
View Source
var ( IP = "ip" Nft = "nft" Resolvectl = "resolvectl" Sysctl = "sysctl" )
default values.
View Source
var RunCmd = func(ctx context.Context, cmd string, s string, arg ...string) (stdout, stderr []byte, err error) { c := exec.CommandContext(ctx, cmd, arg...) if s != "" { c.Stdin = bytes.NewBufferString(s) } var outbuf, errbuf bytes.Buffer c.Stdout = &outbuf c.Stderr = &errbuf err = c.Run() stdout = outbuf.Bytes() stderr = errbuf.Bytes() return }
RunCmd runs the cmd with args and sets stdin to s, returns stdout and stderr.
Functions ¶
func RunIP4Route ¶
RunIP4Route runs the "ip -4 route" command with args.
func RunIP4Rule ¶
RunIP4Rule runs the "ip -4 rule" command with args.
func RunIP6Route ¶
RunIP6Route runs the "ip -6 route" command with args.
func RunIP6Rule ¶
RunIP6Rule runs the "ip -6 rule" command with args.
func RunIPAddress ¶
RunIPAddress runs the "ip address" command with args.
func RunResolvectl ¶
RunResolvectl runs the "resolvectl" command with args.
func SetExecutables ¶
func SetExecutables(config *Config)
SetExecutables configures all executables from config.
Types ¶
type Config ¶
Config is executables configuration.
func (*Config) CheckExecutables ¶
CheckExecutables checks whether executables in config exist in the file system and are executable.
Click to show internal directories.
Click to hide internal directories.