From b411c6d504031fc8261adc9c9fbcbbf302472e89 Mon Sep 17 00:00:00 2001 From: yusing Date: Tue, 3 Jun 2025 22:48:35 +0800 Subject: [PATCH] feat(route): add api info for whether route is excluded --- internal/route/route.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/route/route.go b/internal/route/route.go index 8840405..7f295f3 100644 --- a/internal/route/route.go +++ b/internal/route/route.go @@ -64,6 +64,8 @@ type ( LisURL *net.URL `json:"lurl,omitempty"` ProxyURL *net.URL `json:"purl,omitempty"` + Excluded bool `json:"excluded"` + impl routes.Route isValidated bool lastError gperr.Error @@ -183,7 +185,9 @@ func (r *Route) Validate() gperr.Error { } r.ProxyURL = gperr.Collect(errs, net.ParseURL, fmt.Sprintf("%s://%s:%d", r.Scheme, r.Host, r.Port.Proxy)) case route.SchemeTCP, route.SchemeUDP: - r.LisURL = gperr.Collect(errs, net.ParseURL, fmt.Sprintf("%s://:%d", r.Scheme, r.Port.Listening)) + if !r.ShouldExclude() { + r.LisURL = gperr.Collect(errs, net.ParseURL, fmt.Sprintf("%s://:%d", r.Scheme, r.Port.Listening)) + } r.ProxyURL = gperr.Collect(errs, net.ParseURL, fmt.Sprintf("%s://%s:%d", r.Scheme, r.Host, r.Port.Proxy)) } @@ -213,6 +217,7 @@ func (r *Route) Validate() gperr.Error { } r.impl = impl + r.Excluded = r.ShouldExclude() return nil }