Module: Ftpd::DataServerFactory
- Defined in:
- lib/ftpd/data_server_factory.rb,
lib/ftpd/data_server_factory/specific_port_range.rb,
lib/ftpd/data_server_factory/random_ephemeral_port.rb
Overview
Factories for creating TCPServer used for passive mode connections.
Defined Under Namespace
Classes: RandomEphemeralPort, SpecificPortRange
Instance Attribute Summary collapse
-
#tcp_server ⇒ Object
readonly
Returns the value of attribute tcp_server.
Class Method Summary collapse
-
.make(interface, ports) ⇒ Object
Create a factory.
Instance Method Summary collapse
Instance Attribute Details
#tcp_server ⇒ Object (readonly)
Returns the value of attribute tcp_server.
12 13 14 |
# File 'lib/ftpd/data_server_factory.rb', line 12 def tcp_server @tcp_server end |
Class Method Details
.make(interface, ports) ⇒ Object
Create a factory.
20 21 22 23 24 25 26 |
# File 'lib/ftpd/data_server_factory.rb', line 20 def self.make(interface, ports) if ports SpecificPortRange.new(interface, ports) else RandomEphemeralPort.new(interface) end end |
Instance Method Details
#initialize(interface, ports) ⇒ Object
32 33 34 35 |
# File 'lib/ftpd/data_server_factory.rb', line 32 def initialize(interface, ports) @interface = interface @ports = ports end |
#make_tcp_server ⇒ TCPServer
38 39 40 |
# File 'lib/ftpd/data_server_factory.rb', line 38 def make_tcp_server TCPServer.new(@interface, 0) end |