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

Function CountAuthFiles

internal/util/util.go:99–114  ·  view source on GitHub ↗

CountAuthFiles returns the number of auth records available through the provided Store. For filesystem-backed stores, this reflects the number of JSON auth files under the configured directory.

(ctx context.Context, store interface {
	List(context.Context) ([]T, error)
})

Source from the content-addressed store, hash-verified

97// CountAuthFiles returns the number of auth records available through the provided Store.
98// For filesystem-backed stores, this reflects the number of JSON auth files under the configured directory.
99func CountAuthFiles[T any](ctx context.Context, store interface {
100 List(context.Context) ([]T, error)
101}) int {
102 if store == nil {
103 return 0
104 }
105 if ctx == nil {
106 ctx = context.Background()
107 }
108 entries, err := store.List(ctx)
109 if err != nil {
110 log.Debugf("countAuthFiles: failed to list auth records: %v", err)
111 return 0
112 }
113 return len(entries)
114}
115
116// WritablePath returns the cleaned WRITABLE_PATH environment variable when it is set.
117// It accepts both uppercase and lowercase variants for compatibility with existing conventions.

Callers 1

UpdateClientsMethod · 0.92

Calls 1

ListMethod · 0.65

Tested by

no test coverage detected