Keep the local daemon bound to loopback#31
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Non-technical summary
This closes the remaining gap where the local
llamafile-localdaemon could be pointed at a non-loopback bind host through config. After this change, the daemon-managed local model endpoint stays local-only by contract, and users get an explicit error instead of silently exposing it more broadly.Why this matters now:
INTENT.mdsays the project is local-first by default.How the system is better afterward:
daemon.hostnow accepts only loopback values.llamafile-localrefuses invalid host config instead of falling back or binding wider than intended.Technical summary
internal/clithat canonicalizes accepted loopback values (127.0.0.1,localhost,::1) to127.0.0.1.daemonRunForegroundandbuildBackend("llamafile-local", ...)so startup and local backend resolution enforce the same boundary.daemon.hostvalues ini config setso the user gets fast feedback before a bad config lands.config set daemon.host 0.0.0.0.docs/SPEC.mdso the configuration example and daemon contract match the implementation.Relevant intent being strengthened:
INTENT.md: local-first by default, safe by construction.internal/daemon/daemon.goarchitecture comment: the daemon-managed HTTP API is on loopback.Tests:
go test ./internal/cli/...go test ./...go vet ./...make buildBreaking changes:
daemon.hostto a non-loopback value forllamafile-localwill now get a validation error. This is intentional: remote serving belongs on the explicit network backends, not the local daemon path.Additional notes
Trade-off:
127.0.0.1rather than preserving the original spelling, because the goal here is enforcement and a single predictable local endpoint, not host-style fidelity.Deferred follow-up:
llamafile-network,ollama,openai). Those remain the supported surfaces for non-local endpoints.Remaining gap: