Help us shape the future of Go! Take the 2026 Go Developer Survey

host

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoaderCrypto

func LoaderCrypto(logger *bLogger.Helper) lua.LGFunction

LoaderCrypto 返回 crypto 模块(kratos_crypto)的 loader,供 go-scripts 引擎 RegisterModule 使用。

func LoaderHTTP

func LoaderHTTP(opts hostmodule.HTTPOptions) lua.LGFunction

LoaderHTTP 返回 http 模块(kratos_http)的 loader,供 go-scripts 引擎 RegisterModule 使用。 白名单为空时模块函数仍在,但所有请求都会被拒(fail-closed,报错信息指明白名单)。

func LoaderHook

func LoaderHook(engine HookEngine, logger *bLogger.Helper) lua.LGFunction

LoaderHook 返回 hook 模块(kratos_hook)的 loader,供 go-scripts 引擎 RegisterModule 使用。 engine 为 nil 时返回空模块。

func LoaderLogger

func LoaderLogger(logger *bLogger.Helper) lua.LGFunction

LoaderLogger 返回 logger 模块(kratos_logger)的 loader,供 go-scripts 引擎 RegisterModule 使用。

func LoaderUtil

func LoaderUtil(logger *bLogger.Helper, maxSleep ...time.Duration) lua.LGFunction

LoaderUtil 返回 util 模块(kratos_util)的 loader,供 go-scripts 引擎 RegisterModule 使用。 maxSleep 为 sleep 时长上限(防御脚本无限阻塞执行线程);未传时默认 5 秒。

func RegisterCrypto

func RegisterCrypto(L *lua.LState, logger *bLogger.Helper)

RegisterCrypto registers the Crypto API for Lua as a requireable module

func RegisterHTTP

func RegisterHTTP(L *lua.LState, opts hostmodule.HTTPOptions)

RegisterHTTP 注册 http 模块(Lua,preload 风格)。

func RegisterHookAPI

func RegisterHookAPI(L *lua.LState, engine HookEngine, logger *bLogger.Helper)

RegisterHookAPI registers the hook management API for Lua as a requireable module This allows Lua scripts to register themselves to hooks dynamically

func RegisterLogger

func RegisterLogger(L *lua.LState, logger *bLogger.Helper)

RegisterLogger registers the logger API for Lua as a requireable module RegisterLogger registers the logger API for Lua as a requireable module

func RegisterUtilAPI

func RegisterUtilAPI(L *lua.LState, logger *bLogger.Helper)

RegisterUtilAPI registers utility functions for Lua scripts Provides common utilities like sleep, time, etc.

Types

type HookEngine

type HookEngine interface {
	RegisterHook(name, description string) error
	AddScript(hookName string, script interface{}) error
	ListHooks() []string
	RegisterCallback(hookName string, L *lua.LState, fn *lua.LFunction)
}

HookEngine defines the interface for hook management This avoids circular dependency with the main lua package

type Script

type Script struct {
	ID          string
	Name        string
	Hook        string
	Source      string
	Enabled     bool
	Priority    int
	Description string
	Version     string
	Author      string
	Critical    bool
}

Script represents a Lua script for the hook engine

Jump to

Keyboard shortcuts

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