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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user