mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-12-01 06:08:37 +00:00
rebase
This commit is contained in:
+5
-1
@@ -241,6 +241,7 @@ type MultiplexConfig struct {
|
||||
Concurrency int16 `json:"concurrency"`
|
||||
XudpConcurrency int16 `json:"xudpConcurrency"`
|
||||
XudpProxyUDP443 string `json:"xudpProxyUDP443"`
|
||||
MaxReuseTimes int32 `json:"maxReuseTimes"`
|
||||
}
|
||||
|
||||
func (c *MultiplexConfig) Build() (*vless.Multiplex, error) {
|
||||
@@ -252,7 +253,10 @@ func (c *MultiplexConfig) Build() (*vless.Multiplex, error) {
|
||||
udp443 = "reject"
|
||||
}
|
||||
return multiplex.NormalizeConfig(&vless.Multiplex{
|
||||
Concurrency: int32(c.Concurrency), XudpConcurrency: int32(c.XudpConcurrency), XudpProxyUDP443: udp443,
|
||||
Concurrency: int32(c.Concurrency),
|
||||
XudpConcurrency: int32(c.XudpConcurrency),
|
||||
XudpProxyUDP443: udp443,
|
||||
MaxReuseTimes: c.MaxReuseTimes,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -236,9 +236,11 @@ func TestMultiplexConfig_Build(t *testing.T) {
|
||||
{name: "empty", fields: `{}`},
|
||||
{name: "both zero", fields: `{"concurrency":0,"xudpConcurrency":0}`},
|
||||
{name: "regular pool", fields: `{"concurrency":4}`, want: &vless.Multiplex{Concurrency: 4, XudpProxyUDP443: "reject"}},
|
||||
{name: "regular pool with maxReuseTimes", fields: `{"concurrency":4,"maxReuseTimes":128}`, want: &vless.Multiplex{Concurrency: 4, XudpProxyUDP443: "reject", MaxReuseTimes: 128}},
|
||||
{name: "XUDP only", fields: `{"xudpConcurrency":8}`, want: &vless.Multiplex{XudpConcurrency: 8, XudpProxyUDP443: "reject"}},
|
||||
{name: "negative concurrency", fields: `{"concurrency":-1,"xudpConcurrency":8}`, bad: true},
|
||||
{name: "negative XUDP concurrency", fields: `{"concurrency":4,"xudpConcurrency":-1}`, bad: true},
|
||||
{name: "negative maxReuseTimes", fields: `{"concurrency":4,"maxReuseTimes":-1}`, bad: true},
|
||||
{name: "invalid UDP policy", fields: `{"concurrency":4,"xudpProxyUDP443":"invalid"}`, bad: true},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user