()
| 125 | } |
| 126 | |
| 127 | func (opt *Plugin) run() { |
| 128 | opt.Context, opt.CancelFunc = context.WithCancel(Engine) |
| 129 | opt.Config.OnEvent(FirstConfig(&opt.RawConfig)) |
| 130 | opt.Debug("config", zap.Any("config", opt.Config)) |
| 131 | if conf, ok := opt.Config.(config.HTTPConfig); ok { |
| 132 | go conf.Listen(opt) |
| 133 | } |
| 134 | if conf, ok := opt.Config.(config.TCPConfig); ok { |
| 135 | go conf.ListenTCP(opt, opt.Config.(config.TCPPlugin)) |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | // Update 热更新配置 |
| 140 | func (opt *Plugin) Update(conf *config.Config) { |