irclb 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/LICENSE.md +21 -0
- data/bin/irclb +8 -0
- data/irclb.gemspec +19 -0
- data/lib/irclb/config.rb +20 -0
- data/lib/irclb/runner.rb +0 -0
- data/lib/irclb/ssl_server.rb +38 -0
- data/lib/irclb/version.rb +5 -0
- data/lib/irclb.rb +2 -0
- metadata +53 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ea1863949ecb32fda6fdc7ee8ecda503ff687511493a30c14e89c935586722eb
|
4
|
+
data.tar.gz: 00e09847618d6530f28adacc4202de7084cc07e14c6b7f4a0c9bce20f9cea24a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d3ac3504f2d0893324f086993701493713d95c94ee6ce07d4c0bc0669d6c29d817c8ea656a80a472c9c7dc182514989ee53c6a4cf5da2bde63bfef9f60329a0a
|
7
|
+
data.tar.gz: 4caeed5c3ee9ab3385e840a9355acdc4f40c6d9c197c64b21047c22fe019beb32266e59ddc8a24d4d20fb73ebbe016c3eac6e054d457610d0d794b867228e481
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# MIT LICENSE
|
2
|
+
|
3
|
+
Copyright (c) 2020 IotaSpencer <me@iotaspencer.me>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/bin/irclb
ADDED
data/irclb.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
$:.unshift File.expand_path('../lib', __FILE__)
|
4
|
+
require 'irclb/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'irclb'
|
8
|
+
s.version = IrcLB::VERSION
|
9
|
+
s.authors = ['IotaSpencer']
|
10
|
+
s.email = ['me@iotaspencer.me']
|
11
|
+
s.homepage = 'https://github.com/IotaSpencer/irclb'
|
12
|
+
s.licenses = ['MIT']
|
13
|
+
s.summary = '[summary]'
|
14
|
+
s.description = '[description]'
|
15
|
+
|
16
|
+
s.files = Dir.glob('{bin/*,lib/**/*,[A-Z]*}')
|
17
|
+
s.platform = Gem::Platform::RUBY
|
18
|
+
s.require_paths = ['lib']
|
19
|
+
end
|
data/lib/irclb/config.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module IrcLB
|
6
|
+
class Config
|
7
|
+
def initialize
|
8
|
+
@filename = Pathname.new(Dir.home_dir).join('.irclb.json')
|
9
|
+
begin
|
10
|
+
@config = JSON.parse(IO.read(filename))
|
11
|
+
rescue Errno::ENOENT => e
|
12
|
+
puts "Was not able to load #{@filename}."
|
13
|
+
exit(1)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
attr_reader :config
|
18
|
+
end
|
19
|
+
end
|
20
|
+
$config = IrcLB::Config.new.config
|
data/lib/irclb/runner.rb
ADDED
File without changes
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#! /usr/bin/ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# (c) 2020-
|
5
|
+
# Ken Spencer / 6697
|
6
|
+
|
7
|
+
require 'socket'
|
8
|
+
require 'irclb/config'
|
9
|
+
module IrcLB
|
10
|
+
class Socket
|
11
|
+
def initialize
|
12
|
+
tcp_srv = TCPServer.new 6697
|
13
|
+
ssl_ctx = OpenSSL::SSL::SSLContext.new
|
14
|
+
ssl_ctx.min_version = OpenSSL::SSL::TLS1_1_VERSION
|
15
|
+
ssl_ctx.max_version = OpenSSL::SSL::TLS1_2_VERSION
|
16
|
+
ssl_sock = OpenSSL::SSL::SSLSocket.new(tcp_srv, ssl_ctx)
|
17
|
+
dont_block
|
18
|
+
end
|
19
|
+
|
20
|
+
def dont_block
|
21
|
+
loop do
|
22
|
+
Thread.start(server.accept) do |client|
|
23
|
+
until client.gets =~ /^USER .*/
|
24
|
+
client.puts ":irc.lb NOTICE * :This server is running IRClb, an IRC load balancer\r\n"
|
25
|
+
client.puts ":irc.lb NOTICE * :IRClb is written by Ken Spencer / iota\r\n"
|
26
|
+
client.puts ":irc.lb NOTICE * :He has a website at https://iotaspencer.me\r\n"
|
27
|
+
client.puts ":irc.lb NOTICE * :\r\n"
|
28
|
+
client.puts ":irc.lb NOTICE * :IRClb Support can be found in #irclb on irc.6697.co.uk\r\n"
|
29
|
+
client.puts ":irc.lb NOTICE * :\r\n"
|
30
|
+
client.puts ":irc.lb NOTICE * :With that out of the way, ...\r\n"
|
31
|
+
client.puts ":irc.lb NOTICE * :Connecting you to #{$config.network.name}...\r\n"
|
32
|
+
end
|
33
|
+
client.close if client.gets =~ /^QUIT .*/
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/irclb.rb
ADDED
metadata
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: irclb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- IotaSpencer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-02-23 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: "[description]"
|
14
|
+
email:
|
15
|
+
- me@iotaspencer.me
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- Gemfile
|
21
|
+
- LICENSE.md
|
22
|
+
- bin/irclb
|
23
|
+
- irclb.gemspec
|
24
|
+
- lib/irclb.rb
|
25
|
+
- lib/irclb/config.rb
|
26
|
+
- lib/irclb/runner.rb
|
27
|
+
- lib/irclb/ssl_server.rb
|
28
|
+
- lib/irclb/version.rb
|
29
|
+
homepage: https://github.com/IotaSpencer/irclb
|
30
|
+
licenses:
|
31
|
+
- MIT
|
32
|
+
metadata: {}
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
requirements: []
|
48
|
+
rubyforge_project:
|
49
|
+
rubygems_version: 2.7.6.2
|
50
|
+
signing_key:
|
51
|
+
specification_version: 4
|
52
|
+
summary: "[summary]"
|
53
|
+
test_files: []
|