Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine interface { // Run executes a self-contained JavaScript script and returns the result from stdout. Run(script string) (string, error) }
Engine defines the interface for a JavaScript runtime.
type ExternalEngine ¶
type ExternalEngine struct {
Command string
}
ExternalEngine uses an external command-line JS runtime (node, deno, bun).
func NewExternalEngine ¶
func NewExternalEngine(command string) (*ExternalEngine, error)
NewExternalEngine creates a new engine that shells out to an external command.
type OttoEngine ¶
type OttoEngine struct{}
OttoEngine uses the embedded otto interpreter.
func NewOttoEngine ¶
func NewOttoEngine() *OttoEngine
NewOttoEngine creates a new engine that uses the built-in otto interpreter.
func (*OttoEngine) Run ¶
func (e *OttoEngine) Run(script string) (string, error)
Run executes a script in otto. It captures output by overriding console.log.
func (*OttoEngine) SolveV2Challenge ¶
func (e *OttoEngine) SolveV2Challenge(body, domain string, scriptMatches [][]string, logger *log.Logger) (string, error)
SolveV2Challenge uses the original synchronous method to solve v2 challenges, as otto does not support asynchronous operations like setTimeout.
Click to show internal directories.
Click to hide internal directories.