github.com/wangyougui/gf/v2@v2.6.5/net/ghttp/ghttp_server_plugin.go (about) 1 // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/wangyougui/gf. 6 7 package ghttp 8 9 // Plugin is the interface for server plugin. 10 type Plugin interface { 11 Name() string // Name returns the name of the plugin. 12 Author() string // Author returns the author of the plugin. 13 Version() string // Version returns the version of the plugin, like "v1.0.0". 14 Description() string // Description returns the description of the plugin. 15 Install(s *Server) error // Install installs the plugin BEFORE the server starts. 16 Remove() error // Remove removes the plugin when server shuts down. 17 } 18 19 // Plugin adds plugin to the server. 20 func (s *Server) Plugin(plugin ...Plugin) { 21 s.plugins = append(s.plugins, plugin...) 22 }