test: Add Tuic

This commit is contained in:
wyx2685
2025-04-30 07:50:41 +09:00
parent 6a95d576f1
commit d200a3336e
6 changed files with 46 additions and 2 deletions

View File

@@ -32,6 +32,7 @@ type NodeInfo struct {
VAllss *VAllssNode
Shadowsocks *ShadowsocksNode
Trojan *TrojanNode
Tuic *TuicNode
Hysteria *HysteriaNode
Hysteria2 *Hysteria2Node
Common *CommonNode
@@ -100,6 +101,12 @@ type TrojanNode struct {
NetworkSettings json.RawMessage `json:"networkSettings"`
}
type TuicNode struct {
CommonNode
CongestionControl string `json:"congestion_control"`
ZeroRTTHandshake bool `json:"zero_rtt_handshake"`
}
type HysteriaNode struct {
CommonNode
UpMbps int `json:"up_mbps"`
@@ -203,6 +210,15 @@ func (c *Client) GetNodeInfo() (node *NodeInfo, err error) {
cm = &rsp.CommonNode
node.Trojan = rsp
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":
rsp := &HysteriaNode{}
err = json.Unmarshal(r.Body(), rsp)

View File

@@ -56,6 +56,7 @@ func New(c *conf.ApiConfig) (*Client, error) {
"shadowsocks",
"hysteria",
"hysteria2",
"tuic",
"vless":
default:
return nil, fmt.Errorf("unsupported Node type: %s", c.NodeType)