Refactor server package: split handlers and routes into separate files
- Move all handler functions to handlers.go - Move setupRoutes to routes.go - Clean up server.go to only contain core server logic - Add missing GetASDetails and GetPrefixDetails to mockStore for tests - Fix linter errors (magic numbers, unused parameters, blank lines)
This commit is contained in:
@@ -201,6 +201,26 @@ func (m *mockStore) GetASInfoForIP(ip string) (*database.ASInfo, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
// GetASDetails mock implementation
|
||||
func (m *mockStore) GetASDetails(asn int) (*database.ASN, []database.LiveRoute, error) {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
|
||||
// Check if ASN exists
|
||||
if asnInfo, exists := m.ASNs[asn]; exists {
|
||||
// Return empty prefixes for now
|
||||
return asnInfo, []database.LiveRoute{}, nil
|
||||
}
|
||||
|
||||
return nil, nil, database.ErrNoRoute
|
||||
}
|
||||
|
||||
// GetPrefixDetails mock implementation
|
||||
func (m *mockStore) GetPrefixDetails(prefix string) ([]database.LiveRoute, error) {
|
||||
// Return empty routes for now
|
||||
return []database.LiveRoute{}, nil
|
||||
}
|
||||
|
||||
func TestRouteWatchLiveFeed(t *testing.T) {
|
||||
|
||||
// Create mock database
|
||||
|
||||
Reference in New Issue
Block a user