mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-15 13:41:23 +08:00
23 lines
305 B
Go
23 lines
305 B
Go
package picker
|
|
|
|
import "context"
|
|
|
|
func SelectFast(ctx context.Context, in <-chan interface{}) <-chan interface{} {
|
|
out := make(chan interface{})
|
|
go func() {
|
|
select {
|
|
case p, open := <-in:
|
|
if open {
|
|
out <- p
|
|
}
|
|
case <-ctx.Done():
|
|
}
|
|
|
|
close(out)
|
|
for range in {
|
|
}
|
|
}()
|
|
|
|
return out
|
|
}
|