mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-30 23:37:44 +00:00
merge bad configuration error
This commit is contained in:
10 files changed
+25
-27
No files matched your search
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/v2ray/v2ray-core/app/dns"
|
||||
"github.com/v2ray/v2ray-core/app/router"
|
||||
"github.com/v2ray/v2ray-core/common"
|
||||
"github.com/v2ray/v2ray-core/common/log"
|
||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||
"github.com/v2ray/v2ray-core/transport"
|
||||
@@ -196,7 +197,7 @@ func (this *InboundDetourConfig) UnmarshalJSON(data []byte) error {
|
||||
}
|
||||
if jsonConfig.PortRange == nil {
|
||||
log.Error("Point: Port range not specified in InboundDetour.")
|
||||
return ErrBadConfiguration
|
||||
return common.ErrBadConfiguration
|
||||
}
|
||||
this.ListenOn = v2net.AnyIP
|
||||
if jsonConfig.ListenOn != nil {
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package point
|
||||
|
||||
import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrBadConfiguration = errors.New("Bad configuration.")
|
||||
)
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/v2ray/v2ray-core/app/dns"
|
||||
"github.com/v2ray/v2ray-core/app/proxyman"
|
||||
"github.com/v2ray/v2ray-core/app/router"
|
||||
"github.com/v2ray/v2ray-core/common"
|
||||
"github.com/v2ray/v2ray-core/common/log"
|
||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||
"github.com/v2ray/v2ray-core/common/retry"
|
||||
@@ -82,7 +83,7 @@ func NewPoint(pConfig *Config) (*Point, error) {
|
||||
r, err := router.CreateRouter(routerConfig.Strategy, routerConfig.Settings, vpoint.space)
|
||||
if err != nil {
|
||||
log.Error("Failed to create router: ", err)
|
||||
return nil, ErrBadConfiguration
|
||||
return nil, common.ErrBadConfiguration
|
||||
}
|
||||
vpoint.space.BindApp(router.APP_ID, r)
|
||||
vpoint.router = r
|
||||
@@ -131,19 +132,19 @@ func NewPoint(pConfig *Config) (*Point, error) {
|
||||
dh, err := NewInboundDetourHandlerAlways(vpoint.space, detourConfig)
|
||||
if err != nil {
|
||||
log.Error("Point: Failed to create detour handler: ", err)
|
||||
return nil, ErrBadConfiguration
|
||||
return nil, common.ErrBadConfiguration
|
||||
}
|
||||
detourHandler = dh
|
||||
case AllocationStrategyRandom:
|
||||
dh, err := NewInboundDetourHandlerDynamic(vpoint.space, detourConfig)
|
||||
if err != nil {
|
||||
log.Error("Point: Failed to create detour handler: ", err)
|
||||
return nil, ErrBadConfiguration
|
||||
return nil, common.ErrBadConfiguration
|
||||
}
|
||||
detourHandler = dh
|
||||
default:
|
||||
log.Error("Point: Unknown allocation strategy: ", allocConfig.Strategy)
|
||||
return nil, ErrBadConfiguration
|
||||
return nil, common.ErrBadConfiguration
|
||||
}
|
||||
vpoint.idh[idx] = detourHandler
|
||||
if len(detourConfig.Tag) > 0 {
|
||||
@@ -190,7 +191,7 @@ func (this *Point) Close() {
|
||||
func (this *Point) Start() error {
|
||||
if this.port <= 0 {
|
||||
log.Error("Point: Invalid port ", this.port)
|
||||
return ErrBadConfiguration
|
||||
return common.ErrBadConfiguration
|
||||
}
|
||||
|
||||
err := retry.Timed(100 /* times */, 100 /* ms */).On(func() error {
|
||||
|
||||
Reference in new issue
Block a user