Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPC Plugin System #69

Draft
wants to merge 1 commit into
base: 1.x
Choose a base branch
from
Draft

RPC Plugin System #69

wants to merge 1 commit into from

Conversation

yusufhm
Copy link
Contributor

@yusufhm yusufhm commented Oct 21, 2024

Created a quick sandbox for creating external plugins using Hashicorp's go-plugin.

You can get the sample working by running:

go build -o build/shipshape
go build -o build/plugin-sample examples/plugin/sample.go
./build/shipshape plugin

Output similar to the following should be generated:

2024-10-21T12:45:35.988+0400 [DEBUG] plugin: starting plugin: path=./build/plugin-sample args=[./build/plugin-sample]
2024-10-21T12:45:35.990+0400 [DEBUG] plugin: plugin started: path=./build/plugin-sample pid=79104
2024-10-21T12:45:35.990+0400 [DEBUG] plugin: waiting for RPC address: plugin=./build/plugin-sample
2024-10-21T12:45:35.996+0400 [DEBUG] plugin.plugin-sample: message from plugin: foo=bar timestamp=2024-10-21T12:45:35.995+0400
2024-10-21T12:45:35.996+0400 [DEBUG] plugin: using plugin: version=1
2024-10-21T12:45:35.996+0400 [DEBUG] plugin.plugin-sample: plugin address: address=/var/folders/lq/gql2jg193ndbp64b2z32qp8r0000gn/T/plugin366665257 network=unix timestamp=2024-10-21T12:45:35.996+0400
2024-10-21T12:45:35.997+0400 [DEBUG] plugin.plugin-sample: message from SampleOutput.Output: timestamp=2024-10-21T12:45:35.997+0400
output from plugin: ResultList: {map[policy1:[rule1 rule2]] false 0 0 map[] map[] map[] map[] [{result1   [rule1] [] []  }]}

2024-10-21T12:45:35.997+0400 [DEBUG] plugin.plugin-sample: 2024/10/21 12:45:35 [DEBUG] plugin: plugin server: accept unix /var/folders/lq/gql2jg193ndbp64b2z32qp8r0000gn/T/plugin366665257: use of closed network connection
2024-10-21T12:45:35.997+0400 [INFO]  plugin: plugin process exited: plugin=./build/plugin-sample id=79104
2024-10-21T12:45:35.998+0400 [DEBUG] plugin: plugin exited

The line saying output from plugin: ResultList:... is the indication that the plugin works.

- initially implemented Output plugin
- has a sample plugin in `examples/plugin`
@yusufhm yusufhm force-pushed the feature/rpc-plugin branch from 88cfa0c to 7fd8da9 Compare October 22, 2024 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant