Add "share status" command and a relay-piped fallback for cross-network peers
status: swarm.Client.Status()/RoomStatus/FileStatus report per-room peer count and per-file chunk progress; daemon gets a "status" control action; CLI gets "share status" to display it. Relay fallback: peers advertising a LAN-only address can't be dialed directly by peers on a different network. connectToPeer now races a direct dial against a relay-piped connection (both sides derive the same pairing key from their two IDs, independent of who arrives first) and uses whichever succeeds. The relay grows a second, on-demand path alongside room membership: a "pipe" request pairs two connections on a key and forwards raw bytes between them from then on, same as the original relay's behavior before the rendezvous-only redesign, just now triggered per-pair only when direct connection fails.
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package daemon
|
||||
|
||||
import "github.com/tzgyn/share/src/swarm"
|
||||
|
||||
// request/response are the only vocabulary spoken over the control
|
||||
// socket between a CLI invocation and the background daemon.
|
||||
type request struct {
|
||||
Action string `json:"action"` // "join" or "stop"
|
||||
Action string `json:"action"` // "join", "stop", or "status"
|
||||
Join *joinRequest `json:"join,omitempty"`
|
||||
}
|
||||
|
||||
@@ -20,6 +22,7 @@ type joinRequest struct {
|
||||
}
|
||||
|
||||
type response struct {
|
||||
OK bool `json:"ok"`
|
||||
Error string `json:"error,omitempty"`
|
||||
OK bool `json:"ok"`
|
||||
Error string `json:"error,omitempty"`
|
||||
Rooms []swarm.RoomStatus `json:"rooms,omitempty"` // "status" only
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user