server: /metrics endpoint + signaling stub for v0.3 WebRTC

- Add Prometheus counters/gauges/histograms: messages_total{source},
  message_bytes_total, active_subscribers, publish_duration_seconds.
- Add /api/signal/<room> mailbox endpoint (POST adds, GET drains).
  Currently scaffolding for WebRTC SDP/ICE exchange — peers do not
  use it yet; client-side WebRTC negotiation is roadmap.

client: structured default label

Use "<GOOS>-sse-<role>" (e.g., windows-sse-listener) instead of the
old "linux-client" fallback. -label still overrides.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Claude Opus 4.7
2026-05-21 00:30:37 -05:00
parent 24854e44d6
commit 80539ae60c
4 changed files with 302 additions and 14 deletions

View File

@@ -12,12 +12,20 @@ import (
"log"
"net/http"
"os"
"runtime"
"strings"
"time"
"github.com/atotto/clipboard"
)
// defaultLabel returns "{platform}-{transport}-{role}" so the server can
// tell at a glance who's connecting. Transport is "sse" today; "rtc" once
// WebRTC lands (v0.3 roadmap).
func defaultLabel(role string) string {
return fmt.Sprintf("%s-sse-%s", runtime.GOOS, role)
}
var (
noClipboard bool
myLabel string
@@ -31,10 +39,18 @@ type Message struct {
func main() {
server := flag.String("server", "https://tether.pecord.io", "tether-server base URL")
label := flag.String("label", "linux-client", "X-Tether-Client label")
label := flag.String("label", "", "X-Tether-Client label (default: <os>-sse-<role>)")
sendText := flag.String("send", "", "send this text and exit (otherwise listen)")
flag.BoolVar(&noClipboard, "no-clipboard", false, "don't write incoming messages to the OS clipboard")
flag.Parse()
if *label == "" {
if *sendText != "" {
*label = defaultLabel("sender")
} else {
*label = defaultLabel("listener")
}
}
myLabel = *label
if *sendText != "" {