2020-11-25 14:01:53 +03:00
|
|
|
package conf_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2020-12-04 04:36:16 +03: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 14:01:53 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestShadowsocksServerConfigParsing(t *testing.T) {
|
|
|
|
creator := func() Buildable {
|
|
|
|
return new(ShadowsocksServerConfig)
|
|
|
|
}
|
|
|
|
|
|
|
|
runMultiTestCase(t, []TestCase{
|
|
|
|
{
|
|
|
|
Input: `{
|
2021-09-16 23:13:07 +03:00
|
|
|
"method": "aes-256-GCM",
|
2020-11-25 14:01:53 +03:00
|
|
|
"password": "xray-password"
|
|
|
|
}`,
|
|
|
|
Parser: loadJSON(creator),
|
|
|
|
Output: &shadowsocks.ServerConfig{
|
2021-01-19 01:52:35 +03:00
|
|
|
Users: []*protocol.User{{
|
2020-11-25 14:01:53 +03:00
|
|
|
Account: serial.ToTypedMessage(&shadowsocks.Account{
|
2021-09-16 23:13:07 +03:00
|
|
|
CipherType: shadowsocks.CipherType_AES_256_GCM,
|
2020-11-25 14:01:53 +03:00
|
|
|
Password: "xray-password",
|
|
|
|
}),
|
2021-01-19 01:52:35 +03:00
|
|
|
}},
|
2020-11-25 14:01:53 +03:00
|
|
|
Network: []net.Network{net.Network_TCP},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|