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 GojaEngine ¶
type GojaEngine struct{}
GojaEngine uses the embedded goja interpreter.
func NewGojaEngine ¶
func NewGojaEngine() *GojaEngine
NewGojaEngine creates a new engine that uses the built-in goja interpreter.
func (*GojaEngine) Run ¶
func (e *GojaEngine) Run(script string) (string, error)
Run executes a script in goja. It captures output by overriding console.log.
func (*GojaEngine) SolveV2Challenge ¶
func (e *GojaEngine) SolveV2Challenge(body, domain string, scriptMatches [][]string, logger *log.Logger) (string, error)
SolveV2Challenge uses the original synchronous method to solve v2 challenges, as goja does not support asynchronous operations like setTimeout without additional setup.
Click to show internal directories.
Click to hide internal directories.