github.com/imannamdari/v2ray-core/v5@v5.0.5/infra/conf/v4/reverse_test.go (about)

     1  package v4_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/imannamdari/v2ray-core/v5/app/reverse"
     7  	"github.com/imannamdari/v2ray-core/v5/infra/conf/cfgcommon"
     8  	"github.com/imannamdari/v2ray-core/v5/infra/conf/cfgcommon/testassist"
     9  	v4 "github.com/imannamdari/v2ray-core/v5/infra/conf/v4"
    10  )
    11  
    12  func TestReverseConfig(t *testing.T) {
    13  	creator := func() cfgcommon.Buildable {
    14  		return new(v4.ReverseConfig)
    15  	}
    16  
    17  	testassist.RunMultiTestCase(t, []testassist.TestCase{
    18  		{
    19  			Input: `{
    20  				"bridges": [{
    21  					"tag": "test",
    22  					"domain": "test.v2fly.org"
    23  				}]
    24  			}`,
    25  			Parser: testassist.LoadJSON(creator),
    26  			Output: &reverse.Config{
    27  				BridgeConfig: []*reverse.BridgeConfig{
    28  					{Tag: "test", Domain: "test.v2fly.org"},
    29  				},
    30  			},
    31  		},
    32  		{
    33  			Input: `{
    34  				"portals": [{
    35  					"tag": "test",
    36  					"domain": "test.v2fly.org"
    37  				}]
    38  			}`,
    39  			Parser: testassist.LoadJSON(creator),
    40  			Output: &reverse.Config{
    41  				PortalConfig: []*reverse.PortalConfig{
    42  					{Tag: "test", Domain: "test.v2fly.org"},
    43  				},
    44  			},
    45  		},
    46  	})
    47  }