buildVmessConfig static method
Build a minimal VMess JSON config string.
Implementation
static String buildVmessConfig({
required String address,
required int port,
required String uuid,
int alterId = 0,
String network = 'tcp',
String security = 'tls',
String? serverName,
String? path,
}) {
return jsonEncode({
'log': {'loglevel': 'warning'},
'inbounds': [
{
'port': 10808,
'protocol': 'socks',
'settings': {'auth': 'noauth'},
},
],
'outbounds': [
{
'protocol': 'vmess',
'settings': {
'vnext': [
{
'address': address,
'port': port,
'users': [
{
'id': uuid,
'alterId': alterId,
'security': 'auto',
},
],
},
],
},
'streamSettings': {
'network': network,
if (network == 'ws') 'wsSettings': {'path': path ?? '/'},
'security': security,
if (security == 'tls')
'tlsSettings': {
'serverName': serverName ?? address,
'allowInsecure': false,
},
},
},
],
});
}