http_test.go 641 B

12345678910111213141516171819202122232425262728293031323334353637
  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. "accounts": [
  15. {
  16. "user": "my-username",
  17. "pass": "my-password"
  18. }
  19. ],
  20. "allowTransparent": true,
  21. "userLevel": 1
  22. }`,
  23. Parser: loadJSON(creator),
  24. Output: &http.ServerConfig{
  25. Accounts: map[string]string{
  26. "my-username": "my-password",
  27. },
  28. AllowTransparent: true,
  29. UserLevel: 1,
  30. },
  31. },
  32. })
  33. }