Browse Source

TCP/UDP client

master
Nicolas Vinot 4 years ago
parent
commit
0559ed0597

+ 2
- 0
lib/cryptcheck.rb View File

@@ -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'

+ 1
- 1
lib/cryptcheck/tls/https/server.rb View File

@@ -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)

+ 15
- 1
lib/cryptcheck/tls/server.rb View File

@@ -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

+ 1
- 1
lib/cryptcheck/tls/xmpp/server.rb View File

@@ -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