mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-07 03:52:34 +02:00
feat(route): add api info for whether route is excluded
This commit is contained in:
parent
966a59b5c9
commit
b411c6d504
1 changed files with 6 additions and 1 deletions
|
@ -64,6 +64,8 @@ type (
|
||||||
LisURL *net.URL `json:"lurl,omitempty"`
|
LisURL *net.URL `json:"lurl,omitempty"`
|
||||||
ProxyURL *net.URL `json:"purl,omitempty"`
|
ProxyURL *net.URL `json:"purl,omitempty"`
|
||||||
|
|
||||||
|
Excluded bool `json:"excluded"`
|
||||||
|
|
||||||
impl routes.Route
|
impl routes.Route
|
||||||
isValidated bool
|
isValidated bool
|
||||||
lastError gperr.Error
|
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))
|
r.ProxyURL = gperr.Collect(errs, net.ParseURL, fmt.Sprintf("%s://%s:%d", r.Scheme, r.Host, r.Port.Proxy))
|
||||||
case route.SchemeTCP, route.SchemeUDP:
|
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))
|
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.impl = impl
|
||||||
|
r.Excluded = r.ShouldExclude()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue