YukidouSatoru / sphia

Sphia - a Proxy Handling Intuitive Application
GNU General Public License v3.0
34 stars 6 forks source link

singbox dosen't work #4

Closed Jds548 closed 4 months ago

Jds548 commented 5 months ago

Bug report checklist

System

Linux

System version

archlinux

Sphia version

0.8.0

Last commit hash

3d0eae1ba8c61ce209f8aa145f720b0513649e4b

Description

Singnox doesn't work. Log section doesn't show anything. Xray works fine. Sometimes gives DNS error: Failed to start core: Exception: Failed to resolve DNS server address: https://dns.google/dns-query Changing direct and remote DNS doesn't seem to make a difference. TUN mode also doesn't work.

Reproduction

Start core. failure to connect to proxy.

Logs

#0   configureApp (package:sphia/main.dart:97)
#1   <asynchronous suspension>
22:46:08.032 (+0:00:00.009986)
πŸ’‘   Sphia - a Proxy Handling Intuitive Application
πŸ’‘   Full version: 0.8.0+11
πŸ’‘   Last commit hash: 0e7f794d5a50a5bb1c462322b5fa6f5b06cb3309
πŸ’‘   OS: linux
πŸ’‘   Architecture: x86_64
πŸ’‘   App Path: /home/userf/.local/share/com.yukidousatoru.sphia
πŸ’‘   Exec Path: /home/userf/Downloads/sphia-linux-amd64(1).AppImage
πŸ’‘   Bin path: /home/userf/.local/share/com.yukidousatoru.sphia/bin
πŸ’‘   Config path: /home/userf/.local/share/com.yukidousatoru.sphia/config
πŸ’‘   Log path: /home/userf/.local/share/com.yukidousatoru.sphia/log
πŸ’‘   Temp path: /home/userf/.local/share/com.yukidousatoru.sphia/temp
#0   SphiaConfigDao.loadConfig (package:sphia/app/database/dao/config.dart:33)
#1   configureApp (package:sphia/main.dart:117)
22:46:08.034 (+0:00:00.011970)
πŸ’‘ Loading Sphia config
#0   ServerConfigDao.loadConfig (package:sphia/app/database/dao/config.dart:98)
#1   configureApp (package:sphia/main.dart:118)
22:46:08.056 (+0:00:00.033943)
πŸ’‘ Loading server config
#0   RuleConfigDao.loadConfig (package:sphia/app/database/dao/config.dart:152)
#1   configureApp (package:sphia/main.dart:119)
22:46:08.056 (+0:00:00.034160)
πŸ’‘ Loading rule config
#0   VersionConfigDao.loadConfig (package:sphia/app/database/dao/config.dart:206)
#1   configureApp (package:sphia/main.dart:120)
22:46:08.057 (+0:00:00.034334)
πŸ’‘ Loading version config
#0   configureApp (package:sphia/main.dart:135)
#1   <asynchronous suspension>
22:46:08.057 (+0:00:00.034513)
πŸ’‘ singBoxVersion: v1.8.14
πŸ’‘ singBoxRulesVersion: 20240525003523
#0   ServerGroupDao.getOrderedServerGroups (package:sphia/app/database/dao/server_group.dart:15)
#1   configureApp (package:sphia/main.dart:139)
22:46:08.057 (+0:00:00.034551)
πŸ’‘ Getting ordered server groups
#0   ServerDao.getOrderedServerModelsByGroupId (package:sphia/app/database/dao/server.dart:36)
#1   configureApp (package:sphia/main.dart:142)
22:46:08.058 (+0:00:00.035326)
πŸ’‘ Getting ordered servers by group id: 1
#0   RuleGroupDao.getOrderedRuleGroups (package:sphia/app/database/dao/rule_group.dart:15)
#1   configureApp (package:sphia/main.dart:145)
22:46:08.058 (+0:00:00.036170)
πŸ’‘ Getting ordered rule groups
#0   RuleDao.getOrderedRuleModelsByGroupId (package:sphia/app/database/dao/rule.dart:38)
#1   configureApp (package:sphia/main.dart:146)
22:46:08.059 (+0:00:00.036510)
πŸ’‘ Getting ordered rules by group id: 1
#0   TrayNotifier.build (package:sphia/app/notifier/tray.dart:12)
#1   AsyncNotifierProviderImpl.runNotifierBuild (package:riverpod/src/async_notifier/base.dart:139)
22:46:08.066 (+0:00:00.044186)
πŸ’‘ Setting tray menu
#0   _TrayWrapperState.initState.<anonymous closure> (package:sphia/view/wrapper/tray.dart:26)
#1   SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1386)
22:46:08.208 (+0:00:00.186063)
πŸ’‘ Building tray
#0   TrayUtil.setIcon (package:sphia/util/tray.dart:7)
#1   _TrayWrapperState.initState.<anonymous closure> (package:sphia/view/wrapper/tray.dart:27)
22:46:08.208 (+0:00:00.186188)
πŸ’‘ Setting tray icon
#0   _ServerPageState._scrollToServer (package:sphia/view/page/server.dart:570)
#1   _ServerPageState.build.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:sphia/view/page/server.dart:437)
22:46:08.209 (+0:00:00.186325)
πŸ’‘ Scrolling to server 0

Screenshots

No response

Additional context

both latest commit and latest release checked.

Jds548 commented 5 months ago

Using custom config, generate this log: FATAL[0001] start service: pre-start cache file: open cache.db: read-only file system

Jds548 commented 5 months ago

New update: using mixed port (not socks port) and TUN mode sometimes gives something like this log: +0330 2024-05-26 14:47:59 ERROR [1048340031 615ms] inbound/mixed[0]: process connection from 127.0.0.1:38050: unexpected HTTP response status: 403

YukidouSatoru commented 5 months ago

Singnox doesn't work. Log section doesn't show anything. Xray works fine. Sometimes gives DNS error:

https://github.com/YukidouSatoru/sphia/blob/448537d066eac32ef3d8f02530f9caf868c682c2/lib/l10n/intl_en_US.arb#L68

This issue might be due to local network instability causing resolution failures. This step is part of the preparation for generating the sing-box configuration file. However, as you encountered, this is not a best practice. I have improved the process by allowing users to manually set the dnsResolver, with a default value of 223.5.5.5. Additionally, the default value for directDns is now set to https+local://dns.alidns.com/dns-query. It is recommended that you manually update directDns to match the IP of the dnsResolver for consistency.

read-only file system

You might need to check the owner and group of cache.db.

unexpected HTTP response status: 403

I will keep an eye on it. It is possible that the configuration file generated by Sphia is not the best practice.

YukidouSatoru commented 5 months ago

Try this build.

Jds548 commented 5 months ago

I have improved the process by allowing users to manually set the dnsResolver, with a default value of 223.5.5.5.

Thanks for implementation.

Direct DNS works fine, because when I set from "Global" or "Default" to "Direct" rules, My internet works as it is (restricted and it shows app can direct well). I've changed Remote DNS, but still no chance.

You might need to check the owner and group of cache.db.

after multiple efforts, I've didn't encounter it in order to reproduce it and change the permission. It is worth noting Sing-box Log for custom won't be available from log directory (.local/share/com.yukidousatoru.sphia/log). also the configs tested on others and they are working.

even ERROR logs won't printed on "Log" section in the app. I have to see them in Log directory (both custom and regular vless).

unexpected HTTP response status: 403

I'm trying to run vless config like this and I face this error: vless://f4a6ve2a-556e-4b77-4466-34b34333f832@104.12.28.212:443?security=tls&sni=XXX.XXXX.XXX&alpn=http/1.1&fp=firefox&type=ws&path=/?ed%3D2560&host=XXX.XXXX.XXX&encryption=none#X

YukidouSatoru commented 5 months ago

I've changed Remote DNS, but still no chance.

Try the latest build. There is currently no progress on the xray-core fix.

Jds548 commented 5 months ago

Try the latest build.

Thanks for follow-up. It doesn't work, but I see new ERROR log: +0330 2024-05-27 19:25:20 ERROR [4195716526 310ms] inbound/mixed[0]: process connection from 127.0.0.1:39266: download: unknown version: 72 and now all errors are these. I think url testing also uses sing-box? I have same problem with that. no matter what I change, it is timeout.

There is currently no progress on the xray-core fix.

Xray-core works very well for me. maybe I just have small inconveniences.

YukidouSatoru commented 5 months ago

The latest build has fixed the issue where remote DNS was not working, xray configuration currently generated by Sphia does not make it effective.

It doesn't work, but I see new ERROR log:

Can you provide more information? For example, configuration files, core details, etc. I will try to reproduce the issue on the latest build.

YukidouSatoru commented 5 months ago

It is worth noting Sing-box Log for custom won't be available from log directory

I tried to reproduce it on macOS and Linux, but outputting sing-box logs to log file causes a crash on startup, unless switching to version 1.7.8.

Jds548 commented 5 months ago

xray configuration currently generated by Sphia does not make it effective.

Now, I'm facing problem with Xray-core that sound very irrational. My backup from app (com.yukidousatoru.sphia) works flawlessly with all these lately builds (from this to last one). But now if I delete this backup start the app from default, I can not connect to xray! I'm trying to reproduce same setting from this build. I mean even If I start from a build that OK was, Now I'm not! Xray-core log is successful, but I have this at Sphia log (from this build):

β›” Failed to get uplink from proxy: type 'Null' is not a subtype of type 'String'
#0   XrayTraffic.queryOutboundUplink.<anonymous closure> (package:sphia/util/traffic/traffic.dart:136)
#1   <asynchronous suspension>
Jds548 commented 5 months ago

Can you provide more information? For example, configuration files, core details, etc.

I'm using Archlinux, KDE Plasma and linux-zen kernel. also I've seen a bug. If you enable "Save Core Log", "Enable Core Log" won't have its action. core log won't display in the app.

Jds548 commented 5 months ago

now Xray-core log is something like this: 2024/05/28 01:37:00 tcp:127.0.0.1:34640 accepted tcp:52.178.56.177:80 [proxy] but not connected. why?

Jds548 commented 5 months ago

I've tested latest build on both Windows 11 and Manjaro (Archlinux based OS). both Xray-core and Sing-box don't work. Xray-core logs are successful but actually not working. Sing-box core on windows has this log for example:

-ERROR [2637205634 513ms] dns: lookup failed for whoer.net: exchange4: unknown version: 72 | exchange6: unknown version: 72
-ERROR [2066636165 506ms] inbound/mixed[0]: process connection from 127.0.0.1:61462: exchange4: unknown version: 72 | exchange6: unknown version: 72

I've changed both remote and resolver DNS but didn't make difference in action.

Jds548 commented 5 months ago

UPDATE:

It is possible that the configuration file generated by Sphia is not the best practice.

I think I've found the problem. It is by sing-box json generated by Sphia (available at .local/share/com.yukidousatoru.sphia/temp). My vless config is: vless://s0a6ge8s-415e-4r61-fg28-77b34670f8d8@152.159.32.35:443?security=tls&sni=example.com&alpn=http/1.1&fp=firefox&type=ws&path=/?ed%3D2560&host=example.com&encryption=none#NAME

and the Sphia sing-box.json outbound transport is: "transport":{"type":"ws","path":"/"}

If I replace the transport with below, sing-box is working now:

      "transport": {
        "early_data_header_name": "Sec-WebSocket-Protocol",
        "headers": {
          "Host": "example.com"
        },
        "max_early_data": 2560,
        "path": "/",
        "type": "ws"
      },
Jds548 commented 4 months ago

UPDATE: Thank you very much! new commit (https://github.com/YukidouSatoru/sphia/commit/1656729e711d019f7f7142c95bdd829bbb7070d8) have kinda fixed the problem. both Xray and sing-box work well on old configuration directory. setting it up fresh still isn't ok.

Now, I'm facing problem with Xray-core that sound very irrational. My backup from app (com.yukidousatoru.sphia) works flawlessly with all these lately builds (from this to last one). But now if I delete this backup start the app from default, I can not connect to xray!