Official cwtch.im peer and server implementations. https://cwtch.im
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
645B

  1. package plugins
  2. import (
  3. "cwtch.im/cwtch/event"
  4. "git.openprivacy.ca/openprivacy/connectivity"
  5. )
  6. // PluginID is used as an ID for signaling plugin activities
  7. type PluginID int
  8. // These are the plugin IDs for the supplied plugins
  9. const (
  10. CONNECTIONRETRY PluginID = iota
  11. NETWORKCHECK
  12. )
  13. // Plugin is the interface for a plugin
  14. type Plugin interface {
  15. Start()
  16. Shutdown()
  17. }
  18. // Get is a plugin factory for the requested plugin
  19. func Get(id PluginID, bus event.Manager, acn connectivity.ACN) Plugin {
  20. switch id {
  21. case CONNECTIONRETRY:
  22. return NewConnectionRetry(bus)
  23. case NETWORKCHECK:
  24. return NewNetworkCheck(bus, acn)
  25. }
  26. return nil
  27. }