mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-23 00:38:33 +02:00
refactor(route): unify common fields into routes.go
This commit is contained in:
@@ -11,20 +11,14 @@ import (
|
||||
net "github.com/yusing/go-proxy/internal/net/types"
|
||||
"github.com/yusing/go-proxy/internal/route/routes"
|
||||
"github.com/yusing/go-proxy/internal/task"
|
||||
"github.com/yusing/go-proxy/internal/watcher/health"
|
||||
"github.com/yusing/go-proxy/internal/watcher/health/monitor"
|
||||
)
|
||||
|
||||
// TODO: support stream load balance.
|
||||
type StreamRoute struct {
|
||||
*Route
|
||||
|
||||
net.Stream `json:"-"`
|
||||
|
||||
HealthMon health.HealthMonitor `json:"health"`
|
||||
|
||||
task *task.Task
|
||||
|
||||
l zerolog.Logger
|
||||
}
|
||||
|
||||
@@ -88,20 +82,6 @@ func (r *StreamRoute) Start(parent task.Parent) gperr.Error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Task implements task.TaskStarter.
|
||||
func (r *StreamRoute) Task() *task.Task {
|
||||
return r.task
|
||||
}
|
||||
|
||||
// Finish implements task.TaskFinisher.
|
||||
func (r *StreamRoute) Finish(reason any) {
|
||||
r.task.Finish(reason)
|
||||
}
|
||||
|
||||
func (r *StreamRoute) HealthMonitor() health.HealthMonitor {
|
||||
return r.HealthMon
|
||||
}
|
||||
|
||||
func (r *StreamRoute) acceptConnections() {
|
||||
defer r.task.Finish("listener closed")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user