Module: SocketHarness
- Defined in:
- lib/socket_harness.rb,
lib/socket_harness/proxy.rb,
lib/socket_harness/version.rb
Defined Under Namespace
Classes: Proxy
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
Class Method Details
.cli ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/socket_harness.rb', line 8 def self.cli = {} parser = OptionParser.new do |opts| opts. = "Usage: #{$0} [options] remotehost remoteport" opts.version = SocketHarness::VERSION opts.on("-p", "--port PORT", "local port to bind") do |v| [:local_port] = v end opts.on("-b", "--bind ADDRESS", "local address to bind") do |v| [:local_host] = v end opts.on("--block-size NUMBER", "chunck out large data reads. by default 1024 byte") do |v| [:local_host] = v end opts.on("-d", "--delay NUMBER", "delay for client response: 12 will deplay 12ms for package sending back to the client.") do |v| [:delay] = v end end parser.parse! remote_host = ARGV.shift remote_port = ARGV.shift if remote_host.to_s.empty? || remote_port.to_s.empty? puts parser exit 1 end Proxy.new(remote_host, remote_port, ).run end |