1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-10 18:00:43 +00:00

fix inbound user in dekodemo door and http

This commit is contained in:
Darien Raymond 2019-02-15 00:46:19 +01:00
parent 634bba0f8a
commit 2a6cad2f9b
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
2 changed files with 14 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import (
"v2ray.com/core/common"
"v2ray.com/core/common/buf"
"v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
"v2ray.com/core/common/session"
"v2ray.com/core/common/signal"
"v2ray.com/core/common/task"
@ -99,6 +100,12 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn in
return newError("unable to get destination")
}
if inbound := session.InboundFromContext(ctx); inbound != nil {
inbound.User = &protocol.MemoryUser{
Level: d.config.UserLevel,
}
}
plcy := d.policy()
ctx, cancel := context.WithCancel(ctx)
timer := signal.CancelAfterInactivity(ctx, cancel, plcy.Timeouts.ConnectionIdle)

View File

@ -17,6 +17,7 @@ import (
"v2ray.com/core/common/errors"
"v2ray.com/core/common/log"
"v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
http_proto "v2ray.com/core/common/protocol/http"
"v2ray.com/core/common/session"
"v2ray.com/core/common/signal"
@ -84,6 +85,12 @@ type readerOnly struct {
}
func (s *Server) Process(ctx context.Context, network net.Network, conn internet.Connection, dispatcher routing.Dispatcher) error {
if inbound := session.InboundFromContext(ctx); inbound != nil {
inbound.User = &protocol.MemoryUser{
Level: s.config.UserLevel,
}
}
reader := bufio.NewReaderSize(readerOnly{conn}, buf.Size)
Start: