ipc

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package ipc centralises the local IPC between the privileged netscoped daemon and its unprivileged clients (the Wails app and the CLI). Communication is plain HTTP carried over a Unix domain socket — so there is no open TCP port a browser or another user's process could reach; access is gated by the socket file's ownership and permissions instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client

func Client(sock string) *http.Client

Client returns an HTTP client that reaches the daemon over the unix socket. Use any URL host (e.g. http://netscoped/api/health); only the path matters.

func DefaultSocketPath

func DefaultSocketPath() string

DefaultSocketPath is where the daemon listens and clients connect. It is a fixed absolute path (not derived from $HOME) so the root daemon and the user's app/CLI agree on it regardless of who runs them. Override with the NETSCOPE_SOCK environment variable (handy for un-privileged offline dev).

func Listen

func Listen(sock string) (net.Listener, error)

Listen creates the unix socket listener for the daemon. It ensures the parent directory exists, removes a stale socket, and (when running as root) hands ownership of the socket to the target user with 0600 perms so only that user and root can connect.

func NewReverseProxy

func NewReverseProxy(sock string) *httputil.ReverseProxy

NewReverseProxy returns a reverse proxy that forwards requests to the daemon over the unix socket, streaming responses immediately (so SSE works). The Wails asset server mounts this as its fallback handler for /api/*.

Types

This section is empty.

Jump to

Keyboard shortcuts

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