mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-25 10:01: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
|
#### 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,7 +58,10 @@ 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 {
|
||||||
|
outbound.xudp = true
|
||||||
|
} else {
|
||||||
|
switch *options.PacketEncoding {
|
||||||
case "":
|
case "":
|
||||||
case "packetaddr":
|
case "packetaddr":
|
||||||
outbound.packetAddr = true
|
outbound.packetAddr = true
|
||||||
|
@ -67,6 +70,7 @@ func NewVLESS(ctx context.Context, router adapter.Router, logger log.ContextLogg
|
||||||
default:
|
default:
|
||||||
return nil, E.New("unknown packet encoding: ", options.PacketEncoding)
|
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 {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in a new issue