22
33This file provides guidance to WARP (warp.dev) when working with code in this repository.
44
5- ** Last updated** : v0.8.0 (commit 12564c16a0f725e447aa2880e57b30ff282dc112 )
5+ ** Last updated** : v0.9.1 (commit 4f8ad47cb134b65e5bacc469c907906f9a095094 )
66
77## Project Overview
88
@@ -71,11 +71,14 @@ go test -v -cover ./...
7171- Implements tabular display of peers with proper formatting and alignment
7272
7373** Network Layer (` tsnet/ ` )**
74- - ` Server ` : Core networking component handling multicast UDP discovery
74+ - ` Server ` : Core networking component handling multicast UDP discovery and direct peer communication
7575- Peer discovery via multicast broadcasts (default 239.255.116.115:29556)
7676- Interface detection to find the correct network interface for multicast
7777- Automatic peer cleanup based on configurable timeout (10s default)
7878- Uses epoch-based messaging to detect and handle duplicate instances
79+ - Single shared UDP socket (` dualUDPSock ` ) for both multicast/broadcast sending and unicast peer-to-peer communication
80+ - Multicast loopback enabled for Windows compatibility (processes can see their own broadcasts)
81+ - Connection state tracking per peer without creating separate sockets
7982
8083** Cryptographic Identity (` tcrypto/ ` )**
8184- Ed25519-based identity system for peer authentication
@@ -108,13 +111,20 @@ go test -v -cover ./...
108111- Automatic interface detection by testing connectivity to 8.8.8.8:53
109112- Enhanced interface debugging for troubleshooting network issues
110113
114+ ** Direct Connection Protocol** :
115+ - Format: ` "connect1 %q %q" ` (requester_name, target_name)
116+ - Uses the same socket as discovery for unicast communication
117+ - Connection state tracked in ` connections ` map without per-peer sockets
118+ - Efficient resource usage by reusing ` dualUDPSock ` for all peer communication
119+
111120** Key Features** :
112- - Cross-platform multicast UDP networking
121+ - Cross-platform multicast UDP networking (with Windows loopback support)
113122- Automatic duplicate detection (same name/IP/key)
114123- Dynamic peer management with cleanup
115124- Terminal UI with real-time tabular peer display
116125- Interactive peer selection (keys 1-9 bind to discovered peers)
117126- Stable peer snapshot system for consistent UI display
127+ - Direct peer-to-peer communication without creating per-peer sockets
118128
119129### Data Flow
120130
@@ -131,6 +141,7 @@ go test -v -cover ./...
131141- ` fortio.org/log ` : Structured logging throughout
132142- ` fortio.org/terminal/ansipixels ` : Terminal UI and color management
133143- ` fortio.org/smap ` : Thread-safe map for peer storage with snapshot support
144+ - ` golang.org/x/net/ipv4 ` : IPv4 multicast control (for loopback configuration)
134145- Standard library: ` crypto/ed25519 ` , ` net ` for networking, ` slices ` for sorting
135146
136147## Coding Style Guidelines
@@ -165,9 +176,12 @@ This approach adds only 3 new lines instead of reformatting the entire struct.
165176
166177- The application is designed to work across Windows, macOS, and Linux
167178- Windows requires special interface detection due to WSL virtual interfaces
168- - All networking uses IPv4 UDP multicast
179+ - Windows requires multicast loopback to be explicitly enabled to see own broadcasts
180+ - All networking uses IPv4 UDP multicast and unicast
181+ - Single shared UDP socket for all communication reduces resource usage
169182- Cryptographic operations use Ed25519 for performance and security
170183- Terminal UI supports resize events and FPS-limited refresh with table-based layout
171184- Docker support available but multicast may not work in all environments
172185- Enhanced debugging available for interface detection and network troubleshooting
173186- Peer interaction system allows direct connection attempts via numbered keys
187+ - CI tests skip multicast tests on macOS and Windows due to unreliable multicast in CI environments
0 commit comments