refactor common/net.Port

This commit is contained in:
Darien Raymond committed 2015-12-02 20:44:01 +00:00
1 parent fa7c1069bc
commit ae056714db
33 files changed
+86 -70

No files matched your search

+3 -2
View File
@@ -8,13 +8,14 @@ import (
routerconfig "github.com/v2ray/v2ray-core/app/router/config"
routerconfigjson "github.com/v2ray/v2ray-core/app/router/config/json"
"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"
)
// Config is the config for Point server.
type Config struct {
PortValue uint16 `json:"port"` // Port of this Point server.
PortValue v2net.Port `json:"port"` // Port of this Point server.
LogConfigValue *LogConfig `json:"log"`
RouterConfigValue *routerconfigjson.RouterConfig `json:"routing"`
InboundConfigValue *ConnectionConfig `json:"inbound"`
@@ -23,7 +24,7 @@ type Config struct {
OutboundDetoursValue []*OutboundDetourConfig `json:"outboundDetour"`
}
func (config *Config) Port() uint16 {
func (config *Config) Port() v2net.Port {
return config.PortValue
}
+2 -2
View File
@@ -23,7 +23,7 @@ func TestClientSampleConfig(t *testing.T) {
pointConfig, err := json.LoadConfig(filepath.Join(baseDir, "vpoint_socks_vmess.json"))
assert.Error(err).IsNil()
assert.Uint16(pointConfig.Port()).Positive()
assert.Uint16(pointConfig.Port().Value()).Positive()
assert.Pointer(pointConfig.InboundConfig()).IsNotNil()
assert.Pointer(pointConfig.OutboundConfig()).IsNotNil()
@@ -43,7 +43,7 @@ func TestServerSampleConfig(t *testing.T) {
pointConfig, err := json.LoadConfig(filepath.Join(baseDir, "vpoint_vmess_freedom.json"))
assert.Error(err).IsNil()
assert.Uint16(pointConfig.Port()).Positive()
assert.Uint16(pointConfig.Port().Value()).Positive()
assert.Pointer(pointConfig.InboundConfig()).IsNotNil()
assert.Pointer(pointConfig.OutboundConfig()).IsNotNil()