Feature: add custom DNS support (#56)
This commit is contained in:
22
common/picker/picker.go
Normal file
22
common/picker/picker.go
Normal file
@ -0,0 +1,22 @@
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user