mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-12-27 07:59:47 +00:00
079d0bd8a9
* Refactor log * Add new log methods * Fix logger test * Change all logging code * Clean up pathObj * Rebase to latest main * Remove invoking method name after the dot
26 lines
771 B
Go
26 lines
771 B
Go
package conf
|
|
|
|
import "github.com/xtls/xray-core/common/errors"
|
|
|
|
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 errors.New("Rejected by Postprocessing Stage ", k).AtError().Base(err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|