mirror of
https://github.com/bettercap/bettercap
synced 2025-08-13 02:06:57 -07:00
fix: api.rest and https.server certificates are now correctly generated with IsCA to false
This commit is contained in:
parent
070708c307
commit
8257d25ff3
23 changed files with 8876 additions and 14 deletions
30
vendor/github.com/evilsocket/islazy/async/timeout.go
generated
vendored
Normal file
30
vendor/github.com/evilsocket/islazy/async/timeout.go
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
package async
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// TimedCallback represents a generic function with a return value.
|
||||
type TimedCallback func() interface{}
|
||||
|
||||
// WithTimeout will execute the callback and return its value or a
|
||||
// ErrTimeout if its execution will exceed the provided duration.
|
||||
func WithTimeout(tm time.Duration, cb TimedCallback) (interface{}, error) {
|
||||
timeout := time.After(tm)
|
||||
done := make(chan interface{})
|
||||
go func() {
|
||||
done <- cb()
|
||||
}()
|
||||
|
||||
select {
|
||||
case <-timeout:
|
||||
return nil, ErrTimeout
|
||||
case res := <-done:
|
||||
if res != nil {
|
||||
if e, ok := res.(error); ok {
|
||||
return nil, e
|
||||
}
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue