11-- Copyright (C) Yuansheng Wang
2+
23local ipmatcher = require (" resty.ipmatcher" )
34local base = require (" resty.core.base" )
45local clear_tab = require (" table.clear" )
@@ -7,7 +8,7 @@ local bit = require("bit")
78local new_tab = base .new_tab
89local tonumber = tonumber
910local ipairs = ipairs
10- local ffi = require " ffi"
11+ local ffi = require ( " ffi" )
1112local ffi_cast = ffi .cast
1213local ffi_cdef = ffi .cdef
1314local insert_tab = table.insert
@@ -21,7 +22,7 @@ local error = error
2122local newproxy = newproxy
2223local tostring = tostring
2324local cur_level = ngx .config .subsystem == " http" and
24- require " ngx.errlog" .get_sys_filter_level ()
25+ require ( " ngx.errlog" ) .get_sys_filter_level ()
2526local ngx_var = ngx .var
2627
2728
@@ -179,10 +180,11 @@ local function parse_remote_addr(route_remote_addrs)
179180end
180181
181182
183+ local pre_insert_route
182184do
183185 local route_opts = {}
184186
185- local function pre_insert_route (self , path , route )
187+ function pre_insert_route (self , path , route )
186188 if type (path ) ~= " string" then
187189 error (" invalid argument path" , 2 )
188190 end
@@ -288,6 +290,9 @@ local function pre_insert_route(self, path, route)
288290 insert_route (self , route_opts )
289291end
290292
293+ end -- do
294+
295+
291296function _M .new (routes )
292297 if not routes then
293298 return nil , " missing argument route"
@@ -326,8 +331,6 @@ function _M.new(routes)
326331 return self
327332end
328333
329- end -- do
330-
331334
332335function _M .free (self )
333336 local it = self .tree_it
0 commit comments