mirror of
https://github.com/safing/portmaster
synced 2025-09-10 23:14:35 +00:00
netquery: add batch-query handler
This commit is contained in:
parent
2603e42d4e
commit
6e7792f29e
3 changed files with 134 additions and 0 deletions
|
@ -82,6 +82,11 @@ func (m *module) prepare() error {
|
|||
IsDevMode: config.Concurrent.GetAsBool(config.CfgDevModeKey, false),
|
||||
}
|
||||
|
||||
batchHander := &BatchQueryHandler{
|
||||
Database: m.Store,
|
||||
IsDevMode: config.Concurrent.GetAsBool(config.CfgDevModeKey, false),
|
||||
}
|
||||
|
||||
chartHandler := &ChartHandler{
|
||||
Database: m.Store,
|
||||
}
|
||||
|
@ -99,6 +104,19 @@ func (m *module) prepare() error {
|
|||
return fmt.Errorf("failed to register API endpoint: %w", err)
|
||||
}
|
||||
|
||||
if err := api.RegisterEndpoint(api.Endpoint{
|
||||
Name: "Batch Query Connections",
|
||||
Description: "Batch query the in-memory sqlite connection database.",
|
||||
Path: "netquery/query/batch",
|
||||
MimeType: "application/json",
|
||||
Read: api.PermitUser, // Needs read+write as the query is sent using POST data.
|
||||
Write: api.PermitUser, // Needs read+write as the query is sent using POST data.
|
||||
BelongsTo: m.Module,
|
||||
HandlerFunc: servertiming.Middleware(batchHander, nil).ServeHTTP,
|
||||
}); err != nil {
|
||||
return fmt.Errorf("failed to register API endpoint: %w", err)
|
||||
}
|
||||
|
||||
if err := api.RegisterEndpoint(api.Endpoint{
|
||||
Name: "Active Connections Chart",
|
||||
Description: "Query the in-memory sqlite connection database and return a chart of active connections.",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue