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

Method authFileUnchanged

internal/watcher/events.go:130–149  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

128}
129
130func (w *Watcher) authFileUnchanged(path string) (bool, error) {
131 data, errRead := os.ReadFile(path)
132 if errRead != nil {
133 return false, errRead
134 }
135 if len(data) == 0 {
136 return false, nil
137 }
138 sum := sha256.Sum256(data)
139 curHash := hex.EncodeToString(sum[:])
140
141 normalized := w.normalizeAuthPath(path)
142 w.clientsMutex.RLock()
143 prevHash, ok := w.lastAuthHashes[normalized]
144 w.clientsMutex.RUnlock()
145 if ok && prevHash == curHash {
146 return true, nil
147 }
148 return false, nil
149}
150
151func (w *Watcher) isKnownAuthFile(path string) bool {
152 normalized := w.normalizeAuthPath(path)

Callers 3

handleEventMethod · 0.95

Calls 1

normalizeAuthPathMethod · 0.95