mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 04:30:08 +00:00
修复xray内核vless协议bug,升级xray/sing内核
This commit is contained in:
@@ -49,7 +49,7 @@ const (
|
||||
defaultStreamReceiveWindow = 8388608 // 8MB
|
||||
defaultConnReceiveWindow = defaultStreamReceiveWindow * 5 / 2 // 20MB
|
||||
defaultMaxIdleTimeout = 30 * time.Second
|
||||
defaultMaxIncomingStreams = 1024
|
||||
defaultMaxIncomingStreams = 4096
|
||||
defaultUDPIdleTimeout = 60 * time.Second
|
||||
)
|
||||
|
||||
@@ -268,7 +268,7 @@ func (n *Hysteria2node) getOutboundConfig(c *serverConfig) (server.Outbound, err
|
||||
return Outbound, nil
|
||||
}
|
||||
|
||||
func (n *Hysteria2node) getMasqHandler(tlsconfig *server.TLSConfig, conn net.PacketConn, info *panel.NodeInfo, c *serverConfig) (http.Handler, error) {
|
||||
func (n *Hysteria2node) getMasqHandler(tlsconfig *server.TLSConfig, conn net.PacketConn, c *serverConfig) (http.Handler, error) {
|
||||
var handler http.Handler
|
||||
switch strings.ToLower(c.Masquerade.Type) {
|
||||
case "", "404":
|
||||
@@ -347,7 +347,7 @@ func (n *Hysteria2node) getMasqHandler(tlsconfig *server.TLSConfig, conn net.Pac
|
||||
return MasqHandler, nil
|
||||
}
|
||||
|
||||
func (n *Hysteria2node) getHyConfig(tag string, info *panel.NodeInfo, config *conf.Options, c *serverConfig) (*server.Config, error) {
|
||||
func (n *Hysteria2node) getHyConfig(info *panel.NodeInfo, config *conf.Options, c *serverConfig) (*server.Config, error) {
|
||||
tls, err := n.getTLSConfig(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -364,7 +364,7 @@ func (n *Hysteria2node) getHyConfig(tag string, info *panel.NodeInfo, config *co
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
Masq, err := n.getMasqHandler(tls, conn, info, c)
|
||||
Masq, err := n.getMasqHandler(tls, conn, c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func (h *Hysteria2) AddNode(tag string, info *panel.NodeInfo, config *conf.Optio
|
||||
},
|
||||
}
|
||||
|
||||
hyconfig, err = n.getHyConfig(tag, info, config, &c)
|
||||
hyconfig, err = n.getHyConfig(info, config, &c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/sagernet/sing-box/common/urltest"
|
||||
|
||||
"github.com/InazumaV/V2bX/common/format"
|
||||
"github.com/InazumaV/V2bX/common/rate"
|
||||
|
||||
"github.com/InazumaV/V2bX/limiter"
|
||||
@@ -95,7 +96,7 @@ func (h *HookServer) RoutedConnection(_ context.Context, conn net.Conn, m adapte
|
||||
return conn, t
|
||||
}
|
||||
ip := m.Source.Addr.String()
|
||||
if b, r := l.CheckLimit(m.User, ip, true); r {
|
||||
if b, r := l.CheckLimit(format.UserTag(m.Inbound, m.User), ip, true); r {
|
||||
conn.Close()
|
||||
log.Error("[", m.Inbound, "] ", "Limited ", m.User, " by ip or conn")
|
||||
return conn, t
|
||||
@@ -149,7 +150,7 @@ func (h *HookServer) RoutedPacketConnection(_ context.Context, conn N.PacketConn
|
||||
return conn, t
|
||||
}
|
||||
ip := m.Source.Addr.String()
|
||||
if b, r := l.CheckLimit(m.User, ip, true); r {
|
||||
if b, r := l.CheckLimit(format.UserTag(m.Inbound, m.User), ip, true); r {
|
||||
conn.Close()
|
||||
log.Error("[", m.Inbound, "] ", "Limited ", m.User, " by ip or conn")
|
||||
return conn, t
|
||||
|
||||
@@ -91,7 +91,7 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
||||
Enabled: true,
|
||||
ShortID: []string{v.TlsSettings.ShortId},
|
||||
PrivateKey: v.TlsSettings.PrivateKey,
|
||||
Xver: v.TlsSettings.Xver,
|
||||
Xver: uint8(v.TlsSettings.Xver),
|
||||
Handshake: option.InboundRealityHandshakeOptions{
|
||||
ServerOptions: option.ServerOptions{
|
||||
Server: dest,
|
||||
|
||||
@@ -105,9 +105,17 @@ func buildInbound(option *conf.Options, nodeInfo *panel.NodeInfo, tag string) (*
|
||||
// Reality
|
||||
in.StreamSetting.Security = "reality"
|
||||
v := nodeInfo.VAllss
|
||||
dest := v.TlsSettings.Dest
|
||||
if dest == "" {
|
||||
dest = v.TlsSettings.ServerName
|
||||
}
|
||||
xver := v.TlsSettings.Xver
|
||||
if xver == 0 {
|
||||
xver = v.RealityConfig.Xver
|
||||
}
|
||||
d, err := json.Marshal(fmt.Sprintf(
|
||||
"%s:%s",
|
||||
v.TlsSettings.ServerName,
|
||||
dest,
|
||||
v.TlsSettings.ServerPort))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("marshal reality dest error: %s", err)
|
||||
@@ -115,7 +123,7 @@ func buildInbound(option *conf.Options, nodeInfo *panel.NodeInfo, tag string) (*
|
||||
mtd, _ := time.ParseDuration(v.RealityConfig.MaxTimeDiff)
|
||||
in.StreamSetting.REALITYSettings = &coreConf.REALITYConfig{
|
||||
Dest: d,
|
||||
Xver: v.RealityConfig.Xver,
|
||||
Xver: xver,
|
||||
ServerNames: []string{v.TlsSettings.ServerName},
|
||||
PrivateKey: v.TlsSettings.PrivateKey,
|
||||
MinClientVer: v.RealityConfig.MinClientVer,
|
||||
|
||||
Reference in New Issue
Block a user