mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-01 17:25:02 +00:00
Bug fixes
Fix broken parsing support for Clash Shadowsocks configuration. Fix support for multipart Surge custom rule. Optimize codes. INIReader: Remove MAX_LINE_LENGTH limit.
This commit is contained in:
5 files changed
+20
-7
No files matched your search
+1
-3
@@ -5,8 +5,6 @@
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#define MAX_LINE_LENGTH 4096
|
||||
|
||||
typedef std::map<std::string, std::multimap<std::string, std::string>> ini_data_struct;
|
||||
typedef std::multimap<std::string, std::string> string_multimap;
|
||||
|
||||
@@ -144,7 +142,7 @@ public:
|
||||
while(getline(strStrm, strLine)) //get one line of content
|
||||
{
|
||||
lineSize = strLine.size();
|
||||
if(!lineSize || lineSize > MAX_LINE_LENGTH || strLine[0] == ';' || strLine[0] == '#') //empty lines, lines longer than MAX_LINE_LENGTH and comments are ignored
|
||||
if(!lineSize || strLine[0] == ';' || strLine[0] == '#') //empty lines and comments are ignored
|
||||
continue;
|
||||
if(strLine[lineSize - 1] == '\r') //remove line break
|
||||
{
|
||||
|
||||
@@ -46,11 +46,17 @@ std::string refreshRulesets()
|
||||
ruleset_content rc;
|
||||
for(std::string &x : rulesets)
|
||||
{
|
||||
/*
|
||||
vArray = split(x, ",");
|
||||
if(vArray.size() != 2)
|
||||
continue;
|
||||
rule_group = trim(vArray[0]);
|
||||
rule_url = trim(vArray[1]);
|
||||
*/
|
||||
if(x.find(",") == x.npos)
|
||||
continue;
|
||||
rule_group = trim(x.substr(0, x.find(",")));
|
||||
rule_url = trim(x.substr(x.find(",") + 1));
|
||||
if(rule_url.find("[]") == 0)
|
||||
{
|
||||
std::cerr<<"Adding rule '"<<rule_url.substr(2)<<","<<rule_group<<"'."<<std::endl;
|
||||
@@ -80,6 +86,7 @@ std::string refreshRulesets()
|
||||
void readConf()
|
||||
{
|
||||
guarded_mutex guard(on_configuring);
|
||||
std::cerr<<"Reading preference settings..."<<std::endl;
|
||||
eraseElements(def_exclude_remarks);
|
||||
eraseElements(def_include_remarks);
|
||||
eraseElements(clash_extra_group);
|
||||
@@ -147,6 +154,7 @@ void readConf()
|
||||
max_concurrent_threads = ini.GetInt("max_concurrent_threads");
|
||||
|
||||
remarksInit(def_exclude_remarks, def_include_remarks);
|
||||
std::cerr<<"Read preference settings completed."<<std::endl;
|
||||
}
|
||||
|
||||
int main()
|
||||
|
||||
@@ -880,6 +880,13 @@ void explodeClash(Node yamlnode, std::string custom_port, int local_port, std::v
|
||||
yamlnode["Proxy"][i]["plugin-opts"]["host"] >> pluginopts_host;
|
||||
}
|
||||
}
|
||||
else if(yamlnode["Proxy"][i]["obfs"].IsDefined())
|
||||
{
|
||||
plugin = "simple-obfs";
|
||||
yamlnode["Proxy"][i]["obfs"] >> pluginopts_mode;
|
||||
if(yamlnode["Proxy"][i]["plugin-opts"]["obfs-host"].IsDefined())
|
||||
yamlnode["Proxy"][i]["obfs-host"] >> pluginopts_host;
|
||||
}
|
||||
else
|
||||
plugin = "";
|
||||
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ struct listener_args
|
||||
int max_workers;
|
||||
};
|
||||
|
||||
void append_response(std::string type, std::string request, std::string content_type, response_callback response);
|
||||
void append_response(std::string method, std::string uri, std::string content_type, response_callback response);
|
||||
int start_web_server(void *argv);
|
||||
int start_web_server_multi(void *argv);
|
||||
|
||||
|
||||
@@ -212,11 +212,11 @@ int start_web_server_multi(void *argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void append_response(std::string type, std::string request, std::string content_type, response_callback response)
|
||||
void append_response(std::string method, std::string uri, std::string content_type, response_callback response)
|
||||
{
|
||||
responseRoute rr;
|
||||
rr.method = type;
|
||||
rr.path = request;
|
||||
rr.method = method;
|
||||
rr.path = uri;
|
||||
rr.content_type = content_type;
|
||||
rr.rc = response;
|
||||
responses.emplace_back(rr);
|
||||
|
||||
Reference in new issue
Block a user