class

SOCKS::Client

Inherits IO < Reference < Object

Constructors

new(host : String, port : Int32, dns_resolver : DNS::Resolver, options : Options, timeout : TimeOut = TimeOut.new)
Source
new(outbound : IO, options : Options)
Source
new(ip_address : Socket::IPAddress, options : Options, timeout : TimeOut = TimeOut.new)
Source

Instance methods

__transfer_before_call
Source
__transfer_extra_received_bytes
Source
__transfer_extra_sent_bytes
Source
authenticate_frame
Source
authenticate_frame=(value : Frames::Authenticate)
Source
authentication_methods
Source
authentication_methods=(value : Array(Frames::AuthenticationFlag))
Source
authentication_methods=(value : Set(Frames::AuthenticationFlag))
Source
authentication_methods=(value : Frames::AuthenticationFlag)
Source
close

Closes this IO.

IO defines this is a no-op method, but including types may override.

Source
close_forwarder(reset : Bool = true)
Source
closed?

Returns true if this IO is closed.

IO defines returns false, but including types may override.

Source
connection_identifier
Source
connection_identifier=(value : UUID)
Source
connection_pause_pending=(value : Bool | Nil)
Source
connection_pause_pending?
Source
establish!(dns_resolver : DNS::Resolver, command_flag : Frames::CommandFlag, host : String, port : Int32, remote_dns_resolution : Bool = true)
Source
establish!(dns_resolver : DNS::Resolver, command_flag : Frames::CommandFlag, destination_address : Socket::IPAddress | Address, remote_dns_resolution : Bool = true) : Frames::Establish | Nil
Source
flush

Flushes buffered data, if any.

IO defines this is a no-op method, but including types may override.

Source
handshake!
Source
last_alive_time
Source
notify_peer_incoming
Source
notify_peer_negotiate(source : IO, command_flag : SOCKS::Enhanced::CommandFlag | Nil = nil) : SOCKS::Enhanced::CommandFlag | Nil
Source
options
Source
outbound
Source
outbound=(outbound : IO)
Source
process_upgrade!(state : SOCKS::Enhanced::State | Nil = nil)
Source
read(slice : Bytes) : Int32

Reads at most slice.size bytes from this IO into slice. Returns the number of bytes read, which is 0 if and only if there is no more data to read (so checking for 0 is the way to detect end of file).

io = IO::Memory.new "hello"
slice = Bytes.new(4)
io.read(slice) # => 4
slice          # => Bytes[104, 101, 108, 108]
io.read(slice) # => 1
slice          # => Bytes[111, 101, 108, 108]
io.read(slice) # => 0
Source
resynchronize(command_flag : Frames::CommandFlag) : Frames::Establish | Nil
Source
tcp_forwarder
Source
tcpForwarder
Source
tcpForwarder=(tcpForwarder : Layer::TCPBinding | Nil)
Source
udp_forwarder
Source
udpForwarder
Source
udpForwarder=(udpForwarder : Layer::AssociateUDP | Nil)
Source
version
Source
version=(value : Frames::VersionFlag)
Source
wrapper
Source
wrapper=(value : Options::Client::Wrapper)
Source
wrapper_authorize
Source
wrapper_authorize=(value : Frames::Authorize)
Source
write(slice : Bytes) : Nil

Writes the contents of slice into this IO.

io = IO::Memory.new
slice = Bytes.new(4) { |i| ('a'.ord + i).to_u8 }
io.write(slice)
io.to_s # => "abcd"
Source