Class: SOCKSSocket
- Inherits:
-
TCPSocket
- Object
- IO
- BasicSocket
- IPSocket
- TCPSocket
- SOCKSSocket
- Defined in:
- sockssocket.c,
sockssocket.c
Overview
SOCKS is an Internet protocol that routes packets between a client and a server through a proxy server. SOCKS5, if supported, additionally provides authentication so only authorized users may access a server.
Instance Method Summary collapse
-
#close ⇒ Object
Closes the SOCKS connection.
-
#new(host, port) ⇒ Object
constructor
Opens a SOCKS connection to
host
via the SOCKS server.
Methods inherited from TCPSocket
Methods inherited from IPSocket
#addr, getaddress, #inspect, #peeraddr, #recvfrom
Methods inherited from BasicSocket
#close_read, #close_write, #connect_address, do_not_reverse_lookup, #do_not_reverse_lookup, do_not_reverse_lookup=, #do_not_reverse_lookup=, for_fd, #getpeereid, #getpeername, #getsockname, #getsockopt, #local_address, #read_nonblock, #recv, #recv_nonblock, #recvmsg, #recvmsg_nonblock, #remote_address, #send, #sendmsg, #sendmsg_nonblock, #setsockopt, #shutdown, #write_nonblock
Constructor Details
#new(host, port) ⇒ Object
Opens a SOCKS connection to host
via the SOCKS server.
The SOCKS server configuration varies by implementation
When using the Dante libsocks/libsocksd implementation it is configured as SOCKS_SERVER env var.
See: manpages.debian.org/testing/dante-client/socksify.1.en.html for full env variable support.
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'sockssocket.c', line 27
static VALUE
socks_init(VALUE sock, VALUE host, VALUE port)
{
static int init = 0;
if (init == 0) {
SOCKSinit("ruby");
init = 1;
}
return rsock_init_inetsock(sock, host, port, Qnil, Qnil, INET_SOCKS, Qnil);
}
|
Instance Method Details
#close ⇒ Object
Closes the SOCKS connection.
45 46 47 48 49 50 51 52 53 |
# File 'sockssocket.c', line 45
static VALUE
socks_s_close(VALUE sock)
{
rb_io_t *fptr;
GetOpenFile(sock, fptr);
shutdown(fptr->fd, 2);
return rb_io_close(sock);
}
|