replaceOutbound method

V2RayConfigBuilder replaceOutbound(
  1. String tag,
  2. Map<String, dynamic> outbound
)

Edit a named outbound while preserving the other outbounds.

Implementation

V2RayConfigBuilder replaceOutbound(
    String tag, Map<String, dynamic> outbound) {
  final items = _listSection('outbounds');
  final index = items.indexWhere(
      (item) => item is Map && item['tag'] == tag);
  if (index < 0) throw ArgumentError('Unknown outbound tag: $tag');
  final copy = _cloneMap(outbound);
  copy['tag'] = tag;
  items[index] = copy;
  return this;
}