Sha256: c22ba8c50dd7fb25ad5fd5de961dd4701ced29f9124975e99f8f2706a0ec7370

Contents?: true

Size: 901 Bytes

Versions: 1

Compression:

Stored size: 901 Bytes

Contents

=begin
                  Arachni-RPC
  Copyright (c) 2011 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>

  This is free software; you can copy and distribute and modify
  this program under the term of the GPL v2.0 License
  (See LICENSE file for details)

=end

module Arachni
module RPC
module EM

#
# Helper methods to be included in EventMachine::Connection classes
#
# @author: Tasos "Zapotek" Laskos
#                                      <tasos.laskos@gmail.com>
#                                      <zapotek@segfault.gr>
# @version: 0.1
#
module ConnectionUtilities

    #
    # @return   [String]    IP address of the client
    #
    def peer_ip_addr
        begin
            if peername = get_peername
                Socket.unpack_sockaddr_in( peername )[1]
            else
                'n/a'
            end
        rescue
            'n/a'
        end
    end

end

end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
arachni-rpc-em-0.1 lib/arachni/rpc/em/connection_utilities.rb