fix: dns resolution taking long and add caching options (#8)

This commit is contained in:
Karol Broda
2025-12-24 11:12:39 +01:00
committed by GitHub
parent 1021ba13aa
commit b0226d1286
13 changed files with 1302 additions and 67 deletions

View File

@@ -167,9 +167,20 @@ shortcut flags work on all commands:
-e, --established established connections
-4, --ipv4 ipv4 only
-6, --ipv6 ipv6 only
-n, --numeric no dns resolution
```
## resolution
dns and service name resolution options:
```
--resolve-addrs resolve ip addresses to hostnames (default: true)
--resolve-ports resolve port numbers to service names
--no-cache disable dns caching (force fresh lookups)
```
dns lookups are performed in parallel and cached for performance. use `--no-cache` to bypass the cache for debugging or when addresses change frequently.
for more specific filtering, use `key=value` syntax with `ls`:
```bash
@@ -208,8 +219,19 @@ optional config file at `~/.config/snitch/snitch.toml`:
```toml
[defaults]
numeric = false
theme = "auto"
numeric = false # disable name resolution
dns_cache = true # cache dns lookups (set to false to disable)
theme = "auto" # color theme: auto, dark, light, mono
```
### environment variables
```bash
SNITCH_THEME=dark # set default theme
SNITCH_RESOLVE=0 # disable dns resolution
SNITCH_DNS_CACHE=0 # disable dns caching
SNITCH_NO_COLOR=1 # disable color output
SNITCH_CONFIG=/path/to # custom config file path
```
## requirements