Skip to content
Snippets Groups Projects
Verified Commit f784831f authored by Petr Špaček's avatar Petr Špaček
Browse files

doh: remember source transport

parent d477626e
Branches
Tags
1 merge request!799DNS-over-HTTP support (server side)
...@@ -166,6 +166,7 @@ struct kr_rplan { ...@@ -166,6 +166,7 @@ struct kr_rplan {
struct kr_request_qsource_flags { struct kr_request_qsource_flags {
_Bool tcp : 1; _Bool tcp : 1;
_Bool tls : 1; _Bool tls : 1;
_Bool http : 1;
}; };
struct kr_request { struct kr_request {
struct kr_context *ctx; struct kr_context *ctx;
......
...@@ -179,6 +179,7 @@ struct kr_context ...@@ -179,6 +179,7 @@ struct kr_context
struct kr_request_qsource_flags { struct kr_request_qsource_flags {
bool tcp:1; /**< true if the request is on TCP (or TLS); only meaningful if (dst_addr). */ bool tcp:1; /**< true if the request is on TCP (or TLS); only meaningful if (dst_addr). */
bool tls:1; /**< true if the request is on TLS; only meaningful if (dst_addr). */ bool tls:1; /**< true if the request is on TLS; only meaningful if (dst_addr). */
bool http:1; /**< true if the request is on HTTP; only meaningful if (dst_addr). */
}; };
/** /**
......
...@@ -92,6 +92,10 @@ local function serve_doh(h, stream) ...@@ -92,6 +92,10 @@ local function serve_doh(h, stream)
local function init_cb(req) local function init_cb(req)
req.qsource.addr = convert_sockaddr(stream:peername()) req.qsource.addr = convert_sockaddr(stream:peername())
req.qsource.dst_addr = convert_sockaddr(stream:localname()) req.qsource.dst_addr = convert_sockaddr(stream:localname())
req.qsource.flags.tcp = true
req.qsource.flags.tls = (stream.connection:checktls() ~= nil)
print(req.qsource.flags.tls)
req.qsource.flags.http = true
end end
-- resolve query -- resolve query
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment