Documentation
¶
Index ¶
- type CodeRunner
- func (t *CodeRunner) AddDangerousPattern(pattern string)
- func (t *CodeRunner) EnableJS(enabled bool)
- func (t *CodeRunner) EnablePython(enabled bool)
- func (t *CodeRunner) Execute(ctx context.Context, params map[string]interface{}) (core.Result, error)
- func (t *CodeRunner) GetSupportedLanguages() []string
- func (t *CodeRunner) IsJSEnabled() bool
- func (t *CodeRunner) IsPythonEnabled() bool
- func (t *CodeRunner) SetMaxOutputSize(size int)
- func (t *CodeRunner) SetTimeout(timeout time.Duration)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodeRunner ¶
CodeRunner provides code execution capabilities with sandbox constraints. WARNING: This tool executes code on the host system. Use with caution and ensure proper sandboxing.
func NewCodeRunnerWithOptions ¶
func NewCodeRunnerWithOptions(enablePython, enableJS bool, timeout time.Duration, maxOutputSize int) *CodeRunner
NewCodeRunnerWithOptions creates a new CodeRunner with custom options.
func (*CodeRunner) AddDangerousPattern ¶
func (t *CodeRunner) AddDangerousPattern(pattern string)
AddDangerousPattern adds a custom dangerous pattern to validate against.
func (*CodeRunner) EnableJS ¶
func (t *CodeRunner) EnableJS(enabled bool)
EnableJS enables or disables JavaScript execution.
func (*CodeRunner) EnablePython ¶
func (t *CodeRunner) EnablePython(enabled bool)
EnablePython enables or disables Python execution.
func (*CodeRunner) Execute ¶
func (t *CodeRunner) Execute(ctx context.Context, params map[string]interface{}) (core.Result, error)
Execute performs the code execution operation.
func (*CodeRunner) GetSupportedLanguages ¶
func (t *CodeRunner) GetSupportedLanguages() []string
GetSupportedLanguages returns the list of supported languages.
func (*CodeRunner) IsJSEnabled ¶
func (t *CodeRunner) IsJSEnabled() bool
IsJSEnabled returns whether JavaScript execution is enabled.
func (*CodeRunner) IsPythonEnabled ¶
func (t *CodeRunner) IsPythonEnabled() bool
IsPythonEnabled returns whether Python execution is enabled.
func (*CodeRunner) SetMaxOutputSize ¶
func (t *CodeRunner) SetMaxOutputSize(size int)
SetMaxOutputSize sets the maximum output size.
func (*CodeRunner) SetTimeout ¶
func (t *CodeRunner) SetTimeout(timeout time.Duration)
SetTimeout sets the execution timeout.