github.com/imannamdari/v2ray-core/v5@v5.0.5/infra/conf/v4/lint.go (about)

     1  package v4
     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  }