Class: IPAccess::TCPSocket
- Inherits:
-
TCPSocket
- Object
- TCPSocket
- IPAccess::TCPSocket
- Includes:
- Patches::TCPSocket
- Defined in:
- lib/ipaccess/ghost_doc/ghost_doc_sockets.rb,
lib/ipaccess/socket.rb
Overview
TCPSocket class with IP access control. It uses output access lists.
This class acts the same way as TCPSocket class but provides special member called acl and a few new instance methods for controlling IP access.
:include:ghost_doc_patched_usage.rb
This documentation doesn’t cover description of all class and instance methods of the original TCPSocket class, just the patched variants that make use of IP access control.
Example
require 'ipaccess/socket' # load sockets subsystem
acl_set = IPAccess::Set.new # create shared access set
acl_set.output.block 'randomseed.pl' # block connections to this host
socket = IPAccess::TCPSocket.new('randomseed.pl', 80)
Instance Attribute Summary collapse
-
#acl ⇒ Object
This member keeps the information about currently used access set.
Attributes included from Patches::ACL
Instance Method Summary collapse
-
#acl_recheck ⇒ Object
This method allows you to re-check access on demad.
-
#blacklist ⇒ Object
(also: #add_black, #deny, #block)
:include:ghost_doc_p_blacklist.rb.
-
#blacklist! ⇒ Object
(also: #add_black!, #deny!, #block!)
:include:ghost_doc_p_blacklist_e.rb.
-
#initialize ⇒ TCPSocket
constructor
:call-seq: new(addr, port)
{|socket| …}<br /> new(addr, port, acl){|socket| …}. -
#unblacklist ⇒ Object
(also: #unblock, #del_black)
:include:ghost_doc_p_unblacklist.rb.
-
#unblacklist! ⇒ Object
(also: #unblock!, #del_black!)
:include:ghost_doc_p_unblacklist_e.rb.
-
#unwhitelist ⇒ Object
(also: #del_white)
:include:ghost_doc_p_unwhitelist.rb.
-
#unwhitelist! ⇒ Object
(also: #del_white!)
:include:ghost_doc_p_unwhitelist_e.rb.
-
#whitelist ⇒ Object
:include:ghost_doc_p_whitelist.rb.
-
#whitelist! ⇒ Object
:include:ghost_doc_p_whitelist_e.rb.
Methods included from Patches::ACL
#__ipa_wrap_socket_call, #blacklist_reasonable, #blacklist_reasonable!, #close_on_deny, #close_on_deny=, #default_list, #terminate, #valid_acl?, #whitelist_reasonable, #whitelist_reasonable!
Constructor Details
#initialize ⇒ TCPSocket
:call-seq:
new(addr, port) <tt>{|socket| …}</tt><br />
new(addr, port, acl) <tt>{|socket| …}</tt>
Creates a new object and attempts to connect to the host and port. If a block is provided, it is yielded as socket object. It optionally sets an access set given as the last parameter or as ACL member of opts. The access set given as an argument has precedence over access set given in options. If ACL parameter is not given it defaults to ACL to IPAccess::Set.Global.
447 448 449 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 447 def initialize # Real code hidden. end |
Instance Attribute Details
#acl ⇒ Object
This member keeps the information about currently used access set. You may use it to do low-level operations on IPAccess::Set object associated with instance. You cannot however call any of global access set operations – to do that use IPAccess::Set.Global contant referencing to global ACL.
432 433 434 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 432 def acl @acl end |
Instance Method Details
#acl_recheck ⇒ Object
This method allows you to re-check access on demad. It uses internal socket’s address and access set assigned to an object. It will close your communication session before throwing an exception in case of denied access – you can prevent it by setting the flag opened_on_deny to true. The flag can be set while initializing object (through argument :opened_on_deny) or by setting the attribute.
460 461 462 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 460 def acl_recheck # Real code hidden. end |
#blacklist ⇒ Object Also known as: add_black, deny, block
:include:ghost_doc_p_blacklist.rb
378 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 378 def blacklist; end |
#blacklist! ⇒ Object Also known as: add_black!, deny!, block!
:include:ghost_doc_p_blacklist_e.rb
375 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 375 def blacklist!; end |
#unblacklist ⇒ Object Also known as: unblock, del_black
:include:ghost_doc_p_unblacklist.rb
390 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 390 def unblacklist; end |
#unblacklist! ⇒ Object Also known as: unblock!, del_black!
:include:ghost_doc_p_unblacklist_e.rb
387 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 387 def unblacklist!; end |
#unwhitelist ⇒ Object Also known as: del_white
:include:ghost_doc_p_unwhitelist.rb
384 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 384 def unwhitelist; end |
#unwhitelist! ⇒ Object Also known as: del_white!
:include:ghost_doc_p_unwhitelist_e.rb
381 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 381 def unwhitelist!; end |
#whitelist ⇒ Object
:include:ghost_doc_p_whitelist.rb
372 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 372 def whitelist; end |
#whitelist! ⇒ Object
:include:ghost_doc_p_whitelist_e.rb
369 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 369 def whitelist!; end |