github.com/xraypb/Xray-core@v1.8.1/infra/conf/dokodemo_test.go (about) 1 package conf_test 2 3 import ( 4 "testing" 5 6 "github.com/xraypb/Xray-core/common/net" 7 . "github.com/xraypb/Xray-core/infra/conf" 8 "github.com/xraypb/Xray-core/proxy/dokodemo" 9 ) 10 11 func TestDokodemoConfig(t *testing.T) { 12 creator := func() Buildable { 13 return new(DokodemoConfig) 14 } 15 16 runMultiTestCase(t, []TestCase{ 17 { 18 Input: `{ 19 "address": "8.8.8.8", 20 "port": 53, 21 "network": "tcp", 22 "timeout": 10, 23 "followRedirect": true, 24 "userLevel": 1 25 }`, 26 Parser: loadJSON(creator), 27 Output: &dokodemo.Config{ 28 Address: &net.IPOrDomain{ 29 Address: &net.IPOrDomain_Ip{ 30 Ip: []byte{8, 8, 8, 8}, 31 }, 32 }, 33 Port: 53, 34 Networks: []net.Network{net.Network_TCP}, 35 Timeout: 10, 36 FollowRedirect: true, 37 UserLevel: 1, 38 }, 39 }, 40 }) 41 }