mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 01:57:12 -05:00
remove unused code
This commit is contained in:
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 (
|
||||
"v2ray.com/core/common"
|
||||
"v2ray.com/core/common/alloc"
|
||||
"v2ray.com/core/common/loader"
|
||||
)
|
||||
|
||||
type Authenticator interface {
|
||||
@ -18,7 +17,6 @@ type AuthenticatorFactory interface {
|
||||
|
||||
var (
|
||||
authenticatorCache = make(map[string]AuthenticatorFactory)
|
||||
configCache = loader.ConfigCreatorCache{}
|
||||
)
|
||||
|
||||
func RegisterAuthenticator(name string, factory AuthenticatorFactory) error {
|
||||
|
@ -8,15 +8,17 @@ import (
|
||||
v2net "v2ray.com/core/common/net"
|
||||
)
|
||||
|
||||
type ConfigCreator func() interface{}
|
||||
|
||||
var (
|
||||
globalNetworkConfigCreatorCache = make(map[v2net.Network]loader.ConfigCreator)
|
||||
globalNetworkConfigCreatorCache = make(map[v2net.Network]ConfigCreator)
|
||||
|
||||
globalNetworkSettings []*NetworkSettings
|
||||
|
||||
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
|
||||
globalNetworkConfigCreatorCache[network] = creator
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user