1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-02 09:17:55 -04:00
v2fly/transport/internet/authenticator_json.go
2016-08-25 13:25:59 +02:00

28 lines
613 B
Go

// +build json
package internet
import (
"v2ray.com/core/common"
"v2ray.com/core/common/loader"
)
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
}
var (
configCache = loader.NewJSONConfigLoader("type", "")
)