return dnsdist::queueQueryResumptionEvent(std::move(query));
});
- luaCtx.registerMember<const ComboAddress (DNSResponse::*)>("selectedBackend",
- []( const DNSResponse& dr) -> const ComboAddress {
- if (dr.d_downstream == nullptr) {
- return ComboAddress();
- } else {
- return dr.d_downstream->d_config.remote;
- }
- },
- [](DNSResponse& dr, const ComboAddress newSelectedBackend) { (void) newSelectedBackend; }
- );
+ luaCtx.registerFunction<std::shared_ptr<DownstreamState>(DNSResponse::*)(void)const>("getSelectedBackend", [](const DNSResponse& dr) {
+ return dr.d_downstream;
+ });
#endif /* DISABLE_NON_FFI_DQ_BINDINGS */
}
- ``useECS``
If the value is really needed while the response is being processed, it is possible to set a tag while the query is processed, as tags will be passed to the response object.
- The DNSResponse object has one additional attribute:
+ It also has additional methods:
- .. attribute:: DNSResponse.selectedBackend
+ .. method:: DNSResponse.getSelectedBackend() -> Server
.. versionadded:: 1.9.0
- :ref:`ComboAddress` of the selected backend.
-
- It also has additional methods:
+ Get the selected backend :class:`Server` or nil
.. method:: DNSResponse:editTTLs(func)