package slave import ( "analysis/app" "analysis/logo" "context" "plugin" ) // func Create(config string, typ, id string, gpu int, shm bool, ipc2Rule string, ruleMaxSize int, fn func(...interface{}), reserved map[string]string) interface{} // func Run(ctx context.Context, i interface{}) { // SDK plugin Func type SDK struct { fnCreate func(string, string, string, int, bool, string, int, func(...interface{}), map[string]interface{}) interface{} fnRun func(context.Context, interface{}) } // LoadSDK from plugin func LoadSDK(soFile string) *SDK { plug, err := plugin.Open(soFile) if err != nil { logo.Errorln("Slave Open so File: ", soFile, " Error: ", err) return nil } fnC, err := app.LoadFunc(plug, soFile, "Create") if err != nil { logo.Errorln("Load Func Create From: ", soFile, " Error: ", err) return nil } fnR, err := app.LoadFunc(plug, soFile, "Run") if err != nil { logo.Errorln("Load Func Run From: ", soFile, " Error: ", err) return nil } return &SDK{ fnCreate: fnC.(func(string, string, string, int, bool, string, int, func(...interface{}), map[string]interface{}) interface{}), fnRun: fnR.(func(context.Context, interface{})), } }