Add UDP support to serve and forward

Aperta
#122 0 commenti 7 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go
Ambito
cli, networking

Direzione di ricerca

Inizia con i percorsi CLI esistenti di serve e forward, quindi leggi Server.OnUDP, ServedUDPPorts, Client.DialUDPPort, ProxyPacketConns e udpForwardTo. Conferma la sintassi dei comandi e la scelta del loopback prima di implementare; il lavoro è completo quando le forme UDP proposte di serve e forward fanno da proxy al traffico, incluso il caso mosh su IPv6.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I wanted to run mosh through tailcat (over a DERP-relayed connection the typing lag is noticeable, and mosh's local echo fixes that), and found there's no way to get UDP to a served port from the CLI. The library has it all (Server.OnUDP, ServedUDPPorts, Client.DialUDPPort, ProxyPacketConns), and d0d599161 wired it up for exit nodes, but serve <ports> only ever sets OnTCP, and forward only listens on TCP. socks can dial UDP but mosh-client doesn't speak SOCKS.

Proposal:

tailcat serve --udp=60000-60010 no-auth-ssh      # proxy those UDP ports to loopback
tailcat forward <tc-addr> udp:60001              # local udp 60001 -> server udp 60001
tailcat forward <tc-addr> udp:16001:60001

Server side is tiny. It gates on the port set and calls the existing udpForwardTo, plus sets ServedUDPPorts. Client side is a UDP listener that opens one DialUDPPort flow per local source address and reaps idle ones. I have this working and can send a PR, but there are two things I'd want your call on first.

  • tailcat serve --udp=60000-60010 22,no-auth-ssh vs tailcat serve 22,udp:60000-60010,no-auth-ssh. The flag is less code. The inline form matches the udp: prefix on the client side.
  • Which loopback to proxy to. TCP dials localhost via localhostdns and falls back between 127.0.0.1 and ::1, but UDP can't fall back. The dial "succeeds" against whichever is first (Go picks ::1) and packets to a listener on the other one just vanish. I defaulted to 127.0.0.1 with a --udp-host override.

One thing to know for mosh specifically is that it only works over ::1. mosh sizes packets by address family, 1252 bytes over IPv4, which is over MaxUDPPayload (1232) and gets dropped, vs 1216 over IPv6, which fits. Keystrokes are small so an IPv4 setup looks like it works until the first big screen redraw stalls it. With mosh-server -i ::1, mosh-client ::1, and --udp-host=::1 it's fine.

Lingua principale
Go
Stelle
8.8k
Fork
404
Merge medio
3h 48m
PR unite (30g)
1

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tailscale/tailcat

Tutte le issue di tailscale/tailcat

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.