mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 20:50:09 +00:00
测试:尝试增加hysteria2协议,尝试增加设备数限制功能
This commit is contained in:
@@ -33,6 +33,7 @@ type NodeInfo struct {
|
||||
Shadowsocks *ShadowsocksNode
|
||||
Trojan *TrojanNode
|
||||
Hysteria *HysteriaNode
|
||||
Hysteria2 *Hysteria2Node
|
||||
Common *CommonNode
|
||||
}
|
||||
|
||||
@@ -100,6 +101,14 @@ type HysteriaNode struct {
|
||||
Obfs string `json:"obfs"`
|
||||
}
|
||||
|
||||
type Hysteria2Node struct {
|
||||
CommonNode
|
||||
UpMbps int `json:"up_mbps"`
|
||||
DownMbps int `json:"down_mbps"`
|
||||
ObfsType string `json:"obfs"`
|
||||
ObfsPassword string `json:"obfs-password"`
|
||||
}
|
||||
|
||||
type RawDNS struct {
|
||||
DNSMap map[string]map[string]interface{}
|
||||
DNSJson []byte
|
||||
@@ -166,7 +175,7 @@ func (c *Client) GetNodeInfo() (node *NodeInfo, err error) {
|
||||
rsp := &ShadowsocksNode{}
|
||||
err = json.Unmarshal(r.Body(), rsp)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("decode v2ray params error: %s", err)
|
||||
return nil, fmt.Errorf("decode shadowsocks params error: %s", err)
|
||||
}
|
||||
cm = &rsp.CommonNode
|
||||
node.Shadowsocks = rsp
|
||||
@@ -175,7 +184,7 @@ func (c *Client) GetNodeInfo() (node *NodeInfo, err error) {
|
||||
rsp := &TrojanNode{}
|
||||
err = json.Unmarshal(r.Body(), rsp)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("decode v2ray params error: %s", err)
|
||||
return nil, fmt.Errorf("decode trojan params error: %s", err)
|
||||
}
|
||||
cm = (*CommonNode)(rsp)
|
||||
node.Trojan = rsp
|
||||
@@ -184,11 +193,20 @@ func (c *Client) GetNodeInfo() (node *NodeInfo, err error) {
|
||||
rsp := &HysteriaNode{}
|
||||
err = json.Unmarshal(r.Body(), rsp)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("decode v2ray params error: %s", err)
|
||||
return nil, fmt.Errorf("decode hysteria params error: %s", err)
|
||||
}
|
||||
cm = &rsp.CommonNode
|
||||
node.Hysteria = rsp
|
||||
node.Security = Tls
|
||||
case "hysteria2":
|
||||
rsp := &Hysteria2Node{}
|
||||
err = json.Unmarshal(r.Body(), rsp)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("decode hysteria2 params error: %s", err)
|
||||
}
|
||||
cm = &rsp.CommonNode
|
||||
node.Hysteria2 = rsp
|
||||
node.Security = Tls
|
||||
}
|
||||
|
||||
// parse rules and dns
|
||||
|
||||
Reference in New Issue
Block a user