1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-10-31 08:18:50 -04:00
v2fly/infra/conf/v4/lint.go
2021-09-04 11:13:13 +01:00

24 lines
717 B
Go

package v4
type ConfigureFilePostProcessingStage interface {
Process(conf *Config) error
}
var configureFilePostProcessingStages map[string]ConfigureFilePostProcessingStage
func RegisterConfigureFilePostProcessingStage(name string, stage ConfigureFilePostProcessingStage) {
if configureFilePostProcessingStages == nil {
configureFilePostProcessingStages = make(map[string]ConfigureFilePostProcessingStage)
}
configureFilePostProcessingStages[name] = stage
}
func PostProcessConfigureFile(conf *Config) error {
for k, v := range configureFilePostProcessingStages {
if err := v.Process(conf); err != nil {
return newError("Rejected by Postprocessing Stage ", k).AtError().Base(err)
}
}
return nil
}