|
|
|
@ -9,6 +9,8 @@ import (
|
|
|
|
|
"syscall" |
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
"github.com/xtls/xray-core/transport/internet/stat" |
|
|
|
|
|
|
|
|
|
"github.com/xtls/xray-core/common" |
|
|
|
|
"github.com/xtls/xray-core/common/buf" |
|
|
|
|
"github.com/xtls/xray-core/common/errors" |
|
|
|
@ -25,7 +27,6 @@ import (
|
|
|
|
|
"github.com/xtls/xray-core/features/policy" |
|
|
|
|
"github.com/xtls/xray-core/features/routing" |
|
|
|
|
"github.com/xtls/xray-core/features/stats" |
|
|
|
|
"github.com/xtls/xray-core/transport/internet" |
|
|
|
|
"github.com/xtls/xray-core/transport/internet/udp" |
|
|
|
|
"github.com/xtls/xray-core/transport/internet/xtls" |
|
|
|
|
) |
|
|
|
@ -141,11 +142,11 @@ func (s *Server) Network() []net.Network {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Process implements proxy.Inbound.Process().
|
|
|
|
|
func (s *Server) Process(ctx context.Context, network net.Network, conn internet.Connection, dispatcher routing.Dispatcher) error { |
|
|
|
|
func (s *Server) Process(ctx context.Context, network net.Network, conn stat.Connection, dispatcher routing.Dispatcher) error { |
|
|
|
|
sid := session.ExportIDToError(ctx) |
|
|
|
|
|
|
|
|
|
iConn := conn |
|
|
|
|
statConn, ok := iConn.(*internet.StatCouterConnection) |
|
|
|
|
statConn, ok := iConn.(*stat.CounterConnection) |
|
|
|
|
if ok { |
|
|
|
|
iConn = statConn.Connection |
|
|
|
|
} |
|
|
|
@ -343,7 +344,7 @@ func (s *Server) handleUDPPayload(ctx context.Context, clientReader *PacketReade
|
|
|
|
|
func (s *Server) handleConnection(ctx context.Context, sessionPolicy policy.Session, |
|
|
|
|
destination net.Destination, |
|
|
|
|
clientReader buf.Reader, |
|
|
|
|
clientWriter buf.Writer, dispatcher routing.Dispatcher, iConn internet.Connection, rawConn syscall.RawConn, statConn *internet.StatCouterConnection) error { |
|
|
|
|
clientWriter buf.Writer, dispatcher routing.Dispatcher, iConn stat.Connection, rawConn syscall.RawConn, statConn *stat.CounterConnection) error { |
|
|
|
|
ctx, cancel := context.WithCancel(ctx) |
|
|
|
|
timer := signal.CancelAfterInactivity(ctx, cancel, sessionPolicy.Timeouts.ConnectionIdle) |
|
|
|
|
ctx = policy.ContextWithBufferPolicy(ctx, sessionPolicy.Buffer) |
|
|
|
@ -391,7 +392,7 @@ func (s *Server) handleConnection(ctx context.Context, sessionPolicy policy.Sess
|
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (s *Server) fallback(ctx context.Context, sid errors.ExportOption, err error, sessionPolicy policy.Session, connection internet.Connection, iConn internet.Connection, napfb map[string]map[string]map[string]*Fallback, first *buf.Buffer, firstLen int64, reader buf.Reader) error { |
|
|
|
|
func (s *Server) fallback(ctx context.Context, sid errors.ExportOption, err error, sessionPolicy policy.Session, connection stat.Connection, iConn stat.Connection, napfb map[string]map[string]map[string]*Fallback, first *buf.Buffer, firstLen int64, reader buf.Reader) error { |
|
|
|
|
if err := connection.SetReadDeadline(time.Time{}); err != nil { |
|
|
|
|
newError("unable to set back read deadline").Base(err).AtWarning().WriteToLog(sid) |
|
|
|
|
} |
|
|
|
|