V2RayConfigBuilder.empty constructor

V2RayConfigBuilder.empty({
  1. int socksPort = 1080,
  2. String listen = '127.0.0.1',
})

Start with a local SOCKS inbound and no outbound servers.

Add at least one outbound before building the configuration.

Implementation

factory V2RayConfigBuilder.empty({
  int socksPort = 1080,
  String listen = '127.0.0.1',
}) {
  if (socksPort < 1 || socksPort > 65535) {
    throw RangeError.range(socksPort, 1, 65535, 'socksPort');
  }
  return V2RayConfigBuilder._({
    'log': {'loglevel': 'warning'},
    'inbounds': [
      {
        'tag': 'in_proxy',
        'listen': listen,
        'port': socksPort,
        'protocol': 'socks',
        'settings': {'auth': 'noauth', 'udp': true},
      }
    ],
    'outbounds': <Map<String, dynamic>>[],
    'routing': {
      'domainStrategy': 'AsIs',
      'rules': <Map<String, dynamic>>[],
    },
  });
}