config_json_test.go 741 B

1234567891011121314151617181920212223242526272829303132333435
  1. // +build json
  2. package outbound_test
  3. import (
  4. "encoding/json"
  5. "testing"
  6. //"github.com/v2ray/v2ray-core/common/protocol"
  7. . "github.com/v2ray/v2ray-core/proxy/vmess/outbound"
  8. "github.com/v2ray/v2ray-core/testing/assert"
  9. )
  10. func TestConfigTargetParsing(t *testing.T) {
  11. assert := assert.On(t)
  12. rawJson := `{
  13. "vnext": [{
  14. "address": "127.0.0.1",
  15. "port": 80,
  16. "users": [
  17. {
  18. "id": "e641f5ad-9397-41e3-bf1a-e8740dfed019",
  19. "email": "love@v2ray.com",
  20. "level": 255
  21. }
  22. ]
  23. }]
  24. }`
  25. config := new(Config)
  26. err := json.Unmarshal([]byte(rawJson), &config)
  27. assert.Error(err).IsNil()
  28. assert.Destination(config.Receivers[0].Destination()).EqualsString("tcp:127.0.0.1:80")
  29. }