test: add anytls

This commit is contained in:
wyx2685
2025-05-24 08:33:36 +09:00
parent d200a3336e
commit a68378670f
10 changed files with 209 additions and 179 deletions

View File

@@ -33,6 +33,7 @@ type NodeInfo struct {
Shadowsocks *ShadowsocksNode
Trojan *TrojanNode
Tuic *TuicNode
AnyTls *AnyTlsNode
Hysteria *HysteriaNode
Hysteria2 *Hysteria2Node
Common *CommonNode
@@ -107,6 +108,11 @@ type TuicNode struct {
ZeroRTTHandshake bool `json:"zero_rtt_handshake"`
}
type AnyTlsNode struct {
CommonNode
PaddingScheme []string `json:"padding_scheme,omitempty"`
}
type HysteriaNode struct {
CommonNode
UpMbps int `json:"up_mbps"`
@@ -219,6 +225,15 @@ func (c *Client) GetNodeInfo() (node *NodeInfo, err error) {
cm = &rsp.CommonNode
node.Tuic = rsp
node.Security = Tls
case "anytls":
rsp := &AnyTlsNode{}
err = json.Unmarshal(r.Body(), rsp)
if err != nil {
return nil, fmt.Errorf("decode anytls params error: %s", err)
}
cm = &rsp.CommonNode
node.AnyTls = rsp
node.Security = Tls
case "hysteria":
rsp := &HysteriaNode{}
err = json.Unmarshal(r.Body(), rsp)

View File

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