mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-29 03:51:31 +00:00
Enable XUDP by default in VLESS
This commit is contained in:
parent
f7e9d9ab1f
commit
d0e9443031
|
@ -60,6 +60,8 @@ TLS configuration, see [TLS](/configuration/shared/tls/#outbound).
|
||||||
|
|
||||||
#### packet_encoding
|
#### packet_encoding
|
||||||
|
|
||||||
|
UDP packet encoding, xudp is used by default.
|
||||||
|
|
||||||
| Encoding | Description |
|
| Encoding | Description |
|
||||||
|------------|-----------------------|
|
|------------|-----------------------|
|
||||||
| (none) | Disabled |
|
| (none) | Disabled |
|
||||||
|
|
|
@ -60,6 +60,8 @@ TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#outbound)。
|
||||||
|
|
||||||
#### packet_encoding
|
#### packet_encoding
|
||||||
|
|
||||||
|
UDP 包编码,默认使用 xudp。
|
||||||
|
|
||||||
| 编码 | 描述 |
|
| 编码 | 描述 |
|
||||||
|------------|---------------|
|
|------------|---------------|
|
||||||
| (空) | 禁用 |
|
| (空) | 禁用 |
|
||||||
|
|
|
@ -86,6 +86,8 @@ TLS configuration, see [TLS](/configuration/shared/tls/#outbound).
|
||||||
|
|
||||||
#### packet_encoding
|
#### packet_encoding
|
||||||
|
|
||||||
|
UDP packet encoding.
|
||||||
|
|
||||||
| Encoding | Description |
|
| Encoding | Description |
|
||||||
|------------|-----------------------|
|
|------------|-----------------------|
|
||||||
| (none) | Disabled |
|
| (none) | Disabled |
|
||||||
|
|
|
@ -86,6 +86,8 @@ TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#outbound)。
|
||||||
|
|
||||||
#### packet_encoding
|
#### packet_encoding
|
||||||
|
|
||||||
|
UDP 包编码。
|
||||||
|
|
||||||
| 编码 | 描述 |
|
| 编码 | 描述 |
|
||||||
|------------|---------------|
|
|------------|---------------|
|
||||||
| (空) | 禁用 |
|
| (空) | 禁用 |
|
||||||
|
|
|
@ -20,5 +20,5 @@ type VLESSOutboundOptions struct {
|
||||||
Network NetworkList `json:"network,omitempty"`
|
Network NetworkList `json:"network,omitempty"`
|
||||||
TLS *OutboundTLSOptions `json:"tls,omitempty"`
|
TLS *OutboundTLSOptions `json:"tls,omitempty"`
|
||||||
Transport *V2RayTransportOptions `json:"transport,omitempty"`
|
Transport *V2RayTransportOptions `json:"transport,omitempty"`
|
||||||
PacketEncoding string `json:"packet_encoding,omitempty"`
|
PacketEncoding *string `json:"packet_encoding,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,14 +58,18 @@ func NewVLESS(ctx context.Context, router adapter.Router, logger log.ContextLogg
|
||||||
return nil, E.Cause(err, "create client transport: ", options.Transport.Type)
|
return nil, E.Cause(err, "create client transport: ", options.Transport.Type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch options.PacketEncoding {
|
if options.PacketEncoding == nil {
|
||||||
case "":
|
|
||||||
case "packetaddr":
|
|
||||||
outbound.packetAddr = true
|
|
||||||
case "xudp":
|
|
||||||
outbound.xudp = true
|
outbound.xudp = true
|
||||||
default:
|
} else {
|
||||||
return nil, E.New("unknown packet encoding: ", options.PacketEncoding)
|
switch *options.PacketEncoding {
|
||||||
|
case "":
|
||||||
|
case "packetaddr":
|
||||||
|
outbound.packetAddr = true
|
||||||
|
case "xudp":
|
||||||
|
outbound.xudp = true
|
||||||
|
default:
|
||||||
|
return nil, E.New("unknown packet encoding: ", options.PacketEncoding)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
outbound.client, err = vless.NewClient(options.UUID, options.Flow, logger)
|
outbound.client, err = vless.NewClient(options.UUID, options.Flow, logger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue