freedom_test.go 966 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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/common/net"
  6. "github.com/v2fly/v2ray-core/v4/common/protocol"
  7. . "github.com/v2fly/v2ray-core/v4/infra/conf"
  8. "github.com/v2fly/v2ray-core/v4/proxy/freedom"
  9. )
  10. func TestFreedomConfig(t *testing.T) {
  11. creator := func() cfgcommon.Buildable {
  12. return new(FreedomConfig)
  13. }
  14. runMultiTestCase(t, []TestCase{
  15. {
  16. Input: `{
  17. "domainStrategy": "AsIs",
  18. "timeout": 10,
  19. "redirect": "127.0.0.1:3366",
  20. "userLevel": 1
  21. }`,
  22. Parser: loadJSON(creator),
  23. Output: &freedom.Config{
  24. DomainStrategy: freedom.Config_AS_IS,
  25. Timeout: 10,
  26. DestinationOverride: &freedom.DestinationOverride{
  27. Server: &protocol.ServerEndpoint{
  28. Address: &net.IPOrDomain{
  29. Address: &net.IPOrDomain_Ip{
  30. Ip: []byte{127, 0, 0, 1},
  31. },
  32. },
  33. Port: 3366,
  34. },
  35. },
  36. UserLevel: 1,
  37. },
  38. },
  39. })
  40. }