reverse_test.go 877 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package conf_test
  2. import (
  3. "github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
  4. "testing"
  5. "github.com/v2fly/v2ray-core/v4/app/reverse"
  6. "github.com/v2fly/v2ray-core/v4/infra/conf"
  7. )
  8. func TestReverseConfig(t *testing.T) {
  9. creator := func() cfgcommon.Buildable {
  10. return new(conf.ReverseConfig)
  11. }
  12. runMultiTestCase(t, []TestCase{
  13. {
  14. Input: `{
  15. "bridges": [{
  16. "tag": "test",
  17. "domain": "test.v2fly.org"
  18. }]
  19. }`,
  20. Parser: loadJSON(creator),
  21. Output: &reverse.Config{
  22. BridgeConfig: []*reverse.BridgeConfig{
  23. {Tag: "test", Domain: "test.v2fly.org"},
  24. },
  25. },
  26. },
  27. {
  28. Input: `{
  29. "portals": [{
  30. "tag": "test",
  31. "domain": "test.v2fly.org"
  32. }]
  33. }`,
  34. Parser: loadJSON(creator),
  35. Output: &reverse.Config{
  36. PortalConfig: []*reverse.PortalConfig{
  37. {Tag: "test", Domain: "test.v2fly.org"},
  38. },
  39. },
  40. },
  41. })
  42. }