1
0

http_test.go 686 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package conf_test
  2. import (
  3. "testing"
  4. . "github.com/xtls/xray-core/infra/conf"
  5. "github.com/xtls/xray-core/proxy/http"
  6. )
  7. func TestHTTPServerConfig(t *testing.T) {
  8. creator := func() Buildable {
  9. return new(HTTPServerConfig)
  10. }
  11. runMultiTestCase(t, []TestCase{
  12. {
  13. Input: `{
  14. "timeout": 10,
  15. "accounts": [
  16. {
  17. "user": "my-username",
  18. "pass": "my-password"
  19. }
  20. ],
  21. "allowTransparent": true,
  22. "userLevel": 1
  23. }`,
  24. Parser: loadJSON(creator),
  25. Output: &http.ServerConfig{
  26. Accounts: map[string]string{
  27. "my-username": "my-password",
  28. },
  29. AllowTransparent: true,
  30. UserLevel: 1,
  31. Timeout: 10,
  32. },
  33. },
  34. })
  35. }