create static method

Future<SOCKSSocket> create({
  1. required String proxyHost,
  2. required int proxyPort,
  3. bool sslEnabled = false,
})

Creates a SOCKS5 socket to the specified proxyHost and proxyPort.

This method is a factory constructor that returns a Future that resolves to a SOCKSSocket instance.

Parameters:

  • proxyHost: The host of the SOCKS5 proxy server.
  • proxyPort: The port of the SOCKS5 proxy server.

Returns: A Future that resolves to a SOCKSSocket instance.

Implementation

static Future<SOCKSSocket> create(
    {required String proxyHost,
    required int proxyPort,
    bool sslEnabled = false}) async {
  // Create a SOCKS socket instance.
  var instance = SOCKSSocket._(proxyHost, proxyPort, sslEnabled);

  // Initialize the SOCKS socket.
  await instance._init();

  // Return the SOCKS socket instance.
  return instance;
}