lxd/response.go
func ForwardedResponseIfTargetIsRemote(d *Daemon, request *http.Request) Response {
	targetNode := queryParam(request, "target")
	if targetNode == "" {
		return nil
	}

	// Figure out the address of the target node (which is possibly
	// this very same node).
	address, err := cluster.ResolveTarget(d.cluster, targetNode)
	if err != nil {
		return SmartError(err)
	}

	if address != "" {
		// Forward the response.
		cert := d.endpoints.NetworkCert()
		client, err := cluster.Connect(address, cert, false)
		if err != nil {
			return SmartError(err)
		}
		return ForwardedResponse(client, request)
	}

	return nil
}
func ForwardedResponseIfTargetIsRemote(d *Daemon, request *http.Request) Response {
	targetNode := queryParam(request, "target")
	if targetNode == "" {
		return nil
	}

	// Figure out the address of the target node (which is possibly
	// this very same node).
	address, err := cluster.ResolveTarget(d.cluster, targetNode)
	if err != nil {
		return SmartError(err)
	}

	if address != "" {
		// Forward the response.
		cert := d.endpoints.NetworkCert()
		client, err := cluster.Connect(address, cert, false)
		if err != nil {
			return SmartError(err)
		}
		return ForwardedResponse(client, request)
	}

	return nil
}
func ForwardedResponseIfTargetIsRemote ( d * Daemon , request * http . Request ) Response { targetNode := queryParam ( request , " " ) if targetNode == " " { return nil } // Figure out the address of the target node (which is possibly // this very same node). address , err := cluster . ResolveTarget ( d . cluster , targetNode ) if err != nil { return SmartError ( err ) } if address != " " { // Forward the response. cert := d . endpoints . NetworkCert ( ) client , err := cluster . Connect ( address , cert , false ) if err != nil { return SmartError ( err ) } return ForwardedResponse ( client , request ) } return nil }
// ForwardedResponseIfTargetIsRemote redirects a request to the request has a
// targetNode parameter pointing to a node which is not the local one.
ForwardedResponseIfTargetIsRemote redirects a request to the request has a targetNode parameter pointing to a node which is not the local one .