Enhancements

Fix when processing duplicated node name for Surge, the program will crash.
Add an interface to directly convert Surge config to Clash config.
Add Netease Music IP ruleset.
Clean up codes.
Update build scripts.
This commit is contained in:
Tindy X
2020-02-10 18:22:12 +08:00
parent ac75c9513a
commit e14f7dd6bf
8 changed files with 1386 additions and 1153 deletions

View File

@@ -32,6 +32,7 @@ IF(USING_MALLOC_TRIM)
ENDIF()
ADD_EXECUTABLE(subconverter
src/interfaces.cpp
src/logger.cpp
src/main.cpp
src/misc.cpp

View File

@@ -0,0 +1,19 @@
IP-CIDR,39.105.63.80/32
IP-CIDR,45.254.48.1/32
IP-CIDR,47.100.127.239/32
IP-CIDR,59.111.160.195/32
IP-CIDR,59.111.160.197/32
IP-CIDR,59.111.181.35/32
IP-CIDR,59.111.181.38/32
IP-CIDR,59.111.181.60/32
IP-CIDR,101.71.154.241/32
IP-CIDR,103.126.92.132/32
IP-CIDR,103.126.92.133/32
IP-CIDR,112.13.119.17/32
IP-CIDR,112.13.122.1/32
IP-CIDR,115.236.118.33/32
IP-CIDR,115.236.121.1/32
IP-CIDR,118.24.63.156/32
IP-CIDR,193.112.159.225/32
IP-CIDR,223.252.199.66/32
IP-CIDR,223.252.199.67/32

View File

@@ -3,6 +3,7 @@ mkdir obj
set -xe
c++ -std=c++17 -Wall -fexceptions -c src/interfaces.cpp -o obj/interfaces.o
c++ -std=c++17 -Wall -fexceptions -c src/logger.cpp -o obj/logger.o
c++ -std=c++17 -Wall -fexceptions -c src/main.cpp -o obj/main.o
c++ -std=c++17 -Wall -fexceptions -c src/misc.cpp -o obj/misc.o

1331
src/interfaces.cpp Normal file

File diff suppressed because it is too large Load Diff

17
src/interfaces.h Normal file
View File

@@ -0,0 +1,17 @@
#ifndef INTERFACES_H_INCLUDED
#define INTERFACES_H_INCLUDED
#include <string>
#include <map>
#include "subexport.h"
#include "webserver.h"
void refreshRulesets(string_array &ruleset_list, std::vector<ruleset_content> &rca);
void readConf();
void generateBase();
std::string subconverter(RESPONSE_CALLBACK_ARGS);
std::string simpleToClashR(RESPONSE_CALLBACK_ARGS);
std::string surgeConfToClash(RESPONSE_CALLBACK_ARGS);
#endif // INTERFACES_H_INCLUDED

File diff suppressed because it is too large Load Diff

View File

@@ -819,7 +819,7 @@ std::string netchToSurge(std::vector<nodeInfo> &nodes, std::string &base_conf, s
x.remarks = "[" + type + "]" + x.remarks;
remark = x.remarks;
while(std::count(remarks_list.begin(), remarks_list.end(), remark) > 0)
while(std::count(remarks_list.begin(), remarks_list.end(), x.remarks) > 0)
x.remarks += "$";
remark = x.remarks;

View File

@@ -2,6 +2,11 @@
#define SUBEXPORT_H_INCLUDED
#include <string>
#include <vector>
#include "misc.h"
#include "ini_reader.h"
#include "nodeinfo.h"
struct ruleset_content
{