MatsuriDayo / NekoBoxForAndroid

NekoBox for Android / sing-box / universal proxy toolchain for Android
https://matsuridayo.github.io/
Other
11.87k stars 992 forks source link

Wireguard outbound. Failed: Timeout #314

Closed dm1sh closed 1 year ago

dm1sh commented 1 year ago

Unable to connect to my wireguard server. My setting are presented in log file.

预期行为:

Connection establishes and requests succeed.

实际行为:

NekoBox for Andoird 1.2.2 (130) OSS
Date: 2023-08-30 04:40:56.198 UTC

OS_VERSION: 4.9.337-lineage+
SDK_INT: 33
RELEASE: 13
ID: TQ3A.230705.001
DISPLAY: lineage_***-userdebug 13 TQ3A.230705.001 73a55fd7e1
INCREMENTAL: 73a55fd7e1
SECURITY_PATCH: 2023-07-05
IS_DEBUGGABLE: 1
IS_EMULATOR: null
IS_TREBLE_ENABLED: true
TYPE: userdebug
TAGS: release-keys

MANUFACTURER: Xiaomi
BRAND: Xiaomi
MODEL: ***
PRODUCT: lineage_***
BOARD: ***
HARDWARE: qcom
DEVICE: ***
SUPPORTED_ABIS: arm64-v8a, armeabi-v7a, armeabi

Settings: 

mixedPort: 2080
portLocalDns: 6450
transproxyPort: 9200
nightTheme: 0
mtu: 9000
speedInterval: 1000
profileTrafficStatistics: true
showGroupInNotification: false
showDirectSpeed: true
proxyApps: false
bypassLan: false
bypassLanInCore: false
trafficSniffing: 1
resolveServer: false
ipv6Mode: 0
rulesProvider: 0
mux: []
muxType: 0
muxConcurrency: 8
directDnsUseSystem: false
dnsNetwork: []
transproxyMode: 0
allowAccess: false
acquireWakeLock: false
enableClashAPI: false
tcpKeepAliveInterval: 15
appTLSVersion: 1.2
logLevel: 3
alwaysShowAddress: true
meteredNetwork: false
isAutoConnect: true
appTheme: 19
serviceMode: vpn
requireTransproxy: false
resolveDestination: false
appendHttpProxy: false
connectionTestConcurrent: 5
connectionTestURL: http://he.net/
tunImplementation: 1
domain_strategy_for_direct: auto
directDns: https://dns.quad9.net/dns-query
showBottomBar: false
enableDnsRouting: true
enableFakeDns: false
domain_strategy_for_server: auto
nekoPlugins: 
domain_strategy_for_remote: auto
remoteDns: 9.9.9.9
profileId: 17
profileGroup: 1
profileCurrent: 17

Logcat: 

--------- beginning of main
08-30 07:40:41.634  9926  9926 W TabLayout: MODE_SCROLLABLE + GRAVITY_FILL is not supported, GRAVITY_START will be used instead
08-30 07:40:47.119  9954  9954 W moe.nb4a:bg: type=1400 audit(0.0:1564): avc: denied { bind } for scontext=u:r:untrusted_app:s0:c187,c256,c512,c768 tcontext=u:r:untrusted_app:s0:c187,c256,c512,c768 tclass=netlink_route_socket permissive=0 bug=b/155595000 app=moe.nb4a

2023/08/30 04:40:47 [Debug] [ProxyInstance] {
  "dns": {
    "independent_cache": true,
    "rules": [],
    "servers": [
      {
        "address": "9.9.9.9",
        "address_resolver": "dns-direct",
        "strategy": "ipv4_only",
        "tag": "dns-remote"
      },
      {
        "address": "https://dns.quad9.net/dns-query",
        "address_resolver": "dns-local",
        "detour": "direct",
        "strategy": "ipv4_only",
        "tag": "dns-direct"
      },
      {
        "address": "local",
        "detour": "direct",
        "tag": "dns-local"
      },
      {
        "address": "rcode://success",
        "tag": "dns-block"
      }
    ]
  },
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "listen_port": 6450,
      "override_address": "8.8.8.8",
      "override_port": 53,
      "tag": "dns-in",
      "type": "direct"
    },
    {
      "domain_strategy": "",
      "endpoint_independent_nat": true,
      "inet4_address": [
        "172.19.0.1/28"
      ],
      "mtu": 9000,
      "sniff": true,
      "sniff_override_destination": false,
      "stack": "system",
      "tag": "tun-in",
      "type": "tun"
    },
    {
      "domain_strategy": "",
      "listen": "127.0.0.1",
      "listen_port": 2080,
      "sniff": true,
      "sniff_override_destination": false,
      "tag": "mixed-in",
      "type": "mixed"
    }
  ],
  "log": {
    "level": "debug"
  },
  "outbounds": [
    {
      "local_address": [
        "10.0.0.4/32",
        "fd86:ea04:1115::4/128"
      ],
      "mtu": 1420,
      "peer_public_key": "***",
      "pre_shared_key": "***",
      "private_key": "***",
      "server": "1.2.3.4",
      "server_port": 1234,
      "type": "wireguard",
      "domain_strategy": "",
      "tag": "proxy"
    },
    {
      "tag": "direct",
      "type": "direct"
    },
    {
      "tag": "bypass",
      "type": "direct"
    },
    {
      "tag": "block",
      "type": "block"
    },
    {
      "tag": "dns-out",
      "type": "dns"
    }
  ],
  "route": {
    "auto_detect_interface": true,
    "rules": [
      {
        "outbound": "dns-out",
        "port": [
          53
        ]
      },
      {
        "inbound": [
          "dns-in"
        ],
        "outbound": "dns-out"
      },
      {
        "ip_cidr": [
          "224.0.0.0/3",
          "ff00::/8"
        ],
        "outbound": "block",
        "source_ip_cidr": [
          "224.0.0.0/3",
          "ff00::/8"
        ]
      }
    ]
  }
}
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: uapi: updating private key
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: handshake worker 2 - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: encryption worker 2 - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: handshake worker 1 - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: encryption worker 3 - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: handshake worker 3 - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: decryption worker 2 - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: decryption worker 3 - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: decryption worker 1 - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: decryption worker 4 - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: encryption worker 4 - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: handshake worker 4 - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: encryption worker 5 - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: decryption worker 5 - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: handshake worker 5 - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: tun reader - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: event worker - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: encryption worker 1 - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: peer(ivOL…nCXc) - uapi: created
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: peer(ivOL…nCXc) - uapi: updating endpoint
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: peer(ivOL…nCXc) - uapi: updating preshared key
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: peer(ivOL…nCXc) - uapi: adding allowedip
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: peer(ivOL…nCXc) - uapi: adding allowedip
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: interface up requested
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: udp bind has been updated
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: peer(ivOL…nCXc) - starting
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: routine: receive incoming receive - started
2023/08/30 04:40:47 INFO[0000] inbound/direct[dns-in]: tcp server started at 127.0.0.1:6450
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: peer(ivOL…nCXc) - routine: sequential receiver - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: peer(ivOL…nCXc) - routine: sequential sender - started
2023/08/30 04:40:47 DEBUG[0000] outbound/wireguard[proxy]: interface state was Down, requested Up, now Up
2023/08/30 04:40:47 INFO[0000] inbound/direct[dns-in]: udp server started at 127.0.0.1:6450
2023/08/30 04:40:47 WARN[0000] inbound/tun[tun-in]: bind forwarder to interface: operation not permitted
2023/08/30 04:40:47 INFO[0000] inbound/tun[tun-in]: started at tun
2023/08/30 04:40:47 INFO[0000] inbound/mixed[mixed-in]: tcp server started at 127.0.0.1:2080
2023/08/30 04:40:47 INFO[0000] sing-box started (0.88s)
2023/08/30 04:40:47 [Debug] [TrafficLooper] traffic count proxy to 17
2023/08/30 04:40:48 INFO[0001] [497822193 0ms] inbound/tun[tun-in]: inbound connection from 100.77.161.39:40246
2023/08/30 04:40:48 INFO[0001] [497822193 0ms] inbound/tun[tun-in]: inbound connection to 127.0.0.1:853
2023/08/30 04:40:48 DEBUG[0001] [497822193 13ms] router: sniffed protocol: tls
2023/08/30 04:40:48 INFO[0001] [497822193 13ms] outbound/wireguard[proxy]: outbound connection to 127.0.0.1:853
2023/08/30 04:40:48 DEBUG[0001] outbound/wireguard[proxy]: peer(ivOL…nCXc) - sending handshake initiation
2023/08/30 04:40:48 DEBUG[0001] outbound/wireguard[proxy]: peer(ivOL…nCXc) - received handshake response
2023/08/30 04:40:48 INFO[0001] outbound/wireguard[proxy]: outbound connection to he.net:80
2023/08/30 04:40:48 DEBUG[0001] dns: lookup domain he.net
2023/08/30 04:40:48 INFO[0001] outbound/wireguard[proxy]: outbound packet connection to 9.9.9.9:53
2023/08/30 04:40:51 ERROR[0004] dns: lookup failed for he.net: context deadline exceeded
2023/08/30 04:40:51 [Warning] [StatsBar$testConnection$1] java.lang.IllegalStateException: Timeout
arm64v8a commented 1 year ago

In addition to the timeout, you can’t see any valid information. The high probability is your configuration problem.

dm1sh commented 1 year ago

There is also a line, telling

bind forwarder to interface: operation not permitted

Maybe it can give useful information. I can connect to the server using official app, but get timeout error in any xray client.

arm64v8a commented 1 year ago

bind forwarder to interface: operation not permitted

No. This is normal.

There are no other reports, so for the time being, you can only check if there is something wrong with your configuration and network