feat: installer fetched from the direct address sets it as the agent's own with the main one as fallback (and downloads from it); agents fall back to whichever address is not theirs; (direct) beside the connection status

This commit is contained in:
redtea committed 2026-10-15 11:34:58 +03:00
1 parent 021da93229
commit 79828e3f8a
11 files changed
+72 -25

No files matched your search

+2 -1
View File
@@ -84,6 +84,7 @@ func (s *Server) handleAgentWS(w http.ResponseWriter, r *http.Request) {
if err != nil {
return
}
s.viaDirectA.Store(a.ID, s.viaDirect(r))
conn.SetReadLimit(4 << 20)
ctx, cancel := context.WithCancel(r.Context())
defer cancel()
@@ -97,7 +98,7 @@ func (s *Server) handleAgentWS(w http.ResponseWriter, r *http.Request) {
return wsjson.Write(wctx, conn, m)
}
cfg := func() proto.WSMsg {
return proto.WSMsg{T: "cfg", Tunnel: s.tunnelAdvert(), Transport: s.transportOf(a.ID), Fallback: s.db.DirectAddress()}
return proto.WSMsg{T: "cfg", Tunnel: s.tunnelAdvert(), Transport: s.transportOf(a.ID), Fallback: s.db.DirectAddress(), Main: s.db.HostAddress()}
}
if send(cfg()) != nil {
return