mirror of https://github.com/h44z/wg-portal.git
72 lines
1.9 KiB
Go
72 lines
1.9 KiB
Go
package app
|
|
|
|
// region misc-events
|
|
|
|
const TopicAuthLogin = "auth:login"
|
|
const TopicRouteUpdate = "route:update"
|
|
const TopicRouteRemove = "route:remove"
|
|
|
|
// endregion misc-events
|
|
|
|
// region user-events
|
|
|
|
const TopicUserCreated = "user:created"
|
|
const TopicUserDeleted = "user:deleted"
|
|
const TopicUserUpdated = "user:updated"
|
|
const TopicUserApiEnabled = "user:api:enabled"
|
|
const TopicUserApiDisabled = "user:api:disabled"
|
|
const TopicUserRegistered = "user:registered"
|
|
const TopicUserDisabled = "user:disabled"
|
|
const TopicUserEnabled = "user:enabled"
|
|
|
|
// endregion user-events
|
|
|
|
// region interface-events
|
|
|
|
const TopicInterfaceCreated = "interface:created"
|
|
const TopicInterfaceUpdated = "interface:updated"
|
|
const TopicInterfaceDeleted = "interface:deleted"
|
|
|
|
// endregion interface-events
|
|
|
|
// region peer-events
|
|
|
|
const TopicPeerCreated = "peer:created"
|
|
const TopicPeerDeleted = "peer:deleted"
|
|
const TopicPeerUpdated = "peer:updated"
|
|
const TopicPeerInterfaceUpdated = "peer:interface:updated"
|
|
const TopicPeerIdentifierUpdated = "peer:identifier:updated"
|
|
const TopicPeerStateChanged = "peer:state:changed"
|
|
|
|
// endregion peer-events
|
|
|
|
// region audit-events
|
|
|
|
const TopicAuditLoginSuccess = "audit:login:success"
|
|
const TopicAuditLoginFailed = "audit:login:failed"
|
|
|
|
const TopicAuditInterfaceChanged = "audit:interface:changed"
|
|
const TopicAuditPeerChanged = "audit:peer:changed"
|
|
|
|
|
|
const TopicFanPeersUpdated = "peers.updated"
|
|
const TopicFanPeerSave = "peer.save"
|
|
const TopicFanPeerDelete = "peer.delete"
|
|
const TopicFanInterfaceSave = "interface.save"
|
|
const TopicFanInterfaceUpdated = "interface.updated"
|
|
|
|
// endregion audit-events
|
|
|
|
type EventPublisher interface {
|
|
Publish(topic string, args ...any)
|
|
}
|
|
|
|
type EventSubscriber interface {
|
|
Subscribe(topic string, fn interface{}) error
|
|
}
|
|
|
|
// Зручно мати комбінований інтерфейс:
|
|
type EventBus interface {
|
|
EventPublisher
|
|
EventSubscriber
|
|
} |