Simple interprocess plugins
Here's a plugin that provides a simple echo service.
package main
import "github.com/tidwall/sipp"
func main() {
sipp.Handle(func(input []byte) []byte {
return input
})
}
Save to echo.go and compile:
go build echo.go
You now have a plugin named echo
.
package main
import "github.com/tidwall/sipp"
func main() {
p, err := sipp.Open("echo")
if err != nil{
panic(err)
}
println(p.Send([]byte("hello")).Output())
}
Prints hello
Josh Baker @tidwall
Source code is available under the MIT License.