MCPcopy
hub / github.com/shadow1ng/fscan / UpdateConfig

Method UpdateConfig

common/proxy/manager.go:93–115  ·  view source on GitHub ↗

UpdateConfig 更新配置

(config *ProxyConfig)

Source from the content-addressed store, hash-verified

91
92// UpdateConfig 更新配置
93func (m *manager) UpdateConfig(config *ProxyConfig) error {
94 if config == nil {
95 return NewProxyError(ErrTypeConfig, ErrMsgEmptyConfig, ErrCodeEmptyConfig, nil)
96 }
97
98 m.mu.Lock()
99 defer m.mu.Unlock()
100
101 m.config = config
102 m.stats.ProxyType = config.Type.String()
103 m.stats.ProxyAddress = config.Address
104
105 // 自动配置代理行为
106 AutoConfigureProxy(config)
107
108 // 清理缓存
109 m.cacheMu.Lock()
110 m.dialerCache = make(map[string]Dialer)
111 m.cacheExpiry = time.Now().Add(DefaultCacheExpiry)
112 m.cacheMu.Unlock()
113
114 return nil
115}
116
117// Close 关闭管理器
118func (m *manager) Close() error {

Callers

nothing calls this directly

Calls 4

NewProxyErrorFunction · 0.85
AutoConfigureProxyFunction · 0.85
StringMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected