MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / defaultWatcherFactory

Function defaultWatcherFactory

sdk/cliproxy/watcher.go:11–44  ·  view source on GitHub ↗
(configPath, authDir string, reload func(*config.Config))

Source from the content-addressed store, hash-verified

9)
10
11func defaultWatcherFactory(configPath, authDir string, reload func(*config.Config)) (*WatcherWrapper, error) {
12 w, err := watcher.NewWatcher(configPath, authDir, reload)
13 if err != nil {
14 return nil, err
15 }
16
17 return &WatcherWrapper{
18 start: func(ctx context.Context) error {
19 return w.Start(ctx)
20 },
21 stop: func() error {
22 return w.Stop()
23 },
24 setConfig: func(cfg *config.Config) {
25 w.SetConfig(cfg)
26 },
27 snapshotAuths: func() []*coreauth.Auth { return w.SnapshotCoreAuths() },
28 setUpdateQueue: func(queue chan<- watcher.AuthUpdate) {
29 w.SetAuthUpdateQueue(queue)
30 },
31 dispatchRuntimeUpdate: func(update watcher.AuthUpdate) bool {
32 return w.DispatchRuntimeAuthUpdate(update)
33 },
34 dispatchPersistedAuth: func(update watcher.AuthUpdate) bool {
35 return w.DispatchPersistedAuthUpdate(update)
36 },
37 setPluginAuthParser: func(parser PluginAuthParser) {
38 w.SetPluginAuthParser(parser)
39 },
40 reloadConfigIfChanged: func() {
41 w.ReloadConfigIfChanged()
42 },
43 }, nil
44}

Callers

nothing calls this directly

Calls 10

StartMethod · 0.95
StopMethod · 0.95
SetConfigMethod · 0.95
SnapshotCoreAuthsMethod · 0.95
SetAuthUpdateQueueMethod · 0.95
SetPluginAuthParserMethod · 0.95
ReloadConfigIfChangedMethod · 0.95
NewWatcherFunction · 0.92

Tested by

no test coverage detected