buildShadowsocksConfig static method

String buildShadowsocksConfig({
  1. required String address,
  2. required int port,
  3. required String password,
  4. String method = 'aes-256-gcm',
})

Build a Shadowsocks JSON config string.

Implementation

static String buildShadowsocksConfig({
  required String address,
  required int port,
  required String password,
  String method = 'aes-256-gcm',
}) {
  return jsonEncode({
    'log': {'loglevel': 'warning'},
    'inbounds': [
      {
        'port': 10808,
        'protocol': 'socks',
        'settings': {'auth': 'noauth'},
      },
    ],
    'outbounds': [
      {
        'protocol': 'shadowsocks',
        'settings': {
          'servers': [
            {
              'address': address,
              'port': port,
              'method': method,
              'password': password,
            },
          ],
        },
      },
    ],
  });
}