SagerNet / SagerNet/sing-box

wireguard starts with a delay when the screen turns on

Open
#4,509 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
38.2k
Forks
4.6k
Avg merge
19d 15h
Merged PRs (30d)
1

Description

Operating system

iOS

System version

26.6.1

Installation type

sing-box for iOS Graphical Client

If you are using a graphical client, please provide the version of the client.

sing-box MT 1.14.4

Version

Description

wireguard in endpoints stops when the screen turns off, and experiences a delay of 50 seconds when the screen turns back on.

{
  "log": {
    "level": "debug",
    "timestamp": true
  },
  "services": [
    {
      "type": "api",
      "listen": "0.0.0.0",
      "listen_port": 9696,
      "secret": "singbox",
      "dashboard": {
        "enabled": true,
        "path": "dashboard",
        "download_url": "https://github.com/SagerNet/sing-box-dashboard/archive/refs/heads/gh-pages.zip",
        "http_client": "default",
        "update_interval": "1d"
      }
    }
  ],
  "http_clients": [
    {
      "tag": "default"
    }
  ],
  "inbounds": [
    {
      "type": "tun",
      "address": ["172.19.0.1/30", "fdfe:dcba:9876::1/126"],
      "mtu": 1280,
      "auto_route": true,
      "strict_route": true
    }
  ],
  "endpoints": [
    {
      "tag": "wg-xxx",
      "type": "wireguard",
      "private_key": "xxxx",
      "address": ["10.2.4.212/32", "fd42::212/128"],
      "name": "wg0",
      "mtu": 1280,
      "peers": [
        {
          "address": "xxxx",
          "port": xxxx,
          "public_key": "xxxx",
          "pre_shared_key": "xxxx",
          "persistent_keepalive_interval": 25,
          "allowed_ips": ["0.0.0.0/0", "::/0"]
        }
      ]
    }
  ],
  "outbounds": [
    {
      "type": "direct",
      "tag": "direct"
    }
  ],
  "route": {
    "final": "wg-xxx",
    "auto_detect_interface": true
  }
}
Reproduction
  1. turn off the screen, waiting for wg stop
  2. turn on the screen
  3. open app there is no internet about 50 secs
  4. wireguard starting after 50 secs
Logs
// screen off
DEBUG[0588] endpoint/wireguard[wg-xxx]: routine: receive incoming v4 - stopped
DEBUG[0588] endpoint/wireguard[wg-xxx]: routine: receive incoming v6 - stopped
DEBUG[0588] endpoint/wireguard[wg-xxx]: peer(xxx…xxx) - stopping
DEBUG[0588] endpoint/wireguard[wg-xxx]: peer(xxx…xxx) - routine: sequential receiver - stopped
DEBUG[0588] endpoint/wireguard[wg-xxx]: peer(xxx…xxx) - routine: sequential sender - stopped
DEBUG[0588] endpoint/wireguard[wg-xxx]: interface state was Up, requested Down, now Down


//screen on

//a lot of logs

//after 50 seconds
DEBUG[0670] endpoint/wireguard[wg-xxx]: udp bind has been updated
DEBUG[0670] endpoint/wireguard[wg-xxx]: peer(xxx…xxx) - starting
DEBUG[0670] endpoint/wireguard[wg-xxx]: peer(xxx…xxx) - sending keepalive packet
DEBUG[0670] endpoint/wireguard[wg-xxx]: routine: receive incoming v4 - started
DEBUG[0670] endpoint/wireguard[wg-xxx]: peer(xxx…xxx) - sending handshake initiation
DEBUG[0670] endpoint/wireguard[wg-xxx]: routine: receive incoming v6 - started
DEBUG[0670] endpoint/wireguard[wg-xxx]: peer(xxx…xxx) - routine: sequential sender - started
DEBUG[0670] endpoint/wireguard[wg-xxx]: peer(xxx…xxx) - routine: sequential receiver - started
DEBUG[0670] endpoint/wireguard[wg-xxx]: interface state was Down, requested Up, now Up
DEBUG[0670] endpoint/wireguard[wg-xxx]: peer(xxx…xxx) - received handshake response
Supporter
Integrity requirements
  • I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
  • I confirm that I have provided the server and client configuration files and process that can be reproduced locally, instead of a complicated client configuration file that has been stripped of sensitive data.
  • I confirm that I have provided the simplest configuration that can be used to reproduce the error I reported, instead of depending on remote servers, TUN, graphical interface clients, or other closed-source software.
  • I confirm that I have provided the complete configuration files and logs, rather than just providing parts I think are useful out of confidence in my own intelligence.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files, tests, or entry points are named. Start by reproducing the screen-off and screen-on sequence with the provided WireGuard configuration and debug logs; done means the endpoint resumes without the reported 50-second period without internet.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, ios
Domain
mobile-dev, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.