mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-19 23:03:08 +00:00
cleanup shell/point/config
This commit is contained in:
1 parent
e1c58fae2b
commit
8bee0c4a7b
18 files changed
+341
-37
No files matched your search
@@ -1,4 +1,4 @@
|
||||
package config
|
||||
package point
|
||||
|
||||
import (
|
||||
"github.com/v2ray/v2ray-core/app/dns"
|
||||
@@ -1,4 +1,4 @@
|
||||
package config
|
||||
package point
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||
"github.com/v2ray/v2ray-core/common/retry"
|
||||
"github.com/v2ray/v2ray-core/proxy/common/connhandler"
|
||||
"github.com/v2ray/v2ray-core/shell/point/config"
|
||||
)
|
||||
|
||||
type InboundConnectionHandlerWithPort struct {
|
||||
@@ -17,7 +16,7 @@ type InboundConnectionHandlerWithPort struct {
|
||||
// Handler for inbound detour connections.
|
||||
type InboundDetourHandler struct {
|
||||
space *app.Space
|
||||
config config.InboundDetourConfig
|
||||
config InboundDetourConfig
|
||||
ich []*InboundConnectionHandlerWithPort
|
||||
}
|
||||
|
||||
@@ -25,7 +24,7 @@ func (this *InboundDetourHandler) Initialize() error {
|
||||
ichFactory := connhandler.GetInboundConnectionHandlerFactory(this.config.Protocol())
|
||||
if ichFactory == nil {
|
||||
log.Error("Unknown inbound connection handler factory %s", this.config.Protocol())
|
||||
return config.BadConfiguration
|
||||
return BadConfiguration
|
||||
}
|
||||
|
||||
ports := this.config.PortRange()
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/v2ray/v2ray-core/common/log"
|
||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||
proxyconfig "github.com/v2ray/v2ray-core/proxy/common/config"
|
||||
"github.com/v2ray/v2ray-core/shell/point/config"
|
||||
"github.com/v2ray/v2ray-core/shell/point"
|
||||
)
|
||||
|
||||
// Config is the config for Point server.
|
||||
@@ -28,7 +28,7 @@ func (config *Config) Port() v2net.Port {
|
||||
return config.PortValue
|
||||
}
|
||||
|
||||
func (config *Config) LogConfig() config.LogConfig {
|
||||
func (config *Config) LogConfig() point.LogConfig {
|
||||
if config.LogConfigValue == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -42,30 +42,30 @@ func (this *Config) RouterConfig() routerconfig.RouterConfig {
|
||||
return this.RouterConfigValue
|
||||
}
|
||||
|
||||
func (config *Config) InboundConfig() config.ConnectionConfig {
|
||||
func (config *Config) InboundConfig() point.ConnectionConfig {
|
||||
if config.InboundConfigValue == nil {
|
||||
return nil
|
||||
}
|
||||
return config.InboundConfigValue
|
||||
}
|
||||
|
||||
func (config *Config) OutboundConfig() config.ConnectionConfig {
|
||||
func (config *Config) OutboundConfig() point.ConnectionConfig {
|
||||
if config.OutboundConfigValue == nil {
|
||||
return nil
|
||||
}
|
||||
return config.OutboundConfigValue
|
||||
}
|
||||
|
||||
func (this *Config) InboundDetours() []config.InboundDetourConfig {
|
||||
detours := make([]config.InboundDetourConfig, len(this.InboundDetoursValue))
|
||||
func (this *Config) InboundDetours() []point.InboundDetourConfig {
|
||||
detours := make([]point.InboundDetourConfig, len(this.InboundDetoursValue))
|
||||
for idx, detour := range this.InboundDetoursValue {
|
||||
detours[idx] = detour
|
||||
}
|
||||
return detours
|
||||
}
|
||||
|
||||
func (this *Config) OutboundDetours() []config.OutboundDetourConfig {
|
||||
detours := make([]config.OutboundDetourConfig, len(this.OutboundDetoursValue))
|
||||
func (this *Config) OutboundDetours() []point.OutboundDetourConfig {
|
||||
detours := make([]point.OutboundDetourConfig, len(this.OutboundDetoursValue))
|
||||
for idx, detour := range this.OutboundDetoursValue {
|
||||
detours[idx] = detour
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
_ "github.com/v2ray/v2ray-core/proxy/freedom/config/json"
|
||||
_ "github.com/v2ray/v2ray-core/proxy/socks/config/json"
|
||||
_ "github.com/v2ray/v2ray-core/proxy/vmess/config/json"
|
||||
"github.com/v2ray/v2ray-core/shell/point/config/json"
|
||||
"github.com/v2ray/v2ray-core/shell/point/json"
|
||||
|
||||
v2testing "github.com/v2ray/v2ray-core/testing"
|
||||
"github.com/v2ray/v2ray-core/testing/assert"
|
||||
File renamed without changes.
File renamed without changes.
@@ -11,7 +11,6 @@ import (
|
||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||
"github.com/v2ray/v2ray-core/common/retry"
|
||||
"github.com/v2ray/v2ray-core/proxy/common/connhandler"
|
||||
"github.com/v2ray/v2ray-core/shell/point/config"
|
||||
"github.com/v2ray/v2ray-core/transport/ray"
|
||||
)
|
||||
|
||||
@@ -28,7 +27,7 @@ type Point struct {
|
||||
|
||||
// NewPoint returns a new Point server based on given configuration.
|
||||
// The server is not started at this point.
|
||||
func NewPoint(pConfig config.PointConfig) (*Point, error) {
|
||||
func NewPoint(pConfig PointConfig) (*Point, error) {
|
||||
var vpoint = new(Point)
|
||||
vpoint.port = pConfig.Port()
|
||||
|
||||
@@ -57,7 +56,7 @@ func NewPoint(pConfig config.PointConfig) (*Point, error) {
|
||||
ichFactory := connhandler.GetInboundConnectionHandlerFactory(pConfig.InboundConfig().Protocol())
|
||||
if ichFactory == nil {
|
||||
log.Error("Unknown inbound connection handler factory %s", pConfig.InboundConfig().Protocol())
|
||||
return nil, config.BadConfiguration
|
||||
return nil, BadConfiguration
|
||||
}
|
||||
ichConfig := pConfig.InboundConfig().Settings()
|
||||
ich, err := ichFactory.Create(vpoint.space, ichConfig)
|
||||
@@ -70,7 +69,7 @@ func NewPoint(pConfig config.PointConfig) (*Point, error) {
|
||||
ochFactory := connhandler.GetOutboundConnectionHandlerFactory(pConfig.OutboundConfig().Protocol())
|
||||
if ochFactory == nil {
|
||||
log.Error("Unknown outbound connection handler factory %s", pConfig.OutboundConfig().Protocol())
|
||||
return nil, config.BadConfiguration
|
||||
return nil, BadConfiguration
|
||||
}
|
||||
ochConfig := pConfig.OutboundConfig().Settings()
|
||||
och, err := ochFactory.Create(vpoint.space, ochConfig)
|
||||
@@ -103,7 +102,7 @@ func NewPoint(pConfig config.PointConfig) (*Point, error) {
|
||||
detourFactory := connhandler.GetOutboundConnectionHandlerFactory(detourConfig.Protocol())
|
||||
if detourFactory == nil {
|
||||
log.Error("Unknown detour outbound connection handler factory %s", detourConfig.Protocol())
|
||||
return nil, config.BadConfiguration
|
||||
return nil, BadConfiguration
|
||||
}
|
||||
detourHandler, err := detourFactory.Create(vpoint.space, detourConfig.Settings())
|
||||
if err != nil {
|
||||
@@ -119,7 +118,7 @@ func NewPoint(pConfig config.PointConfig) (*Point, error) {
|
||||
r, err := router.CreateRouter(routerConfig.Strategy(), routerConfig.Settings())
|
||||
if err != nil {
|
||||
log.Error("Failed to create router: %v", err)
|
||||
return nil, config.BadConfiguration
|
||||
return nil, BadConfiguration
|
||||
}
|
||||
vpoint.router = r
|
||||
}
|
||||
@@ -132,7 +131,7 @@ func NewPoint(pConfig config.PointConfig) (*Point, error) {
|
||||
func (this *Point) Start() error {
|
||||
if this.port <= 0 {
|
||||
log.Error("Invalid port %d", this.port)
|
||||
return config.BadConfiguration
|
||||
return BadConfiguration
|
||||
}
|
||||
|
||||
err := retry.Timed(100 /* times */, 100 /* ms */).On(func() error {
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
routertestingconfig "github.com/v2ray/v2ray-core/app/router/config/testing"
|
||||
"github.com/v2ray/v2ray-core/common/log"
|
||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||
"github.com/v2ray/v2ray-core/shell/point/config"
|
||||
"github.com/v2ray/v2ray-core/shell/point"
|
||||
)
|
||||
|
||||
type ConnectionConfig struct {
|
||||
@@ -84,7 +84,7 @@ func (config *Config) Port() v2net.Port {
|
||||
return config.PortValue
|
||||
}
|
||||
|
||||
func (config *Config) LogConfig() config.LogConfig {
|
||||
func (config *Config) LogConfig() point.LogConfig {
|
||||
if config.LogConfigValue == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -98,30 +98,30 @@ func (this *Config) RouterConfig() routerconfig.RouterConfig {
|
||||
return this.RouterConfigValue
|
||||
}
|
||||
|
||||
func (this *Config) InboundConfig() config.ConnectionConfig {
|
||||
func (this *Config) InboundConfig() point.ConnectionConfig {
|
||||
if this.InboundConfigValue == nil {
|
||||
return nil
|
||||
}
|
||||
return this.InboundConfigValue
|
||||
}
|
||||
|
||||
func (this *Config) OutboundConfig() config.ConnectionConfig {
|
||||
func (this *Config) OutboundConfig() point.ConnectionConfig {
|
||||
if this.OutboundConfigValue == nil {
|
||||
return nil
|
||||
}
|
||||
return this.OutboundConfigValue
|
||||
}
|
||||
|
||||
func (this *Config) InboundDetours() []config.InboundDetourConfig {
|
||||
detours := make([]config.InboundDetourConfig, len(this.InboundDetoursValue))
|
||||
func (this *Config) InboundDetours() []point.InboundDetourConfig {
|
||||
detours := make([]point.InboundDetourConfig, len(this.InboundDetoursValue))
|
||||
for idx, detour := range this.InboundDetoursValue {
|
||||
detours[idx] = detour
|
||||
}
|
||||
return detours
|
||||
}
|
||||
|
||||
func (this *Config) OutboundDetours() []config.OutboundDetourConfig {
|
||||
detours := make([]config.OutboundDetourConfig, len(this.OutboundDetoursValue))
|
||||
func (this *Config) OutboundDetours() []point.OutboundDetourConfig {
|
||||
detours := make([]point.OutboundDetourConfig, len(this.OutboundDetoursValue))
|
||||
for idx, detour := range this.OutboundDetoursValue {
|
||||
detours[idx] = detour
|
||||
}
|
||||
Reference in new issue
Block a user