desktop

package
v0.43.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package desktop implements knot's desktop mode: bare `knot` runs the full server (identical to `knot server`) plus a system tray icon whose menu offers to open the web UI in the default browser and to quit. The whole package is excluded from -tags server builds.

Index

Constants

This section is empty.

Variables

View Source
var NFSServerCmd = &cli.Command{
	Name:  "nfs-server",
	Usage: "Serve file storage over NFS, to mount buckets as local folders",
	Description: `Serve the buckets of a knot server over NFS (NFSv4.0 and NFSv3), acting as the user of the API token it connects with (--server and --token, or --alias), so they can be mounted without FUSE. The top level of the export holds the buckets; mkdir there makes a new bucket. Mount it whole at /, or a single bucket or folder by its path.

NFS has no authentication: anyone who can connect reaches every file the user can, so only loopback clients are accepted unless --nfs-allow says otherwise.

NFSv4.0 and NFSv3 are both served, on the one port. NFSv4 needs no separate mount port and its locks work across clients of this server; NFSv3 suits older clients.

Docker or Podman volume (from a Docker Desktop or OrbStack VM, use host.docker.internal as the address):

  docker volume create --driver local --opt type=nfs \
    --opt o=addr=127.0.0.1,port=2049,vers=4.0 --opt device=:/ knot-files

macOS:

  mount_nfs -o vers=4,tcp,port=2049 127.0.0.1:/ ~/mnt

Linux:

  mount -t nfs4 -o vers=4.0,port=2049 127.0.0.1:/ /mnt/knot

NFSv3, for a single bucket or folder by its path:

  mount -t nfs -o vers=3,tcp,port=2049,mountport=2049,nolock 127.0.0.1:/mybucket /mnt/knot`,
	MaxArgs: cli.NoArgs,
	Flags: append(cmdutil.ClientFlags(false),
		&cli.StringFlag{
			Name:         "nfs-listen",
			Usage:        "The address to serve NFS on, or just a port for loopback.",
			EnvVars:      []string{config.CONFIG_ENV_PREFIX + "_NFS_LISTEN"},
			DefaultValue: "127.0.0.1:2049",
		},
		&cli.IntFlag{
			Name:         "uid",
			Usage:        "Show every file as owned by this user id, e.g. 0 for containers running as root. Without it, files show the owner stored on them, else the user running the server.",
			DefaultValue: -1,
		},
		&cli.IntFlag{
			Name:         "gid",
			Usage:        "Show every file as in this group id. Without it, files show the group stored on them, else the group running the server.",
			DefaultValue: -1,
		},
		&cli.StringFlag{
			Name:    "cache-dir",
			Usage:   "Keep files read and written in this directory, so they need not be fetched again. No cache when not set.",
			EnvVars: []string{config.CONFIG_ENV_PREFIX + "_NFS_CACHE_DIR"},
		},
		&cli.StringFlag{
			Name:         "cache-size",
			Usage:        "The most the cache may hold, e.g. 512MB or 10GB.",
			EnvVars:      []string{config.CONFIG_ENV_PREFIX + "_NFS_CACHE_SIZE"},
			DefaultValue: "1GB",
		},
		&cli.StringSliceFlag{
			Name:    "nfs-allow",
			Usage:   "Addresses or CIDRs allowed to connect (default loopback only). NFS has no authentication: anyone allowed can reach every file the user can.",
			EnvVars: []string{config.CONFIG_ENV_PREFIX + "_NFS_ALLOW"},
		},
	),
	Run: runNFSServer,
}

NFSServerCmd serves a knot server's file storage over NFS, as the user of the API token it connects with. It is a client of the server, so as many can run as are wanted, on any machine, each as its own user.

Functions

func Run

func Run(ctx context.Context, cmd *cli.Command) error

Run starts the knot server in a background goroutine and the system tray on the calling (main) goroutine, blocking until the user quits from the tray menu. If the tray is unavailable the server keeps running headless and Ctrl-C still shuts it down via the signal path in RunServer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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