resolver

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package resolver maps a network connection (proto + local port + remote endpoint) to the process that owns it, and that process to a display name.

On macOS there is no syscall that takes a 4-tuple and returns a PID, so the resolver periodically enumerates every process' open socket file descriptors (libproc) and builds a reverse index. Lookups consult that index and trigger an on-demand rescan when a key misses and the cache is stale.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver holds the reverse index and process metadata cache. Safe for concurrent use.

func New

func New(minInterval time.Duration) *Resolver

New returns a Resolver. minInterval bounds how often an on-demand miss can force a rescan, protecting against busy-looping the (relatively expensive) full process/fd enumeration.

func (*Resolver) Lookup

func (r *Resolver) Lookup(k types.ConnKey) (types.Process, bool)

Lookup resolves a connection key to its owning process. The boolean reports whether attribution succeeded; on a miss the caller may still record the flow under an "unknown" bucket.

func (*Resolver) Refresh

func (r *Resolver) Refresh() bool

Refresh rebuilds the index from the OS. It is rate limited by minInterval and returns true if a scan actually ran.

Jump to

Keyboard shortcuts

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