Update README.md

This commit is contained in:
idk
2022-02-02 18:11:09 -05:00
parent 8d3b037974
commit e62b814641
3 changed files with 23 additions and 13 deletions

View File

@ -1,16 +1,24 @@
I2P native plugin generation tool ShellService Plugin Generator
================================= =============================
I wrote this way faster than I documented it. Shocking, right? Generates a valid ShellService plugin from a single script or executable. A
ShellService plugin is an application which runs as a process which is managed
by the I2P sofware. This allows I2P to manage the lifetime of a non-JVM
application by monitoring it. That way, plugins don't risk outliving the I2P
router because the router loses track of them.
This is a handy little tool for assembling I2P plugins when those A ShellService plugin should not "daemonize" itself or othewise fork itself to the
plugins don't have a clean way to interface with the JVM, or just don't background. The I2P router will manage it as a "Client Application" and daemonizing
need one. Think of it a little like `checkinstall` but for I2P Plugins. it will break this. If your process forks itself to the background by default, it
Right now it mostly works, and it's pretty cleanly put together. must have this feature disabled to work as a ShellService.
There are some examples in the Makefile for now. ShellService adds additional "arguments" to the applications in question,
which are used to configure the ShellService. In order to function correctly,
Here's a copy of the usage while I work on a better README.md: the ShellService must be named so that the name of the Plugin, i.e. `name` in
plugin.config, must match the `-shellservice.name` argument added by the
ShellService class. If it does not, the ShellService will be unable to look up
the plugin process. If the final elements of the ShellService name are `-$OS-$ARCH`
or `-$OS` they may be optionally omitted.
```markdown ```markdown
Usage of i2p.plugin.native: Usage of i2p.plugin.native:

View File

@ -17,16 +17,15 @@ type ClientConfig struct {
NoShellService *bool NoShellService *bool
CommandInPath *bool CommandInPath *bool
ExtendClassPath string ExtendClassPath string
JavaShellService *string
} }
func karenConfig() string { func karenConfig() string {
return "" return ""
} }
var javaShellService = "net.i2p.router.web.ShellService"
func (cc *ClientConfig) Print() string { func (cc *ClientConfig) Print() string {
r := "clientApp.0.main=" + javaShellService + "\n" r := "clientApp.0.main=" + *cc.JavaShellService + "\n"
r += cc.PrintClientName() r += cc.PrintClientName()
r += cc.PrintCommand() r += cc.PrintCommand()
r += cc.PrintStop() r += cc.PrintStop()

View File

@ -46,6 +46,8 @@ func find(root, ext string) []string {
return a return a
} }
var javaShellService = "net.i2p.router.web.ShellService"
func flagsSet() { func flagsSet() {
pc.PluginName = flag.String("name", "", "Name of the plugin") pc.PluginName = flag.String("name", "", "Name of the plugin")
pc.KeyName = flag.String("key", "", "Key to use(omit for su3)") pc.KeyName = flag.String("key", "", "Key to use(omit for su3)")
@ -85,6 +87,7 @@ func flagsSet() {
resdir = flag.String("res", "", "a directory of additional resources to include in the plugin") resdir = flag.String("res", "", "a directory of additional resources to include in the plugin")
targetos = flag.String("targetos", os.Getenv("GOOS"), "Target to run the plugin on") targetos = flag.String("targetos", os.Getenv("GOOS"), "Target to run the plugin on")
noautosuffixwindows = flag.Bool("noautosuffixwindows", false, "Don't automatically add .exe to exename on Windows") noautosuffixwindows = flag.Bool("noautosuffixwindows", false, "Don't automatically add .exe to exename on Windows")
cc.JavaShellService = flag.String("javashellservice", javaShellService, "specify ShellService java path")
flag.Parse() flag.Parse()
cc.ClientDisplayName = pc.ConsoleLinkName cc.ClientDisplayName = pc.ConsoleLinkName
} }