mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-23 00:51:29 +00:00
31 lines
696 B
Go
31 lines
696 B
Go
package deprecated
|
|
|
|
import (
|
|
"os"
|
|
"strconv"
|
|
|
|
"github.com/sagernet/sing/common/logger"
|
|
)
|
|
|
|
type envManager struct {
|
|
logger logger.Logger
|
|
}
|
|
|
|
func NewEnvManager(logger logger.Logger) Manager {
|
|
return &envManager{logger: logger}
|
|
}
|
|
|
|
func (f *envManager) ReportDeprecated(feature Note) {
|
|
if !feature.Impending() {
|
|
f.logger.Warn(feature.MessageWithLink())
|
|
return
|
|
}
|
|
enable, enableErr := strconv.ParseBool(os.Getenv("ENABLE_DEPRECATED_" + feature.EnvName))
|
|
if enableErr == nil && enable {
|
|
f.logger.Warn(feature.MessageWithLink())
|
|
return
|
|
}
|
|
f.logger.Error(feature.MessageWithLink())
|
|
f.logger.Fatal("to continuing using this feature, set ENABLE_DEPRECATED_" + feature.EnvName + "=true")
|
|
}
|