mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-16 11:39:57 +00: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.
30 lines
435 B
Go
30 lines
435 B
Go
package worker
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
const (
|
|
None ConnPriority = 0
|
|
Relay ConnPriority = 1
|
|
ICETurn ConnPriority = 2
|
|
ICEP2P ConnPriority = 3
|
|
)
|
|
|
|
type ConnPriority int
|
|
|
|
func (cp ConnPriority) String() string {
|
|
switch cp {
|
|
case None:
|
|
return "None"
|
|
case Relay:
|
|
return "PriorityRelay"
|
|
case ICETurn:
|
|
return "PriorityICETurn"
|
|
case ICEP2P:
|
|
return "PriorityICEP2P"
|
|
default:
|
|
return fmt.Sprintf("ConnPriority(%d)", cp)
|
|
}
|
|
}
|