service

package
v0.2.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package service registers vmflow as a native OS service so it starts at boot and restarts on crash:

  • Linux: systemd unit (/etc/systemd/system/<name>.service)
  • macOS: launchd daemon (/Library/LaunchDaemons/io.cloudapp.<name>.plist)
  • Windows: Windows Service (managed via services.msc / SCM APIs)

The package only performs install/uninstall/status: it generates the unit or plist file and invokes the platform's service manager (systemctl / launchctl / Windows SCM). The runtime itself does not need this package to run: Linux and macOS execute vmflow in the foreground and supervise it via signals; on Windows vmflow detects the SCM at startup (see cmd/vmflow/daemon_windows.go) and reports state itself.

Style follows internal/updater: error-return (no logger in the package), progress streamed to an io.Writer, and file writes use a same-directory temp + rename for atomicity.

Index

Constants

View Source
const DefaultServiceName = "vmflow"

DefaultServiceName is the service/unit/registry name used when Config.Name is empty.

Variables

This section is empty.

Functions

func Install

func Install(cfg Config, w io.Writer) error

Install registers, enables, and starts the service.

func Status

func Status(cfg Config, w io.Writer) error

Status prints the current service status to w.

func Uninstall

func Uninstall(cfg Config, w io.Writer) error

Uninstall stops and removes the service. Config and log files are left in place for the operator to clean up.

Types

type Config

type Config struct {
	// BinaryPath is the vmflow executable path. Defaults to the current
	// executable when empty.
	BinaryPath string
	// ConfigPath is the -config path the service runs with. Defaults to the
	// platform's system config path when empty.
	ConfigPath string
	// ServiceName is the service/unit/registry name. Defaults to "vmflow".
	ServiceName string
	// User is the systemd User= the unit runs as (Linux only). Empty = root.
	// When set and the account is missing, install creates it as a system user.
	User string
	// LogFile redirects daemon logs. On Linux/Windows it is passed to the daemon
	// via -log-file; on macOS it sets the launchd capture paths. Windows defaults
	// to a durable path under ProgramData because the SCM provides no stdout.
	LogFile string
	// ControlListen overrides the daemon control API listen address.
	ControlListen string
	// InsecureAllowRemoteControl permits an unauthenticated non-loopback control
	// API. Callers should prefer configuring authentication instead.
	InsecureAllowRemoteControl bool
	// ExtraArgs are individual extra arguments appended to the daemon command
	// line for future daemon flags. Existing daemon flags have dedicated Config
	// fields and are rejected here to prevent overriding validated paths.
	ExtraArgs []string
}

Config describes how to install or query the vmflow service.

Jump to

Keyboard shortcuts

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