mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 04:30:08 +00:00
test: Add Tuic
This commit is contained in:
@@ -343,6 +343,17 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
||||
}
|
||||
}
|
||||
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":
|
||||
in.Type = "hysteria"
|
||||
in.Options = &option.HysteriaInboundOptions{
|
||||
|
||||
@@ -96,6 +96,7 @@ func (b *Sing) Protocols() []string {
|
||||
"vless",
|
||||
"shadowsocks",
|
||||
"trojan",
|
||||
"tuic",
|
||||
"hysteria",
|
||||
"hysteria2",
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/sagernet/sing-box/protocol/hysteria2"
|
||||
"github.com/sagernet/sing-box/protocol/shadowsocks"
|
||||
"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/vmess"
|
||||
)
|
||||
@@ -66,6 +67,18 @@ func (b *Sing) AddUsers(p *core.AddUsersParams) (added int, err error) {
|
||||
}
|
||||
}
|
||||
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":
|
||||
us := make([]option.HysteriaUser, len(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)
|
||||
case "trojan":
|
||||
del = i.(*trojan.Inbound)
|
||||
case "tuic":
|
||||
del = i.(*tuic.Inbound)
|
||||
case "hysteria":
|
||||
del = i.(*hysteria.Inbound)
|
||||
case "hysteria2":
|
||||
|
||||
Reference in New Issue
Block a user