addOutbound method
Append an Xray outbound (VLESS, VMess, direct, blackhole, etc.).
Its tag must be unique. The first outbound remains the default.
Implementation
V2RayConfigBuilder addOutbound(Map<String, dynamic> outbound,
{String? tag}) {
final copy = _cloneMap(outbound);
if (tag != null) copy['tag'] = tag;
final effectiveTag = copy['tag'];
if (effectiveTag is! String || effectiveTag.trim().isEmpty) {
throw ArgumentError('Every outbound needs a nonempty tag');
}
if (outboundTags.contains(effectiveTag)) {
throw ArgumentError('Duplicate outbound tag: $effectiveTag');
}
if (copy['protocol'] is! String) {
throw ArgumentError('Outbound needs a protocol');
}
_listSection('outbounds').add(copy);
return this;
}