-
Notifications
You must be signed in to change notification settings - Fork 14
/
forward-proxy
executable file
·37 lines (28 loc) · 1021 Bytes
/
forward-proxy
1
2
3
4
5
6
7
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
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'optparse'
options = {}
OptionParser.new do |parser|
parser.banner = 'Usage: forward-proxy [options]'
parser.on('-pPORT', '--port=PORT', String, 'Bind to specified port. Default: 9292') do |bind_port|
options[:bind_port] = bind_port
end
parser.on('-bBINDING', '--binding=BINDING', String, 'Bind to the specified ip. Default: 127.0.0.1') do |bind_address|
options[:bind_address] = bind_address
end
parser.on('-tTIMEOUT', '--timeout=TIMEOUT', Integer,
'Specify the connection timeout in seconds. Default: 300') do |threads|
options[:timeout] = threads
end
parser.on('-cTHREADS', '--threads=THREADS', Integer,
'Specify the number of client threads. Default: 128') do |threads|
options[:threads] = threads
end
parser.on('-h', '--help', 'Prints this help.') do
puts parser
exit
end
end.parse!
require_relative '../lib/forward_proxy'
server = ForwardProxy::Server.new(options)
server.start