mirror of https://github.com/v2ray/v2ray-core
remove unused code
parent
751a105324
commit
2320bc3304
|
@ -1,36 +0,0 @@
|
||||||
package loader
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"v2ray.com/core/common"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
ErrUnknownConfigID = errors.New("Unknown config ID.")
|
|
||||||
)
|
|
||||||
|
|
||||||
type ConfigCreator func() interface{}
|
|
||||||
|
|
||||||
type ConfigCreatorCache map[string]ConfigCreator
|
|
||||||
|
|
||||||
func (this ConfigCreatorCache) RegisterCreator(id string, creator ConfigCreator) error {
|
|
||||||
if _, found := this[id]; found {
|
|
||||||
return common.ErrDuplicatedName
|
|
||||||
}
|
|
||||||
|
|
||||||
this[id] = creator
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this ConfigCreatorCache) CreateConfig(id string) (interface{}, error) {
|
|
||||||
creator, found := this[id]
|
|
||||||
if !found {
|
|
||||||
return nil, ErrUnknownConfigID
|
|
||||||
}
|
|
||||||
return creator(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type ConfigLoader interface {
|
|
||||||
Load([]byte) (interface{}, string, error)
|
|
||||||
LoadWithID([]byte, string) (interface{}, error)
|
|
||||||
}
|
|
|
@ -3,7 +3,6 @@ package internet
|
||||||
import (
|
import (
|
||||||
"v2ray.com/core/common"
|
"v2ray.com/core/common"
|
||||||
"v2ray.com/core/common/alloc"
|
"v2ray.com/core/common/alloc"
|
||||||
"v2ray.com/core/common/loader"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Authenticator interface {
|
type Authenticator interface {
|
||||||
|
@ -18,7 +17,6 @@ type AuthenticatorFactory interface {
|
||||||
|
|
||||||
var (
|
var (
|
||||||
authenticatorCache = make(map[string]AuthenticatorFactory)
|
authenticatorCache = make(map[string]AuthenticatorFactory)
|
||||||
configCache = loader.ConfigCreatorCache{}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func RegisterAuthenticator(name string, factory AuthenticatorFactory) error {
|
func RegisterAuthenticator(name string, factory AuthenticatorFactory) error {
|
||||||
|
|
|
@ -8,15 +8,17 @@ import (
|
||||||
v2net "v2ray.com/core/common/net"
|
v2net "v2ray.com/core/common/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type ConfigCreator func() interface{}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
globalNetworkConfigCreatorCache = make(map[v2net.Network]loader.ConfigCreator)
|
globalNetworkConfigCreatorCache = make(map[v2net.Network]ConfigCreator)
|
||||||
|
|
||||||
globalNetworkSettings []*NetworkSettings
|
globalNetworkSettings []*NetworkSettings
|
||||||
|
|
||||||
ErrUnconfiguredNetwork = errors.New("Network config creator not set.")
|
ErrUnconfiguredNetwork = errors.New("Network config creator not set.")
|
||||||
)
|
)
|
||||||
|
|
||||||
func RegisterNetworkConfigCreator(network v2net.Network, creator loader.ConfigCreator) error {
|
func RegisterNetworkConfigCreator(network v2net.Network, creator ConfigCreator) error {
|
||||||
// TODO: check duplicate
|
// TODO: check duplicate
|
||||||
globalNetworkConfigCreatorCache[network] = creator
|
globalNetworkConfigCreatorCache[network] = creator
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue