Browse Source

TCP/UDP client

v1
Nicolas Vinot 7 years ago
parent
commit
0559ed0597
  1. 2
      lib/cryptcheck.rb
  2. 2
      lib/cryptcheck/tls/https/server.rb
  3. 16
      lib/cryptcheck/tls/server.rb
  4. 2
      lib/cryptcheck/tls/xmpp/server.rb

2
lib/cryptcheck.rb

@ -1,6 +1,8 @@
module CryptCheck
module Tls
autoload :Server, 'cryptcheck/tls/server'
autoload :TcpServer, 'cryptcheck/tls/server'
autoload :UdpServer, 'cryptcheck/tls/server'
autoload :TlsNotSupportedServer, 'cryptcheck/tls/server'
autoload :Grade, 'cryptcheck/tls/grade'
autoload :TlsNotSupportedGrade, 'cryptcheck/tls/grade'

2
lib/cryptcheck/tls/https/server.rb

@ -5,7 +5,7 @@ require 'httparty'
module CryptCheck
module Tls
module Https
class Server < Tls::Server
class Server < Tls::TcpServer
attr_reader :hsts
def initialize(hostname, port=443)

16
lib/cryptcheck/tls/server.rb

@ -153,7 +153,7 @@ module CryptCheck
private
def connect(family, host, port, &block)
socket = ::Socket.new family, ::Socket::SOCK_STREAM
socket = ::Socket.new family, sock_type
sockaddr = ::Socket.sockaddr_in port, host
@log.debug { "Connecting to #{host}:#{port}" }
begin
@ -303,5 +303,19 @@ module CryptCheck
store.verify cert
end
end
class TcpServer < Server
private
def sock_type
::Socket::SOCK_STREAM
end
end
class UdpServer < Server
private
def sock_type
::Socket::SOCK_DGRAM
end
end
end
end

2
lib/cryptcheck/tls/xmpp/server.rb

@ -9,7 +9,7 @@ module CryptCheck
TLS_NAMESPACE = 'urn:ietf:params:xml:ns:xmpp-tls'
RESOLVER = Resolv::DNS.new
class Server < Tls::Server
class Server < Tls::TcpServer
attr_reader :domain
def initialize(domain, type=:s2s, hostname: nil)

Loading…
Cancel
Save