proxy

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package proxy 封装了给各种类型的代理(或较 patch)中间层 负责比如外部传如类型校验、私有函数名转换成 uintptr、trampoline 初始化、并发 proxy 等

Package proxy 封装了给各种类型的代理(或叫 patch)中间层 负责比如外部传如私有函数名转换成 uintptr,trampoline 初始化,并发 proxy 等

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Func

func Func(funcDef interface{}, proxyFunc, trampolineFunc interface{}) (*patch.Guard, error)

Func 通过函数生成代理函数 @param funcDef 原始函数定义 @param proxyFunc 代理函数实现 @param originFunc 跳板函数即代理后的原始函数定义(值为 nil 时,使用公共的跳板函数, 不为 nil 时使用指定的跳板函数)

func FuncName

func FuncName(funcName string, proxyFunc interface{}, trampolineFunc interface{}) (*patch.Guard, error)

FuncName 通过函数名生成代理函数 @param genCallableMethod 函数名称 @param proxyFunc 代理函数实现 @param trampolineFunc 跳板函数,即代理后的原始函数定义;跳板函数的签名必须和原函数一致,值不能为空

func Interface

func Interface(ifaceVar interface{}, ctx *iface.IContext, method string, imp interface{}, proxy iface.PFunc) error

Interface 构造接口代理,自动生成接口实现的桩指令织入到内存中 ifaceVar 接口类型变量(指针类型) ctx 接口代理上下文 method 代理模板方法名 apply 代理函数, 代理函数的第一个参数类型必须是*IContext proxy 动态代理函数, 用于反射的方式回调, proxy 参数会覆盖 apply 参数值 return error 异常

func Method

func Method(target reflect.Type, methodName string, proxyFunc,
	trampolineFunc interface{}) (*patch.Guard, error)

Method 通过方法生成代理方法 @param target 类型 @param methodName 方法名 @param proxyFunc 代理函数实现 @param trampolineFunc 跳板函数即代理后的原始方法定义(值为 nil 时,使用公共的跳板函数, 不为 nil 时使用指定的跳板函数)

Types

This section is empty.

Jump to

Keyboard shortcuts

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