I shared bgscan here about a month ago. Quite a bit has changed since then, so here's another update for anyone who missed the last post.
I'm the author of bgscan. It started as a pile of one-off scripts I kept rewriting to answer the same questions: which IPs in a range are alive, which ones serve HTTP, which DNS resolvers actually forward queries, and which Xray outbounds still work.
I eventually got tired of maintaining separate scripts for all of that, so I started putting them together in one terminal UI. It's written in Go, GPL-3.0, and has no telemetry.
What it does
bgscan probes IPs over ICMP, TCP, HTTP/1.1, HTTP/2, HTTP/3 (QUIC), DNS, Xray, and DNS tunnels.
Chaining is probably the part I use most. Run an ICMP sweep, send only the hosts that answered into TCP or HTTP, then write the results to CSV. The next scan can use that CSV as its input, so the target list gets smaller at every stage.
Pipelines can run in streaming, batch or sequential mode. You can shuffle targets, limit how many IPs each stage reads, control how many sit between stages, and stop after a certain number of successful results. That last option is useful when you only need a handful of working IPs and don't want to wait for the entire list.
What's new in 2.12.1
Most of this release is about the TUI. I spent quite a bit of time fixing unnecessary rendering:
- Tables, scanner panels and the footer now cache their rendered output and only rebuild when something changes.
- Opening a dialog no longer rebuilds the screen behind it.
- The log view batches incoming lines instead of polling once a second.
- The footer now renders on the first frame instead of staying blank for a second.
There were also some core fixes:
- A failed result-writer flush now stops the scan and reports the error instead of finishing with missing rows.
- Closing the logger no longer races with workers still writing to the log file.
- HTTP/2 works again in the default
h1,h2 mode. - Plain HTTP probes now connect to the target IP instead of the URL host.
- SSH key authentication keeps the username, and DNSTT keeps its handshake timeout.
- Merged results are deduplicated by key, and speedtest transfers now respect their deadlines.
- The startup checklist shows the vendored TheFeed library version.
A bit about the internals
bgscan doesn't shell out to most of these clients. They're vendored as git submodules in third_party/, and I maintain small forks with the changes needed to run them inside the scanner.
Xray is the biggest one. A scan can dial thousands of targets, and stock Xray leaves a lot of those dials waiting for their timeouts instead of closing them explicitly. On a large scan, that adds up pretty quickly.
My fork tracks every dial from TCP connect through the TLS handshake and force-closes anything still tracked when the scan ends. The dial timeout follows the Xray latency timeout from settings, there's a process-wide cap on concurrent dials, and the VLESS/VMess retry count is configurable instead of being hardcoded to five.
TLS handshakes also have an 8-second limit. If a handshake fails, the raw connection gets closed instead of leaving the descriptor around.
The xhttp/splithttp and gRPC dialers got similar changes: deadlines around dial and handshake, cancellation when the caller cancels, releasing per-destination clients when their last tunnel closes, and clearing the global dialer maps when a scan ends. Otherwise, individual instances close but the pooled dialers can outlive them.
VayDNS got context propagation through the transport and tunnel layers, TCP resolver support, TCP packet connections, and a small internal logger to replace logrus. Its client also backs the DNSTT path bgscan uses.
For MasterDNS, StormDNS and TheFeed, I wrote thin wrappers in internal/core/dns/ and added a few exported hooks to the forks: a tunnel package, logger disable, default config, and a public protocol package. This lets bgscan run them in-process instead of spawning separate binaries.
Slipstream is the exception. It's still running as an external binary.
The forks are here if anyone wants to look at the changes:
third_party/xray-core, branch scanner-fixthird_party/vaydnsthird_party/masterdnsthird_party/stormdnsthird_party/thefeed
All of it is open source. Rebasing the Xray patches onto every upstream release is probably the least fun part of maintaining this project.
Supported probes
- ICMP: Host discovery over IPv4 and IPv6.
- TCP: Connection and handshake checks on any port.
- HTTP: HTTP/1.1, HTTP/2 and HTTP/3 over QUIC. Configurable Host header, SNI override, TLS version range, uTLS fingerprint and accepted status codes.
- DNS: UDP, TCP and DoT, with record types, EDNS buffer size, accepted response codes, random subdomains, and an anti-hijack check using a fake
.invalid domain. DNS tunnels:
- DNSTT, VayDNS and Slipstream with SOCKS or SSH base connections.
- MasterDNS and StormDNS with configurable encryption and MTU discovery.
- TheFeed over UDP, TCP or DoT.
- Xray: Outbound validation plus download and upload speed tests.
There are also bundled IP lists for Cloudflare (IPv4 and IPv6), AWS, Azure, Google, Akamai, Fastly, Bunny, G-Core, Iran and public DNS servers.
Using Xray with CDN IPs
You can add outbounds directly inside the TUI. Share links are supported for VMess, VLESS, Trojan, Shadowsocks, SOCKS and Hysteria2.
For anything else Xray supports, you can import JSON or JSONC. It can be a single outbound, an array of outbounds, or a full Xray config. WireGuard is supported this way too, through JSON rather than a share link.
For each target, bgscan builds the config in memory and replaces the outbound address with the target IP. The port, SNI and Host header stay unchanged.
This is how I test CDN-fronted configs. There's a Cloudflare example outbound and IPv4/IPv6 lists in the repo, so you can point an outbound with a fixed SNI at thousands of Cloudflare IPs and see which ones actually pass traffic.
Some of the settings I usually change:
- Xray pre-scan: none, ICMP, TCP or HTTP.
- Test type: connectivity only, download, upload, or both.
- Download and upload thresholds in Kbps.
- Latency timeout and speed-test timeout.
- Xray workers, max concurrent dials, and dial attempts.
- Pipeline mode, batch size, and max IPs per stage.
- Workers, timeout and retries per probe.
- Shuffle and IP caps.
- DNS tunnel resolver pre-check and adaptive resolver mode.
Everything is editable in the TUI inspector and saved to TOML files, which you can also edit by hand. No restart needed.
Installation
There's an installer for Linux, macOS, Termux and Windows. I wrote a small Rust installer for it, called bgscan-installer.
It checks the SHA-256 of the downloaded release and handles updates, clean installs and backups. It's around 2 MB and doesn't need a runtime installed.
Installer source: https://github.com/MohsenBg/bgscan-installer
Links
Why I built it
This is a solo project. No company behind it, no cloud service, no accounts and no telemetry.
I originally built it because I needed something for resolver and Xray outbound testing. Over time it grew into something bigger, and I figured other people might find it useful too.
If you try it, let me know what breaks. Issues with your OS, bgscan version, the config you used (redact secrets), and the relevant part of debug.log are especially helpful.
Feature requests are welcome too. It's more useful if you explain what you're trying to do rather than just suggesting a feature.