github.com/xtls/xray-core@v1.8.12-0.20240518155711-3168d27b0bdb/infra/conf/lint.go (about) 1 package conf 2 3 type ConfigureFilePostProcessingStage interface { 4 Process(conf *Config) error 5 } 6 7 var configureFilePostProcessingStages map[string]ConfigureFilePostProcessingStage 8 9 func RegisterConfigureFilePostProcessingStage(name string, stage ConfigureFilePostProcessingStage) { 10 if configureFilePostProcessingStages == nil { 11 configureFilePostProcessingStages = make(map[string]ConfigureFilePostProcessingStage) 12 } 13 configureFilePostProcessingStages[name] = stage 14 } 15 16 func PostProcessConfigureFile(conf *Config) error { 17 for k, v := range configureFilePostProcessingStages { 18 if err := v.Process(conf); err != nil { 19 return newError("Rejected by Postprocessing Stage ", k).AtError().Base(err) 20 } 21 } 22 return nil 23 }