mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 18:08:14 -05:00
optimize code
This commit is contained in:
parent
3848198630
commit
21bd807e99
10
api/node.go
10
api/node.go
@ -225,6 +225,9 @@ func (c *Client) ParseSSNodeResponse() (*NodeInfo, error) {
|
|||||||
|
|
||||||
// ParseV2rayNodeResponse parse the response for the given nodeinfor format
|
// ParseV2rayNodeResponse parse the response for the given nodeinfor format
|
||||||
func (c *Client) ParseV2rayNodeResponse(body []byte, notParseNode, parseRule bool) (*NodeInfo, error) {
|
func (c *Client) ParseV2rayNodeResponse(body []byte, notParseNode, parseRule bool) (*NodeInfo, error) {
|
||||||
|
if notParseNode && (!parseRule) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
node := &NodeInfo{V2ray: &V2rayConfig{}}
|
node := &NodeInfo{V2ray: &V2rayConfig{}}
|
||||||
err := json.Unmarshal(body, node.V2ray)
|
err := json.Unmarshal(body, node.V2ray)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -236,16 +239,15 @@ func (c *Client) ParseV2rayNodeResponse(body []byte, notParseNode, parseRule boo
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
}
|
}
|
||||||
|
if notParseNode {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
node.V2ray.Routing = nil
|
node.V2ray.Routing = nil
|
||||||
if notParseNode {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
node.SpeedLimit = uint64(c.SpeedLimit * 1000000 / 8)
|
node.SpeedLimit = uint64(c.SpeedLimit * 1000000 / 8)
|
||||||
node.DeviceLimit = c.DeviceLimit
|
node.DeviceLimit = c.DeviceLimit
|
||||||
node.NodeType = c.NodeType
|
node.NodeType = c.NodeType
|
||||||
node.NodeId = c.NodeID
|
node.NodeId = c.NodeID
|
||||||
|
|
||||||
if c.EnableXTLS {
|
if c.EnableXTLS {
|
||||||
node.TLSType = "xtls"
|
node.TLSType = "xtls"
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user