This is an automated email from the ASF dual-hosted git repository.
spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new 3bb0633 feat(ext-plugin): step 1, add flatbuffer proto and generated
files (#4081)
3bb0633 is described below
commit 3bb063321c79c2815980c6226a3960406db233fc
Author: 罗泽轩 <[email protected]>
AuthorDate: Fri Apr 23 09:16:51 2021 +0800
feat(ext-plugin): step 1, add flatbuffer proto and generated files (#4081)
---
.luacheckrc | 1 +
Makefile | 13 ++
apisix/plugins/ext-plugin/A6/DataEntry.lua | 67 +++++++++
apisix/plugins/ext-plugin/A6/Err/Code.lua | 27 ++++
apisix/plugins/ext-plugin/A6/Err/Resp.lua | 51 +++++++
.../plugins/ext-plugin/A6/HTTPReqCall/Action.lua | 27 ++++
apisix/plugins/ext-plugin/A6/HTTPReqCall/Req.lua | 151 +++++++++++++++++++++
apisix/plugins/ext-plugin/A6/HTTPReqCall/Resp.lua | 68 ++++++++++
.../plugins/ext-plugin/A6/HTTPReqCall/Rewrite.lua | 90 ++++++++++++
apisix/plugins/ext-plugin/A6/HTTPReqCall/Stop.lua | 88 ++++++++++++
apisix/plugins/ext-plugin/A6/Method.lua | 39 ++++++
apisix/plugins/ext-plugin/A6/PrepareConf/Req.lua | 63 +++++++++
apisix/plugins/ext-plugin/A6/PrepareConf/Resp.lua | 51 +++++++
apisix/plugins/ext-plugin/A6/TextEntry.lua | 57 ++++++++
apisix/plugins/ext-plugin/ext-plugin.fbs | 109 +++++++++++++++
utils/check-lua-code-style.sh | 5 +-
16 files changed, 906 insertions(+), 1 deletion(-)
diff --git a/.luacheckrc b/.luacheckrc
index f3dc124..05a4e22 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -4,4 +4,5 @@ redefined = false
max_line_length = 100
exclude_files = {
"apisix/cli/ngx_tpl.lua",
+ "apisix/plugins/ext-plugin/A6",
}
diff --git a/Makefile b/Makefile
index f4d1e97..a98e78b 100644
--- a/Makefile
+++ b/Makefile
@@ -198,6 +198,19 @@ install: default
$(INSTALL) -d $(INST_LUADIR)/apisix/plugins
$(INSTALL) apisix/plugins/*.lua $(INST_LUADIR)/apisix/plugins/
+ $(INSTALL) -d $(INST_LUADIR)/apisix/plugins/ext-plugin
+ $(INSTALL) -d $(INST_LUADIR)/apisix/plugins/ext-plugin/A6
+ $(INSTALL) apisix/plugins/ext-plugin/A6/*.lua
$(INST_LUADIR)/apisix/plugins/ext-plugin/A6/
+ $(INSTALL) -d $(INST_LUADIR)/apisix/plugins/ext-plugin/A6/Err
+ $(INSTALL) apisix/plugins/ext-plugin/A6/Err/*.lua \
+ $(INST_LUADIR)/apisix/plugins/ext-plugin/A6/Err/
+ $(INSTALL) -d $(INST_LUADIR)/apisix/plugins/ext-plugin/A6/HTTPReqCall
+ $(INSTALL) apisix/plugins/ext-plugin/A6/HTTPReqCall/*.lua \
+ $(INST_LUADIR)/apisix/plugins/ext-plugin/A6/HTTPReqCall/
+ $(INSTALL) -d $(INST_LUADIR)/apisix/plugins/ext-plugin/A6/PrepareConf
+ $(INSTALL) apisix/plugins/ext-plugin/A6/PrepareConf/*.lua \
+ $(INST_LUADIR)/apisix/plugins/ext-plugin/A6/PrepareConf/
+
$(INSTALL) -d $(INST_LUADIR)/apisix/plugins/grpc-transcode
$(INSTALL) apisix/plugins/grpc-transcode/*.lua
$(INST_LUADIR)/apisix/plugins/grpc-transcode/
diff --git a/apisix/plugins/ext-plugin/A6/DataEntry.lua
b/apisix/plugins/ext-plugin/A6/DataEntry.lua
new file mode 100644
index 0000000..b07f88f
--- /dev/null
+++ b/apisix/plugins/ext-plugin/A6/DataEntry.lua
@@ -0,0 +1,67 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- automatically generated by the FlatBuffers compiler, do not modify
+
+-- namespace: A6
+
+local flatbuffers = require('flatbuffers')
+
+local DataEntry = {} -- the module
+local DataEntry_mt = {} -- the class metatable
+
+function DataEntry.New()
+ local o = {}
+ setmetatable(o, {__index = DataEntry_mt})
+ return o
+end
+function DataEntry.GetRootAsDataEntry(buf, offset)
+ local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
+ local o = DataEntry.New()
+ o:Init(buf, n + offset)
+ return o
+end
+function DataEntry_mt:Init(buf, pos)
+ self.view = flatbuffers.view.New(buf, pos)
+end
+function DataEntry_mt:Name()
+ local o = self.view:Offset(4)
+ if o ~= 0 then
+ return self.view:String(o + self.view.pos)
+ end
+end
+function DataEntry_mt:Value(j)
+ local o = self.view:Offset(6)
+ if o ~= 0 then
+ local a = self.view:Vector(o)
+ return self.view:Get(flatbuffers.N.Uint8, a + ((j-1) * 1))
+ end
+ return 0
+end
+function DataEntry_mt:ValueLength()
+ local o = self.view:Offset(6)
+ if o ~= 0 then
+ return self.view:VectorLen(o)
+ end
+ return 0
+end
+function DataEntry.Start(builder) builder:StartObject(2) end
+function DataEntry.AddName(builder, name)
builder:PrependUOffsetTRelativeSlot(0, name, 0) end
+function DataEntry.AddValue(builder, value)
builder:PrependUOffsetTRelativeSlot(1, value, 0) end
+function DataEntry.StartValueVector(builder, numElems) return
builder:StartVector(1, numElems, 1) end
+function DataEntry.End(builder) return builder:EndObject() end
+
+return DataEntry -- return the module
diff --git a/apisix/plugins/ext-plugin/A6/Err/Code.lua
b/apisix/plugins/ext-plugin/A6/Err/Code.lua
new file mode 100644
index 0000000..3b3b0b4
--- /dev/null
+++ b/apisix/plugins/ext-plugin/A6/Err/Code.lua
@@ -0,0 +1,27 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- automatically generated by the FlatBuffers compiler, do not modify
+
+-- namespace: Err
+
+local Code = {
+ BAD_REQUEST = 0,
+ SERVICE_UNAVAILABLE = 1,
+ CONF_TOKEN_NOT_FOUND = 2,
+}
+
+return Code -- return the module
diff --git a/apisix/plugins/ext-plugin/A6/Err/Resp.lua
b/apisix/plugins/ext-plugin/A6/Err/Resp.lua
new file mode 100644
index 0000000..f433e25
--- /dev/null
+++ b/apisix/plugins/ext-plugin/A6/Err/Resp.lua
@@ -0,0 +1,51 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- automatically generated by the FlatBuffers compiler, do not modify
+
+-- namespace: Err
+
+local flatbuffers = require('flatbuffers')
+
+local Resp = {} -- the module
+local Resp_mt = {} -- the class metatable
+
+function Resp.New()
+ local o = {}
+ setmetatable(o, {__index = Resp_mt})
+ return o
+end
+function Resp.GetRootAsResp(buf, offset)
+ local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
+ local o = Resp.New()
+ o:Init(buf, n + offset)
+ return o
+end
+function Resp_mt:Init(buf, pos)
+ self.view = flatbuffers.view.New(buf, pos)
+end
+function Resp_mt:Code()
+ local o = self.view:Offset(4)
+ if o ~= 0 then
+ return self.view:Get(flatbuffers.N.Uint8, o + self.view.pos)
+ end
+ return 0
+end
+function Resp.Start(builder) builder:StartObject(1) end
+function Resp.AddCode(builder, code) builder:PrependUint8Slot(0, code, 0) end
+function Resp.End(builder) return builder:EndObject() end
+
+return Resp -- return the module
diff --git a/apisix/plugins/ext-plugin/A6/HTTPReqCall/Action.lua
b/apisix/plugins/ext-plugin/A6/HTTPReqCall/Action.lua
new file mode 100644
index 0000000..9166a05
--- /dev/null
+++ b/apisix/plugins/ext-plugin/A6/HTTPReqCall/Action.lua
@@ -0,0 +1,27 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- automatically generated by the FlatBuffers compiler, do not modify
+
+-- namespace: HTTPReqCall
+
+local Action = {
+ NONE = 0,
+ Stop = 1,
+ Rewrite = 2,
+}
+
+return Action -- return the module
diff --git a/apisix/plugins/ext-plugin/A6/HTTPReqCall/Req.lua
b/apisix/plugins/ext-plugin/A6/HTTPReqCall/Req.lua
new file mode 100644
index 0000000..cf6fd15
--- /dev/null
+++ b/apisix/plugins/ext-plugin/A6/HTTPReqCall/Req.lua
@@ -0,0 +1,151 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- automatically generated by the FlatBuffers compiler, do not modify
+
+-- namespace: HTTPReqCall
+
+local flatbuffers = require('flatbuffers')
+
+local Req = {} -- the module
+local Req_mt = {} -- the class metatable
+
+function Req.New()
+ local o = {}
+ setmetatable(o, {__index = Req_mt})
+ return o
+end
+function Req.GetRootAsReq(buf, offset)
+ local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
+ local o = Req.New()
+ o:Init(buf, n + offset)
+ return o
+end
+function Req_mt:Init(buf, pos)
+ self.view = flatbuffers.view.New(buf, pos)
+end
+function Req_mt:Id()
+ local o = self.view:Offset(4)
+ if o ~= 0 then
+ return self.view:Get(flatbuffers.N.Uint32, o + self.view.pos)
+ end
+ return 0
+end
+function Req_mt:SrcIp(j)
+ local o = self.view:Offset(6)
+ if o ~= 0 then
+ local a = self.view:Vector(o)
+ return self.view:Get(flatbuffers.N.Uint8, a + ((j-1) * 1))
+ end
+ return 0
+end
+function Req_mt:SrcIpLength()
+ local o = self.view:Offset(6)
+ if o ~= 0 then
+ return self.view:VectorLen(o)
+ end
+ return 0
+end
+function Req_mt:Method()
+ local o = self.view:Offset(8)
+ if o ~= 0 then
+ return self.view:Get(flatbuffers.N.Uint8, o + self.view.pos)
+ end
+ return 0
+end
+function Req_mt:Path()
+ local o = self.view:Offset(10)
+ if o ~= 0 then
+ return self.view:String(o + self.view.pos)
+ end
+end
+function Req_mt:Args(j)
+ local o = self.view:Offset(12)
+ if o ~= 0 then
+ local x = self.view:Vector(o)
+ x = x + ((j-1) * 4)
+ x = self.view:Indirect(x)
+ local obj = require('A6.TextEntry').New()
+ obj:Init(self.view.bytes, x)
+ return obj
+ end
+end
+function Req_mt:ArgsLength()
+ local o = self.view:Offset(12)
+ if o ~= 0 then
+ return self.view:VectorLen(o)
+ end
+ return 0
+end
+function Req_mt:Headers(j)
+ local o = self.view:Offset(14)
+ if o ~= 0 then
+ local x = self.view:Vector(o)
+ x = x + ((j-1) * 4)
+ x = self.view:Indirect(x)
+ local obj = require('A6.TextEntry').New()
+ obj:Init(self.view.bytes, x)
+ return obj
+ end
+end
+function Req_mt:HeadersLength()
+ local o = self.view:Offset(14)
+ if o ~= 0 then
+ return self.view:VectorLen(o)
+ end
+ return 0
+end
+function Req_mt:ConfToken()
+ local o = self.view:Offset(16)
+ if o ~= 0 then
+ return self.view:Get(flatbuffers.N.Uint32, o + self.view.pos)
+ end
+ return 0
+end
+function Req_mt:ExtraInfo(j)
+ local o = self.view:Offset(18)
+ if o ~= 0 then
+ local x = self.view:Vector(o)
+ x = x + ((j-1) * 4)
+ x = self.view:Indirect(x)
+ local obj = require('A6.DataEntry').New()
+ obj:Init(self.view.bytes, x)
+ return obj
+ end
+end
+function Req_mt:ExtraInfoLength()
+ local o = self.view:Offset(18)
+ if o ~= 0 then
+ return self.view:VectorLen(o)
+ end
+ return 0
+end
+function Req.Start(builder) builder:StartObject(8) end
+function Req.AddId(builder, id) builder:PrependUint32Slot(0, id, 0) end
+function Req.AddSrcIp(builder, srcIp) builder:PrependUOffsetTRelativeSlot(1,
srcIp, 0) end
+function Req.StartSrcIpVector(builder, numElems) return builder:StartVector(1,
numElems, 1) end
+function Req.AddMethod(builder, method) builder:PrependUint8Slot(2, method, 0)
end
+function Req.AddPath(builder, path) builder:PrependUOffsetTRelativeSlot(3,
path, 0) end
+function Req.AddArgs(builder, args) builder:PrependUOffsetTRelativeSlot(4,
args, 0) end
+function Req.StartArgsVector(builder, numElems) return builder:StartVector(4,
numElems, 4) end
+function Req.AddHeaders(builder, headers)
builder:PrependUOffsetTRelativeSlot(5, headers, 0) end
+function Req.StartHeadersVector(builder, numElems) return
builder:StartVector(4, numElems, 4) end
+function Req.AddConfToken(builder, confToken) builder:PrependUint32Slot(6,
confToken, 0) end
+function Req.AddExtraInfo(builder, extraInfo)
builder:PrependUOffsetTRelativeSlot(7, extraInfo, 0) end
+function Req.StartExtraInfoVector(builder, numElems) return
builder:StartVector(4, numElems, 4) end
+function Req.End(builder) return builder:EndObject() end
+
+return Req -- return the module
diff --git a/apisix/plugins/ext-plugin/A6/HTTPReqCall/Resp.lua
b/apisix/plugins/ext-plugin/A6/HTTPReqCall/Resp.lua
new file mode 100644
index 0000000..df4f52e
--- /dev/null
+++ b/apisix/plugins/ext-plugin/A6/HTTPReqCall/Resp.lua
@@ -0,0 +1,68 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- automatically generated by the FlatBuffers compiler, do not modify
+
+-- namespace: HTTPReqCall
+
+local flatbuffers = require('flatbuffers')
+
+local Resp = {} -- the module
+local Resp_mt = {} -- the class metatable
+
+function Resp.New()
+ local o = {}
+ setmetatable(o, {__index = Resp_mt})
+ return o
+end
+function Resp.GetRootAsResp(buf, offset)
+ local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
+ local o = Resp.New()
+ o:Init(buf, n + offset)
+ return o
+end
+function Resp_mt:Init(buf, pos)
+ self.view = flatbuffers.view.New(buf, pos)
+end
+function Resp_mt:Id()
+ local o = self.view:Offset(4)
+ if o ~= 0 then
+ return self.view:Get(flatbuffers.N.Uint32, o + self.view.pos)
+ end
+ return 0
+end
+function Resp_mt:ActionType()
+ local o = self.view:Offset(6)
+ if o ~= 0 then
+ return self.view:Get(flatbuffers.N.Uint8, o + self.view.pos)
+ end
+ return 0
+end
+function Resp_mt:Action()
+ local o = self.view:Offset(8)
+ if o ~= 0 then
+ local obj =
flatbuffers.view.New(require('flatbuffers.binaryarray').New(0), 0)
+ self.view:Union(obj, o)
+ return obj
+ end
+end
+function Resp.Start(builder) builder:StartObject(3) end
+function Resp.AddId(builder, id) builder:PrependUint32Slot(0, id, 0) end
+function Resp.AddActionType(builder, actionType) builder:PrependUint8Slot(1,
actionType, 0) end
+function Resp.AddAction(builder, action)
builder:PrependUOffsetTRelativeSlot(2, action, 0) end
+function Resp.End(builder) return builder:EndObject() end
+
+return Resp -- return the module
diff --git a/apisix/plugins/ext-plugin/A6/HTTPReqCall/Rewrite.lua
b/apisix/plugins/ext-plugin/A6/HTTPReqCall/Rewrite.lua
new file mode 100644
index 0000000..ca8058b
--- /dev/null
+++ b/apisix/plugins/ext-plugin/A6/HTTPReqCall/Rewrite.lua
@@ -0,0 +1,90 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- automatically generated by the FlatBuffers compiler, do not modify
+
+-- namespace: HTTPReqCall
+
+local flatbuffers = require('flatbuffers')
+
+local Rewrite = {} -- the module
+local Rewrite_mt = {} -- the class metatable
+
+function Rewrite.New()
+ local o = {}
+ setmetatable(o, {__index = Rewrite_mt})
+ return o
+end
+function Rewrite.GetRootAsRewrite(buf, offset)
+ local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
+ local o = Rewrite.New()
+ o:Init(buf, n + offset)
+ return o
+end
+function Rewrite_mt:Init(buf, pos)
+ self.view = flatbuffers.view.New(buf, pos)
+end
+function Rewrite_mt:Path()
+ local o = self.view:Offset(4)
+ if o ~= 0 then
+ return self.view:String(o + self.view.pos)
+ end
+end
+function Rewrite_mt:Headers(j)
+ local o = self.view:Offset(6)
+ if o ~= 0 then
+ local x = self.view:Vector(o)
+ x = x + ((j-1) * 4)
+ x = self.view:Indirect(x)
+ local obj = require('A6.TextEntry').New()
+ obj:Init(self.view.bytes, x)
+ return obj
+ end
+end
+function Rewrite_mt:HeadersLength()
+ local o = self.view:Offset(6)
+ if o ~= 0 then
+ return self.view:VectorLen(o)
+ end
+ return 0
+end
+function Rewrite_mt:Args(j)
+ local o = self.view:Offset(8)
+ if o ~= 0 then
+ local x = self.view:Vector(o)
+ x = x + ((j-1) * 4)
+ x = self.view:Indirect(x)
+ local obj = require('A6.TextEntry').New()
+ obj:Init(self.view.bytes, x)
+ return obj
+ end
+end
+function Rewrite_mt:ArgsLength()
+ local o = self.view:Offset(8)
+ if o ~= 0 then
+ return self.view:VectorLen(o)
+ end
+ return 0
+end
+function Rewrite.Start(builder) builder:StartObject(3) end
+function Rewrite.AddPath(builder, path) builder:PrependUOffsetTRelativeSlot(0,
path, 0) end
+function Rewrite.AddHeaders(builder, headers)
builder:PrependUOffsetTRelativeSlot(1, headers, 0) end
+function Rewrite.StartHeadersVector(builder, numElems) return
builder:StartVector(4, numElems, 4) end
+function Rewrite.AddArgs(builder, args) builder:PrependUOffsetTRelativeSlot(2,
args, 0) end
+function Rewrite.StartArgsVector(builder, numElems) return
builder:StartVector(4, numElems, 4) end
+function Rewrite.End(builder) return builder:EndObject() end
+
+return Rewrite -- return the module
diff --git a/apisix/plugins/ext-plugin/A6/HTTPReqCall/Stop.lua
b/apisix/plugins/ext-plugin/A6/HTTPReqCall/Stop.lua
new file mode 100644
index 0000000..0d41471
--- /dev/null
+++ b/apisix/plugins/ext-plugin/A6/HTTPReqCall/Stop.lua
@@ -0,0 +1,88 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- automatically generated by the FlatBuffers compiler, do not modify
+
+-- namespace: HTTPReqCall
+
+local flatbuffers = require('flatbuffers')
+
+local Stop = {} -- the module
+local Stop_mt = {} -- the class metatable
+
+function Stop.New()
+ local o = {}
+ setmetatable(o, {__index = Stop_mt})
+ return o
+end
+function Stop.GetRootAsStop(buf, offset)
+ local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
+ local o = Stop.New()
+ o:Init(buf, n + offset)
+ return o
+end
+function Stop_mt:Init(buf, pos)
+ self.view = flatbuffers.view.New(buf, pos)
+end
+function Stop_mt:Status()
+ local o = self.view:Offset(4)
+ if o ~= 0 then
+ return self.view:Get(flatbuffers.N.Uint16, o + self.view.pos)
+ end
+ return 0
+end
+function Stop_mt:Headers(j)
+ local o = self.view:Offset(6)
+ if o ~= 0 then
+ local x = self.view:Vector(o)
+ x = x + ((j-1) * 4)
+ x = self.view:Indirect(x)
+ local obj = require('A6.TextEntry').New()
+ obj:Init(self.view.bytes, x)
+ return obj
+ end
+end
+function Stop_mt:HeadersLength()
+ local o = self.view:Offset(6)
+ if o ~= 0 then
+ return self.view:VectorLen(o)
+ end
+ return 0
+end
+function Stop_mt:Body(j)
+ local o = self.view:Offset(8)
+ if o ~= 0 then
+ local a = self.view:Vector(o)
+ return self.view:Get(flatbuffers.N.Uint8, a + ((j-1) * 1))
+ end
+ return 0
+end
+function Stop_mt:BodyLength()
+ local o = self.view:Offset(8)
+ if o ~= 0 then
+ return self.view:VectorLen(o)
+ end
+ return 0
+end
+function Stop.Start(builder) builder:StartObject(3) end
+function Stop.AddStatus(builder, status) builder:PrependUint16Slot(0, status,
0) end
+function Stop.AddHeaders(builder, headers)
builder:PrependUOffsetTRelativeSlot(1, headers, 0) end
+function Stop.StartHeadersVector(builder, numElems) return
builder:StartVector(4, numElems, 4) end
+function Stop.AddBody(builder, body) builder:PrependUOffsetTRelativeSlot(2,
body, 0) end
+function Stop.StartBodyVector(builder, numElems) return builder:StartVector(1,
numElems, 1) end
+function Stop.End(builder) return builder:EndObject() end
+
+return Stop -- return the module
diff --git a/apisix/plugins/ext-plugin/A6/Method.lua
b/apisix/plugins/ext-plugin/A6/Method.lua
new file mode 100644
index 0000000..016d128
--- /dev/null
+++ b/apisix/plugins/ext-plugin/A6/Method.lua
@@ -0,0 +1,39 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- automatically generated by the FlatBuffers compiler, do not modify
+
+-- namespace: A6
+
+local Method = {
+ GET = 0,
+ HEAD = 1,
+ POST = 2,
+ PUT = 3,
+ DELETE = 4,
+ MKCOL = 5,
+ COPY = 6,
+ MOVE = 7,
+ OPTIONS = 8,
+ PROPFIND = 9,
+ PROPPATCH = 10,
+ LOCK = 11,
+ UNLOCK = 12,
+ PATCH = 13,
+ TRACE = 14,
+}
+
+return Method -- return the module
diff --git a/apisix/plugins/ext-plugin/A6/PrepareConf/Req.lua
b/apisix/plugins/ext-plugin/A6/PrepareConf/Req.lua
new file mode 100644
index 0000000..2006249
--- /dev/null
+++ b/apisix/plugins/ext-plugin/A6/PrepareConf/Req.lua
@@ -0,0 +1,63 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- automatically generated by the FlatBuffers compiler, do not modify
+
+-- namespace: PrepareConf
+
+local flatbuffers = require('flatbuffers')
+
+local Req = {} -- the module
+local Req_mt = {} -- the class metatable
+
+function Req.New()
+ local o = {}
+ setmetatable(o, {__index = Req_mt})
+ return o
+end
+function Req.GetRootAsReq(buf, offset)
+ local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
+ local o = Req.New()
+ o:Init(buf, n + offset)
+ return o
+end
+function Req_mt:Init(buf, pos)
+ self.view = flatbuffers.view.New(buf, pos)
+end
+function Req_mt:Conf(j)
+ local o = self.view:Offset(4)
+ if o ~= 0 then
+ local x = self.view:Vector(o)
+ x = x + ((j-1) * 4)
+ x = self.view:Indirect(x)
+ local obj = require('A6.TextEntry').New()
+ obj:Init(self.view.bytes, x)
+ return obj
+ end
+end
+function Req_mt:ConfLength()
+ local o = self.view:Offset(4)
+ if o ~= 0 then
+ return self.view:VectorLen(o)
+ end
+ return 0
+end
+function Req.Start(builder) builder:StartObject(1) end
+function Req.AddConf(builder, conf) builder:PrependUOffsetTRelativeSlot(0,
conf, 0) end
+function Req.StartConfVector(builder, numElems) return builder:StartVector(4,
numElems, 4) end
+function Req.End(builder) return builder:EndObject() end
+
+return Req -- return the module
diff --git a/apisix/plugins/ext-plugin/A6/PrepareConf/Resp.lua
b/apisix/plugins/ext-plugin/A6/PrepareConf/Resp.lua
new file mode 100644
index 0000000..6fb9780
--- /dev/null
+++ b/apisix/plugins/ext-plugin/A6/PrepareConf/Resp.lua
@@ -0,0 +1,51 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- automatically generated by the FlatBuffers compiler, do not modify
+
+-- namespace: PrepareConf
+
+local flatbuffers = require('flatbuffers')
+
+local Resp = {} -- the module
+local Resp_mt = {} -- the class metatable
+
+function Resp.New()
+ local o = {}
+ setmetatable(o, {__index = Resp_mt})
+ return o
+end
+function Resp.GetRootAsResp(buf, offset)
+ local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
+ local o = Resp.New()
+ o:Init(buf, n + offset)
+ return o
+end
+function Resp_mt:Init(buf, pos)
+ self.view = flatbuffers.view.New(buf, pos)
+end
+function Resp_mt:ConfToken()
+ local o = self.view:Offset(4)
+ if o ~= 0 then
+ return self.view:Get(flatbuffers.N.Uint32, o + self.view.pos)
+ end
+ return 0
+end
+function Resp.Start(builder) builder:StartObject(1) end
+function Resp.AddConfToken(builder, confToken) builder:PrependUint32Slot(0,
confToken, 0) end
+function Resp.End(builder) return builder:EndObject() end
+
+return Resp -- return the module
diff --git a/apisix/plugins/ext-plugin/A6/TextEntry.lua
b/apisix/plugins/ext-plugin/A6/TextEntry.lua
new file mode 100644
index 0000000..0e20074
--- /dev/null
+++ b/apisix/plugins/ext-plugin/A6/TextEntry.lua
@@ -0,0 +1,57 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- automatically generated by the FlatBuffers compiler, do not modify
+
+-- namespace: A6
+
+local flatbuffers = require('flatbuffers')
+
+local TextEntry = {} -- the module
+local TextEntry_mt = {} -- the class metatable
+
+function TextEntry.New()
+ local o = {}
+ setmetatable(o, {__index = TextEntry_mt})
+ return o
+end
+function TextEntry.GetRootAsTextEntry(buf, offset)
+ local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
+ local o = TextEntry.New()
+ o:Init(buf, n + offset)
+ return o
+end
+function TextEntry_mt:Init(buf, pos)
+ self.view = flatbuffers.view.New(buf, pos)
+end
+function TextEntry_mt:Name()
+ local o = self.view:Offset(4)
+ if o ~= 0 then
+ return self.view:String(o + self.view.pos)
+ end
+end
+function TextEntry_mt:Value()
+ local o = self.view:Offset(6)
+ if o ~= 0 then
+ return self.view:String(o + self.view.pos)
+ end
+end
+function TextEntry.Start(builder) builder:StartObject(2) end
+function TextEntry.AddName(builder, name)
builder:PrependUOffsetTRelativeSlot(0, name, 0) end
+function TextEntry.AddValue(builder, value)
builder:PrependUOffsetTRelativeSlot(1, value, 0) end
+function TextEntry.End(builder) return builder:EndObject() end
+
+return TextEntry -- return the module
diff --git a/apisix/plugins/ext-plugin/ext-plugin.fbs
b/apisix/plugins/ext-plugin/ext-plugin.fbs
new file mode 100644
index 0000000..05db413
--- /dev/null
+++ b/apisix/plugins/ext-plugin/ext-plugin.fbs
@@ -0,0 +1,109 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+namespace A6;
+
+table TextEntry {
+ name:string;
+ value:string;
+}
+
+table DataEntry {
+ name:string;
+ value:[ubyte];
+}
+
+enum Method:ubyte {
+ GET,
+ HEAD,
+ POST,
+ PUT,
+ DELETE,
+ MKCOL,
+ COPY,
+ MOVE,
+ OPTIONS,
+ PROPFIND,
+ PROPPATCH,
+ LOCK,
+ UNLOCK,
+ PATCH,
+ TRACE,
+}
+
+namespace A6.Err;
+
+enum Code:ubyte {
+ BAD_REQUEST,
+ SERVICE_UNAVAILABLE,
+ CONF_TOKEN_NOT_FOUND,
+}
+
+table Resp {
+ code:Code;
+}
+
+namespace A6.PrepareConf;
+
+table Req {
+ conf:[TextEntry];
+}
+
+table Resp {
+ conf_token:uint32;
+}
+
+namespace A6.HTTPReqCall;
+
+table Req {
+ id:uint32;
+
+ src_ip:[ubyte];
+
+ method:Method;
+
+ path:string;
+ args:[TextEntry];
+ headers:[TextEntry];
+
+ conf_token:uint32;
+
+ extra_info:[DataEntry];
+}
+
+table Stop {
+ status:uint16;
+ headers:[TextEntry];
+ body:[ubyte];
+}
+table Rewrite {
+ path:string;
+ headers:[TextEntry];
+ // Note that args are modified in full.
+ // Either empty, meaning no args need to be moved
+ // or the entire modified args, not the incrementally changed parts
+ args:[TextEntry];
+}
+
+union Action {
+ Stop,
+ Rewrite,
+}
+
+table Resp {
+ id:uint32;
+ action:Action;
+}
diff --git a/utils/check-lua-code-style.sh b/utils/check-lua-code-style.sh
index 59fe473..00f5ddb 100755
--- a/utils/check-lua-code-style.sh
+++ b/utils/check-lua-code-style.sh
@@ -21,7 +21,10 @@ set -ex
luacheck -q apisix t/lib
-find apisix -name '*.lua' ! -wholename 'apisix/cli/ngx_tpl.lua' -exec
./utils/lj-releng {} + > \
+find apisix -name '*.lua' \
+ ! -wholename 'apisix/cli/ngx_tpl.lua' \
+ ! -wholename 'apisix/plugins/ext-plugin/A6/*.lua' \
+ -exec ./utils/lj-releng {} + > \
/tmp/check.log 2>&1 || (cat /tmp/check.log && exit 1)
grep -E "ERROR.*.lua:" /tmp/check.log > /tmp/error.log || true