mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-22 08:31:30 +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
|
||||
|
||||
UDP packet encoding, xudp is used by default.
|
||||
|
||||
| Encoding | Description |
|
||||
|------------|-----------------------|
|
||||
| (none) | Disabled |
|
||||
|
|
|
@ -60,6 +60,8 @@ TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#outbound)。
|
|||
|
||||
#### packet_encoding
|
||||
|
||||
UDP 包编码,默认使用 xudp。
|
||||
|
||||
| 编码 | 描述 |
|
||||
|------------|---------------|
|
||||
| (空) | 禁用 |
|
||||
|
|
|
@ -86,6 +86,8 @@ TLS configuration, see [TLS](/configuration/shared/tls/#outbound).
|
|||
|
||||
#### packet_encoding
|
||||
|
||||
UDP packet encoding.
|
||||
|
||||
| Encoding | Description |
|
||||
|------------|-----------------------|
|
||||
| (none) | Disabled |
|
||||
|
|
|
@ -86,6 +86,8 @@ TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#outbound)。
|
|||
|
||||
#### packet_encoding
|
||||
|
||||
UDP 包编码。
|
||||
|
||||
| 编码 | 描述 |
|
||||
|------------|---------------|
|
||||
| (空) | 禁用 |
|
||||
|
|
|
@ -20,5 +20,5 @@ type VLESSOutboundOptions struct {
|
|||
Network NetworkList `json:"network,omitempty"`
|
||||
TLS *OutboundTLSOptions `json:"tls,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)
|
||||
}
|
||||
}
|
||||
switch options.PacketEncoding {
|
||||
case "":
|
||||
case "packetaddr":
|
||||
outbound.packetAddr = true
|
||||
case "xudp":
|
||||
if options.PacketEncoding == nil {
|
||||
outbound.xudp = true
|
||||
default:
|
||||
return nil, E.New("unknown packet encoding: ", options.PacketEncoding)
|
||||
} else {
|
||||
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)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue