dsl

package
v0.0.1-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package dsl ----------------------------- @author : EndlessShw @time : 2025/9/17 17:46 @Description : -------------------------------------------

Package dsl ----------------------------- @author : EndlessShw @time : 2025/9/17 11:26 @Description : dsl 的环境模块 -------------------------------------------

Package dsl ----------------------------- @author : EndlessShw @time : 2025/9/17 21:58 @Description : 在 DSL 的 expr.Run 上做了封装 -------------------------------------------

Package dsl ----------------------------- @author : EndlessShw @time : 2025/10/15 15:07 @Description : DSL 的工具类 -------------------------------------------

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

type Env struct {
	// Threat 表示当前 Env 对应的威胁种类
	Threat threat.Threat

	// RequestInfo 存放一次请求的相关信息,主要包括 URI、Headers、Body、Method 和 IP 五个部分,然后还有一个 ALL
	RequestInfo map[string]any
	// contains filtered or unexported fields
}

Env 为 DSL 模块提供环境,一个实例对应一个 Env

func NewEnv

func NewEnv() *Env

func (*Env) Compile

func (env *Env) Compile(code string) (*vm.Program, error)

Compile 将上层用户传来的逻辑表达式执行,返回结果待 expr.Run

func (*Env) GetRequestValue

func (e *Env) GetRequestValue(key string) string

GetRequestValue 从 Env(本质信息源来自当前请求)中获取请求环境

func (*Env) Run

func (env *Env) Run(program *vm.Program) (any, error)

Run 在每次有 DSL 语句来时被调用

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL