2016-07-25 10:48:09 -04:00
|
|
|
// +build json
|
|
|
|
|
|
|
|
package outbound_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"testing"
|
|
|
|
|
2016-08-20 14:55:45 -04:00
|
|
|
//"v2ray.com/core/common/protocol"
|
|
|
|
. "v2ray.com/core/proxy/vmess/outbound"
|
|
|
|
"v2ray.com/core/testing/assert"
|
2016-07-25 10:48:09 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestConfigTargetParsing(t *testing.T) {
|
|
|
|
assert := assert.On(t)
|
|
|
|
|
|
|
|
rawJson := `{
|
|
|
|
"vnext": [{
|
|
|
|
"address": "127.0.0.1",
|
|
|
|
"port": 80,
|
|
|
|
"users": [
|
|
|
|
{
|
|
|
|
"id": "e641f5ad-9397-41e3-bf1a-e8740dfed019",
|
|
|
|
"email": "love@v2ray.com",
|
|
|
|
"level": 255
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}]
|
|
|
|
}`
|
|
|
|
|
|
|
|
config := new(Config)
|
|
|
|
err := json.Unmarshal([]byte(rawJson), &config)
|
|
|
|
assert.Error(err).IsNil()
|
|
|
|
assert.Destination(config.Receivers[0].Destination()).EqualsString("tcp:127.0.0.1:80")
|
|
|
|
}
|