mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 20:50:09 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d200a3336e |
@@ -32,6 +32,7 @@ type NodeInfo struct {
|
|||||||
VAllss *VAllssNode
|
VAllss *VAllssNode
|
||||||
Shadowsocks *ShadowsocksNode
|
Shadowsocks *ShadowsocksNode
|
||||||
Trojan *TrojanNode
|
Trojan *TrojanNode
|
||||||
|
Tuic *TuicNode
|
||||||
Hysteria *HysteriaNode
|
Hysteria *HysteriaNode
|
||||||
Hysteria2 *Hysteria2Node
|
Hysteria2 *Hysteria2Node
|
||||||
Common *CommonNode
|
Common *CommonNode
|
||||||
@@ -100,6 +101,12 @@ type TrojanNode struct {
|
|||||||
NetworkSettings json.RawMessage `json:"networkSettings"`
|
NetworkSettings json.RawMessage `json:"networkSettings"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type TuicNode struct {
|
||||||
|
CommonNode
|
||||||
|
CongestionControl string `json:"congestion_control"`
|
||||||
|
ZeroRTTHandshake bool `json:"zero_rtt_handshake"`
|
||||||
|
}
|
||||||
|
|
||||||
type HysteriaNode struct {
|
type HysteriaNode struct {
|
||||||
CommonNode
|
CommonNode
|
||||||
UpMbps int `json:"up_mbps"`
|
UpMbps int `json:"up_mbps"`
|
||||||
@@ -203,6 +210,15 @@ func (c *Client) GetNodeInfo() (node *NodeInfo, err error) {
|
|||||||
cm = &rsp.CommonNode
|
cm = &rsp.CommonNode
|
||||||
node.Trojan = rsp
|
node.Trojan = rsp
|
||||||
node.Security = Tls
|
node.Security = Tls
|
||||||
|
case "tuic":
|
||||||
|
rsp := &TuicNode{}
|
||||||
|
err = json.Unmarshal(r.Body(), rsp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("decode tuic params error: %s", err)
|
||||||
|
}
|
||||||
|
cm = &rsp.CommonNode
|
||||||
|
node.Tuic = rsp
|
||||||
|
node.Security = Tls
|
||||||
case "hysteria":
|
case "hysteria":
|
||||||
rsp := &HysteriaNode{}
|
rsp := &HysteriaNode{}
|
||||||
err = json.Unmarshal(r.Body(), rsp)
|
err = json.Unmarshal(r.Body(), rsp)
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ func New(c *conf.ApiConfig) (*Client, error) {
|
|||||||
"shadowsocks",
|
"shadowsocks",
|
||||||
"hysteria",
|
"hysteria",
|
||||||
"hysteria2",
|
"hysteria2",
|
||||||
|
"tuic",
|
||||||
"vless":
|
"vless":
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unsupported Node type: %s", c.NodeType)
|
return nil, fmt.Errorf("unsupported Node type: %s", c.NodeType)
|
||||||
|
|||||||
@@ -343,6 +343,17 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
in.Options = trojanoption
|
in.Options = trojanoption
|
||||||
|
case "tuic":
|
||||||
|
in.Type = "tuic"
|
||||||
|
tls.ALPN = append(tls.ALPN, "h3")
|
||||||
|
in.Options = &option.TUICInboundOptions{
|
||||||
|
ListenOptions: listen,
|
||||||
|
CongestionControl: info.Tuic.CongestionControl,
|
||||||
|
ZeroRTTHandshake: info.Tuic.ZeroRTTHandshake,
|
||||||
|
InboundTLSOptionsContainer: option.InboundTLSOptionsContainer{
|
||||||
|
TLS: &tls,
|
||||||
|
},
|
||||||
|
}
|
||||||
case "hysteria":
|
case "hysteria":
|
||||||
in.Type = "hysteria"
|
in.Type = "hysteria"
|
||||||
in.Options = &option.HysteriaInboundOptions{
|
in.Options = &option.HysteriaInboundOptions{
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ func (b *Sing) Protocols() []string {
|
|||||||
"vless",
|
"vless",
|
||||||
"shadowsocks",
|
"shadowsocks",
|
||||||
"trojan",
|
"trojan",
|
||||||
|
"tuic",
|
||||||
"hysteria",
|
"hysteria",
|
||||||
"hysteria2",
|
"hysteria2",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import (
|
|||||||
"github.com/sagernet/sing-box/protocol/hysteria2"
|
"github.com/sagernet/sing-box/protocol/hysteria2"
|
||||||
"github.com/sagernet/sing-box/protocol/shadowsocks"
|
"github.com/sagernet/sing-box/protocol/shadowsocks"
|
||||||
"github.com/sagernet/sing-box/protocol/trojan"
|
"github.com/sagernet/sing-box/protocol/trojan"
|
||||||
|
"github.com/sagernet/sing-box/protocol/tuic"
|
||||||
"github.com/sagernet/sing-box/protocol/vless"
|
"github.com/sagernet/sing-box/protocol/vless"
|
||||||
"github.com/sagernet/sing-box/protocol/vmess"
|
"github.com/sagernet/sing-box/protocol/vmess"
|
||||||
)
|
)
|
||||||
@@ -66,6 +67,18 @@ func (b *Sing) AddUsers(p *core.AddUsersParams) (added int, err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = in.(*trojan.Inbound).AddUsers(us)
|
err = in.(*trojan.Inbound).AddUsers(us)
|
||||||
|
case "tuic":
|
||||||
|
us := make([]option.TUICUser, len(p.Users))
|
||||||
|
id := make([]int, len(p.Users))
|
||||||
|
for i := range p.Users {
|
||||||
|
us[i] = option.TUICUser{
|
||||||
|
Name: p.Users[i].Uuid,
|
||||||
|
UUID: p.Users[i].Uuid,
|
||||||
|
Password: p.Users[i].Uuid,
|
||||||
|
}
|
||||||
|
id[i] = p.Users[i].Id
|
||||||
|
}
|
||||||
|
err = in.(*tuic.Inbound).AddUsers(us, id)
|
||||||
case "hysteria":
|
case "hysteria":
|
||||||
us := make([]option.HysteriaUser, len(p.Users))
|
us := make([]option.HysteriaUser, len(p.Users))
|
||||||
for i := range p.Users {
|
for i := range p.Users {
|
||||||
@@ -122,6 +135,8 @@ func (b *Sing) DelUsers(users []panel.UserInfo, tag string, info *panel.NodeInfo
|
|||||||
del = i.(*shadowsocks.MultiInbound)
|
del = i.(*shadowsocks.MultiInbound)
|
||||||
case "trojan":
|
case "trojan":
|
||||||
del = i.(*trojan.Inbound)
|
del = i.(*trojan.Inbound)
|
||||||
|
case "tuic":
|
||||||
|
del = i.(*tuic.Inbound)
|
||||||
case "hysteria":
|
case "hysteria":
|
||||||
del = i.(*hysteria.Inbound)
|
del = i.(*hysteria.Inbound)
|
||||||
case "hysteria2":
|
case "hysteria2":
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ func (c *Controller) nodeInfoMonitor() (err error) {
|
|||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"tag": c.tag,
|
"tag": c.tag,
|
||||||
"err": err,
|
"err": err,
|
||||||
}).Error("Delete node failed")
|
}).Panic("Delete node failed")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ func (c *Controller) nodeInfoMonitor() (err error) {
|
|||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"tag": c.tag,
|
"tag": c.tag,
|
||||||
"err": err,
|
"err": err,
|
||||||
}).Error("Add node failed")
|
}).Panic("Add node failed")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
_, err = c.server.AddUsers(&vCore.AddUsersParams{
|
_, err = c.server.AddUsers(&vCore.AddUsersParams{
|
||||||
|
|||||||
Reference in New Issue
Block a user