Class: Ftpd::Protocols
Overview
With the commands EPORT and EPSV, the client sends a protocol code to indicate whether it wants an IPV4 or an IPV6 connection. This class contains functions related to that protocol code.
Defined Under Namespace
Modules: Codes
Constant Summary
Constants included from Codes
Instance Method Summary collapse
-
#initialize(socket) ⇒ Protocols
constructor
A new instance of Protocols.
-
#protocol_codes ⇒ Array<Integer>
What protocol codes does the socket support?.
-
#supports_protocol?(protocol_code) ⇒ Boolean
Can the socket support a connection in the indicated protocol?.
Constructor Details
#initialize(socket) ⇒ Protocols
Returns a new instance of Protocols.
19 20 21 |
# File 'lib/ftpd/protocols.rb', line 19 def initialize(socket) @socket = socket end |
Instance Method Details
#protocol_codes ⇒ Array<Integer>
What protocol codes does the socket support?
35 36 37 38 39 40 |
# File 'lib/ftpd/protocols.rb', line 35 def protocol_codes [ (IPV4 if supports_ipv4?), (IPV6 if supports_ipv6?), ].compact end |
#supports_protocol?(protocol_code) ⇒ Boolean
Can the socket support a connection in the indicated protocol?
27 28 29 |
# File 'lib/ftpd/protocols.rb', line 27 def supports_protocol?(protocol_code) protocol_codes.include?(protocol_code) end |