mirror of
https://github.com/openappsec/attachment.git
synced 2025-06-28 16:41:03 +03:00
fix config.go file
This commit is contained in:
parent
5962caf2e9
commit
589aafdd1f
@ -60,7 +60,6 @@ func getEnvoyConcurrency() int {
|
|||||||
api.LogWarnf("using number of CPU cores")
|
api.LogWarnf("using number of CPU cores")
|
||||||
return runtime.NumCPU()
|
return runtime.NumCPU()
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
var conc_number string
|
var conc_number string
|
||||||
|
|
||||||
@ -156,8 +155,7 @@ func configurationServer() {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
last_keep_alive = time.Time{}
|
last_keep_alive = time.Time{}
|
||||||
envoyHttp.RegisterHttpFilterFactoryAndConfigParser(Name, ConfigFactory, &parser{})
|
envoyHttp.RegisterHttpFilterConfigFactoryAndParser(Name, ConfigFactory, &parser{})
|
||||||
|
|
||||||
go configurationServer()
|
go configurationServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,12 +240,13 @@ func (p *parser) Merge(parent interface{}, child interface{}) interface{} {
|
|||||||
return &newConfig
|
return &newConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConfigFactory(c interface{}, callbacks api.FilterCallbackHandler) api.StreamFilter {
|
func ConfigFactory(c interface{}) api.StreamFilterFactory {
|
||||||
conf, ok := c.(*config)
|
conf, ok := c.(*config)
|
||||||
if !ok {
|
if !ok {
|
||||||
panic("unexpected config type")
|
panic("unexpected config type")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return func(callbacks api.FilterCallbackHandler) api.StreamFilter {
|
||||||
worker_thread_id := int(C.get_thread_id())
|
worker_thread_id := int(C.get_thread_id())
|
||||||
api.LogDebugf("worker_thread_id: %d", worker_thread_id)
|
api.LogDebugf("worker_thread_id: %d", worker_thread_id)
|
||||||
if _, ok := thread_to_attachment_mapping[int(worker_thread_id)]; !ok {
|
if _, ok := thread_to_attachment_mapping[int(worker_thread_id)]; !ok {
|
||||||
@ -281,5 +280,6 @@ func ConfigFactory(c interface{}, callbacks api.FilterCallbackHandler) api.Strea
|
|||||||
request_structs: attachment_to_filter_request_structs[worker_id],
|
request_structs: attachment_to_filter_request_structs[worker_id],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func main() {}
|
func main() {}
|
||||||
|
@ -60,7 +60,6 @@ func getEnvoyConcurrency() int {
|
|||||||
api.LogWarnf("using number of CPU cores")
|
api.LogWarnf("using number of CPU cores")
|
||||||
return runtime.NumCPU()
|
return runtime.NumCPU()
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
var conc_number string
|
var conc_number string
|
||||||
|
|
||||||
@ -156,8 +155,7 @@ func configurationServer() {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
last_keep_alive = time.Time{}
|
last_keep_alive = time.Time{}
|
||||||
envoyHttp.RegisterHttpFilterFactoryAndConfigParser(Name, ConfigFactory, &parser{})
|
envoyHttp.RegisterHttpFilterConfigFactoryAndParser(Name, ConfigFactory, &parser{})
|
||||||
|
|
||||||
go configurationServer()
|
go configurationServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,12 +240,13 @@ func (p *parser) Merge(parent interface{}, child interface{}) interface{} {
|
|||||||
return &newConfig
|
return &newConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConfigFactory(c interface{}, callbacks api.FilterCallbackHandler) api.StreamFilter {
|
func ConfigFactory(c interface{}) api.StreamFilterFactory {
|
||||||
conf, ok := c.(*config)
|
conf, ok := c.(*config)
|
||||||
if !ok {
|
if !ok {
|
||||||
panic("unexpected config type")
|
panic("unexpected config type")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return func(callbacks api.FilterCallbackHandler) api.StreamFilter {
|
||||||
worker_thread_id := int(C.get_thread_id())
|
worker_thread_id := int(C.get_thread_id())
|
||||||
api.LogDebugf("worker_thread_id: %d", worker_thread_id)
|
api.LogDebugf("worker_thread_id: %d", worker_thread_id)
|
||||||
if _, ok := thread_to_attachment_mapping[int(worker_thread_id)]; !ok {
|
if _, ok := thread_to_attachment_mapping[int(worker_thread_id)]; !ok {
|
||||||
@ -281,5 +280,6 @@ func ConfigFactory(c interface{}, callbacks api.FilterCallbackHandler) api.Strea
|
|||||||
request_structs: attachment_to_filter_request_structs[worker_id],
|
request_structs: attachment_to_filter_request_structs[worker_id],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func main() {}
|
func main() {}
|
||||||
|
@ -60,7 +60,6 @@ func getEnvoyConcurrency() int {
|
|||||||
api.LogWarnf("using number of CPU cores")
|
api.LogWarnf("using number of CPU cores")
|
||||||
return runtime.NumCPU()
|
return runtime.NumCPU()
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
var conc_number string
|
var conc_number string
|
||||||
|
|
||||||
@ -156,8 +155,7 @@ func configurationServer() {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
last_keep_alive = time.Time{}
|
last_keep_alive = time.Time{}
|
||||||
envoyHttp.RegisterHttpFilterFactoryAndConfigParser(Name, ConfigFactory, &parser{})
|
envoyHttp.RegisterHttpFilterConfigFactoryAndParser(Name, ConfigFactory, &parser{})
|
||||||
|
|
||||||
go configurationServer()
|
go configurationServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,12 +240,13 @@ func (p *parser) Merge(parent interface{}, child interface{}) interface{} {
|
|||||||
return &newConfig
|
return &newConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConfigFactory(c interface{}, callbacks api.FilterCallbackHandler) api.StreamFilter {
|
func ConfigFactory(c interface{}) api.StreamFilterFactory {
|
||||||
conf, ok := c.(*config)
|
conf, ok := c.(*config)
|
||||||
if !ok {
|
if !ok {
|
||||||
panic("unexpected config type")
|
panic("unexpected config type")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return func(callbacks api.FilterCallbackHandler) api.StreamFilter {
|
||||||
worker_thread_id := int(C.get_thread_id())
|
worker_thread_id := int(C.get_thread_id())
|
||||||
api.LogDebugf("worker_thread_id: %d", worker_thread_id)
|
api.LogDebugf("worker_thread_id: %d", worker_thread_id)
|
||||||
if _, ok := thread_to_attachment_mapping[int(worker_thread_id)]; !ok {
|
if _, ok := thread_to_attachment_mapping[int(worker_thread_id)]; !ok {
|
||||||
@ -281,5 +280,6 @@ func ConfigFactory(c interface{}, callbacks api.FilterCallbackHandler) api.Strea
|
|||||||
request_structs: attachment_to_filter_request_structs[worker_id],
|
request_structs: attachment_to_filter_request_structs[worker_id],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func main() {}
|
func main() {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user