Class: IPAccess::TCPServer
- Inherits:
-
TCPServer
- Object
- TCPServer
- IPAccess::TCPServer
- Includes:
- Patches::TCPServer
- Defined in:
- lib/ipaccess/ghost_doc/ghost_doc_sockets.rb,
lib/ipaccess/socket.rb
Overview
TCPServer class with IP access control. It uses input access lists.
This class acts the same way as TCPServer 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 TCPServer class, just the patched variants that make use of IP access control.
Example
require 'ipaccess/socket' # load sockets subsystem
serv = IPAccess::TCPServer.new(31337) # create listening TCP socket
serv.acl = :private # create and use private access set
serv.blacklist :local, :private # block local and private IP addresses
serv.permit '127.0.0.5' # make an exception
puts serv.acl.show # show listed IP addresses
sock = serv.sysaccept # accept connection
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.
-
#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!
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.
556 557 558 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 556 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.
567 568 569 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 567 def acl_recheck # Real code hidden. end |
#blacklist ⇒ Object Also known as: add_black, deny, block
:include:ghost_doc_p_blacklist.rb
508 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 508 def blacklist; end |
#blacklist! ⇒ Object Also known as: add_black!, deny!, block!
:include:ghost_doc_p_blacklist_e.rb
505 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 505 def blacklist!; end |
#unblacklist ⇒ Object Also known as: unblock, del_black
:include:ghost_doc_p_unblacklist.rb
520 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 520 def unblacklist; end |
#unblacklist! ⇒ Object Also known as: unblock!, del_black!
:include:ghost_doc_p_unblacklist_e.rb
517 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 517 def unblacklist!; end |
#unwhitelist ⇒ Object Also known as: del_white
:include:ghost_doc_p_unwhitelist.rb
514 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 514 def unwhitelist; end |
#unwhitelist! ⇒ Object Also known as: del_white!
:include:ghost_doc_p_unwhitelist_e.rb
511 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 511 def unwhitelist!; end |
#whitelist ⇒ Object
:include:ghost_doc_p_whitelist.rb
502 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 502 def whitelist; end |
#whitelist! ⇒ Object
:include:ghost_doc_p_whitelist_e.rb
499 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_sockets.rb', line 499 def whitelist!; end |