Commit Graph

27 Commits

Author SHA1 Message Date
Anthony Rubick
1c84a8f9cf fix: remove events import from zoraxy_plugin
The import, when the code is copied to develop a plugin, results an invalid path.

Fixing the path manually as a plugin developer is easy, but it shouldn't be necessary.
To fix that, the type is replaced with a string in zoraxy_plugin.IntroSpect and validation is added to lifecycle.go to ensure all subscribed events are valid.

A downside is that the list of validEventNames has to be updated whenever a new event is created, but this is mitigated by placing definitions of that list and the actual event names right next to each other.
2025-09-06 16:45:02 -05:00
Anthony Rubick
22d2a0c6ca refactor: move event types into own submodule 2025-08-31 21:27:45 -05:00
Anthony Rubick
f45d5f46b4 refactor(events): extract event system to own module and generalize subscriber handling 2025-08-24 18:46:03 -05:00
Anthony Rubick
d74ecb2444 fix: event deserialization 2025-08-19 19:09:50 -05:00
Anthony Rubick
fe2db92392 test: event deserialization 2025-08-19 19:09:50 -05:00
Anthony Rubick
d6c907b13f feat: add function to assist parsing events 2025-08-19 19:09:49 -05:00
Anthony Rubick
9c99f6c734 feat(plugins): Implement event system w/ POC events
Implements the partially created event system with 3 events implemented as proof of concepts.

The 3 events are:
- `blacklistedIpBlocked`: emitted when a request from a blacklisted IP
- `accessRuleCreated`: emitted when a new access rule is created
- `blacklistToggled`: emitted when the blacklist is toggled for a given access rule

Why these events? Because these are the ones I forsee myself needing in the next version of the zoraxy_crowdsec_bouncer

Events are dispatched via a global event manager `plugins.EventSystem.Emit`
2025-08-19 19:08:46 -05:00
Toby Chui
2daf3cd2cb Optimized plugin examples
- Fixed build script bug in plugin module copy logic
- Fixed plugin example typos
- Fixed the missing embeded web server handleFunc interface
2025-08-17 10:34:10 +08:00
Anthony Rubick
dd93f9a2c4 feat(plugins): Implement plugin API key management and authentication middleware
The purpose of this is to allow plugins to access certain internal APIs via

- Added PluginAPIKey and APIKeyManager for managing API keys associated with plugins.
- Introduced PluginAuthMiddleware to handle API key validation for plugin requests.
- Updated RouterDef to support plugin accessible endpoints with authentication.
- Modified various API registration functions to include plugin accessibility checks.
- Enhanced plugin lifecycle management to generate and revoke API keys as needed.
- Updated plugin specifications to include permitted API endpoints for access control.
2025-07-17 22:20:09 -07:00
Anthony Rubick
100c1e9c04 fix: typo in dynamic_router.go
SniffResultAccpet should be SniffResultAccept
2025-07-15 22:05:06 -07:00
Toby Chui
877692695e Added #653
- Added dev mode plugin auto-reload
- Optimized struct in plugin manager options
2025-05-11 14:02:07 +08:00
Toby Chui
ffc67ede12 Added working plugin store prototype
- Added plugin install and remove api
2025-04-24 21:19:16 +08:00
Toby Chui
6750c7fe3d Added wip plugin store
- Added plugin store snippet
- Added plugin list sync functions
- Work in progress install / uninstall plugin function
2025-04-22 07:15:30 +08:00
Toby Chui
136989f2ea Added plugin dir parameter
- Added plugin dir parameter
- Fixed critical architectural bug that effects plugin UI in production mode
- Updated implementation of embed FS routing
- Minor dark theme update
- Fixed ztnc UI bug for msgbox and confirm box
2025-03-28 21:24:18 +08:00
Toby Chui
0fdfda436b Added plugin info view
- Added plugin info view
- Removed zerotier related start parameters
- Added automatic tag filter reset on tab change in http proxy page
2025-03-16 11:41:46 +08:00
Toby Chui
f8270e46c2 Added UI for plugin system and upnp example
- Added wip UI for plugin tag system
- Added upnp port forwarder plugin
- Added error and fatal printout for plugins
- Optimized UI flow for plugin context window
- Added dev web server for plugin development purpose
2025-03-15 21:02:44 +08:00
Toby Chui
4a99afa2f0 Fixed deadlock in plugin manager close
- Moved all mutex away from defer
- Updated plugin manager close logic to prevent deadlock
2025-03-11 21:22:09 +08:00
Toby Chui
dfd5ef5578 Modernized dpcore code
- Rewritten dpcore transport object with deprecated API removed
- Optimized concurrent connection counts from 32 to 256
- Updated random port range for plugins
- Added debug output to plugin library
2025-03-10 22:00:33 +08:00
Toby Chui
3e57a90bb6 Fixed #573
- Added whitelist loopback quick toggle
- Fixed plugin exit stuck bug
2025-03-09 17:02:48 +08:00
Toby Chui
23d4df1ed7 Added dynamic capture capabilities to plugin API
- Added dynamic capture ingress and sniff endpoint
- Removed static capture example (API update)
2025-03-02 12:26:44 +08:00
Toby Chui
39d6d16c2a Updated plugin interface
- Updated plugin interface to support static path routing
- Added autosave for statistic data (workaround for #561)
2025-03-02 09:15:50 +08:00
Toby Chui
28a0a837ba Plugin lifecycle optimization
- Added term flow before plugin is killed
- Updated example implementations
- Added SIGINT to Zoraxy for shutdown sequence (Fixes #561 ?)
2025-03-01 10:00:33 +08:00
Toby Chui
5abc4ac606 Added plugin context view
- Added plugin context view
- Moved plugin type definition to separate file
- Added wip request forwarder
2025-02-28 22:05:14 +08:00
Toby Chui
53657e8716 Added embed server for plugin library
- Added embeded resources server for plugin library
- Added ztnc plugin for global area network
- Added wide mode for side wrapper
2025-02-28 15:46:57 +08:00
Toby Chui
bddff0cf2f Added working plugin manager prototype
- Added experimental plugin UI proxy
- Added plugin icon loader
- Added plugin table renderer
2025-02-27 22:27:13 +08:00
Toby Chui
ad13b33283 Added plugin prototype
- Added proof of concept plugin prototype
- Added wip plugin page
2025-02-25 21:14:03 +08:00
Toby Chui
1116b643b5 Added plugin interface definations
- Added wip plugin interface
- Merged in PR for lego update
- Minor code optimization
2025-02-19 21:25:50 +08:00