diff --git a/example/plugins/api-call-example/mod/zoraxy_plugin/events/events.go b/example/plugins/api-call-example/mod/zoraxy_plugin/events/events.go index c743ec6..df61861 100644 --- a/example/plugins/api-call-example/mod/zoraxy_plugin/events/events.go +++ b/example/plugins/api-call-example/mod/zoraxy_plugin/events/events.go @@ -12,6 +12,9 @@ type EventName string type EventPayload interface { // GetName returns the event type GetName() EventName + + // Returns the "source" of the event, that is, the component or plugin that emitted the event + GetEventSource() string } // Event represents a system event @@ -62,6 +65,10 @@ func (e *BlacklistedIPBlockedEvent) GetName() EventName { return EventBlacklistedIPBlocked } +func (e *BlacklistedIPBlockedEvent) GetEventSource() string { + return "proxy-access" +} + // BlacklistToggledEvent represents an event when the blacklist is disabled for an access rule type BlacklistToggledEvent struct { RuleID string `json:"rule_id"` @@ -72,6 +79,10 @@ func (e *BlacklistToggledEvent) GetName() EventName { return EventBlacklistToggled } +func (e *BlacklistToggledEvent) GetEventSource() string { + return "accesslist-api" +} + // AccessRuleCreatedEvent represents an event when a new access ruleset is created type AccessRuleCreatedEvent struct { ID string `json:"id"` @@ -85,6 +96,10 @@ func (e *AccessRuleCreatedEvent) GetName() EventName { return EventAccessRuleCreated } +func (e *AccessRuleCreatedEvent) GetEventSource() string { + return "accesslist-api" +} + // ParseEvent parses a JSON byte slice into an Event struct func ParseEvent(jsonData []byte, event *Event) error { // First, determine the event type, and parse shared fields, from the JSON data diff --git a/example/plugins/debugger/mod/zoraxy_plugin/events/events.go b/example/plugins/debugger/mod/zoraxy_plugin/events/events.go index c743ec6..df61861 100644 --- a/example/plugins/debugger/mod/zoraxy_plugin/events/events.go +++ b/example/plugins/debugger/mod/zoraxy_plugin/events/events.go @@ -12,6 +12,9 @@ type EventName string type EventPayload interface { // GetName returns the event type GetName() EventName + + // Returns the "source" of the event, that is, the component or plugin that emitted the event + GetEventSource() string } // Event represents a system event @@ -62,6 +65,10 @@ func (e *BlacklistedIPBlockedEvent) GetName() EventName { return EventBlacklistedIPBlocked } +func (e *BlacklistedIPBlockedEvent) GetEventSource() string { + return "proxy-access" +} + // BlacklistToggledEvent represents an event when the blacklist is disabled for an access rule type BlacklistToggledEvent struct { RuleID string `json:"rule_id"` @@ -72,6 +79,10 @@ func (e *BlacklistToggledEvent) GetName() EventName { return EventBlacklistToggled } +func (e *BlacklistToggledEvent) GetEventSource() string { + return "accesslist-api" +} + // AccessRuleCreatedEvent represents an event when a new access ruleset is created type AccessRuleCreatedEvent struct { ID string `json:"id"` @@ -85,6 +96,10 @@ func (e *AccessRuleCreatedEvent) GetName() EventName { return EventAccessRuleCreated } +func (e *AccessRuleCreatedEvent) GetEventSource() string { + return "accesslist-api" +} + // ParseEvent parses a JSON byte slice into an Event struct func ParseEvent(jsonData []byte, event *Event) error { // First, determine the event type, and parse shared fields, from the JSON data diff --git a/example/plugins/dynamic-capture-example/mod/zoraxy_plugin/events/events.go b/example/plugins/dynamic-capture-example/mod/zoraxy_plugin/events/events.go index c743ec6..df61861 100644 --- a/example/plugins/dynamic-capture-example/mod/zoraxy_plugin/events/events.go +++ b/example/plugins/dynamic-capture-example/mod/zoraxy_plugin/events/events.go @@ -12,6 +12,9 @@ type EventName string type EventPayload interface { // GetName returns the event type GetName() EventName + + // Returns the "source" of the event, that is, the component or plugin that emitted the event + GetEventSource() string } // Event represents a system event @@ -62,6 +65,10 @@ func (e *BlacklistedIPBlockedEvent) GetName() EventName { return EventBlacklistedIPBlocked } +func (e *BlacklistedIPBlockedEvent) GetEventSource() string { + return "proxy-access" +} + // BlacklistToggledEvent represents an event when the blacklist is disabled for an access rule type BlacklistToggledEvent struct { RuleID string `json:"rule_id"` @@ -72,6 +79,10 @@ func (e *BlacklistToggledEvent) GetName() EventName { return EventBlacklistToggled } +func (e *BlacklistToggledEvent) GetEventSource() string { + return "accesslist-api" +} + // AccessRuleCreatedEvent represents an event when a new access ruleset is created type AccessRuleCreatedEvent struct { ID string `json:"id"` @@ -85,6 +96,10 @@ func (e *AccessRuleCreatedEvent) GetName() EventName { return EventAccessRuleCreated } +func (e *AccessRuleCreatedEvent) GetEventSource() string { + return "accesslist-api" +} + // ParseEvent parses a JSON byte slice into an Event struct func ParseEvent(jsonData []byte, event *Event) error { // First, determine the event type, and parse shared fields, from the JSON data diff --git a/example/plugins/event-subscriber-example/mod/zoraxy_plugin/events/events.go b/example/plugins/event-subscriber-example/mod/zoraxy_plugin/events/events.go index c743ec6..df61861 100644 --- a/example/plugins/event-subscriber-example/mod/zoraxy_plugin/events/events.go +++ b/example/plugins/event-subscriber-example/mod/zoraxy_plugin/events/events.go @@ -12,6 +12,9 @@ type EventName string type EventPayload interface { // GetName returns the event type GetName() EventName + + // Returns the "source" of the event, that is, the component or plugin that emitted the event + GetEventSource() string } // Event represents a system event @@ -62,6 +65,10 @@ func (e *BlacklistedIPBlockedEvent) GetName() EventName { return EventBlacklistedIPBlocked } +func (e *BlacklistedIPBlockedEvent) GetEventSource() string { + return "proxy-access" +} + // BlacklistToggledEvent represents an event when the blacklist is disabled for an access rule type BlacklistToggledEvent struct { RuleID string `json:"rule_id"` @@ -72,6 +79,10 @@ func (e *BlacklistToggledEvent) GetName() EventName { return EventBlacklistToggled } +func (e *BlacklistToggledEvent) GetEventSource() string { + return "accesslist-api" +} + // AccessRuleCreatedEvent represents an event when a new access ruleset is created type AccessRuleCreatedEvent struct { ID string `json:"id"` @@ -85,6 +96,10 @@ func (e *AccessRuleCreatedEvent) GetName() EventName { return EventAccessRuleCreated } +func (e *AccessRuleCreatedEvent) GetEventSource() string { + return "accesslist-api" +} + // ParseEvent parses a JSON byte slice into an Event struct func ParseEvent(jsonData []byte, event *Event) error { // First, determine the event type, and parse shared fields, from the JSON data diff --git a/example/plugins/helloworld/mod/zoraxy_plugin/events/events.go b/example/plugins/helloworld/mod/zoraxy_plugin/events/events.go index c743ec6..df61861 100644 --- a/example/plugins/helloworld/mod/zoraxy_plugin/events/events.go +++ b/example/plugins/helloworld/mod/zoraxy_plugin/events/events.go @@ -12,6 +12,9 @@ type EventName string type EventPayload interface { // GetName returns the event type GetName() EventName + + // Returns the "source" of the event, that is, the component or plugin that emitted the event + GetEventSource() string } // Event represents a system event @@ -62,6 +65,10 @@ func (e *BlacklistedIPBlockedEvent) GetName() EventName { return EventBlacklistedIPBlocked } +func (e *BlacklistedIPBlockedEvent) GetEventSource() string { + return "proxy-access" +} + // BlacklistToggledEvent represents an event when the blacklist is disabled for an access rule type BlacklistToggledEvent struct { RuleID string `json:"rule_id"` @@ -72,6 +79,10 @@ func (e *BlacklistToggledEvent) GetName() EventName { return EventBlacklistToggled } +func (e *BlacklistToggledEvent) GetEventSource() string { + return "accesslist-api" +} + // AccessRuleCreatedEvent represents an event when a new access ruleset is created type AccessRuleCreatedEvent struct { ID string `json:"id"` @@ -85,6 +96,10 @@ func (e *AccessRuleCreatedEvent) GetName() EventName { return EventAccessRuleCreated } +func (e *AccessRuleCreatedEvent) GetEventSource() string { + return "accesslist-api" +} + // ParseEvent parses a JSON byte slice into an Event struct func ParseEvent(jsonData []byte, event *Event) error { // First, determine the event type, and parse shared fields, from the JSON data diff --git a/example/plugins/restful-example/mod/zoraxy_plugin/events/events.go b/example/plugins/restful-example/mod/zoraxy_plugin/events/events.go index c743ec6..df61861 100644 --- a/example/plugins/restful-example/mod/zoraxy_plugin/events/events.go +++ b/example/plugins/restful-example/mod/zoraxy_plugin/events/events.go @@ -12,6 +12,9 @@ type EventName string type EventPayload interface { // GetName returns the event type GetName() EventName + + // Returns the "source" of the event, that is, the component or plugin that emitted the event + GetEventSource() string } // Event represents a system event @@ -62,6 +65,10 @@ func (e *BlacklistedIPBlockedEvent) GetName() EventName { return EventBlacklistedIPBlocked } +func (e *BlacklistedIPBlockedEvent) GetEventSource() string { + return "proxy-access" +} + // BlacklistToggledEvent represents an event when the blacklist is disabled for an access rule type BlacklistToggledEvent struct { RuleID string `json:"rule_id"` @@ -72,6 +79,10 @@ func (e *BlacklistToggledEvent) GetName() EventName { return EventBlacklistToggled } +func (e *BlacklistToggledEvent) GetEventSource() string { + return "accesslist-api" +} + // AccessRuleCreatedEvent represents an event when a new access ruleset is created type AccessRuleCreatedEvent struct { ID string `json:"id"` @@ -85,6 +96,10 @@ func (e *AccessRuleCreatedEvent) GetName() EventName { return EventAccessRuleCreated } +func (e *AccessRuleCreatedEvent) GetEventSource() string { + return "accesslist-api" +} + // ParseEvent parses a JSON byte slice into an Event struct func ParseEvent(jsonData []byte, event *Event) error { // First, determine the event type, and parse shared fields, from the JSON data diff --git a/example/plugins/static-capture-example/mod/zoraxy_plugin/events/events.go b/example/plugins/static-capture-example/mod/zoraxy_plugin/events/events.go index c743ec6..df61861 100644 --- a/example/plugins/static-capture-example/mod/zoraxy_plugin/events/events.go +++ b/example/plugins/static-capture-example/mod/zoraxy_plugin/events/events.go @@ -12,6 +12,9 @@ type EventName string type EventPayload interface { // GetName returns the event type GetName() EventName + + // Returns the "source" of the event, that is, the component or plugin that emitted the event + GetEventSource() string } // Event represents a system event @@ -62,6 +65,10 @@ func (e *BlacklistedIPBlockedEvent) GetName() EventName { return EventBlacklistedIPBlocked } +func (e *BlacklistedIPBlockedEvent) GetEventSource() string { + return "proxy-access" +} + // BlacklistToggledEvent represents an event when the blacklist is disabled for an access rule type BlacklistToggledEvent struct { RuleID string `json:"rule_id"` @@ -72,6 +79,10 @@ func (e *BlacklistToggledEvent) GetName() EventName { return EventBlacklistToggled } +func (e *BlacklistToggledEvent) GetEventSource() string { + return "accesslist-api" +} + // AccessRuleCreatedEvent represents an event when a new access ruleset is created type AccessRuleCreatedEvent struct { ID string `json:"id"` @@ -85,6 +96,10 @@ func (e *AccessRuleCreatedEvent) GetName() EventName { return EventAccessRuleCreated } +func (e *AccessRuleCreatedEvent) GetEventSource() string { + return "accesslist-api" +} + // ParseEvent parses a JSON byte slice into an Event struct func ParseEvent(jsonData []byte, event *Event) error { // First, determine the event type, and parse shared fields, from the JSON data diff --git a/example/plugins/upnp/mod/zoraxy_plugin/events/events.go b/example/plugins/upnp/mod/zoraxy_plugin/events/events.go index c743ec6..df61861 100644 --- a/example/plugins/upnp/mod/zoraxy_plugin/events/events.go +++ b/example/plugins/upnp/mod/zoraxy_plugin/events/events.go @@ -12,6 +12,9 @@ type EventName string type EventPayload interface { // GetName returns the event type GetName() EventName + + // Returns the "source" of the event, that is, the component or plugin that emitted the event + GetEventSource() string } // Event represents a system event @@ -62,6 +65,10 @@ func (e *BlacklistedIPBlockedEvent) GetName() EventName { return EventBlacklistedIPBlocked } +func (e *BlacklistedIPBlockedEvent) GetEventSource() string { + return "proxy-access" +} + // BlacklistToggledEvent represents an event when the blacklist is disabled for an access rule type BlacklistToggledEvent struct { RuleID string `json:"rule_id"` @@ -72,6 +79,10 @@ func (e *BlacklistToggledEvent) GetName() EventName { return EventBlacklistToggled } +func (e *BlacklistToggledEvent) GetEventSource() string { + return "accesslist-api" +} + // AccessRuleCreatedEvent represents an event when a new access ruleset is created type AccessRuleCreatedEvent struct { ID string `json:"id"` @@ -85,6 +96,10 @@ func (e *AccessRuleCreatedEvent) GetName() EventName { return EventAccessRuleCreated } +func (e *AccessRuleCreatedEvent) GetEventSource() string { + return "accesslist-api" +} + // ParseEvent parses a JSON byte slice into an Event struct func ParseEvent(jsonData []byte, event *Event) error { // First, determine the event type, and parse shared fields, from the JSON data diff --git a/src/mod/plugins/zoraxy_plugin/events/events.go b/src/mod/plugins/zoraxy_plugin/events/events.go index c743ec6..df61861 100644 --- a/src/mod/plugins/zoraxy_plugin/events/events.go +++ b/src/mod/plugins/zoraxy_plugin/events/events.go @@ -12,6 +12,9 @@ type EventName string type EventPayload interface { // GetName returns the event type GetName() EventName + + // Returns the "source" of the event, that is, the component or plugin that emitted the event + GetEventSource() string } // Event represents a system event @@ -62,6 +65,10 @@ func (e *BlacklistedIPBlockedEvent) GetName() EventName { return EventBlacklistedIPBlocked } +func (e *BlacklistedIPBlockedEvent) GetEventSource() string { + return "proxy-access" +} + // BlacklistToggledEvent represents an event when the blacklist is disabled for an access rule type BlacklistToggledEvent struct { RuleID string `json:"rule_id"` @@ -72,6 +79,10 @@ func (e *BlacklistToggledEvent) GetName() EventName { return EventBlacklistToggled } +func (e *BlacklistToggledEvent) GetEventSource() string { + return "accesslist-api" +} + // AccessRuleCreatedEvent represents an event when a new access ruleset is created type AccessRuleCreatedEvent struct { ID string `json:"id"` @@ -85,6 +96,10 @@ func (e *AccessRuleCreatedEvent) GetName() EventName { return EventAccessRuleCreated } +func (e *AccessRuleCreatedEvent) GetEventSource() string { + return "accesslist-api" +} + // ParseEvent parses a JSON byte slice into an Event struct func ParseEvent(jsonData []byte, event *Event) error { // First, determine the event type, and parse shared fields, from the JSON data