github.com/xmplusdev/xmcore@v1.8.11-0.20240412132628-5518b55526af/infra/conf/shadowsocks_test.go (about)

     1  package conf_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/xmplusdev/xmcore/common/net"
     7  	"github.com/xmplusdev/xmcore/common/protocol"
     8  	"github.com/xmplusdev/xmcore/common/serial"
     9  	. "github.com/xmplusdev/xmcore/infra/conf"
    10  	"github.com/xmplusdev/xmcore/proxy/shadowsocks"
    11  )
    12  
    13  func TestShadowsocksServerConfigParsing(t *testing.T) {
    14  	creator := func() Buildable {
    15  		return new(ShadowsocksServerConfig)
    16  	}
    17  
    18  	runMultiTestCase(t, []TestCase{
    19  		{
    20  			Input: `{
    21  				"method": "aes-256-GCM",
    22  				"password": "xray-password"
    23  			}`,
    24  			Parser: loadJSON(creator),
    25  			Output: &shadowsocks.ServerConfig{
    26  				Users: []*protocol.User{{
    27  					Account: serial.ToTypedMessage(&shadowsocks.Account{
    28  						CipherType: shadowsocks.CipherType_AES_256_GCM,
    29  						Password:   "xray-password",
    30  					}),
    31  				}},
    32  				Network: []net.Network{net.Network_TCP},
    33  			},
    34  		},
    35  	})
    36  }