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:
1 parent
021da93229
commit
79828e3f8a
11 files changed
+72
-25
No files matched your search
@@ -45,6 +45,7 @@ func (s *Server) handlePoll(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
// The agent sends its version and OS user occasionally; record them when
|
||||
// present. Agents older than 0.0.2 send no user, so keep what we have.
|
||||
s.viaDirectA.Store(a.ID, s.viaDirect(r))
|
||||
v := r.Header.Get("X-Agent-Version")
|
||||
u := firstNonEmpty(r.Header.Get("X-Agent-User"), a.RunUser)
|
||||
if v != "" && (v != a.Version || u != a.RunUser) {
|
||||
@@ -69,6 +70,7 @@ func (s *Server) setTunnelHeader(w http.ResponseWriter) {
|
||||
}
|
||||
if d := s.db.DirectAddress(); d != "" {
|
||||
w.Header().Set(proto.FallbackHeader, d)
|
||||
w.Header().Set(proto.MainHeader, s.db.HostAddress())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user