mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-06 00:38:08 +08:00
wip: minimal plugin works
License: MIT Signed-off-by: Oli Evans <oli@tableflip.io>
This commit is contained in:
parent
45efea8aef
commit
d83e07ea90
@ -5,6 +5,7 @@ import (
|
||||
pluginflatfs "github.com/ipfs/go-ipfs/plugin/plugins/flatfs"
|
||||
pluginipldgit "github.com/ipfs/go-ipfs/plugin/plugins/git"
|
||||
pluginlevelds "github.com/ipfs/go-ipfs/plugin/plugins/levelds"
|
||||
pluginpeeridlog "github.com/ipfs/go-ipfs/plugin/plugins/peeridlog"
|
||||
)
|
||||
|
||||
// DO NOT EDIT THIS FILE
|
||||
@ -16,4 +17,5 @@ func init() {
|
||||
Preload(pluginbadgerds.Plugins...)
|
||||
Preload(pluginflatfs.Plugins...)
|
||||
Preload(pluginlevelds.Plugins...)
|
||||
Preload(pluginpeeridlog.Plugins...)
|
||||
}
|
||||
|
||||
@ -8,3 +8,4 @@ ipldgit github.com/ipfs/go-ipfs/plugin/plugins/git *
|
||||
badgerds github.com/ipfs/go-ipfs/plugin/plugins/badgerds *
|
||||
flatfs github.com/ipfs/go-ipfs/plugin/plugins/flatfs *
|
||||
levelds github.com/ipfs/go-ipfs/plugin/plugins/levelds *
|
||||
peeridlog github.com/ipfs/go-ipfs/plugin/plugins/peeridlog *
|
||||
|
||||
44
plugin/plugins/peeridlog/peeridlog.go
Normal file
44
plugin/plugins/peeridlog/peeridlog.go
Normal file
@ -0,0 +1,44 @@
|
||||
package peeridlog
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
core "github.com/ipfs/go-ipfs/core"
|
||||
plugin "github.com/ipfs/go-ipfs/plugin"
|
||||
)
|
||||
|
||||
// Plugins is exported list of plugins that will be loaded
|
||||
var Plugins = []plugin.Plugin{
|
||||
&peerIDLogPlugin{},
|
||||
}
|
||||
|
||||
// Log all the PeerIDs we connect to.
|
||||
type peerIDLogPlugin struct{}
|
||||
|
||||
var _ plugin.PluginDaemonInternal = (*peerIDLogPlugin)(nil)
|
||||
|
||||
// Name returns the plugin's name, satisfying the plugin.Plugin interface.
|
||||
func (*peerIDLogPlugin) Name() string {
|
||||
return "peeridlog"
|
||||
}
|
||||
|
||||
// Version returns the plugin's version, satisfying the plugin.Plugin interface.
|
||||
func (*peerIDLogPlugin) Version() string {
|
||||
return "0.1.0"
|
||||
}
|
||||
|
||||
// Init initializes plugin, satisfying the plugin.Plugin interface. Put any
|
||||
// initialization logic here.
|
||||
func (*peerIDLogPlugin) Init(*plugin.Environment) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (*peerIDLogPlugin) Start(*core.IpfsNode) error {
|
||||
fmt.Println("peerIDLogPlugin HELLO!")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (*peerIDLogPlugin) Close() error {
|
||||
fmt.Println("peerIDLogPlugin GOODBYE!")
|
||||
return nil
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user