Class Jabber::Bytestreams::SOCKS5Socket
In: lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb
Parent: TCPSocket
XMLStanza Message Presence Iq REXML::Element X IqQuery Error StreamHost IqSiFileRange IqSiFile StreamHostUsed IqSi XRosterItem RosterItem IqFeature XMUCUserItem XMUCUserInvite Feature Identity Item XDataField XDataReported XDataTitle XDataInstructions IqVcard Singleton IdGenerator Connection Client Component Comparable JID RuntimeError ErrorException AuthenticationFailure SOCKS5Error Stream SOCKS5Bytestreams SOCKS5BytestreamsTarget SOCKS5BytestreamsInitiator SOCKS5BytestreamsServerStreamHost TCPSocket SOCKS5Socket IqQuery IqQueryBytestreams IqQueryVersion IqQueryRoster IqQueryDiscoItems IqQueryDiscoInfo IBB IBBTarget IBBInitiator Responder SimpleResponder X XRoster XMUCUser XMUC XDelay XData MUCClient SimpleMUCClient Base DigestMD5 Plain FileSource StreamParser SOCKS5BytestreamsPeer SOCKS5BytestreamsServer IBBQueueItem Helper MUCBrowser Helper Helper lib/xmpp4r/authenticationfailure.rb lib/xmpp4r/idgenerator.rb lib/xmpp4r/connection.rb lib/xmpp4r/iq.rb lib/xmpp4r/jid.rb lib/xmpp4r/xmlstanza.rb lib/xmpp4r/errorexception.rb lib/xmpp4r/stream.rb lib/xmpp4r/client.rb lib/xmpp4r/streamparser.rb lib/xmpp4r/x.rb lib/xmpp4r/error.rb lib/xmpp4r/component.rb lib/xmpp4r/query.rb lib/xmpp4r/message.rb lib/xmpp4r/presence.rb lib/xmpp4r/bytestreams/helper/ibb/initiator.rb lib/xmpp4r/bytestreams/iq/si.rb lib/xmpp4r/bytestreams/iq/bytestreams.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb lib/xmpp4r/bytestreams/helper/ibb/base.rb lib/xmpp4r/bytestreams/helper/ibb/target.rb Bytestreams lib/xmpp4r/version/iq/version.rb lib/xmpp4r/version/helper/responder.rb lib/xmpp4r/version/helper/simpleresponder.rb Version lib/xmpp4r/roster/helper/roster.rb lib/xmpp4r/roster/iq/roster.rb lib/xmpp4r/roster/x/roster.rb Roster lib/xmpp4r/feature_negotiation/iq/feature.rb FeatureNegotiation lib/xmpp4r/muc/x/muc.rb lib/xmpp4r/muc/helper/mucclient.rb lib/xmpp4r/muc/x/mucuseritem.rb lib/xmpp4r/muc/helper/mucbrowser.rb lib/xmpp4r/muc/x/mucuserinvite.rb lib/xmpp4r/muc/helper/simplemucclient.rb MUC lib/xmpp4r/sasl.rb SASL lib/xmpp4r/delay/x/delay.rb Delay lib/xmpp4r/bytestreams/helper/filetransfer.rb TransferSource FileTransfer lib/xmpp4r/discovery/iq/discoinfo.rb lib/xmpp4r/discovery/iq/discoitems.rb Discovery lib/xmpp4r/dataforms/x/data.rb Dataforms lib/xmpp4r/vcard/helper/vcard.rb lib/xmpp4r/vcard/iq/vcard.rb Vcard Jabber Module: Jabber

A SOCKS5 client implementation

Usage:

  • Initialize with proxy’s address and port
  • Authenticate
  • Connect to target host

Methods

auth   connect_domain   new  

Public Class methods

Connect to SOCKS5 proxy

[Source]

    # File lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb, line 20
20:       def initialize(socks_host, socks_port)
21:         super(socks_host, socks_port)
22:       end

Public Instance methods

Authenticate for SOCKS5 proxy

Currently supports only ‘no authentication required’

[Source]

    # File lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb, line 28
28:       def auth
29:         write("\x05\x01\x00")
30:         buf = read(2)
31:         if buf.nil? or buf != "\x05\x00"
32:           close
33:           raise SOCKS5Error.new("Invalid SOCKS5 authentication: #{buf.inspect}")
34:         end
35: 
36:         self
37:       end

Issue a CONNECT request to a host name which is to be resolved by the proxy.

domain:[String] Host name
port:[Fixnum] Port number

[Source]

    # File lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb, line 44
44:       def connect_domain(domain, port)
45:         write("\x05\x01\x00\x03#{domain.size.chr}#{domain}#{[port].pack("n")}")
46:         buf = read(7 + domain.size)
47:         if buf.nil? or buf[0..1] != "\005\000"
48:           close
49:           raise SOCKS5Error.new("Invalid SOCKS5 connect: #{buf.inspect}")
50:         end
51: 
52:         self
53:       end

[Validate]