A simple, non-allocating SOCKS 5/4/4a client library for Zig
Tested against Zig 0.13.x
- Protocol version 5
- CONNECT command
- BIND command
- UDP ASSOCIATE command
- Password authentication
- IPv4 address
- IPv6 address
- hostname address
- Protocol version 4 and 4a
- CONNECT command
- BIND command
- IPv4 address
- hostname address
- Remote DNS lookups
conststd=@import("std");
constSocksv5=@import("socks.zig").Socksv5;
pubfnmain() !void {
constproxy=trystd.net.Address.parseIp4("127.0.0.1", 1080);
conststream=trySocksv5.connect(proxy, null, "www.google.com", 80);
deferstream.close();
// read/write to stream...
}or
vargpa=GeneralPurposeAllocator(.{})();
constallocator=gpa.allocator();
conststream=trystd.net.tcpConnectToHost(allocator, "localhost", 1080);
deferstream.close();
// use the generic interface - should work with any std.io.Reader and std.io.WritertrySocksv5.client(stream.reader(), stream.writer(), null, "www.google.com", 80);
// read/write to stream...