mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 17:46:58 -05:00
remove ErrMissingApplication
This commit is contained in:
parent
55be94f8e3
commit
c041740940
@ -1,6 +1,7 @@
|
||||
package impl
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"v2ray.com/core/app"
|
||||
"v2ray.com/core/app/proxyman"
|
||||
"v2ray.com/core/app/router"
|
||||
@ -27,8 +28,7 @@ func NewDefaultDispatcher(space app.Space) *DefaultDispatcher {
|
||||
// Private: Used by app.Space only.
|
||||
func (this *DefaultDispatcher) Initialize(space app.Space) error {
|
||||
if !space.HasApp(proxyman.APP_ID_OUTBOUND_MANAGER) {
|
||||
log.Error("DefaultDispatcher: OutboundHandlerManager is not found in the space.")
|
||||
return app.ErrMissingApplication
|
||||
return errors.New("DefaultDispatcher: OutboundHandlerManager is not found in the space.")
|
||||
}
|
||||
this.ohm = space.GetApp(proxyman.APP_ID_OUTBOUND_MANAGER).(proxyman.OutboundHandlerManager)
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dns
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net"
|
||||
"sync"
|
||||
"time"
|
||||
@ -38,8 +39,7 @@ func NewCacheServer(space app.Space, config *Config) *CacheServer {
|
||||
}
|
||||
space.InitializeApplication(func() error {
|
||||
if !space.HasApp(dispatcher.APP_ID) {
|
||||
log.Error("DNS: Dispatcher is not found in the space.")
|
||||
return app.ErrMissingApplication
|
||||
return errors.New("DNS: Dispatcher is not found in the space.")
|
||||
}
|
||||
|
||||
dispatcher := space.GetApp(dispatcher.APP_ID).(dispatcher.PacketDispatcher)
|
||||
|
@ -45,8 +45,7 @@ func NewRouter(config *Config, space app.Space) *Router {
|
||||
}
|
||||
|
||||
if !space.HasApp(dns.APP_ID) {
|
||||
log.Error("Router: DNS is not found in the space.")
|
||||
return app.ErrMissingApplication
|
||||
return errors.New("Router: DNS is not found in the space.")
|
||||
}
|
||||
r.dnsServer = space.GetApp(dns.APP_ID).(dns.Server)
|
||||
return nil
|
||||
|
@ -6,10 +6,6 @@ import (
|
||||
"v2ray.com/core/common"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrMissingApplication = errors.New("App: Failed to found one or more applications.")
|
||||
)
|
||||
|
||||
type ID int
|
||||
|
||||
// Context of a function call from proxy to app.
|
||||
|
@ -3,6 +3,7 @@ package dokodemo
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"errors"
|
||||
"v2ray.com/core/app"
|
||||
"v2ray.com/core/app/dispatcher"
|
||||
"v2ray.com/core/common/alloc"
|
||||
@ -39,8 +40,7 @@ func NewDokodemoDoor(config *Config, space app.Space, meta *proxy.InboundHandler
|
||||
}
|
||||
space.InitializeApplication(func() error {
|
||||
if !space.HasApp(dispatcher.APP_ID) {
|
||||
log.Error("Dokodemo: Dispatcher is not found in the space.")
|
||||
return app.ErrMissingApplication
|
||||
return errors.New("Dokodemo: Dispatcher is not found in the space.")
|
||||
}
|
||||
d.packetDispatcher = space.GetApp(dispatcher.APP_ID).(dispatcher.PacketDispatcher)
|
||||
return nil
|
||||
|
@ -3,6 +3,7 @@ package freedom
|
||||
import (
|
||||
"io"
|
||||
|
||||
"errors"
|
||||
"v2ray.com/core/app"
|
||||
"v2ray.com/core/app/dns"
|
||||
"v2ray.com/core/common/alloc"
|
||||
@ -35,8 +36,7 @@ func NewFreedomConnection(config *Config, space app.Space, meta *proxy.OutboundH
|
||||
space.InitializeApplication(func() error {
|
||||
if config.DomainStrategy == Config_USE_IP {
|
||||
if !space.HasApp(dns.APP_ID) {
|
||||
log.Error("Freedom: DNS server is not found in the space.")
|
||||
return app.ErrMissingApplication
|
||||
return errors.New("Freedom: DNS server is not found in the space.")
|
||||
}
|
||||
f.dns = space.GetApp(dns.APP_ID).(dns.Server)
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ func NewServer(config *ServerConfig, space app.Space, meta *proxy.InboundHandler
|
||||
|
||||
space.InitializeApplication(func() error {
|
||||
if !space.HasApp(dispatcher.APP_ID) {
|
||||
return app.ErrMissingApplication
|
||||
return errors.New("Shadowsocks|Server: Dispatcher is not found in space.")
|
||||
}
|
||||
s.packetDispatcher = space.GetApp(dispatcher.APP_ID).(dispatcher.PacketDispatcher)
|
||||
return nil
|
||||
|
@ -46,8 +46,7 @@ func NewServer(config *ServerConfig, space app.Space, meta *proxy.InboundHandler
|
||||
}
|
||||
space.InitializeApplication(func() error {
|
||||
if !space.HasApp(dispatcher.APP_ID) {
|
||||
log.Error("Socks|Server: Dispatcher is not found in the space.")
|
||||
return app.ErrMissingApplication
|
||||
return errors.New("Socks|Server: Dispatcher is not found in the space.")
|
||||
}
|
||||
s.packetDispatcher = space.GetApp(dispatcher.APP_ID).(dispatcher.PacketDispatcher)
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user