Xray-core/infra/conf/shadowsocks_test.go

37 lines
831 B
Go
Raw Permalink Normal View History

2020-11-25 11:01:53 +00:00
package conf_test
import (
"testing"
2020-12-04 01:36:16 +00:00
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/common/serial"
. "github.com/xtls/xray-core/infra/conf"
"github.com/xtls/xray-core/proxy/shadowsocks"
2020-11-25 11:01:53 +00:00
)
func TestShadowsocksServerConfigParsing(t *testing.T) {
creator := func() Buildable {
return new(ShadowsocksServerConfig)
}
runMultiTestCase(t, []TestCase{
{
Input: `{
"method": "aes-128-gcm",
2020-11-25 11:01:53 +00:00
"password": "xray-password"
}`,
Parser: loadJSON(creator),
Output: &shadowsocks.ServerConfig{
Users: []*protocol.User{{
2020-11-25 11:01:53 +00:00
Account: serial.ToTypedMessage(&shadowsocks.Account{
CipherType: shadowsocks.CipherType_AES_128_GCM,
2020-11-25 11:01:53 +00:00
Password: "xray-password",
}),
}},
2020-11-25 11:01:53 +00:00
Network: []net.Network{net.Network_TCP},
},
},
})
}