This commit is contained in:
Dev
2025-09-13 03:03:35 +03:00
parent 67b170415b
commit d3416687c9
6 changed files with 69 additions and 172 deletions

View File

@@ -80,11 +80,11 @@ func NewMirrorList(family string) *MirrorList {
func (ml *MirrorList) LoadMirrors(ctx context.Context, family string) error {
fetcher := NewMirrorFetcher()
fmt.Printf("🌐 Fetching complete mirror list for %s...\n", family)
fmt.Printf("Fetching complete mirror list for %s...\n", family)
mirrors, err := fetcher.FetchMirrors(ctx, family)
if err != nil {
fmt.Printf("⚠️ Failed to fetch mirrors online, using fallback list: %v\n", err)
fmt.Printf("Failed to fetch mirrors online, using fallback list: %v\n", err)
mirrors = fetcher.getDefaultMirrors(family)
}
@@ -102,7 +102,7 @@ func (ml *MirrorList) LoadMirrors(ctx context.Context, family string) error {
})
}
fmt.Printf("📡 Loaded %d mirrors for testing\n", len(ml.Mirrors))
fmt.Printf("Loaded %d mirrors for testing\n", len(ml.Mirrors))
return nil
}
@@ -118,7 +118,7 @@ func (ml *MirrorList) TestMirrors(ctx context.Context, timeout time.Duration) er
results := make(chan TestResult, len(ml.Mirrors))
var wg sync.WaitGroup
fmt.Printf("🔄 Testing %d mirrors concurrently...\n", len(ml.Mirrors))
fmt.Printf("Testing %d mirrors concurrently...\n", len(ml.Mirrors))
// Test each mirror concurrently
for i := range ml.Mirrors {
@@ -154,7 +154,7 @@ func (ml *MirrorList) TestMirrors(ctx context.Context, timeout time.Duration) er
}
}
fmt.Printf("Testing complete: %d successful, %d failed\n", successCount, failureCount)
fmt.Printf("Testing complete: %d successful, %d failed\n", successCount, failureCount)
// Sort by score (higher is better), but put failed mirrors at the end
sort.Slice(ml.Mirrors, func(i, j int) bool {