mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-24 01:11:29 +02:00
Relocate WorkerICE (renamed worker.ICE) and WorkerRelay plus ConnPriority into client/internal/peer/worker. To break the peer<->worker cycle the workers no longer take *Conn or ConnConfig: callbacks are passed as plain functions (Conn's unexported methods as method values), and each worker receives only the fields it needs (key, ICE config, isController) plus a small services struct. Context is passed to OnNewOffer instead of stored. Move the worker connection-status helper the other way, out of the worker package into peer as worker_status.go (WorkerStatus / AtomicWorkerStatus), since only Conn uses it.
15 lines
801 B
Go
15 lines
801 B
Go
package peer
|
|
|
|
// connStatusInputs is the primitive-valued snapshot of the state that drives the
|
|
// tri-state connection classification. Extracted so the decision logic can be unit-tested
|
|
// without constructing full Worker/Handshaker objects.
|
|
type connStatusInputs struct {
|
|
forceRelay bool // NB_FORCE_RELAY or JS/WASM
|
|
peerUsesRelay bool // remote peer advertises relay support AND local has relay
|
|
relayConnected bool // statusRelay reports Connected (independent of whether peer uses relay)
|
|
remoteSupportsICE bool // remote peer sent ICE credentials
|
|
iceWorkerCreated bool // local ICE worker exists (false in force-relay mode)
|
|
iceStatusConnecting bool // statusICE is anything other than Disconnected
|
|
iceInProgress bool // a negotiation is currently in flight
|
|
}
|