reverse_test.go 815 B

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