|
|
@ -4,6 +4,7 @@ package point_test
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"encoding/json"
|
|
|
|
|
|
|
|
"io"
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
@ -14,13 +15,19 @@ import (
|
|
|
|
"v2ray.com/core/testing/assert"
|
|
|
|
"v2ray.com/core/testing/assert"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func OpenFile(file string, assert *assert.Assert) io.Reader {
|
|
|
|
|
|
|
|
input, err := os.Open(file)
|
|
|
|
|
|
|
|
assert.Error(err).IsNil()
|
|
|
|
|
|
|
|
return input
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestClientSampleConfig(t *testing.T) {
|
|
|
|
func TestClientSampleConfig(t *testing.T) {
|
|
|
|
assert := assert.On(t)
|
|
|
|
assert := assert.On(t)
|
|
|
|
|
|
|
|
|
|
|
|
GOPATH := os.Getenv("GOPATH")
|
|
|
|
GOPATH := os.Getenv("GOPATH")
|
|
|
|
baseDir := filepath.Join(GOPATH, "src", "v2ray.com", "core", "tools", "release", "config")
|
|
|
|
baseDir := filepath.Join(GOPATH, "src", "v2ray.com", "core", "tools", "release", "config")
|
|
|
|
|
|
|
|
|
|
|
|
pointConfig, err := LoadConfig(filepath.Join(baseDir, "vpoint_socks_vmess.json"))
|
|
|
|
pointConfig, err := LoadConfig(OpenFile(filepath.Join(baseDir, "vpoint_socks_vmess.json"), assert))
|
|
|
|
assert.Error(err).IsNil()
|
|
|
|
assert.Error(err).IsNil()
|
|
|
|
|
|
|
|
|
|
|
|
assert.Pointer(pointConfig.InboundConfig).IsNotNil()
|
|
|
|
assert.Pointer(pointConfig.InboundConfig).IsNotNil()
|
|
|
@ -40,7 +47,7 @@ func TestServerSampleConfig(t *testing.T) {
|
|
|
|
GOPATH := os.Getenv("GOPATH")
|
|
|
|
GOPATH := os.Getenv("GOPATH")
|
|
|
|
baseDir := filepath.Join(GOPATH, "src", "v2ray.com", "core", "tools", "release", "config")
|
|
|
|
baseDir := filepath.Join(GOPATH, "src", "v2ray.com", "core", "tools", "release", "config")
|
|
|
|
|
|
|
|
|
|
|
|
pointConfig, err := LoadConfig(filepath.Join(baseDir, "vpoint_vmess_freedom.json"))
|
|
|
|
pointConfig, err := LoadConfig(OpenFile(filepath.Join(baseDir, "vpoint_vmess_freedom.json"), assert))
|
|
|
|
assert.Error(err).IsNil()
|
|
|
|
assert.Error(err).IsNil()
|
|
|
|
|
|
|
|
|
|
|
|
assert.Pointer(pointConfig.InboundConfig).IsNotNil()
|
|
|
|
assert.Pointer(pointConfig.InboundConfig).IsNotNil()
|
|
|
|