socks5 0.1.2 copy "socks5: ^0.1.2" to clipboard
socks5: ^0.1.2 copied to clipboard

Simple SOCKS5 connection initializer using RawSocket, supports connection requests by Ip and Domain

socks #

A SOCKS5 connection handler

Example #

/// [SOCKSSocket] uses a raw socket to authorize 
/// and request a connection, connect to your socks proxy server
final sock = await RawSocket.connect(InternetAddress.loopbackIPv4, 9050);

/// pass the socket to [SOCKSSocket]
final proxy = SOCKSSocket(sock);

/// request the proxy to connect to a host
/// this call will throw exceptions if connection attempt fails from the proxy
await proxy.connect("google.com:80");

/// Now you can use the [sock] from earlier, since we can only listen
/// once on a [RawSocket] we must set the [onData] function to intercept 
/// the events from the socket
proxy.subscription.onData((RawSocketEvent event) {
    /// [RawSocketEvent] messages are here
    /// read from here.. 
    if (event == RawSocketEvent.read) {
      final data = sock.read(sock.available());
      ...
    }
});

/// To connect with an [InternetAddress] use:
/// await s.connectIp(InternetAddress.loopbackIPv4, 80);

/// keepOpen=false will call close the [RawSocket]
await proxy.close(keepOpen: false);
0
likes
30
pub points
8%
popularity

Publisher

verified publisherv0l.io

Simple SOCKS5 connection initializer using RawSocket, supports connection requests by Ip and Domain

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on socks5