discoverBehavior method
Discovers the current NAT behavior
Implementation
Future<NatBehavior> discoverBehavior() async {
final behavior = await stunClientPool.discoverNatBehavior();
// Check if behavior has changed
if (_behaviorHasChanged(behavior)) {
final oldBehavior = _currentBehavior;
_currentBehavior = behavior;
// Add to history
final record = NatBehaviorRecord(behavior: behavior);
_behaviorHistory.add(record);
// Limit history size
while (_behaviorHistory.length > maxHistorySize) {
_behaviorHistory.removeAt(0);
}
// Save to storage
await _saveToStorage();
// Notify callbacks
_notifyCallbacks(oldBehavior, behavior);
}
return behavior;
}