feat: Add ProxyStarted webhook event for dynamic port notification #5120
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add a new
ProxyStartedserver plugin webhook event that fires after a proxy has been successfully started and port allocation is complete.Problem
The existing
NewProxywebhook event fires before port allocation occurs. This means:remotePort = 0for dynamic port allocation, the webhook only receivesremote_port: 0NewUserConnevents to discover the negotiated portSolution
Add a new
ProxyStartedwebhook event that:remote_addrwith the actual allocated port (e.g.,:10000)CloseProxyfor consistencyUse Cases
Changes
pkg/plugin/server/types.go- AddProxyStartedContenttypepkg/plugin/server/plugin.go- AddOpProxyStartedconstantpkg/plugin/server/manager.go- AddproxyStartedPluginsslice andProxyStarted()methodpkg/config/v1/validation/validation.go- AddProxyStartedtoSupportedHTTPPluginOpsserver/control.go- CallProxyStartedwebhook after successful proxy registrationdoc/server_plugin.md- Update documentationConfiguration
Webhook Payload
{ "version": "0.1.0", "op": "ProxyStarted", "content": { "user": { "user": "myuser", "metas": {"key": "value"}, "run_id": "abc123" }, "proxy_name": "my-tcp-proxy", "proxy_type": "tcp", "remote_addr": ":10000" } }Comparison: NewProxy vs ProxyStarted
remote_port/remote_addrNewProxyProxyStartedBackward Compatibility
This is a purely additive change: