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

Method GetByPrefix

internal/sessions/manager.go:123–135  ·  view source on GitHub ↗

GetByPrefix returns the first session whose ID starts with the given prefix. Returns nil if no session matches or prefix is empty.

(prefix string)

Source from the content-addressed store, hash-verified

121// GetByPrefix returns the first session whose ID starts with the given prefix.
122// Returns nil if no session matches or prefix is empty.
123func (m *Manager) GetByPrefix(prefix string) *Session {
124 if prefix == "" {
125 return nil
126 }
127 m.mu.RLock()
128 defer m.mu.RUnlock()
129 for id, sess := range m.sessions {
130 if strings.HasPrefix(id, prefix) {
131 return sess
132 }
133 }
134 return nil
135}
136
137// List returns summaries of all active sessions.
138func (m *Manager) List() []SessionSummary {

Callers 1

TestManager_GetByPrefixFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestManager_GetByPrefixFunction · 0.76