fix three V1.0.1 leftover tails

1. per-client links (LinkProvider.LinksForClient) now apply the
   inbound's managed Host records with the same precedence as
   subscriptions and export-all (host endpoints after fallback
   projection); zero-host inbounds keep the legacy output.
2. agent node writes no longer store the form placeholder
   address='agent', port=2053: CreateFromRequest/UpdateFromRequest
   sanitize it to the node's resolved agent address (update) or
   empty (create / unreported), port 0; normalize gains a lenient
   endpoint mode for agent writes only.
3. runtime Remote.baseURL refuses the legacy 'agent' placeholder
   with a clear no-panel-endpoint error instead of splicing it into
   a dialable https://agent:2053 URL.
This commit is contained in:
Muse
2026-10-22 17:55:19 +00:00
parent 8e89960474
commit 3413ccca9f
7 changed files with 404 additions and 10 deletions
+15
View File
@@ -151,11 +151,26 @@ func (r *Remote) httpClient() (*http.Client, error) {
return r.client, r.clientErr
}
// isAgentPlaceholderAddress reports whether addr is the placeholder the
// node form used to store for agent nodes ("agent"). Agent nodes dial out
// to the master and expose no panel endpoint; the write path no longer
// stores the placeholder (see sanitizeAgentEndpoint in the node service),
// but rows written earlier still carry it, and "agent" is a syntactically
// valid hostname — without this guard baseURL would splice it into a
// dialable URL (https://agent:2053/...) and do() would fire real requests
// at whatever "agent" happens to resolve to.
func isAgentPlaceholderAddress(addr string) bool {
return strings.EqualFold(addr, "agent")
}
func (r *Remote) baseURL() (string, error) {
addr, err := netsafe.NormalizeHost(r.node.Address)
if err != nil {
return "", err
}
if isAgentPlaceholderAddress(addr) {
return "", errors.New("node has no panel endpoint (agent-managed nodes cannot be dialed)")
}
scheme := r.node.Scheme
if scheme != "http" && scheme != "https" {
scheme = "https"