DanivosYoun 855b2b272f fix(websocket): detect dead/half-open control connection (read deadline + protocol ping)
The control websocket had no read deadline and only sent application-level
"newt/ping" JSON (never protocol PING frames), so a half-open connection — for
example a cloud load balancer keeping the socket open after the backend API
server restarted — was never detected. ReadMessage blocked forever while the
buffered ping writes kept succeeding, so newt stayed "connected" to a dead peer
and only recovered after a manual restart.

- Arm a read deadline (pongWait = 2x pingInterval, min 20s) and refresh it on
  every pong and every inbound message.
- Send a protocol-level PING alongside the existing app ping, so a compliant
  server replies with a PONG that refreshes the read deadline.
- On ping-write failure, close the connection and let the read pump perform a
  single reconnect (previously sendPing and the read-pump defer could both
  trigger a reconnect, racing two connections).
- Give each connection a lifecycle channel so its ping monitor stops when the
  connection ends (previously one ping-monitor goroutine leaked per reconnect).
2026-06-22 11:51:03 +09:00
2026-06-04 11:29:09 -07:00
2026-06-05 17:09:58 -07:00
2026-05-28 15:40:22 -07:00
2025-12-08 12:17:11 -05:00
2025-11-17 13:49:43 -05:00
2025-12-03 20:49:46 -05:00
2026-04-24 10:39:44 -07:00
2026-05-28 15:38:09 -07:00
2025-07-28 12:02:10 -07:00
2026-06-04 11:47:49 -07:00
2025-12-22 14:31:44 -05:00
2025-01-04 21:22:32 -05:00
2026-02-16 17:54:19 -08:00
2025-08-28 17:32:27 +02:00
2026-06-05 17:09:58 -07:00
2026-05-28 15:40:22 -07:00
2025-10-19 15:12:15 -07:00
2026-02-16 17:54:19 -08:00
2026-05-28 15:38:09 -07:00
2025-01-07 20:51:33 -05:00
2026-06-04 11:51:40 -07:00
2026-05-11 10:34:30 -07:00
2025-01-04 21:22:32 -05:00
2026-06-09 20:50:02 -07:00
2026-05-28 15:38:46 -07:00
2026-02-25 14:57:32 -08:00
2025-12-10 16:24:22 -05:00
2026-05-28 15:38:09 -07:00
2026-05-28 15:38:09 -07:00
2025-10-19 15:12:15 -07:00
2025-12-10 15:32:49 -05:00
2026-06-04 16:57:51 -07:00
2025-11-26 17:57:27 -05:00
2025-03-07 12:35:46 -05:00

Newt

PkgGoDev GitHub License Go Report Card

Newt is a fully user space WireGuard tunnel client and TCP/UDP proxy, designed to securely expose private resources controlled by Pangolin. By using Newt, you don't need to manage complex WireGuard tunnels and NATing.

Installation and Documentation

Newt is used with Pangolin and Gerbil as part of the larger system. See documentation below:

Key Functions

Registers with Pangolin

Using the Newt ID and a secret, the client will make HTTP requests to Pangolin to receive a session token. Using that token, it will connect to a websocket and maintain that connection. Control messages will be sent over the websocket.

Receives WireGuard Control Messages

When Newt receives WireGuard control messages, it will use the information encoded (endpoint, public key) to bring up a WireGuard tunnel using netstack fully in user space. It will ping over the tunnel to ensure the peer on the Gerbil side is brought up.

Receives Proxy Control Messages

When Newt receives WireGuard control messages, it will use the information encoded to create a local low level TCP and UDP proxies attached to the virtual tunnel in order to relay traffic to programmed targets.

Build

Binary

Make sure to have Go 1.25 installed.

make

Nix Flake

nix build

Binary will be at ./result/bin/newt

Development shell available with nix develop

Licensing

Newt is dual licensed under the AGPLv3 and the Fossorial Commercial license. For inquiries about commercial licensing, please contact us.

Contributions

Please see CONTRIBUTIONS in the repository for guidelines and best practices.

Languages
Go 93.5%
Shell 3.8%
Python 1%
Inno Setup 0.7%
Makefile 0.6%
Other 0.4%