Cross-platform secure peer-to-peer file transfer and private networking
End-to-end encryption for file transfers · Direct connections within or across networks, with no data relay · No account required
Join the discussion in the WeChat group
简体中文 | English
Gonc helps two devices find each other with a shared passphrase. On the same LAN, peers can quickly discover each other and connect directly over the local network. Across different networks, Gonc uses NAT traversal and hole punching to establish a peer-to-peer direct connection. No account, no cloud upload, no file size gate. Gonc also includes a VPN mode for building an encrypted tunnel between your own devices.
Usage Demo
Features
- Send files and folders directly - Share multiple files or whole directories between desktop and Android.
- No accounts - A shared passphrase is enough to connect both sides.
- Nearby devices - On the same network, pick a device and send. Pair once by comparing a six-digit number; later transfers only need the recipient to accept.
- End-to-end encrypted - Traffic is protected by TLS 1.3. The TLS certificates are automatically derived from the shared passphrase and mutual authentication is mandatory, so no CA certificate is required and man-in-the-middle eavesdropping or tampering is prevented.
- True P2P when connected - A successful transfer uses a real peer-to-peer connection. Gonc does not provide an official relay service by default.
- Reliable receive mode - Browse the remote file list, download everything or selected paths, and resume interrupted downloads with BLAKE3 block repair.
- Android and desktop UI - The same workflow is available on Windows and Android.
- Easy VPN deployment - Run
gonc -p2p <passphrase> -linkagenton many device architectures, then connect remotely from the desktop or Android VPN client. - IPv4 and IPv6 aware - VPN mode supports IPv6 routing checks and DNS leak protection options on Windows.
Download
Download the latest build from GitHub Releases.
Release packages are named like:
| Platform | Package |
|---|---|
| Windows x64 | gonc-gui-<version>-windows-amd64.zip |
| Windows arm64 | gonc-gui-<version>-windows-arm64.zip |
| Linux x64 | gonc-gui-<version>-linux-amd64.tar.gz |
| Linux arm64 | gonc-gui-<version>-linux-arm64.tar.gz |
| Android arm64 | gonc-gui-<version>-android-arm64.apk |
On Windows, keep gonc-gui.exe and wintun.dll in the same folder when using
VPN features.
How It Works
- The sender chooses files or folders and starts sharing.
- Gonc generates or accepts a passphrase.
- The receiver enters or scans the same passphrase.
- Both sides exchange encrypted connection information over public MQTT signaling servers.
- Gonc tries NAT traversal and starts the transfer after a real P2P connection is established.
The signaling server is only used to help both peers meet. It cannot see the passphrase and cannot decrypt the exchanged network information.
If both peers are behind restrictive IPv4 NATs, NAT traversal may fail. In that case, use a SOCKS5 proxy server as a relay path.
NAT Traversal Support
If both peers have IPv6 connectivity, direct P2P connection is usually the easiest case.
For IPv4, NAT traversal behavior depends on the NAT type on each side:
| Type | NAT type | P2P traversal difficulty |
|---|---|---|
| 1 | Full Cone NAT | Easiest |
| 2 | Restricted Cone NAT | Easy |
| 3 | Port Restricted Cone NAT | Medium |
| 4 | Symmetric NAT | Hardest |
Gonc's expected IPv4 traversal support:
| Peer A NAT | Peer B NAT | Expected result |
|---|---|---|
| Type 1 | Type 1, 2, 3, or 4 | Works with TCP and UDP |
| Type 2 | Type 2, 3, or 4 | Works with TCP and UDP |
| Type 3 | Type 3 or 4 | Works with UDP |
| Type 4 | Type 4 | Does not work directly; connect through a user-provided SOCKS5 proxy server that supports UDP ASSOCIATE |
Nearby (Same Network)
The Nearby page lists Gonc devices on the same local network. No passphrase is needed.
- Open Nearby on both devices. (From Send Files or Receive Files, use the Send to nearby devices link or the Receive from Nearby button.) A device can be found only while its Nearby page is open; the banner at the top shows the name others see it as.
- Add files, folders, text or clipboard content.
- On the other device's card, choose how to send:
- Pair & send shows the same six-digit number on both devices. Confirm on both if they match. The devices stay paired, and later transfers to a paired device skip this step.
- Send (unpaired devices only) sends without comparing numbers. Use it for files that are fine for anyone on the network to see: nothing proves who the other device is, and the devices do not become paired.
- The recipient sees the sender's name and the file list and clicks
Accept. A request from an unpaired device is marked Not paired.
Files are saved to the folder shown under This device; an existing file
is never overwritten (a copy is saved as
name (1).ext). To receive only from paired devices, turn off Accept files from unpaired devices under This device.
Nearby transfers go directly between the two devices over TLS 1.3 and never contact the MQTT or STUN servers, so they also work on a network with no internet access. Devices find each other with multicast on UDP port 19731 and accept connections on TCP port 19732. Gonc sends discovery traffic only while the Nearby page is open; on other pages it stays quiet on the network, and transfers already running carry on. A device whose firewall blocks incoming connections still works: every announcement asks nearby devices to reply, and when a direct connection is not answered, both devices meet the way passphrase LAN mode does, by multicasting to each other and dialing each other at the same time. The Activity log (bottom right) shows which path was used. Where the other device is not listed (some guest or office Wi-Fi blocks multicast, or the devices are on different networks), use Send Files and Receive Files with a passphrase instead.
Advertisements carry a value that changes over time instead of a fixed device ID, so the device cannot be tracked across networks; the device name is still visible to others on the same network. Turn off Visible to nearby devices to stop advertising. Pairing keys are encrypted with Windows DPAPI; on macOS and Linux they are currently stored in a file readable only by the current user.
Send Files
Desktop send-content capabilities:
| Content source | Windows desktop | macOS/Linux desktop |
|---|---|---|
| File | Supported | Supported |
| Folder | Supported | Supported |
| Authored text | Supported | Supported |
| Clipboard text | Supported | Supported |
| Native clipboard files | Supported | Unsupported; the app shows an explicit unsupported message when no readable clipboard text is available |
| Native clipboard image | Supported (saved as a generated PNG) | Unsupported; the app shows an explicit unsupported message when no readable clipboard text is available |
The single Add button opens a four-option picker for File, Folder, Text, and Clipboard. Files and folders can also be added by drag and drop. Each list row has its own remove control, and Clear all empties the whole list. Changes made while a send session is running are synchronized with the receiver, including an empty list after the receiver refreshes.
- Open Send Files.
- Add the content to share.
- Use the generated passphrase, or enter your own strong passphrase.
- Share the passphrase or QR code with the receiver through a trusted channel.
- Keep the sender running until the receiver finishes.
Receive Files
- Open Receive Files.
- Enter or scan the sender passphrase.
- Choose the save folder.
- Connect, browse the remote directory, then download selected files or the current folder.
Resume mode validates local blocks with a BLAKE3 manifest before reusing them. For interrupted downloads, Gonc resumes from the last verified complete block instead of blindly trusting the local file size.
After a received file exists as a readable regular file and its size matches the current remote listing, the receive list marks it as locally available. This is a convenience check, not a content-integrity guarantee. On desktop, the row's locate button reveals the file in Explorer, Finder, or the platform file manager; Gonc does not open received files directly on desktop.
On Android, locally available files can be opened, opened with another app, shared, or inspected from the current receive session. These actions are not saved as download history across app launches. Opening an APK hands it to Android's package installer, which controls unknown-source authorization and installation confirmation; Gonc does not install packages silently.
VPN Tunnel
Gonc can also run a VPN tunnel between devices. Deploying the server is meant to be simple: on a remote device, run:
gonc -p2p <passphrase> -linkagent
Then connect to it from the desktop or Android VPN client.
- VPN Server runs a
linkagentendpoint and can expose this device as the traffic exit. - VPN Client connects to the server and can start a system VPN interface.
- Profiles can be saved and shared by QR code.
- Advanced options include DNS servers, route CIDRs, MTU, route metric, upstream
proxy, tunnel-only mode, and extra
goncarguments.
On Windows, VPN client mode may request administrator permission so it can configure routes and DNS protection.
Privacy And Security
- Gonc does not require user accounts.
- File data is transferred only after the TLS 1.3 secure connection is established. Even when a SOCKS5 server is used as a relay path, it only sees TLS-encrypted traffic and cannot read or tamper with file contents.
- The shared passphrase is the connection secret. Anyone who has it can connect and receive your shared files, so use the randomly generated high-strength passphrase each time and do not reuse passphrases that have already been shared.
- Gonc derives the TLS certificates from the passphrase and requires mutual authentication, so no CA certificate is required.
- Gonc uses public third-party STUN servers to discover NAT addresses and public MQTT servers for signaling. Peers meet on MQTT using a passphrase-derived hash, and network addresses are exchanged as AES-GCM encrypted data derived from the passphrase. MQTT servers cannot see the passphrase or decrypt the exchanged addresses.
- File repair uses BLAKE3 block hashes to avoid trusting stale local data.
Public servers used for STUN and signaling:
STUN:
tcp://turn.cloudflare.com:80
udp://turn.cloudflare.com:53
udp://stun.l.google.com:19302
stun.gonc.cc:3478
global.turn.twilio.com:3478
stun.nextcloud.com:443
MQTT:
tcp://broker.hivemq.com:1883
tcp://broker.emqx.io:1883
tcp://test.mosquitto.org:1883
tcp://mqtt.gonc.cc:1883
Troubleshooting
Windows App Does Not Open
Gonc uses Microsoft Edge WebView2 through Wails. If the app does not open, install or repair the Microsoft Edge WebView2 Runtime.
Android VPN Stops In The Background
Android may restrict long-running background work. Allow Gonc to ignore battery optimization or set the app battery mode to unrestricted.
Transfer Cannot Connect
- Make sure both sides use the exact same passphrase.
- If both sides are behind type 4 / Symmetric NAT, configure your own SOCKS5 proxy server with UDP ASSOCIATE support so Gonc can use it as the relay path.
Development
The desktop app is built with Wails and embeds the gonetcat Go engine.
Android's mobilegonc.aar binds this repository's android/mobilegonc and
android/nearbygo packages against the gonc version pinned in go.mod.
VPN packet forwarding
The desktop VPN and Android's mobilegonc binding use the FlowRelay version
pinned in go.mod. Both pass the SOCKS5 endpoint reported by gonc to
internal/tunengine. Windows opens the TUN through Wintun. Android's
VpnService keeps its original descriptor and lends it to FlowRelay, which
duplicates it during startup and closes its copy on failure or shutdown.
For TCP, gonc-gui waits for the SOCKS5 CONNECT reply before acknowledging the guest's connection. Connecting to the proxy has a 5-second timeout, followed by a 21-second SOCKS5 handshake timeout. Failed SYNs are cached for 30 seconds with a 4096-entry limit. The app rejects IPv6 TCP and UDP locally when IPv6 routes are configured and the exit probe fails. A tunnel reconnection triggers another probe.
The VPN configures a 15-second idle timeout for established UDP flows to destination port 53. Other ports use 60 seconds. Traffic forwarded in either direction restarts the idle timer.
With device-error reporting enabled, a terminal TUN failure prompts you to disconnect and reconnect manually. The app keeps its VPN routes until you stop it. At the default warning level, the first forwarding error of each class is logged immediately and repeats are counted over ten seconds. An IPv4 ping may be answered locally. To check the exit, use a connection through the proxy, as the IPv6 probe does.
The Android VPN service calls Mobilegonc.startFlowRelayWithListener with
deferred TCP handshakes enabled and local IPv6 rejection set by the exit probe.
In the Go binding, StartFlowRelayWithPolicy exposes the same two settings.
The five-argument StartFlowRelay uses early TCP handshakes and leaves local
IPv6 rejection disabled. External AAR clients must update their VPN method
calls to the new FlowRelay names when upgrading. The APK build packages the
checked-in mobilegonc.aar. Run the AAR update script when the bindings or
their Go dependencies change.
The project, local CLI and GitHub workflow use Wails v2.17.1. For a manual
desktop build, set GOWORK=off and use wails build with the desired platform
and the gonc_noexec tag (plus webkit2_41 on Linux). No embed-scanner bypass or placeholder script
is needed. Wails generates bindings, frontend assets, app icons and platform
manifests normally, including on a fresh checkout. Prefer the supplied build
scripts.
Every gonc-gui build, desktop and Android, uses the gonc_noexec build tag.
It disables gonc's shell server (:sh, -shellagent), shell client
(-shell), raw terminal mode (-pty), external command execution (-e),
and daemon mode (-daemon). The supplied scripts and the release workflow
pass the tag. A build
without it stops with undefined: build_gonc_gui_with_tags_gonc_noexec, so
pass it to your own commands too, for example wails dev -tags gonc_noexec or
go test -tags gonc_noexec ./....
Rebuild the Android Go bridge from the gonc-gui repository root:
android\update-mobilegonc-aar.bat
Build on Windows
Prerequisites (the same tools the GitHub release workflow uses):
- Go, at the version in
go.mod - Node.js with npm (the release workflow uses Node.js 24)
- Wails CLI v2.17.1
- Microsoft Edge WebView2 Runtime, to run the app
Install the Wails CLI, and make sure GOBIN (by default GOPATH\bin) is on
PATH:
go install github.com/wailsapp/wails/v2/cmd/wails@v2.17.1
From the project root, build:
The script sets GOPROXY=https://goproxy.cn,direct, installs the frontend
dependencies, runs wails build -platform windows/amd64, and copies the
required Wintun DLL. Pass arm64 to build for Windows arm64. Outputs:
build\bin\gonc-gui.exe
build\bin\wintun.dll
Keep wintun.dll next to gonc-gui.exe when you distribute it.
Plain go build is not equivalent to this build. It does not run the Wails
frontend build or generate the Windows resources. During wails build, Wails
writes a temporary gonc-gui-res.syso with the app icon and Windows manifest,
links it in, and deletes it afterwards, so finding no .syso in the repository
is normal, and separate rsrc or windres tools are not needed. A plain
go build (which also needs the desktop,production,gonc_noexec tags and an
already-built frontend\dist) produces an exe without the icon and manifest:
fine for diagnostics, but not a release build.
Create release packages (Windows amd64 and arm64 zips plus the Android APK,
in dist\):
Project Layout
gonc-gui/
app.go Wails backend methods exposed to the frontend
frontend/ Desktop React UI
internal/goncrunner/ Embedded gonc session runner
internal/httpdownload/ Desktop HTTP receive downloader
internal/nearby/ Nearby discovery, pairing, and transfer protocol
internal/nearbyapp/ Nearby service shared by desktop and Android
internal/tunengine/ FlowRelay adapter for desktop and Android VPN sessions
android/ Android app
android/mobilegonc/ Go bindings for passphrase transfers and VPN
android/nearbygo/ Go bindings for Android Nearby
android/internal/mobilefilesource/
Shared Android file source adapter
android/update-mobilegonc-aar.bat
Rebuild the Android mobilegonc.aar
License
See LICENSE.


