From 13188021db4c06d25a3ee0440e09e31176e8bbad Mon Sep 17 00:00:00 2001 From: Fangliding Date: Thu, 20 Aug 2026 13:52:06 +0800 Subject: [PATCH] Fix some other panic --- infra/conf/common.go | 3 +++ infra/conf/xray.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/infra/conf/common.go b/infra/conf/common.go index 0de3568cd..3ddd01574 100644 --- a/infra/conf/common.go +++ b/infra/conf/common.go @@ -65,6 +65,9 @@ func (v *Address) UnmarshalJSON(data []byte) error { } func (v *Address) Build() *net.IPOrDomain { + if v == nil { + return nil + } return net.NewIPOrDomain(v.Address) } diff --git a/infra/conf/xray.go b/infra/conf/xray.go index 3c70ec4c8..c029a7bf7 100644 --- a/infra/conf/xray.go +++ b/infra/conf/xray.go @@ -140,7 +140,7 @@ func (c *InboundDetourConfig) Build() (*core.InboundHandlerConfig, error) { // TUN inbound doesn't need port configuration as it uses network interface instead if strings.ToLower(c.Protocol) == "tun" { // Skip port validation for TUN - } else if c.ListenOn == nil { + } else if c.ListenOn == nil || len(c.ListenOn.String()) == 0 { // Listen on anyip, must set PortList if c.PortList == nil { return nil, errors.New("Listen on AnyIP but no Port(s) set in InboundDetour.")