mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-28 20:01:50 +01:00
v0.5: (BREAKING) simplified config format, improved error output, updated proxy entry default value for 'port'
This commit is contained in:
@@ -106,6 +106,10 @@ func NewHTTPRoute(entry *P.Entry) (*HTTPRoute, E.NestedError) {
|
||||
return r, E.Nil()
|
||||
}
|
||||
|
||||
func (r *HTTPRoute) String() string {
|
||||
return fmt.Sprintf("%s (reverse proxy)", r.Alias)
|
||||
}
|
||||
|
||||
func (r *HTTPRoute) Start() E.NestedError {
|
||||
httpRoutes.Set(r.Alias.String(), r)
|
||||
return E.Nil()
|
||||
|
||||
@@ -11,6 +11,7 @@ type (
|
||||
Route interface {
|
||||
Start() E.NestedError
|
||||
Stop() E.NestedError
|
||||
String() string
|
||||
}
|
||||
Routes = F.Map[string, Route]
|
||||
)
|
||||
|
||||
@@ -49,6 +49,10 @@ func NewStreamRoute(entry *P.StreamEntry) (*StreamRoute, E.NestedError) {
|
||||
return base, E.Nil()
|
||||
}
|
||||
|
||||
func (r *StreamRoute) String() string {
|
||||
return fmt.Sprintf("%s (%v stream)", r.Alias, r.Scheme)
|
||||
}
|
||||
|
||||
func (r *StreamRoute) Start() E.NestedError {
|
||||
if r.started.Load() {
|
||||
return E.Invalid("state", "already started")
|
||||
|
||||
Reference in New Issue
Block a user