Skip to content

Commit

Permalink
stream select
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed Jul 25, 2023
1 parent e3824f1 commit aef12e9
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions kong/router/atc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -630,29 +630,42 @@ function _M:select(_, _, _, scheme,

local c = context.new(self.schema)

for _, field in ipairs(self.fields) do
for i = 1, self.fields_n do
local field = self.fields[i]

if field == "net.protocol" then
assert(c:add_value(field, scheme))
goto continue
end

elseif field == "tls.sni" then
if field == "tls.sni" then
local res, err = c:add_value(field, sni)
if not res then
return nil, err
end
goto continue
end

elseif field == "net.src.ip" then
if field == "net.src.ip" then
assert(c:add_value(field, src_ip))
goto continue
end

elseif field == "net.src.port" then
if field == "net.src.port" then
assert(c:add_value(field, src_port))
goto continue
end

elseif field == "net.dst.ip" then
if field == "net.dst.ip" then
assert(c:add_value(field, dst_ip))
goto continue
end

elseif field == "net.dst.port" then
if field == "net.dst.port" then
assert(c:add_value(field, dst_port))

end -- if

::continue::
end -- for

local matched = self.router:execute(c)
Expand Down

0 comments on commit aef12e9

Please sign in to comment.