reactor: update deps

This commit is contained in:
Yuzuki616
2025-05-19 16:02:27 +09:00
parent 5a5eb7e496
commit becd4287ae
3 changed files with 9 additions and 23 deletions

2
go.mod
View File

@@ -6,7 +6,7 @@ toolchain go1.24.2
require ( require (
github.com/InazumaV/Ratte-Core-Xray v0.0.0-20250420021044-42b0d35bcd79 github.com/InazumaV/Ratte-Core-Xray v0.0.0-20250420021044-42b0d35bcd79
github.com/InazumaV/Ratte-Interface v0.0.0-20250505045848-a0068c2a9be9 github.com/InazumaV/Ratte-Interface v0.0.0-20250519063521-202abe204fd8
github.com/InazumaV/Ratte-Panel-V2b v0.0.0-20250420013203-72f8abe3e919 github.com/InazumaV/Ratte-Panel-V2b v0.0.0-20250420013203-72f8abe3e919
github.com/fsnotify/fsnotify v1.7.0 github.com/fsnotify/fsnotify v1.7.0
github.com/go-acme/lego/v4 v4.18.0 github.com/go-acme/lego/v4 v4.18.0

2
go.sum
View File

@@ -65,6 +65,8 @@ github.com/InazumaV/Ratte-Core-Xray v0.0.0-20250420021044-42b0d35bcd79 h1:PruEu6
github.com/InazumaV/Ratte-Core-Xray v0.0.0-20250420021044-42b0d35bcd79/go.mod h1:GGt1mWh9rdkPD9jT/iKM170Oqk1xm8s1ujH+QIW1nGk= github.com/InazumaV/Ratte-Core-Xray v0.0.0-20250420021044-42b0d35bcd79/go.mod h1:GGt1mWh9rdkPD9jT/iKM170Oqk1xm8s1ujH+QIW1nGk=
github.com/InazumaV/Ratte-Interface v0.0.0-20250505045848-a0068c2a9be9 h1:+adxGP0iY0EYP8iuva/q0IUgUSwIBEz8ZXWVuW8PTTA= github.com/InazumaV/Ratte-Interface v0.0.0-20250505045848-a0068c2a9be9 h1:+adxGP0iY0EYP8iuva/q0IUgUSwIBEz8ZXWVuW8PTTA=
github.com/InazumaV/Ratte-Interface v0.0.0-20250505045848-a0068c2a9be9/go.mod h1:UxqxslbpT8Q4qMldSNI6VCX5WFXWDbvE4fXpymp73kA= github.com/InazumaV/Ratte-Interface v0.0.0-20250505045848-a0068c2a9be9/go.mod h1:UxqxslbpT8Q4qMldSNI6VCX5WFXWDbvE4fXpymp73kA=
github.com/InazumaV/Ratte-Interface v0.0.0-20250519063521-202abe204fd8 h1:WjSGJqB9zmNuJ0Iv0Exo6PdKHMnJ1Z2vdGb/Vc5X9l0=
github.com/InazumaV/Ratte-Interface v0.0.0-20250519063521-202abe204fd8/go.mod h1:UxqxslbpT8Q4qMldSNI6VCX5WFXWDbvE4fXpymp73kA=
github.com/InazumaV/Ratte-Panel-V2b v0.0.0-20250420013203-72f8abe3e919 h1:+Fp5s8BVpk3vQC7N/x3a6sTRZNSU8Jd8G4MenyLnK3g= github.com/InazumaV/Ratte-Panel-V2b v0.0.0-20250420013203-72f8abe3e919 h1:+Fp5s8BVpk3vQC7N/x3a6sTRZNSU8Jd8G4MenyLnK3g=
github.com/InazumaV/Ratte-Panel-V2b v0.0.0-20250420013203-72f8abe3e919/go.mod h1:5EkRRTlqZqG3rp3aP6QiPlrPJKpWtwt5gBtJduFv35E= github.com/InazumaV/Ratte-Panel-V2b v0.0.0-20250420013203-72f8abe3e919/go.mod h1:5EkRRTlqZqG3rp3aP6QiPlrPJKpWtwt5gBtJduFv35E=
github.com/OmarTariq612/goech v0.0.0-20240405204721-8e2e1dafd3a0 h1:Wo41lDOevRJSGpevP+8Pk5bANX7fJacO2w04aqLiC5I= github.com/OmarTariq612/goech v0.0.0-20240405204721-8e2e1dafd3a0 h1:Wo41lDOevRJSGpevP+8Pk5bANX7fJacO2w04aqLiC5I=

View File

@@ -6,6 +6,7 @@ import (
"github.com/InazumaV/Ratte-Interface/panel" "github.com/InazumaV/Ratte-Interface/panel"
"github.com/InazumaV/Ratte/common/maps" "github.com/InazumaV/Ratte/common/maps"
"github.com/InazumaV/Ratte/common/number" "github.com/InazumaV/Ratte/common/number"
"strconv"
) )
func (h *Handler) PullNodeHandle(n *panel.NodeInfo) error { func (h *Handler) PullNodeHandle(n *panel.NodeInfo) error {
@@ -15,7 +16,7 @@ func (h *Handler) PullNodeHandle(n *panel.NodeInfo) error {
return fmt.Errorf("del node error: %w", err) return fmt.Errorf("del node error: %w", err)
} }
} else { } else {
if n.TlsType() != panel.NoTls { if n.Security == "" {
h.needTls = true h.needTls = true
err := h.acme.CreateCert(h.Cert.CertPath, h.Cert.KeyPath, h.Cert.Domain) err := h.acme.CreateCert(h.Cert.CertPath, h.Cert.KeyPath, h.Cert.Domain)
if err != nil { if err != nil {
@@ -23,33 +24,16 @@ func (h *Handler) PullNodeHandle(n *panel.NodeInfo) error {
} }
} }
} }
var protocol, port string
switch n.Type {
case "vmess":
protocol = "vmess"
port = n.VMess.Port
case "vless":
protocol = "vless"
port = n.VLess.Port
case "shadowsocks":
protocol = "shadowsocks"
port = n.Shadowsocks.Port
case "trojan":
protocol = "trojan"
port = n.Trojan.Port
case "other":
protocol = "other"
port = n.Other.Port
}
if h.Hook.BeforeAddNode != "" { if h.Hook.BeforeAddNode != "" {
err := h.execHookCmd(h.Hook.BeforeAddNode, h.nodeName, protocol, port) err := h.execHookCmd(h.Hook.BeforeAddNode, h.nodeName, n.Type, strconv.Itoa(n.Port))
if err != nil { if err != nil {
h.l.WithError(err).Error("Exec before add node hook failed") h.l.WithError(err).Error("Exec before add node hook failed")
} }
} }
ni := (*core.NodeInfo)(n) ni := (*core.NodeInfo)(n)
ni.OtherOptions = maps.Merge[string, any](ni.OtherOptions, h.Options.Expand) ni.Options = maps.Merge[string, any](ni.Options, h.Options.Expand)
ni.Limit.IPLimit = number.SelectBigger(ni.Limit.IPLimit, h.Limit.IPLimit) ni.Limit.IPLimit = number.SelectBigger(ni.Limit.IPLimit, h.Limit.IPLimit)
ni.Limit.SpeedLimit = number.SelectBigger(ni.Limit.SpeedLimit, uint64(h.Limit.SpeedLimit)) ni.Limit.SpeedLimit = number.SelectBigger(ni.Limit.SpeedLimit, uint64(h.Limit.SpeedLimit))
err := h.c.AddNode(&core.AddNodeParams{ err := h.c.AddNode(&core.AddNodeParams{
@@ -64,7 +48,7 @@ func (h *Handler) PullNodeHandle(n *panel.NodeInfo) error {
return fmt.Errorf("add node error: %w", err) return fmt.Errorf("add node error: %w", err)
} }
if h.Hook.AfterAddNode != "" { if h.Hook.AfterAddNode != "" {
err = h.execHookCmd(h.Hook.AfterAddNode, h.nodeName, protocol, port) err = h.execHookCmd(h.Hook.AfterAddNode, h.nodeName, ni.Type, strconv.Itoa(ni.Port))
if err != nil { if err != nil {
h.l.WithError(err).Warn("Exec after add node hook failed") h.l.WithError(err).Warn("Exec after add node hook failed")
} }