Sha256: 661e7e2bd6e7f24c5cbfae2054a53aa1bc3ff2cc04224a90d4715b785a7d571d

Contents?: true

Size: 1.91 KB

Versions: 2

Compression:

Stored size: 1.91 KB

Contents

# RProxy

a powerful ruby http proxy server, base on eventmachine

able to run in multi-process like nginx workers
## Installation

Add this line to your application's Gemfile:

```ruby
gem 'r_proxy'
```

And then execute:

    $ bundle install

Or install it yourself as:

    $ gem install r_proxy

## Usage

##### Currently only support `BSD` and `MacOS`

Http and Https proxy server

integrated with Redis, if you enable auth then you must provide redis url
to let server connect to redis.

e.g: `server.set(:redis_url, "redis://@localhost:6379/1")`

redis key rule: `proxy:username-password`

redis value rule: `integer string` e.g: `1234567`

the value describe how many bytes that user can use. 

`unit: bytes`

```ruby
require 'r_proxy'

server = RProxy::MasterProcess.new

server.set(:host, '127.0.0.1')
server.set(:port, 8080)

# set how many instances process that you want to run.
# master process will looking after those process,
# if any of them exit, will auto re-create new instance.
# if want to quit all, just kill master process.
server.set(:instances, 3)

# if disable_auth is true
# then server will not auth user and password
# server.set(:disable_auth, true)

# if disable unbind cb, then it mean
# server will not decrby usage for user
# server.set(:disable_unbind_cb, true)

# default is true 
server.set(:enable_ssl, true) 

server.set(:callback_url,'http://127.0.0.1:1234')

server.set(:redis_url, "redis://@localhost:6379/1")

server.set(:ssl_private_key, './server_key.txt')
server.set(:ssl_cert, './server_cert.txt')

server.set(:logger, Logger.new(STDOUT))
# logger output like:
# I, [2020-05-08T21:04:00.492477 #86348]  INFO -- : r_proxy @1588935840 process start....
# I, [2020-05-08T21:04:21.534989 #87168]  INFO -- : r_proxy rebuild new instance replace @1588935861....

# call run to start server
server.run!
```

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/nickoan/r_proxy.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
r_proxy-0.2.3 README.md
r_proxy-0.2.2 README.md