Default listen address to 0.0.0.0 in GenXrayInboundConfig
When the listen address is empty, it now defaults to 0.0.0.0 to ensure proper dual-stack IPv4/IPv6 binding, improving compatibility on systems with bindv6only=0.
This commit is contained in:
@@ -80,9 +80,12 @@ type HistoryOfSeeders struct {
|
|||||||
// GenXrayInboundConfig generates an Xray inbound configuration from the Inbound model.
|
// GenXrayInboundConfig generates an Xray inbound configuration from the Inbound model.
|
||||||
func (i *Inbound) GenXrayInboundConfig() *xray.InboundConfig {
|
func (i *Inbound) GenXrayInboundConfig() *xray.InboundConfig {
|
||||||
listen := i.Listen
|
listen := i.Listen
|
||||||
if listen != "" {
|
// Default to 0.0.0.0 (all interfaces) when listen is empty
|
||||||
listen = fmt.Sprintf("\"%v\"", listen)
|
// This ensures proper dual-stack IPv4/IPv6 binding in systems where bindv6only=0
|
||||||
|
if listen == "" {
|
||||||
|
listen = "0.0.0.0"
|
||||||
}
|
}
|
||||||
|
listen = fmt.Sprintf("\"%v\"", listen)
|
||||||
return &xray.InboundConfig{
|
return &xray.InboundConfig{
|
||||||
Listen: json_util.RawMessage(listen),
|
Listen: json_util.RawMessage(listen),
|
||||||
Port: i.Port,
|
Port: i.Port,
|
||||||
|
|||||||
Reference in New Issue
Block a user