mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-11-30 21:58:39 +00:00
Early reject
This commit is contained in:
@@ -152,6 +152,13 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
|
|||||||
rec := h.server
|
rec := h.server
|
||||||
var conn stat.Connection
|
var conn stat.Connection
|
||||||
|
|
||||||
|
account := rec.User.Account.(*vless.MemoryAccount)
|
||||||
|
|
||||||
|
if ob.Target.Network == net.Network_UDP && ob.Target.Port == 443 && account.Flow == vless.XRV {
|
||||||
|
proxy.DropUDP(ctx, link.Reader)
|
||||||
|
return errors.New("XTLS rejected UDP/443 traffic")
|
||||||
|
}
|
||||||
|
|
||||||
if h.testpre > 0 && h.reverse == nil {
|
if h.testpre > 0 && h.reverse == nil {
|
||||||
h.initpre.Do(func() {
|
h.initpre.Do(func() {
|
||||||
h.preConns = make(chan *ConnExpire)
|
h.preConns = make(chan *ConnExpire)
|
||||||
@@ -233,28 +240,20 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
|
|||||||
Port: target.Port,
|
Port: target.Port,
|
||||||
}
|
}
|
||||||
|
|
||||||
account := request.User.Account.(*vless.MemoryAccount)
|
|
||||||
|
|
||||||
requestAddons := &encoding.Addons{
|
requestAddons := &encoding.Addons{
|
||||||
Flow: account.Flow,
|
Flow: account.Flow,
|
||||||
}
|
}
|
||||||
|
|
||||||
var input *bytes.Reader
|
var input *bytes.Reader
|
||||||
var rawInput **bytes.Buffer
|
var rawInput **bytes.Buffer
|
||||||
allowUDP443 := false
|
|
||||||
switch requestAddons.Flow {
|
switch requestAddons.Flow {
|
||||||
case vless.XRV + "-udp443":
|
case vless.XRV + "-udp443":
|
||||||
allowUDP443 = true
|
|
||||||
requestAddons.Flow = requestAddons.Flow[:16]
|
requestAddons.Flow = requestAddons.Flow[:16]
|
||||||
fallthrough
|
fallthrough
|
||||||
case vless.XRV:
|
case vless.XRV:
|
||||||
ob.CanSpliceCopy = 2
|
ob.CanSpliceCopy = 2
|
||||||
switch request.Command {
|
switch request.Command {
|
||||||
case protocol.RequestCommandUDP:
|
case protocol.RequestCommandUDP:
|
||||||
if !allowUDP443 && request.Port == 443 {
|
|
||||||
proxy.DropUDP(ctx, link.Reader)
|
|
||||||
return errors.New("XTLS rejected UDP/443 traffic")
|
|
||||||
}
|
|
||||||
case protocol.RequestCommandMux:
|
case protocol.RequestCommandMux:
|
||||||
fallthrough // let server break Mux connections that contain TCP requests
|
fallthrough // let server break Mux connections that contain TCP requests
|
||||||
case protocol.RequestCommandTCP, protocol.RequestCommandRvs:
|
case protocol.RequestCommandTCP, protocol.RequestCommandRvs:
|
||||||
|
|||||||
Reference in New Issue
Block a user