Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
arm64v8a committed Oct 1, 2022
1 parent 57bf866 commit 392ed2e
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-qv2ray-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions/setup-go@v2
with:
stable: false
go-version: 1.18.6
go-version: 1.19.1
- name: Build golang and common parts
shell: bash
run: |
Expand Down
30 changes: 21 additions & 9 deletions db/ConfigBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ namespace NekoRay {
dnsServers += QJsonObject{{"tag", "dns-direct"},
{"address_resolver", "dns-local"},
{"address", directDNSAddress.replace("+local://", "://")},
{"detour", "bypass"},};
{"detour", "direct"},};

// local
dnsServers += QJsonObject{{"tag", "dns-local"},
Expand All @@ -671,9 +671,13 @@ namespace NekoRay {

// Routing

// custom routing rule
// custom routing rule (top)
auto routingRules = QString2QJsonObject(dataStore->routing->custom)["rules"].toArray();

// dns hijack
routingRules += QJsonObject{{"protocol", "dns"},
{"outbound", "dns-out"}};

auto add_rule_route = [&](const QJsonArray &arr, bool isIP, const QString &out) {
auto rule = make_rule(arr, isIP);
if (rule.isEmpty()) return;
Expand All @@ -682,6 +686,18 @@ namespace NekoRay {
};

// ip user rule
for (const auto &line: SplitLines(dataStore->routing->block_ip)) {
if (line.startsWith("#")) continue;
status->ipListBlock += line;
}
for (const auto &line: SplitLines(dataStore->routing->proxy_ip)) {
if (line.startsWith("#")) continue;
status->ipListRemote += line;
}
for (const auto &line: SplitLines(dataStore->routing->direct_ip)) {
if (line.startsWith("#")) continue;
status->ipListDirect += line;
}
add_rule_route(status->ipListBlock, true, "block");
add_rule_route(status->ipListRemote, true, tagProxy);
add_rule_route(status->ipListDirect, true, "bypass");
Expand All @@ -691,15 +707,11 @@ namespace NekoRay {
add_rule_route(status->domainListRemote, false, tagProxy);
add_rule_route(status->domainListDirect, false, "bypass");

// dns hijack
routingRules += QJsonObject{{"protocol", "dns"},
{"outbound", "dns-out"}};

// geopath
auto geoip = FindCoreAsset("geoip.db");
auto geosite = FindCoreAsset("geosite.db");
if (geoip.isEmpty()) result->error = + "geoip.db not found";
if (geosite.isEmpty()) result->error = + "geosite.db not found";
if (geoip.isEmpty()) result->error = +"geoip.db not found";
if (geosite.isEmpty()) result->error = +"geosite.db not found";

// final add routing rule
QJSONARRAY_ADD(routingRules, QString2QJsonObject(dataStore->custom_route_global)["rules"].toArray())
Expand All @@ -715,7 +727,7 @@ namespace NekoRay {
result->coreConfig.insert("experimental", QJsonObject{
{"v2ray_api", QJsonObject{
{"listen", "127.0.0.1:" + Int2String(dataStore->inbound_socks_port + 10)},
{"stats", QJsonObject{
{"stats", QJsonObject{
{"enabled", true},
{"outbounds", QJsonArray{
tagProxy, "bypass", "block"
Expand Down
12 changes: 6 additions & 6 deletions go/cmd/nekobox_core/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.19

require (
github.com/dustin/go-humanize v1.0.0
github.com/sagernet/sing v0.0.0-20220926054900-7209937cc235
github.com/sagernet/sing-box v1.0.2-0.20220929011213-aa613cba7362
github.com/sagernet/sing v0.0.0-20221001030341-348376220066
github.com/sagernet/sing-box v1.0.2-0.20221001030427-2dc8acea5c1a
github.com/spf13/cobra v1.5.0
neko v1.0.0
)
Expand Down Expand Up @@ -51,7 +51,7 @@ require (
github.com/sagernet/quic-go v0.0.0-20220818150011-de611ab3e2bb // indirect
github.com/sagernet/sing-dns v0.0.0-20220929010544-ee843807aae3 // indirect
github.com/sagernet/sing-shadowsocks v0.0.0-20220819002358-7461bb09a8f6 // indirect
github.com/sagernet/sing-tun v0.0.0-20220925112147-6bad0c2380ca // indirect
github.com/sagernet/sing-tun v0.0.0-20220929163559-a93592a9b581 // indirect
github.com/sagernet/sing-vmess v0.0.0-20220925083655-063bc85ea685 // indirect
github.com/sagernet/smux v0.0.0-20220831015742-e0f1988e3195 // indirect
github.com/sagernet/websocket v0.0.0-20220913015213-615516348b4e // indirect
Expand All @@ -62,11 +62,11 @@ require (
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.22.0 // indirect
go4.org/netipx v0.0.0-20220925034521-797b0c90d8ab // indirect
golang.org/x/crypto v0.0.0-20220924013350-4ba4fb4dd9e7 // indirect
golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/net v0.0.0-20220923203811-8be639271d50 // indirect
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect
golang.org/x/net v0.0.0-20220927171203-f486391704dc // indirect
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
golang.org/x/tools v0.1.11-0.20220513221640-090b14e8501f // indirect
Expand Down
24 changes: 12 additions & 12 deletions go/cmd/nekobox_core/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,16 @@ github.com/sagernet/quic-go v0.0.0-20220818150011-de611ab3e2bb h1:wc0yQ+SBn4TaTY
github.com/sagernet/quic-go v0.0.0-20220818150011-de611ab3e2bb/go.mod h1:MIccjRKnPTjWwAOpl+AUGWOkzyTd9tERytudxu+1ra4=
github.com/sagernet/sing v0.0.0-20220812082120-05f9836bff8f/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY=
github.com/sagernet/sing v0.0.0-20220817130738-ce854cda8522/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY=
github.com/sagernet/sing v0.0.0-20220926054900-7209937cc235 h1:RnOAPYPntphJkZaucj90uAiJtoyuvVbW13fjHDgb3rM=
github.com/sagernet/sing v0.0.0-20220926054900-7209937cc235/go.mod h1:5/u6RMDMoGIkSNtrZb41kJvyIFg3Ysn69P3WiAu8m0c=
github.com/sagernet/sing-box v1.0.2-0.20220929011213-aa613cba7362 h1:V+8AA8VxGA1xlWbU7XEzi6MFhl6jBkSsBs4xA5iy1WY=
github.com/sagernet/sing-box v1.0.2-0.20220929011213-aa613cba7362/go.mod h1:NjHsyHk4AL1DP3OPaF1JQm5w6gPn5btjPS0PYGP8w+k=
github.com/sagernet/sing v0.0.0-20221001030341-348376220066 h1:kQSd+x9ZLBcjl2+VjCLlkxzlD8VO5Q9X3FHDb7OGoN4=
github.com/sagernet/sing v0.0.0-20221001030341-348376220066/go.mod h1:zvgDYKI+vCAW9RyfyrKTgleI+DOa8lzHMPC7VZo3OL4=
github.com/sagernet/sing-box v1.0.2-0.20221001030427-2dc8acea5c1a h1:FCJ3lkzb/hSrqivqkBt9rq0dyqqbg7Znq3CVFP+bU+c=
github.com/sagernet/sing-box v1.0.2-0.20221001030427-2dc8acea5c1a/go.mod h1:zRxea9PoDsNcjzF4qUi5bVuXi3GJow3pdrakuzQ8Jsc=
github.com/sagernet/sing-dns v0.0.0-20220929010544-ee843807aae3 h1:AEdyJxEDFq38z0pBX/0MpikQapGMIch+1ADe9k1bJqU=
github.com/sagernet/sing-dns v0.0.0-20220929010544-ee843807aae3/go.mod h1:SrvWLfOSlnFmH32CWXicfilAGgIXR0VjrH6yRbuXYww=
github.com/sagernet/sing-shadowsocks v0.0.0-20220819002358-7461bb09a8f6 h1:JJfDeYYhWunvtxsU/mOVNTmFQmnzGx9dY034qG6G3g4=
github.com/sagernet/sing-shadowsocks v0.0.0-20220819002358-7461bb09a8f6/go.mod h1:EX3RbZvrwAkPI2nuGa78T2iQXmrkT+/VQtskjou42xM=
github.com/sagernet/sing-tun v0.0.0-20220925112147-6bad0c2380ca h1:Owgx9izFNYyMyUZ61td+mL3vumBhJz4zNismYlCyQbw=
github.com/sagernet/sing-tun v0.0.0-20220925112147-6bad0c2380ca/go.mod h1:ftP5VXlp3RJO5+WS3mPFk7jB9B/K/QrPEZX3BUORGQY=
github.com/sagernet/sing-tun v0.0.0-20220929163559-a93592a9b581 h1:ghpmEsGVdFQys5jxy01aVQvhbbUT2c4kJRZXHZBNerw=
github.com/sagernet/sing-tun v0.0.0-20220929163559-a93592a9b581/go.mod h1:qbqV9lwcXJnj1Tw4we7oA6Z8zGE/kCXQBCzuhzRWVw8=
github.com/sagernet/sing-vmess v0.0.0-20220925083655-063bc85ea685 h1:AZzFNRR/ZwMTceUQ1b/mxx6oyKqmFymdMn/yleJmoVM=
github.com/sagernet/sing-vmess v0.0.0-20220925083655-063bc85ea685/go.mod h1:bwhAdSNET1X+j9DOXGj9NIQR39xgcWIk1rOQ9lLD+gM=
github.com/sagernet/smux v0.0.0-20220831015742-e0f1988e3195 h1:5VBIbVw9q7aKbrFdT83mjkyvQ+VaRsQ6yflTepfln38=
Expand Down Expand Up @@ -216,8 +216,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220924013350-4ba4fb4dd9e7 h1:WJywXQVIb56P2kAvXeMGTIgQ1ZHQxR60+F9dLsodECc=
golang.org/x/crypto v0.0.0-20220924013350-4ba4fb4dd9e7/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be h1:fmw3UbQh+nxngCAHrDCCztao/kbYFnWjoqop8dHx05A=
golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA=
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA=
Expand Down Expand Up @@ -249,8 +249,8 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211111160137-58aab5ef257a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220630215102-69896b714898/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.0.0-20220923203811-8be639271d50 h1:vKyz8L3zkd+xrMeIaBsQ/MNVPVFSffdaU3ZyYlBGFnI=
golang.org/x/net v0.0.0-20220923203811-8be639271d50/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.0.0-20220927171203-f486391704dc h1:FxpXZdoBqT8RjqTy6i1E8nXHhW21wK7ptQ/EPIGxzPQ=
golang.org/x/net v0.0.0-20220927171203-f486391704dc/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1 h1:B333XXssMuKQeBwiNODx4TupZy7bf4sxFZnN2ZOcvUE=
Expand Down Expand Up @@ -287,8 +287,8 @@ golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220731174439-a90be440212d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc=
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI=
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down
5 changes: 3 additions & 2 deletions go/cmd/nekobox_core/grpc_box.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ func (s *server) Stop(ctx context.Context, in *gen.EmptyReq) (out *gen.ErrorResp
return
}

instance_cancel()
instance.Close() // xx closed

instance = nil
box_v2ray_service = nil

instance_cancel()
instance.Close() // xx closed
return
}

Expand Down
2 changes: 1 addition & 1 deletion rpc/gRPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ namespace NekoRay::rpc {
QString Client::Stop(bool *rpcOK) {
libcore::EmptyReq request;
libcore::ErrorResp reply;
auto status = grpc_channel->Call("Stop", request, &reply);
auto status = grpc_channel->Call("Stop", request, &reply, 3000);

if (status == QNetworkReply::NoError) {
*rpcOK = true;
Expand Down
39 changes: 3 additions & 36 deletions updater/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,41 +50,10 @@ func Updater() {
}

// remove old file
removeAll("./*.exe")
removeAll("./*.dll")
removeAll("./*.dmp")

// nekoray_list_old := make([]string, 0)
// nekoray_list_new := make([]string, 0)

// // delete old file from list
// if f, _ := os.Open("./files.json"); f != nil {
// err := json.NewDecoder(f).Decode(&nekoray_list_old)
// if err == nil {
// for _, fn := range nekoray_list_old {
// log.Println("del", fn, os.RemoveAll(fn))
// }
// }
// f.Close()
// }

// // walk the new file list
// if os.Chdir("./nekoray_update/nekoray/") == nil {
// filepath.Walk(".",
// func(path string, info os.FileInfo, err error) error {
// if path != "." {
// nekoray_list_new = append([]string{path}, nekoray_list_new...)
// }
// return nil
// })
// os.Chdir("../../")

// // store new file list
// if f, _ := os.OpenFile("./files.json", os.O_CREATE|os.O_TRUNC|os.O_RDWR, 0644); f != nil {
// json.NewEncoder(f).Encode(&nekoray_list_new)
// f.Close()
// }
// }

// update move
err := Mv("./nekoray_update/nekoray", "./")
if err != nil {
Expand Down Expand Up @@ -141,9 +110,7 @@ func Mv(src, dst string) error {

func removeAll(glob string) {
files, _ := filepath.Glob(glob)
if files != nil {
for _, f := range files {
os.Remove(f)
}
for _, f := range files {
os.Remove(f)
}
}

0 comments on commit 392ed2e

Please sign in to comment.