mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-03 03:47:38 +03:00
18 lines
254 B
Go
18 lines
254 B
Go
package common
|
|
|
|
import "io"
|
|
|
|
type closeWrapper struct {
|
|
closer func() error
|
|
}
|
|
|
|
func (w *closeWrapper) Close() error {
|
|
return w.closer()
|
|
}
|
|
|
|
func Closer(closer func() error) io.Closer {
|
|
if closer == nil {
|
|
return nil
|
|
}
|
|
return &closeWrapper{closer}
|
|
}
|