Skip to content

A go plugin which can hotpatch function and method used in main program

Notifications You must be signed in to change notification settings

MrWrong77/go_hotpatch

Repository files navigation

Plugin System

The Plugins folder contains the plugin manager (plgmgr) and demo plugins.

Plugin Manager

plgmgr is a plugin manager that should be integrated into the main program.

Demo

To run the demonstration:

./run_demo.sh

This demo showcases how plugins p1 and p2 replace functions and methods defined in the business package.

Plugin Configuration The Plugins/plugin_version.json file defines plugin information, including names and versions.

Plugin Implementation Each plugin should implement the following function:

func Hook(m map[string]uintptr) {
    // m is a map of [functionName]functionPointer
    // It is passed by plgmgr and contains all functions in the main program
    // These function pointers are generated by the nm tool during initialization
    // Use this map to replace functions as needed
}

This Hook function is the entry point for each plugin to modify or replace functions in the main program.

About

A go plugin which can hotpatch function and method used in main program

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published