v2ray-core/transport/internet/authenticator_json.go

28 lines
613 B
Go
Raw Normal View History

2016-08-06 21:59:22 +02:00
// +build json
package internet
2016-08-25 13:25:59 +02:00
import (
"v2ray.com/core/common"
"v2ray.com/core/common/loader"
)
2016-08-06 21:59:22 +02:00
2016-08-25 13:25:59 +02:00
func RegisterAuthenticatorConfig(name string, configCreator loader.ConfigCreator) error {
if _, found := authenticatorCache[name]; found {
return common.ErrDuplicatedName
}
return configCache.RegisterCreator(name, configCreator)
}
func CreateAuthenticatorConfig(rawConfig []byte) (string, AuthenticatorConfig, error) {
config, name, err := configCache.Load(rawConfig)
if err != nil {
return name, nil, err
}
return name, config, nil
2016-08-06 21:59:22 +02:00
}
2016-08-25 13:25:59 +02:00
var (
configCache = loader.NewJSONConfigLoader("type", "")
)