Paraffin
Paraffin is a search aggregator, it is capable of querying multiple applications and return aggregate results.
It is like a MetaSearch Engine but for applications like Jira, MediaWiki, OTRS, Check_MK and other enterprise applications
Build
Build Plugins
Plugins are stored in the ./plugins
folder. You can edit the location in the config.yml
file
root@localhost$ # to build a plugin use the following command
root@localhost$ go build -buildmode=plugins -o {output}.so plugins/{folder}/{plugin}.go
root@localhost$ # example
root@localhost$ go build -buildmode=plugins -o ./plugins/check_mk.so ./plugins/check_mk/check_mk.go
Develop
Write Plugins
A plugin must export the Searcher
symbol as a structure that satisfies the types.SearchPlugin
interface
// SearchPlugin plugins must satisfy this interface
type SearchPlugin interface {
Name() string
Version() string
Search(*sync.WaitGroup, *http.Client, *http.Request, string) []map[string]interface{}
}
The export is usually done at the end of the file
// example_plugin.go
// compile with # go build -buildmode=plugin -o example_plugin.so example_plugin.go
package main
const (
name = "example_search_plugin"
version = "0.1"
)
type searchPlugin interface{}
func (s *searchPlugin) Name() string {
return name
}
func (s *searchPlugin) Version() string {
return version
}
func (s *searchPlugin) Search(wg *sync.WaitGroup, client *http.Client, request *http.Request, query string) []map[string]interface{} {
defer wg.Done()
// do your stuff
}
// [...]
var Searcher searchPlugin
The SearchResult
interface is just an empty interface, but remember that it must be a JSON-serializable structure
// SearchResult generic interface to map plugins responses
type SearchResult interface{}
Run
To run paraffin
follow these steps:
ensure you have a valid golang
installation
root@localhost:$ go version
go version go1.18.1 linux/amd64
install paraffin
root@localhost:$ go install github.com/areYouLazy/paraffin@latest