Skip to content

Error when using sing-box with naive under macOS #771

@catcheru

Description

@catcheru

Welcome

  • Yes, I'm using the latest major release. Only such installations are supported.
  • Yes, I'm using the latest Golang release. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, FULL config, FULL log, etc).

Description of the problem

Error when using sing-box with naive under macOS
The sing-box logs loop looks similar to the following message:
router: found process path: /usr/local/bin/naive
+0800 2023-08-11 23:12:00 INFO [2420874521 7ms] outbound/socks[proxy]: outbound connection to vps_ip:443
+0800 2023-08-11 23:12:00 INFO [569157379 0ms] inbound/tun[tun-in]: inbound connection from local_ip:58910
+0800 2023-08-11 23:12:00 INFO [569157379 0ms] inbound/tun[tun-in]: inbound connection to vps_ip:443
+0800 2023-08-11 23:12:00 INFO [1326610905 0ms] inbound/tun[tun-in]: inbound connection from local_ip:58912
+0800 2023-08-11 23:12:00 INFO [1326610905 0ms] inbound/tun[tun-in]: inbound connection to vps_ip:443

and then errors occurred in naive:
[0811/225107.433560:ERROR:ssl_client_socket_impl.cc(978)] handshake failed; returned -1, SSL error code 1, net_error -100
[0811/225107.433761:ERROR:ssl_client_socket_impl.cc(978)] handshake failed; returned -1, SSL error code 1, net_error -100

lsof command yields the following results:
naive 17655 user 6u IPv4 0x934febfad6b8cc89 0t0 TCP localhost:10808 (LISTEN)
naive 17655 user 11u IPv4 0x934febfad6aac909 0t0 TCP localhost:10808->localhost:63158 (CLOSE_WAIT)
naive 17655 user 13u IPv4 0x934febfad6aaa7a9 0t0 TCP localhost:10808->localhost:63160 (CLOSE_WAIT)
naive 17655 user 15u IPv4 0x934febfad6aba2c9 0t0 TCP localhost:10808->localhost:63162 (CLOSE_WAIT)
naive 17655 user 17u IPv4 0x934febfad6ab54e9 0t0 TCP localhost:10808->localhost:63164 (CLOSE_WAIT)

Version of sing-box

Details
$ sing-box version
sing-box version 1.3.5

Environment: go1.20.6 darwin/amd64
Tags: with_gvisor,with_quic,with_wireguard,with_utls,with_reality_server,with_clash_api
CGO: enabled

Server and client configuration file

Details
server use caddy
client config:

{
    "log": {
        "level": "info",
        "timestamp": true
    },
    "dns": {
        "servers": [
            {
                "tag": "dns_proxy",
                "address": "tls://1.1.1.1",
                "address_resolver": "dns_direct",
                "strategy": "ipv4_only",
                "detour": "proxy"
            },
            {
                "tag": "dns_direct",
                "address": "tls://223.5.5.5",
                "strategy": "ipv4_only",
                "detour": "direct"
            },
            {
                "tag": "dns_block",
                "address": "rcode://success"
            }
        ],
        "rules": [
            {
                "geosite": [
                    "category-ads-all"
                ],
                "server": "dns_block",
                "disable_cache": true
            },
            {
                "geosite": [
                    "geolocation-!cn"
                ],
                "server": "dns_proxy"
            },
            {
                "geosite": [
                    "cn",
                    "private"
                ],
                "server": "dns_direct"
            },
            {
                "outbound": [
                    "any"
                ],
                "server": "dns_direct"
            }
        ]
    },
    "route": {
        "geoip": {
            "download_url": "https://github.com/soffchen/sing-geoip/releases/latest/download/geoip.db"
        },
        "geosite": {
            "download_url": "https://github.com/soffchen/sing-geosite/releases/latest/download/geosite.db"
        },
        "rules": [
            {
                "protocol": "dns",
                "outbound": "dns-out"
            },
            {
                "protocol": [
                    "quic"
                ],
                "outbound": "block"
            },
            {
                "geosite": [
                    "category-ads-all"
                ],
                "outbound": "block"
            },
            {
                "geosite": [
                    "geolocation-!cn"
                ],
                "outbound": "proxy"
            },
            {
                "geosite": [
                    "cn",
                    "private"
                ],
                "outbound": "direct"
            },
            {
                "geoip": [
                    "cn",
                    "private"
                ],
                "outbound": "direct"
            }
        ],
        "auto_detect_interface": true
    },
    "inbounds": [
        {
            "type": "tun",
            "tag": "tun-in",
            "inet4_address": "172.19.0.1/30",
            "inet6_address": "fdfe:dcba:9876::1/126",
            "auto_route": true,
            "strict_route": true,
            "stack": "system",
            "sniff": true,
            "sniff_override_destination": false
        }
    ],
    "outbounds": [
        {
          "type": "socks",
            "server": "127.0.0.1",
            "server_port": 10808,
            "udp_over_tcp": {
                "enabled": true,
                "version": 2
            },
            "tag": "proxy"
        },
        {
            "type": "direct",
            "tag": "direct"
        },
        {
            "type": "block",
            "tag": "block"
        },
        {
            "type": "dns",
            "tag": "dns-out"
        }
    ]
}


Server and client log file

Details
router: found process path: /usr/local/bin/naive
+0800 2023-08-11 23:12:00 INFO [2420874521 7ms] outbound/socks[proxy]: outbound connection to vps_ip:443
+0800 2023-08-11 23:12:00 INFO [569157379 0ms] inbound/tun[tun-in]: inbound connection from local_ip:58910
+0800 2023-08-11 23:12:00 INFO [569157379 0ms] inbound/tun[tun-in]: inbound connection to vps_ip:443
+0800 2023-08-11 23:12:00 INFO [1326610905 0ms] inbound/tun[tun-in]: inbound connection from local_ip:58912
+0800 2023-08-11 23:12:00 INFO [1326610905 0ms] inbound/tun[tun-in]: inbound connection to vps_ip:443```
....
loops n times



</details>

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions