1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-06-16 15:59:58 -04:00

massive refactoring for interoperability

This commit is contained in:
Darien Raymond
2018-01-10 12:22:37 +01:00
parent 5a3c7fdd20
commit 292d7cc353
66 changed files with 1515 additions and 1200 deletions

View File

@@ -8,8 +8,7 @@ import (
"sync"
"time"
"v2ray.com/core/app"
"v2ray.com/core/app/dispatcher"
"v2ray.com/core"
"v2ray.com/core/app/proxyman"
"v2ray.com/core/common/buf"
"v2ray.com/core/common/errors"
@@ -262,21 +261,14 @@ func (m *Client) fetchOutput() {
}
type Server struct {
dispatcher dispatcher.Interface
dispatcher core.Dispatcher
}
// NewServer creates a new mux.Server.
func NewServer(ctx context.Context) *Server {
s := &Server{}
space := app.SpaceFromContext(ctx)
space.On(app.SpaceInitializing, func(interface{}) error {
d := dispatcher.FromSpace(space)
if d == nil {
return newError("no dispatcher in space")
}
s.dispatcher = d
return nil
})
s := &Server{
dispatcher: core.FromContext(ctx).Dispatcher(),
}
return s
}
@@ -295,8 +287,15 @@ func (s *Server) Dispatch(ctx context.Context, dest net.Destination) (ray.Inboun
return ray, nil
}
func (s *Server) Start() error {
return nil
}
func (s *Server) Close() {
}
type ServerWorker struct {
dispatcher dispatcher.Interface
dispatcher core.Dispatcher
outboundRay ray.OutboundRay
sessionManager *SessionManager
}