You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Xray-core/infra/conf/shadowsocks_test.go

37 lines
831 B

4 years ago
package conf_test
import (
"testing"
4 years ago
"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"
4 years ago
)
func TestShadowsocksServerConfigParsing(t *testing.T) {
creator := func() Buildable {
return new(ShadowsocksServerConfig)
}
runMultiTestCase(t, []TestCase{
{
Input: `{
"method": "aes-128-gcm",
4 years ago
"password": "xray-password"
}`,
Parser: loadJSON(creator),
Output: &shadowsocks.ServerConfig{
Users: []*protocol.User{{
4 years ago
Account: serial.ToTypedMessage(&shadowsocks.Account{
CipherType: shadowsocks.CipherType_AES_128_GCM,
4 years ago
Password: "xray-password",
}),
}},
4 years ago
Network: []net.Network{net.Network_TCP},
},
},
})
}