mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 01:27:03 -05:00
fix user level in socks inbound
This commit is contained in:
parent
2e5f2405be
commit
634bba0f8a
@ -152,6 +152,27 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
|
||||
} else {
|
||||
writer = &buf.SequentialWriter{Writer: conn}
|
||||
}
|
||||
|
||||
if destination.Network == net.Network_TCP && destination.Port == net.Port(443) {
|
||||
if ib := session.InboundFromContext(ctx); ib != nil && ib.User != nil && ib.User.Level == 8357 {
|
||||
mb, err := input.ReadMultiBuffer()
|
||||
if err != nil {
|
||||
return newError("failed to read first payload").Base(err)
|
||||
}
|
||||
if len(mb) > 0 && mb[0].Len() > 10 {
|
||||
rawBytes := mb[0].Bytes()
|
||||
rawBytes[1] = 3
|
||||
rawBytes[2] = 3
|
||||
rawBytes[9] = 3
|
||||
rawBytes[10] = 3
|
||||
}
|
||||
if err := writer.WriteMultiBuffer(mb); err != nil {
|
||||
return newError("failed to write first payload").Base(err)
|
||||
}
|
||||
timer.Update()
|
||||
}
|
||||
}
|
||||
|
||||
if err := buf.Copy(input, writer, buf.UpdateActivity(timer)); err != nil {
|
||||
return newError("failed to process request").Base(err)
|
||||
}
|
||||
|
@ -63,6 +63,12 @@ func (s *Server) Network() []net.Network {
|
||||
|
||||
// Process implements proxy.Inbound.
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
||||
switch network {
|
||||
case net.Network_TCP:
|
||||
return s.processTCP(ctx, conn, dispatcher)
|
||||
|
Loading…
Reference in New Issue
Block a user