mirror of
https://github.com/sablierapp/sablier.git
synced 2025-12-21 13:23:03 +01:00
feat(plugin): add proxywasm plugin (#284)
* feat(plugin): add `proxywasm` plugin The `proxywasm` plugin is a WASM Filter following the ProxyWasm ABI Specification using the proxywasm go sdk This allows extensibility with any reverse proxy who implements the ProxyWasm ABI Specification. The current WASM Filter was successfully tested with APISIX, Envoy, Nginx with ngx_wasm_module from Kong and Istio. Fixes #145
This commit is contained in:
73
plugins/proxywasm/DynamicConfiguration_json.go
Normal file
73
plugins/proxywasm/DynamicConfiguration_json.go
Normal file
@@ -0,0 +1,73 @@
|
||||
package main
|
||||
|
||||
import jsoniter "github.com/json-iterator/tinygo"
|
||||
|
||||
type DynamicConfiguration_json struct {
|
||||
}
|
||||
func (json DynamicConfiguration_json) Type() interface{} {
|
||||
var val DynamicConfiguration
|
||||
return val
|
||||
}
|
||||
func (json DynamicConfiguration_json) Unmarshal(iter *jsoniter.Iterator, out interface{}) {
|
||||
DynamicConfiguration_json_unmarshal(iter, out.(*DynamicConfiguration))
|
||||
}
|
||||
func (json DynamicConfiguration_json) Marshal(stream *jsoniter.Stream, val interface{}) {
|
||||
DynamicConfiguration_json_marshal(stream, val.(DynamicConfiguration))
|
||||
}
|
||||
func DynamicConfiguration_json_unmarshal(iter *jsoniter.Iterator, out *DynamicConfiguration) {
|
||||
more := iter.ReadObjectHead()
|
||||
for more {
|
||||
field := iter.ReadObjectField()
|
||||
if !DynamicConfiguration_json_unmarshal_field(iter, field, out) {
|
||||
iter.Skip()
|
||||
}
|
||||
more = iter.ReadObjectMore()
|
||||
}
|
||||
}
|
||||
func DynamicConfiguration_json_unmarshal_field(iter *jsoniter.Iterator, field string, out *DynamicConfiguration) bool {
|
||||
switch {
|
||||
case field == `display_name`:
|
||||
iter.ReadString(&(*out).DisplayName)
|
||||
return true
|
||||
case field == `show_details`:
|
||||
DynamicConfiguration_ptr1_json_unmarshal(iter, &(*out).ShowDetails)
|
||||
return true
|
||||
case field == `theme`:
|
||||
iter.ReadString(&(*out).Theme)
|
||||
return true
|
||||
case field == `refresh_frequency`:
|
||||
iter.ReadString(&(*out).RefreshFrequency)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
func DynamicConfiguration_ptr1_json_unmarshal (iter *jsoniter.Iterator, out **bool) {
|
||||
var val bool
|
||||
iter.ReadBool(&val)
|
||||
if iter.Error == nil {
|
||||
*out = &val
|
||||
}
|
||||
}
|
||||
func DynamicConfiguration_json_marshal(stream *jsoniter.Stream, val DynamicConfiguration) {
|
||||
stream.WriteObjectHead()
|
||||
DynamicConfiguration_json_marshal_field(stream, val)
|
||||
stream.WriteObjectTail()
|
||||
}
|
||||
func DynamicConfiguration_json_marshal_field(stream *jsoniter.Stream, val DynamicConfiguration) {
|
||||
stream.WriteObjectField(`display_name`)
|
||||
stream.WriteString(val.DisplayName)
|
||||
stream.WriteMore()
|
||||
stream.WriteObjectField(`show_details`)
|
||||
if val.ShowDetails == nil {
|
||||
stream.WriteNull()
|
||||
} else {
|
||||
stream.WriteBool(*val.ShowDetails)
|
||||
}
|
||||
stream.WriteMore()
|
||||
stream.WriteObjectField(`theme`)
|
||||
stream.WriteString(val.Theme)
|
||||
stream.WriteMore()
|
||||
stream.WriteObjectField(`refresh_frequency`)
|
||||
stream.WriteString(val.RefreshFrequency)
|
||||
stream.WriteMore()
|
||||
}
|
||||
Reference in New Issue
Block a user