Documentation ¶
Index ¶
Constants ¶
const CoreImportPath = "github.com/p2pNG/core"
CoreImportPath is the package import path for p2pNG core.
Variables ¶
This section is empty.
Functions ¶
func GoModule ¶
GoModule returns the build info of this p2pNG build from debug.BuildInfo (requires Go modules). If no version information is available, a non-nil value will still be returned, but with an unknown version.
func RegisterRouterPlugin ¶
func RegisterRouterPlugin(plugin RouterPlugin)
RegisterRouterPlugin is used to register a plugin Notice: should called by package init()
Types ¶
type PluginInfo ¶
PluginInfo is a type that describe a p2pNG plugin. Name is should be unique, usually use module path for it. Prefix indicates the http service path prefix. Buckets indicates which database bucket will use.
type RouterPlugin ¶
type RouterPlugin interface { PluginInfo() *PluginInfo GetRouter() chi.Router Init() error Config() interface{} }
RouterPlugin is a type that is used as a p2pNG plugin. p2pNG will call PluginInfo first, so PluginInfo should returns static info, then fill the Config and call Init, at last GetRouter() to mount and init database buckets.
func GetRouterPlugin ¶
func GetRouterPlugin(name string) (p RouterPlugin, ok bool)
GetRouterPlugin return a RouterPlugin from registry that matches the key
func GetRouterPluginRegistry ¶
func GetRouterPluginRegistry() []RouterPlugin
GetRouterPluginRegistry returns a list of all registered RouterPlugin