Class: SOCKSSocket
- Defined in:
- ext/socket/sockssocket.c,
ext/socket/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 included from CoreExtensions::TCPSocketExt
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
Methods inherited from IO
#beep, #check_winsize_changed, #clear_screen, console, #console_mode, #console_mode=, #cooked, #cooked!, #cursor, #cursor=, #cursor_down, #cursor_left, #cursor_right, #cursor_up, default_console_size, #echo=, #echo?, #erase_line, #erase_screen, #expect, #getch, #getpass, #goto, #goto_column, #iflush, io_maybe_wait, io_maybe_wait_readable, io_maybe_wait_writable, io_wait, #ioflush, #noecho, #nonblock, #nonblock=, #nonblock?, #nread, #oflush, #pathconf, #pressed?, #raw, #raw!, #ready?, #scroll_backward, #scroll_forward, thread_fd_close, thread_fd_wait, thread_fd_writable, #wait, #wait_priority, #wait_readable, #wait_writable, #winsize, #winsize=
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 'ext/socket/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, Qnil);
}
|
Instance Method Details
#close ⇒ Object
Closes the SOCKS connection.
45 46 47 48 49 50 51 52 53 |
# File 'ext/socket/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);
}
|