github.com/xraypb/Xray-core@v1.8.1/infra/conf/freedom_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/common/protocol"
     8  	. "github.com/xraypb/Xray-core/infra/conf"
     9  	"github.com/xraypb/Xray-core/proxy/freedom"
    10  )
    11  
    12  func TestFreedomConfig(t *testing.T) {
    13  	creator := func() Buildable {
    14  		return new(FreedomConfig)
    15  	}
    16  
    17  	runMultiTestCase(t, []TestCase{
    18  		{
    19  			Input: `{
    20  				"domainStrategy": "AsIs",
    21  				"timeout": 10,
    22  				"redirect": "127.0.0.1:3366",
    23  				"userLevel": 1
    24  			}`,
    25  			Parser: loadJSON(creator),
    26  			Output: &freedom.Config{
    27  				DomainStrategy: freedom.Config_AS_IS,
    28  				Timeout:        10,
    29  				DestinationOverride: &freedom.DestinationOverride{
    30  					Server: &protocol.ServerEndpoint{
    31  						Address: &net.IPOrDomain{
    32  							Address: &net.IPOrDomain_Ip{
    33  								Ip: []byte{127, 0, 0, 1},
    34  							},
    35  						},
    36  						Port: 3366,
    37  					},
    38  				},
    39  				UserLevel: 1,
    40  			},
    41  		},
    42  	})
    43  }