1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-04-08 14:55:28 -04:00
Files
v2fly/common/task/taskDerive/tryAll.go
Shelikhoo f516eca541 Add IPv6 happy eyeball support for wireguard
(mostly vibe coded)
2026-02-20 11:43:33 +00:00

29 lines
540 B
Go

package taskDerive
import (
"context"
"github.com/v2fly/v2ray-core/v5/common/task"
)
func RunTryAll(ctx context.Context, tasks ...func() error) []error {
errors := make([]error, len(tasks))
wrappedTasks := make([]func() error, len(tasks))
for i, currentTask := range tasks {
index := i
wrappedTasks[i] = func() error {
err := currentTask()
errors[index] = err
if err != nil {
return nil
}
return newError()
}
}
runErr := task.Run(ctx, wrappedTasks...)
if runErr != nil {
return nil
}
return errors
}