Feature: transfer a Go-managed host to the MFC master from the web console
A Go-managed host cannot receive the client upgrade that only the MFC master can push. Transfer moves its main link there and brings it back after N days; MFC has no reason to return it. Transfer is not share: ASSIGN writes the target and drops the current connection, so the old master sees the host go offline and the new master gets a normal main link it can remote control and upgrade. While a transfer is live the client refuses a second transfer and any share, so no host is handed to a third master that expiry would orphan. Server: admin-only `transfer_device` WS command, COMMAND_ASSIGN_MASTER + SHARE_TYPE_YAMA_FOREVER as `host:port:days::transport\0`, byte-compatible with the MFC dialog. The transport segment is always present (YAMA_TRANSFER_TRANSPORT, default 0/TCP) because clients keep their current link when it is missing: a WSS-managed host would otherwise retry WSS against the MFC master's raw TCP port and never connect. The empty shine segment keeps the host's header encryption. The button only renders when `device_list.transfer` is present, which MFC never sends, so no MFC change is needed. devicehistory keeps transfer_to/transfer_until for the card badge and drops the marker on expiry or on a fresh login here. Client: KernelManager.cpp writes the registry and disconnects; ClientDll.cpp re-reads the registry at the top of every reconnect, so a mid-session transfer lands on the next round. Expiry is checked before every connect attempt as well as inside the heartbeat loop, so an unreachable target cannot pin the host to an expired address until a restart; restoring rebuilds the link captured on entry (address, header encryption, transport). linux/main.cpp applies the transfer on the main loop and restores the captured endpoint at expiry; Android does the same; macOS has neither share nor transfer.
This commit is contained in:
1 parent
b466f568ab
commit
63c7cdf588
18 files changed
+1024
-177
No files matched your search
@@ -181,6 +181,16 @@ type wsHub struct {
|
||||
loginIPLimit *wsauth.RateLimiter
|
||||
loginUserLimit *wsauth.RateLimiter
|
||||
trustForwardedFor bool // honor X-Forwarded-For (only when behind a trusted proxy)
|
||||
|
||||
// transferTarget / transferDays pre-fill the "transfer host" dialog and,
|
||||
// by being reported to the browser, tell the shared page that this backend
|
||||
// implements COMMAND_ASSIGN_MASTER at all (see withTransferDefaults).
|
||||
// transferTransport is the link the transferred host uses to reach the
|
||||
// target (protocol.TransferTransport*); it is sent in the command because
|
||||
// the clients keep their current link when it is missing.
|
||||
transferTarget string
|
||||
transferDays float64
|
||||
transferTransport int
|
||||
}
|
||||
|
||||
func newWSHub(auth *wsauth.Authenticator, devices *hub.Hub, history *devicehistory.Store, log *logger.Logger) *wsHub {
|
||||
@@ -227,6 +237,22 @@ func (h *wsHub) withDeviceACL(acl *DeviceACL) *wsHub {
|
||||
return h
|
||||
}
|
||||
|
||||
// withTransferDefaults installs the pre-filled target/days and the link type
|
||||
// (protocol.TransferTransport*) for the web UI's "transfer host" dialog. An
|
||||
// empty target still enables the feature: the operator types the address in
|
||||
// the dialog. The front-end keys the button's visibility off this being
|
||||
// reported at all, so the shared page shows no transfer button on the MFC
|
||||
// server (which never reports it).
|
||||
func (h *wsHub) withTransferDefaults(target string, days float64, transport int) *wsHub {
|
||||
h.transferTarget = target
|
||||
if days <= 0 {
|
||||
days = 1 // one day is enough for an upgrade round-trip
|
||||
}
|
||||
h.transferDays = days
|
||||
h.transferTransport = transport
|
||||
return h
|
||||
}
|
||||
|
||||
// isSuperAdmin reports whether this session is the built-in admin account
|
||||
// (username "admin" + role admin). Other admin-role users — local accounts
|
||||
// created in the user panel or portal admins bridged by SSO — are device-
|
||||
|
||||
Reference in new issue
Block a user