diff --git a/src/generator/config/subexport.cpp b/src/generator/config/subexport.cpp index 3fb9bd813..5710a6baa 100644 --- a/src/generator/config/subexport.cpp +++ b/src/generator/config/subexport.cpp @@ -2317,9 +2317,9 @@ void proxyToSingBox(std::vector &nodes, rapidjson::Document &json, std::v { addSingBoxCommonMembers(proxy, x, "hysteria", allocator); if (!x.Up.empty()) - proxy.AddMember("up", rapidjson::StringRef(x.Up.c_str()), allocator); + proxy.AddMember("up_mbps", x.UpSpeed, allocator); if (!x.Down.empty()) - proxy.AddMember("down", rapidjson::StringRef(x.Down.c_str()), allocator); + proxy.AddMember("down_mbps", x.DownSpeed, allocator); if (!x.OBFS.empty()) { proxy.AddMember("obfs", rapidjson::StringRef(x.OBFS.c_str()), allocator); diff --git a/src/parser/subparser.cpp b/src/parser/subparser.cpp index db42d89a9..3ac0312a9 100644 --- a/src/parser/subparser.cpp +++ b/src/parser/subparser.cpp @@ -165,19 +165,28 @@ void hysteriaConstruct( if (!up.empty()) { if (up.length() > 4 && up.find("bps") == up.length() - 3) + node.Up = up; else if (to_int(up)) + { + node.UpSpeed = to_int(up); node.Up = up + " Mbps"; + } } - node.UpSpeed = to_int(up_speed); + if (!up_speed.empty()) + node.UpSpeed = to_int(up_speed); if (!down.empty()) { if (down.length() > 4 && down.find("bps") == down.length() - 3) node.Down = down; else if (to_int(down)) + { + node.DownSpeed = to_int(down); node.Down = down + " Mbps"; + } } - node.DownSpeed = to_int(down_speed); + if (!down_speed.empty()) + node.DownSpeed = to_int(down_speed); node.AuthStr = auth_str; if (!auth.empty()) node.AuthStr = base64Decode(auth);