remove DetourTag and add more test cases

This commit is contained in:
Darien Raymond committed 2015-11-30 15:14:38 +00:00
1 parent f6c486327f
commit 56a79a2190
10 files changed
+60 -22

No files matched your search

+1 -3
View File
@@ -5,8 +5,6 @@ import (
v2net "github.com/v2ray/v2ray-core/common/net"
)
type DetourTag string
type ConnectionConfig interface {
Protocol() string
Settings() interface{}
@@ -24,7 +22,7 @@ type InboundDetourConfig interface {
type OutboundDetourConfig interface {
Protocol() string
Tag() DetourTag
Tag() string
Settings() interface{}
}
+2 -3
View File
@@ -4,7 +4,6 @@ import (
"encoding/json"
proxyconfig "github.com/v2ray/v2ray-core/proxy/common/config"
"github.com/v2ray/v2ray-core/shell/point/config"
)
type OutboundDetourConfig struct {
@@ -17,8 +16,8 @@ func (this *OutboundDetourConfig) Protocol() string {
return this.ProtocolValue
}
func (this *OutboundDetourConfig) Tag() config.DetourTag {
return config.DetourTag(this.TagValue)
func (this *OutboundDetourConfig) Tag() string {
return this.TagValue
}
func (this *OutboundDetourConfig) Settings() interface{} {
+2 -2
View File
@@ -47,10 +47,10 @@ func (this *InboundDetourConfig) PortRange() v2net.PortRange {
type OutboundDetourConfig struct {
ConnectionConfig
TagValue config.DetourTag
TagValue string
}
func (this *OutboundDetourConfig) Tag() config.DetourTag {
func (this *OutboundDetourConfig) Tag() string {
return this.TagValue
}
+2 -2
View File
@@ -16,7 +16,7 @@ type Point struct {
ich connhandler.InboundConnectionHandler
och connhandler.OutboundConnectionHandler
idh []*InboundDetourHandler
odh map[config.DetourTag]connhandler.OutboundConnectionHandler
odh map[string]connhandler.OutboundConnectionHandler
router router.Router
}
@@ -70,7 +70,7 @@ func NewPoint(pConfig config.PointConfig) (*Point, error) {
outboundDetours := pConfig.OutboundDetours()
if len(outboundDetours) > 0 {
vpoint.odh = make(map[config.DetourTag]connhandler.OutboundConnectionHandler)
vpoint.odh = make(map[string]connhandler.OutboundConnectionHandler)
for _, detourConfig := range outboundDetours {
detourFactory := connhandler.GetOutboundConnectionHandlerFactory(detourConfig.Protocol())
if detourFactory == nil {