github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/infra/conf/v4/http_test.go (about) 1 package v4_test 2 3 import ( 4 "testing" 5 6 "github.com/v2fly/v2ray-core/v5/infra/conf/cfgcommon" 7 "github.com/v2fly/v2ray-core/v5/infra/conf/cfgcommon/testassist" 8 v4 "github.com/v2fly/v2ray-core/v5/infra/conf/v4" 9 "github.com/v2fly/v2ray-core/v5/proxy/http" 10 ) 11 12 func TestHTTPServerConfig(t *testing.T) { 13 creator := func() cfgcommon.Buildable { 14 return new(v4.HTTPServerConfig) 15 } 16 17 testassist.RunMultiTestCase(t, []testassist.TestCase{ 18 { 19 Input: `{ 20 "timeout": 10, 21 "accounts": [ 22 { 23 "user": "my-username", 24 "pass": "my-password" 25 } 26 ], 27 "allowTransparent": true, 28 "userLevel": 1 29 }`, 30 Parser: testassist.LoadJSON(creator), 31 Output: &http.ServerConfig{ 32 Accounts: map[string]string{ 33 "my-username": "my-password", 34 }, 35 AllowTransparent: true, 36 UserLevel: 1, 37 Timeout: 10, 38 }, 39 }, 40 }) 41 }